• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IMod类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IMod的典型用法代码示例。如果您正苦于以下问题:C# IMod类的具体用法?C# IMod怎么用?C# IMod使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IMod类属于命名空间,在下文中一共展示了IMod类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: PrepareMod

		/// <summary>
		/// Prepares the given mod for installation.
		/// </summary>
		/// <remarks>
		/// This task puts the mod into read-only mode.
		/// </remarks>
		/// <returns><c>true</c> if the mod was successfully prepared;
		/// <c>false</c> otherwise.</returns>
		/// <param name="p_modMod">The mod to prepare.</param>
		public bool PrepareMod(IMod p_modMod)
		{
			OverallMessage = "Preparing Mod...";
			ShowItemProgress = false;
			OverallProgressMaximum = 100;
			OverallProgressStepSize = 1;

			try
			{
				p_modMod.ReadOnlyInitProgressUpdated += new CancelProgressEventHandler(Mod_ReadOnlyInitProgressUpdated);
				p_modMod.BeginReadOnlyTransaction(FileUtility);
			}
			catch (Exception)
			{
				Status = TaskStatus.Error;
				OnTaskEnded(false);
				throw;
			}
			finally
			{
				p_modMod.ReadOnlyInitProgressUpdated -= Mod_ReadOnlyInitProgressUpdated;
			}
			bool booSuccess = Status != TaskStatus.Cancelling;
			Status = Status == TaskStatus.Cancelling ? TaskStatus.Cancelled : TaskStatus.Complete;
			OnTaskEnded(booSuccess);
			return booSuccess;
		}
开发者ID:etinquis,项目名称:nexusmodmanager,代码行数:36,代码来源:PrepareModTask.cs


示例2: ModFileUpgradeInstaller

		/// <summary>
		/// A simple constructor that initializes the object with its dependencies.
		/// </summary>
		/// <param name="p_gmiGameModeInfo">The environment info of the current game mode.</param>
		/// <param name="p_modMod">The mod being installed.</param>
		/// <param name="p_ilgInstallLog">The install log to use to log file installations.</param>
		/// <param name="p_pmgPluginManager">The plugin manager.</param>
		/// <param name="p_dfuDataFileUtility">The utility class to use to work with data files.</param>
		/// <param name="p_tfmFileManager">The transactional file manager to use to interact with the file system.</param>
		/// <param name="p_dlgOverwriteConfirmationDelegate">The method to call in order to confirm an overwrite.</param>
        /// <param name="p_UsesPlugins">Game using plugin or mods (True for plugins).</param>
		public ModFileUpgradeInstaller(IGameModeEnvironmentInfo p_gmiGameModeInfo, IMod p_modMod, IInstallLog p_ilgInstallLog, IPluginManager p_pmgPluginManager, IDataFileUtil p_dfuDataFileUtility, TxFileManager p_tfmFileManager, ConfirmItemOverwriteDelegate p_dlgOverwriteConfirmationDelegate, bool p_UsesPlugins)
            : base(p_gmiGameModeInfo, p_modMod, p_ilgInstallLog, p_pmgPluginManager, p_dfuDataFileUtility, p_tfmFileManager, p_dlgOverwriteConfirmationDelegate, p_UsesPlugins, null)
		{
			OriginallyInstalledFiles = new Set<string>(StringComparer.OrdinalIgnoreCase);
			foreach (string strFile in InstallLog.GetInstalledModFiles(Mod))
				OriginallyInstalledFiles.Add(strFile.Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar));
		}
开发者ID:NexusMods,项目名称:NexusModManager-4.5,代码行数:18,代码来源:ModFileUpgradeInstaller.cs


