public bool OnAccept(HashSet <string> unwantedItems) { if (ModuleDataManager.GetInstance().ExecuteClone(mFileData, mParameters, unwantedItems)) { mViewer.Reload(); } return(true); }
public bool OnAccept(string inputMessage) { if (checkNewModName(inputMessage) && manifestTemplate != null) { string newModPath = modsDirectoryPath + "/" + inputMessage; string newManifestPath = newModPath + "/manifest.json"; string newLocalesPath = newModPath + "/locales/en.json"; Directory.CreateDirectory(newModPath + "/locales"); using (StreamWriter wr = new StreamWriter(newManifestPath, false, new UTF8Encoding(false))) { using (JsonTextWriter jsonTextWriter = new JsonTextWriter(wr)) { jsonTextWriter.Formatting = Newtonsoft.Json.Formatting.Indented; jsonTextWriter.Indentation = 3; jsonTextWriter.IndentChar = ' '; JsonSerializer jsonSerializer = new JsonSerializer(); jsonSerializer.Serialize(jsonTextWriter, JObject.Parse(manifestTemplate)); } } using (StreamWriter wr = new StreamWriter(newLocalesPath, false, new UTF8Encoding(false))) { using (JsonTextWriter jsonTextWriter = new JsonTextWriter(wr)) { jsonTextWriter.Formatting = Newtonsoft.Json.Formatting.Indented; jsonTextWriter.Indentation = 3; jsonTextWriter.IndentChar = ' '; JsonSerializer jsonSerializer = new JsonSerializer(); jsonSerializer.Serialize(jsonTextWriter, new JObject()); } } // Need a way to autoselect the new mod treeItem after reload, to focus on it mOwner.Reload(); return(true); } else { return(false); } }
public bool OnAccept(string inputMessage) { // Do the cloning string newAliasName = inputMessage.Trim(); if (newAliasName.Length <= 1) { MessageBox.Show("You must enter a name longer than 1 character for the new alias!"); return(false); } if (mModule.GetAliasFile(newAliasName) != null) { MessageBox.Show("An alias already exists with that name!"); return(false); } mModule.AddToManifest(newAliasName, "file(" + mFilePath + ")", mManifestEntryType); mModule.WriteManifestToFile(); mOwner.Reload(); return(true); }