Example #1
0
        private bool main_CheckForUpdate(UpdateManifest manifest)
        {
            //Prepare
            string       root         = Application.StartupPath;
            AssemblyName assemblyName = null;
            bool         update       = false;

            //Loop
            foreach (var info in Program.UpdateManifest)
            {
                //Check
                if (!File.Exists(Path.Combine(root, info.Filename)))
                {
                    update |= true;
                }
                else if (info.AssemblyName != null)
                {
                    //Get Name
                    assemblyName = AssemblyName.GetAssemblyName(Path.Combine(root, info.Filename));
                    update      |= info.AssemblyName.Version > assemblyName.Version;
                }

                //Check
                if (update)
                {
                    break;
                }
            }

            //Return
            return(update);
        }
Example #2
0
        private void checkForUpdatesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //Prepare
            XmlDocument    manifestDocument = new XmlDocument();
            UpdateManifest manifest         = null;
            bool           update           = Program.ForceUpdate;

            try
            {
                //Load XML Document
                manifestDocument.Load(Program.UpdateManifestUrl);

                //Get Update Manifest
                manifest = new UpdateManifest(manifestDocument);

                //Check
                update |= main_CheckForUpdate(manifest);
            }
            catch { update = false; }

            //Check
            if (update)
            {
                using (UpdateDialog updateDlg = new UpdateDialog(manifest))
                    if (updateDlg.ShowDialog() == DialogResult.OK)
                    {
                        Application.Exit();
                    }
            }
            else
            {
                MessageBox.Show("Abide is up to date.", "Up to date", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Example #3
0
        private static void Main(params string[] args)
        {
            //Prepare
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            addOns = new AddOnFactoryManager();

            //Check
            if (!Directory.Exists(AbideRegistry.AddOnsDirectory))
            {
                Directory.CreateDirectory(AbideRegistry.AddOnsDirectory);
            }

            //Load Update Manifset
            XmlDocument updateManifestDocument = new XmlDocument();

            try { updateManifestDocument.Load(manifestUrl); }
            catch { updateManifestDocument = null; }
            if (updateManifestDocument != null)
            {
                updateManifest = new UpdateManifest(updateManifestDocument);
            }

            //Load AddOns
            AddOnManifest manifest = new AddOnManifest();

            foreach (string directory in Directory.EnumerateDirectories(AbideRegistry.AddOnsDirectory))
            {
                //Get Manifest Path
                if (File.Exists(Path.Combine(directory, "Manifest.xml")))
                {
                    //Load Manifest
                    manifest.LoadXml(Path.Combine(directory, "Manifest.xml"));

                    //Load
                    string assemblyPath = Path.Combine(directory, manifest.PrimaryAssemblyFile);
                    if (File.Exists(assemblyPath))
                    {
                        addOnAssemblies.Add(assemblyPath);
                    }
                }
            }

            //Handle Arguments
            if (Main_HandleArguments(args))
            {
                Main_Continue();
            }
        }