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

C# IProgressStatus类代码示例

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

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



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

示例1: AddinScanner

        public AddinScanner(AddinDatabase database, AddinScanResult scanResult, IProgressStatus monitor)
        {
            this.database = database;
            if (!scanResult.CheckOnly) {

                // If there is a local copy of the cecil reflector, use it instead of the one in the gac
                Type t;
                string asmFile = Path.Combine (Path.GetDirectoryName (GetType().Assembly.Location), "Mono.Addins.CecilReflector.dll");
                if (File.Exists (asmFile)) {
                    Assembly asm = Assembly.LoadFrom (asmFile);
                    t = asm.GetType ("Mono.Addins.CecilReflector.Reflector");
                }
                else {
                    string refName = GetType().Assembly.FullName;
                    int i = refName.IndexOf (',');
                    refName = "Mono.Addins.CecilReflector.Reflector, Mono.Addins.CecilReflector" + refName.Substring (i);
                    t = Type.GetType (refName, false);
                }
                if (t != null)
                    reflector = (IAssemblyReflector) Activator.CreateInstance (t);
                else
                    reflector = new DefaultAssemblyReflector ();

                if (monitor.LogLevel > 1)
                    monitor.Log ("Using assembly reflector: " + reflector.GetType ());
                reflector.Initialize (scanResult);
                coreAssembly = reflector.LoadAssembly (GetType().Assembly.Location);
            }
        }
开发者ID:NALSS,项目名称:Telegraph,代码行数:29,代码来源:AddinScanner.cs


示例2: GetProgressMonitor

		public static IProgressMonitor GetProgressMonitor (IProgressStatus status)
		{
			if (status == null)
				return new NullProgressMonitor ();
			else
				return new ProgressStatusMonitor (status);
		}
开发者ID:wanglehui,项目名称:mono-addins,代码行数:7,代码来源:ProgressStatusMonitor.cs


示例3: RegisterRepository

		public AddinRepository RegisterRepository (IProgressStatus monitor, string url, bool updateNow)
		{
			if (!url.EndsWith (".mrep"))
				url = url + "/main.mrep";
			
			RepositoryRecord rr = FindRepositoryRecord (url);
			if (rr != null)
				return rr;

			RegisterRepository (url, false);
			
			try {
				if (updateNow) {
					UpdateRepository (monitor, url);
					rr = FindRepositoryRecord (url);
					Repository rep = rr.GetCachedRepository ();
					rr.Name = rep.Name;
				}
				service.SaveConfiguration ();
				return rr;
			} catch (Exception ex) {
				if (monitor != null)
					monitor.ReportError ("The repository could not be registered", ex);
				if (ContainsRepository (url))
					RemoveRepository (url);
				return null;
			}
		}
开发者ID:AminBonyadUni,项目名称:facedetect-f-spot,代码行数:28,代码来源:RepositoryRegistry.cs


示例4: ExecuteCommand

		internal static void ExecuteCommand (IProgressStatus monitor, string registryPath, string startupDir, string name, params string[] args)
		{
			string asm = new Uri (typeof(SetupProcess).Assembly.CodeBase).LocalPath;
			string verboseParam = monitor.VerboseLog ? "v " : "nv";
			
			Process process = new Process ();
			if (Util.IsWindows)
				process.StartInfo = new ProcessStartInfo (asm, verboseParam + " " + name + " " + string.Join (" ", args));
			else
				process.StartInfo = new ProcessStartInfo ("mono", "--debug " + asm + " " + verboseParam + " " + name + " " + string.Join (" ", args));
			process.StartInfo.WorkingDirectory = AppDomain.CurrentDomain.BaseDirectory;
			process.StartInfo.UseShellExecute = false;
			process.StartInfo.RedirectStandardInput = true;
			process.StartInfo.RedirectStandardOutput = true;
			process.StartInfo.RedirectStandardError = true;
			process.EnableRaisingEvents = true;
			try {
				process.Start ();
			} catch (Exception ex) {
				Console.WriteLine (ex);
				throw;
			}
			
			process.StandardInput.WriteLine (registryPath);
			process.StandardInput.WriteLine (startupDir);
			process.StandardInput.Flush ();

//			string rr = process.StandardOutput.ReadToEnd ();
//			Console.WriteLine (rr);
			
			ProcessProgressStatus.MonitorProcessStatus (monitor, process.StandardOutput);
			process.WaitForExit ();
			if (process.ExitCode != 0)
				throw new ProcessFailedException ();
		}
