30-09-2011, 18:41
|
|
|
חבר מתאריך: 10.06.11
הודעות: 34
|
|
צריך את עזרתכם במציאת באג מסויים
אני יוצר ProcessStartInfo ןמריץ קובץ מסויים מהמחשב, אני קולט את מה שזה מחזיר ומדפיס, אם אני מריץ את זה בעזרת CMD זה מדפיס לי הודעות מסויימות ואותם אני קולט בתוכנית ומדפיס, כשאני מריץ את התוכנית (איזשהו קובץ exe) אני רושם אחרי זה Path מסויים של קובץ אבל הבעיה היא שאם בשם של אותו הקובץ יש רווחים התוכנית לא מדפיסה כלום בניגוד לזה שאם שוב אני עושה את זה בעזרת CMD אין בעיה והכל עובד.
הנה הקוד שלי:
קוד:
Process Capinfos = new Process();
ProcessStartInfo ps1 = new ProcessStartInfo(@"C:\Program Files\Wireshark\capinfos.exe", @"D:\Downloads\10_attach_Copy.snoop");
ps1.RedirectStandardOutput = true;
ps1.RedirectStandardError = true;
ps1.WindowStyle = ProcessWindowStyle.Hidden;
ps1.CreateNoWindow = false;
ps1.UseShellExecute = false;
ps1.ErrorDialog = false;
Capinfos.StartInfo = ps1;
Capinfos.Start();
StreamReader myStreamReader = Capinfos.StandardOutput;
String result = myStreamReader.ReadLine();
Console.WriteLine(result);
string[] array = new string[18];
for (int i = 0; i < array.Length; i++)
{
array[i] = myStreamReader.ReadLine();
}
Console.WriteLine(array[0]);
Console.WriteLine(array[4]);
Console.WriteLine(array[5]);
Console.WriteLine(array[7]);
אם למשל בארגומנט שאני שולח לתוכנית (אחרי ה-Path של קובץ ה-exe) היה את השם ללא הסימן "_" זה אז לא היה מדפיס לי כלום:
קוד:
ProcessStartInfo ps1 = new ProcessStartInfo(@"C:\Program Files\Wireshark\capinfos.exe", @"D:\Downloads\10_attach Copy.snoop");
|