示例3: GetTagInfoCandidates

		/// <summary>
		/// Gets a list of possible mod info tags which match the given mod.
		/// </summary>
		/// <param name="p_modMod">The mod for which to retrieve a list of possible tags.</param>
		/// <returns>A list of possible mod info tags which match the given mod.</returns>
		public IEnumerable<IModInfo> GetTagInfoCandidates(IMod p_modMod)
		{
			//get mod info
			List<IModInfo> lstMods = new List<IModInfo>();
			IModInfo mifInfo = null;
			try
			{
				if (!String.IsNullOrEmpty(p_modMod.Id))
					mifInfo = ModRepository.GetModInfo(p_modMod.Id);
				if (mifInfo == null)
					mifInfo = ModRepository.GetModInfoForFile(p_modMod.Filename);
				if (mifInfo == null)
				{
					//use heuristics to find info
					lstMods.AddRange(ModRepository.FindMods(p_modMod.ModName, true));
					if (lstMods.Count == 0)
						lstMods.AddRange(ModRepository.FindMods(Regex.Replace(p_modMod.ModName, "[^a-zA-Z0-9_. ]+", "", RegexOptions.Compiled), true));
					if ((lstMods.Count == 0) && (!String.IsNullOrEmpty(p_modMod.Author)))
						lstMods.AddRange(ModRepository.FindMods(p_modMod.ModName, p_modMod.Author));
					if (lstMods.Count == 0)
						lstMods.AddRange(ModRepository.FindMods(p_modMod.ModName, false));
				}
				else
					lstMods.Add(mifInfo);

				//if we don't know the mod Id, then we have no way of getting
				// the file-specific info, so only look if we have one mod info
				// candidate.
				if (lstMods.Count == 1)
				{
					mifInfo = lstMods[0];
					lstMods.Clear();
					//get file specific info
					IModFileInfo mfiFileInfo = ModRepository.GetFileInfoForFile(p_modMod.Filename);
					if (mfiFileInfo == null)
					{
						foreach (IModFileInfo mfiModFileInfo in ModRepository.GetModFileInfo(mifInfo.Id))
							lstMods.Add(CombineInfo(mifInfo, mfiModFileInfo));
					}
					else
						lstMods.Add(CombineInfo(mifInfo, mfiFileInfo));
					if (lstMods.Count == 0)
						lstMods.Add(mifInfo);
				}
			}
			catch (RepositoryUnavailableException e)
			{
				TraceUtil.TraceException(e);
				//the repository is not available, so add a dummy value indicating such
				lstMods.Add(new ModInfo(null, String.Format("{0} is unavailable", ModRepository.Name), null, null, false, null, null, 0, -1, null, null, null, null));
			}
			catch (NullReferenceException e)
			{
				TraceUtil.TraceException(e);
				//couldn't find any match, so add a dummy value indicating such
				lstMods.Add(new ModInfo(null, String.Format("{0}", e.Message), null, null, false, null, null, 0, -1, null, null, null, null));
			}
			return lstMods;
		}
开发者ID:NexusMods,项目名称:NexusModManager-4.5,代码行数:64,代码来源:AutoTagger.cs


示例4: Compare

		/// <summary>
		/// Compares the given <see cref="IMod"/>s.
		/// </summary>
		/// <param name="x">An object to compare to another object.</param>
		/// <param name="y">An object to compare to another object.</param>
		/// <returns>A value less than 0 if <paramref name="x"/> is less than <paramref name="y"/>.
		/// 0 if this node is equal to the other.
		/// A value greater than 0 if <paramref name="x"/> is greater than <paramref name="y"/>.</returns>
		public override int Compare(IMod x, IMod y)
		{
			if (x == null)
				return (y == null) ? 0 : -1;
			if (y == null)
				return 1;
			return StringComparer.OrdinalIgnoreCase.Compare(x.Filename, y.Filename);
		}
开发者ID:etinquis,项目名称:nexusmodmanager,代码行数:16,代码来源:FilenameModComparer.cs


