protected void ModPacksManagerModPackManagerAdded(object sender, ModPack pack) { if (!pack.IsDummy) { base.BeginInvoke(new MethodInvoker(() => this.AddAllFiles(pack))); } }
private void gridView_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex != 3 || e.RowIndex == -1) { return; } DataGridViewRow item = this.gridView.Rows[e.RowIndex]; string fileName = ModsSelector.GetFileName(item); ModPack selectedPack = ModsSelector.GetSelectedPack(item); try { if (!this.IsDisabled(item)) { ModPlayer.Play(selectedPack.Files.FindByName(fileName)); } else { ModPlayer.Play(GlobalData.ElswordFilesInfo.FindByName(fileName)); } } catch (Exception exception) { MsgBox.Error(exception.Message); } }
private int loadxmlfile(IntPtr L) { var fileName = Melua.luaL_checkstring(L, 1); Melua.lua_pop(L, 1); fileName = ModPack.NormalizePath(fileName); if (!fileName.EndsWith(".xml") && !fileName.EndsWith(".xml.compiled")) { return(Melua.melua_error(L, "Expected XML file extension.")); } if (!FileExistsInPackages(fileName)) { return(Melua.melua_error(L, "File '{0}' not found in packages.", fileName)); } try { _loadedXmlFile = fileName; _loadedXmlModder = _modPack.GetXmlModder(fileName); return(0); } catch (XmlException ex) { _loadedXmlFile = null; _loadedXmlModder = null; return(Melua.melua_error(L, "Failed to parse XML: '{0}'", ex.Message)); } }
public ImportModPackWizard(ModPackJson modPackJson, Dictionary <string, MagickImage> imageDictionary, DirectoryInfo modPackDirectory) { InitializeComponent(); _imageDictionary = imageDictionary; _modPackDirectory = modPackDirectory; ModPackNameLabel.Content = modPackJson.Name; ModPackAuthorLabel.Content = modPackJson.Author; ModPackVersionLabel.Content = modPackJson.Version; ModPackDescription.Text = modPackJson.Description; _modPackEntry = new ModPack { name = modPackJson.Name, author = modPackJson.Author, version = modPackJson.Version }; _pageCount = modPackJson.ModPackPages.Count; var wizPages = importModPackWizard.Items; for (var i = 0; i < _pageCount; i++) { wizPages.Add(new WizardPage { Content = new ImportWizardModPackControl(modPackJson.ModPackPages[i], imageDictionary), PageType = WizardPageType.Blank }); } }
protected void ModPacksManagerModPackManagerRemoved(object sender, ModPack pack) { if (!pack.IsDummy) { base.BeginInvoke(new MethodInvoker(() => this.RemoveAll(pack))); } }
public ImportModPackWizard(ModPackJson modPackJson, Dictionary <string, Image> imageDictionary, DirectoryInfo modPackDirectory, TextureViewModel textureViewModel, ModelViewModel modelViewModel, bool messageInImport = false) { InitializeComponent(); _imageDictionary = imageDictionary; _modPackDirectory = modPackDirectory; _messageInImport = messageInImport; _textureViewModel = textureViewModel; _modelViewModel = modelViewModel; ModPackNameLabel.Content = modPackJson.Name; ModPackAuthorLabel.Content = modPackJson.Author; ModPackVersionLabel.Content = modPackJson.Version; ModPackDescription.Text = modPackJson.Description; _modPackEntry = new ModPack { name = modPackJson.Name, author = modPackJson.Author, version = modPackJson.Version }; _pageCount = modPackJson.ModPackPages.Count; var wizPages = importModPackWizard.Items; for (var i = 0; i < _pageCount; i++) { wizPages.Add(new WizardPage { Content = new ImportWizardModPackControl(modPackJson.ModPackPages[i], imageDictionary), PageType = WizardPageType.Blank, Background = null, HeaderBackground = null }); } }
/// <summary> /// Event handler for when the selection in the modpack list changes /// </summary> private void ModpackList_SelectionChanged(object sender, RoutedEventArgs e) { List <ModsJson> selectedModsJsons = new List <ModsJson>(); ModPack selectedModpack = null; var selectedModpackName = ((BackupModpackItemEntry)ModpackList.SelectedItem).ModpackName; if (selectedModpackName == UIStrings.Standalone_Non_ModPack) { selectedModsJsons = _modsJsons.FindAll(modsJson => modsJson.ModPackEntry == null); } else { selectedModsJsons = _modsJsons.FindAll(modsJson => modsJson.ModPackEntry?.name == selectedModpackName); selectedModpack = selectedModsJsons[0].ModPackEntry; } var modsInModpack = new List <Mod>(); foreach (var modsJson in selectedModsJsons) { var mod = Mod.MakeModFromJson(modsJson, XivStrings.TexTools); modsInModpack.Add(mod); } (DataContext as BackupModpackViewModel).UpdateDescription(selectedModpack, modsInModpack); }
public void SetModOnAllRows(ModPack mod) { foreach (DataGridViewRow row in (IEnumerable)this.gridView.Rows) { this.SetModOn(row, mod); } }
private static void Edit(ModPack pack) { using (ModEditorForm modEditorForm = new ModEditorForm(pack)) { modEditorForm.ShowDialog(); } }
private void Modify() { try { var dataPath = "data"; var packagesPath = ModPack.GetPackagePath(); var fileListPath = Path.Combine(ToolFolderName, FileListFileName); var fileNames = Directory.EnumerateFiles(dataPath, "*", SearchOption.AllDirectories).Select(a => ModPack.NormalizePath(a).Replace(ModPack.NormalizePath(dataPath + "/"), "")).ToArray(); if (fileNames == null || !fileNames.Any()) { Trace.WriteLine("Void file name list empty."); return; } foreach (var path in Directory.EnumerateFiles(packagesPath, "*.pack", SearchOption.TopDirectoryOnly).OrderBy(a => a)) { Trace.WriteLine(string.Format("Voiding {0}...", Path.GetFileName(path))); PackVoider.ModifyFileNamesInPack(path, fileNames, true); } Trace.WriteLine("Done voiding file names in pack files, to make client use the files in the data folder."); File.WriteAllLines(fileListPath, fileNames); } catch (IOException ex) { Trace.WriteLine("Error while modifying pack file: " + ex.Message); } catch (Exception ex) { Trace.WriteLine("Error while enabling files: " + ex.GetType().Name + Environment.NewLine + ex); } }
private void SetAllSelectors(ModPack mod) { ModsSelector[] modsSelectorArray = this._modsSelectors; for (int i = 0; i < (int)modsSelectorArray.Length; i++) { modsSelectorArray[i].SetModOnAllRows(mod); } }
private void runPrepare(ModPack pContainer) { VpkCompiler.Clean(); VpkCompiler.Create(); ReadFile(pContainer.Name); VpkCompiler.Copy(pContainer); }
private void RemoveAll(ModPack pack) { foreach (string str in from f in pack.Files select f.FileName) { this.Remove(str, pack); } }
public void SetModOn(DataGridViewRow row, ModPack mod) { DataGridViewComboBoxCell comboBoxCell = ModsSelector.GetComboBoxCell(row); if (ModsSelector.GetDataSource(comboBoxCell).Any <ModPack>((ModPack m) => m == mod)) { comboBoxCell.Value = mod; } }
private bool IsInsideCwd(string path) { var fullPath = Path.GetFullPath(Path.Combine(_cwd, path)); var cwd = Path.GetFullPath(_cwd); fullPath = ModPack.NormalizePath(fullPath); cwd = ModPack.NormalizePath(cwd); return(fullPath.StartsWith(cwd)); }
public bool SDKInstall(ModPack pContainer, Steam pSteam) { runPrepare(pContainer); if (TrySDKInstalls(pSteam) != 0) { return(false); } runEnd(pContainer); return(true); }
public void SetModOnSelectedRows(ModPack mod) { foreach (DataGridViewRow dataGridViewRow in from DataGridViewRow row in this.gridView.SelectedRows where row.Index != -1 select row) { this.SetModOn(dataGridViewRow, mod); } }
public bool Install(ModPack pContainer) { runPrepare(pContainer); if (VpkCompiler.Run() != 0) { return(false); } runEnd(pContainer); return(true); }
private void AskAndSet(string modName) { if (System.Windows.Forms.DialogResult.Yes != MsgBox.Question(gPatcher.Localization.Text.Question_SetModNow)) { return; } ModPack modPack = GlobalData.ModPacksManager.FindByName(modName); this.cbxSetMod.SelectedItem = modPack; this.SetAllSelectors(modPack); }
public ZipExportDialog(ModPack modPack, string zipPath) { if (modPack.IsDummy) { throw new Exception("It's not possible to export dummy ModPack objects."); } this.InitializeComponent(); this.lblCurrentFile.Text = gPatcher.Localization.Text.Window_ZipSavingDialog_Text; this._modPack = modPack; this._zipPath = zipPath; }
public ImportModPackWizard(ModPackJson modPackJson, Dictionary <string, Image> imageDictionary, DirectoryInfo modPackDirectory, TextureViewModel textureViewModel, ModelViewModel modelViewModel, bool messageInImport = false) { InitializeComponent(); _imageDictionary = imageDictionary; _modPackDirectory = modPackDirectory; _messageInImport = messageInImport; _textureViewModel = textureViewModel; _modelViewModel = modelViewModel; ModPackNameLabel.Content = modPackJson.Name; ModPackAuthorLabel.Content = modPackJson.Author; ModPackVersionLabel.Content = modPackJson.Version; ModPackDescription.Text = modPackJson.Description; ModPackUrlLabel.Text = modPackJson.Url; ModPackUrlLabel.PreviewMouseLeftButtonDown += ModPackUrlLabel_PreviewMouseLeftButtonDown; if (!String.IsNullOrEmpty(modPackJson.MinimumFrameworkVersion)) { Version ver; bool success = Version.TryParse(modPackJson.MinimumFrameworkVersion, out ver); if (success) { var frameworkVersion = typeof(XivCache).Assembly.GetName().Version; if (ver > frameworkVersion) { var Win32Window = new WindowWrapper(new WindowInteropHelper(this).Handle); FlexibleMessageBox.Show(Win32Window, "This Modpack requires a more recent version of TexTools to install.", "Framework Version Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); Close(); return; } } } _modPackEntry = new ModPack { name = modPackJson.Name, author = modPackJson.Author, version = modPackJson.Version }; _pageCount = modPackJson.ModPackPages.Count; var wizPages = importModPackWizard.Items; for (var i = 0; i < _pageCount; i++) { wizPages.Add(new WizardPage { Content = new ImportWizardModPackControl(modPackJson.ModPackPages[i], imageDictionary), PageType = WizardPageType.Blank, Background = null, HeaderBackground = null }); } }
private void tsmi_EditOn_WExplorer_Click(object sender, EventArgs e) { ModPack selectedPack = this.GetSelectedPack(); try { Process.Start(selectedPack.FullName); } catch (Exception exception) { MsgBox.Error(gPatcher.Localization.Text.Error_OpenInExplorer, exception); } }
public ImportModPackWizard(ModPackJson modPackJson, Dictionary <string, Image> imageDictionary, DirectoryInfo modPackDirectory, TextureViewModel textureViewModel, ModelViewModel modelViewModel, bool messageInImport = false) { InitializeComponent(); _imageDictionary = imageDictionary; _modPackDirectory = modPackDirectory; _messageInImport = messageInImport; _textureViewModel = textureViewModel; _modelViewModel = modelViewModel; ModPackNameLabel.Content = modPackJson.Name; ModPackAuthorLabel.Content = modPackJson.Author; ModPackVersionLabel.Content = modPackJson.Version; ModPackDescription.Text = modPackJson.Description; if (String.IsNullOrEmpty(modPackJson.MinimumFrameworkVersion)) { Version ver; bool success = Version.TryParse(modPackJson.MinimumFrameworkVersion, out ver); if (success) { var frameworkVersion = typeof(XivCache).Assembly.GetName().Version; if (ver > frameworkVersion) { throw new NotSupportedException("This modpack requires a more recent TexTools version to install."); } } } _modPackEntry = new ModPack { name = modPackJson.Name, author = modPackJson.Author, version = modPackJson.Version }; _pageCount = modPackJson.ModPackPages.Count; var wizPages = importModPackWizard.Items; for (var i = 0; i < _pageCount; i++) { wizPages.Add(new WizardPage { Content = new ImportWizardModPackControl(modPackJson.ModPackPages[i], imageDictionary), PageType = WizardPageType.Blank, Background = null, HeaderBackground = null }); } }
//public ModPack test; // Use this for initialization void Start() { /*using (var stream = new FileStream("Credentials.json", FileMode.Open, FileAccess.Read)) * { * // The file token.json stores the user's access and refresh tokens, and is created * // automatically when the authorization flow completes for the first time. * string credPath = "token.json"; * credential = GoogleWebAuthorizationBroker.AuthorizeAsync( * GoogleClientSecrets.Load(stream).Secrets, * scopes, * "user", * CancellationToken.None, * new FileDataStore(credPath, true)).Result; * Debug.Log("Credential file saved to: " + credPath); * } * service = new SheetsService(new BaseClientService.Initializer() * { * HttpClientInitializer = credential, * ApplicationName = applicationName, * }); */ ACEOMM = new ModPack("1hb1i3JrN9hKFkSLe3Wpe9XPKTbWkR3PKab2cIiWwIi0", "ACEOMM"); ACEOMM.ranges.Add("data", "Lookups!K2:Q3"); ACEOMM.ranges.Add("banks", "Banks!A2:K500"); ACEOMM.ranges.Add("contractors", "Contractors!A2:K500"); ACEOMM.ranges.Add("avfuel", "AVFuelSuppliers!A2:K500"); ACEOMM.ranges.Add("catering", "Catering!A2:K500"); ACEOMM.ranges.Add("airlines", "Airlines!A2:S1500"); ACEOMM.ranges.Add("liveries", "Liveries!A2:O1000"); ACEOMM.ranges.Add("products", "Products!A2:M500"); ACEOMM.ranges.Add("deice", "De-Ice!A2:K100"); ACEOMM.ranges.Add("franchises", "Franchises!A2:Q1000"); ACEOMM.GetMainData(); ACEOMM.GetBankData(); ACEOMM.GetContractorsData(); ACEOMM.GetAvFuelData(); ACEOMM.GetCateringData(); ACEOMM.GetAirlineData(); ACEOMM.GetLiveriesData(); ACEOMM.GetProductsData(); ACEOMM.GetDeicingData(); ACEOMM.GetFranchisesData(); GameObject.FindObjectOfType <UIController>().RefreshModUi(); Debug.Log(ACEOMM.description); }
private void Remove(string fileName, ModPack pack) { DataGridViewRow dataGridViewRow = this.gridView.Rows.Cast <DataGridViewRow>().FirstOrDefault <DataGridViewRow>((DataGridViewRow r) => ModsSelector.GetFileName(r).Equals(fileName)); if (dataGridViewRow == null) { return; } BindingList <ModPack> dataSource = ModsSelector.GetDataSource(dataGridViewRow); dataSource.Remove(pack); if (dataSource.Count == 1) { this.gridView.Rows.Remove(dataGridViewRow); } }
protected void AddAllFiles(ModPack pack) { IEnumerable <ModFile> files = from f in pack.Files where f.ModType == this.ModType select f; foreach (ModFile file in files) { this.AddFile(file, pack); } pack.FileAdded -= new FileAddedEventHandler(this.ModPack_FileAdded); pack.FileRemoved -= new FileRemovedEventHandler(this.ModPack_FileRemoved); pack.FileAdded += new FileAddedEventHandler(this.ModPack_FileAdded); pack.FileRemoved += new FileRemovedEventHandler(this.ModPack_FileRemoved); }
public ModEditorForm(ModPack modPack) { this.InitializeComponent(); this._modPack = modPack; this.Text = string.Format(gPatcher.Localization.Text.Window_ModEditorDialog_Title, modPack.Name); this.tbxName.Text = modPack.Name; this.tbxName.TextChanged += new EventHandler(this.EnableApplyButton); ModEditor[] modEditorArray = new ModEditor[] { this.genEditor, this.bgmEditor, this.vidEditor }; this._editors = modEditorArray; ModEditor[] modEditorArray1 = this._editors; for (int i = 0; i < (int)modEditorArray1.Length; i++) { ModEditor modEditor = modEditorArray1[i]; modEditor.ModPack = modPack; modEditor.FileEnabledChanged += new FileEnabledChanged(this.EnableApplyButton); } }
private void tsmi_Delete_Click(object sender, EventArgs e) { ModPack selectedPack = this.GetSelectedPack(); if (MsgBox.Question(gPatcher.Localization.Text.Confirmation_DeleteMod) != System.Windows.Forms.DialogResult.Yes) { return; } try { selectedPack.Delete(); MsgBox.Success(gPatcher.Localization.Text.Success_DeleteMod); } catch (Exception exception) { MsgBox.Error(gPatcher.Localization.Text.Error_ModDelete, exception); } }
private void RemoveMods() { try { var packagesPath = ModPack.GetPackagePath(); var fileListPath = Path.Combine(ToolFolderName, FileListFileName); string[] fileNames; if (File.Exists(fileListPath)) { fileNames = File.ReadAllLines(fileListPath); } else { fileNames = new string[0]; } if (fileNames == null || !fileNames.Any()) { Trace.WriteLine("Unvoid file name list empty."); return; } foreach (var path in Directory.EnumerateFiles(packagesPath, "*.pack", SearchOption.TopDirectoryOnly).OrderBy(a => a)) { Trace.WriteLine(string.Format("Unvoiding {0}...", Path.GetFileName(path))); PackVoider.ModifyFileNamesInPack(path, fileNames, false); } Trace.WriteLine("Done unvoiding files."); File.WriteAllText(fileListPath, ""); } catch (IOException ex) { Trace.WriteLine("Error while modifying pack file: " + ex.Message); } catch (Exception ex) { Trace.WriteLine("Error while enabling files: " + ex.GetType().Name + Environment.NewLine + ex); } }
private void btnExportToZip_Click(object sender, EventArgs e) { ModPack selectedPack = this.GetSelectedPack(); SaveFileDialog saveFileDialog = new SaveFileDialog() { FileName = string.Concat(selectedPack.Name, ".zip"), DefaultExt = "zip", RestoreDirectory = true, Filter = gPatcher.Localization.Text.Window_ManagerForm_SelectZipFilter, Title = gPatcher.Localization.Text.Action_ZipSaving }; using (SaveFileDialog saveFileDialog1 = saveFileDialog) { if (System.Windows.Forms.DialogResult.OK == saveFileDialog1.ShowDialog()) { (new ZipExportDialog(selectedPack, saveFileDialog1.FileName)).ShowDialog(); } } }