Пример #1
0
 /// <summary>
 /// Applies the default list filters
 /// </summary>
 private void ApplyFilters(IVirtualModInfo p_vmiModInfo)
 {
     this.ModelFilter = new ModelFilter(delegate(object x)
     {
         return(true);
     });
 }
Пример #2
0
 /// <summary>
 /// Setup the Hyperlink Manager
 /// </summary>
 public void SetupHyperlinkManager()
 {
     tlcModId.Hyperlink = true;
     this.IsHyperlink  += delegate(object sender, BrightIdeasSoftware.IsHyperlinkEventArgs e)
     {
         try
         {
             IVirtualModInfo vmiInfo = (IVirtualModInfo)e.Model;
             if (!(vmiInfo == null))
             {
                 if (String.IsNullOrEmpty(vmiInfo.ModId))
                 {
                     e.Url = null;
                 }
                 else
                 {
                     string strUri = "https://" + m_mmrModRepository.GameModeWebsite + "/mods/" + vmiInfo.ModId;
                     e.Url = strUri;
                 }
             }
         }
         catch
         {
             e.Url = null;
         }
     };
 }
Пример #3
0
 public VirtualModLink(IVirtualModLink p_vmlLink)
 {
     VirtualModPath = p_vmlLink.VirtualModPath;
     RealModPath    = p_vmlLink.RealModPath;
     Priority       = p_vmlLink.Priority;
     Active         = p_vmlLink.Active;
     ModInfo        = p_vmlLink.ModInfo;
 }
Пример #4
0
 public VirtualModLink(string p_strRealPath, string p_strVirtualPath, int p_intPriority, bool p_booActive, IVirtualModInfo p_vmiVirtualModInfo)
 {
     VirtualModPath = p_strVirtualPath;
     RealModPath    = p_strRealPath;
     Priority       = p_intPriority;
     Active         = p_booActive;
     ModInfo        = p_vmiVirtualModInfo;
 }
Пример #5
0
        /// <summary>
        /// Setup the ProfileView
        /// </summary>
        /// <param name="p_lvwList">The source list view.</param>
        /// <param name="p_cmgProfileManager">The mod Profile Manager.</param>
        public void Setup(ReadOnlyObservableList <IMod> p_rolManagedMods, IModRepository p_mmrModRepository, IProfileManager p_cmgProfileManager, ISettings p_Settings)
        {
            this.Tag = false;

            this.CellEditActivation = CellEditActivateMode.None;
            this.MultiSelect        = true;
            this.AllowDrop          = true;
            this.UseFiltering       = true;
            this.UseHyperlinks      = true;

            ProfileManager     = p_cmgProfileManager;
            m_mmrModRepository = p_mmrModRepository;
            m_rolManagedMods   = p_rolManagedMods;
            Settings           = p_Settings;

            // Setup menuStrip commands
            SetupContextMenu();

            // Setup Profile validator
            SetupProfileValidator();

            // Setup Profile sorter
            SetupProfileSorter();

            this.CheckBoxes           = false;
            this.UseSubItemCheckBoxes = false;

            this.FormatRow += delegate(object sender, FormatRowEventArgs e)
            {
                IVirtualModInfo modInfo = (IVirtualModInfo)e.Model;
                var             modMod  = ManagedMods.Where(x => String.Equals(Path.GetFileName(x.Filename), modInfo.ModFileName, StringComparison.InvariantCultureIgnoreCase)).FirstOrDefault();
                if (modMod == null)
                {
                    e.Item.ForeColor = Color.Gray;
                }
            };

            // Setup AspectGetter (IconListView cell parser)
            SetupColumnParser();

            // Setup the Drag&Drop functionality
            SetupDragAndDrop();

            // Setup hyperlink manager
            SetupHyperlinkManager();

            // Setup ImageGetters
            SetupImageGetters();

            // Set control initialized
            this.Tag = true;
            this.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
        }
Пример #6
0
 /// <summary>
 /// Removes the selected Profile.
 /// </summary>
 /// <param name="p_imcProfile">The Profile to remove.</param>
 public void RemoveProfile(IVirtualModInfo p_vmiModInfo)
 {
 }
Пример #7
0
 /// <summary>
 /// Adds a new Profile to the TreeListView.
 /// </summary>
 /// <param name="p_imcProfile">The Profile to add to the roots list.</param>
 /// <param name="booIsNew">Whether the Profile is new or was just hidden.</param>
 public void AddData(IVirtualModInfo p_vmiModInfo, bool booIsNew)
 {
 }
