コード例 #1
0
 public MyServiceBase(string name, MainAction ma, LogAction la)
 {
     // InitializeComponent
     this.ServiceName = name;
     this.CbMain = ma;
     this.CbLog = la;
 }
コード例 #2
0
ファイル: Parser.cs プロジェクト: netintellect/NetOffice
 internal static void ParseWord(XDocument document, LogAction func)
 {
     XElement WordNode = new XElement("Word");
     (document.FirstNode as XElement).Add(WordNode);
     ParseWordTypes(WordNode, func);
     ParseWordEnums(WordNode, func);
     ParseWordTypesMembers(WordNode, func);
 }
コード例 #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="LoggerBase" /> class.
        /// </summary>
        /// <param name="action">The action to use.</param>
        /// <param name="syncRoot">The custom object for thread safe operations.</param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="action" /> is <see langword="null" />.
        /// </exception>
        public DelegateLogger(LogAction action, object syncRoot = null)
            : base(syncRoot: syncRoot)
        {
            if (action == null)
            {
                throw new ArgumentNullException("action");
            }

            _ACTION = action;
        }
コード例 #4
0
ファイル: LogEntry.cs プロジェクト: kjlahm/Dugout-Digits
        /// <summary>
        /// Log object constructor.
        /// </summary>
        /// <param name="type">The type of the event being logged.</param>
        /// <param name="function">The function executing when the event occured.</param>
        /// <param name="action">The action being performed when the event occured.</param>
        /// <param name="Message">A specific message associated with the event being logged.</param>
        /// <param name="user">The user of the system when the event occured.</param>
        /// <param name="timestamp">The date and time when the event was logged (set in DB).</param>
        public LogEntry(LogType type, LogFunction function, LogAction action, DateTime timestamp, long id, string message, Person user)
        {
            Type = type;
            Function = function;
            Action = action;

            ID = id;
            Timestamp = timestamp;
            Message = message;
            User = user;
        }
コード例 #5
0
        /// <summary>
        /// Read all files in a directory and replace arg search with arg replace in file content(s)
        /// </summary>
        /// <param name="directoryName">target root directory</param>
        /// <param name="fileFilter">exclude filter as file extension</param>
        /// <param name="search">search expression</param>
        /// <param name="replace">replace value</param>
        /// <param name="func">log handler</param>
        public static void SearchAndReplace(string directoryName, string fileFilter, string search, string replace, LogAction func)
        {
            if (!Directory.Exists(directoryName))
                throw new DirectoryNotFoundException(directoryName);
            if (null == func || String.IsNullOrWhiteSpace(replace) || String.IsNullOrWhiteSpace(search) || String.IsNullOrWhiteSpace(fileFilter) || String.IsNullOrWhiteSpace(directoryName))
                throw new ArgumentNullException();

            string[] filterArray = BuildFilterArray(fileFilter);
            string[] searchArray = BuildSearchArray(search);
            string[] replaceArray = BuildReplaceArray(replace);
            if (searchArray.Length != replaceArray.Length)
                throw new FormatException("Search and Repleace terms count must equal");
            SearchAndReplace(directoryName, filterArray, searchArray, replaceArray, func);
        }
コード例 #6
0
ファイル: Parser.cs プロジェクト: netintellect/NetOffice
        internal static XDocument ParseReference(LogAction func)
        {
            func("Parse References ");
            XDocument document = new XDocument();
            document.Add(new XElement("NOBuildTools.ReferenceAnalyzer"));
            ParseExcel(document, func);
            ParseAccess(document, func);
            ParseOffice(document, func);
            ParseOutlook(document, func);
            ParsePowerPoint(document, func);
            ParseProject(document, func);
            ParseVisio(document, func);
            ParseWord(document, func);
            func("Done!");

            return document;
        }
