public string ToLongString() { var sb = new StringBuilder(); sb.Append(Date); sb.Append(" - "); sb.Append(Type.ToString().PadRight(8)); string tempSourceName; if (string.IsNullOrEmpty(ExtraSourceInfo)) { tempSourceName = string.Empty; } else { tempSourceName = ":" + ExtraSourceInfo; } sb.Append(string.Concat("(", SourceName.ToString(), tempSourceName, ")").PadRight(18)); sb.Append(" - "); sb.Append(Message); return(sb.ToString()); }
public void SourceNameShouldBeSortedAlphabetically_GreaterThanOrEqual(string a, string b) { SourceName x = a; SourceName y = b; Assert.IsTrue(x >= y); }
public void SourceNameShouldEqualSourceNameWithEqualCapitalization_ObjectEquals() { SourceName a = "Decos.Diagnostics.Tests"; SourceName b = "Decos.Diagnostics.Tests"; Assert.AreEqual(a, b); }
public override void CommitLogEvent(LogEvent logEvent) { SourceName source = GetSource(logEvent, Database); CategoryName category = GetCategory(logEvent, Database); UserName user = GetUser(logEvent, Database); ComputerName computer = GetComputer(logEvent, Database); Signature signature = GetSignature(logEvent, Database); Event instance = new Event(); instance.SignatureId = signature.Id; instance.ComputerNameId = computer.Id; instance.CategoryNameId = category.Id; instance.SourceNameId = source.Id; instance.UserNameId = user.Id; instance.EventId = logEvent.EventID; instance.Time = logEvent.Time; instance.Severity = (int)logEvent.Severity; instance.Save(Database); logEvent.MessageVariableValues.Each((val, pos) => { Param p = instance.Params.AddNew(); p.Position = pos; p.Value = val; }); instance.Save(Database); }
public void SourceNameCanBeCastFromString() { const string name = "Decos.Diagnostics.Tests"; SourceName a = name; Assert.AreEqual(a.Name, "Decos.Diagnostics.Tests"); }
public VdOtherType(XmlNode otherNode, OtherType type) { Id = otherNode.Name; Type = type; SourceName = AtributeValue(ref otherNode, "SourcePath"); if (Type == OtherType.ProjectOutput) { // Real DestName should be parsed from .csproj file which is really difficult // Instead simply keep only file name (without path) DestName = AtributeValue(ref otherNode, "TargetName"); if (String.IsNullOrEmpty(DestName)) { int iPos = SourceName.LastIndexOf('\\'); if (iPos > 0) { DestName = SourceName.Substring(iPos + 1); } else { DestName = SourceName; } } } else { DestName = AtributeValue(ref otherNode, "TargetName"); } FolderId = AtributeValue(ref otherNode, "Folder"); Exclude = VdProduct.AtrToBool(AtributeValue(ref otherNode, "Exclude")); }
public void SourceNameShouldBeSortedAlphabetically_LessThan(string a, string b) { SourceName x = a; SourceName y = b; Assert.IsTrue(x < y); }
public void SourceNameHashCodeIsEqualForEqualNames() { SourceName a = "A"; SourceName b = "A"; Assert.AreEqual(a.GetHashCode(), b.GetHashCode()); }
public void SourceNameShouldEqualSourceNameWithEqualCapitalization_IEquatable() { SourceName a = "Decos.Diagnostics.Tests"; SourceName b = "Decos.Diagnostics.Tests"; Assert.IsTrue(a.Equals(b)); }
public async void TestSourceDeduplication(string feedName) { var sourceName = new SourceName("fileName", "hash"); var feed = Storage.GetFeed(feedName); await TestDeduplication(packageName => feed.GetSource(packageName, sourceName)); }
public void SourceNameShouldEqualSourceNameWithEqualCapitalization_InequalityOperator() { SourceName a = "Decos.Diagnostics.Tests"; SourceName b = "Decos.Diagnostics.Tests"; Assert.IsFalse(a != b); }
public void SourceNameShouldNotEqualSourceNameWithDifferentCapitalization_InequalityOperator() { SourceName a = "Decos.Diagnostics.Tests"; SourceName b = "decos.diagnostics.tests"; Assert.IsTrue(a != b); }
private TraceSource CreateSource(SourceName name) { var switchValue = Options.GetLogLevel(name).ToSourceLevels(); var traceSource = new TraceSource(name, switchValue); var listeners = System.Diagnostics.Trace.Listeners.Cast <TraceListener>() .Concat(Options.Listeners); foreach (var listener in listeners) { if (listener is DefaultTraceListener && traceSource.Listeners.OfType <DefaultTraceListener>().Any()) { continue; } if (!ContainsListenerOfType(traceSource.Listeners, listener.GetType())) { if (listener is AsyncTraceListener asyncListener) { StartProcessing(asyncListener); } traceSource.Listeners.Add(listener); } } return(traceSource); }
public void SourceNameShouldNotEqualSourceNameWithDifferentCapitalization_ObjectEquals() { SourceName a = "Decos.Diagnostics.Tests"; SourceName b = "decos.diagnostics.tests"; Assert.AreNotEqual(a, b); }
public void SourceNameShouldNotEqualSourceNameWithDifferentCapitalization_IEquatable() { SourceName a = "Decos.Diagnostics.Tests"; SourceName b = "decos.diagnostics.tests"; Assert.IsFalse(a.Equals(b)); }
public static IParsingResultExtended Parse(ParsingContext context) { IParsingResultExtended simple = SimpleOperatorName.Parse(context); if (simple != null) { return(simple); } RewindState rewind = context.RewindState; if (context.Parser.VerifyString("cv")) { IParsingResultExtended type = Type.Parse(context); if (type == null) { context.Rewind(rewind); return(null); } return(new Cast(type)); } if (context.Parser.VerifyString("li")) { IParsingResultExtended name = SourceName.Parse(context); if (name == null) { context.Rewind(rewind); return(null); } return(new Literal(name)); } if (context.Parser.VerifyString("v")) { if (!char.IsDigit(context.Parser.Peek)) { context.Rewind(rewind); return(null); } int arity = context.Parser.Peek - '0'; context.Parser.Position++; IParsingResultExtended name = SourceName.Parse(context); if (name == null) { context.Rewind(rewind); return(null); } return(new VendorExtension(arity, name)); } return(null); }
public void SourceNameHashCodeIsUniqueForDifferentNames() { SourceName a = "A"; SourceName b = "a"; Assert.AreNotEqual(a.GetHashCode(), b.GetHashCode()); }
public void SourceNameCanBeCastToNull() { SourceName a = null; string name = a; Assert.IsNull(name); }
public void SourceNameCanBeCastToString() { SourceName a = "Decos.Diagnostics.Tests"; string name = a; Assert.AreEqual(name, a.Name); }
public void SourceNameCanBeCastFromNull() { const string name = null; SourceName a = name; Assert.IsNull(a); }
public HttpQueryableServiceSpec() { this.listener = new ConsoleTraceListener(); this.listener.Name = Guid.NewGuid().ToString(); TracerExtensibility.AddListener(SourceName.For <TracingChannel>(), listener); TracerExtensibility.SetTracingLevel(SourceName.For <TracingChannel>(), SourceLevels.All); }
public void WhenTypeNameHasNoNamespace_ThenCompositeContainsDefaultAndTypeName() { var names = SourceName.CompositeFor <SourceNameWithoutNamespace>(); Assert.Equal(2, names.Count()); Assert.True(names.Contains(SourceName.Default)); Assert.True(names.Contains("SourceNameWithoutNamespace")); }
public override int GetHashCode() { int result = 17; result = 31 * result + (SourceName == null ? 0 : SourceName.GetHashCode()); result = 31 * result + (CultureInfo == null && CultureInfo.Name != null ? 0 : CultureInfo.Name.GetHashCode()); return(result); }
/// <summary> /// Gets the source for the given type <paramref name="type"/>. /// </summary> public static ITraceSource GetSourceFor(Type type) { return(new AggregateTraceSource( SourceName.For(type), SourceName .CompositeFor(type) .Select(name => Instance.GetSourceEntryFor(name).TraceSource))); }
public AiFile(XmlNode fileNode, ref Dictionary <string, string> components) { Id = RowValue(ref fileNode, "File"); SourceName = RowValue(ref fileNode, "SourcePath"); DestName = GetFilenamePart(RowValue(ref fileNode, "FileName")); FolderId = components[RowValue(ref fileNode, "Component_")]; //!Exclude = VdProduct.AtrToBool(TdValue(ref fileNode, "Exclude")); if (Details == null) { Details = new FileDetails(); } // Font if (SourceName.Contains(".ttf") || DestName.Contains(".ttf")) { Details.Type = FileType.Font; Details.IsOTF = false; } if (SourceName.Contains(".otf") || DestName.Contains(".otf")) { Details.Type = FileType.Font; Details.IsOTF = true; } /* if (Details.Type == FileType.Font) * { * // Should be registered? * if (TdValue(ref fileNode, "Register") == "5") // vsdrfFont * Details.Register = true; * } * // Type library (.tlb). * if (SourceName.Contains(".tlb") || DestName.Contains(".tlb")) * { * Details.Type = FileType.Library; * int regFile = int.Parse(TdValue(ref fileNode, "Register")); * if (regFile > 1 && regFile < 5) * Details.Register = true; * } * * // Is assembly? * if (TdValue(ref fileNode, "AssemblyRegister") != null) * { * Details.Type = FileType.Assembly; * int regFile = int.Parse(TdValue(ref fileNode, "AssemblyRegister")); * if (regFile > 1 && regFile < 5) * Details.Register = true; * Details.IsInGAC = VdProduct.AtrToBool(TdValue(ref fileNode, "AssemblyIsInGAC")); * Details.AsmName = TdValue(ref fileNode, "AssemblyAsmDisplayName"); * } * * // Register File? * if(Details.Type == FileType.File) * { * int regFile = int.Parse(TdValue(ref fileNode, "Register")); * if (regFile > 1 && regFile < 5) * Details.Register = true; * }*/ }
public void WhenGenericTypeName_ThenCompositeContainsSegmentsButNoSplitFromGenericArgument() { var names = SourceName.CompositeFor <IComparable <string> >(); Assert.Equal(4, names.Count()); Assert.True(names.Contains("System")); Assert.True(names.Contains("System.IComparable")); Assert.True(names.Contains("System.IComparable<System.String>")); }
public bool setup(UserAccount account) { if (!SourceName.Equals(account.SourceName)) { return(false); } MasterAccount = account; return(true); }
public override int GetHashCode() { unchecked { var hashCode = (SourceName != null ? SourceName.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (LocalName != null ? LocalName.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Path != null ? Path.GetHashCode() : 0); return(hashCode); } }
/// <inheritdoc /> public override int GetHashCode() { unchecked { int hashCode = 0; hashCode = (hashCode * 397) ^ (int)SourceId; hashCode = (hashCode * 397) ^ (SourceName != null ? SourceName.GetHashCode() : 0); return(hashCode); } }
public async void TestSource(string feedName) { var packageName = new PackageName("packageId", "1.0"); var sourceName = new SourceName("fileName", "hash"); var feed = Storage.GetFeed(feedName); var source = feed.GetSource(packageName, sourceName); await TestItemRoundtrip(source); }