Example #1
0
        private void toolModGrid_MoveDown_Click(object sender, EventArgs e)
        {
            this.SaveSelection();

            foreach (DataGridViewRow _CurrentRow in dgrvMods.SelectedRows)
            {
                DataObjects.ModDetails _CurrentMod = (DataObjects.ModDetails)_CurrentRow.DataBoundItem;
                this.m_Manager.MoveModDown(_CurrentMod);
            }

            //this.m_Manager.ModList = this.m_Manager.ModList.OrderBy(o => o.Sequence);

            //var temp = this.m_Manager.ModList.OrderBy(o => o.Sequence);

            //this.bsrcModDetails.DataSource = null;
            //this.bsrcModDetails.DataSource = this.m_Manager.ModList;

            //Update grid sequence
            this.UpdateOrder();

            // dgrvMods.Sort(dgrvMods_Sequence, ListSortDirection.Descending);
            //Reselect


            this.m_Manager.CheckIssues();

            this.LoadSelection();
        }
Example #2
0
        /*
         * private void bttnLoad_Click(object sender, EventArgs e)
         * {
         *  //this.m_SettingsManager = new SettingsManager();
         *  //this.m_SettingsManager.Load();
         *
         *  this.m_ProfileManager = frmSettings.GetSettings();
         *  if (this.m_ProfileManager == null) { return; }
         *
         *
         *  this.m_Manager = new RimworldModManager.DataObjects.ModManager();
         *
         *  this.m_Manager.LoadModList(this.m_ProfileManager.ActiveProfile_RimworldFolder, this.m_ProfileManager.ActiveProfile_WorkshopFolder);
         *
         *  this.m_Manager.LoadModConfig(this.m_ProfileManager.ActiveProfile_ConfigFolder);
         *
         *  this.m_Manager.CheckIssues();
         *
         *  this.UpdateOrder();
         *
         *  if (this.m_ProfileManager.ActiveProfile == null)
         *  {
         *      lblProfile.Text = "No Profile Loaded";
         *  }
         *  else
         *  {
         *      lblProfile.Text = this.m_ProfileManager.ActiveProfile.ToString();
         *  }
         *
         * }
         */
        private void toolModGrid_MoveUp_Click(object sender, EventArgs e)
        {
            this.SaveSelection();

            List <ModDetails> temp = new List <ModDetails>();

            foreach (DataGridViewRow _CurrentRow in dgrvMods.SelectedRows)
            {
                DataObjects.ModDetails _CurrentMod = (DataObjects.ModDetails)_CurrentRow.DataBoundItem;
                temp.Add(_CurrentMod);
            }

            temp.Reverse();


            foreach (ModDetails _CurrentMod in temp)
            {
                this.m_Manager.MoveModUp(_CurrentMod);
            }


            //Update grid sequence
            this.UpdateOrder();
            //Reselect

            this.m_Manager.CheckIssues();

            this.LoadSelection();
        }
Example #3
0
 public void Toggle(ModDetails modToToggle)
 {
     if (modToToggle.Sequence == ModManager.INACTIVE_SEQUENCE)
     {
         modToToggle.Sequence = this.NextUnusedSequence();
     }
     else
     {
         modToToggle.Sequence = ModManager.INACTIVE_SEQUENCE;
     }
 }
Example #4
0
        public void CheckIssues(ModManager parentManager)
        {
            StringBuilder _Problems = new StringBuilder();

            if (this.IsCore && this.Sequence != 0)
            {
                _Problems.AppendLine("Core must be active and the first in the sequence");
            }

            if (!this.ExistsInDisk)
            {
                _Problems.AppendLine("Missing on Disk");
            }
            else
            {
                if (!this.ExistsInAbout)
                {
                    _Problems.AppendLine("Missing About.xml");
                }
                if (!this.ExistsInDependencies && !this.IsCore)
                {
                    _Problems.AppendLine("Not Checked - No Dependencies.xml");
                    // _Problems.AppendLine("-");
                }
            }

            foreach (Dependency _CurrentDependency in this.Dependencies)
            {
                ModDetails _CurrentDependencyMod = parentManager.GetModByDiskName(_CurrentDependency.m_DiskNme);

                if (_CurrentDependencyMod == null)
                {
                    _Problems.AppendLine("Missing Dependencie: " + _CurrentDependency.m_DiskNme);
                }
                else if (!_CurrentDependencyMod.IsActive)
                {
                    _Problems.AppendLine("Inactive Dependencie: " + _CurrentDependency.m_DiskNme);
                }
                else if (_CurrentDependencyMod.Sequence > this.Sequence)
                {
                    _Problems.AppendLine("Dependencie later in load order: " + _CurrentDependency.m_DiskNme);
                }
            }

            if (_Problems.Length == 0)
            {
                //  _Problems.AppendLine("No issues found");
            }

            this.Issues = _Problems.ToString();
        }
