示例#1
0
 public void Visit(TypeByte type)
 {
     if (id >= 0)
     {
         sw.WriteLine(prefix + bufname + ".WriteInt(Zeze.ByteBuffer.BYTE | " + id + " << Zeze.ByteBuffer.TAG_SHIFT);");
     }
     sw.WriteLine(prefix + bufname + ".WriteByte(" + varname + ");");
 }
示例#2
0
        public void Write(BinaryWriter bw)
        {
            bw.Write(data.Count);
            for (int i = 0; i < data.Count;)
            {
                TypeByte tb = determine(i);
                int      amount;
                bw.Write(tb);
                switch (tb.head)
                {
                case 0:
                    amount = tb.amount;
                    for (; amount > 0; amount--)
                    {
                        bw.Write((uint)((UID)data[i]).Value);
                        bw.Write((byte)data[i + 1]);
                        i += 2;
                    }
                    break;

                case 1:
                    amount = tb.amount;
                    for (; amount > 0; amount--)
                    {
                        bw.Write((uint)((Time)data[i]).Value);
                        bw.Write((byte)data[i + 1]);
                        i += 2;
                    }
                    break;

                case 2:
                    amount = tb.amount;
                    bw.Write((uint)((Time)data[i]).Value);
                    i++;
                    for (; amount > 0; amount--)
                    {
                        bw.Write((uint)((UID)data[i]).Value);
                        bw.Write((byte)data[i + 1]);
                        i += 2;
                    }
                    break;

                case 3:
                    amount = tb.amount;
                    for (; amount > 0; amount--)
                    {
                        bw.Write((uint)((Time)data[i]).Value);
                        bw.Write((uint)((UID)data[i + 1]).Value);
                        bw.Write((byte)data[i + 2]);
                        i += 3;
                    }
                    break;
                }
            }
        }
示例#3
0
 void Visitor.Visit(TypeByte type)
 {
     if (id >= 0)
     {
         sw.WriteLine(prefix + "case (Zeze.ByteBuffer.BYTE | " + id + " << Zeze.ByteBuffer.TAG_SHIFT): ");
         sw.WriteLine(prefix + "    " + varname + " = " + bufname + ".ReadByte();");
         sw.WriteLine(prefix + "    break;");
     }
     else
     {
         sw.WriteLine(prefix + varname + " = " + bufname + ".ReadByte();");
     }
 }
示例#4
0
 public void Visit(TypeByte type)
 {
     WriteProperty(type);
 }
示例#5
0
文件: Construct.cs 项目: e2wugui/zeze
 public void Visit(TypeByte type)
 {
     Initial();
 }
示例#6
0
 void Visitor.Visit(TypeByte type)
 {
     Type = Zeze.Serialize.ByteBuffer.BYTE;
 }
示例#7
0
 void Visitor.Visit(TypeByte type)
 {
     text = var.NamePrivate + (isEquals ? " == " : " != ") + another + "." + var.NamePrivate;
 }
示例#8
0
 void Visitor.Visit(TypeByte type)
 {
     ChangeVariableCollectorName = "Zeze.Transaction.ChangeVariableCollectorChanged()";
 }
示例#9
0
 void Visitor.Visit(TypeByte type)
 {
 }
示例#10
0
文件: TypeName.cs 项目: e2wugui/zeze
 public void Visit(TypeByte type)
 {
     name = "byte";
 }
示例#11
0
 public void Visit(TypeByte type)
 {
     text = varname + ".GetHashCode()";
 }
示例#12
0
文件: Compare.cs 项目: e2wugui/zeze
 public void Visit(TypeByte type)
 {
     text = variable.NamePrivate + ".CompareTo(" + another + "." + variable.NamePrivate + ")";
 }
示例#13
0
 /// <summary>
 /// Writes the element_type of the BSON Grammar
 /// </summary>
 /// <param name="type">The type.</param>
 void element_type(TypeByte type)
 {
     Write((byte)type);
 }
示例#14
0
 public void Visit(TypeByte type)
 {
     WriteLogValue(type);
 }
示例#15
0
文件: Default.cs 项目: e2wugui/zeze
 void Visitor.Visit(TypeByte type)
 {
     SetDefaultValue("0");
 }
示例#16
0
文件: Define.cs 项目: e2wugui/zeze
 public void Visit(TypeByte type)
 {
     DefineStack(type);
 }
示例#17
0
 public void Visit(TypeByte type)
 {
     name = "number";
 }
示例#18
0
        public static UndoList Read(BinaryReader br)
        {
            UndoList ret   = new UndoList();
            int      count = br.ReadInt32();

            for (int i = 0; i < count;)
            {
                TypeByte tb = br.ReadByte();
                int      amount;
                switch (tb.head)
                {
                case 0:
                    amount = tb.amount;
                    try {
                        for (; amount > 0; amount--)
                        {
                            ret.data.Add(new UID(br.ReadUInt32()));
                            ret.data.Add(br.ReadByte());
                            i += 2;
                        }
                    }
                    catch {
                    }
                    break;

                case 1:
                    amount = tb.amount;
                    try {
                        for (; amount > 0; amount--)
                        {
                            ret.data.Add(new Time(br.ReadUInt32()));
                            ret.data.Add(br.ReadByte());
                            i += 2;
                        }
                    }
                    catch {
                    }
                    break;

                case 2:
                    amount = tb.amount;
                    ret.data.Add(new Time(br.ReadUInt32()));
                    i++;
                    for (; amount > 0; amount--)
                    {
                        try {
                            ret.data.Add(new UID(br.ReadUInt32()));
                            ret.data.Add(br.ReadByte());
                        }
                        catch {
                            i = i;
                        }
                        i += 2;
                    }
                    break;

                case 3:
                    amount = tb.amount;
                    try {
                        for (; amount > 0; amount--)
                        {
                            ret.data.Add(new Time(br.ReadUInt32()));
                            ret.data.Add(new UID(br.ReadUInt32()));
                            ret.data.Add(br.ReadByte());
                            i += 3;
                        }
                    }
                    catch {
                    }
                    break;
                }
            }
            return(ret);
        }
示例#19
0
 void Visitor.Visit(TypeByte type)
 {
     Name = "Zeze.ByteBuffer.BYTE";
 }
示例#20
0
文件: Tostring.cs 项目: e2wugui/zeze
 void Visitor.Visit(TypeByte type)
 {
     sw.WriteLine(prefix + $"sb.Append(new string(' ', level * 4)).Append(\"{var}\").Append(\"=\").Append({var}).Append(\"{sep}\").Append(Environment.NewLine);");
 }