Пример #8
0
        /// <summary>
        /// The method that is called to start the backgound task.
        /// </summary>
        /// <param name="p_objArgs">Arguments to for the task execution.</param>
        /// <returns>Always <c>null</c>.</returns>
        protected override object DoWork(object[] p_objArgs)
        {
            try
            {
                ConfirmActionMethod camConfirm = (ConfirmActionMethod)p_objArgs[0];
                OverallMessage          = "Checking the Profile Online Integrity...";
                OverallProgress         = 0;
                OverallProgressStepSize = 1;
                ShowItemProgress        = false;
                OverallProgressMaximum  = 1;

                List <ProfileMissingModInfo> lstMissingInfo   = null;
                Dictionary <string, string>  dctMissingMods   = new Dictionary <string, string>();
                Dictionary <string, string>  dctNewDownloadID = new Dictionary <string, string>();

                if (ModProfile != null)
                {
                    lstMissingInfo = ModRepository.GetMissingFiles(ModRepository.RemoteGameId, int.Parse(ModProfile.OnlineID));
                }

                foreach (KeyValuePair <string, string> kvp in MissingModsList)
                {
                    IVirtualModInfo Mod = ModProfile.ModList.Find(x => x.DownloadId == kvp.Value);

                    if (Mod != null)
                    {
                        ProfileMissingModInfo pmModInfo = lstMissingInfo.Find(x => x.FileId.ToString().Equals(kvp.Value));

                        if (pmModInfo != null)
                        {
                            if ((!string.IsNullOrEmpty(pmModInfo.NewFileId.ToString())) && (pmModInfo.NewFileId.ToString() != "-1"))
                            {
                                dctNewDownloadID.Add(kvp.Key, pmModInfo.NewFileId.ToString());
                                dctMissingMods.Add(kvp.Key, @"@nxm://" + GameModeID + "/mods/" + Mod.ModId + "/files/" + pmModInfo.NewFileId.ToString());
                            }
                            else if (string.IsNullOrEmpty(pmModInfo.ModName))
                            {
                                dctMissingMods.Add(kvp.Key, null);
                            }
                            else if (pmModInfo.NewFileId.ToString().Equals("-1", StringComparison.OrdinalIgnoreCase))
                            {
                                dctMissingMods.Add(kvp.Key, null);
                            }
                        }
                        else
                        {
                            dctMissingMods.Add(kvp.Key, @"nxm://" + GameModeID + "/mods/" + Mod.ModId + "/files/" + Mod.DownloadId);
                        }
                    }
                }


                ProfileManager.UpdateProfileDownloadId(ModProfile, dctNewDownloadID);

                return(dctMissingMods);
            }
            catch (Exception ex)
            {
                return("ERROR - There was a problem communicating with the Nexus server: " + Environment.NewLine + ex.Message);
            }

            return(null);
        }
        /// <summary>
        /// Setup the SaveGameView
        /// </summary>
        /// <param name="p_lvwList">The source list view.</param>
        /// <param name="p_cmgSaveGameManager">The mod SaveGame Manager.</param>
        public void Setup(ModManager p_mmModManager)
        {
            this.Tag = false;

            this.CellEditActivation = CellEditActivateMode.None;
            this.MultiSelect        = true;
            this.AllowDrop          = true;
            this.UseFiltering       = true;
            this.UseHyperlinks      = true;

            ModManager = p_mmModManager;

            // Setup menuStrip commands
            SetupContextMenu();

            // Setup SaveGame sorter
            SetupSaveGameSorter();

            this.CheckBoxes           = false;
            this.UseSubItemCheckBoxes = false;

            IVirtualModInfo modInfo = null;

            this.FormatRow += delegate(object sender, FormatRowEventArgs e)
            {
                modInfo = (IVirtualModInfo)e.Model;

                string fileName    = Path.GetFileName(modInfo.ModFileName);
                string downloadId  = modInfo.DownloadId;
                string fileVersion = modInfo.FileVersion;

                var mod = ModManager.ManagedMods.Where(x => String.Equals(Path.GetFileName(x.Filename), fileName, StringComparison.InvariantCultureIgnoreCase)).FirstOrDefault();
                if (mod == null)
                {
                    mod = ModManager.ManagedMods.Where(x => String.Equals(x.DownloadId, downloadId, StringComparison.InvariantCultureIgnoreCase)).FirstOrDefault();
                }

                if (mod != null)
                {
                    e.ListView.Font = new Font("Arial", 8F, FontStyle.Bold, GraphicsUnit.Point, ((byte)(0)));
                    e.Item.Font     = new Font("Arial", 8F, FontStyle.Bold, GraphicsUnit.Point, ((byte)(0)));

                    if (!ModManager.IsMatchingVersion(fileVersion, mod.HumanReadableVersion))
                    {
                        e.ListView.ForeColor = Color.DarkSalmon;
                        e.Item.ForeColor     = Color.DarkSalmon;
                    }
                    else
                    {
                        e.ListView.ForeColor = Color.Gray;
                        e.Item.ForeColor     = Color.Gray;
                    }
                }
                else
                {
                    e.ListView.ForeColor = Color.Red;
                    e.Item.ForeColor     = Color.Red;
                }
            };

            // Setup AspectGetter (IconListView cell parser)
            SetupColumnParser();

            // Setup the Drag&Drop functionality
            SetupDragAndDrop();

            // Setup hyperlink manager
            //SetupHyperlinkManager();

            // Setup ImageGetters
            SetupImageGetters();

            // Set control initialized
            this.Tag = true;
            //this.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
            ResetColumns();
        }
