Пример #1
0
 public static byte[] DeflaterExpand(byte[] compressedData)
 {
     try
     {
         return(DeflaterExpandInternal(false, compressedData));
     }
     catch (Exception exception)
     {
         Comman.WriteLog("The content could not be decompressed.\n\n" + exception.Message + "Fiddler: Inflation failed");
         return(new byte[0]);
     }
 }
Пример #2
0
 public static bool RunExecutable(string sExecute, string sParams)
 {
     try
     {
         using (Process.Start(sExecute, sParams))
         {
         }
         return(true);
     }
     catch (Exception exception)
     {
         Comman.WriteLog(string.Format("Failed to execute: {0}\nwith parameters: {1}\r\n\r\n{2}\r\n{3}", new object[] { sExecute, sParams, exception.Message, exception.StackTrace.ToString() }) + "ShellExecute Failed");
     }
     return(false);
 }
Пример #3
0
 //[CodeDescription("ShellExecutes the sURL.")]
 public static bool LaunchHyperlink(string sURL)
 {
     try
     {
         using (Process.Start(sURL))
         {
         }
         return(true);
     }
     catch (Exception exception)
     {
         Comman.WriteLog("Your web browser is not correctly configured to launch hyperlinks.\n\nTo see this content, visit:\n\t" + sURL + "\n...in your web browser.\n\nError: " + exception.Message + "Error");
     }
     return(false);
 }
Пример #4
0
 ////[CodeDescription("Returns a byte[] containing a gzip-compressed copy of writeData[]")]
 public static byte[] GzipCompress(byte[] writeData)
 {
     try
     {
         MemoryStream inner = new MemoryStream();
         using (GZipCompressedStream stream2 = new GZipCompressedStream(inner))
         {
             stream2.Write(writeData, 0, writeData.Length);
         }
         return(inner.ToArray());
     }
     catch (Exception exception)
     {
         Comman.WriteLog("The content could not be compressed.\n\n" + exception.Message + "Fiddler: GZip failed");
         return(writeData);
     }
 }
Пример #5
0
 //[CodeDescription("Run an executable and wait for it to exit.")]
 public static bool RunExecutableAndWait(string sExecute, string sParams)
 {
     try
     {
         Process process = new Process();
         process.StartInfo.UseShellExecute        = false;
         process.StartInfo.RedirectStandardOutput = false;
         process.StartInfo.RedirectStandardError  = false;
         process.StartInfo.CreateNoWindow         = true;
         process.StartInfo.FileName  = sExecute;
         process.StartInfo.Arguments = sParams;
         process.Start();
         process.WaitForExit();
         process.Dispose();
         return(true);
     }
     catch (Exception exception)
     {
         Comman.WriteLog("Fiddler Exception thrown: " + exception.ToString() + "\r\n" + exception.StackTrace.ToString() + "ShellExecute Failed");
         return(false);
     }
 }