コード例 #7
0
ファイル: Parser.cs プロジェクト: netintellect/NetOffice
        private static void ParseWordTypes(XElement excelNode, LogAction func)
        {
            func("Parse Word Types");

            XElement rootNode = new XElement("Types");
            excelNode.Add(rootNode);

            int counter = 0;
            string excelRootReferencePage = _rootAdress + _wordTypesRelative;
            using (var client = new System.Net.WebClient())
            {
                string pageContent = DownloadPage(client, excelRootReferencePage);
                HtmlDocument doc = new HtmlDocument();
                doc.LoadHtml(pageContent);
                var root = doc.DocumentNode;

                var divNodes = root.Descendants("div").ToList();
                foreach (var item in divNodes)
                {
                    string className = item.GetAttributeValue("class", null);
                    if (className == "toclevel2")
                    {
                        string href = item.FirstChild.NextSibling.GetAttributeValue("href", null);
                        string name = item.FirstChild.NextSibling.GetAttributeValue("title", null);
                        if (null != href && null != name)
                        {
                            if (name.EndsWith(" Object", StringComparison.InvariantCultureIgnoreCase))
                            {
                                name = name.Substring(0, name.Length - " Object".Length);
                                rootNode.Add(new XElement("Type", new XElement("Name", name), new XElement("Link", _rootAdress + href)));
                                counter++;
                            }
                        }
                    }

                }
            }

            func(String.Format("{0} Word Types recieved", counter));
        }
コード例 #8
0
        private static bool DoSearchAndReplace(ref string fileContent, string[] searchArray, string[] replaceArray, LogAction func)
        {
            bool oneOrMoreReplaced = false;
            for (int i = 0; i < searchArray.Length; i++)
            {
                string search = searchArray[i];
                string replace = replaceArray[i];
                int cnt = 0;
                while (fileContent.IndexOf(search) > -1)
                {
                    fileContent = fileContent.Replace(search, replace);
                    cnt++;
                }
                if (cnt > 0)
                {
                    oneOrMoreReplaced = true;
                    func(String.Format("{0} entries of {1} replaced", cnt, search));
                }

            }

            return oneOrMoreReplaced;
        }
コード例 #9
0
 /// <summary>
 /// Log a WARNING message
 /// </summary>
 /// <param name="text">Message</param>
 /// <param name="action">Perform the given action after logging the Message</param>
 public static void Warning(string text, LogAction action)
 {
     WriteFormattedLog(LogLevel.WARNING, text);
     PerformAction(action);
 }
コード例 #10
0
 /// <summary>
 /// Log an INFO message
 /// </summary>
 /// <param name="text">Message</param>
 /// <param name="action">Perform the given action after logging the Message</param>
 public static void Info(string text, LogAction action)
 {
     WriteFormattedLog(LogLevel.INFO, text);
     PerformAction(action);
 }
コード例 #11
0
ファイル: JobService.cs プロジェクト: sddhttxd/SDDH_Job
 protected override async void OnStop()
 {
     LogHelper.WriteLog("Service Stop!");
     await LogAction.WriteLogAsync(logBatch, "JobService", "OnStart", "Service Stop");
 }
コード例 #12
0
 public static void Warning(this ILog log, Verbosity verbosity, LogAction logAction) => log.Write(verbosity, LogLevel.Warn, logAction);
コード例 #13
0
 public static void Error(this ILog log, LogAction logAction) => log.Write(LogLevel.Error, logAction);
コード例 #14
0
ファイル: LogEntry.cs プロジェクト: kjlahm/Dugout-Digits
 public LogEntry(LogType type, LogFunction function, LogAction action) : this(type, function, action, DateTime.Now, 0, "NA", new Person())
 {
 }
コード例 #15
0
        private async ValueTask <(bool succeed, Error error)> Log(LogLevel level, Agent agent, Target target, string role, ModelType targetType, LogAction action)
        {
            try {
                var urole =
                    string.IsNullOrEmpty(role) || role == UserRoleConstants.User ? LogRole.User :
                    role == UserRoleConstants.Admin ? LogRole.Admin :
                    role == UserRoleConstants.CORE ? LogRole.Core :
                    LogRole.Error;
                if (urole == LogRole.Error)
                {
                    return(false, Model.Utils.Error.Create(Errors.CreateLogFailed, Errors.LogRoleError));
                }
                var log = new LogEntry {
                    Creator = new BaseCreator {
                        UUID = agent.UID, UserName = agent.UserName, AvatarUrl = agent.Avatar
                    },
                    TargetID    = target.ID,
                    TargetKey   = target.Key,
                    TargetType  = targetType,
                    Role        = urole,
                    Action      = action,
                    Description = target.Description,
                    Level       = level
                };
                await this.collection.InsertOneAsync(log);

                return(true, Model.Utils.Error.Empty);
            } catch (Exception e) {
                return(false, Model.Utils.Error.Create(Errors.CreateLogFailed, e.Message));
            }
        }
