本文整理汇总了C#中IMod.GetFileList方法的典型用法代码示例。如果您正苦于以下问题:C# IMod.GetFileList方法的具体用法?C# IMod.GetFileList怎么用?C# IMod.GetFileList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IMod
的用法示例。
在下文中一共展示了IMod.GetFileList方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckSecondaryInstall
/// <summary>
/// Checks whether to use the secondary mod install method.
/// </summary>
/// <returns>Whether to use the secondary mod install method.</returns>
/// <param name="p_modMod">The mod to be installed.</param>
public override bool CheckSecondaryInstall(IMod p_modMod)
{
//string strPattern = String.Format(@"[^\{0}\{1}]+[\{0}\{1}]cook\.hash", Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);
string strPattern = String.Format(@"cook\.hash", Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);
foreach (string strFile in p_modMod.GetFileList())
if (Regex.IsMatch(strFile, strPattern))
return true;
return false;
}
示例2: 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);
//.........这里部分代码省略.........
示例3: NeedsPathAdjust
/// <summary>
/// Checks a mod if it needs a path adjust.
/// Mods need path adjusts if they either are not exactly one folder deep.
/// Also more than one content.xml is not allowed in one package.
///
/// Ex:
/// ZIP/
/// Mod1/
/// content.xml
///
/// Wrong:
/// ZIP/
/// Mod1/
/// XYZ/
/// content.xml
/// </summary>
/// <param name="p_modMod"></param>
/// <returns></returns>
private bool NeedsPathAdjust(IMod p_modMod)
{
// this is ok to throw if nessecary, handled in calling function
var strContentXmlPath = p_modMod.GetFileList().Single(f => f.Contains("content.xml"));
var intNestLevels = strContentXmlPath.Split('\\').Count();
if (intNestLevels == 1 || intNestLevels > 2)
return true;
return false;
}
示例4: NeedsPathAdjustForContentXml
/// <summary>
/// Checks a mod if it needs a path adjust.
/// Mods need path adjusts if they either are not exactly one folder deep.
/// Also more than one content.xml is not allowed in one package.
///
/// Ex:
/// ZIP/
/// Mod1/
/// content.xml
///
/// Wrong:
/// ZIP/
/// Mod1/
/// XYZ/
/// content.xml
/// </summary>
/// <param name="p_modMod"></param>
/// <returns></returns>
private bool NeedsPathAdjustForContentXml(IMod p_modMod)
{
bool adjustPath = false;
if (p_modMod.GetFileList().Exists(DoesContentFileExist))
{
// this is ok to throw if nessecary, handled in calling function
var strContentXmlPath = p_modMod.GetFileList().Single(f => f.Contains("content.xml"));
var intNestLevels = strContentXmlPath.Split('\\').Count();
if (intNestLevels == 1 || intNestLevels > 2)
{
adjustPath = true;
}
}
return adjustPath;
}