コード例 #1
0
ファイル: Form1.cs プロジェクト: diehard3303/ModManagerUlt
        private void reMakeModListsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var lc = new ListCreator();

            lc.CreateSortedLists();
            lc.SortedFileListComplete();
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: diehard3303/ModManagerUlt
        private void sortModsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var sort = new ModSorter();
            var lc   = new ListCreator();

            sort.SortMods();
            sort.DoDeepSort();
            lc.CreateSortedLists();
            lc.SortedFileListComplete();
        }
コード例 #3
0
        /// <summary>
        ///     Removes the mod.
        /// </summary>
        /// <param name="key">The key.</param>
        /// <returns></returns>
        public Dictionary <string, string> ProfileRemoveMod(string key)
        {
            var reg     = new AtsRegWork(true);
            var gam     = reg.Read(RegKeys.CURRENT_GAME);
            var profile = reg.Read(RegKeys.CURRENT_PROFILE);
            var modPath = string.Empty;

            switch (gam)
            {
            case "ATS":
                modPath = reg.Read(AtsRegKeys.ATS_PROFILES) + profile + "\\" + profile + XML_EXT;
                break;

            case "ETS":
                modPath = reg.Read(EtsRegKeys.ETS_PROFILES) + profile + "\\" + profile + XML_EXT;
                break;

            case "FS15":
                modPath = reg.Read(Fs15RegKeys.FS15_PROFILES) + profile + "\\" + profile + XML_EXT;
                break;

            case "FS17":
                modPath = reg.Read(Fs17RegKeys.FS17_PROFILES) + profile + "\\" + profile + XML_EXT;
                break;
            }

            var dic = Serializer.DeserializeDictionary(modPath);

            if (dic.Any(v => string.Equals(v.Key, key, StringComparison.OrdinalIgnoreCase)))
            {
                var mod = reg.Read(Fs17RegKeys.FS17_PROFILES) + profile + "\\" + key;
                dic.Remove(key);
                DeleteFiles.DeleteFilesOrFolders(mod);

                var ls = new ListCreator();
                ls.CreateSortedLists();
                ls.SortedFileListComplete();
                MsgBx.Msg("Operation completed successfully", "Mod Remover");
            }

            Serializer.SerializeDictionary(modPath, dic);

            return(dic);
        }
コード例 #4
0
        /// <summary>
        /// </summary>
        public void MoveMod(string mod)
        {
            var loc = GetLocation();

            if (loc.IsNullOrEmpty())
            {
                return;
            }
            if (!mod.FileExists())
            {
                return;
            }
            FileCopyMove.FileCopy(mod, loc + mod.GetFileName(), true);

            var ls = new ListCreator();

            ls.CreateSortedLists();
            ls.SortedFileListComplete();

            MsgBx.Msg("Operation completed successfully..", "Mod Mover");
        }
コード例 #5
0
ファイル: Form1.cs プロジェクト: diehard3303/ModManagerUlt
        private void DeleteRepoMod(string pth)
        {
            var    reg = new AtsRegWork(true);
            var    gam = reg.Read(RegKeys.CURRENT_GAME);
            var    dic = Serializer.DeserializeDictionary(pth);
            var    lc  = new ListCreator();
            var    key = lstAvailableMods.SelectedItem.ToString();
            string pt;

            if (!dic.Any(v => string.Equals(v.Key, key, StringComparison.OrdinalIgnoreCase)))
            {
                return;
            }
            dic.TryGetValue(key, out pt);
            var mPth = pt + key;

            DeleteFiles.DeleteFilesOrFolders(mPth);
            lstAvailableMods.Items.Remove(key);
            lc.CreateSortedLists();
            lc.SortedFileListComplete();
            switch (gam)
            {
            case "ETS":
                EtsLoad();
                break;

            case "ATS":
                AtsLoad();
                break;

            case "FS15":
                Fs15Load();
                break;

            case "FS17":
                Fs17Load();
                CheckModCount();
                break;
            }
        }