示例5: IniInstaller

		/// <summary>
		/// A simple constructor that initializes the object with its dependencies.
		/// </summary>
		/// <param name="p_modMod">The mod being installed.</param>
		/// <param name="p_ilgInstallLog">The install log to use to log file installations.</param>
		/// <param name="p_tfmFileManager">The transactional file manager to use to interact with the file system.</param>
		/// <param name="p_dlgOverwriteConfirmationDelegate">The method to call in order to confirm an overwrite.</param>
		public IniInstaller(IMod p_modMod, IInstallLog p_ilgInstallLog, TxFileManager p_tfmFileManager, ConfirmItemOverwriteDelegate p_dlgOverwriteConfirmationDelegate)
		{
			TouchedFiles = new Set<string>(StringComparer.OrdinalIgnoreCase);
			Mod = p_modMod;
			InstallLog = p_ilgInstallLog;
			TransactionalFileManager = p_tfmFileManager;
			m_dlgOverwriteConfirmationDelegate = p_dlgOverwriteConfirmationDelegate ?? ((s, b, m) => OverwriteResult.No);
		}
开发者ID:NexusMods,项目名称:NexusModManager-4.5,代码行数:15,代码来源:IniInstaller.cs


示例6: BasicUninstallTask

		/// <summary>
		/// A simple constructor that initializes the object with the given values.
		/// </summary>
		/// <param name="p_modMod">The mod being installed.</param>
		/// <param name="p_igpInstallers">The utility class to use to install the mod items.</param>
		/// <param name="p_ilgModInstallLog">The install log that tracks mod install info
		/// for the current game mode</param>
		/// <param name="p_gmdGameMode">The the current game mode.</param>
		/// <param name="p_rolActiveMods">The list of active mods.</param>
		public BasicUninstallTask(IMod p_modMod, InstallerGroup p_igpInstallers, IInstallLog p_ilgModInstallLog, IGameMode p_gmdGameMode, ReadOnlyObservableList<IMod> p_rolActiveMods)
		{
			Mod = p_modMod;
			Installers = p_igpInstallers;
			ModInstallLog = p_ilgModInstallLog;
			GameMode = p_gmdGameMode;
			ActiveMods = p_rolActiveMods;
		}
开发者ID:etinquis,项目名称:nexusmodmanager,代码行数:17,代码来源:BasicUninstallTask.cs


示例7: XmlScriptExecutor

		/// <summary>
		/// A simple constructor that initializes the object with the required dependencies.
		/// </summary>
		/// <param name="p_modMod">The mod for which the script is running.</param>
		/// <param name="p_gmdGameMode">The game mode currently being managed.</param>
		/// <param name="p_eifEnvironmentInfo">The application's envrionment info.</param>
		/// <param name="p_igpInstallers">The utility class to use to install the mod items.</param>
		/// <param name="p_scxUIContext">The <see cref="SynchronizationContext"/> to use to marshall UI interactions to the UI thread.</param>		
		public XmlScriptExecutor(IMod p_modMod, IGameMode p_gmdGameMode, IEnvironmentInfo p_eifEnvironmentInfo, InstallerGroup p_igpInstallers, SynchronizationContext p_scxUIContext)
		{
			m_scxSyncContext = p_scxUIContext;
			Mod = p_modMod;
			GameMode = p_gmdGameMode;
			EnvironmentInfo = p_eifEnvironmentInfo;
			Installers = p_igpInstallers;
		}
开发者ID:NexusMods,项目名称:NexusModManager-4.5,代码行数:16,代码来源:XmlScriptExecutor.cs


