/// <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); }
/// <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); }
/// <summary> /// Loads the ats mod choice. /// </summary> /// <param name="chc">The CHC.</param> /// <returns></returns> public string LoadEtsModChoice(string chc) { var ets = new EtsRegWork(true); var fnd = string.Empty; var dic = Serializer.DeserializeDictionary(ets.Read(EtsRegKeys.ETS_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> LoadEtsProfileMods(string prof) { var ets = new EtsRegWork(true); var pro = ets.Read(EtsRegKeys.ETS_PROFILES) + ets.Read(RegKeys.CURRENT_PROFILE) + "\\" + prof + ".xml"; if (!pro.FileExists()) { return(null); } var dic = Serializer.DeserializeDictionary(pro); return(dic); }
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); }
/// <summary> /// Starts the ats. /// </summary> public void StartEts() { var ets = new EtsRegWork(true); var gam = ets.Read(EtsRegKeys.ETS_START_GAME_PATH); if (gam.IsNullOrEmpty()) { var ofd = new OpenFileDialog { CheckFileExists = true, Title = @"Navigate to the Euro Truck Simulator Exe" }; ofd.ShowDialog(); gam = ofd.FileName; ets.Write(EtsRegKeys.ETS_START_GAME_PATH, ofd.FileName); } Process.Start(gam); }
private static void CreateFolders() { var atsw = new EtsRegWork(true); var ofd = new FolderBrowserDialog { Description = @"Navigate to where you want the top folder for ETS", ShowNewFolderButton = false }; ofd.ShowDialog(); if (!ofd.SelectedPath.FolderExists()) { return; } var pth = ofd.SelectedPath; FolderCreator.CreatePublicFolders(pth + "\\ETSRepo"); atsw.Write(EtsRegKeys.ETS_REPO, pth + "\\ETSRepo\\"); var tmp = pth + "\\ETSRepo\\"; FolderCreator.CreatePublicFolders(tmp + "ETSExtraction"); atsw.Write(EtsRegKeys.ETS_EXTRACTION, tmp + "ETSExtraction"); FolderCreator.CreatePublicFolders(tmp + "ETSProfiles"); atsw.Write(EtsRegKeys.ETS_PROFILES, tmp + "ETSProfiles\\"); FolderCreator.CreatePublicFolders(tmp + "ETSGroups"); atsw.Write(EtsRegKeys.ETS_GROUPS, tmp + "ETSGroups\\"); FolderCreator.CreatePublicFolders(tmp + "ETSXml"); atsw.Write(EtsRegKeys.ETS_XML, tmp + "ETSXml\\"); FolderCreator.CreatePublicFolders(tmp + "ETSWork"); atsw.Write(EtsRegKeys.ETS_WORK, tmp + "ETSWork\\"); ofd = new FolderBrowserDialog { Description = @"Navigate to your ETS Game Mod Folder", ShowNewFolderButton = false }; ofd.ShowDialog(); if (ofd.SelectedPath.FolderExists()) { atsw.Write(EtsRegKeys.ETS_GAME_MOD_FOLDER, ofd.SelectedPath + "\\"); } MsgBx.Msg("All folders have been created for ETS", "Game Intializer"); }
/// <summary> /// Initializes the ats. /// </summary> public void InitializeEts() { var atsw = new EtsRegWork(true); var tmp = atsw.Read(EtsRegKeys.ETS_REPO); if (!tmp.IsNullOrEmpty()) { return; } var diag = MessageBox.Show(@"Do you want me to setup Euro Truck Simulator 2?", @"ETS Init", MessageBoxButtons.YesNo); if (diag != DialogResult.Yes) { return; } CreateFolders(); }
/// <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); }
/// <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); } }
/// <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"); }
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"); }