Ejemplo n.º 1
0
        /// <summary>Takes the remaining content of the stream and deserialze it into the instance.</summary>
        public static Example.Msg Deserialize(Stream stream, Example.Msg instance)
        {
            while (true)
            {
                int keyByte = stream.ReadByte();
                if (keyByte == -1)
                    break;
                // Optimized reading of known fields with field ID < 16
                switch (keyByte)
                {
                    // Field 1 LengthDelimited
                    case 10:
                        instance.Name = global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadString(stream);
                        continue;
                    // Field 2 Varint
                    case 16:
                        instance.Age = (int)global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadUInt64(stream);
                        continue;
                }

                var key = global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadKey((byte)keyByte, stream);

                // Reading field ID > 16 and unknown field ID/wire type combinations
                switch (key.Field)
                {
                    case 0:
                        throw new global::SilentOrbit.ProtocolBuffers.ProtocolBufferException("Invalid field id: 0, something went wrong in the stream");
                    default:
                        global::SilentOrbit.ProtocolBuffers.ProtocolParser.SkipKey(stream, key);
                        break;
                }
            }

            return instance;
        }
Ejemplo n.º 2
0
        /// <summary>Takes the remaining content of the stream and deserialze it into the instance.</summary>
        public static Example.CDTIPlane Deserialize(Stream stream, Example.CDTIPlane instance)
        {
            while (true)
            {
                int keyByte = stream.ReadByte();
                if (keyByte == -1)
                    break;
                // Optimized reading of known fields with field ID < 16
                switch (keyByte)
                {
                    // Field 1 LengthDelimited
                    case 10:
                        instance.Id = global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadString(stream);
                        continue;
                    // Field 2 LengthDelimited
                    case 18:
                        if (instance.Position == null)
                            instance.Position = Example.Vector.DeserializeLengthDelimited(stream);
                        else
                            Example.Vector.DeserializeLengthDelimited(stream, instance.Position);
                        continue;
                    // Field 3 LengthDelimited
                    case 26:
                        if (instance.Velocity == null)
                            instance.Velocity = Example.Vector.DeserializeLengthDelimited(stream);
                        else
                            Example.Vector.DeserializeLengthDelimited(stream, instance.Velocity);
                        continue;
                    // Field 4 Varint
                    case 32:
                        instance.severity = (Example.CDTIPlane.Severity)global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadUInt64(stream);
                        continue;
                }

                var key = global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadKey((byte)keyByte, stream);

                // Reading field ID > 16 and unknown field ID/wire type combinations
                switch (key.Field)
                {
                    case 0:
                        throw new global::SilentOrbit.ProtocolBuffers.ProtocolBufferException("Invalid field id: 0, something went wrong in the stream");
                    default:
                        global::SilentOrbit.ProtocolBuffers.ProtocolParser.SkipKey(stream, key);
                        break;
                }
            }

            return instance;
        }
Ejemplo n.º 3
0
 public static void Main(string[] args)
 {
     Example example = new Example();
     DocxReport.CreateReportFromObject(example, Path.GetFullPath("./../.."), "", DocumentAction.OpenAction);
 }
Ejemplo n.º 4
0
 private void toUpper_completed__(Ice.AsyncResult r__, Example.Callback_Converter_toUpper cb__, Ice.ExceptionCallback excb__)
 {
     string ret__;
     try
     {
         ret__ = end_toUpper(r__);
     }
     catch(Ice.Exception ex__)
     {
         if(excb__ != null)
         {
             excb__(ex__);
         }
         return;
     }
     if(cb__ != null)
     {
         cb__(ret__);
     }
 }
