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


C# IProgressStatus.ReportWarning方法代码示例

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


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

示例1: ReportReflectionException

        void ReportReflectionException(IProgressStatus monitor, Exception ex, AddinDescription config, AddinScanResult scanResult)
        {
            scanResult.AddFileToWithFailure (config.AddinFile);
            monitor.ReportWarning ("[" + config.AddinId + "] Could not load some add-in assemblies: " + ex.Message);
            if (monitor.LogLevel <= 1)
                return;

            ReflectionTypeLoadException rex = ex as ReflectionTypeLoadException;
            if (rex != null) {
                foreach (Exception e in rex.LoaderExceptions)
                    monitor.Log ("Load exception: " + e);
            }
        }
开发者ID:JamesChan,项目名称:mono-addins,代码行数:13,代码来源:AddinScanner.cs

示例2: CollectExtensionData

        void CollectExtensionData(IProgressStatus monitor, AddinIndex addinHash, AddinDescription conf, AddinUpdateData updateData)
        {
            IEnumerable<string> missingDeps = addinHash.GetMissingDependencies (conf, conf.MainModule);
            if (missingDeps.Any ()) {
                string w = "The add-in '" + conf.AddinId + "' could not be updated because some of its dependencies are missing or not compatible:";
                w += BuildMissingAddinsList (addinHash, conf, missingDeps);
                monitor.ReportWarning (w);
                return;
            }

            CollectModuleExtensionData (conf, conf.MainModule, updateData, addinHash);

            foreach (ModuleDescription module in conf.OptionalModules) {
                missingDeps = addinHash.GetMissingDependencies (conf, module);
                if (missingDeps.Any ()) {
                    if (monitor.LogLevel > 1) {
                        string w = "An optional module of the add-in '" + conf.AddinId + "' could not be updated because some of its dependencies are missing or not compatible:";
                        w += BuildMissingAddinsList (addinHash, conf, missingDeps);
                    }
                }
                else
                    CollectModuleExtensionData (conf, module, updateData, addinHash);
            }
        }
开发者ID:mono,项目名称:mono-addins,代码行数:24,代码来源:AddinDatabase.cs

示例3: MonitorProcessStatus

		public static void MonitorProcessStatus (IProgressStatus monitor, TextReader reader, StringCollection progessLog)
		{
			string line;
			string exceptionText = null;
			while ((line = reader.ReadLine ()) != null) {
				int i = line.IndexOf (':');
				if (i != -1) {
					string tag = line.Substring (0, i);
					string txt = line.Substring (i+1);
					bool wasTag = true;
					
					switch (tag) {
						case "process-ps-msg":
							monitor.SetMessage (Decode (txt));
							break;
						case "process-ps-progress":
							monitor.SetProgress (double.Parse (txt));
							break;
						case "process-ps-log":
							monitor.Log (Decode (txt));
							break;
						case "process-ps-warning":
							monitor.ReportWarning (Decode (txt));
							break;
						case "process-ps-exception":
							exceptionText = Decode (txt);
							if (exceptionText == string.Empty)
								exceptionText = null;
							break;
						case "process-ps-error":
							string err = Decode (txt);
							if (err == string.Empty) err = null;
							monitor.ReportError (err, exceptionText != null ? new Exception (exceptionText) : null);
							break;
						case "process-ps-cancel":
							monitor.Cancel ();
							break;
						case "process-ps-plog":
							progessLog.Add (Decode (txt));
							break;
						default:
							wasTag = false;
							break;
					}
					if (wasTag)
						continue;
				}
				Console.WriteLine (line);
			}
		}
开发者ID:wanglehui,项目名称:mono-addins,代码行数:50,代码来源:ProcessProgressStatus.cs

