コード例 #1
0
        /// <summary>
        ///     Loads the ats profiles.
        /// </summary>
        /// <returns></returns>
        public IEnumerable <string> LoadEtsProfiles()
        {
            var ets = new EtsRegWork(true);
            var lst = GetFilesFolders.GetFolders(ets.Read(EtsRegKeys.ETS_PROFILES), "*.*");

            return(lst);
        }
コード例 #2
0
        /// <summary>
        ///     Loads the ets group mods.
        /// </summary>
        /// <param name="grp">The GRP.</param>
        /// <returns></returns>
        public IEnumerable <string> LoadEtsGroupMods(string grp)
        {
            var ets = new EtsRegWork(true);
            var lst = GetFilesFolders.GetFiles(ets.Read(EtsRegKeys.ETS_GROUPS) + grp + "\\", "*.scs");

            return(lst);
        }
コード例 #3
0
        /// <summary>
        ///     Loads the ats groups.
        /// </summary>
        /// <returns></returns>
        public IEnumerable <string> LoadEtsGroups()
        {
            var ets = new AtsRegWork(true);
            var lst = GetFilesFolders.GetFolders(ets.Read(EtsRegKeys.ETS_GROUPS), "*.*");

            return(lst);
        }
コード例 #4
0
        /// <summary>
        ///     Loads the Fs15 profiles.
        /// </summary>
        /// <returns></returns>
        public IEnumerable <string> LoadFs15Profiles()
        {
            var fs15 = new Fs15RegWork(true);
            var lst  = GetFilesFolders.GetFolders(fs15.Read(Fs15RegKeys.FS15_PROFILES), "*.*");

            return(lst);
        }
コード例 #5
0
        /// <summary>
        ///     Loads the fs15 group mods.
        /// </summary>
        /// <param name="grp">The GRP.</param>
        /// <returns></returns>
        public IEnumerable <string> LoadFs15GroupMods(string grp)
        {
            var fs15 = new Fs15RegWork(true);
            var lst  = GetFilesFolders.GetFiles(fs15.Read(Fs15RegKeys.FS15_GROUPS) + grp + "\\", "*.zip");

            return(lst);
        }
コード例 #6
0
        /// <summary>
        ///     Loads the ats groups.
        /// </summary>
        /// <returns></returns>
        public IEnumerable <string> LoadFs17Groups()
        {
            var fs17 = new Fs17RegWork(true);
            var lst  = GetFilesFolders.GetFolders(fs17.Read(Fs17RegKeys.FS17_GROUPS), "*.*");

            return(lst);
        }
コード例 #7
0
        private static string GetLocation()
        {
            var gi  = new GameInfo();
            var tmp = gi.GetGame();

            if (tmp.IsNullOrEmpty())
            {
                return(null);
            }


            var pth = string.Empty;

            switch (tmp)
            {
            case "ATS":
                var atsp = new AtsRegWork(true);
                pth = atsp.Read(AtsRegKeys.ATS_GROUPS);
                break;

            case "ETS":
                var etsp = new EtsRegWork(true);
                pth = etsp.Read(EtsRegKeys.ETS_GROUPS);
                break;

            case "FS15":
                var fs15 = new Fs15RegWork(true);
                pth = fs15.Read(Fs15RegKeys.FS15_GROUPS);
                break;

            case "FS17":
                var fs17 = new Fs17RegWork(true);
                pth = fs17.Read(Fs17RegKeys.FS17_GROUPS);
                break;
            }

            var lst = GetFilesFolders.GetFolders(pth, "*.*");
            var frm = new ModMover();

            foreach (var f in lst)
            {
                frm.lstModMove.Items.Add(f);
            }

            frm.ShowDialog();

            var fld = frm.lstModMove.SelectedItem.ToString();

            frm.Close();
            return(fld);
        }
コード例 #8
0
        private static void DeleteMods()
        {
            var    reg = new AtsRegWork(true);
            var    gam = reg.Read(RegKeys.CURRENT_GAME);
            string pth;
            IEnumerable <string> lst;

            switch (gam)
            {
            case "ATS":
                pth = reg.Read(AtsRegKeys.ATS_GAME_MOD_FOLDER);
                if (!pth.FolderExists())
                {
                    return;
                }
                lst = GetFilesFolders.GetFiles(pth, "*.*");
                foreach (var t in lst)
                {
                    try {
                        DeleteFile(t);
                    }
                    catch (Exception g) {
                        MsgBx.Msg(g.ToString(), "Error");
                    }
                }

                FolderCreator.CreatePublicFolders(reg.Read(AtsRegKeys.ATS_GAME_MOD_FOLDER));
                break;

            case "ETS":
                pth = reg.Read(EtsRegKeys.ETS_GAME_MOD_FOLDER);
                if (!pth.FolderExists())
                {
                    return;
                }
                lst = GetFilesFolders.GetFiles(pth, "*.*");
                foreach (var s in lst)
                {
                    try {
                        DeleteFile(s);
                    }
                    catch (Exception g) {
                        MsgBx.Msg(g.ToString(), "Error");
                    }
                }

                FolderCreator.CreatePublicFolders(reg.Read(EtsRegKeys.ETS_GAME_MOD_FOLDER));
                break;
            }
        }