Ejemplo n.º 5
0
        /// <summary>Read the VarInt length prefix and the given number of bytes from the stream and deserialze it into the instance.</summary>
        public static Example.Vector DeserializeLengthDelimited(Stream stream, Example.Vector instance)
        {
            BinaryReader br = new BinaryReader(stream);
            long limit = global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadUInt32(stream);
            limit += stream.Position;
            while (true)
            {
                if (stream.Position >= limit)
                {
                    if (stream.Position == limit)
                        break;
                    else
                        throw new global::SilentOrbit.ProtocolBuffers.ProtocolBufferException("Read past max limit");
                }
                int keyByte = stream.ReadByte();
                if (keyByte == -1)
                    throw new System.IO.EndOfStreamException();
                // Optimized reading of known fields with field ID < 16
                switch (keyByte)
                {
                    // Field 1 Fixed32
                    case 13:
                        instance.N = br.ReadSingle();
                        continue;
                    // Field 2 Fixed32
                    case 21:
                        instance.E = br.ReadSingle();
                        continue;
                    // Field 3 Fixed32
                    case 29:
                        instance.D = br.ReadSingle();
                        continue;
                }

                var key = global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadKey((byte)keyByte, stream);

                // Reading field ID > 16 and unknown field ID/wire type combinations
                switch (key.Field)
                {
                    case 0:
                        throw new global::SilentOrbit.ProtocolBuffers.ProtocolBufferException("Invalid field id: 0, something went wrong in the stream");
                    default:
                        global::SilentOrbit.ProtocolBuffers.ProtocolParser.SkipKey(stream, key);
                        break;
                }
            }

            return instance;
        }
Ejemplo n.º 6
0
 /// <summary>Helper: put the buffer into a MemoryStream before deserializing</summary>
 public static Example.Vector Deserialize(byte[] buffer, Example.Vector instance)
 {
     using (var ms = new MemoryStream(buffer))
         Deserialize(ms, instance);
     return instance;
 }
Ejemplo n.º 7
0
        /// <summary>Read the VarInt length prefix and the given number of bytes from the stream and deserialze it into the instance.</summary>
        public static Example.CDTIReport DeserializeLengthDelimited(Stream stream, Example.CDTIReport instance)
        {
            BinaryReader br = new BinaryReader(stream);
            instance.AdvisoryLevel = Example.CDTIReport.Severity.PROXIMATE;
            if (instance.Planes == null)
                instance.Planes = new List<Example.CDTIPlane>();
            long limit = global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadUInt32(stream);
            limit += stream.Position;
            while (true)
            {
                if (stream.Position >= limit)
                {
                    if (stream.Position == limit)
                        break;
                    else
                        throw new global::SilentOrbit.ProtocolBuffers.ProtocolBufferException("Read past max limit");
                }
                int keyByte = stream.ReadByte();
                if (keyByte == -1)
                    throw new System.IO.EndOfStreamException();
                // Optimized reading of known fields with field ID < 16
                switch (keyByte)
                {
                    // Field 1 Fixed64
                    case 9:
                        instance.Timestamp = br.ReadInt64();
                        continue;
                    // Field 2 LengthDelimited
                    case 18:
                        if (instance.Ownship == null)
                            instance.Ownship = Example.CDTIPlane.DeserializeLengthDelimited(stream);
                        else
                            Example.CDTIPlane.DeserializeLengthDelimited(stream, instance.Ownship);
                        continue;
                    // Field 3 LengthDelimited
                    case 26:
                        instance.AdvisoryMessage = global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadString(stream);
                        continue;
                    // Field 4 Varint
                    case 32:
                        instance.AdvisoryLevel = (Example.CDTIReport.Severity)global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadUInt64(stream);
                        continue;
                    // Field 5 LengthDelimited
                    case 42:
                        // repeated
                        instance.Planes.Add(Example.CDTIPlane.DeserializeLengthDelimited(stream));
                        continue;
                }

                var key = global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadKey((byte)keyByte, stream);

                // Reading field ID > 16 and unknown field ID/wire type combinations
                switch (key.Field)
                {
                    case 0:
                        throw new global::SilentOrbit.ProtocolBuffers.ProtocolBufferException("Invalid field id: 0, something went wrong in the stream");
                    default:
                        global::SilentOrbit.ProtocolBuffers.ProtocolParser.SkipKey(stream, key);
                        break;
                }
            }

            return instance;
        }
Ejemplo n.º 8
0
        /// <summary>Read the VarInt length prefix and the given number of bytes from the stream and deserialze it into the instance.</summary>
        public static Example.SCLoginNode DeserializeLengthDelimited(Stream stream, Example.SCLoginNode instance)
        {
            long limit = global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadUInt32(stream);
            limit += stream.Position;
            while (true)
            {
                if (stream.Position >= limit)
                {
                    if (stream.Position == limit)
                        break;
                    else
                        throw new global::SilentOrbit.ProtocolBuffers.ProtocolBufferException("Read past max limit");
                }
                int keyByte = stream.ReadByte();
                if (keyByte == -1)
                    throw new System.IO.EndOfStreamException();
                var key = global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadKey((byte)keyByte, stream);

                // Reading field ID > 16 and unknown field ID/wire type combinations
                switch (key.Field)
                {
                    case 0:
                        throw new global::SilentOrbit.ProtocolBuffers.ProtocolBufferException("Invalid field id: 0, something went wrong in the stream");
                    default:
                        global::SilentOrbit.ProtocolBuffers.ProtocolParser.SkipKey(stream, key);
                        break;
                }
            }

            return instance;
        }