示例8: BasicInstallTask

		/// <summary>
		/// A simple constructor that initializes the object with the given values.
		/// </summary>
		/// <param name="p_modMod">The mod being installed.</param>
		/// <param name="p_gmdGameMode">The the current game mode.</param>
		/// <param name="p_mfiFileInstaller">The file installer to use.</param>
		/// <param name="p_pmgPluginManager">The plugin manager.</param>
		/// <param name="p_booSkipReadme">Whether to skip the installation of readme files.</param>
		/// <param name="p_rolActiveMods">The list of active mods.</param>
		public BasicInstallTask(IMod p_modMod, IGameMode p_gmdGameMode, IModFileInstaller p_mfiFileInstaller, IPluginManager p_pmgPluginManager, bool p_booSkipReadme, ReadOnlyObservableList<IMod> p_rolActiveMods)
		{
			Mod = p_modMod;
			GameMode = p_gmdGameMode;
			FileInstaller = p_mfiFileInstaller;
			PluginManager = p_pmgPluginManager;
			SkipReadme = p_booSkipReadme;
			ActiveMods = p_rolActiveMods;
		}
开发者ID:etinquis,项目名称:nexusmodmanager,代码行数:18,代码来源:BasicInstallTask.cs


示例9: ModTaggerVM

		/// <summary>
		/// A simple constructor that initializes the object with the given values.
		/// </summary>
		/// <param name="p_atgTagger">The tagger to use to tag mods with metadata.</param>
		/// <param name="p_modMod">The mod to be tagged.</param>
		/// <param name="p_setSettings">The application and user settings.</param>
		/// <param name="p_thmTheme">The current theme to use for the views.</param>
		public ModTaggerVM(AutoTagger p_atgTagger, IMod p_modMod, ISettings p_setSettings, Theme p_thmTheme)
		{
			ModTagger = p_atgTagger;
			Mod = p_modMod;
			Settings = p_setSettings;
			CurrentTheme = p_thmTheme;
			m_mifCurrentTagOption = new ModInfo(Mod);
			ModInfoEditorVM = new ModInfoEditorVM(m_mifCurrentTagOption, p_setSettings);
			ModInfoEditorVM.EditedModInfoVM.LoadInfoValues(p_modMod);
		}
开发者ID:NexusMods,项目名称:NexusModManager-4.5,代码行数:17,代码来源:ModTaggerVM.cs


示例10: ModController

        public ModController(IMod mod)
            : base(mod) {
            Contract.Requires<ArgumentNullException>(mod != null);
            _contentEngine = CalculatedGameSettings.ContentManager.ContentEngine;
            Mod = mod;
            _modState = new ModState(mod);
            _sixSyncModInstaller = new SixSyncModInstaller(mod, _modState);

            Model.State = _modState.State;
        }
开发者ID:SIXNetworks,项目名称:withSIX.Desktop,代码行数:10,代码来源:ModController.cs