开发者ID:AminBonyadUni,项目名称:facedetect-f-spot,代码行数:35,代码来源:SetupProcess.cs


示例5: Install

		public bool Install (IProgressStatus statusMonitor, params AddinRepositoryEntry[] addins)
		{
			Package[] packages = new Package [addins.Length];
			for (int n=0; n<addins.Length; n++)
				packages [n] = AddinPackage.FromRepository (addins [n]);

			return Install (statusMonitor, packages);
		}
开发者ID:AminBonyadUni,项目名称:facedetect-f-spot,代码行数:8,代码来源:AddinStore.cs


示例6: GetPresetName

        private IList<IncludeEntry> GetPresetName(IProgressStatus progress)
        {
            string presetName = Request.QueryString["preset"] ?? "default";

            progress.ReportStatus("Using preset name {0}", MessageType.Info, presetName);

            return SerializationUtility.GetPreset(presetName);
        }
开发者ID:jelleovermars,项目名称:Unicorn,代码行数:8,代码来源:sync-database.aspx.cs


示例7: Process

        protected override void Process(IProgressStatus progress)
        {
            var configurations = ResolveConfigurations();

            foreach (var configuration in configurations)
            {
                var logger = configuration.Resolve<ILogger>();

                using (new LoggingContext(new WebConsoleLogger(progress), configuration))
                {
                    try
                    {
                        logger.Info("Control Panel Sync: Processing Unicorn configuration " + configuration.Name);

                        var beginArgs = new UnicornSyncBeginPipelineArgs(configuration);
                        CorePipeline.Run("unicornSyncBegin", beginArgs);

                        if (beginArgs.Aborted)
                        {
                            logger.Error("Unicorn Sync Begin pipeline was aborted. Not executing sync for this configuration.");
                            continue;
                        }

                        if (beginArgs.SyncIsHandled)
                        {
                            logger.Info("Unicorn Sync Begin pipeline signalled that it handled the sync for this configuration.");
                            continue;
                        }

                        var pathResolver = configuration.Resolve<PredicateRootPathResolver>();
                        var retryer = configuration.Resolve<IDeserializeFailureRetryer>();
                        var consistencyChecker = configuration.Resolve<IConsistencyChecker>();
                        var loader = configuration.Resolve<SerializationLoader>();

                        var roots = pathResolver.GetRootSerializedItems();

                        var index = 0;

                        loader.LoadAll(roots, retryer, consistencyChecker, item =>
                        {
                            progress.Report((int)(((index + 1) / (double)roots.Length) * 100));
                            index++;
                        });

                        CorePipeline.Run("unicornSyncComplete", new UnicornSyncCompletePipelineArgs(configuration));

                        logger.Info("Control Panel Sync: Completed syncing Unicorn configuration " + configuration.Name);
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex);
                        break;
                    }
                }
            }

            CorePipeline.Run("unicornSyncEnd", new UnicornSyncEndPipelineArgs(configurations));
        }
开发者ID:BerserkerDotNet,项目名称:Unicorn,代码行数:58,代码来源:SyncConsole.cs


示例8: Scan

		public void Scan (IProgressStatus monitor, AddinRegistry registry, string scanFolder, string[] filesToIgnore)
		{
			AddinRegistry reg = new AddinRegistry (registry.RegistryPath, registry.StartupDirectory, registry.DefaultAddinsFolder, registry.AddinCachePath);
			reg.CopyExtensionsFrom (registry);
			StringCollection files = new StringCollection ();
			for (int n=0; n<filesToIgnore.Length; n++)
				files.Add (filesToIgnore[n]);
			reg.ScanFolders (monitor, scanFolder, files);
		}
开发者ID:wanglehui,项目名称:mono-addins,代码行数:9,代码来源:SetupLocal.cs