コード例 #6
0
        public void OrganizeMaps()
        {
            var mapLst = new List <string> {
                "map",
                "Map"
            };

            var reg = new AtsRegWork(true);
            var gam = reg.Read(RegKeys.CURRENT_GAME);

            if (gam.IsNullOrEmpty())
            {
                MsgBx.Msg("Mod Sorting is Game specific, you need to choose a game", "Game Error");
                return;
            }

            SetSearchLists();

            string tmp;
            IEnumerable <string> lst;

            switch (gam)
            {
            case "ATS":
                tmp = reg.Read(AtsRegKeys.ATS_REPO);
                lst = GetFilesFolders.GetFiles(tmp, "*.scs");
                if (lst.IsNull())
                {
                    return;
                }
                foreach (var v in lst)
                {
                    foreach (var t in _srchLstTs)
                    {
                        if (!v.Contains(t, StringComparison.OrdinalIgnoreCase))
                        {
                            continue;
                        }
                        FolderCreator.CreatePublicFolders(reg.Read(AtsRegKeys.ATS_GROUPS) + t);
                        FileCopyMove.FileCopy(v, reg.Read(AtsRegKeys.ATS_GROUPS) + t + "\\" + v.GetFileName(),
                                              true);
                    }
                }

                break;

            case "ETS":
                var ets = new EtsRegWork(true);
                tmp = ets.Read(EtsRegKeys.ETS_REPO);
                lst = GetFilesFolders.GetFiles(tmp, "*.scs");
                if (lst.IsNull())
                {
                    return;
                }
                foreach (var v in lst)
                {
                    foreach (var t in _srchLstTs)
                    {
                        if (!v.Contains(t, StringComparison.OrdinalIgnoreCase))
                        {
                            continue;
                        }
                        FolderCreator.CreatePublicFolders(ets.Read(EtsRegKeys.ETS_GROUPS) + t);
                        FileCopyMove.FileCopy(v, ets.Read(EtsRegKeys.ETS_GROUPS) + t + "\\" + v.GetFileName(),
                                              true);
                    }
                }

                break;

            case "FS15":
                var fs15 = new Fs15RegWork(true);
                tmp = fs15.Read(Fs15RegKeys.FS15_REPO);
                lst = GetFilesFolders.GetFiles(tmp, "*.zip");
                if (lst.IsNull())
                {
                    return;
                }
                foreach (var v in lst)
                {
                    foreach (var t in _srchLstFs)
                    {
                        if (!v.Contains(t, StringComparison.OrdinalIgnoreCase))
                        {
                            continue;
                        }
                        FolderCreator.CreatePublicFolders(fs15.Read(Fs15RegKeys.FS15_GROUPS) + t);
                        FileCopyMove.FileCopy(v, fs15.Read(Fs15RegKeys.FS15_GROUPS) + t + "\\" + v.GetFileName(),
                                              true);
                    }
                }

                break;

            case "FS17":
                var fs17      = new Fs17RegWork(true);
                var bypass    = new SortingBypass();
                var byPassDat = bypass.GetBypassList();
                tmp = fs17.Read(Fs17RegKeys.FS17_GROUPS);
                var fldLst  = GetFilesFolders.GetFolders(tmp, "*.*");
                var chkList = new List <string>();
                var enu     = fldLst.ToList();
                foreach (var v in enu)
                {
                    var chk = v.GetLastFolderName();
                    if (byPassDat.ContainsKey(chk))
                    {
                        continue;
                    }
                    chkList.Add(v);
                }

                if (chkList.IsNull())
                {
                    return;
                }
                foreach (var v in chkList)
                {
                    lst = GetFilesFolders.GetFiles(v + "\\", "*.zip");
                    foreach (var f in lst)
                    {
                        foreach (var t in mapLst)
                        {
                            if (!f.Contains(t, StringComparison.OrdinalIgnoreCase))
                            {
                                continue;
                            }
                            var src = tmp + "\\" + "Map" + "\\" + f.GetFileName();
                            if (src.FileExists())
                            {
                                continue;
                            }
                            FileCopyMove.FileCopy(f, src, true);
                        }
                    }
                }

                break;
            }

            var lstCreate = new ListCreator();

            lstCreate.CreateSortedLists();
            lstCreate.SortedFileListComplete();
            MsgBx.Msg("Map Sorting Complete", "Map Sorter");
        }
コード例 #7
0
        private static void DoCleanUp()
        {
            var    reg = new AtsRegWork(true);
            var    gam = reg.Read(RegKeys.CURRENT_GAME);
            string tmp;
            IEnumerable <string> lst;

            switch (gam)
            {
            case "ATS":
                tmp = reg.Read(AtsRegKeys.ATS_REPO);
                lst = GetFilesFolders.GetFiles(tmp, "*.scs");
                FolderCreator.CreatePublicFolders(reg.Read(AtsRegKeys.ATS_GROUPS) + "misc");
                foreach (var v in lst)
                {
                    FileCopyMove.FileCopy(v, reg.Read(AtsRegKeys.ATS_GROUPS) + "misc" + "\\" + v.GetFileName(),
                                          true);
                }

                break;

            case "ETS":
                var ets = new EtsRegWork(true);
                tmp = ets.Read(EtsRegKeys.ETS_REPO);
                lst = GetFilesFolders.GetFiles(tmp, "*.scs");
                FolderCreator.CreatePublicFolders(ets.Read(EtsRegKeys.ETS_GROUPS) + "misc");
                foreach (var t in lst)
                {
                    FileCopyMove.FileCopy(t, ets.Read(EtsRegKeys.ETS_GROUPS) + "misc" + "\\" + t.GetFileName(),
                                          true);
                }

                break;

            case "FS15":
                var fs15 = new Fs15RegWork(true);
                tmp = fs15.Read(Fs15RegKeys.FS15_REPO);
                lst = GetFilesFolders.GetFiles(tmp, "*.zip");
                FolderCreator.CreatePublicFolders(fs15.Read(Fs15RegKeys.FS15_GROUPS) + "misc");
                foreach (var v in lst)
                {
                    FileCopyMove.FileCopy(v, fs15.Read(Fs15RegKeys.FS15_GROUPS) + "misc" + "\\" + v.GetFileName(),
                                          true);
                }

                break;

            case "FS17":
                var fs17 = new Fs17RegWork(true);
                tmp = fs17.Read(Fs17RegKeys.FS17_REPO);
                lst = GetFilesFolders.GetFiles(tmp, "*.zip");
                FolderCreator.CreatePublicFolders(fs17.Read(Fs17RegKeys.FS17_GROUPS) + "misc");
                foreach (var v in lst)
                {
                    FileCopyMove.FileCopy(v, fs17.Read(Fs17RegKeys.FS17_GROUPS) + "misc" + "\\" + v.GetFileName(),
                                          true);
                }

                break;
            }

            var lstCreate = new ListCreator();

            lstCreate.CreateSortedLists();
            lstCreate.SortedFileListComplete();
            MsgBx.Msg("Mod Sorting Complete", "Mod Sorter");
        }