Ejemplo n.º 9
0
        /// <summary>Read the given number of bytes from the stream and deserialze it into the instance.</summary>
        public static Example.CSLoginMain DeserializeLength(Stream stream, int length, Example.CSLoginMain instance)
        {
            long limit = stream.Position + length;
            while (true)
            {
                if (stream.Position >= limit)
                {
                    if (stream.Position == limit)
                        break;
                    else
                        throw new global::SilentOrbit.ProtocolBuffers.ProtocolBufferException("Read past max limit");
                }
                int keyByte = stream.ReadByte();
                if (keyByte == -1)
                    throw new System.IO.EndOfStreamException();
                // Optimized reading of known fields with field ID < 16
                switch (keyByte)
                {
                    // Field 1 LengthDelimited
                    case 10:
                        instance.AccountId = global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadString(stream);
                        continue;
                }

                var key = global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadKey((byte)keyByte, stream);

                // Reading field ID > 16 and unknown field ID/wire type combinations
                switch (key.Field)
                {
                    case 0:
                        throw new global::SilentOrbit.ProtocolBuffers.ProtocolBufferException("Invalid field id: 0, something went wrong in the stream");
                    default:
                        global::SilentOrbit.ProtocolBuffers.ProtocolParser.SkipKey(stream, key);
                        break;
                }
            }

            return instance;
        }
Ejemplo n.º 10
0
        /// <summary>Takes the remaining content of the stream and deserialze it into the instance.</summary>
        public static Example.SCLoginNode Deserialize(Stream stream, Example.SCLoginNode instance)
        {
            while (true)
            {
                int keyByte = stream.ReadByte();
                if (keyByte == -1)
                    break;
                var key = global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadKey((byte)keyByte, stream);

                // Reading field ID > 16 and unknown field ID/wire type combinations
                switch (key.Field)
                {
                    case 0:
                        throw new global::SilentOrbit.ProtocolBuffers.ProtocolBufferException("Invalid field id: 0, something went wrong in the stream");
                    default:
                        global::SilentOrbit.ProtocolBuffers.ProtocolParser.SkipKey(stream, key);
                        break;
                }
            }

            return instance;
        }
Ejemplo n.º 11
0
        /// <summary>Takes the remaining content of the stream and deserialze it into the instance.</summary>
        public static Example.Vector Deserialize(Stream stream, Example.Vector instance)
        {
            BinaryReader br = new BinaryReader(stream);
            while (true)
            {
                int keyByte = stream.ReadByte();
                if (keyByte == -1)
                    break;
                // Optimized reading of known fields with field ID < 16
                switch (keyByte)
                {
                    // Field 1 Fixed32
                    case 13:
                        instance.N = br.ReadSingle();
                        continue;
                    // Field 2 Fixed32
                    case 21:
                        instance.E = br.ReadSingle();
                        continue;
                    // Field 3 Fixed32
                    case 29:
                        instance.D = br.ReadSingle();
                        continue;
                }

                var key = global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadKey((byte)keyByte, stream);

                // Reading field ID > 16 and unknown field ID/wire type combinations
                switch (key.Field)
                {
                    case 0:
                        throw new global::SilentOrbit.ProtocolBuffers.ProtocolBufferException("Deserialize Invalid field id: 0, something went wrong in the stream");
                    default:
                        global::SilentOrbit.ProtocolBuffers.ProtocolParser.SkipKey(stream, key);
                        break;
                }
            }

            return instance;
        }
Ejemplo n.º 12
0
        private static void AddExample(CommandLineApplication app, string name, string description, Example example, CommandOption dataDirOption)
        {
            app.Command(name, (cmd) =>
            {
                cmd.Description = description;
                cmd.HelpOption("-?|-h|--help");
                cmd.OnExecute(() =>
                {
                    string dataDir = dataDirOption.Value();
                    FindDataDir(ref dataDir);

                    try
                    {
                        example.Execute(dataDir);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex);
                        return(1);
                    }

                    return(0);
                });
            });
        }