示例11: ModdingEnvironmentWriter

        internal ModdingEnvironmentWriter(IMod[] mods_to_use, IMod[] dependencies_to_use, bool useHiDefProfile)
        {

            config = ModdingEnvironmentConfiguration.Create();

            ModEnvironment.RequestSetupDataReset();

            all_mods_to_process = mods_to_use;
            all_possible_dependencies = dependencies_to_use;

            var source_exe = ModManager.GameDirectory.ContainingFile(ModManager.OriginalExecutable);
                //new System.IO.FileInfo(System.IO.Path.Combine(base_directoy.FullName, source_exe_name));
            var modded_exe = ModManager.GameDirectory.ContainingFile(ModManager.ModdedExecutable);
                //new System.IO.FileInfo(System.IO.Path.Combine(base_directoy.FullName, modded_exe_name));
            var source_lib = ModManager.GameDirectory.ContainingFile(ModManager.OriginalLibrary);
            var modded_lib = ModManager.GameDirectory.ContainingFile(ModManager.ModdedLibrary);



            
            game_injector = new GnomoriaExeInjector(source_exe);
            lib_injector = new Injector(source_lib);
            config.Hashes.SourceExecutable = source_exe.GenerateMD5Hash();
            config.Hashes.SourceLibrary = source_lib.GenerateMD5Hash();

            // may switch those 2 later to have it outside...
            game_injector.Inject_SetContentRootDirectoryToCurrentDir_InsertAtStartOfMain();
            game_injector.Inject_CallTo_ModRuntimeController_Initialize_AtStartOfMain(ModManager.GameDirectory.ContainingFile(ModManager.ModController));
            //game_injector.Inject_TryCatchWrapperAroundEverthingInMain_WriteCrashLog();
            //game_injector.Inject_CurrentAppDomain_AddResolveEventAtStartOfMain();
            game_injector.Inject_SaveLoadCalls();
            //game_injector.Inject_TryCatchWrapperAroundGnomanEmpire_LoadGame();
            game_injector.Debug_ManipulateStuff();
            if (useHiDefProfile)
            {
                game_injector.Inject_AddHighDefXnaProfile();
            }


            foreach (var mod in mods_to_use)
            {
                ProcessMod(mod);
            }

            var allLoadedStuff = processedMods.Select(mod => Tuple.Create(mod, mod.Dependencies.Union(mod.InitAfter.Where(befor => processedMods.Contains(befor.GetInstance()))).Select(type => type.GetInstance())));
            var processedMods_sortedByDependencyAndInitAfter = DependencySort.Sort(allLoadedStuff);

            config.SetModReferences(processedMods_sortedByDependencyAndInitAfter.Select(mod => new ModReference(mod)).ToArray());

            //Mono.Cecil.WriterParameters
            game_injector.Write(modded_exe);
            lib_injector.Write(modded_lib);
            config.Hashes.ModdedExecutable = modded_exe.GenerateMD5Hash();
            config.Hashes.ModdedLibrary = modded_lib.GenerateMD5Hash();
        }
开发者ID:Rychard,项目名称:Faark.Gnomoria.Modding,代码行数:55,代码来源:ModdingWriter.cs


示例12: RegisterMod

		/// <summary>
		/// Register mod, if not already registered
		/// </summary>
		/// <param name="mod">Mod to be registered</param>
		public static void RegisterMod(IMod mod)
		{
			if (loadedModTypes.Contains(mod.GetType()))
			{
				return;
			}

			RegisterItems(mod.RegisterItems());
			RegisterRecipes(mod.RegisterRecipes());
			loadedModTypes.Add(mod.GetType());
		}
开发者ID:TheLogan,项目名称:ItemFramework,代码行数:15,代码来源:FrameworkRegistry.cs


示例13: ModFileInstaller

 /// <summary>
 /// A simple constructor that initializes the object with its dependencies.
 /// </summary>
 /// <param name="p_gmiGameModeInfo">The environment info of the current game mode.</param>
 /// <param name="p_modMod">The mod being installed.</param>
 /// <param name="p_ilgInstallLog">The install log to use to log file installations.</param>
 /// <param name="p_pmgPluginManager">The plugin manager.</param>
 /// <param name="p_dfuDataFileUtility">The utility class to use to work with data files.</param>
 /// <param name="p_tfmFileManager">The transactional file manager to use to interact with the file system.</param>
 /// <param name="p_dlgOverwriteConfirmationDelegate">The method to call in order to confirm an overwrite.</param>
 /// <param name="p_UsesPlugins">Whether the file is a mod or a plugin.</param>
 public ModFileInstaller(IGameModeEnvironmentInfo p_gmiGameModeInfo, IMod p_modMod, IInstallLog p_ilgInstallLog, IPluginManager p_pmgPluginManager, IDataFileUtil p_dfuDataFileUtility, TxFileManager p_tfmFileManager, ConfirmItemOverwriteDelegate p_dlgOverwriteConfirmationDelegate, bool p_UsesPlugins)
 {
     GameModeInfo = p_gmiGameModeInfo;
     Mod = p_modMod;
     InstallLog = p_ilgInstallLog;
     PluginManager = p_pmgPluginManager;
     DataFileUtility = p_dfuDataFileUtility;
     TransactionalFileManager = p_tfmFileManager;
     m_dlgOverwriteConfirmationDelegate = p_dlgOverwriteConfirmationDelegate ?? ((s, b, m) => OverwriteResult.No);
     IsPlugin = p_UsesPlugins;
 }
