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


C# ILogWriter.WriteLine方法代码示例

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


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

示例1: ValidateModuleName

        /// <summary>
        /// Validates the name of a module and renames it until a valid name is found
        /// </summary>
        private static void ValidateModuleName(Blackboard blackboard, ILogWriter log, ref string moduleName, ref bool moduleEnabled, string moduleAlias, SortedList<string, ModuleClient> disabledModules)
        {
            // Module validation.
            // If a module with the same name exists, rename the current module and disable it
            if (blackboard.Modules.Contains(moduleName) || disabledModules.ContainsKey(moduleName))
            {
                int n = 1;
                string newModuleName = moduleName + n.ToString().PadLeft(2, '0');

                while (blackboard.Modules.Contains(newModuleName) || disabledModules.ContainsKey(newModuleName))
                {
                    ++n;
                    newModuleName = moduleName + n.ToString().PadLeft(2, '0');
                }
                log.WriteLine(1, "Module " + moduleName + " already exists. Renamed to " + newModuleName + (moduleAlias != moduleName ? " alias " + moduleAlias : ""));
                moduleName = newModuleName;
                moduleEnabled = false;
            }
        }
开发者ID:BioRoboticsUNAM,项目名称:Blackboard,代码行数:22,代码来源:Blackboard.cs

示例2: AddDisabledModules

        private static void AddDisabledModules(Blackboard blackboard, SortedList<string, ModuleClient> disabledModules, ILogWriter log)
        {
            log.WriteLine(2, "Adding disabled modules");
            for (int i = 0; i < disabledModules.Count; ++i)
            {
                try
                {

                    ModuleClient mod = disabledModules.Values[i];
                    blackboard.Modules.Add(mod);
                    log.WriteLine(3, "Added module " + mod.Name + (mod.Alias != mod.Name ? " alias " + mod.Alias : String.Empty));
                }
                catch { }
            }
        }
开发者ID:BioRoboticsUNAM,项目名称:Blackboard,代码行数:15,代码来源:Blackboard.cs

示例3: LoadStartupSequence

        /// <summary>
        /// Loads the startup sequence of the blackboard modules
        /// </summary>
        /// <param name="blackboard">The blackboard where will be loaded the startup sequence</param>
        /// <param name="doc">The xml document from which the actions will be loaded</param>
        /// <param name="log">The log writer</param>
        private static void LoadStartupSequence(Blackboard blackboard, XmlDocument doc, ILogWriter log)
        {
            XmlNodeList modules;
            string moduleName;

            if (doc.GetElementsByTagName("startupSequence").Count != 1)
            {
                log.WriteLine(1, "Startup sequence not found");
                return;
            }

            modules = doc.GetElementsByTagName("startupSequence")[0].ChildNodes;
            for(int i = 0; i < modules.Count; ++i)
            {
                try
                {
                    // Module check
                    if ((modules[i].Name != "module") ||
                        //(modules[i].Attributes.Count < 1) ||
                        //(modules[i].Attributes["name"].Value.Length < 1) ||
                        (modules[i].InnerText == null) ||
                        (modules[i].InnerText.Length < 1))
                        continue;

                    //moduleName = modules[i].Attributes["name"].Value.ToUpper();
                    moduleName = modules[i].InnerText.ToUpper();
                    if(blackboard.StartupSequence.ModuleSequence.Contains(moduleName))
                        continue;
                    blackboard.StartupSequence.ModuleSequence.Add(moduleName);
                }
                catch
                {
                    continue;
                }
            }
            log.WriteLine(1, "Startup sequence: " + String.Join(", ", blackboard.StartupSequence.ModuleSequence.ToArray()));
        }
开发者ID:BioRoboticsUNAM,项目名称:Blackboard,代码行数:43,代码来源:Blackboard.cs

