public void TestMethodCsConfigFindAttribute() { var ecf = new ConfigEcfAccess(); ecf.ReadConfigEcf(@"C:\steamcmd\empyrion\Content", null, null, null); Assert.IsNotNull(ecf.FindAttribute(2248, "Mass")); Assert.IsNotNull(ecf.FindAttribute(2248, "StackSize")); }
public void TestMethodReadItemsInfo() { var ecf = new ConfigEcfAccess(); ecf.ReadConfigEcf(@"C:\steamcmd\empyrion\Content", null, null, null); var localization = new Localization(@"C:\steamcmd\empyrion\Content", null); var items = new ItemInfos(ecf, localization).ItemInfo; Assert.IsTrue(items.Count() > 0); }
public void TestMethodConfigTemplates() { var config = new ConfigEcfAccess(); //config.ReadConfigEcf(@"C:\steamcmd\empyrion\Content", null, null, null); config.ReadConfigEcf(@"C:\steamcmd\empyrion\Content", "Reforged Eden", @"C:\steamcmd\empyrion.server\Saves\Games\Default\blocksmap.dat", null); var templates = new Dictionary <int, Dictionary <int, int> >(); config.FlatConfigBlockById .ForEach(B => { var idCfg = B.Value.Attr.FirstOrDefault(A => A.Name == "Id"); if (!int.TryParse(idCfg?.Value?.ToString(), out var id)) { return; } var ressList = new Dictionary <int, int>(); var templateRoot = B.Value.Attr.FirstOrDefault(A => A.Name == "TemplateRoot")?.Value?.ToString() ?? idCfg.AddOns?.FirstOrDefault(A => A.Key == "Name").Value?.ToString(); if (string.IsNullOrEmpty(templateRoot)) { return; } if (!config.FlatConfigTemplatesByName.TryGetValue(templateRoot, out var templateRootBlock)) { return; } ScanTemplates(config, templateRootBlock, ressList); if (ressList.Count > 0) { templates.Add(id, ressList); } }); Console.WriteLine(templates.Count); }