/// <summary>
        ///     Loads the ats profiles.
        /// </summary>
        /// <returns></returns>
        public IEnumerable <string> LoadFs17Profiles()
        {
            var fs17 = new Fs17RegWork(true);
            var lst  = GetFilesFolders.GetFolders(fs17.Read(Fs17RegKeys.FS17_PROFILES), "*.*");

            return(lst);
        }
        /// <summary>
        ///     Loads the fs17 group mods.
        /// </summary>
        /// <param name="grp">The GRP.</param>
        /// <returns></returns>
        public IEnumerable <string> LoadFs17GroupMods(string grp)
        {
            var fs17 = new Fs17RegWork(true);
            var lst  = GetFilesFolders.GetFiles(fs17.Read(Fs17RegKeys.FS17_GROUPS) + grp + "\\", "*.zip");

            return(lst);
        }
Exemple #3
0
        public void BypassSort(string fldName)
        {
            var          fs      = new Fs17RegWork(false);
            var          chkName = fldName.GetLastFolderName();
            const string BYPASS  = "******";
            var          pth     = fs.Read(Fs17RegKeys.FS17_GROUPS) + "\\" + BYPASS;

            if (pth.FileExists())
            {
                var dic = Serializer.DeserializeDictionary(pth);
                if (dic.ContainsKey(chkName))
                {
                    MsgBx.Msg("That Mod has already been added to the bypass list.", "Error");
                    return;
                }
                dic.Add(fldName, fs.Read(Fs17RegKeys.FS17_GROUPS) + "\\");
                Serializer.SerializeDictionary(pth, dic);
            }
            else
            {
                var sb = new Dictionary <string, string> {
                    { fldName, fs.Read(Fs17RegKeys.FS17_GROUPS) + "\\" }
                };
                Serializer.SerializeDictionary(pth, sb);
            }
        }
Exemple #4
0
        public Dictionary <string, string> GetBypassList()
        {
            var          fs     = new Fs17RegWork(false);
            const string BYPASS = "******";
            var          pth    = fs.Read(Fs17RegKeys.FS17_GROUPS) + "\\" + BYPASS;

            return(Serializer.DeserializeDictionary(pth));
        }
        /// <summary>
        ///     Loads the Fs17 mod choice.
        /// </summary>
        /// <param name="chc">The CHC.</param>
        /// <returns></returns>
        public string LoadFs17ModChoice(string chc)
        {
            var ets = new Fs17RegWork(true);
            var fnd = string.Empty;
            var dic = Serializer.DeserializeDictionary(ets.Read(Fs17RegKeys.FS17_XML) + "sortedFileListComplete.xml");

            if (dic.Any(v => string.Equals(v.Key, chc, StringComparison.OrdinalIgnoreCase)))
            {
                dic.TryGetValue(chc, out fnd);
            }
            return(fnd + chc);
        }
        /// <summary>
        ///     Loads the ats profile mods.
        /// </summary>
        /// <param name="prof">The PTH.</param>
        /// <returns></returns>
        public Dictionary <string, string> LoadFs17ProfileMods(string prof)
        {
            var fs17 = new Fs17RegWork(true);
            var pro  = fs17.Read(Fs17RegKeys.FS17_PROFILES) + prof + "\\" + prof + ".xml";

            if (!pro.FileExists())
            {
                return(null);
            }
            var dic = Serializer.DeserializeDictionary(pro);

            return(dic);
        }
Exemple #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);
        }
        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");
        }
        /// <summary>
        ///     Starts the FS17.
        /// </summary>
        public void StartFs17()
        {
            var fs17 = new Fs17RegWork(true);
            var gam  = fs17.Read(Fs17RegKeys.FS17_START_GAME_PATH);

            if (gam.IsNullOrEmpty())
            {
                var ofd = new OpenFileDialog {
                    CheckFileExists = true,
                    Title           = @"Navigate to the Farming Simulator 2017 Exe"
                };

                ofd.ShowDialog();
                gam = ofd.FileName;
                fs17.Write(Fs17RegKeys.FS17_START_GAME_PATH, ofd.FileName);
            }

            Process.Start(gam);
        }
Exemple #10
0
        /// <summary>
        ///     Initializes the Fs15.
        /// </summary>
        public void InitializeFs17()
        {
            var fs  = new Fs17RegWork(true);
            var tmp = fs.Read(Fs17RegKeys.FS17_REPO);

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

            var diag = MessageBox.Show(@"Do you want me to setup Farming Simulator 2017?", @"FS 17 Init",
                                       MessageBoxButtons.YesNo);

            if (diag != DialogResult.Yes)
            {
                return;
            }

            CreateFolders();
        }
Exemple #11
0
        /// <summary>
        ///     Creates the favorite.
        /// </summary>
        /// <param name="mod">The mod.</param>
        public static void CreateFavorite(string mod)
        {
            var dic = new Dictionary <string, string>();

            var reg = new Fs17RegWork(true);

            var grpPath = reg.Read(Fs17RegKeys.FS17_GROUPS);
            var xFile   = grpPath + "\\claas.xml";

            if (xFile.FileExists())
            {
                dic = Serializer.DeserializeDictionary(xFile);
                dic.Add(mod, grpPath + "\\" + Vars.FldName + "\\");
            }
            else
            {
                dic.Add(mod, grpPath + "\\" + Vars.FldName + "\\");
            }

            Serializer.SerializeDictionary(xFile, dic);
        }
        /// <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);
        }
Exemple #13
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");
        }
Exemple #14
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);
            }
        }