开发者ID:ThosRTanner,项目名称:modorganizer-NCC,代码行数:22,代码来源:ModFileInstaller.cs


示例14: RegisterMod

			/// <summary>
			/// Registers the given mod as being active, and associates it with the given key.
			/// </summary>
			/// <param name="p_modNewMod">The mod to register.</param>
			/// <param name="p_strModKey">The key with which to associate the mod.</param>
			/// <param name="p_booHiddenMod">Whether or not the mod should be included in the
			/// list of active mods.</param>
			public void RegisterMod(IMod p_modNewMod, string p_strModKey, bool p_booHiddenMod)
			{
				if (m_dicModKeys.ContainsValue(p_strModKey))
				{
					IMod modOld = m_dicModKeys.First(x => x.Value.Equals(p_strModKey)).Key;
					DeregisterMod(modOld);
				}
				m_dicModKeys.Add(p_modNewMod, p_strModKey);
				if (!p_booHiddenMod)
					m_oclRegisteredMods.Add(p_modNewMod);
			}
开发者ID:etinquis,项目名称:nexusmodmanager,代码行数:18,代码来源:InstallLog.ActiveModRegistry.cs


示例15: FindAlternateVersion

		/// <summary>
		/// This finds any mod in the candidate list that appears to be another version of the given mod.
		/// </summary>
		/// <param name="p_modMod">The mod for which to find another version.</param>
		/// <param name="p_booExistingOnly">Whether the matcher should only match candidate mods that exist.</param>
		/// <returns>The active mod that appears to be another version of the given mod,
		/// or <c>null</c> if no such mod was found.</returns>
		public IMod FindAlternateVersion(IMod p_modMod, bool p_booExistingOnly)
		{
			IEnumerable<IMod> lstMatches = from m in Candidates
										   where !String.IsNullOrEmpty(m.Id)
												&& m.Id.Equals(p_modMod.Id)
												&& !m.Filename.Equals(p_modMod.Filename, StringComparison.OrdinalIgnoreCase)
												&& (AssumeAllExist || !p_booExistingOnly || File.Exists(m.Filename))
										   select m;
			string strNewModName = p_modMod.ModName;
			if (String.IsNullOrEmpty(p_modMod.Id))
			{
				if (lstMatches.Count() == 0)
				{
					lstMatches = from m in Candidates
								 where m.ModName.Equals(strNewModName, StringComparison.InvariantCultureIgnoreCase)
									 && !m.Filename.Equals(p_modMod.Filename, StringComparison.OrdinalIgnoreCase)
									 && (AssumeAllExist || !p_booExistingOnly || File.Exists(m.Filename))
								 select m;
				}
				if (lstMatches.Count() == 0)
				{
					string strNewModNamePrefix = strNewModName.Split('-')[0].Trim();
					lstMatches = from m in Candidates
								 where m.ModName.Split('-')[0].Trim().Equals(strNewModNamePrefix, StringComparison.InvariantCultureIgnoreCase)
									 && !m.Filename.Equals(p_modMod.Filename, StringComparison.OrdinalIgnoreCase)
									 && (AssumeAllExist || !p_booExistingOnly || File.Exists(m.Filename))
								 select m;
				}
			}
			IMod modMatch = null;
			Int64 intFilesize = 0;
			foreach (IMod modCandidate in lstMatches)
			{
				if (File.Exists(modCandidate.Filename))
				{
					FileInfo fifInfo = new FileInfo(modCandidate.Filename);
					if (fifInfo.Length > intFilesize)
					{
						intFilesize = fifInfo.Length;
						modMatch = modCandidate;
					}
				}
			}
			if (modMatch == null)
				modMatch = lstMatches.FirstOrDefault();
			return modMatch;
		}
