public void TestRfcOrderBytes() { Guid guid = Guid.NewGuid(); byte[] data = guid.ToByteArray(); byte[] data2 = GuidExtensions.ToRfcBytes(guid); Guid guid2 = GuidExtensions.ToRfcGuid(data2); foreach (var b in data) { System.Console.Write("{0:X2} ", b); } System.Console.WriteLine(); foreach (var b in data2) { System.Console.Write("{0:X2} ", b); } System.Console.WriteLine(); StringBuilder sb = new StringBuilder(); foreach (var b in data2) { sb.AppendFormat("{0:X2}", b); } System.Console.WriteLine(sb.ToString()); System.Console.WriteLine(guid.ToString("N").ToUpper()); System.Console.WriteLine(guid); System.Console.WriteLine(guid2); Assert.AreEqual(guid, guid2); Assert.AreEqual(guid.ToString("N").ToUpper(), sb.ToString()); }
public void Profile() { PointCount = 0; BenchmarkFile(@"C:\temp\C37Test\benchmark1.sttp", @"C:\temp\C37Test\benchmark2.sttp", CtpCompressionMode.None, EncodingMethod.Normal); Console.WriteLine($"None: " + new FileInfo(@"C:\temp\C37Test\benchmark2.sttp").Length / 1024); Console.WriteLine(new FileInfo(@"C:\temp\C37Test\benchmark2.sttp").Length / (float)PointCount); //BenchmarkFile(@"C:\temp\C37Test\benchmark2.sttp", @"C:\temp\C37Test\benchmark3.sttp", CtpCompressionMode.None, EncodingMethod.Raw); using (var sha = new SHA1Managed()) { Console.WriteLine(GuidExtensions.ToRfcGuid(sha.ComputeHash(File.ReadAllBytes(@"C:\temp\C37Test\benchmark1.sttp")), 0)); Console.WriteLine(GuidExtensions.ToRfcGuid(sha.ComputeHash(File.ReadAllBytes(@"C:\temp\C37Test\benchmark2.sttp")), 0)); } string[] file1 = File.ReadAllLines(@"C:\temp\C37Test\benchmark1.txt"); string[] file2 = File.ReadAllLines(@"C:\temp\C37Test\benchmark2.txt"); int cnt = 0; int l = Math.Max(file1.Length, file2.Length); //int l = Math.Min(file1.Length, file2.Length); for (int x = 0; x < l; x++) { if (x >= file1.Length) { Console.WriteLine(x); Console.WriteLine(file2[x]); cnt++; } else if (x >= file2.Length) { Console.WriteLine(x); Console.WriteLine(file1[x]); cnt++; } else if (file1[x] != file2[x]) { Console.WriteLine(x); Console.WriteLine(file1[x]); Console.WriteLine(file2[x]); cnt++; } if (cnt == 10) { return; } } //Console.WriteLine(Names.Average(x => x.Length)); //BenchmarkFile(@"C:\temp\C37Test\benchmark1.sttp", @"C:\temp\C37Test\benchmark2.sttp", SttpCompressionMode.Deflate, EncodingMethod.Adaptive); //Console.WriteLine($"None: " + new FileInfo(@"C:\temp\C37Test\benchmark2.sttp").Length / 1024); //BenchmarkFile(@"C:\temp\C37Test\benchmark1.sttp", @"C:\temp\C37Test\benchmark2.sttp", SttpCompressionMode.Zlib, EncodingMethod.Adaptive); //Console.WriteLine($"None: " + new FileInfo(@"C:\temp\C37Test\benchmark2.sttp").Length / 1024); }