当前位置: 首页>>代码示例>>C#>>正文


C# IMod.GetFileList方法代码示例

本文整理汇总了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;
		}
开发者ID:etinquis,项目名称:nexusmodmanager,代码行数:14,代码来源:Witcher2GameMode.cs

示例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);

//.........这里部分代码省略.........
开发者ID:NexusMods,项目名称:NexusModManager-4.5,代码行数:101,代码来源:DragonAge2GameMode.cs

示例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;
		}
开发者ID:etinquis,项目名称:nexusmodmanager,代码行数:28,代码来源:XRebirthGameMode.cs

示例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;
        }
开发者ID:etinquis,项目名称:nexusmodmanager,代码行数:36,代码来源:StateOfDecayGameMode.cs


注:本文中的IMod.GetFileList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。