开发者ID:etinquis,项目名称:nexusmodmanager,代码行数:54,代码来源:ModMatcher.cs


示例16: DummyPluginManager

        public DummyPluginManager(string pluginsFile, IGameMode gameMode, IMod mod)
        {
            StreamReader reader = new StreamReader(pluginsFile);

            string installationPath = Path.Combine(gameMode.GameModeEnvironmentInfo.InstallationPath, gameMode.GetModFormatAdjustedPath(mod.Format, null, false));

            string line;
            while ((line = reader.ReadLine()) != null)
            {
                if (line[0] != '#')
                {
                    m_Plugins.Add(new Plugin(Path.Combine(installationPath, line.ToLower()), line, null));
                }
            }
            ((INotifyCollectionChanged)m_Plugins).CollectionChanged += new NotifyCollectionChangedEventHandler(ActivePlugins_CollectionChanged);
            m_ROOLPlugins = new ReadOnlyObservableList<Plugin>(m_Plugins);
        }
开发者ID:TanninOne,项目名称:modorganizer-NCC,代码行数:17,代码来源:DummyPluginManager.cs


示例17: CreateCacheFile

 /// <summary>
 /// Creates a cache file for the given mod, containing the specified files.
 /// </summary>
 /// <param name="p_modMod">The mod for which to create the cache file.</param>
 /// <param name="p_strFilesToCacheFolder">The folder containing the files to put into the cache.</param>
 /// <returns>The cache file for the specified mod, or <c>null</c>
 /// if there were no files to cache.</returns>
 public Archive CreateCacheFile(IMod p_modMod, string p_strFilesToCacheFolder)
 {
     if (!String.IsNullOrEmpty(p_strFilesToCacheFolder))
     {
         string[] strFilesToCompress = Directory.GetFiles(p_strFilesToCacheFolder, "*.*", SearchOption.AllDirectories);
         if (strFilesToCompress.Length > 0)
         {
             string strCachePath = GetCacheFilePath(p_modMod);
             SevenZipCompressor szcCompressor = new SevenZipCompressor();
             szcCompressor.ArchiveFormat = OutArchiveFormat.Zip;
             szcCompressor.CompressionLevel = CompressionLevel.Ultra;
             szcCompressor.CompressDirectory(p_strFilesToCacheFolder, strCachePath);
             return new Archive(strCachePath);
         }
     }
     return null;
 }
开发者ID:ThosRTanner,项目名称:modorganizer-NCC,代码行数:24,代码来源:NexusModCacheManager.cs


示例18: Activate

		/// <summary>
		/// Activates the given mod.
		/// </summary>
		/// <remarks>
		/// The given mod is either installed or upgraded, as appropriate.
		/// </remarks>
		/// <param name="p_modMod">The mod to install.</param>
		/// <param name="p_dlgUpgradeConfirmationDelegate">The delegate that is called to confirm whether an upgrade install should be performed.</param>
		/// <param name="p_dlgOverwriteConfirmationDelegate">The method to call in order to confirm an overwrite.</param>
		/// <param name="p_rolActiveMods">The list of active mods.</param>
		/// <returns>A background task set allowing the caller to track the progress of the operation.</returns>
		public IBackgroundTaskSet Activate(IMod p_modMod, ConfirmModUpgradeDelegate p_dlgUpgradeConfirmationDelegate, ConfirmItemOverwriteDelegate p_dlgOverwriteConfirmationDelegate, ReadOnlyObservableList<IMod> p_rolActiveMods)
		{
			ModMatcher mmcMatcher = new ModMatcher(InstallationLog.ActiveMods, true);
			IMod modOldVersion = mmcMatcher.FindAlternateVersion(p_modMod, true);
			ConfirmUpgradeResult curAction = (modOldVersion == null) ? ConfirmUpgradeResult.NormalActivation : p_dlgUpgradeConfirmationDelegate(modOldVersion, p_modMod);
			switch (curAction)
			{
				case ConfirmUpgradeResult.Upgrade:
					ModInstaller muiUpgrader = InstallerFactory.CreateUpgradeInstaller(modOldVersion, p_modMod, p_dlgOverwriteConfirmationDelegate);
                    return muiUpgrader;
				case ConfirmUpgradeResult.NormalActivation:
					ModInstaller minInstaller = InstallerFactory.CreateInstaller(p_modMod, p_dlgOverwriteConfirmationDelegate, p_rolActiveMods);
					return minInstaller;
				case ConfirmUpgradeResult.Cancel:
					return null;
				default:
					throw new Exception(String.Format("Unrecognized value for ConfirmUpgradeResult: {0}", curAction));
			}
		}