Example #5
0
        public void MoveModDown(ModDetails modToMove)
        {
            if (modToMove.Sequence < (this.NextUnusedSequence() - 1))
            {
                ModDetails _SwappingMod = this.GetModBySequence(modToMove.Sequence + 1);

                modToMove.Sequence += 1;

                if (_SwappingMod != null)
                {
                    _SwappingMod.Sequence -= 1;
                }
            }
        }
Example #6
0
        public void MoveModUp(ModDetails modToMove)
        {
            if (modToMove.Sequence > 0)
            {
                ModDetails _SwappingMod = this.GetModBySequence(modToMove.Sequence - 1);

                modToMove.Sequence -= 1;

                if (_SwappingMod != null)
                {
                    _SwappingMod.Sequence += 1;
                }
            }
        }
Example #7
0
        private void toolModGrid_Toggle_Click(object sender, EventArgs e)
        {
            this.SaveSelection();
            //this.FullSelect();

            foreach (DataGridViewRow _CurrentRow in dgrvMods.SelectedRows)
            {
                DataObjects.ModDetails _CurrentMod = (DataObjects.ModDetails)_CurrentRow.DataBoundItem;
                this.m_Manager.Toggle(_CurrentMod);
            }
            this.UpdateOrder();

            this.m_Manager.CheckIssues();

            this.LoadSelection();
        }
Example #8
0
        public void LoadModConfig(string saveFolder)
        {
            // Check that the Save Folder exists
            if (!System.IO.Directory.Exists(saveFolder))
            {
                MessageBox.Show("Save Folder not Found: " + saveFolder);
                return;
            }

            string _RimworldConfigFolder = saveFolder + @"\Config";

            //Check mods folder exists
            if (!System.IO.Directory.Exists(_RimworldConfigFolder))
            {
                MessageBox.Show("Config Folder not Found:" + _RimworldConfigFolder);
                return;
            }

            //Check File
            string _ModsConfigFilePath = _RimworldConfigFolder + @"\ModsConfig.xml";

            if (!System.IO.File.Exists(_ModsConfigFilePath))
            {
                MessageBox.Show("Mod Config File not Found:" + _ModsConfigFilePath);
                return;
            }

            XmlDocument _XmlFileConfigFile = new XmlDocument();

            _XmlFileConfigFile.Load(_ModsConfigFilePath);

            var _XmlModsConfigData = _XmlFileConfigFile.DocumentElement.SelectSingleNode("/ModsConfigData");

            var _XmlBuildNumber = _XmlFileConfigFile.DocumentElement.SelectSingleNode("buildNumber");

            var _XmlactiveMods = _XmlFileConfigFile.DocumentElement.SelectSingleNode("activeMods");

            this.m_BuildNumber = int.Parse(_XmlBuildNumber.InnerText);

            List <string> _ActiveMods = new List <string>();

            int i = 0;

            foreach (XmlNode _XmlactiveMod in _XmlactiveMods.ChildNodes)
            {
                _ActiveMods.Add(_XmlactiveMod.InnerText);
                ModDetails _currentMod = this.GetModByDiskName(_XmlactiveMod.InnerText);

                if (_currentMod != null)
                {
                    _currentMod.configValues(i);
                }
                else
                {
                    //Add missing mods

                    ModDetails _NewMod = new ModDetails();

                    _NewMod.XMLName = _XmlactiveMod.InnerText;
                    _NewMod.configValues(i);

                    this.ModList.Add(_NewMod);
                }

                i++;
            }
        }