private static void Example2() { Energy.Base.ByteArrayBuilder b = new Energy.Base.ByteArrayBuilder(); b.Append((byte)1); b.Append((byte)2); b.Append((int)1); b.Append((int)2); b.Append("Zurück"); b.Encoding = System.Text.Encoding.Unicode; b.Append("Zurück"); b.Append(Guid.NewGuid()); b.Rewind(); Console.WriteLine(Energy.Base.Hex.Print(b.ToArray())); b.Rewind(); b.Skip(2 + 8); string s1 = b.ReadString(System.Text.Encoding.UTF8); string s2 = b.ReadString(System.Text.Encoding.Unicode); Console.WriteLine("{0} {1}", s1, s2); Guid guid = b.ReadGuid(); Console.WriteLine(Energy.Base.Hex.Print(guid.ToByteArray())); }
public void ByteArrayBuilderBase64() { Energy.Base.ByteArrayBuilder b = new Energy.Base.ByteArrayBuilder(); string s1 = "TWljcm9zb2Z0IFdpbmRvd3M="; b.WriteBase64(s1); b.Rewind(); string s2 = b.ReadString(); Assert.AreEqual("Microsoft Windows", s2); b.Clear(); string s3 = "Gęś"; b.WriteString(s3); b.Rewind(); string s4 = b.ReadBase64(); string s5 = "R8SZxZs="; Assert.AreEqual(s5, s4); }