本文整理汇总了C#中Writer.WriteString方法的典型用法代码示例。如果您正苦于以下问题:C# Writer.WriteString方法的具体用法?C# Writer.WriteString怎么用?C# Writer.WriteString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Writer
的用法示例。
在下文中一共展示了Writer.WriteString方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Build
public override byte[] Build()
{
MemoryStream temp = new MemoryStream(128);
Writer writer = new Writer(temp);
writer.Seek(0x62, SeekOrigin.Begin);
writer.WriteString(Login, Encoding.ASCII);
writer.Seek(0x70, SeekOrigin.Begin);
writer.WriteString(Password, Encoding.ASCII);
MemoryStream ms = new MemoryStream(168);
writer = new Writer(ms);
writer.Write(Id);
writer.Write(Encrypt(temp.GetBuffer()));
writer.Write(SessionId);
writer.Write(GameGuard);
ulong chk = Utils.CheckSum(ms.GetBuffer(), 160);
writer.Write((byte)(chk & 0xff));
writer.Write((byte)(chk >> 0x08 & 0xff));
writer.Write((byte)(chk >> 0x10 & 0xff));
writer.Write((byte)(chk >> 0x18 & 0xff));
writer.Write((Int32)0);
return ms.GetBuffer();
}
示例2: Build
public override byte[] Build()
{
MemoryStream ms = new MemoryStream(Size);
Writer writer = new Writer(ms);
writer.Write(Id);
writer.WriteString(Message, Encoding);
writer.WriteString(Name, Encoding);
return ms.GetBuffer();
}
示例3: Build
public override byte[] Build()
{
MemoryStream ms = new MemoryStream(Size);
Writer writer = new Writer(ms);
writer.Write(Id);
writer.WriteString(Message, Encoding);
writer.Write((Int32)Channel);
if(NeedTarget())
writer.WriteString(Target, Encoding);
return ms.GetBuffer();
}
示例4: Build
public override byte[] Build()
{
MemoryStream ms = new MemoryStream(Size);
Writer writer = new Writer(ms);
writer.Write(Id);
writer.WriteString(Login, Encoding.Unicode);
writer.Write(GameKey.Skip(4).ToArray());
writer.Write(LoginKey.Take(4).ToArray());
writer.Write(GameKey.Take(4).ToArray());
writer.Write(LoginKey.Skip(4).ToArray());
writer.Write((Int32)1);
return ms.GetBuffer();
}
示例5: WriterStringTest
public void WriterStringTest()
{
// Prepare
var writer = new Writer<Node>();
var values = new Dictionary<string, object>
{
{"levelKey", 1},
{"multilevel", new Node()},
{"multilevel.level2", new Node()},
{"multilevel.level2.number", 1},
{"multilevel.level2.decimal", 1.1d},
{"multilevel.level2.boolean", true},
{"multilevel.level2.string", "str1"},
{"second_multilevel", new Node()},
{"second_multilevel.array", new List<object>{ "str1", 1, 2.2d}},
};
// Act
var data = writer.WriteString(values);
// Validate
const string expected = @"
levelKey : 1
multilevel {
level2 {
boolean : true
decimal : 1.1
number : 1
string : ""str1""
}
}
second_multilevel {
array : [""str1"", 1, 2.2]
}
";
Assert.AreEqual(expected, data);
}
示例6: SerializeX
/// <summary>
/// Serialize this object to the specified output stream.
/// Unlike the Serlialize() method, this method is not inherited from the
/// parent class allowing a specific version of the method to be called.
/// </summary>
/// <param name="_Writer">Output stream</param>
/// <param name="_wrap">If true, output is wrapped with object
/// start and end sequences '{ ... }'.</param>
/// <param name="_first">If true, item is the first entry in a list.</param>
public new void SerializeX (Writer _Writer, bool _wrap, ref bool _first) {
if (_wrap) {
_Writer.WriteObjectStart ();
}
if (EmailAddress != null) {
_Writer.WriteObjectSeparator (ref _first);
_Writer.WriteToken ("EmailAddress", 1);
_Writer.WriteString (EmailAddress);
}
if (ReplyToAddress != null) {
_Writer.WriteObjectSeparator (ref _first);
_Writer.WriteToken ("ReplyToAddress", 1);
_Writer.WriteString (ReplyToAddress);
}
if (DisplayName != null) {
_Writer.WriteObjectSeparator (ref _first);
_Writer.WriteToken ("DisplayName", 1);
_Writer.WriteString (DisplayName);
}
if (AccountName != null) {
_Writer.WriteObjectSeparator (ref _first);
_Writer.WriteToken ("AccountName", 1);
_Writer.WriteString (AccountName);
}
if (Inbound != null) {
_Writer.WriteObjectSeparator (ref _first);
_Writer.WriteToken ("Inbound", 1);
_Writer.WriteArrayStart ();
bool _firstarray = true;
foreach (var _index in Inbound) {
_Writer.WriteArraySeparator (ref _firstarray);
// This is an untagged structure. Cannot inherit.
//_Writer.WriteObjectStart();
//_Writer.WriteToken(_index.Tag(), 1);
bool firstinner = true;
_index.Serialize (_Writer, true, ref firstinner);
//_Writer.WriteObjectEnd();
}
_Writer.WriteArrayEnd ();
}
if (Outbound != null) {
_Writer.WriteObjectSeparator (ref _first);
_Writer.WriteToken ("Outbound", 1);
_Writer.WriteArrayStart ();
bool _firstarray = true;
foreach (var _index in Outbound) {
_Writer.WriteArraySeparator (ref _firstarray);
// This is an untagged structure. Cannot inherit.
//_Writer.WriteObjectStart();
//_Writer.WriteToken(_index.Tag(), 1);
bool firstinner = true;
_index.Serialize (_Writer, true, ref firstinner);
//_Writer.WriteObjectEnd();
}
_Writer.WriteArrayEnd ();
}
if (Sign != null) {
_Writer.WriteObjectSeparator (ref _first);
_Writer.WriteToken ("Sign", 1);
_Writer.WriteArrayStart ();
bool _firstarray = true;
foreach (var _index in Sign) {
_Writer.WriteArraySeparator (ref _firstarray);
// This is an untagged structure. Cannot inherit.
//_Writer.WriteObjectStart();
//_Writer.WriteToken(_index.Tag(), 1);
bool firstinner = true;
_index.Serialize (_Writer, true, ref firstinner);
//_Writer.WriteObjectEnd();
}
_Writer.WriteArrayEnd ();
}
if (Encrypt != null) {
_Writer.WriteObjectSeparator (ref _first);
_Writer.WriteToken ("Encrypt", 1);
_Writer.WriteArrayStart ();
bool _firstarray = true;
foreach (var _index in Encrypt) {
_Writer.WriteArraySeparator (ref _firstarray);
// This is an untagged structure. Cannot inherit.
//_Writer.WriteObjectStart();
//_Writer.WriteToken(_index.Tag(), 1);
bool firstinner = true;
_index.Serialize (_Writer, true, ref firstinner);
//_Writer.WriteObjectEnd();
}
_Writer.WriteArrayEnd ();
}
//.........这里部分代码省略.........
示例7: SerializeX
/// <summary>
/// Serialize this object to the specified output stream.
/// Unlike the Serlialize() method, this method is not inherited from the
/// parent class allowing a specific version of the method to be called.
/// </summary>
/// <param name="_Writer">Output stream</param>
/// <param name="_wrap">If true, output is wrapped with object
/// start and end sequences '{ ... }'.</param>
/// <param name="_first">If true, item is the first entry in a list.</param>
public new void SerializeX (Writer _Writer, bool _wrap, ref bool _first) {
if (_wrap) {
_Writer.WriteObjectStart ();
}
if (__Major){
_Writer.WriteObjectSeparator (ref _first);
_Writer.WriteToken ("Major", 1);
_Writer.WriteInteger32 (Major);
}
if (__Minor){
_Writer.WriteObjectSeparator (ref _first);
_Writer.WriteToken ("Minor", 1);
_Writer.WriteInteger32 (Minor);
}
if (Encodings != null) {
_Writer.WriteObjectSeparator (ref _first);
_Writer.WriteToken ("Encodings", 1);
_Writer.WriteArrayStart ();
bool _firstarray = true;
foreach (var _index in Encodings) {
_Writer.WriteArraySeparator (ref _firstarray);
// This is an untagged structure. Cannot inherit.
//_Writer.WriteObjectStart();
//_Writer.WriteToken(_index.Tag(), 1);
bool firstinner = true;
_index.Serialize (_Writer, true, ref firstinner);
//_Writer.WriteObjectEnd();
}
_Writer.WriteArrayEnd ();
}
if (URI != null) {
_Writer.WriteObjectSeparator (ref _first);
_Writer.WriteToken ("URI", 1);
_Writer.WriteArrayStart ();
bool _firstarray = true;
foreach (var _index in URI) {
_Writer.WriteArraySeparator (ref _firstarray);
_Writer.WriteString (_index);
}
_Writer.WriteArrayEnd ();
}
if (_wrap) {
_Writer.WriteObjectEnd ();
}
}
示例8: SerializeX
/// <summary>
/// Serialize this object to the specified output stream.
/// Unlike the Serlialize() method, this method is not inherited from the
/// parent class allowing a specific version of the method to be called.
/// </summary>
/// <param name="_Writer">Output stream</param>
/// <param name="_wrap">If true, output is wrapped with object
/// start and end sequences '{ ... }'.</param>
/// <param name="_first">If true, item is the first entry in a list.</param>
public new void SerializeX (Writer _Writer, bool _wrap, ref bool _first) {
if (_wrap) {
_Writer.WriteObjectStart ();
}
((Entry)this).SerializeX(_Writer, false, ref _first);
if (UDF != null) {
_Writer.WriteObjectSeparator (ref _first);
_Writer.WriteToken ("UDF", 1);
_Writer.WriteString (UDF);
}
if (UserKeys != null) {
_Writer.WriteObjectSeparator (ref _first);
_Writer.WriteToken ("UserKeys", 1);
_Writer.WriteArrayStart ();
bool _firstarray = true;
foreach (var _index in UserKeys) {
_Writer.WriteArraySeparator (ref _firstarray);
// This is an untagged structure. Cannot inherit.
//_Writer.WriteObjectStart();
//_Writer.WriteToken(_index.Tag(), 1);
bool firstinner = true;
_index.Serialize (_Writer, true, ref firstinner);
//_Writer.WriteObjectEnd();
}
_Writer.WriteArrayEnd ();
}
if (_wrap) {
_Writer.WriteObjectEnd ();
}
}
示例9: SerializeX
/// <summary>
/// Serialize this object to the specified output stream.
/// Unlike the Serlialize() method, this method is not inherited from the
/// parent class allowing a specific version of the method to be called.
/// </summary>
/// <param name="_Writer">Output stream</param>
/// <param name="_wrap">If true, output is wrapped with object
/// start and end sequences '{ ... }'.</param>
/// <param name="_first">If true, item is the first entry in a list.</param>
public new void SerializeX (Writer _Writer, bool _wrap, ref bool _first) {
if (_wrap) {
_Writer.WriteObjectStart ();
}
((MeshResponse)this).SerializeX(_Writer, false, ref _first);
if (__LastWriteTime){
_Writer.WriteObjectSeparator (ref _first);
_Writer.WriteToken ("LastWriteTime", 1);
_Writer.WriteDateTime (LastWriteTime);
}
if (__LastCheckpointTime){
_Writer.WriteObjectSeparator (ref _first);
_Writer.WriteToken ("LastCheckpointTime", 1);
_Writer.WriteDateTime (LastCheckpointTime);
}
if (__NextCheckpointTime){
_Writer.WriteObjectSeparator (ref _first);
_Writer.WriteToken ("NextCheckpointTime", 1);
_Writer.WriteDateTime (NextCheckpointTime);
}
if (CheckpointValue != null) {
_Writer.WriteObjectSeparator (ref _first);
_Writer.WriteToken ("CheckpointValue", 1);
_Writer.WriteString (CheckpointValue);
}
if (_wrap) {
_Writer.WriteObjectEnd ();
}
}
示例10: SerializeX
/// <summary>
/// Serialize this object to the specified output stream.
/// Unlike the Serlialize() method, this method is not inherited from the
/// parent class allowing a specific version of the method to be called.
/// </summary>
/// <param name="_Writer">Output stream</param>
/// <param name="_wrap">If true, output is wrapped with object
/// start and end sequences '{ ... }'.</param>
/// <param name="_first">If true, item is the first entry in a list.</param>
public new void SerializeX (Writer _Writer, bool _wrap, ref bool _first) {
if (_wrap) {
_Writer.WriteObjectStart ();
}
if (Key != null) {
_Writer.WriteObjectSeparator (ref _first);
_Writer.WriteToken ("Key", 1);
_Writer.WriteString (Key);
}
if (Entries != null) {
_Writer.WriteObjectSeparator (ref _first);
_Writer.WriteToken ("Entries", 1);
_Writer.WriteArrayStart ();
bool _firstarray = true;
foreach (var _index in Entries) {
_Writer.WriteArraySeparator (ref _firstarray);
// This is an untagged structure. Cannot inherit.
//_Writer.WriteObjectStart();
//_Writer.WriteToken(_index.Tag(), 1);
bool firstinner = true;
_index.Serialize (_Writer, true, ref firstinner);
//_Writer.WriteObjectEnd();
}
_Writer.WriteArrayEnd ();
}
if (_wrap) {
_Writer.WriteObjectEnd ();
}
}
示例11: SerializeX
/// <summary>
/// Serialize this object to the specified output stream.
/// Unlike the Serlialize() method, this method is not inherited from the
/// parent class allowing a specific version of the method to be called.
/// </summary>
/// <param name="_Writer">Output stream</param>
/// <param name="_wrap">If true, output is wrapped with object
/// start and end sequences '{ ... }'.</param>
/// <param name="_first">If true, item is the first entry in a list.</param>
public new void SerializeX (Writer _Writer, bool _wrap, ref bool _first) {
if (_wrap) {
_Writer.WriteObjectStart ();
}
if (Sites != null) {
_Writer.WriteObjectSeparator (ref _first);
_Writer.WriteToken ("Sites", 1);
_Writer.WriteArrayStart ();
bool _firstarray = true;
foreach (var _index in Sites) {
_Writer.WriteArraySeparator (ref _firstarray);
_Writer.WriteString (_index);
}
_Writer.WriteArrayEnd ();
}
if (DNS != null) {
_Writer.WriteObjectSeparator (ref _first);
_Writer.WriteToken ("DNS", 1);
_Writer.WriteArrayStart ();
bool _firstarray = true;
foreach (var _index in DNS) {
_Writer.WriteArraySeparator (ref _firstarray);
// This is an untagged structure. Cannot inherit.
//_Writer.WriteObjectStart();
//_Writer.WriteToken(_index.Tag(), 1);
bool firstinner = true;
_index.Serialize (_Writer, true, ref firstinner);
//_Writer.WriteObjectEnd();
}
_Writer.WriteArrayEnd ();
}
if (Prefix != null) {
_Writer.WriteObjectSeparator (ref _first);
_Writer.WriteToken ("Prefix", 1);
_Writer.WriteArrayStart ();
bool _firstarray = true;
foreach (var _index in Prefix) {
_Writer.WriteArraySeparator (ref _firstarray);
_Writer.WriteString (_index);
}
_Writer.WriteArrayEnd ();
}
if (CTL != null) {
_Writer.WriteObjectSeparator (ref _first);
_Writer.WriteToken ("CTL", 1);
_Writer.WriteBinary (CTL);
}
if (WebPKI != null) {
_Writer.WriteObjectSeparator (ref _first);
_Writer.WriteToken ("WebPKI", 1);
_Writer.WriteArrayStart ();
bool _firstarray = true;
foreach (var _index in WebPKI) {
_Writer.WriteArraySeparator (ref _firstarray);
_Writer.WriteString (_index);
}
_Writer.WriteArrayEnd ();
}
if (_wrap) {
_Writer.WriteObjectEnd ();
}
}