public void TranslateToLanguage() { CimToolBase toolBase = new CimToolBase(new CimToolSettings("", "TranslateToLanguageTest", modAssembly: Assembly.GetExecutingAssembly())); TranslationTester translation = new TranslationTester(toolBase); ExportTranslations.TranslationA = ""; ExportTranslations.TranslationB = ""; Assert.AreEqual("", ExportTranslations.TranslationA); Assert.AreEqual("", ExportTranslations.TranslationB); string xmlText = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" + "<Language xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" UniqueName=\"export\" ReadableName=\"Exported Language\">\n" + "<Translations>\n" + "<Translation ID=\"translateTextA\" String=\"ChangedTextA\" />\n" + "<Translation ID=\"translateTextB\" String=\"Changed Text B\"/>\n" + "</Translations>\n" + "</Language>\n"; Language loadedLanguage = translation.LoadFromText(new StringReader(xmlText)); Assert.IsNotNull(loadedLanguage); Assert.IsTrue(translation.ManuallyLoadLanguage(loadedLanguage)); Assert.IsTrue(translation.TranslateTo("export"), "Translate to imported language"); Assert.AreEqual("ChangedTextA", ExportTranslations.TranslationA); Assert.AreEqual("Changed Text B", ExportTranslations.TranslationB); }
public void SaveLanguageFile() { CimToolBase toolBase = new CimToolBase(new CimToolSettings("", "SaveLanguageFileTest", modAssembly: Assembly.GetExecutingAssembly())); TranslationTester translation = new TranslationTester(toolBase); translation.GenerateLanguageTemplate(); }
/// <summary> /// Handles options on the mod option panel ingame /// </summary> /// <param name="toolBase">The tool base</param> public ModOptionPanelUtilities(CimToolBase toolBase) { _toolBase = toolBase; _toolBase.DetailedLogger.Log("Init ModOptionPanelUtilities"); _savedData = new OptionPanelSavedData(); toolBase.XMLFileOptions.AddObjectToSave(_savedData); }
public DetailedLogger(CimToolBase toolBase) { _saveTimer.Elapsed += SaveTimer_Elapsed; _saveTimer.Enabled = true; _saveTimer.AutoReset = true; _fileName = toolBase.ModSettings.ModName + "-detailed.log"; try { System.IO.File.Delete(_fileName); } catch { LogError("Couldn't delete log file!"); } try { System.IO.File.CreateText(_fileName).Close(); } catch { LogError("Couldn't create new log file!"); } }
public void InterpretLanguageFile() { CimToolBase toolBase = new CimToolBase(new CimToolSettings("", "InterpretLanguageFileTest", modAssembly: Assembly.GetExecutingAssembly())); TranslationTester translation = new TranslationTester(toolBase); string xmlText = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" + "<Language xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" UniqueName=\"export\" ReadableName=\"Exported Language\">\n" + "<Translations>\n" + "<Translation ID=\"translateTextA\" String=\"\" />\n" + "<Translation ID=\"translateTextB\" String=\"\" />\n" + "</Translations>\n" + "</Language>\n"; Language loadedLanguage = translation.LoadFromText(new StringReader(xmlText)); Assert.IsNotNull(loadedLanguage); }
/// <summary> /// Automatically initialises the update panel with settings from /// the tool base. /// </summary> /// <param name="toolBase">Your internally saved CimToolBase</param> public void Initialise(CimToolBase toolBase) { _savedData = new UpdatePanelSavedData(); toolBase.XMLFileOptions.AddObjectToSave(_savedData); toolBase.XMLFileOptions.Load(); m_changelogDownloader = toolBase.Changelog; m_updatedTitleMessage = string.Format("{0} has updated!", toolBase.ModSettings.ReadableName); showInitially = _savedData.lastCheckedVersion != toolBase.Version.Delimited(Utilities.Version.Limit.Revision); if (showInitially) { Show(); } else { Hide(); } m_toolBase = toolBase; }
/// <summary> /// Handles IO between classes and the options XML file. /// </summary> /// <param name="toolBase"></param> public XmlFileManager(CimToolBase toolBase, XmlOptionsAttribute.OptionType optionType = XmlOptionsAttribute.OptionType.XmlFile) { m_toolBase = toolBase; m_optionType = optionType; }
public SaveFileManager(CimToolBase toolBase) { _toolBase = toolBase; _xmlManager = new XmlFileManager(toolBase, Attributes.XmlOptionsAttribute.OptionType.SaveFile); }
public Translation(CimToolBase toolBase, bool loadLanguageAutomatically = true) { _toolBase = toolBase; _loadLanguageAutomatically = loadLanguageAutomatically; }
public Strings(CimToolBase toolBase) { _toolBase = toolBase; SetUpStrings(); }
public Version(CimToolBase toolBase) { m_toolBase = toolBase; }
public NamedLogger(CimToolBase toolBase) { _toolBase = toolBase; }
public TranslationTester(CimToolBase toolBase) : base(toolBase, false) { }
public Path(CimToolBase toolBase) { m_toolBase = toolBase; }
public void Initialise(CimToolBase toolBase) { m_toolBase = toolBase; }
public ChangelogTest(CimToolBase settings) : base(settings) { }
public Changelog(CimToolBase toolBase) { m_toolBase = toolBase; }