示例9: ExecuteCommand

		internal static void ExecuteCommand (IProgressStatus monitor, string registryPath, string startupDir, string addinsDir, string databaseDir, string name, string arg1, params string[] args)
		{
			string verboseParam = monitor.LogLevel.ToString ();
			
			// Arguments string
			StringBuilder sb = new StringBuilder ();
			sb.Append (verboseParam).Append (' ').Append (name);
			sb.Append (" \"").Append (arg1).Append ("\"");
			foreach (string arg in args)
				sb.Append (" \"").Append (arg).Append ("\"");
			
			Process process = new Process ();
			
			string asm = null;
			try {
				asm = CreateHostExe ();
				if (!Util.IsMono)
					process.StartInfo = new ProcessStartInfo (asm, sb.ToString ());
				else {
					asm = asm.Replace(" ", @"\ ");
					process.StartInfo = new ProcessStartInfo ("mono", "--debug " + asm + " " + sb.ToString ());
				}
				process.StartInfo.WorkingDirectory = AppDomain.CurrentDomain.BaseDirectory;
				process.StartInfo.UseShellExecute = false;
				process.StartInfo.CreateNoWindow = true;
				process.StartInfo.RedirectStandardInput = true;
				process.StartInfo.RedirectStandardOutput = true;
				process.StartInfo.RedirectStandardError = true;
				process.EnableRaisingEvents = true;
				process.Start ();
			
				process.StandardInput.WriteLine (registryPath);
				process.StandardInput.WriteLine (startupDir);
				process.StandardInput.WriteLine (addinsDir);
				process.StandardInput.WriteLine (databaseDir);
				process.StandardInput.Flush ();
	
	//			string rr = process.StandardOutput.ReadToEnd ();
	//			Console.WriteLine (rr);
				
				StringCollection progessLog = new StringCollection ();
				ProcessProgressStatus.MonitorProcessStatus (monitor, process.StandardOutput, progessLog);
				process.WaitForExit ();
				if (process.ExitCode != 0)
					throw new ProcessFailedException (progessLog);
				
			} catch (Exception ex) {
				Console.WriteLine (ex);
				throw;
			} finally {
				if (asm != null) {
					try {
						File.Delete (asm);
					} catch { }
				}
			}
		}
开发者ID:wanglehui,项目名称:mono-addins,代码行数:57,代码来源:SetupProcess.cs


示例10: Process

        protected virtual void Process(IProgressStatus progress, ILogger additionalLogger)
        {
            var configurations = ResolveConfigurations();
            int taskNumber = 1;

            foreach (var configuration in configurations)
            {
                var logger = configuration.Resolve<ILogger>();
                var helper = configuration.Resolve<SerializationHelper>();

                using (new LoggingContext(additionalLogger, configuration))
                {
                    try
                    {
                        logger.Info(configuration.Name + " is being synced.");

                        using (new TransparentSyncDisabler())
                        {
                            var pathResolver = configuration.Resolve<PredicateRootPathResolver>();

                            var roots = pathResolver.GetRootSerializedItems();

                            var index = 0;

                            helper.SyncTree(configuration, item =>
                            {
                                WebConsoleUtility.SetTaskProgress(progress, taskNumber, configurations.Length, (int)((index / (double)roots.Length) * 100));
                                index++;
                            }, roots);
                        }
                    }
                    catch (DeserializationSoftFailureAggregateException ex)
                    {
                        logger.Error(ex);
                        // allow execution to continue, because the exception was non-fatal
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex);
                        break;
                    }
                }

                taskNumber++;
            }

            try
            {
                CorePipeline.Run("unicornSyncEnd", new UnicornSyncEndPipelineArgs(progress, configurations));
            }
            catch (Exception exception)
            {
                Log.Error("Error occurred in unicornSyncEnd pipeline.", exception);
                progress.ReportException(exception);
            }
        }
开发者ID:Eldblom,项目名称:Unicorn,代码行数:56,代码来源:SyncVerb.cs


