Esempio n. 1
0
        static void DoUpdateWorker_DoWork(object sender, ProgressWorkerEventArgs e, object passdata = null)
        {
            // TODO: Is this the right place?

            #region Fetch Parameter Meta Data

            var progressReporterDialogue = ((ProgressReporterDialogue)sender);
            progressReporterDialogue.UpdateProgressAndStatus(-1, "Getting Updated Parameters");

            try
            {
                ParameterMetaDataParser.GetParameterInformation();
            }
            catch (Exception ex)
            {
                log.Error(ex.ToString());
                CustomMessageBox.Show("Error getting Parameter Information");
            }

            #endregion Fetch Parameter Meta Data

            progressReporterDialogue.UpdateProgressAndStatus(-1, "Getting Base URL");
            // check for updates
            //  if (Debugger.IsAttached)
            {
                //      log.Info("Skipping update test as it appears we are debugging");
            }
            //  else
            {
                updateCheckMain(progressReporterDialogue);
            }
        }
Esempio n. 2
0
        static void DoUpdateWorker_DoWork(object sender, ProgressWorkerEventArgs e, object passdata = null)
        {
            // TODO: Is this the right place?

            #region Fetch Parameter Meta Data

            var progressReporterDialogue = ((ProgressReporterDialogue)sender);
            progressReporterDialogue.UpdateProgressAndStatus(-1, "Getting Updated Parameters");

            // ToDo: Check this:
            try
            {
                ParameterMetaDataParser.GetParameterInformation();
            }
            catch (Exception ex)
            {
                log.Error(ex.ToString());
                CustomMessageBox.Show("Error getting Parameter Information");
            }

            #endregion Fetch Parameter Meta Data

            progressReporterDialogue.UpdateProgressAndStatus(-1, "Getting Base URL");

            #region Writetest check
            try
            {
                File.WriteAllText(Path.GetDirectoryName(Application.ExecutablePath) + Path.DirectorySeparatorChar + "writetest.txt", "this is a test");
            }
            catch (Exception ex)
            {
                log.Info("Write test failed");
                throw new Exception("Unable to write to the install directory", ex);
            }
            finally
            {
                try
                {
                    File.Delete(Path.GetDirectoryName(Application.ExecutablePath) + Path.DirectorySeparatorChar +
                                "writetest.txt");
                }
                catch
                {
                    log.Info("Write test cleanup failed");
                }
            }
            #endregion

            // check for updates
            //  if (Debugger.IsAttached)
            {
                //      log.Info("Skipping update test as it appears we are debugging");
            }
            //  else
            {
                updateCheckMain(progressReporterDialogue);
            }
        }
Esempio n. 3
0
        static void DoUpdateWorker_DoWork(IProgressReporterDialogue sender)
        {
            // TODO: Is this the right place?

            #region Fetch Parameter Meta Data

            var progressReporterDialogue = ((IProgressReporterDialogue)sender);
            progressReporterDialogue.UpdateProgressAndStatus(-1, "Getting Updated Parameters");

            try
            {
                if (MissionPlanner.Utilities.Update.dobeta)
                {
                    ParameterMetaDataParser.GetParameterInformation(
                        ConfigurationManager.AppSettings["ParameterLocationsBleeding"], "ParameterMetaData.xml");
                }
                else
                {
                    ParameterMetaDataParser.GetParameterInformation(
                        ConfigurationManager.AppSettings["ParameterLocations"], "ParameterMetaData.xml");
                }
            }
            catch (Exception ex)
            {
                log.Error(ex.ToString());
                CustomMessageBox.Show("Error getting Parameter Information");
            }

            #endregion Fetch Parameter Meta Data

            progressReporterDialogue.UpdateProgressAndStatus(-1, "Getting Base URL");

            try
            {
                File.WriteAllText(
                    Path.GetDirectoryName(Application.ExecutablePath) + Path.DirectorySeparatorChar + "writetest.txt",
                    "this is a test");
            }
            catch (Exception ex)
            {
                log.Info("Write test failed");
                throw new Exception("Unable to write to the install directory", ex);
            }
            finally
            {
                try
                {
                    File.Delete(Path.GetDirectoryName(Application.ExecutablePath) + Path.DirectorySeparatorChar +
                                "writetest.txt");
                }
                catch
                {
                    log.Info("Write test cleanup failed");
                }
            }

            updateCheckMain(progressReporterDialogue);
        }
Esempio n. 4
0
        static void DoUpdateWorker_DoWork(IProgressReporterDialogue sender)
        {
            // TODO: Is this the right place?

            #region Fetch Parameter Meta Data

            var progressReporterDialogue = ((IProgressReporterDialogue)sender);
            progressReporterDialogue.UpdateProgressAndStatus(-1, "Getting updated parameter documentation");

            try
            {
                var dns  = Dns.GetHostAddresses("github.com");
                var dns2 = Dns.GetHostAddresses("raw.githubusercontent.com");

                // Go to the GitHub and make .xml file with parameters
                if (dns.Length != 0)
                {
                    if (MissionPlanner.Utilities.Update.dobeta)
                    {
                        ParameterMetaDataParser.GetParameterInformation(
                            "https://raw.githubusercontent.com/BogdanPal1/ardupilot/pmucan/ArduPlane/Parameters.cpp", "ParameterMetaData.xml");
                    }
                    else
                    {
                        ParameterMetaDataParser.GetParameterInformation(
                            "https://raw.githubusercontent.com/BogdanPal1/ardupilot/pmucan/ArduPlane/Parameters.cpp", "ParameterMetaData.xml");
                    }
                }
            }
            catch (Exception ex)
            {
                log.Error(ex.ToString());
                CustomMessageBox.Show("Error getting Parameter Information");
            }

            #endregion Fetch Parameter Meta Data

            progressReporterDialogue.UpdateProgressAndStatus(-1, "Getting Base URL");

            try
            {
                File.WriteAllText(
                    Path.GetDirectoryName(Application.ExecutablePath) + Path.DirectorySeparatorChar + "writetest.txt",
                    "this is a test");
            }
            catch (Exception ex)
            {
                log.Info("Write test failed");
                throw new Exception("Unable to write to the install directory", ex);
            }
            finally
            {
                try
                {
                    File.Delete(Path.GetDirectoryName(Application.ExecutablePath) + Path.DirectorySeparatorChar +
                                "writetest.txt");
                }
                catch
                {
                    log.Info("Write test cleanup failed");
                }
            }

            updateCheckMain(progressReporterDialogue);
        }