コード例 #9
0
        /// <summary>
        ///     Copy the mods to profile
        /// </summary>
        /// <returns></returns>
        public Dictionary <string, string> CopyProfileMods()
        {
            var reg = new AtsRegWork(true);
            var gam = reg.Read(RegKeys.CURRENT_GAME);
            var ofd = new FolderBrowserDialog {
                Description         = @"Navigate to mods",
                ShowNewFolderButton = false
            };

            ofd.ShowDialog();
            if (!ofd.SelectedPath.FolderExists())
            {
                return(null);
            }
            IEnumerable <string> lst = null;

            switch (gam)
            {
            case "ATS":
                lst = GetFilesFolders.GetFiles(ofd.SelectedPath, "*.scs");
                break;

            case "ETS":
                lst = GetFilesFolders.GetFiles(ofd.SelectedPath, "*.scs");
                break;

            case "FS15":
                lst = GetFilesFolders.GetFiles(ofd.SelectedPath, "*.zip");
                break;

            case "FS17":
                lst = GetFilesFolders.GetFiles(ofd.SelectedPath, "*.zip");
                break;
            }

            return(CreateLinks(lst));
        }
コード例 #10
0
        /// <summary>
        ///     Creates the sorted lists.
        /// </summary>
        public void CreateSortedLists()
        {
            var gi  = new GameInfo();
            var tmp = gi.GetGame();

            if (tmp.IsNullOrEmpty())
            {
                return;
            }
            var src = string.Empty;

            var pth   = string.Empty;
            var cProf = string.Empty;

            switch (tmp)
            {
            case "ATS":
                var atsp = new AtsRegWork(true);
                pth = atsp.Read(AtsRegKeys.ATS_GROUPS);
                src = "*.scs";
                break;

            case "ETS":
                var etsp = new EtsRegWork(true);
                pth = etsp.Read(EtsRegKeys.ETS_GROUPS);
                src = "*.scs";
                break;

            case "FS15":
                var fs15 = new Fs15RegWork(true);
                pth = fs15.Read(Fs15RegKeys.FS15_GROUPS);
                src = "*.zip";
                break;

            case "FS17":
                var fs17 = new Fs17RegWork(true);
                pth   = fs17.Read(Fs17RegKeys.FS17_GROUPS);
                cProf = fs17.Read(Fs17RegKeys.FS17_PROFILES);
                src   = "*.zip";
                break;
            }

            var foldList = GetFilesFolders.GetFolders(pth, "*.*");
            var profList = GetFilesFolders.GetFolders(cProf, "*.*");

            foreach (var v in foldList)
            {
                var lst = GetFilesFolders.GetFiles(v, src);
                var dic = new Dictionary <string, string>();
                foreach (var t in lst)
                {
                    if (CheckPath(t))
                    {
                        continue;
                    }
                    var file = t.GetFileName();
                    var ph   = Path.GetDirectoryName(t);
                    if (dic.ContainsKey(file))
                    {
                        continue;
                    }
                    dic.Add(file, ph + "\\");
                }

                var nam = v.GetLastFolderName();
                Serializer.SerializeDictionary(v + "\\" + nam + ".xml", dic);
            }

            foreach (var v in profList)
            {
                var lst = GetFilesFolders.GetFiles(v, src);
                var dic = new Dictionary <string, string>();
                foreach (var t in lst)
                {
                    if (CheckPath(t))
                    {
                        continue;
                    }
                    var file = t.GetFileName();
                    var ph   = Path.GetDirectoryName(t);
                    if (dic.ContainsKey(file))
                    {
                        continue;
                    }
                    dic.Add(file, ph + "\\");
                }

                var nam = v.GetLastFolderName();
                Serializer.SerializeDictionary(v + "\\" + nam + ".xml", dic);
            }
        }
コード例 #11
0
        /// <summary>
        ///     Makes the sorted list.
        /// </summary>
        public void SortedFileListComplete()
        {
            var dic = new Dictionary <string, string>();
            var gi  = new GameInfo();
            var tmp = gi.GetGame();

            if (tmp.IsNullOrEmpty())
            {
                return;
            }
            IEnumerable <string> lst = null;
            var path = string.Empty;

            switch (tmp)
            {
            case "ATS":
                var atsP = new AtsRegWork(true);
                path       = atsP.Read(AtsRegKeys.ATS_XML) + "sortedFileListComplete.xml";
                FolderPath = atsP.Read(AtsRegKeys.ATS_GROUPS);
                lst        = GetFilesFolders.GetFilesRecursive(FolderPath, "*.scs");
                break;

            case "ETS":
                var etsP = new EtsRegWork(true);
                path       = etsP.Read(EtsRegKeys.ETS_XML) + "sortedFileListComplete.xml";
                FolderPath = etsP.Read(EtsRegKeys.ETS_GROUPS);
                lst        = GetFilesFolders.GetFilesRecursive(FolderPath, "*.scs");
                break;

            case "FS15":
                var fs15 = new Fs15RegWork(true);
                path       = fs15.Read(Fs15RegKeys.FS15_XML) + "sortedFileListComplete.xml";
                FolderPath = fs15.Read(Fs15RegKeys.FS15_GROUPS);
                lst        = GetFilesFolders.GetFilesRecursive(FolderPath, "*.zip");
                break;

            case "FS17":
                var fs17 = new Fs17RegWork(true);
                path       = fs17.Read(Fs17RegKeys.FS17_XML) + "sortedFileListComplete.xml";
                FolderPath = fs17.Read(Fs17RegKeys.FS17_GROUPS);
                lst        = GetFilesFolders.GetFilesRecursive(FolderPath, "*.zip");
                break;
            }

            if (lst.IsNull())
            {
                return;
            }
            Debug.Assert(lst != null, nameof(lst) + " != null");
            foreach (var v in lst)
            {
                var file = v.GetFileName();
                var pth  = Path.GetDirectoryName(v);
                if (dic.ContainsKey(file))
                {
                    continue;
                }
                dic.Add(file, pth + "\\");
            }

            Serializer.SerializeDictionary(path, dic);
            MsgBx.Msg("List Creation Completed", "List Creator");
        }
コード例 #12
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");
        }
コード例 #13
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();
        }
コード例 #14
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");
        }