Esempio n. 1
0
        private void ModStore_Initialise(bool LoadXML = true)
        {
            if (LoadXML)
            {
                //Load Config
                XmlSerializer xs = new XmlSerializer(typeof(ModStoreManager));
                if (File.Exists(config.ConfigPath))
                {
                    using (var fs = File.Open(config.ConfigPath, FileMode.Open))
                    {
                        config            = (ModStoreManager)xs.Deserialize(fs);
                        config.parentForm = this;
                    }
                }
            }

            //Set Sort Menu Check
            setSortMenuItemCheck();

            if (config.AvailableItems.Count == 0 || (DateTime.Now - config.LastUpdate).TotalDays >= 1.0)
            {
                //Ask user to update repository information
                updateModuleList();
            }

            //If no modules, update failed so close mod store
            if (config.AvailableItems.Count == 0)
            {
                Close();
                return;
            }

            //Check if user deleted module
            config.CheckForDeletedItems();

            //Add or Remove Experimental Tab
            if (showExperimentalTab == false)
            {
                tabControl1.TabPages.Remove(tabPage7);
            }
            else if (tabControl1.TabPages.Contains(tabPage7) == false)
            {
                tabControl1.TabPages.Add(tabPage7);
            }

            //Setup Tabs and Load Items
            loadTabItems();
        }
Esempio n. 2
0
        private void ModStore_Initialise()
        {
            //Load Config
            XmlSerializer xs = new XmlSerializer(typeof(ModStoreManager));

            if (File.Exists(config.ConfigPath))
            {
                using (var fs = File.Open(config.ConfigPath, FileMode.Open))
                {
                    config = (ModStoreManager)xs.Deserialize(fs);
                }
            }

            if (config.AvailableItems.Count == 0 || (DateTime.Now - config.LastUpdate).TotalDays >= 1.0)
            {
                //Ask user to update repository information
                updateModuleList();
            }

            //If no modules, update failed so close mod store
            if (config.AvailableItems.Count == 0)
            {
                Close();
                return;
            }

            //Check if user deleted module
            config.CheckForDeletedItems();

            //Set Control Config
            foreach (TabPage tabPage in tabControl1.Controls)
            {
                ModStoreTabControl modStoreTabControl = tabPage.Controls[0] as ModStoreTabControl;
                if (modStoreTabControl != null)
                {
                    modStoreTabControl.Manager = config;
                }
            }
        }