protected MovedRecipe(string key, ICollection <EmProperty> definitions) : base(key, definitions) { oldPath = (EmProperty <string>)Properties[OldPathKey]; newPath = (EmProperty <string>)Properties[NewPathKey]; hidden = (EmYesNo)Properties[HiddenKey]; copied = (EmYesNo)Properties[CopyKey]; }
public void EmProperty_SuperSimple_PrettyPrint_GetExpected() { var emString = new EmProperty <string>("String", "Value"); string actualValue = emString.PrettyPrint(); Assert.AreEqual("String: Value;\r\n", actualValue); }
protected CustomCraftingTab(string key, ICollection <EmProperty> definitions) : base(key, definitions) { emTabID = (EmProperty <string>)Properties[TabIdKey]; emDisplayName = (EmProperty <string>)Properties[DisplayNameKey]; emSpriteID = (EmProperty <TechType>)Properties[SpriteItemIdKey]; emParentTabPath = (EmProperty <string>)Properties[ParentTabPathKey]; base.OnValueExtractedEvent += ParsePath; }
public CustomCraftingTab() : base(KeyName, CustomCraftingTabProperties) { emTabID = (EmProperty <string>)Properties["TabID"]; emDisplayName = (EmProperty <string>)Properties["DisplayName"]; emSpriteID = (EmProperty <TechType>)Properties["SpriteItemID"]; emParentTabPath = (EmProperty <string>)Properties["ParentTabPath"]; base.OnValueExtractedEvent += ParsePath; }
public void Deserialize_AllCasesHandled(string serialized) { const string key = "TT"; var emTechType = new EmProperty <TechType>(key); Assert.IsTrue(emTechType.Deserialize($"{key}: {serialized};")); Assert.AreEqual(TechType.Compass, emTechType.Value); Assert.AreEqual(serialized, emTechType.SerializedValue); }
public void FromString_BasicCasesHandled(string serialized, TechType value) { const string key = "TT"; var emTechType = new EmProperty <TechType>(key); Assert.IsTrue(emTechType.FromString($"{key}:{serialized};")); Assert.AreEqual(value, emTechType.Value); Assert.AreEqual(serialized, emTechType.SerializedValue); }
private static int DeserializeFile(string workingFilePath) { string fileName = Path.GetFileName(workingFilePath); string serializedData = File.ReadAllText(workingFilePath, Encoding.UTF8); if (string.IsNullOrEmpty(serializedData)) { QuickLogger.Warning($"File '{fileName}' contained no text"); return(0); } if (EmProperty.CheckKey(serializedData, out string key)) { int check = -2; if (PackagesLookup.TryGetValue(key, out IParsingPackage package)) { check = package.ParseEntries(serializedData, OriginFile.GetOriginFile(fileName)); } else { QuickLogger.Warning($"Unknown primary key '{key}' detected in file '{fileName}'"); return(0); } switch (check) { case -2: QuickLogger.Error($"Unexpected error when attempting to parse file '{fileName}'"); break; case -1: QuickLogger.Warning($"Unable to parse file '{fileName}'"); break; case 0: QuickLogger.Warning($"File '{fileName}' was parsed but no entries were found"); break; default: QuickLogger.Debug($"{check} entries parsed from file '{fileName}'"); return(check); } } else { QuickLogger.Warning($"Could not identify primary key in file '{fileName}'"); } return(0); }
protected CustomFabricator(string key, ICollection <EmProperty> definitions) : base(key, definitions) { model = (EmProperty <ModelTypes>)Properties[ModelKey]; colortint = (EmColorRGB)Properties[ColorTintKey]; allowedInBase = (EmYesNo)Properties[AllowedInBaseKey]; allowedInCyclops = (EmYesNo)Properties[AllowedInCyclopsKey]; this.CustomCraftingTabs = (EmPropertyCollectionList <CfCustomCraftingTab>)Properties[CfCustomCraftingTabListKey]; this.MovedRecipes = (EmPropertyCollectionList <CfMovedRecipe>)Properties[CfMovedRecipeListKey]; this.AddedRecipes = (EmPropertyCollectionList <CfAddedRecipe>)Properties[CfAddedRecipeListKey]; this.AliasRecipes = (EmPropertyCollectionList <CfAliasRecipe>)Properties[CfAliasRecipeListKey]; this.CustomFoods = (EmPropertyCollectionList <CfCustomFood>)Properties[CfCustomFoodListKey]; path.Optional = true; }
public EmTextPluginPack() : base(MainKey, PluginDefinitions) { pluginPackName = (EmProperty <string>)Properties[nameof(IPluginPack.PluginPackName)]; batteryCapacity = (EmProperty <int>)Properties[nameof(IPluginPack.BatteryCapacity)]; unlocksWith = (EmProperty <TechType>)Properties[nameof(IPluginPack.UnlocksWith)]; batteryID = (EmProperty <string>)Properties[nameof(IPluginPack.BatteryID)]; batteryName = (EmProperty <string>)Properties[nameof(IPluginPack.BatteryName)]; batterFlavorText = (EmProperty <string>)Properties[nameof(IPluginPack.BatteryFlavorText)]; batteryParts = (EmPropertyList <TechType>)Properties[nameof(IPluginPack.BatteryParts)]; batteryIconFile = (EmProperty <string>)Properties[nameof(ITextPluginPack.BatteryIconFile)]; powerCellID = (EmProperty <string>)Properties[nameof(IPluginPack.PowerCellID)]; powerCellName = (EmProperty <string>)Properties[nameof(IPluginPack.PowerCellName)]; powerCellFlavorText = (EmProperty <string>)Properties[nameof(IPluginPack.PowerCellFlavorText)]; powerCellAdditionalParts = (EmPropertyList <TechType>)Properties[nameof(IPluginPack.PowerCellAdditionalParts)]; powerCellIconFile = (EmProperty <string>)Properties[nameof(ITextPluginPack.PowerCellIconFile)]; }
protected CustomBioFuel(string key, ICollection <EmProperty> definitions) : base(key, definitions) { emEnergy = (EmProperty <float>)Properties[EnergyKey]; }
public CyBioReactorSaveData(ICollection <EmProperty> definitions) : base("CyBioReactor", definitions) { _batteryCharge = (EmProperty <float>)Properties[ReactorBatterChargeKey]; _boosterCount = (EmProperty <int>)Properties[BoostCountKey]; _materials = (EmPropertyCollectionList <EmModuleSaveData>)Properties[MaterialsKey]; }
public CustomBioFuel() : base("CustomBioFuel", BioFuelProperties) { emTechType = (EmProperty <string>)Properties["ItemID"]; emEnergy = (EmProperty <float>)Properties["Energy"]; }
public DeepConfig() : base(MainKey, DeepConfigDefinitions) { PowerStyleConfig = (EmProperty <PowerStyle>)Properties[PowerStyleKey]; PowerStyleConfig.Value = PowerStyle.Normal; }
private static void DeserializeFile(string workingFilePath) { QuickLogger.Message($"Reading file: {workingFilePath}"); string serializedData = File.ReadAllText(workingFilePath); if (string.IsNullOrEmpty(serializedData)) { QuickLogger.Warning($"File contained no text"); return; } if (EmProperty.CheckKey(serializedData, out string key)) { int check = -2; switch (key) { case "AddedRecipes": check = ParseEntries <AddedRecipe, AddedRecipeList>(serializedData, addedRecipes); break; case "ModifiedRecipes": check = ParseEntries <ModifiedRecipe, ModifiedRecipeList>(serializedData, modifiedRecipes); break; case "CustomSizes": check = ParseEntries <CustomSize, CustomSizeList>(serializedData, customSizes); break; case "CustomBioFuels": check = ParseEntries <CustomBioFuel, CustomBioFuelList>(serializedData, customBioFuels); break; case "CustomCraftingTabs": check = ParseEntries <CustomCraftingTab, CustomCraftingTabList>(serializedData, customTabs); break; default: QuickLogger.Error($"Invalid primary key '{key}' detected in file"); return; } switch (check) { case -1: QuickLogger.Error($"Unable to parse file"); break; case 0: QuickLogger.Message($"File was parsed but no entries were found"); break; default: QuickLogger.Message($"{check} entries parsed from file"); break; } } else { QuickLogger.Warning("Could not identify primary key in file"); } }
protected CustomFragmentCount(string key, ICollection <EmProperty> definitions) : base(key, definitions) { emFragmentCount = (EmProperty <int>)Properties[FragmentsToScanKey]; }
protected EmTechTyped(string key, ICollection <EmProperty> definitions) : base(key, definitions) { emTechType = (EmProperty <string>)Properties[ItemIdKey]; }
public override void LoadFromSaveData(ModConfigSaveData saveData) { SaveData = saveData.GetBoolProperty(this); }