Well something is wrong with the parameters I give....but I don't know what. When I start debugging this line: Zip.StartInfo.Arguments = "a \"" + Path.GetFileName(zipName) + "\" \"" + ZipFile + "\" \"" + newDir + "\"";
looks like: a "DC2tempDir.zip" "C:\OutputDirectory\temp\P1010827.JPG" "C:\OutputDirectory\01\01.A\"
What I'm trying to do is creating a new zip file in "C:\OutputDirectory\01\01.A\"
with the name "DC2tempDir.zip"
. The content of the zip file must be the .jpg file in the temp dir. Is there something that I'm doing wrong here? (I'm using WinRAR btw.)
JustRonald
Posts
-
Zip and Unzip using Proces.StartInfo -
Zip and Unzip using Proces.StartInfoHi, I need to unzip and zip files using WinRAR in my C# application. The unzip part is complete and 100% working but I'm not getting the zip function to work. Below you see my zip function:
Process Unzip = new Process();
Unzip.StartInfo.Arguments = "x -p" + txtPassword.Text + " \"" + ZipFile + "\" \"" + outputDirectory + "\\temp\"";
Unzip.StartInfo.CreateNoWindow = false;
Unzip.StartInfo.FileName = rarName;
Unzip.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
Unzip.StartInfo.WorkingDirectory = rarDirectory;
Unzip.Start();
Unzip.WaitForExit();
Unzip.Close();
Unzip.Dispose();To zip the files that are in the outputDirectory (C:\outputDirectory\temp) I have the same as the zip function. Only the Atguments are different:
Zip.StartInfo.Arguments = "a \"" + Path.GetFileName(zipName) + "\" \"" + ZipFile + "\" \"" + newDir + "\"";
For some reason he is unzipping the files but is not creating a zip file. Can anyone help me with this?
-
ICSharpZipLib remove passwordHi, I have a directory which contains multiple sub directories. Inside those sub-directories are zip files protected by a password. The password for all the zip files (156) are the same. Is it possible with C# DotNet and the ICSharpZipLib to remove the passwords? So not unzip it, only remove the passwords.... Any help would be greatly appriciated!
-
System.Net.Mail problemAh ok... But it's not possible to get the hostname/address from the SMTP server in C#?
-
System.Net.Mail problemThank you! I changed "localhost" to "ExchangeServer" (our local mail server) and it worked. But if the application is running on a computer outside our network, the SMTP host will be different. So is there a way to determine the SMTP host address/name of the current computer/user?
-
System.Net.Mail problemHi, I'm trying to create a function that will automaticly send me the errors of the application using the MailMessage function from the namespace: System.Net.Mail. This is the code I have now but for some reason it aint working. It gives me the following error (sorry it's in dutch): "Postbus niet beschrikbaar. Het serverantwoord is: 5.7.1 Unable to relay for email@company.nl"
try
{
MailMessage message = new MailMessage();message.From = new MailAddress("info@company.nl", "Application AutoEmail", System.Text.Encoding.UTF8); message.To.Add(new MailAddress("email@company.nl")); message.Subject = "Application error"; message.Body = "This is the content..."; message.Priority = MailPriority.Normal; SmtpClient client = new SmtpClient(); client.Host = "localhost"; client.Port = 25; client.Send(message); MessageBox.Show("Your email has succesfully been send.", "Email send");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Error");
}What am I doing wrong?
-
C# using COM to communicate with VBHi, I have a VB application with a button. When I click on that button it must show a windows form application that is made in C#. How could this be done? I've heard something about COM object:
ComSourceInterfaces
And something about making an interface class file...something like:[InterfaceType(ComInterfaceType.InterfaceIsIDispatch)] public interface _InterfaceClient { //Something... }
Is this the correct way? If so, does anyone have an good example? Thanks, -
base64BinaryThe WSDL file needs
<FileData>base64Binary</FileData>
but I'm not sure how to convert my data from string to base64Binary. So I wrote the following:string FileDataBase64Binary;
SoapBase64Binary base64Binary;
FileDataBase64Binary = "???";
base64Binary = SoapBase64Binary.Parse(FileDataBase64Binary);
request.FileData = base64Binary;Still not sure what must come by
FileDataBase64Binary = "???";
Hope someone can explain to me how to do this? The files I need to send to the webservice are .zip files containing one .txt file. -
base64BinaryI am trying to create an application that will talk with a webservice. This webservice needs the following information:
<request> <EmailAddress>string</EmailAddress> <Filename>string</Filename> <FileData>base64Binary</FileData> </request>
So I wrote the following:
string FileDataBase64Binary;
SoapBase64Binary base64Binary;
FileDataBase64Binary = "???";
base64Binary = SoapBase64Binary.Parse(FileDataBase64Binary);
request.FileData = base64Binary;What should be the right code? Any help would be greatly appriciated.
-
MTOMYes...I suppose you understand me. I did figure the following out:
/* DECALRATIE */
string EmailAddress;
string Filename;
string FileDataBase64Binary;
SoapBase64Binary base64Binary;
MTOMDummy AddFileService;/* INITIALISATIE */
EmailAddress = "email@secret.nl";
Filename = "declaratie1.zip";
FileDataBase64Binary = "AgMFBws=";
base64Binary = SoapBase64Binary.Parse(FileDataBase64Binary);
AddFileService = new MTOMDummy();AddFileRequestType request = new AddFileRequestType();
request.EmailAddress = EmailAddress;
request.Filename = Filename;
request.FileData = base64Binary;/* CALLING WEBSERVICE */
AddFileService.AddFile(request);Now is the object "request" filled with the email address, filename but not the filedata. The code above gives me the following error:
Cannot implicitly convert type 'System.Runtime.Remoting.Metadata.W3cXsd2001.SoapBase64Binary' to 'byte[]'
Any idea how to fill the "request.FileData" in the correct way? -
MTOMHi, I have a Windows Application which should send data to a Webservice. I've added the URL of the Webservice (Add Web Reference...) to my project. I've also added the .cs file of the Webservice in my project. This is from the Webservice:
POST /webservices/MTomTest/Mtomdummy.asmx HTTP/1.1
Host: secret.nl
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
soap12:Body
<AddFile xmlns="http://www.secret.nl/MTOMTest/v1">
<request>
<EmailAddress>string</EmailAddress>
<Filename>string</Filename>
<FileData>base64Binary</FileData>
</request>
</AddFile>
</soap12:Body>
</soap12:Envelope>Based on what he needs (EmailAddress, Filename, FileData) I wrote the following:
/* DECALRATIE */
string EmailAddress;
string Filename;
string FileDataBase64Binary;
SoapBase64Binary base64Binary;
MTOMDummy AddFileService;/* INITIALISATIE */
EmailAddress = "email@secret.nl";
Filename = "TestDeclaratie.zip";
FileDataBase64Binary = "AgMFBws=";
base64Binary = SoapBase64Binary.Parse(FileDataBase64Binary);
AddFileService = new MTOMDummy();AddFileRequestType request = new AddFileRequestType();
//request.EmailAddress ;
//requestFilename = ;
//request.FileData = ;/* CODE */
//AddFileService.AddFile(AddFileRequestType request);
//AddFileService.AddFile(?????????);The webmethod is called "AddFile" which I can call by using: AddFileService.AddFile(); I only need to know what should give as parameters for the "AddFile" webmethod? Any help would be greatly appriciated. Regards, Ronald
-
Zip multiple filesHi, I created an application which will zip .txt files into .zip For each textfile I selected in my listbox it creates one zip file. But I want to modify it now so all files I select would come in one zip file. This is a part of my form.cs file:
public Form1()
{
InitializeComponent();
listBox1.SelectionMode = SelectionMode.MultiExtended;
listBox1.DataSource = ClassFile.GetFiles(@"C:\");
}private void button1_Click(object sender, EventArgs e)
{
/* Declaratie */
ArrayList bestanden;
string StoragePath;
string OldFile;
string NewFile;
string[] split;
int i;/\* Initialisatie \*/ bestanden = new ArrayList(); StoragePath = @"C:\\"; /\* Code \*/ for (i = 0; i < listBox1.SelectedItems.Count; i++) { split = listBox1.SelectedItems\[i\].ToString().Split('.'); bestanden.Add(split\[0\]); } listBox2.Items.Clear(); foreach (string bestand in bestanden) { OldFile = StoragePath + bestand + ".txt"; NewFile = StoragePath + bestand + ".zip"; listBox2.Items.Add("Tekst bestand: " + OldFile); ClassFile.FileToZip(StoragePath, OldFile, NewFile); if (ClassFile.Overschijven == true) { listBox2.Items.Add("ZIP conversie succesvol: " + NewFile); } else { listBox2.Items.Add("ZIP conversie mislukt: " + OldFile); } }
}
This is my class file:
public ArrayList GetFiles(string dir)
{
/* Declaratie */
ArrayList list;
DirectoryInfo di;
FileInfo[] rgFiles;/\* Initialisatie \*/ list = new ArrayList(); di = new DirectoryInfo(dir); rgFiles = di.GetFiles("\*.txt"); /\* Code \*/ foreach(FileInfo fi in rgFiles) { list.Add(fi.Name); } return list; } public void FileToZip(string zipFileStoragePath, string fileToCompress, string zipFileName) { // Controle of het bestand wel bestaat if (File.Exists(fileToCompress) == false) { MessageBox.Show("Bestand niet gevonden.", "Fout", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { // Controle of het zip bestand al bestaat if (File.Exist
-
Chart option by Crystal Reports disabledHi, I made an ASP.NET website with a Crystal Report. Now I want to use the Chart option by Insert, but it is disabled. I'm using Visual Studio 2005 with the 2.0 .NET framework. If there is anyone out there who can help me...please! Thanks
-
Access audio files from resourcesHi, I have a problem with retrieving a wav file from the Resources folder. The wav is file has it build action stands on Embedded Resource. I thought to acces a png file I can use:
Bitmap bm = new Bitmap(GetType().Assembly.GetManifestResourceStream("image.png"));
So what to use to access a .wav file?Stream wav = System.Reflection.Assembly.GetManifestResourceStream("attention.wav");
? Thanks -
GetManifestResource problemHello, I'm building an application which has an option to play a sound with the extern PlaySound method. With the code below the PlaySound method is working
string fileName = @"C:\Documents and Settings\User\My documents\Visual Studio 2005\Projects\Alarm\Alarm\Resources\attention.wav"; PlaySound(fileName, 0, 1);
If I execute the program on an other computer the path will be different. So I need an function that will get the .wav file from my folder Resources. The standard way to access an embedded resource is to use the Assembly class's GetManifestResource* methods. But I can't get it to work properly. This is proberly a very stupid question but i'm just a beginner and can't figure it out. Can someone please help me out? Thanks