Exemplo n.º 1
0
        private void removeProfileToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var prof = new ProfileWorker();
            var lst  = prof.ProfileRemove();

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

            lblProfiles.Text = @"Active Profiles: " + lstProfiles.Items.Count;
        }
Exemplo n.º 2
0
        private void bAddNewProfile_Click(object sender, EventArgs e)
        {
            var reg = new AtsRegWork(true);
            var gam = reg.Read(RegKeys.CURRENT_GAME);

            if (txtAddProfile.Text.IsNullOrEmpty())
            {
                return;
            }
            var prof = new ProfileWorker();

            prof.AddNewProfile(txtAddProfile.Text);
            txtAddProfile.Text = string.Empty;
            lblProfiles.Text   = @"Active Profiles: " + lstProfiles.Items.Count;
            GameLoader(gam);
        }
Exemplo n.º 3
0
        private void removeModToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (lstProfileMods.SelectedItem.IsNull())
            {
                return;
            }
            var prof = new ProfileWorker();
            var dic  = prof.ProfileRemoveMod(lstProfileMods.SelectedItem.ToString());

            lstProfileMods.Items.Clear();

            foreach (var v in dic)
            {
                lstProfileMods.Items.Add(v.Key);
            }

            label2.Text = @"Active Mods: " + lstProfileMods.Items.Count;
        }
Exemplo n.º 4
0
        private static Dictionary <string, string> CreateLinks(IEnumerable <string> lst)
        {
            var reg      = new AtsRegWork(true);
            var pf       = new ProfileWorker();
            var gam      = reg.Read(RegKeys.CURRENT_GAME);
            var profile  = reg.Read(RegKeys.CURRENT_PROFILE);
            var pth      = string.Empty;
            var dic      = new Dictionary <string, string>();
            var linkPath = string.Empty;

            switch (gam)
            {
            case "ATS":
                pth      = reg.Read(AtsRegKeys.ATS_PROFILES) + profile + "\\" + profile + ".xml";
                linkPath = reg.Read(AtsRegKeys.ATS_GAME_MOD_FOLDER);
                break;

            case "ETS":
                pth      = reg.Read(EtsRegKeys.ETS_PROFILES) + profile + "\\" + profile + ".xml";
                linkPath = reg.Read(EtsRegKeys.ETS_GAME_MOD_FOLDER);
                break;

            case "FS15":
                pth      = reg.Read(Fs15RegKeys.FS15_PROFILES) + profile + "\\" + profile + ".xml";
                linkPath = reg.Read(Fs15RegKeys.FS15_PROFILES) + profile + "\\";
                break;

            case "FS17":
                pth      = reg.Read(Fs17RegKeys.FS17_PROFILES) + profile + "\\" + profile + ".xml";
                linkPath = reg.Read(Fs17RegKeys.FS17_PROFILES) + profile + "\\";
                break;
            }

            if (pth.FileExists())
            {
                dic = Serializer.DeserializeDictionary(pth);
                foreach (var v in lst)
                {
                    var file = v.GetFileName();
                    var pt   = Path.GetDirectoryName(v) + "\\";
                    SymLinks.CreateSymLink(linkPath + file, v, 0);
                    dic.Add(file, pt);
                }

                Serializer.SerializeDictionary(pth, dic);
            }
            else if (!pth.FileExists())
            {
                foreach (var v in lst)
                {
                    var file = v.GetFileName();
                    var pt   = Path.GetDirectoryName(v) + "\\";
                    SymLinks.CreateSymLink(linkPath + file, v, 0);
                    dic.Add(file, pt);
                }

                Serializer.SerializeDictionary(pth, dic);
            }

            pf.SetProfileActive();

            return(dic);
        }
Exemplo n.º 5
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");
        }
Exemplo n.º 6
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;
        }