开发者ID:NexusMods,项目名称:NexusModManager-4.5,代码行数:30,代码来源:ModActivator.cs


示例19: ProcessMod

 private void ProcessMod(IMod mod)
 {
     if (processedMods.Contains(mod))
     {
         return;
     }
     if (currentlyProcessing.Contains(mod))
     {
         throw new InvalidOperationException("Can't process mod [" + mod.Name + "], already processing it. Circular dependency?");
     }
     currentlyProcessing.Add(mod);
     mod.Initialize_PreGeneration();
     if (mod.InitBefore.Count() > 0)
     {
         throw new NotImplementedException("Mod.InitAfter and Mod.InitBefore are not yet supported. Sorry.");
     }
     foreach (var dependency in mod.Dependencies)
     {
         ProcessMod(all_mods_to_process.Union(all_possible_dependencies).Single(depModInstance => depModInstance.GetType() == dependency.Type));
     }
     foreach (var change in mod.Modifications)
     {
         if (game_injector.AssemblyContainsType(change.TargetType))
         {
             game_injector.Inject_Modification(change);
         }
         else if (lib_injector.AssemblyContainsType(change.TargetType))
         {
             lib_injector.Inject_Modification(change);
         }
         else
         {
             throw new InvalidOperationException("Cannot change behavoir of type [" + change.TargetType + "]!");
         }
     }
     processedMods.Add(mod);
     currentlyProcessing.Remove(mod);
 }
开发者ID:Rychard,项目名称:Faark.Gnomoria.Modding,代码行数:38,代码来源:ModdingWriter.cs


示例20: CalculatedGameSettings

        public CalculatedGameSettings(Game game) {
            _eventBus = Common.App.Events;
            _game = game;
            CurrentMods = new IMod[0];
            _supportsModding = _game.SupportsMods();
            _supportsMissions = _game.SupportsMissions();
            _supportsServers = _game.SupportsServers();
            if (_supportsModding)
                _modding = _game.Modding();

            Signatures = new string[0];
            if (!Execute.InDesignMode) {
                var collectionChanged = this.WhenAnyValue(x => x.Collection)
                    .Skip(1);
                collectionChanged
                    .Subscribe(HandleModSetSwitch);

                // TODO: Ignore out of band responses, cancel previous etc...
                collectionChanged
                    .ObserveOn(ThreadPoolScheduler.Instance)
                    .Subscribe(x => UpdateSignatures());

                this.WhenAnyValue(x => x.Server)
                    .Skip(1)
                    .Subscribe(HandleServerSwitch);

                this.WhenAnyValue(x => x.Server.Mods)
                    .Skip(1)
                    .Subscribe(HandleServerModsChanged);

                this.WhenAnyValue(x => x.Mission)
                    .Skip(1)
                    .Subscribe(HandleMissionSwitch);
            }

            _first = true;
        }
开发者ID:MaHuJa,项目名称:withSIX.Desktop,代码行数:37,代码来源:CalculatedGameSettings.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IModel类代码示例发布时间:2022-05-24
下一篇:
C# IMiniSimDescription类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap