public PluginSet(string name, string directoryPath) { Name = name; DirectoryPath = directoryPath; try { if (Directory.Exists(directoryPath)) { foreach (string file in Directory.GetFiles(directoryPath)) { if (Path.GetExtension(file) == ".ifp" || Path.GetExtension(file) == ".ent") { string tag = Path.GetFileName(file).Substring(0, 4); IfpDocument document = new IfpDocument(); document.Load(file); if (!plugins.ContainsKey(tag)) { plugins.Add(tag, document); } } } } } catch { } }
public IfpTagGroup(IfpDocument ifpDocument, string groupName) : this(ifpDocument) { if (!string.IsNullOrEmpty(ifpDocument.Plugin.Class)) { Tag = ifpDocument.Plugin.Class; } Name = groupName; }
private void TagEditor_SelectedEntryChanged(object sender, EventArgs e) { //Prepare IfpDocument document = null; bool load = true; //Check if (wrapper.Root != SelectedEntry.Root && plugin_GetPath(SelectedEntry.Root, out string ifpFile)) { //Load try { document = new IfpDocument(); document.Load(ifpFile); wrapper.Layout(document, SelectedEntry); } catch { load = false; } } //Check if (!load) { MessageBox.Show("Plugin error, I think?"); return; } //Read wrapper.Wrap((uint)SelectedEntry.PostProcessedOffset); //Create Nodes structureView.BeginUpdate(); //Clear structureView.Nodes.Clear(); //Create Node(s) TreeNode mainNode = new TreeNode($"{SelectedEntry.Filename}.{SelectedEntry.Root}"); dataObjects_MakeNodes(wrapper, mainNode.Nodes); mainNode.Tag = wrapper; //Add structureView.Nodes.Add(mainNode); mainNode.Expand(); //Select structureView.SelectedNode = mainNode; mainNode.EnsureVisible(); //End structureView.EndUpdate(); }
public IfpTagGroup(IfpDocument ifpDocument) { Tag = ifpDocument.Plugin.Class; switch (Tag) { case "sbsp": //scenario_structure_bsp if (ifpDocument.Plugin.HeaderSize == 588) { return; } break; } if (ifpDocument.Plugin.Nodes.Count > 0) { TagBlocks.Add(new IfpTagBlock(ifpDocument.Plugin)); } }
/// <summary> /// Creates a map of data objects. /// </summary> /// <param name="document">The IFP document.</param> /// <param name="entry">The index entry.</param> public void Layout(IfpDocument document, IndexEntry entry) { //Clear objects.Clear(); objectLookup.Clear(); //Set root = document.Plugin.Class; //Loop int index = 0; foreach (IfpNode node in document.Plugin.Nodes) { //Prepare DataObject childObject = null; //Handle type switch (node.Type) { case IfpNodeType.TagBlock: case IfpNodeType.Byte: case IfpNodeType.SignedByte: case IfpNodeType.Short: case IfpNodeType.UnsignedShort: case IfpNodeType.Int: case IfpNodeType.UnsignedInt: case IfpNodeType.Long: case IfpNodeType.UnsignedLong: case IfpNodeType.Single: case IfpNodeType.Double: case IfpNodeType.Enumerator8: case IfpNodeType.Enumerator16: case IfpNodeType.Enumerator32: case IfpNodeType.Enumerator64: case IfpNodeType.Bitfield8: case IfpNodeType.Bitfield16: case IfpNodeType.Bitfield32: case IfpNodeType.Bitfield64: case IfpNodeType.String32: case IfpNodeType.String64: case IfpNodeType.Unicode128: case IfpNodeType.Unicode256: case IfpNodeType.Tag: case IfpNodeType.TagId: case IfpNodeType.StringId: childObject = new DataObject(node, entry.TagData) { UniqueId = index++ }; break; } //Check if (childObject != null) { //Add objects.Add(childObject); objectLookup.Add(childObject.UniqueId, childObject); //Layout Child if (childObject.Node.Type == IfpNodeType.TagBlock) { Layout(childObject, ref index); } } } }
public Form1() { InitializeComponent(); map = new MapFile(); document = new IfpDocument(); }