예제 #1
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");
        }
예제 #2
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");
        }
예제 #3
0
        /// <summary>
        ///     Sorts the mods.
        /// </summary>
        public void SortMods()
        {
            SetSearchLists();

            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;
            }

            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);
                tmp = fs17.Read(Fs17RegKeys.FS17_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(fs17.Read(Fs17RegKeys.FS17_GROUPS) + t);
                        FileCopyMove.FileCopy(v, fs17.Read(Fs17RegKeys.FS17_GROUPS) + t + "\\" + v.GetFileName(),
                                              true);
                    }
                }

                break;
            }

            DoCleanUp();
        }
예제 #4
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");
        }