Пример #10
0
        public List <string> CheckScriptedInstallersIntegrity(IModProfile p_impFrom, IModProfile p_impTo)
        {
            List <string> lstConflicts = new List <string>();
            string        strToPath    = GetCurrentProfileScriptedLogPath(p_impTo);

            if (!Directory.Exists(strToPath))
            {
                return(null);
            }

            if (p_impFrom == null)
            {
                List <string> lstTo = new List <string>();
                lstTo = Directory.GetFiles(strToPath, "*.xml", SearchOption.TopDirectoryOnly).ToList();
                if ((lstTo != null) && (lstTo.Count > 0))
                {
                    lstTo = lstTo.Select(x => Path.GetFileName(x)).ToList();

                    foreach (string File in lstTo)
                    {
                        IVirtualModInfo modMod = VirtualModActivator.VirtualMods.Find(x => Path.GetFileNameWithoutExtension(x.ModFileName).Equals(Path.GetFileNameWithoutExtension(File), StringComparison.CurrentCultureIgnoreCase));
                        if (modMod != null)
                        {
                            lstConflicts.Add(Path.GetFileName(modMod.ModFileName));
                        }
                    }
                }
            }
            else
            {
                string strFromPath = GetCurrentProfileScriptedLogPath(p_impFrom);
                if (!Directory.Exists(strFromPath))
                {
                    return(null);
                }

                List <string> lstFrom      = new List <string>();
                List <string> lstTo        = new List <string>();
                List <string> lstCommon    = new List <string>();
                Int32         intConflicts = 0;

                try
                {
                    lstFrom = Directory.GetFiles(strFromPath, "*.xml", SearchOption.TopDirectoryOnly).ToList();
                    lstTo   = Directory.GetFiles(strToPath, "*.xml", SearchOption.TopDirectoryOnly).ToList();

                    if ((lstFrom != null) && (lstFrom.Count > 0))
                    {
                        lstFrom = lstFrom.Select(x => Path.GetFileName(x)).ToList();
                    }
                    else
                    {
                        return(lstConflicts);
                    }

                    if ((lstTo != null) && (lstTo.Count > 0))
                    {
                        lstTo = lstTo.Select(x => Path.GetFileName(x)).ToList();
                    }
                    else
                    {
                        return(lstConflicts);
                    }

                    lstCommon = lstFrom.Intersect(lstTo, StringComparer.CurrentCultureIgnoreCase).ToList();

                    foreach (string File in lstCommon)
                    {
                        intConflicts = 0;
                        List <KeyValuePair <string, string> > dicFrom = LoadXMLModFilesToInstall(Path.Combine(strFromPath, File));
                        List <KeyValuePair <string, string> > dicTo   = LoadXMLModFilesToInstall(Path.Combine(strToPath, File));

                        intConflicts += dicFrom.Where(x => !dicTo.Contains(x, StringComparer.CurrentCultureIgnoreCase)).Count();
                        if (intConflicts <= 0)
                        {
                            intConflicts += dicTo.Where(x => !dicFrom.Contains(x, StringComparer.CurrentCultureIgnoreCase)).Count();
                        }

                        if (intConflicts > 0)
                        {
                            IVirtualModInfo modMod = VirtualModActivator.VirtualMods.Find(x => Path.GetFileNameWithoutExtension(x.ModFileName).Equals(Path.GetFileNameWithoutExtension(File), StringComparison.CurrentCultureIgnoreCase));
                            if (modMod != null)
                            {
                                lstConflicts.Add(Path.GetFileName(modMod.ModFileName));
                            }
                        }
                    }
                }
                catch
                { }
            }

            return(lstConflicts);
        }