public static void DownloadGStreamer(Action <int, string> status = null) { var output = Settings.GetDataDirectory() + "gstreamer-1.0-x86_64-1.12.4.zip"; status?.Invoke(0, "Downloading.."); try { Download.getFilefromNet( "http://firmware.ardupilot.org/MissionPlanner/gstreamer/gstreamer-1.0-x86_64-1.12.4.zip", output, status: status); status?.Invoke(50, "Extracting.."); ZipFile.ExtractToDirectory(output, Settings.GetDataDirectory()); status?.Invoke(100, "Done."); } catch (WebException ex) { status?.Invoke(-1, "Error downloading file " + ex.ToString()); try { if (File.Exists(output)) { File.Delete(output); } } catch { } } }
public static void DownloadGStreamer(Action <int, string> status = null) { string output = ""; string url = ""; if (RuntimeInformation.OSArchitecture == Architecture.Arm || RuntimeInformation.OSArchitecture == Architecture.Arm64) { return; } if (System.Environment.Is64BitProcess) { output = Settings.GetDataDirectory() + "gstreamer-1.0-x86_64-1.14.4.zip"; url = "https://firmware.ardupilot.org/MissionPlanner/gstreamer/gstreamer-1.0-x86_64-1.14.4.zip"; } else { output = Settings.GetDataDirectory() + "gstreamer-1.0-x86-1.14.4.zip"; url = "https://firmware.ardupilot.org/MissionPlanner/gstreamer/gstreamer-1.0-x86-1.14.4.zip"; } status?.Invoke(0, "Downloading.."); try { Download.getFilefromNet(url, output, status: status); status?.Invoke(50, "Extracting.."); ZipFile.ExtractToDirectory(output, Settings.GetDataDirectory()); status?.Invoke(100, "Done."); } catch (WebException ex) { status?.Invoke(-1, "Error downloading file " + ex.ToString()); try { if (File.Exists(output)) { File.Delete(output); } } catch { } } }
public static string CheckLogFile(string FileName) { if (Program.WindowsStoreApp) { CustomMessageBox.Show(Strings.Not_available_when_used_as_a_windows_store_app); return(""); } var dir = Settings.GetDataDirectory() + "LogAnalyzer" + Path.DirectorySeparatorChar; var runner = dir + "runner.exe"; var zip = dir + "LogAnalyzer.zip"; if (!Directory.Exists(dir)) { Directory.CreateDirectory(dir); } //if (!File.Exists(runner)) { Loading.ShowLoading("Downloading LogAnalyzer"); bool gotit = false; if (Environment.Is64BitOperatingSystem) { gotit = Download.getFilefromNet( "https://firmware.ardupilot.org/Tools/MissionPlanner/LogAnalyzer/LogAnalyzer64.zip", zip); } else { gotit = Download.getFilefromNet( "https://firmware.ardupilot.org/Tools/MissionPlanner/LogAnalyzer/LogAnalyzer.zip", zip); } // download zip if (gotit) { Loading.ShowLoading("Extracting zip file"); // extract zip FastZip fzip = new FastZip(); fzip.ExtractZip(zip, dir, ""); } else { if (!File.Exists(runner)) { CustomMessageBox.Show("Failed to download LogAnalyzer"); return(""); } } } if (!File.Exists(runner)) { CustomMessageBox.Show("Failed to download LogAnalyzer"); return(""); } var sb = new StringBuilder(); Process P = new Process(); P.StartInfo.FileName = runner; P.StartInfo.Arguments = @" -x """ + FileName + @".xml"" -s """ + FileName + @""""; P.StartInfo.UseShellExecute = false; P.StartInfo.WorkingDirectory = dir; P.StartInfo.RedirectStandardOutput = true; P.StartInfo.RedirectStandardError = true; P.OutputDataReceived += (sender, args) => sb.AppendLine(args.Data); P.ErrorDataReceived += (sender, args) => sb.AppendLine(args.Data); try { Loading.ShowLoading("Running LogAnalyzer"); P.Start(); P.BeginOutputReadLine(); P.BeginErrorReadLine(); // until we are done P.WaitForExit(); log.Info(sb.ToString()); } catch { CustomMessageBox.Show("Failed to start LogAnalyzer"); } Loading.Close(); return(FileName + ".xml"); }