示例4: RunScannerProcess

        void RunScannerProcess(IProgressStatus monitor)
        {
            ISetupHandler setup = GetSetupHandler ();

            IProgressStatus scanMonitor = monitor;
            ArrayList pparams = new ArrayList ();

            bool retry = false;
            do {
                try {
                    if (monitor.LogLevel > 1)
                        monitor.Log ("Looking for addins");
                    setup.Scan (scanMonitor, registry, null, (string[]) pparams.ToArray (typeof(string)));
                    retry = false;
                }
                catch (Exception ex) {
                    ProcessFailedException pex = ex as ProcessFailedException;
                    if (pex != null) {
                        // Get the last logged operation.
                        if (pex.LastLog.StartsWith ("scan:")) {
                            // It crashed while scanning a file. Add the file to the ignore list and try again.
                            string file = pex.LastLog.Substring (5);
                            pparams.Add (file);
                            monitor.ReportWarning ("Could not scan file: " + file);
                            retry = true;
                            continue;
                        }
                    }
                    fatalDatabseError = true;
                    // If the process has crashed, try to do a new scan, this time using verbose log,
                    // to give the user more information about the origin of the crash.
                    if (pex != null && !retry) {
                        monitor.ReportError ("Add-in scan operation failed. The runtime may have encountered an error while trying to load an assembly.", null);
                        if (monitor.LogLevel <= 1) {
                            // Re-scan again using verbose log, to make it easy to find the origin of the error.
                            retry = true;
                            scanMonitor = new ConsoleProgressStatus (true);
                        }
                    } else
                        retry = false;

                    if (!retry) {
                        var pfex = ex as ProcessFailedException;
                        monitor.ReportError ("Add-in scan operation failed", pfex != null? pfex.InnerException : ex);
                        monitor.Cancel ();
                        return;
                    }
                }
            }
            while (retry);
        }
开发者ID:mono,项目名称:mono-addins,代码行数:51,代码来源:AddinDatabase.cs

示例5: ResolveExtensions

		public void ResolveExtensions (IProgressStatus monitor, Hashtable descriptions)
		{
			// Make a copy of the extensions found, sice the hash may change while being scanned
			object[] extensionPointsFound = new object [pathHash.Count];
			pathHash.Values.CopyTo (extensionPointsFound, 0);

			foreach (object ob in extensionPointsFound) {
				ExtensionPoint ep = ob as ExtensionPoint;
				
				if (ep == null) {
					// It is a list of extension from a root add-in
					ArrayList rootExtensionPoints = (ArrayList) ob;
					foreach (RootExtensionPoint rep in rootExtensionPoints) {
						foreach (ExtensionNodeType nt in rep.ExtensionPoint.NodeSet.NodeTypes) {
							if (nt.ObjectTypeName.Length > 0)
								CollectObjectTypeExtensions (rep.Description, rep.ExtensionPoint, nt.ObjectTypeName);
						}
					}
					continue;
				}
				
				if (ep.RootAddin == null) {
					// Ignore class extensions
					if (!ep.Path.StartsWith ("$")) {
						// No add-in has defined this extension point, but some add-in
						// is trying to extend it. A parent extension may exist. Check it now.
						ExtensionPoint pep = GetParentExtensionPoint (ep.Path);
						if (pep != null) {
							foreach (string a in ep.Addins)
								if (!pep.Addins.Contains (a))
									pep.Addins.Add (a);
						} else {
							foreach (string s in ep.Addins)
								monitor.ReportWarning ("The add-in '" + s + "' is trying to extend '" + ep.Path + "', but there isn't any add-in defining this extension point");
						}
					}
					pathHash.Remove (ep.Path);
				}
				else {
					foreach (ExtensionNodeType nt in ep.NodeSet.NodeTypes) {
						if (nt.ObjectTypeName.Length > 0) {
							AddinDescription desc = (AddinDescription) descriptions [ep.RootAddin];
							CollectObjectTypeExtensions (desc, ep, nt.ObjectTypeName);
						}
					}
				}
			}
			
			foreach (ArrayList list in objectTypeExtensions.Values) {
				foreach (UnresolvedObjectTypeExtension data in list) {
					if (!data.FoundExtensionPoint) {
						monitor.ReportWarning ("The add-in '" + data.Description.AddinId + "' is trying to register the class '" + data.Extension.Path + "', but there isn't any add-in defining a suitable extension point");
						// The type extensions may be registered using different base classes.
						// Make sure the warning is shown only once
						data.FoundExtensionPoint = true;
					}
				}
			}
		}
开发者ID:AminBonyadUni,项目名称:facedetect-f-spot,代码行数:59,代码来源:AddinUpdateData.cs


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