コード例 #16
0
ファイル: LogExtensions.cs プロジェクト: stevensona/cake
 /// <summary>
 /// Writes a warning message to the log using the specified log message action.
 /// Evaluates log message only if the verbosity is equal to or more verbose than the log's verbosity.
 /// </summary>
 /// <param name="log">The log.</param>
 /// <param name="logAction">The log action.</param>
 public static void Warning(this ICakeLog log, LogAction logAction)
 {
     Warning(log, Verbosity.Minimal, logAction);
 }
コード例 #17
0
ファイル: LogExtensions.cs プロジェクト: stevensona/cake
 /// <summary>
 /// Writes a warning message to the log using the specified verbosity and log message action.
 /// Evaluates log message only if the verbosity is equal to or more verbose than the log's verbosity.
 /// </summary>
 /// <param name="log">The log.</param>
 /// <param name="verbosity">The verbosity.</param>
 /// <param name="logAction">The log action.</param>
 public static void Warning(this ICakeLog log, Verbosity verbosity, LogAction logAction)
 {
     Write(log, verbosity, LogLevel.Warning, logAction);
 }
コード例 #18
0
ファイル: LogExtensions.cs プロジェクト: stevensona/cake
 /// <summary>
 /// Writes an error message to the log using the specified log message action.
 /// Evaluates log message only if the verbosity is equal to or more verbose than the log's verbosity.
 /// </summary>
 /// <param name="log">The log.</param>
 /// <param name="logAction">The log action.</param>
 public static void Error(this ICakeLog log, LogAction logAction)
 {
     Error(log, Verbosity.Quiet, logAction);
 }
コード例 #19
0
ファイル: LogExtensions.cs プロジェクト: stevensona/cake
 /// <summary>
 /// Writes an error message to the log using the specified verbosity and log message action.
 /// Evaluates log message only if the verbosity is equal to or more verbose than the log's verbosity.
 /// </summary>
 /// <param name="log">The log.</param>
 /// <param name="verbosity">The verbosity.</param>
 /// <param name="logAction">The log action.</param>
 public static void Error(this ICakeLog log, Verbosity verbosity, LogAction logAction)
 {
     Write(log, verbosity, LogLevel.Error, logAction);
 }
コード例 #20
0
ファイル: LogExtensions.cs プロジェクト: stevensona/cake
        /// <summary>
        /// Writes a message to the log using the specified verbosity, log level and log action delegate.
        /// Evaluates log message only if the verbosity is equal to or more verbose than the log's verbosity.
        /// </summary>
        /// <param name="log">The log.</param>
        /// <param name="verbosity">The verbosity.</param>
        /// <param name="level">The log level.</param>
        /// <param name="logAction">The log action.</param>
        public static void Write(this ICakeLog log, Verbosity verbosity, LogLevel level, LogAction logAction)
        {
            if (log == null || logAction == null)
            {
                return;
            }

            if (verbosity > log.Verbosity)
            {
                return;
            }

            LogActionEntry actionEntry = (format, args) => log.Write(verbosity, level, format, args);

            logAction(actionEntry);
        }
コード例 #21
0
 /// <summary>
 /// Log an ERROR message
 /// </summary>
 /// <param name="text">Message</param>
 /// <param name="action">Perform the given action after logging the Message</param>
 public static void Error(string text, LogAction action)
 {
     WriteFormattedLog(LogLevel.ERROR, text);
     PerformAction(action);
 }
コード例 #22
0
 /// <summary>
 /// Update database
 /// </summary>
 /// <param name="device"></param>
 /// <param name="logAction"></param>
 /// <param name="logDetails"></param>
 private static void updateDatabase(DeviceView device, Power power, LogAction logAction, string logDetails)
 {
     device.Power = power;
       device.Save();
       new Log(LogType.Information, logAction, device.ToString() + " " + logDetails);
 }
コード例 #23
0
 public static void SetLogExpression(LogAction logAction, string expression) =>
 logAction.Expression = expression;
コード例 #24
0
 public DataAdjusterWithLogging(IBuildRepository repository, LogAction log) : base(repository)
 {
     OnFoundInvalidData    = data => log("-- Found invalid json-data in file: {0}", data.Source);
     OnFixedInvalidData    = () => log("-- Successfully converted invalid json data to valid");
     OnCouldNotConvertData = e => log("-- Could not convert json-data : {0}", e.Message);
 }
