void SetArchtype(TableBlock block, ArchtypeManager archtypeManager) { switch (block.Block.Name.ToLower()) { case "lightsource": block.ObjectType = FreelancerModStudio.SystemPresenter.ContentType.LightSource; break; case "zone": block.ObjectType = FreelancerModStudio.SystemPresenter.ContentType.Zone; break; case "object": bool hasArchtype = false; //get type of object based on archtype foreach (EditorINIOption option in block.Block.Options) { if (option.Name.ToLower() == "archetype") { if (option.Values.Count > 0) { block.Archtype = archtypeManager.TypeOf(option.Values[0].Value.ToString()); if (block.Archtype != null) { block.ObjectType = block.Archtype.Type; hasArchtype = true; } break; } } } if (!hasArchtype) { block.ObjectType = FreelancerModStudio.SystemPresenter.ContentType.None; } break; } if (block.ObjectType != FreelancerModStudio.SystemPresenter.ContentType.None) { block.Visibility = true; } }
public void LoadArchtypes() { int archtypeTemplate = Helper.Template.Data.Files.IndexOf("Solar Arch"); string archtypeFile = ArchtypeManager.GetRelativeArchtype(File, Data.TemplateIndex, archtypeTemplate); //user interaction required to get the path of the archtype file if (archtypeFile == null) { archtypeFile = ShowSolarArchtypeSelector(); } archtype = new ArchtypeManager(archtypeFile, archtypeTemplate); foreach (TableBlock block in Data.Blocks) { SetArchtype(block, archtype); } }