示例4: SetupSharedVariables

        /// <summary>
        /// Creates and configures the shared variables specified in the provided XML document for the specified blackboard
        /// </summary>
        /// <param name="doc">XML document which contains shared variables initialization data</param>
        /// <param name="blackboard">Blackboard object in which the shared variables will be configured</param>
        private static void SetupSharedVariables(XmlDocument doc, Blackboard blackboard)
        {
            if ((doc == null) || (blackboard == null))
                throw new ArgumentNullException();
            if (blackboard.virtualModule == null)
                throw new Exception("Uninitialized blackboard");

            int i, j;
            ILogWriter log;
            XmlDocument tmpDoc;
            XmlNode node;
            XmlNodeList xmlVarList;
            XmlNodeList xmlWriterModuleList;
            SharedVariable shVar;
            List<string> writers;
            string shVarName;
            string shVarType;
            string shVarValue;
            bool shVarIsArray;
            int bracketPos;

            log = blackboard.log;
            tmpDoc = new XmlDocument();

            if (doc.GetElementsByTagName("sharedVariables").Count < 1)
            {
                log.WriteLine(1, "No shared variables was defined in XML file.");
                return;
            }
            tmpDoc.LoadXml(doc.GetElementsByTagName("sharedVariables")[0].OuterXml);

            #region Load of shared variables
            // Load of shared variables
            log.WriteLine(1, "Reading shared variables");
            xmlVarList = tmpDoc.GetElementsByTagName("var");
            for (i = 0; i < xmlVarList.Count; ++i)
            {
                #region Get variable Name
                node = xmlVarList[i];
                if ((node == null) || (node.Name != "var") || (node.Attributes["name"] == null))
                    continue;
                shVarName = node.Attributes["name"].InnerText;
                shVarType = (node.Attributes["type"] != null) ? node.Attributes["type"].InnerText : "var";
                if (String.IsNullOrEmpty(shVarType) || !SharedVariable.RxVarTypeValidator.IsMatch(shVarType))
                    shVarType = "var";
                bracketPos = shVarType.IndexOf("[");
                if (shVarIsArray = (bracketPos != -1))
                    shVarType = shVarType.Remove(bracketPos);
                if (blackboard.VirtualModule.SharedVariables.Contains(shVarName))
                {
                    log.WriteLine(2, "Error loading shared variable " + shVarName + ". Variable already exists.");
                    continue;
                }

                #endregion

                #region Get variable initial value
                shVarValue = "";
                if (node.Attributes["value"] != null)
                {
                    shVarValue = node.Attributes["value"].Value;
                }
                else if (node.Attributes["fromFile"] != null)
                {
                    shVarValue = node.Attributes["fromFile"].Value;
                    if (File.Exists(shVarValue))
                    {
                        try
                        {
                            shVarValue = File.ReadAllText(shVarValue);
                        }
                        catch
                        {
                            log.WriteLine(2, "Error loading variable content from file " + shVarValue + " for the shared variable " + shVarName + ". Variable was set to null");
                            shVarValue = "";
                        }
                    }
                }
                #endregion

                #region Get list of modules with write permission

                writers = new List<string>();
                tmpDoc = new XmlDocument();
                tmpDoc.LoadXml(node.OuterXml);
                xmlWriterModuleList = tmpDoc.GetElementsByTagName("writers");
                if (xmlWriterModuleList.Count == 1)
                {
                    writers.Add(blackboard.VirtualModule.Name);
                    tmpDoc = new XmlDocument();
                    tmpDoc.LoadXml(xmlWriterModuleList[0].OuterXml);
                    xmlWriterModuleList = tmpDoc.GetElementsByTagName("writer");
                    for (j = 0; j < xmlWriterModuleList.Count; ++j)
                    {
                        node = xmlWriterModuleList[j];
//.........这里部分代码省略.........
开发者ID:BioRoboticsUNAM,项目名称:Blackboard,代码行数:101,代码来源:Blackboard.cs

示例5: Run

		public MSBuildResult Run (
			ProjectConfigurationInfo[] configurations, ILogWriter logWriter, MSBuildVerbosity verbosity,
			string[] runTargets, string[] evaluateItems, string[] evaluateProperties, Dictionary<string,string> globalProperties)
		{
			if (runTargets == null || runTargets.Length == 0)
				throw new ArgumentException ("runTargets is empty");

			MSBuildResult result = null;
			BuildEngine.RunSTA (delegate {
				try {
					var project = SetupProject (configurations);
					currentLogWriter = logWriter;

					ILogger[] loggers;
					var logger = new LocalLogger (file);
					if (logWriter != null) {
						var consoleLogger = new ConsoleLogger (GetVerbosity (verbosity), LogWriteLine, null, null);
						loggers = new ILogger[] { logger, consoleLogger };
					} else {
						loggers = new ILogger[] { logger };
					}

					//building the project will create items and alter properties, so we use a new instance
					var pi = project.CreateProjectInstance ();

					if (globalProperties != null)
						foreach (var p in globalProperties)
							pi.SetProperty (p.Key, p.Value);

					pi.Build (runTargets, loggers);

					result = new MSBuildResult (logger.BuildResult.ToArray ());

					if (evaluateProperties != null) {
						foreach (var name in evaluateProperties) {
							var prop = pi.GetProperty (name);
							result.Properties [name] = prop != null? prop.EvaluatedValue : null;
						}
					}

					if (evaluateItems != null) {
						foreach (var name in evaluateItems) {
							var grp = pi.GetItems (name);
							var list = new List<MSBuildEvaluatedItem> ();
							foreach (var item in grp) {
								var evItem = new MSBuildEvaluatedItem (name, UnescapeString (item.EvaluatedInclude));
								foreach (var m in item.Metadata) {
									evItem.Metadata [m.Name] = UnescapeString (m.EvaluatedValue);
								}
								list.Add (evItem);
							}
							result.Items[name] = list;
						}
					}
				} catch (Microsoft.Build.Exceptions.InvalidProjectFileException ex) {
					var r = new MSBuildTargetResult (
						file, false, ex.ErrorSubcategory, ex.ErrorCode, ex.ProjectFile,
						ex.LineNumber, ex.ColumnNumber, ex.EndLineNumber, ex.EndColumnNumber,
						ex.BaseMessage, ex.HelpKeyword);
					if (logWriter != null)
						logWriter.WriteLine (r.ToString ());
					result = new MSBuildResult (new [] { r });
				} finally {
					currentLogWriter = null;
				}
			});
			return result;
		}
开发者ID:riverans,项目名称:monodevelop,代码行数:68,代码来源:ProjectBuilder.v4.0.cs

示例6: LoadModuleActions

 /// <summary>
 /// Load a group of actions for the provided module action list
 /// </summary>
 /// <param name="actionGroup">The name of the group of actions in the xml file</param>
 /// <param name="actionName">The name of the actions to load (trigger)</param>
 /// <param name="doc">The xml document from which the actions will be loaded</param>
 /// <param name="ac">The action list to load the actions within</param>
 /// <param name="log">The log writer</param>
 private static void LoadModuleActions(string actionGroup, string actionName, XmlDocument doc, ActionCollection ac, ILogWriter log)
 {
     if (doc.GetElementsByTagName(actionGroup).Count > 0)
         ac.AddRange(XtractActionList(doc.GetElementsByTagName(actionGroup)[0].ChildNodes));
     if (ac.Count > 0)
         log.WriteLine(2, "\t" + ac.Count.ToString() + " " + actionName + " actions added");
 }
开发者ID:BioRoboticsUNAM,项目名称:Blackboard,代码行数:15,代码来源:Blackboard.cs

示例7: LoadBlackboardPort

 /// <summary>
 /// Fetch the blackboard input port
 /// </summary>
 /// <param name="doc">XML document which contains the Blackboard data</param>
 /// <param name="blackboard">The blackboard which data will be set</param>
 /// <param name="log">The log writer</param>
 private static void LoadBlackboardPort(XmlDocument doc, Blackboard blackboard, ILogWriter log)
 {
     // Leo puerto
     if ((doc.GetElementsByTagName("port").Count != 1) ||
         !Int32.TryParse(doc.GetElementsByTagName("port")[0].InnerText, out blackboard.port))
     {
         blackboard.port = 2300;
         log.WriteLine(1, "No Blackboard port specified, using default: " + blackboard.Port);
     }
     else log.WriteLine(1, "Blackboard port: " + blackboard.Port);
 }
开发者ID:BioRoboticsUNAM,项目名称:Blackboard,代码行数:17,代码来源:Blackboard.cs

示例8: Run

		public MSBuildResult Run (
			ProjectConfigurationInfo[] configurations, ILogWriter logWriter, MSBuildVerbosity verbosity,
			string[] runTargets, string[] evaluateItems, string[] evaluateProperties, Dictionary<string,string> globalProperties)
		{
			MSBuildResult result = null;
			BuildEngine.RunSTA (delegate {
				try {
					var project = SetupProject (configurations);
					currentLogWriter = logWriter;

					buildEngine.Engine.UnregisterAllLoggers ();

					var logger = new LocalLogger (file);
					buildEngine.Engine.RegisterLogger (logger);
					if (logWriter != null) {
						buildEngine.Engine.RegisterLogger (consoleLogger);
						consoleLogger.Verbosity = GetVerbosity (verbosity);
					}

					if (runTargets != null && runTargets.Length > 0) {
						if (globalProperties != null) {
							foreach (var p in globalProperties)
								project.GlobalProperties.SetProperty (p.Key, p.Value);
						}
						// We are using this BuildProject overload and the BuildSettings.None argument as a workaround to
						// an xbuild bug which causes references to not be resolved after the project has been built once.
						buildEngine.Engine.BuildProject (project, runTargets, new Hashtable (), BuildSettings.None);

						if (globalProperties != null) {
							foreach (var p in globalProperties.Keys) {
								project.GlobalProperties.RemoveProperty (p);
								buildEngine.Engine.GlobalProperties.RemoveProperty (p);
							}
						}
					}

					result = new MSBuildResult (logger.BuildResult.ToArray ());

					if (evaluateProperties != null) {
						foreach (var name in evaluateProperties)
							result.Properties [name] = project.GetEvaluatedProperty (name);
					}

					if (evaluateItems != null) {
						foreach (var name in evaluateItems) {
							BuildItemGroup grp = project.GetEvaluatedItemsByName (name);
							var list = new List<MSBuildEvaluatedItem> ();
							foreach (BuildItem item in grp) {
								var evItem = new MSBuildEvaluatedItem (name, UnescapeString (item.FinalItemSpec));
								foreach (DictionaryEntry de in (IDictionary) evaluatedMetadataField.GetValue (item)) {
									evItem.Metadata [(string)de.Key] = UnescapeString ((string)de.Value);
								}
								list.Add (evItem);
							}
							result.Items[name] = list;
						}
					}
				} catch (InvalidProjectFileException ex) {
					var r = new MSBuildTargetResult (
						file, false, ex.ErrorSubcategory, ex.ErrorCode, ex.ProjectFile,
						ex.LineNumber, ex.ColumnNumber, ex.EndLineNumber, ex.EndColumnNumber,
						ex.BaseMessage, ex.HelpKeyword);
					if (logWriter != null)
						logWriter.WriteLine (r.ToString ());
					result = new MSBuildResult (new [] { r });
				} finally {
					currentLogWriter = null;
				}
			});
			return result;
		}
开发者ID:riverans,项目名称:monodevelop,代码行数:71,代码来源:ProjectBuilder.cs

示例9: LoadBlackboardModules

        /// <summary>
        /// Loads modules configuration from the provided XML document
        /// </summary>
        /// <param name="blackboard">The blackboard where will be loaded the modules</param>
        /// <param name="doc">The xml document from which the modules will be loaded</param>
        /// <param name="log">The log writer</param>
        /// <returns>The number of enabled modules loaded</returns>
        private static int LoadBlackboardModules(Blackboard blackboard, XmlDocument doc, ILogWriter log)
        {
            XmlNodeList modules;
            int i;
            //Command startupCommand;
            SortedList<string, ModuleClient> disabledModules;
            int clientModulesAdded;

            if (doc.GetElementsByTagName("modules").Count < 1)
            {
                log.WriteLine(0, "No modules to load");
                throw new Exception("No modules to load");
            }
            modules = doc.GetElementsByTagName("modules")[0].ChildNodes;

            clientModulesAdded = 0;
            disabledModules = new SortedList<string, ModuleClient>();
            for (i = 0; i < modules.Count; ++i)
            {
                if(LoadModule(blackboard, modules[i], log, disabledModules))
                    ++clientModulesAdded;
            }

            // Add disabled modules
            AddDisabledModules(blackboard, disabledModules, log);
            return clientModulesAdded;
        }
开发者ID:BioRoboticsUNAM,项目名称:Blackboard,代码行数:34,代码来源:Blackboard.cs

示例10: LoadBlackboardName

 /// <summary>
 /// Fetch the blackboard virtual module name
 /// </summary>
 /// <param name="doc">XML document which contains the Blackboard data</param>
 /// <param name="blackboard">The blackboard which data will be set</param>
 /// <param name="log">The log writer</param>
 private static void LoadBlackboardName(XmlDocument doc, Blackboard blackboard, ILogWriter log)
 {
     string moduleName;
     if ((doc.GetElementsByTagName("name").Count != 1) || ((moduleName = doc.GetElementsByTagName("name")[0].InnerText.Trim()).Length < 3))
     {
         log.WriteLine(1, "No Virtual module name specified.");
         log.WriteLine(1, "\tUsing virtual module name: BLACKBOARD");
         blackboard.VirtualModule = new ModuleBlackboard("BLACKBOARD");
     }
     else
     {
         moduleName = moduleName.ToUpper();
         blackboard.VirtualModule = new ModuleBlackboard(moduleName.ToUpper());
         log.WriteLine(1, "Blackboard virtual module name: " + moduleName);
         moduleName = null;
     }
 }
开发者ID:BioRoboticsUNAM,项目名称:Blackboard,代码行数:23,代码来源:Blackboard.cs

示例11: LoadBlackboardConfiguration

        /// <summary>
        /// Loads general blackboard configuration fro the provided XML document
        /// </summary>
        /// <param name="blackboard">The blackboard where will be loaded the settings</param>
        /// <param name="doc">The xml document from which the settings will be loaded</param>
        /// <param name="log">The log writer</param>
        private static void LoadBlackboardConfiguration(Blackboard blackboard, XmlDocument doc, ILogWriter log)
        {
            XmlDocument tmpDoc;
            ModuleClient mod;
            int sendAttempts;
            int globalCheckInterval;
            int moduleLoadDelay;

            log.WriteLine(0, "Loading configuration...");
            tmpDoc = new XmlDocument();
            tmpDoc.LoadXml(doc.GetElementsByTagName("configuration")[0].OuterXml);

            #region Blackboard Input port, Auto-Stop Time, Test Timeout and Name

            LoadBlackboardPort(tmpDoc, blackboard, log);

            LoadBlackboardAutoStopTime(tmpDoc, blackboard, log);

            LoadBlackboardTestTimeOut(doc, blackboard, log);

            LoadBlackboardName(doc, blackboard, log);

            #endregion

            #region Startup/Shutdown sequence

            LoadStartupSequence(blackboard, doc, log);
            LoadShutdownSequence(blackboard, doc, log);

            #endregion

            #region Other Configurations

            // Read global alive/busy/ready check interval
            if ((tmpDoc.GetElementsByTagName("globalCheckInterval").Count == 0) ||
                !Int32.TryParse(tmpDoc.GetElementsByTagName("globalCheckInterval")[0].InnerText, out globalCheckInterval) ||
                (globalCheckInterval < ModuleClient.MinCheckInterval) || (globalCheckInterval > ModuleClient.MaxCheckInterval))
            {
                log.WriteLine(1, "No alive/busy/ready check interval specified (or invalid), using default: " + ModuleClient.GlobalCheckInterval);
            }
            else
            {
                ModuleClient.GlobalCheckInterval = globalCheckInterval;
                log.WriteLine(1, "alive/busy/ready check interval: " + ModuleClient.GlobalCheckInterval);
            }

            // Module load delay
            if ((tmpDoc.GetElementsByTagName("moduleLoadDelay").Count == 0) ||
                !Int32.TryParse(tmpDoc.GetElementsByTagName("moduleLoadDelay")[0].InnerText, out moduleLoadDelay) ||
                (moduleLoadDelay < 0) || (moduleLoadDelay > 10000))
            {
                log.WriteLine(1, "Module load delay not specified (or invalid), using default: " + blackboard.ModuleLoadDelay.ToString());
            }
            else
            {
                blackboard.ModuleLoadDelay = moduleLoadDelay;
                log.WriteLine(1, "Module load delay: " + blackboard.ModuleLoadDelay.ToString());
            }

            // Leo intentos de reenvio
            if ((tmpDoc.GetElementsByTagName("sendAttempts").Count == 0) ||
                !Int32.TryParse(tmpDoc.GetElementsByTagName("sendAttempts")[0].InnerText, out sendAttempts) ||
                (sendAttempts < 0) && (sendAttempts > 5))
            {
                log.WriteLine(1, "No response send attempts specified (or invalid), using default: " + blackboard.SendAttempts);
            }
            else
            {
                blackboard.sendAttempts = sendAttempts;
                log.WriteLine(1, "Response send attempts: " + blackboard.SendAttempts);
            }

            #endregion

            #region Actions Extraction

            mod = blackboard.VirtualModule;

            // Startup actions extraction
            LoadModuleActions("onStart", "Startup", tmpDoc, mod.StartupActions, log);
            // Restart actions extraction
            LoadModuleActions("onRestart", "Restart", tmpDoc, mod.RestartActions, log);
            // Restart Test actions extraction
            LoadModuleActions("onRestartTest", "Restart-Test", tmpDoc, mod.RestartTestActions, log);
            // Stop actons extraction
            LoadModuleActions("onStop", "Stop", tmpDoc, mod.StopActions, log);
            // Test Timeout actons extraction
            LoadModuleActions("onTestTimeOut", "Test Timeout", tmpDoc, mod.TestTimeOutActions, log);

            #endregion
        }
开发者ID:BioRoboticsUNAM,项目名称:Blackboard,代码行数:97,代码来源:Blackboard.cs

示例12: FetchModuleConnectionSettings

        /// <summary>
        /// Reads connection settings from the module XML node
        /// </summary>
        private static bool FetchModuleConnectionSettings(XmlDocument doc, ILogWriter log, out List<IPAddress> ips, out int port)
        {
            port = -1;
            ips = FetchIpAddresses(doc);
            if ((ips == null) || (ips.Count < 1))
            {
                log.WriteLine(2, "\tNo valid IP Address provided");
                log.WriteLine(1, "Module skipped");
                return false;
            }

            // Leo el puerto de conexion del modulo
            if (
                (doc.GetElementsByTagName("port").Count == 0) ||
                !Int32.TryParse(doc.GetElementsByTagName("port")[0].InnerText, out port) ||
                (port <= 1024))
            {
                log.WriteLine(2, "\tInvalid port");
                log.WriteLine(1, "Module skipped");
                return false;
            }
            log.WriteLine("\t" + ips[0].ToString() + ":" + port);
            return true;
        }
开发者ID:BioRoboticsUNAM,项目名称:Blackboard,代码行数:27,代码来源:Blackboard.cs

示例13: ExtractPrototypes

        private static void ExtractPrototypes(ModuleClient mod, XmlDocument tmpDoc, ILogWriter log)
        {
            XmlNodeList commands;
            Prototype proto;
            List<Prototype> protoList;
            string cmdName;
            bool cmdParams;
            bool cmdAnswer;
            int cmdPriority = 1;
            bool cmdPriorityB;
            int cmdTimeOut;

            #region Module Commands Extraction

            // Leo lista de comandos.
            log.WriteLine(2, "\tLoading module commands...");
            if (tmpDoc.GetElementsByTagName("commands").Count < 1)
            {
                log.WriteLine(3, "\tNo commands to load");
                log.WriteLine(2, "\tModule skipped");
                return;
            }
            commands = tmpDoc.GetElementsByTagName("commands")[0].ChildNodes;
            protoList = new List<Prototype>(commands.Count);

            #region Extraccion de Comandos de modulo

            for (int j = 0; j < commands.Count; ++j)
            {
                // Verifico que sea un comando
                cmdTimeOut = 0;
                if ((commands[j].Name == "command") &&
                (commands[j].Attributes.Count >= 3) &&
                (commands[j].Attributes["name"].Value.Length > 1) &&
                Boolean.TryParse(commands[j].Attributes["answer"].Value, out cmdAnswer) &&
                (
                    (cmdAnswer && Int32.TryParse(commands[j].Attributes["timeout"].Value, out cmdTimeOut) && (cmdTimeOut >= 0)) || !cmdAnswer
                ))
                {
                    // Leo nombre de comando
                    cmdName = commands[j].Attributes["name"].Value;
                    log.WriteLine(2, "\t\tAdded command " + cmdName);
                    // Verifico si requiere parametros
                    if ((commands[j].Attributes["parameters"] == null) || !Boolean.TryParse(commands[j].Attributes["parameters"].Value, out cmdParams))
                        cmdParams = true;
                    // Verifico si tiene prioridad
                    if (commands[j].Attributes["priority"] != null)
                    {
                        if(Boolean.TryParse(commands[j].Attributes["priority"].Value, out cmdPriorityB))
                            cmdPriority = cmdPriorityB ? 0 : 1;
                        else if (!Int32.TryParse(commands[j].Attributes["priority"].Value, out cmdPriority))
                            cmdPriority = 1;
                    }
                    // Creo el prototipo
                    proto = new Prototype(cmdName, cmdParams, cmdAnswer, cmdTimeOut, cmdPriority);
                    // Agrego el prototipo al modulo
                    mod.Prototypes.Add(proto);
                    protoList.Add(proto);
                }
                else log.WriteLine(4, "\t\tInvalid Command ");
            }
            #endregion
            // Si no hay comandos soportados por el modulo, salto el modulo
            if (protoList.Count < 1)
            {
                log.WriteLine(3, "\tAll commands rejected.");
                //log.WriteLine(2, "Module skipped");
                return;
            }

            #endregion
        }
开发者ID:BioRoboticsUNAM,项目名称:Blackboard,代码行数:72,代码来源:Blackboard.cs

示例14: AddModuleToBlackboard

 /// <summary>
 /// Adds a module to the blackboard
 /// </summary>
 private static void AddModuleToBlackboard(Blackboard blackboard, ILogWriter log, ModuleClient mod, SortedList<string, ModuleClient> disabledModules)
 {
     if (mod.Enabled)
     {
         blackboard.modules.Add(mod);
         log.WriteLine(2, "Loading module complete!");
     }
     else
     {
         disabledModules.Add(mod.Name, mod);
         log.WriteLine(2, "Disabled module enqueued!");
     }
 }
开发者ID:BioRoboticsUNAM,项目名称:Blackboard,代码行数:16,代码来源:Blackboard.cs

示例15: LoadBlackboardTestTimeOut

        /// <summary>
        /// Fetch the blackboard test time out
        /// </summary>
        /// <param name="doc">XML document which contains the Blackboard data</param>
        /// <param name="blackboard">The blackboard which data will be set</param>
        /// <param name="log">The log writer</param>
        private static void LoadBlackboardTestTimeOut(XmlDocument doc, Blackboard blackboard, ILogWriter log)
        {
            string sTime;
            int iTime;
            TimeSpan time;

            if (doc.GetElementsByTagName("testTimeOut").Count == 1)
            {
                sTime = doc.GetElementsByTagName("testTimeOut")[0].InnerText.Trim();
                if (Int32.TryParse(sTime, out iTime) && (iTime > 0))
                {
                    blackboard.TestTimeOut = new TimeSpan(0, 0, iTime);
                    log.WriteLine(1, "Blackboard  Test Timeout: " + blackboard.TestTimeOut);
                }
                else if (TimeSpan.TryParse(sTime, out time) && (time > TimeSpan.Zero))
                {
                    blackboard.TestTimeOut = time;
                    log.WriteLine(1, "Blackboard Test Timeout: " + time);
                }
                else log.WriteLine(1, "Blackboard  Test Timeout disabled");
            }
            else log.WriteLine(1, "Blackboard  Test Timeout disabled");
        }
开发者ID:BioRoboticsUNAM,项目名称:Blackboard,代码行数:29,代码来源:Blackboard.cs


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