Ejemplo n.º 1
0
        private void LoadProfileMods()
        {
            var reg = new AtsRegWork(true);
            var gam = reg.Read(RegKeys.CURRENT_GAME);

            if (lstSortMods.SelectedItem.IsNull())
            {
                return;
            }
            var chc = lstSortMods.SelectedItem.ToString();

            lstAvailableMods.Items.Clear();
            IEnumerable <string> lst = null;

            switch (gam)
            {
            case "ATS":
                var ats = new AtsLoader();
                lst = ats.LoadAtsGroupMods(chc);
                break;

            case "ETS":
                var ets = new EtsLoader();
                lst = ets.LoadEtsGroupMods(chc);
                break;

            case "FS15":
                var fs15 = new Fs15Loader();
                lst = fs15.LoadFs15GroupMods(chc);
                break;

            case "FS17":
                var fs17 = new Fs17Loader();
                lst = fs17.LoadFs17GroupMods(chc);
                break;
            }

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

            CheckModCount();
        }
Ejemplo n.º 2
0
        private void Fs17Load()
        {
            var fs17      = new Fs17Loader();
            var profLst   = fs17.LoadFs17Profiles();
            var groupsLst = fs17.LoadFs17Groups();

            lstProfiles.Items.Clear();
            lstSortMods.Items.Clear();
            foreach (var v in profLst)
            {
                lstProfiles.Items.Add(v.GetLastFolderName());
            }

            lblProfiles.Text = @"Active Profiles: " + lstProfiles.Items.Count;

            foreach (var t in groupsLst)
            {
                lstSortMods.Items.Add(t.GetLastFolderName());
            }

            LoadProfileMods();
        }
Ejemplo n.º 3
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");
        }
Ejemplo n.º 4
0
        private void lstProfiles_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (lstProfiles.SelectedItem.IsNull())
            {
                return;
            }
            var reg = new AtsRegWork(true);
            var gam = reg.Read(RegKeys.CURRENT_GAME);

            if (gam.IsNullOrEmpty())
            {
                return;
            }
            lstProfileMods.Items.Clear();
            Dictionary <string, string> lst = null;

            lblActiveProfile.Text = @"Active Profile: " + lstProfiles.SelectedItem;
            reg.Write(RegKeys.CURRENT_PROFILE, lstProfiles.SelectedItem);

            switch (gam)
            {
            case "ATS":
                var prof = new ProfileWorker();
                var ats  = new AtsLoader();
                lst = ats.LoadAtsProfileMods(lstProfiles.SelectedItem.ToString());
                prof.SetProfileActive();
                break;

            case "ETS":
                prof = new ProfileWorker();
                var ets = new EtsLoader();
                lst = ets.LoadEtsProfileMods(lstProfiles.SelectedItem.ToString());
                prof.SetProfileActive();
                break;

            case "FS15":
                prof = new ProfileWorker();
                var fs15 = new Fs15Loader();
                lst = fs15.LoadFs15ProfileMods(lstProfiles.SelectedItem.ToString());
                prof.SetProfileActive();
                break;

            case "FS17":
                prof = new ProfileWorker();
                var fs17 = new Fs17Loader();
                lst = fs17.LoadFs17ProfileMods(lstProfiles.SelectedItem.ToString());
                prof.SetProfileActive();
                lblProfiles.Text = @"Active Profiles: " + lstProfiles.Items.Count;
                break;
            }

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

            label2.Text = @"Active Mods: " + lstProfileMods.Items.Count;
        }
Ejemplo n.º 5
0
        private void farmingSimulator2017ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var ldr = new Fs17Loader();

            ldr.StartFs17();
        }
Ejemplo n.º 6
0
        /// <summary>
        ///     Loads the favorites.
        /// </summary>
        public static Dictionary <string, string> LoadFavorites(string mke)
        {
            var fs17  = new Fs17Loader();
            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(null);
            }

            var dic = new Dictionary <string, string>()
            ;

            switch (mke)
            {
            case "Claas":
                dic = Serializer.DeserializeDictionary(reg.Read(Fs17RegKeys.FS17_GROUPS) + @"\claas.xml");
                break;

            case "Krone":
                dic = Serializer.DeserializeDictionary(reg.Read(Fs17RegKeys.FS17_GROUPS) + @"\krone.xml");
                break;

            case "NewHolland":
                dic = Serializer.DeserializeDictionary(reg.Read(Fs17RegKeys.FS17_GROUPS) + @"\newholland.xml");
                break;

            case "JohnDeere":
                dic = Serializer.DeserializeDictionary(reg.Read(Fs17RegKeys.FS17_GROUPS) + @"\johndeere.xml");
                break;

            case "MasseyFerguson":
                dic = Serializer.DeserializeDictionary(reg.Read(Fs17RegKeys.FS17_GROUPS) + @"\masseyferguson.xml");
                break;

            case "Fendt":
                dic = Serializer.DeserializeDictionary(reg.Read(Fs17RegKeys.FS17_GROUPS) + @"\fendt.xml");
                break;

            case "Case":
                dic = Serializer.DeserializeDictionary(reg.Read(Fs17RegKeys.FS17_GROUPS) + @"\case.xml");
                break;

            case "Plows":
                dic = Serializer.DeserializeDictionary(reg.Read(Fs17RegKeys.FS17_GROUPS) + @"\plows.xml");
                break;

            case "Cultivators":
                dic = Serializer.DeserializeDictionary(reg.Read(Fs17RegKeys.FS17_GROUPS) + @"\cultivators.xml");
                break;

            case "Placeables":
                dic = Serializer.DeserializeDictionary(reg.Read(Fs17RegKeys.FS17_GROUPS) + @"\placeables.xml");
                break;

            case "Specials":
                dic = Serializer.DeserializeDictionary(reg.Read(Fs17RegKeys.FS17_GROUPS) + @"\specials.xml");
                break;

            case "TractorsOther":
                dic = Serializer.DeserializeDictionary(reg.Read(Fs17RegKeys.FS17_GROUPS) + @"\tractorsOther.xml");
                break;

            case "Balers":
                dic = Serializer.DeserializeDictionary(reg.Read(Fs17RegKeys.FS17_GROUPS) + @"\balers.xml");
                break;

            case "Trailers":
                dic = Serializer.DeserializeDictionary(reg.Read(Fs17RegKeys.FS17_GROUPS) + @"\trailers.xml");
                break;

            case "Tools":
                dic = Serializer.DeserializeDictionary(reg.Read(Fs17RegKeys.FS17_GROUPS) + @"\tools.xml");
                break;
            }


            var lnkPth = reg.Read(Fs17RegKeys.FS17_PROFILES) + cProf + "\\";

            foreach (var v in dic)
            {
                var tmp = lnkPth + v.Key;
                if (tmp.FileExists())
                {
                    continue;
                }
                var org = v.Value + v.Key;
                if (!org.FileExists())
                {
                    continue;
                }
                //CreateSymbolicLink(tmp, org, SymbolicLink.File);
                //SymLinks.CreateSymLink(tmp, org, 0);
                // FileCopyMove.FileCopy(org, tmp);

                CreateHardLink(tmp, org, IntPtr.Zero);
            }

            var lc = new ListCreator();

            lc.CreateSortedLists();

            var lst = fs17.LoadFs17ProfileMods(reg.Read(RegKeys.CURRENT_PROFILE));

            return(lst);
        }