示例11: ProcessInternal

        protected virtual void ProcessInternal(IProgressStatus progress)
        {
            // this bad-ass ASCII art is from http://www.ascii-art.de/ascii/uvw/unicorn.txt - original credit to 'sk'
            const string unicorn = @"<pre>
                        /
                      .7
               \       , //
               |\.--._/|//
              /\ ) ) ).'/
             /(  \  // /       _   _ _   _ ___ ____ ___  ____  _   _
            /(   J`((_/ \     | | | | \ | |_ _/ ___/ _ \|  _ \| \ | |
               / ) | _\     /     | | | |  \| || | |  | | | | |_) |  \| |
              /|)  \  eJ    L     | |_| | |\  || | |__| |_| |  _ <| |\  |
             |  \ L \   L   L      \___/|_| \_|___\____\___/|_| \_\_| \_|
            /  \  J  `. J   L
            |  )   L   \/   \
               /  \    J   (\   /
              |  \      \   \```
            </pre>";

            // note: these logs are intentionally to progress and not loggingConsole as we don't need them in the Sitecore logs
            progress.ReportStatus(unicorn, MessageType.Warning);
            progress.ReportTransientStatus("Executing.");

            var heartbeat = new Timer(3000);
            var startTime = DateTime.Now;
            heartbeat.AutoReset = true;
            heartbeat.Elapsed += (sender, args) =>
            {
                var elapsed = Math.Round((args.SignalTime - startTime).TotalSeconds);

                progress.ReportTransientStatus("Executing for {0} sec.", elapsed.ToString(CultureInfo.InvariantCulture));
            };

            heartbeat.Start();

            try
            {
                using (new SecurityDisabler())
                {
                    using (new ItemFilterDisabler()) // disable all item filtering (if we're running in live mode we need this to get unadulterated items)
                    {
                        Process(progress);
                    }
                }
            }
            finally
            {
                heartbeat.Stop();
            }

            progress.Report(100);
            progress.ReportTransientStatus("Completed.");
            progress.ReportStatus(_isAutomatedTool ? "\r\n" : "<br>");
            progress.ReportStatus("Completed. Want to <a href=\"?verb=\">return to the control panel?</a>");
        }
开发者ID:BerserkerDotNet,项目名称:Unicorn,代码行数:56,代码来源:ControlPanelConsole.cs


示例12: Process

		protected virtual void Process(IProgressStatus progress, ILogger additionalLogger)
		{
			var configurations = ResolveConfigurations();
			int taskNumber = 1;

			foreach (var configuration in configurations)
			{
				var logger = configuration.Resolve<ILogger>();

				using (new LoggingContext(additionalLogger, configuration))
				{
					try
					{
						var timer = new Stopwatch();
						timer.Start();

						logger.Info(string.Empty);
						logger.Info(configuration.Name + " is being reserialized.");

						using (new TransparentSyncDisabler())
						{
							var targetDataStore = configuration.Resolve<ITargetDataStore>();
							var helper = configuration.Resolve<SerializationHelper>();

							// nuke any existing items in the store before we begin. This is a full reserialize so we want to
							// get rid of any existing stuff even if it's not part of existing configs
							logger.Warn("[D] Clearing existing items from {0} (if any)".FormatWith(targetDataStore.FriendlyName));
							targetDataStore.Clear();

							var roots = configuration.Resolve<PredicateRootPathResolver>().GetRootSourceItems();

							int index = 1;
							foreach (var root in roots)
							{
								helper.DumpTree(root, new[] { configuration });
								WebConsoleUtility.SetTaskProgress(progress, taskNumber, configurations.Length, (int)((index / (double)roots.Length) * 100));
								index++;
							}
						}

						timer.Stop();

						CorePipeline.Run("unicornReserializeComplete", new UnicornReserializeCompletePipelineArgs(configuration));

						logger.Info("{0} reserialization complete in {1}ms.".FormatWith(configuration.Name, timer.ElapsedMilliseconds));
					}
					catch (Exception ex)
					{
						logger.Error(ex);
						break;
					}

					taskNumber++;
				}
			}
		}
开发者ID:jnbuehler,项目名称:Unicorn,代码行数:56,代码来源:ReserializeVerb.cs


示例13: WebConsoleLogger

        public WebConsoleLogger(IProgressStatus progress, string logLevelValue)
        {
            _progress = progress;
            MessageType type;

            if(logLevelValue == null || !Enum.TryParse(logLevelValue, true, out type))
                type = MessageType.Debug;

            _logLevel = type;
        }
开发者ID:Eldblom,项目名称:Unicorn,代码行数:10,代码来源:WebConsoleLogger.cs


示例14: SetRangeTaskProgress

		/// <summary>
		/// Sets the progress of the whole based on the progress within a percentage range of the main progress (e.g. 0-100% of a task within the global range of 0-20%)
		/// </summary>
		/// <param name="progress"></param>
		/// <param name="startPercentage">The percentage the task began at</param>
		/// <param name="endPercentage">The percentage the task ends at</param>
		/// <param name="taskPercent">The percentage complete of the sub-task (0-100)</param>
		private static void SetRangeTaskProgress(IProgressStatus progress, int startPercentage, int endPercentage, int taskPercent)
		{
			int range = endPercentage - startPercentage;

			if (range <= 0) throw new ArgumentException("endPercentage must be greater than startPercentage");

			int offset = (int)Math.Round(range * (taskPercent / 100d));

			progress.Report(Math.Min(startPercentage + offset, 100));
		}
开发者ID:hbopuri,项目名称:Unicorn,代码行数:17,代码来源:WebConsoleUtility.cs


示例15: SetTaskProgress

		/// <summary>
		/// Sets the progress of the whole based on the progress within a sub-task of the main progress (e.g. 0-100% of a task within the global range of 0-20%)
		/// </summary>
		/// <param name="progress"></param>
		/// <param name="taskNumber">The index of the current sub-task</param>
		/// <param name="totalTasks">The total number of sub-tasks</param>
		/// <param name="taskPercent">The percentage complete of the sub-task (0-100)</param>
		public static void SetTaskProgress(IProgressStatus progress, int taskNumber, int totalTasks, int taskPercent)
		{
			if (taskNumber < 1) throw new ArgumentException("taskNumber must be 1 or more");
			if (totalTasks < 1) throw new ArgumentException("totalTasks must be 1 or more");
			if (taskNumber > totalTasks) throw new ArgumentException("taskNumber was greater than the number of totalTasks!");

			int start = (int)Math.Round(((taskNumber - 1) / (double)totalTasks) * 100d);
			int end = start + (int)Math.Round((1d / totalTasks) * 100d);

			SetRangeTaskProgress(progress, Math.Max(start, 0), Math.Min(end, 100), taskPercent);
		}
开发者ID:hbopuri,项目名称:Unicorn,代码行数:18,代码来源:WebConsoleUtility.cs


示例16: SubtaskProgressStatus

		/// <summary>
		/// Default constructor
		/// </summary>
		/// <param name="taskName">Name of the subtask to run</param>
		/// <param name="mainTask">The progress status of the main task (or parent subtask)</param>
		/// <param name="subtaskIndex">The index of this subtask among total subtask count (used to calculate offset progress)</param>
		/// <param name="subtaskCount">The total number of subtasks in the main task (or parent subtask)</param>
		/// <param name="automaticTransientStatus">If true, transient status will be automatically managed for you for this subtask ($taskname running for xx seconds). Make sure to dispose the subtask!</param>
		public SubtaskProgressStatus(string taskName, IProgressStatus mainTask, int subtaskIndex, int subtaskCount, bool automaticTransientStatus)
		{
			_subtaskIndex = subtaskIndex;
			_subtaskCount = subtaskCount;

			_mainTask = mainTask;
			_taskName = taskName;
			_automaticTransientStatus = automaticTransientStatus;

			InitializeStatus();
		}
开发者ID:kamsar,项目名称:Kamsar.WebConsole,代码行数:19,代码来源:SubtaskProgressStatus.cs


示例17: Process

        protected override void Process(IProgressStatus progress)
        {
            var configurations = ResolveConfigurations();
            int taskNumber = 1;

            foreach (var configuration in configurations)
            {
                var logger = configuration.Resolve<ILogger>();
                var helper = configuration.Resolve<SerializationHelper>();

                using (new LoggingContext(new WebConsoleLogger(progress), configuration))
                {
                    try
                    {
                        logger.Info(string.Empty);
                        logger.Info(configuration.Name + " is being synced.");

                        using (new TransparentSyncDisabler())
                        {
                            var pathResolver = configuration.Resolve<PredicateRootPathResolver>();

                            var roots = pathResolver.GetRootSerializedItems();

                            var index = 0;

                            helper.SyncTree(configuration, item =>
                            {
                                SetTaskProgress(progress, taskNumber, configurations.Length, (int)((index / (double)roots.Length) * 100));
                                index++;
                            }, roots);
                        }
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex);
                        break;
                    }
                }

                taskNumber++;
            }

            try
            {
                CorePipeline.Run("unicornSyncEnd", new UnicornSyncEndPipelineArgs(progress, configurations));
            }
            catch (Exception exception)
            {
                Log.Error("Error occurred in unicornSyncEnd pipeline.", exception);
                progress.ReportException(exception);
            }
        }
开发者ID:GuitarRich,项目名称:Unicorn,代码行数:52,代码来源:SyncConsole.cs


示例18: GetAddinDescription

		public void GetAddinDescription (IProgressStatus monitor, AddinRegistry registry, string file, string outFile)
		{
			RemoteProgressStatus remMonitor = new RemoteProgressStatus (monitor);
			try {
				RemoteSetupDomain rsd = GetDomain ();
				rsd.GetAddinDescription (remMonitor, registry.RegistryPath, registry.StartupDirectory, registry.DefaultAddinsFolder, registry.AddinCachePath, file, outFile);
			} catch (Exception ex) {
				throw new ProcessFailedException (remMonitor.ProgessLog, ex);
			} finally {
				System.Runtime.Remoting.RemotingServices.Disconnect (remMonitor);
				ReleaseDomain ();
			}
		}
开发者ID:wanglehui,项目名称:mono-addins,代码行数:13,代码来源:SetupDomain.cs


示例19: ProcessInternal

        protected virtual void ProcessInternal(IProgressStatus progress)
        {
            if (_headingService != null && !_isAutomatedTool)
            {
                progress.ReportStatus(_headingService.GetHeadingHtml());
            }

            // note: these logs are intentionally to progress and not loggingConsole as we don't need them in the Sitecore logs

            progress.ReportTransientStatus("Executing.");

            var heartbeat = new Timer(3000);
            var startTime = DateTime.Now;
            heartbeat.AutoReset = true;
            heartbeat.Elapsed += (sender, args) =>
            {
                var elapsed = Math.Round((args.SignalTime - startTime).TotalSeconds);

                try
                {
                    progress.ReportTransientStatus("Executing for {0} sec.", elapsed.ToString(CultureInfo.InvariantCulture));
                }
                catch
                {
                    // e.g. HTTP connection disconnected - prevent infinite looping
                    heartbeat.Stop();
                }
            };

            heartbeat.Start();

            try
            {
                using (new SecurityDisabler())
                {
                    using (new ItemFilterDisabler()) // disable all item filtering (if we're running in live mode we need this to get unadulterated items)
                    {
                        Process(progress);
                    }
                }
            }
            finally
            {
                heartbeat.Stop();
            }

            progress.Report(100);
            progress.ReportTransientStatus("Completed.");
            progress.ReportStatus(_isAutomatedTool ? "\r\n" : "<br>");
            progress.ReportStatus("Completed. Want to <a href=\"?verb=\">return to the control panel?</a>");
        }
开发者ID:PetersonDave,项目名称:Unicorn,代码行数:51,代码来源:ControlPanelConsole.cs


示例20: Process

        protected override void Process(IProgressStatus progress)
        {
            foreach (var configuration in ResolveConfigurations())
            {
                var logger = configuration.Resolve<ILogger>();

                using (new LoggingContext(new WebConsoleLogger(progress), configuration))
                {
                    try
                    {
                        var timer = new Stopwatch();
                        timer.Start();

                        logger.Info(configuration.Name + " is being reserialized");

                        using (new TransparentSyncDisabler())
                        {
                            var targetDataStore = configuration.Resolve<ITargetDataStore>();
                            var helper = configuration.Resolve<SerializationHelper>();

                            // nuke any existing items in the store before we begin. This is a full reserialize so we want to
                            // get rid of any existing stuff even if it's not part of existing configs
                            logger.Warn("[D] Clearing existing items from {0}".FormatWith(targetDataStore.FriendlyName));
                            targetDataStore.Clear();

                            var roots = configuration.Resolve<PredicateRootPathResolver>().GetRootSourceItems();

                            int index = 1;
                            foreach (var root in roots)
                            {
                                helper.DumpTree(root, configuration);
                                progress.Report((int) ((index/(double) roots.Length)*100));
                                index++;
                            }
                        }

                        timer.Stop();

                        logger.Info("{0} reserialization complete in {1}ms".FormatWith(configuration.Name, timer.ElapsedMilliseconds));
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex);
                        break;
                    }
                }
            }
        }
开发者ID:PetersonDave,项目名称:Unicorn,代码行数:48,代码来源:ReserializeConsole.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# IProject类代码示例发布时间:2022-05-24
下一篇:
C# IProgressReporter类代码示例发布时间: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