protected override void ImportanceParameter(Importance importance) { switch (_ourSettingsControl.ImportanceSetting) { case GenericTemplateSettings.ImportanceSettingEnum.Imp: Template.NewOrReplaceTemplateParm("importance", importance.ToString(), TheArticle, false, false); break; case GenericTemplateSettings.ImportanceSettingEnum.Pri: Template.NewOrReplaceTemplateParm("priority", importance.ToString(), TheArticle, false, false); break; // Case GenericTemplateSettings.ImportanceSettingEnum.None ' do nothing } }
public void SendAlert() { if (IsValid()) { var props = Writer.EnsureProperties(properties); props.Add(XFConstants.EventWriter.EventType, EventTypeOption.Alert); props.Add(XFConstants.Alert.Title, Title); props.Add(XFConstants.Alert.Message, Message); props.Add(XFConstants.Alert.Categories, Categories.ToString()); props.Add(XFConstants.Alert.Urgency, Urgency.ToString()); props.Add(XFConstants.Alert.Importance, Importance.ToString()); props.Add(XFConstants.Alert.Targets, Audiences.ToString()); props.Add(XFConstants.Alert.Source, Source); props.Add(XFConstants.Alert.CreatedAt, DateTime.Now.ToString(XFConstants.DateTimeFormat)); if (!String.IsNullOrEmpty(Error)) { props.Add(XFConstants.Alert.Error, Error); } if (!String.IsNullOrWhiteSpace(Stacktrace)) { props.Add(XFConstants.Alert.StackTrace, Stacktrace); } if (!String.IsNullOrWhiteSpace(NamedRecipient)) { props.Add(XFConstants.Alert.NamedTarget, NamedRecipient); } if (!String.IsNullOrWhiteSpace(Topic)) { props.Add(XFConstants.Alert.Topic, Topic); } List <TypedItem> list = Writer.Convert(props); EventWriter.Write(EventTypeOption.Alert, list); } }
private static PredicateCondition CreateImportancePredicate(Importance importance) { return(TransportRuleParser.Instance.CreatePredicate("is", TransportRuleParser.Instance.CreateProperty("Message.Headers:Importance"), new ShortList <string> { importance.ToString() })); }
public static void Log(Importance importance, string message) { string debugMessage = DateTime.Now.ToString("hh:mm:ss:fff:") + " ProcessHacker (T" + System.Threading.Thread.CurrentThread.ManagedThreadId + "): (" + importance.ToString() + ") " + message + "\r\n\r\n" + Environment.StackTrace; Debugger.Log(0, "DEBUG", debugMessage); if (Logged != null) Logged(debugMessage); }
public static void Log(Importance importance, string message) { string debugMessage = DateTime.Now.ToString("hh:mm:ss:fff:") + " ProcessHacker (T" + System.Threading.Thread.CurrentThread.ManagedThreadId + "): (" + importance.ToString() + ") " + message + "\r\n\r\n" + Environment.StackTrace; Debugger.Log(0, "DEBUG", debugMessage); if (Logged != null) { Logged(debugMessage); } }
/// <summary> /// Outputs message to UI output console /// </summary> /// <param name="level">Level of imortance - Error, Info, etc...</param> /// <param name="msg">Message to input, could be used like string.Format()</param> /// <param name="args"></param> protected void Debug(Importance level, string msg, params object[] args) { StringBuilder sb = new StringBuilder(); if(level != Importance.No) { sb.AppendFormat("[{0}] ", level.ToString().ToUpper()); } sb.AppendFormat(msg, args); sb.AppendLine(); this.AddText("txtOutput", sb.ToString()); txtOutput.SelectionStart = int.MaxValue; txtOutput.ScrollToCaret(); }
/// <summary> /// Outputs message to UI output console /// </summary> /// <param name="level">Level of imortance - Error, Info, etc...</param> /// <param name="msg">Message to input, could be used like string.Format()</param> /// <param name="args"></param> protected void Debug(Importance level, string msg, params object[] args) { StringBuilder sb = new StringBuilder(); if (level != Importance.No) { sb.AppendFormat("[{0}] ", level.ToString().ToUpper()); } sb.AppendFormat(msg, args); sb.AppendLine(); this.AddText("txtOutput", sb.ToString()); txtOutput.SelectionStart = int.MaxValue; txtOutput.ScrollToCaret(); }
public async Task JoinOnlineMeeting(string onlineMeetingUri, string subject, Importance importance, CancellationToken cancellationToken) { if (string.IsNullOrEmpty(onlineMeetingUri) || string.IsNullOrEmpty(subject)) { return; } JObject body = new JObject(); body["onlineMeetingUri"] = onlineMeetingUri; body["subject"] = subject; body["importance"] = importance.ToString(); body["operationid"] = Guid.NewGuid(); body["threadid"] = Guid.NewGuid(); await HttpService.Post(Links.joinOnlineMeeting, body, cancellationToken); }
public static void Log(Importance logLevel, string msg, params object[] Args) { DirectoryInfo dirInfo = new DirectoryInfo(Dir); StringBuilder sb = new StringBuilder(); StringBuilder strMsg = new StringBuilder(); string filename = ""; StreamWriter streamW = null; if(!dirInfo.Exists) { try { dirInfo.Create(); } catch(Exception) { System.Console.WriteLine("Error creating '{0}' directory!", Dir); return; } } // END IF try { sb.AppendFormat(FileName, DateTime.Now.ToString("yyyyMMdd")); filename = dirInfo.FullName; // Ensures that ends w/ '\' if(!filename.EndsWith("\\")) filename += "\\"; filename += sb.ToString(); // System.Console.WriteLine( "Log file name: " + filename ); } catch(Exception) { System.Console.WriteLine("Bad log file name '{0}'!", FileName); } if(TimeFmt.Length > 0) strMsg.Append(DateTime.Now.ToString(TimeFmt)).Append(" "); if(logLevel != Importance.No) { if(logLevel == Importance.HideThis) { strMsg.Append("[*** ").Append(logLevel.ToString().ToUpper()).Append(" ***] "); } else { strMsg.Append("[").Append(logLevel.ToString().ToUpper()).Append("] "); } } //strMsg += " " + msg + Environment.NewLine; strMsg.AppendFormat(msg, Args).Append(Environment.NewLine); if(OutputToConsole) System.Console.Write(strMsg.ToString()); try { lock(m_monitor) { streamW = new StreamWriter(filename, true); streamW.AutoFlush = true; streamW.Write(strMsg); } } catch(Exception ex) { System.Console.WriteLine("Error writing to '{0}' file!", filename); System.Console.WriteLine(ex.ToString()); } if(streamW != null) streamW.Close(); }
static void Main(string[] args) { var temp = Importance.Important; if (temp == Importance.Important) { Console.WriteLine(temp); } Importance importance = Importance.Critical; Console.WriteLine(importance); Console.WriteLine((int)importance); Console.WriteLine(importance.ToString() == "Critical"); Console.WriteLine((int)Importance.After); Console.WriteLine((int)Importance.Important); Console.WriteLine("-------------------------"); //bitwise Console.WriteLine("Bitwise"); var a = 'i'; var b = a >> 1; //shift Console.WriteLine((char)b); Console.WriteLine((decimal)b); b = a | 1; //or Console.WriteLine((char)b); Console.WriteLine((decimal)b); b = a & 'a'; //and Console.WriteLine((char)b); Console.WriteLine((decimal)b); // "Switch-case" switch (importance) { case Importance.None: case Importance.After: { Console.WriteLine("OK"); break; } case Importance.Critical: case Importance.Important: { Console.WriteLine("NO"); break; } default: { Console.WriteLine("NO"); break; } } // "Tuple" var tuple = new Tuple <int, string, bool>(3, "three", true); var tuples = new Tuple <int, int, int> [2]; Console.WriteLine(tuple.Item1); Console.ReadLine(); }
private static bool IsImportanceCondition(Condition condition, Importance importance) { if (condition.ConditionType != ConditionType.Predicate) { return(false); } PredicateCondition predicateCondition = (PredicateCondition)condition; return(predicateCondition.Name.Equals("is") && predicateCondition.Property is HeaderProperty && predicateCondition.Property.Name.Equals("Importance") && predicateCondition.Value.RawValues.Count == 1 && predicateCondition.Value.RawValues[0].Equals(importance.ToString())); }
/// <inheritdoc /> protected override IEnumerable <KeyValuePair <string, string> > GetMetadata() { yield return(new KeyValuePair <string, string>(MetadataKeys.Importance, importance.ToString())); }
public void SendJobFile(string jobFilePath) { if (!File.Exists(jobFilePath)) { TextWriter tw; tw = new StreamWriter(jobFilePath); if (tw != null) { if (!String.IsNullOrEmpty(this.JobID)) { tw.WriteLine("JobID=" + JobID); } if (!String.IsNullOrEmpty(this.ClientID)) { tw.WriteLine("ClientID=" + ClientID); } if (!String.IsNullOrEmpty(this.Robot)) { tw.WriteLine("RobotName=" + Robot); } if (!UseAnyDrive) { tw.WriteLine("DriveID=" + this.DriveID.ToString( )); } tw.WriteLine("Importance=" + Importance.ToString( )); if (this.BinID != 3) { tw.WriteLine("BinID=" + BinID.ToString( )); } if (this.DiscType != 0) { if (this.DiscType == 1) { tw.WriteLine("DiscType=CDR"); } else { tw.WriteLine("DiscType=DVDR"); } } bool setImageType = false; bool setDataType = false; foreach (DataEntry data in this.Data) { string dataField = ""; if (data.DataType == DataFileType.DATA) { dataField = "Data=" + data.File; if (!setDataType) { string DataTypeStr; DataTypeStr = "DataImageType=" + this.DataType.ToString( ).Replace('_', '+'); if (this.DataSetNow) { DataTypeStr += ", SETNOW"; } if (this.DataSAO) { DataTypeStr += ", SAO"; } if (this.DataMode2) { DataTypeStr += ", MODE2"; } tw.WriteLine(DataTypeStr); setDataType = true; } } else if (data.DataType == DataFileType.AUDIO) { dataField = "AudioFile=" + data.File; if (data.SetPreGap) { dataField += " Pregap" + data.PreGap.ToString( ); } } else if (data.DataType == DataFileType.IMAGE) { dataField = "ImageFile=" + data.File; if (!setImageType && (Path.GetExtension(data.File).ToLower( ) == "iso")) { tw.WriteLine("ImageType=" + this.ImgType.ToString( )); setImageType = true; } } if (data.Session != 0) { dataField += " Session" + data.Session.ToString( ); } tw.WriteLine(dataField); } if (!String.IsNullOrEmpty(this.PrintLabel)) { tw.WriteLine("PrintLabel=" + this.PrintLabel); if (Path.GetExtension(this.PrintLabel).Equals(".std", StringComparison.InvariantCultureIgnoreCase)) { foreach (string label in MergeFields) { tw.WriteLine("MergeField=" + label); } } } tw.WriteLine("Copies=" + this.Copies.ToString( )); if (this.SetPrinterSettings) { tw.WriteLine("PrintQuality=" + Convert.ToUInt32(this.PrintQuality)); tw.WriteLine("PrintInnerDiam=" + this.PrintID); tw.WriteLine("PrintOuterMargin=" + this.PrintOM); } if (this.ManLoadUnload) { tw.WriteLine("LoadUnloadOverride=YES"); } else { tw.WriteLine("LoadUnloadOverride=NO"); } if (this.TestRecord) { tw.WriteLine("TestRecord=YES"); } else { tw.WriteLine("TestRecord=NO"); } if (this.PreMasterData) { tw.WriteLine("PreMasterData=YES"); } else { tw.WriteLine("PreMasterData=NO"); } if (this.RejectIfNotBlank) { tw.WriteLine("RejectIfNotBlank=YES"); } else { tw.WriteLine("RejectIfNotBlank=NO"); } if (this.Verify) { tw.WriteLine("VerifyDisc=YES"); } else { tw.WriteLine("VerifyDisc=NO"); } if (this.CloseDisc) { tw.WriteLine("CloseDisc=YES"); } else { tw.WriteLine("CloseDisc=NO"); } if (this.DeleteFiles) { tw.WriteLine("DeleteFiles=YES"); } else { tw.WriteLine("DeleteFiles=NO"); } tw.WriteLine("BurnSpeed=" + this.BurnSpeed.ToString( )); tw.WriteLine("VolumeName=" + this.VolumeName); if (this.CheckDisc) { if (!String.IsNullOrEmpty(this.CheckFileOnDisc)) { tw.WriteLine("CheckFileOnDisc=" + this.CheckFileOnDisc); } if (!String.IsNullOrEmpty(this.CheckSystemIDOnDisc)) { tw.WriteLine("CheckSystemIDOnDisc=" + this.CheckSystemIDOnDisc); } if (!String.IsNullOrEmpty(this.CheckPreparerIDOnDisc)) { tw.WriteLine("CheckPreparerIDOnDisc=" + this.CheckPreparerIDOnDisc); } if (!String.IsNullOrEmpty(this.CheckPubIDOnDisc)) { tw.WriteLine("CheckPubIDOnDisc=" + this.CheckPubIDOnDisc); } if (!String.IsNullOrEmpty(this.CheckAppIDOnDisc)) { tw.WriteLine("CheckAppIDOnDisc=" + this.CheckAppIDOnDisc); } if (!String.IsNullOrEmpty(this.CheckVolumeIDOnDisc)) { tw.WriteLine("CheckVolumeIDOnDisc=" + this.CheckVolumeIDOnDisc); } } if (this.SetPVD) { if (!String.IsNullOrEmpty(this.PVDSystemID)) { tw.WriteLine("PVDSystemID=" + this.PVDSystemID); } if (!String.IsNullOrEmpty(this.PVDApplicationID)) { tw.WriteLine("PVDApplicationID=" + this.PVDApplicationID); } if (!String.IsNullOrEmpty(this.PVDPreparerID)) { tw.WriteLine("PVDPreparerID=" + this.PVDPreparerID); } if (!String.IsNullOrEmpty(this.PVDPublisherID)) { tw.WriteLine("PVDPublisherID=" + this.PVDPublisherID); } } tw.Close( ); } } }
protected override void ImportanceParameter(Importance Importance) { Template.NewOrReplaceTemplateParm("importance", Importance.ToString(), article, false, false); }
public static void Log(Importance logLevel, string msg, params object[] Args) { DirectoryInfo dirInfo = new DirectoryInfo(Dir); StringBuilder sb = new StringBuilder(); StringBuilder strMsg = new StringBuilder(); string filename = ""; StreamWriter streamW = null; if (!dirInfo.Exists) { try { dirInfo.Create(); } catch (Exception) { System.Console.WriteLine("Error creating '{0}' directory!", Dir); return; } } // END IF try { sb.AppendFormat(FileName, DateTime.Now.ToString("yyyyMMdd")); filename = dirInfo.FullName; // Ensures that ends w/ '\' if (!filename.EndsWith("\\")) { filename += "\\"; } filename += sb.ToString(); // System.Console.WriteLine( "Log file name: " + filename ); } catch (Exception) { System.Console.WriteLine("Bad log file name '{0}'!", FileName); } if (TimeFmt.Length > 0) { strMsg.Append(DateTime.Now.ToString(TimeFmt)).Append(" "); } if (logLevel != Importance.No) { if (logLevel == Importance.HideThis) { strMsg.Append("[*** ").Append(logLevel.ToString().ToUpper()).Append(" ***] "); } else { strMsg.Append("[").Append(logLevel.ToString().ToUpper()).Append("] "); } } //strMsg += " " + msg + Environment.NewLine; strMsg.AppendFormat(msg, Args).Append(Environment.NewLine); if (OutputToConsole) { System.Console.Write(strMsg.ToString()); } try { lock (m_monitor) { streamW = new StreamWriter(filename, true); streamW.AutoFlush = true; streamW.Write(strMsg); } } catch (Exception ex) { System.Console.WriteLine("Error writing to '{0}' file!", filename); System.Console.WriteLine(ex.ToString()); } if (streamW != null) { streamW.Close(); } }
protected override void ImportanceParameter(Importance importance) { Template.NewOrReplaceTemplateParm("importance", importance.ToString(), TheArticle, false, false); }
public static void Log(Importance importance, string data, ConsoleColor consoleColor) { Console.ForegroundColor = consoleColor; Console.WriteLine(string.Format("[{0}] [{1}] {2}", DateTime.Now.ToString("HH:mm:ss"), importance.ToString(), data)); Console.ResetColor(); }