Exemple #15
0
        private void toolStripMenuItem1_Click(object sender, EventArgs e)
        {
            var reg   = new AtsRegWork(true);
            var gam   = reg.Read(RegKeys.CURRENT_GAME);
            var cProf = reg.Read(RegKeys.CURRENT_PROFILE);

            if (gam.IsNullOrEmpty() || cProf.IsNullOrEmpty())
            {
                MsgBx.Msg("You need to have a Profile / Game active", "Process Error");
                return;
            }

            string tmp;
            string profPath;
            Dictionary <string, string> lst = null;

            lstProfileMods.Items.Clear();

            switch (gam)
            {
            case "ATS":
                var ats  = new AtsLoader();
                var atsp = new AtsRegWork(true);
                var prof = new ProfileWorker();
                tmp      = ats.LoadAtsModChoice(lstAvailableMods.SelectedItem.ToString());
                profPath = atsp.Read(AtsRegKeys.ATS_GAME_MOD_FOLDER) + tmp.GetFileName();
                prof.BuildProfileList(lstAvailableMods.SelectedItem.ToString());
                SymLinks.CreateSymLink(profPath, tmp, 0);
                lst = ats.LoadAtsProfileMods(reg.Read(RegKeys.CURRENT_PROFILE));
                break;

            case "ETS":
                var ets  = new EtsLoader();
                var etsp = new EtsRegWork(true);
                prof     = new ProfileWorker();
                tmp      = ets.LoadEtsModChoice(lstAvailableMods.SelectedItem.ToString());
                profPath = etsp.Read(EtsRegKeys.ETS_GAME_MOD_FOLDER) + tmp.GetFileName();
                prof.BuildProfileList(lstAvailableMods.SelectedItem.ToString());
                SymLinks.CreateSymLink(profPath, tmp, 0);
                lst = ets.LoadEtsProfileMods(reg.Read(RegKeys.CURRENT_PROFILE));
                break;

            case "FS15":
                var fs15  = new Fs15Loader();
                var fs15P = new Fs15RegWork(true);
                tmp      = fs15.LoadFs15ModChoice(lstAvailableMods.SelectedItem.ToString());
                profPath = fs15P.Read(Fs15RegKeys.FS15_PROFILES) + reg.Read(RegKeys.CURRENT_PROFILE) + "\\" +
                           tmp.GetFileName();
                prof = new ProfileWorker();
                prof.BuildProfileList(lstAvailableMods.SelectedItem.ToString());
                SymLinks.CreateSymLink(profPath, tmp, 0);
                lst = fs15.LoadFs15ProfileMods(reg.Read(RegKeys.CURRENT_PROFILE));
                break;

            case "FS17":
                var fs17  = new Fs17Loader();
                var fs17P = new Fs17RegWork(true);
                tmp      = fs17.LoadFs17ModChoice(lstAvailableMods.SelectedItem.ToString());
                profPath = fs17P.Read(Fs17RegKeys.FS17_PROFILES) + reg.Read(RegKeys.CURRENT_PROFILE) + "\\" +
                           tmp.GetFileName();
                prof = new ProfileWorker();
                prof.BuildProfileList(lstAvailableMods.SelectedItem.ToString());
                SymLinks.CreateSymLink(profPath, tmp, 0);
                lst = fs17.LoadFs17ProfileMods(reg.Read(RegKeys.CURRENT_PROFILE));
                break;
            }

            if (lst == null)
            {
                return;
            }
            foreach (var v in lst)
            {
                lstProfileMods.Items.Add(v.Key);
            }

            CheckModCount();
            label2.Text = @"Active Mods: " + lstProfileMods.Items.Count;

            // MsgBx.Msg("Profile Link Created", "Linker");
        }
        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");
        }
        /// <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();
        }
        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");
        }
Exemple #19
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="mke"></param>
        /// <param name="mod"></param>
        public static void CreateLoadouts(string mke, string mod)
        {
            var dic = new Dictionary <string, string>();
            var reg = new Fs17RegWork(true);
            var pth = reg.Read(Fs17RegKeys.FS17_GROUPS);
            var pt  = string.Empty;

            switch (mke)
            {
            case "Claas":
                pt = pth + @"\claas.xml";
                break;

            case "Krone":
                pt = pth + @"\krone.xml";
                break;

            case "NewHolland":
                pt = pth + @"\newholland.xml";
                break;

            case "JohnDeere":
                pt = pth + @"\johndeere.xml";
                break;

            case "MasseyFerguson":
                pt = pth + @"\masseyferguson.xml";
                break;

            case "Fendt":
                pt = pth + @"\fendt.xml";
                break;

            case "Case":
                pt = pth + @"\case.xml";
                break;

            case "Plows":
                pt = pth + @"\plows.xml";
                break;

            case "Cultivators":
                pt = pth + @"\cultivators.xml";
                break;

            case "Placeables":
                pt = pth + @"\placeables.xml";
                break;

            case "Specials":
                pt = pth + @"\specials.xml";
                break;

            case "TractorsOther":
                pt = pth + @"\tractorsother.xml";
                break;

            case "Tools":
                pt = pth + @"\tools.xml";
                break;

            case "Balers":
                pt = pth + @"\balers.xml";
                break;

            case "Trailers":
                pt = pth + @"\trailers.xml";
                break;
            }

            if (pt.FileExists())
            {
                dic = Serializer.DeserializeDictionary(pt);
            }

            if (dic.ContainsKey(mod))
            {
                return;
            }
            dic.Add(mod, pth + @"\" + Vars.FldName + @"\");
            Serializer.SerializeDictionary(pt, dic);
        }