コード例 #25
0
 public static void Debug(this ILog log, Verbosity verbosity, LogAction logAction) => log.Write(verbosity, LogLevel.Debug, logAction);
コード例 #26
0
ファイル: Parser.cs プロジェクト: netintellect/NetOffice
 internal static void ParseOutlook(XDocument document, LogAction func)
 {
     XElement outlookNode = new XElement("Outlook");
     (document.FirstNode as XElement).Add(outlookNode);
     ParseOutlookTypes(outlookNode, func);
     ParseOutlookEnums(outlookNode, func);
     ParseOutlookTypesMembers(outlookNode, func);
 }
コード例 #27
0
 public static void Info(this ILog log, Verbosity verbosity, LogAction logAction) => log.Write(verbosity, LogLevel.Info, logAction);
コード例 #28
0
ファイル: Parser.cs プロジェクト: netintellect/NetOffice
 internal static void ParseOffice(XDocument document, LogAction func)
 {
     XElement officeNode = new XElement("Office");
     (document.FirstNode as XElement).Add(officeNode);
     ParseOfficeTypes(officeNode, func);
     ParseOfficeEnums(officeNode, func);
     ParseOfficeTypesMembers(officeNode, func);
 }
コード例 #29
0
ファイル: LogExtensions.cs プロジェクト: stevensona/cake
 /// <summary>
 /// Writes a debug message to the log using the specified verbosity and log message action.
 /// Evaluates log message only if the verbosity is equal to or more verbose than the log's verbosity.
 /// </summary>
 /// <param name="log">The log.</param>
 /// <param name="verbosity">The verbosity.</param>
 /// <param name="logAction">The log action.</param>
 public static void Debug(this ICakeLog log, Verbosity verbosity, LogAction logAction)
 {
     Write(log, verbosity, LogLevel.Debug, logAction);
 }
コード例 #30
0
ファイル: Parser.cs プロジェクト: netintellect/NetOffice
 internal static void ParseExcel(XDocument document, LogAction func)
 {
     XElement excelNode = new XElement("Excel");
     (document.FirstNode as XElement).Add(excelNode);
     ParseExcelTypes(excelNode, func);
     ParseExcelEnums(excelNode, func);
     ParseExcelTypesMembers(excelNode, func);
 }
コード例 #31
0
 public void WriteEntry(DateTime time, Guid systemId, LogAction type, Guid portId, Guid signalId, Guid busId, string entityId, int index)
 {
     _writer.WriteLine("{0:s} -> {1:N} : {2,-20} -> P:{3:N} S:{4:N} B:{5:N} {7} {6}", time, systemId, type, portId, signalId, busId, entityId, index);
     _writer.Flush();
 }
コード例 #32
0
ファイル: Parser.cs プロジェクト: netintellect/NetOffice
 internal static void ParseAccess(XDocument document, LogAction func)
 {
     XElement accessNode = new XElement("Access");
     (document.FirstNode as XElement).Add(accessNode);
     ParseAccessTypes(accessNode, func);
     ParseAccessEnums(accessNode, func);
     ParseAccessConstants(accessNode, func);
     ParseAccessTypesMembers(accessNode, func);
 }
コード例 #33
0
 /// <summary>
 /// Log a FATAL ERROR message
 /// </summary>
 /// <param name="text">Message</param>
 /// <param name="action">Perform the given action after logging the Message</param>
 public static void Fatal(string text, LogAction action)
 {
     WriteFormattedLog(LogLevel.FATAL, text);
     PerformAction(action);
 }
コード例 #34
0
ファイル: Parser.cs プロジェクト: netintellect/NetOffice
 private static void ParseAccessConstants(XElement excelNode, LogAction func)
 {
     func("Parse Access Constants");
     XElement constantNode = new XElement("OldConstants", _rootAdress + _accessConstantsRelative);
     excelNode.Add(constantNode);
     func(String.Format("{0} Access Contants recieved", 1));
 }
コード例 #35
0
 /// <summary>
 /// Log a TRACE message
 /// </summary>
 /// <param name="text">Message</param>
 /// <param name="action">Perform the given action after logging the Message</param>
 public static void Trace(string text, LogAction action)
 {
     WriteFormattedLog(LogLevel.TRACE, text);
     PerformAction(action);
 }
