Esempio n. 1
0
        private void bSaveWork_Click(object sender, EventArgs e)
        {
            var reg     = new AtsRegWork(true);
            var gam     = reg.Read(RegKeys.CURRENT_GAME);
            var outPath = reg.Read(RegKeys.CURRENT_ORIGINAL_FILE_EDIT_PATH);

            FsZip.CreateArchive(outPath, reg.Read(RegKeys.CURRENT_EXTRACTED_FOLDER_PATH));
            DeleteFiles.DeleteFilesOrFolders(reg.Read(RegKeys.CURRENT_EXTRACTED_FOLDER_PATH));

            tree.Nodes.Clear();

            switch (gam)
            {
            case "ATS":
                FolderCreator.CreatePublicFolders(reg.Read(AtsRegKeys.ATS_WORK));
                break;

            case "ETS":
                FolderCreator.CreatePublicFolders(reg.Read(EtsRegKeys.ETS_WORK));
                break;

            case "FS15":
                FolderCreator.CreatePublicFolders(reg.Read(Fs15RegKeys.FS15_WORK));
                break;

            case "FS17":
                FolderCreator.CreatePublicFolders(reg.Read(Fs17RegKeys.FS17_WORK));
                break;
            }
        }
Esempio n. 2
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;
            }
        }
Esempio n. 3
0
        private static void CreateFolders()
        {
            var atsw = new Fs17RegWork(true);

            var ofd = new FolderBrowserDialog {
                Description         = @"Navigate to where you want the top folder for FS17",
                ShowNewFolderButton = false
            };

            ofd.ShowDialog();
            if (!ofd.SelectedPath.FolderExists())
            {
                return;
            }
            var pth = ofd.SelectedPath;

            FolderCreator.CreatePublicFolders(pth + "\\FS17Repo");
            atsw.Write(Fs17RegKeys.FS17_REPO, pth + "\\FS17Repo\\");
            var tmp = pth + "\\FS17Repo\\";

            FolderCreator.CreatePublicFolders(tmp + "FS17Extraction");
            atsw.Write(Fs17RegKeys.FS17_EXTRACTION, tmp + "FS17Extraction");
            FolderCreator.CreatePublicFolders(tmp + "FS17Profiles");
            atsw.Write(Fs17RegKeys.FS17_PROFILES, tmp + "Fs17Profiles\\");
            FolderCreator.CreatePublicFolders(tmp + "FS17Groups");
            atsw.Write(Fs17RegKeys.FS17_GROUPS, tmp + "FS17Groups\\");
            FolderCreator.CreatePublicFolders(tmp + "FS17Xml");
            atsw.Write(Fs17RegKeys.FS17_XML, tmp + "FS17Xml\\");
            FolderCreator.CreatePublicFolders(tmp + "FS17Work");
            atsw.Write(Fs17RegKeys.FS17_WORK, tmp + "FS17Work\\");

            ofd = new FolderBrowserDialog {
                Description         = @"Navigate to Farming Simulator 2017 Mod Folder",
                ShowNewFolderButton = false
            };
            ofd.ShowDialog();
            if (ofd.SelectedPath.FolderExists())
            {
                atsw.Write(Fs17RegKeys.FS17_GAME_MOD_FOLDER, ofd.SelectedPath + "\\");
                var t   = ofd.SelectedPath.LastIndexOf("\\", StringComparison.OrdinalIgnoreCase);
                var fix = ofd.SelectedPath.Substring(0, t) + "\\";
                atsw.Write(Fs17RegKeys.FS17_GAME_SETTINGS_XML, fix + "gameSettings.xml");
            }

            MsgBx.Msg("All folders have been created for FS17", "Game Intializer");
        }
Esempio n. 4
0
        private static void CreateFolders()
        {
            var atsw = new AtsRegWork(true);

            var ofd = new FolderBrowserDialog {
                Description         = @"Navigate to where you want the top folder for ATS",
                ShowNewFolderButton = false
            };

            ofd.ShowDialog();
            if (!ofd.SelectedPath.FolderExists())
            {
                return;
            }
            var pth = ofd.SelectedPath;

            FolderCreator.CreatePublicFolders(pth + "\\ATSRepo");
            atsw.Write(AtsRegKeys.ATS_REPO, pth + "\\ATSRepo\\");
            var tmp = pth + "\\ATSRepo\\";

            FolderCreator.CreatePublicFolders(tmp + "ATSExtraction");
            atsw.Write(AtsRegKeys.ATS_EXTRACTION, tmp + "ATSExtraction");
            FolderCreator.CreatePublicFolders(tmp + "ATSProfiles");
            atsw.Write(AtsRegKeys.ATS_PROFILES, tmp + "ATSProfiles\\");
            FolderCreator.CreatePublicFolders(tmp + "ATSGroups");
            atsw.Write(AtsRegKeys.ATS_GROUPS, tmp + "ATSGroups\\");
            FolderCreator.CreatePublicFolders(tmp + "ATSXml");
            atsw.Write(AtsRegKeys.ATS_XML, tmp + "ATSXml\\");
            FolderCreator.CreatePublicFolders(tmp + "ATSWork");
            atsw.Write(AtsRegKeys.ATS_WORK, tmp + "ATSWork\\");

            ofd = new FolderBrowserDialog {
                Description         = @"Navigate to your ATS Game Mod Folder",
                ShowNewFolderButton = false
            };
            ofd.ShowDialog();
            if (ofd.SelectedPath.FolderExists())
            {
                atsw.Write(AtsRegKeys.ATS_GAME_MOD_FOLDER, ofd.SelectedPath + "\\");
            }

            MsgBx.Msg("All folders have been created for ATS", "Game Intializer");
        }
Esempio n. 5
0
        /// <summary>
        ///     Adds the new profile.
        /// </summary>
        /// <param name="nam">The nam.</param>
        public void AddNewProfile(string nam)
        {
            var gi  = new GameInfo();
            var gam = gi.GetGame();

            if (gam.IsNullOrEmpty())
            {
                return;
            }
            var pth = string.Empty;

            switch (gam)
            {
            case "ATS":
                var atsp = new AtsRegWork(true);
                pth = atsp.Read(AtsRegKeys.ATS_PROFILES) + nam;
                break;

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

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

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

            FolderCreator.CreatePublicFolders(pth);
        }
Esempio n. 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");
        }
Esempio n. 7
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();
        }
Esempio n. 8
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");
        }