本文整理汇总了C#中IMod.GetFile方法的典型用法代码示例。如果您正苦于以下问题:C# IMod.GetFile方法的具体用法?C# IMod.GetFile怎么用?C# IMod.GetFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IMod
的用法示例。
在下文中一共展示了IMod.GetFile方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ModFileMerge
/// <summary>
/// Merges the chargenmorphcfg.xml file of the Dragon Age mods.
/// </summary>
/// <param name="p_rolActiveMods">The list of active mods.</param>
/// <param name="p_modMod">The current mod.</param>
/// <param name="p_booRemove">Whether we're adding or removing the mod.</param>
public override void ModFileMerge(ReadOnlyObservableList<IMod> p_rolActiveMods, IMod p_modMod, bool p_booRemove)
{
List<string> lstFiles = null;
XDocument XDoc = null;
XDocument XDocMerge = null;
bool booMerge = false;
Byte[] bFile = null;
strXMLDirectory = Path.Combine(m_gmdGameModeInfo.InstallationPath, "NMM_chargenmorphcfg");
#region activeMods
if (p_booRemove && File.Exists(Path.Combine(strXMLDirectory, "chargenmorphcfg.xml")))
File.Delete(Path.Combine(strXMLDirectory, "chargenmorphcfg.xml"));
if ((!File.Exists(Path.Combine(strXMLDirectory, "chargenmorphcfg.xml"))) || (p_booRemove))
{
foreach (IMod modMod in p_rolActiveMods)
{
if (modMod.Filename != p_modMod.Filename)
{
lstFiles = modMod.GetFileList();
foreach (string strFile in lstFiles)
{
if (strFile.EndsWith("chargenmorphcfg.xml"))
{
bFile = modMod.GetFile(strFile);
string responseText = Encoding.ASCII.GetString(bFile);
XDoc = XDocument.Parse(responseText.Replace("???", ""));
if (XDocMerge == null)
{
XDocMerge = XDoc;
booMerge = true;
}
else
{
foreach (XElement ele in XDoc.Root.Elements())
{
XElement xeDoc = XDoc.Root.Element(ele.Name.ToString());
XElement xeDocMerge = XDocMerge.Root.Element(ele.Name.ToString());
MergeElements(xeDoc, xeDocMerge);
}
}
}
}
}
}
}
else
{
bFile = File.ReadAllBytes(Path.Combine(strXMLDirectory, "chargenmorphcfg.xml"));
string responseText = Encoding.ASCII.GetString(bFile);
XDoc = XDocument.Parse(responseText.Replace("???", ""));
booMerge = true;
}
#endregion
#region currentMod
if ((p_modMod != null) && (!p_rolActiveMods.Contains(p_modMod)))
{
lstFiles = p_modMod.GetFileList();
foreach (string strFile in lstFiles)
{
if (strFile.EndsWith("chargenmorphcfg.xml"))
{
bFile = p_modMod.GetFile(strFile);
string responseText = Encoding.ASCII.GetString(bFile);
XDocMerge = XDocument.Parse(responseText.Replace("???", ""));
if (booMerge)
{
foreach (XElement ele in XDoc.Root.Elements())
{
XElement xeDoc = XDoc.Root.Element(ele.Name.ToString());
XElement xeDocMerge = XDocMerge.Root.Element(ele.Name.ToString());
MergeElements(xeDoc, xeDocMerge);
}
}
}
}
}
#endregion
if (!Directory.Exists(strXMLDirectory))
Directory.CreateDirectory(strXMLDirectory);
//.........这里部分代码省略.........
示例2: LoadModNameInternal
/// <summary>
/// Loads the mod descriptor (content.xml) from an IMod.
/// </summary>
/// <param name="p_modMod">The mod to be activated</param>
/// <returns>Null on error otherwise the mod name</returns>
private string LoadModNameInternal(IMod p_modMod)
{
var bteContentFile = p_modMod.GetFile("content.xml");
var strContentXml = Encoding.UTF8.GetString(bteContentFile);
var xdocContentXml = XDocument.Parse(strContentXml);
if (xdocContentXml.Root != null)
{
return xdocContentXml.Root.Attribute("name").Value;
}
return null;
}
示例3: AddManifest
private void AddManifest(IMod p_modMod)
{
string strAddins = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), @"Bioware\Dragon Age\Settings\AddIns.xml");
XDocument XDoc = XDocument.Load(strAddins);
XDocument docManifest = XDocument.Parse(Encoding.ASCII.GetString(p_modMod.GetFile("Manifest.xml")));
XElement xelAddinsList = docManifest.Descendants("AddInsList").FirstOrDefault();
foreach (XElement XAddin in xelAddinsList.Elements("AddInItem"))
XDoc.Root.Add(XAddin);
XDoc.Save(strAddins);
}