コード例 #36
0
ファイル: Parser.cs プロジェクト: netintellect/NetOffice
 internal static void ParseVisio(XDocument document, LogAction func)
 {
     XElement VisioNode = new XElement("Visio");
     (document.FirstNode as XElement).Add(VisioNode);
     ParseVisioTypes(VisioNode, func);
     ParseVisioEnums(VisioNode, func);
     ParseVisioTypesMembers(VisioNode, func);
 }
コード例 #37
0
 /// <summary>
 /// Log a DEBUG message
 /// </summary>
 /// <param name="text">Message log with level DEBUG</param>
 /// <param name="action">Perform the given action after logging the Message</param>
 public static void Debug(string text, LogAction action)
 {
     WriteFormattedLog(LogLevel.DEBUG, text);
     PerformAction(action);
 }
コード例 #38
0
ファイル: LogExtensions.cs プロジェクト: stevensona/cake
 /// <summary>
 /// Writes a verbose message to the log using the specified verbosity and log message action.
 /// Evaluates log message only if the verbosity is equal to or more verbose than the log's verbosity.
 /// </summary>
 /// <param name="log">The log.</param>
 /// <param name="verbosity">The verbosity.</param>
 /// <param name="logAction">The log action.</param>
 public static void Verbose(this ICakeLog log, Verbosity verbosity, LogAction logAction)
 {
     Write(log, verbosity, LogLevel.Verbose, logAction);
 }
コード例 #39
0
 public ConvertService(LogAction log)
 {
     Models   = new List <ModelFile>();
     this.log = log;
 }
コード例 #40
0
ファイル: Parser.cs プロジェクト: netintellect/NetOffice
 internal static void ParseProject(XDocument document, LogAction func)
 {
     XElement projectNode = new XElement("MSProject");
     (document.FirstNode as XElement).Add(projectNode);
     ParseProjectTypes(projectNode, func);
     ParseProjectEnums(projectNode, func);
     ParseProjectTypesMembers(projectNode, func);
 }
コード例 #41
0
 public static void SetLogLabel(LogAction logAction, string label) =>
 logAction.Label = label;
コード例 #42
0
ファイル: Node.cs プロジェクト: davidiw/brunet
    protected void MonitorLogSwitch()
    {
      if(_running == 0) {
        MonitorLogOff();
        return;
      }

      if(ProtocolLog.Monitor.Enabled) {
        IAction log_act = new LogAction(_packet_queue);
        Action<DateTime> log_todo = delegate(DateTime dt) {
          EnqueueAction(log_act);
        };
        int millisec_timeout = 5000; //log every 5 seconds.
        Util.FuzzyEvent fe = Brunet.Util.FuzzyTimer.Instance.DoEvery(log_todo,
            millisec_timeout, millisec_timeout/2);
        if(Interlocked.CompareExchange(ref _monitor_fe, fe, null) != null) {
          fe.TryCancel();
        }
      }

      if(_running == 0 || !ProtocolLog.Monitor.Enabled) {
        MonitorLogOff();
      }
    }
コード例 #43
0
 public async ValueTask <(bool succeed, Error error)> Warn(Agent agent, Target target, ModelType targetType, LogAction action, string role = null)
 {
     return(await this.Log(LogLevel.Warn, agent, target, role, targetType, action));
 }
コード例 #44
0
ファイル: Node.cs プロジェクト: hseom/brunet
    /**
     * There can only safely be one of these threads running
     */
    protected void AnnounceThread() {
      Brunet.Util.FuzzyEvent fe = null;
      try {
        int millisec_timeout = 5000; //log every 5 seconds.
        IAction queue_item = null;
        bool timedout = false;
        if( ProtocolLog.Monitor.Enabled ) {
          IAction log_act = new LogAction(_packet_queue);
          Action<DateTime> log_todo = delegate(DateTime dt) {
            EnqueueAction(log_act);
          };
          fe = Brunet.Util.FuzzyTimer.Instance.DoEvery(log_todo, millisec_timeout, millisec_timeout/2);
        }
        while( 1 == _running ) {
          queue_item = _packet_queue.Dequeue(millisec_timeout, out timedout);
          if (!timedout) {
            _current_action = queue_item;
            queue_item.Start();
          }
        }
      }
      catch(System.InvalidOperationException x) {
        //This is thrown when Dequeue is called on an empty queue
        //which happens when the BlockingQueue is closed, which
        //happens on Disconnect
        if(1 == _running) {
          ProtocolLog.WriteIf(ProtocolLog.Exceptions, String.Format(
            "Running in AnnounceThread got Exception: {0}", x));
        }
      }
      catch(Exception x) {
        ProtocolLog.WriteIf(ProtocolLog.Exceptions, String.Format(
        "ERROR: Exception in AnnounceThread: {0}", x));
      }
      finally {
        //Make sure we stop logging:
        if( fe != null ) { fe.TryCancel(); }
      }
      ProtocolLog.Write(ProtocolLog.Monitor,
                        String.Format("Node: {0} leaving AnnounceThread",
                                      this.Address));

    }
