/// <summary> /// Recursively builds the tree of records for the given record using the given node. /// </summary> /// <param name="p_plgPlugin">The <see cref="Plugin" /> for which to build a record tree.</param> /// <param name="p_recRecord">The <see cref="Rec" /> for which to build a record tree.</param> /// <param name="p_tndNode">The <see cref="TreeNode" /> at which to build the record tree.</param> private void WalkPluginTree(CriticalRecordPlugin p_crpPlugin, Rec p_recRecord, TreeNode p_tndNode) { if (p_recRecord.Name.Equals("TES4")) { return; } TreeNode tndSubNode; if (p_recRecord is Record) { tndSubNode = new TreeNode(String.Format("{0:x8}: {1}", ((Record)p_recRecord).FormID, p_recRecord.DescriptiveName)); if (p_crpPlugin.IsRecordCritical(((Record)p_recRecord).FormID)) { tndSubNode.BackColor = Color.Red; } } else { tndSubNode = new TreeNode(p_recRecord.DescriptiveName); } tndSubNode.Tag = p_recRecord; if (p_recRecord is GroupRecord) { foreach (var recSubRecord in ((GroupRecord)p_recRecord).Records) { WalkPluginTree(p_crpPlugin, recSubRecord, tndSubNode); } } p_tndNode.Nodes.Add(tndSubNode); }
/// <summary> /// Creates the tree of records for the given plugin using the given node. /// </summary> /// <param name="p_plgPlugin">The <see cref="Plugin" /> for which to build a record tree.</param> /// <param name="p_tndNode">The <see cref="TreeNode" /> at which to root the record tree.</param> private void CreatePluginTree(CriticalRecordPlugin p_crpPlugin, TreeNode p_tndNode) { p_tndNode.Tag = p_crpPlugin; foreach (var recRecord in p_crpPlugin.Records) { WalkPluginTree(p_crpPlugin, recRecord, p_tndNode); } }
/// <summary> /// Loads the specified plugin. /// </summary> /// <param name="p_strPlugin">The plugin whose records are to be loaded.</param> private void LoadPlugin(string p_strPlugin) { var bteData = File.ReadAllBytes(p_strPlugin); var crpPlugin = new CriticalRecordPlugin(bteData, p_strPlugin); var tndPluginRoot = new TreeNode(p_strPlugin); tvwRecords.BeginUpdate(); CreatePluginTree(crpPlugin, tndPluginRoot); tvwRecords.Nodes.Add(tndPluginRoot); tvwRecords.EndUpdate(); }
/// <summary> /// Checks for conflicts with mod-author specified critical records. Used by background worker dialog. /// </summary> public void DetectConflicts(IList <string> p_lstOrderedPlugins) { m_booCancelled = false; for (var intIndex = 0; intIndex < p_lstOrderedPlugins.Count; intIndex++) { var strBasePlugin = p_lstOrderedPlugins[intIndex]; if (m_booCancelled) { return; } OnPluginProcessed(); if (SKIP_PLUGINS.Contains(strBasePlugin.ToLowerInvariant())) { continue; } var crpBasePlugin = new CriticalRecordPlugin(Path.Combine(Program.GameMode.PluginsPath, strBasePlugin), false); if (!crpBasePlugin.HasCriticalRecordData) { continue; } for (var i = intIndex + 1; i < p_lstOrderedPlugins.Count; i++) { var strPlugin = p_lstOrderedPlugins[i]; var plgPlugin = new Plugin(Path.Combine(Program.GameMode.PluginsPath, strPlugin), false); foreach (var uintFormId in crpBasePlugin.CriticalRecordFormIds) { var strMasterPlugin = crpBasePlugin.GetMaster((Int32)uintFormId >> 24) ?? strBasePlugin; if (plgPlugin.GetMasterIndex(strMasterPlugin) < 0) { continue; } var uintAdjustedFormId = ((UInt32)plgPlugin.GetMasterIndex(strMasterPlugin) << 24); uintAdjustedFormId = uintAdjustedFormId + (uintFormId & 0x00ffffff); if (plgPlugin.ContainsFormId(uintAdjustedFormId)) { OnConflictDetected(crpBasePlugin, plgPlugin, uintFormId, crpBasePlugin.GetCriticalRecordInfo(uintFormId)); } } } } }
/// <summary> /// Recursively builds the tree of records for the given record using the given node. /// </summary> /// <param name="p_plgPlugin">The <see cref="Plugin"/> for which to build a record tree.</param> /// <param name="p_recRecord">The <see cref="Rec"/> for which to build a record tree.</param> /// <param name="p_tndNode">The <see cref="TreeNode"/> at which to build the record tree.</param> private void WalkPluginTree(CriticalRecordPlugin p_crpPlugin, Rec p_recRecord, TreeNode p_tndNode) { if (p_recRecord.Name.Equals("TES4")) return; TreeNode tndSubNode = null; if (p_recRecord is Record) { tndSubNode = new TreeNode(String.Format("{0:x8}: {1}", ((Record)p_recRecord).FormID, p_recRecord.DescriptiveName)); if (p_crpPlugin.IsRecordCritical(((Record)p_recRecord).FormID)) tndSubNode.BackColor = Color.Red; } else tndSubNode = new TreeNode(p_recRecord.DescriptiveName); tndSubNode.Tag = p_recRecord; if (p_recRecord is GroupRecord) foreach (Rec recSubRecord in ((GroupRecord)p_recRecord).Records) WalkPluginTree(p_crpPlugin, recSubRecord, tndSubNode); p_tndNode.Nodes.Add(tndSubNode); }
/// <summary> /// Creates the tree of records for the given plugin using the given node. /// </summary> /// <param name="p_plgPlugin">The <see cref="Plugin"/> for which to build a record tree.</param> /// <param name="p_tndNode">The <see cref="TreeNode"/> at which to root the record tree.</param> private void CreatePluginTree(CriticalRecordPlugin p_crpPlugin, TreeNode p_tndNode) { p_tndNode.Tag = p_crpPlugin; foreach (Rec recRecord in p_crpPlugin.Records) WalkPluginTree(p_crpPlugin, recRecord, p_tndNode); }
/// <summary> /// Checks for conflicts with mod-author specified critical records. Used by background worker dialog. /// </summary> public void DetectConflicts(IList<string> p_lstOrderedPlugins) { m_booCancelled = false; for (var intIndex = 0; intIndex < p_lstOrderedPlugins.Count; intIndex++) { var strBasePlugin = p_lstOrderedPlugins[intIndex]; if (m_booCancelled) { return; } OnPluginProcessed(); if (SKIP_PLUGINS.Contains(strBasePlugin.ToLowerInvariant())) { continue; } var crpBasePlugin = new CriticalRecordPlugin(Path.Combine(Program.GameMode.PluginsPath, strBasePlugin), false); if (!crpBasePlugin.HasCriticalRecordData) { continue; } for (var i = intIndex + 1; i < p_lstOrderedPlugins.Count; i++) { var strPlugin = p_lstOrderedPlugins[i]; var plgPlugin = new Plugin(Path.Combine(Program.GameMode.PluginsPath, strPlugin), false); foreach (var uintFormId in crpBasePlugin.CriticalRecordFormIds) { var strMasterPlugin = crpBasePlugin.GetMaster((Int32) uintFormId >> 24) ?? strBasePlugin; if (plgPlugin.GetMasterIndex(strMasterPlugin) < 0) { continue; } var uintAdjustedFormId = ((UInt32) plgPlugin.GetMasterIndex(strMasterPlugin) << 24); uintAdjustedFormId = uintAdjustedFormId + (uintFormId & 0x00ffffff); if (plgPlugin.ContainsFormId(uintAdjustedFormId)) { OnConflictDetected(crpBasePlugin, plgPlugin, uintFormId, crpBasePlugin.GetCriticalRecordInfo(uintFormId)); } } } } }