コード例 #45
0
 public static void Warning(this ILog log, LogAction logAction) => log.Write(LogLevel.Warn, logAction);
コード例 #46
0
ファイル: Log.cs プロジェクト: kcitwm/dova
 public static void Write(LogAction action, string dir, string msg)
 {
     if ((LogConfig.LogType & (int)action) != 0)
     {
         string key = logPrex + dir + "\\" + action.ToString();
         PushLog(key, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + "\t" + msg);
     }
 }
コード例 #47
0
 public static void Info(this ILog log, LogAction logAction) => log.Write(LogLevel.Info, logAction);
コード例 #48
0
ファイル: Errors.cs プロジェクト: kaviarasankk/Phalanger
		public static bool Log(string message, LogAction action, string destination)
		{
			return Log(message, action, destination, null);
		}
コード例 #49
0
 public static void Verbose(this ILog log, Verbosity verbosity, LogAction logAction) => log.Write(verbosity, LogLevel.Verbose, logAction);
コード例 #50
0
ファイル: Logger.cs プロジェクト: Xamtastic/TextFileRamDisk
 public void Log(Type classname, LoggingLevel level, LogAction action, string message)
 {
     _worker(classname, level, action, message);
 }
コード例 #51
0
 public DataAdjusterWithLogging(IBuildRepository repository, LogAction log) : base(repository)
 {
     OnFoundInvalidData = data => log("-- Found invalid json-data in file: {0}", data.Source);
     OnFixedInvalidData = () => log("-- Successfully converted invalid json data to valid");
     OnCouldNotConvertData = e => log("-- Could not convert json-data : {0}", e.Message);
 }
コード例 #52
0
ファイル: LogExtensions.cs プロジェクト: stevensona/cake
 /// <summary>
 /// Writes a debug message to the log using the specified log message action.
 /// Evaluates log message only if the verbosity is equal to or more verbose than the log's verbosity.
 /// </summary>
 /// <param name="log">The log.</param>
 /// <param name="logAction">The log action.</param>
 public static void Debug(this ICakeLog log, LogAction logAction)
 {
     Debug(log, Verbosity.Diagnostic, logAction);
 }
コード例 #53
0
ファイル: Benchmark.cs プロジェクト: kevmal/Spreads
 public Benchmark(LogAction logAction)
 {
     _logAction = logAction;
 }
コード例 #54
0
ファイル: Parser.cs プロジェクト: netintellect/NetOffice
 internal static void ParsePowerPoint(XDocument document, LogAction func)
 {
     XElement pPointNode = new XElement("PowerPoint");
     (document.FirstNode as XElement).Add(pPointNode);
     ParsePowerPointTypes(pPointNode, func);
     ParsePowerPointEnums(pPointNode, func);
     ParsePowerPointTypesMembers(pPointNode, func);
 }
コード例 #55
0
 public void WriteEntry(DateTime time, Guid systemId, LogAction type, Guid portId, Guid signalId, Guid busId, string entityId, int index)
 {
     _writer.WriteLine("{0:s} -> {1:N} : {2,-20} -> P:{3:N} S:{4:N} B:{5:N} {7} {6}", time, systemId, type, portId, signalId, busId, entityId, index);
     _writer.Flush();
 }
コード例 #56
0
ファイル: Parser.cs プロジェクト: netintellect/NetOffice
 private static void ParsePowerPointTypesMembers(XElement typeNode, LogAction func)
 {
     func("Parse PowerPoint Type Members");
     foreach (XElement item in typeNode.Element("Types").Elements("Type"))
     {
         ParseOfficeTypeMembers(item, func);
     }
 }
コード例 #57
0
ファイル: Errors.cs プロジェクト: kaviarasankk/Phalanger
		public static bool Log(string message, LogAction action, string destination, string extraHeaders)
		{
			switch (action)
			{
				case LogAction.Default:

					bool result = true;

					LocalConfiguration config = Configuration.Local;

					// adds a message to the default log file:
					if (config.ErrorControl.LogFile != null)
						try { Logger.AppendLine(config.ErrorControl.LogFile, message); }
						catch (System.Exception) { result = false; }

					// adds a message to an event log:
					if (config.ErrorControl.SysLog)
						try { Logger.AddToEventLog(message); }
						catch (System.Exception) { result = false; }

					return result;

				case LogAction.SendByEmail:
					Mailer.Mail(destination, LibResources.GetString("error_report"), message, extraHeaders);
					return true;

				case LogAction.ToDebuggingConnection:
					PhpException.ArgumentValueNotSupported("action", (int)action);
					return false;

				case LogAction.AppendToFile:
					try
					{
						PHP.Core.Logger.AppendLine(destination, message);
					}
					catch (System.Exception)
					{
						return false;
					}
					return true;

				default:
					PhpException.InvalidArgument("action");
					return false;
			}
		}
コード例 #58
0
ファイル: Parser.cs プロジェクト: netintellect/NetOffice
        private static void ParsePowerPointTypeMembers(XElement typeNode, LogAction func)
        {
            XElement propsNode = new XElement("Properties");
            XElement methodsNode = new XElement("Methods");
            XElement eventsNode = new XElement("Events");
            typeNode.Add(propsNode);
            typeNode.Add(methodsNode);
            typeNode.Add(eventsNode);

            using (var client = new System.Net.WebClient())
            {
                string pageLink = typeNode.Element("Link").Value;
                string pageContent = DownloadPage(client, pageLink);
                HtmlDocument doc = new HtmlDocument();
                doc.LoadHtml(pageContent);
                var root = doc.DocumentNode;

                var divNodes = root.Descendants("div").ToList();
                foreach (var item in divNodes)
                {
                    string className = item.GetAttributeValue("class", null);
                    if (className == "toclevel2")
                    {
                        string href = item.FirstChild.NextSibling.GetAttributeValue("href", null);
                        string name = item.FirstChild.NextSibling.GetAttributeValue("title", null);
                        if (null != href && null != name)
                        {
                            name = name.ToLower().Trim();
                            switch (name)
                            {
                                case "properties":
                                    propsNode.Add(new XAttribute("Link", XmlConvert.EncodeName(_rootAdress + href)));
                                    ParsePowerPointTypeProperties(propsNode, func);
                                    break;
                                case "methods":
                                    methodsNode.Add(new XAttribute("Link", XmlConvert.EncodeName(_rootAdress + href)));
                                    ParsePowerPointTypeMethods(methodsNode, func);
                                    break;
                                case "events":
                                    eventsNode.Add(new XAttribute("Link", XmlConvert.EncodeName(_rootAdress + href)));
                                    ParsePowerPointTypeEvents(eventsNode, func);
                                    break;
                                default:
                                    break;
                            }
                        }
                    }
                }
            }
        }
コード例 #59
0
 private void Log(LoggingLevel loggingLevel, LogAction logAction, string message)
 {
     if (_logger != null)
     {
         _logger.Log(GetType(), loggingLevel, logAction, message);
     }
 }
コード例 #60
0
ファイル: Parser.cs プロジェクト: netintellect/NetOffice
 private static void ParsePowerPointTypeEvents(XElement propertiesNode, LogAction func)
 {
     using (var client = new System.Net.WebClient())
     {
         string pageLink = XmlConvert.DecodeName(propertiesNode.Attribute("Link").Value);
         string pageContent = DownloadPage(client, pageLink);
         HtmlDocument doc = new HtmlDocument();
         doc.LoadHtml(pageContent);
         var root = doc.DocumentNode;
         var divNodes = root.Descendants("div").ToList();
         foreach (var item in divNodes)
         {
             string className = item.GetAttributeValue("class", null);
             if (className == "toclevel2")
             {
                 string href = item.FirstChild.NextSibling.GetAttributeValue("href", null);
                 string name = item.FirstChild.NextSibling.GetAttributeValue("title", null);
                 if (null != href && null != name)
                 {
                     if (name.IndexOf(" ") > -1)
                         name = name.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries)[0];
                     propertiesNode.Add(new XElement("Event", new XElement("Name", name), new XElement("Link", _rootAdress + href)));
                     func("");
                 }
             }
         }
     }
 }