예제 #1
0
파일: Program.cs 프로젝트: huner15/saas
 private static CDTIPlane buildPlanes(double px, double py, double pz, double vx, double vy, double vz, string id)
 {
     CDTIPlane toReturn = new CDTIPlane();
     Vector v = new Vector();
     Vector p = new Vector();
     p.N = (float)px;
     p.E = (float)py;
     p.D = (float)pz;
     v.N = (float)vx;
     v.E = (float)vy;
     v.D = (float)vz;
     toReturn.Position = p;
     toReturn.Velocity = v;
     toReturn.Id = id;
     return toReturn;
 }
예제 #2
0
 /// <summary>Helper: Serialize with a varint length prefix</summary>
 public static void SerializeLengthDelimited(Stream stream, Vector instance)
 {
     var data = SerializeToBytes(instance);
     global::SilentOrbit.ProtocolBuffers.ProtocolParser.WriteUInt32(stream, (uint)data.Length);
     stream.Write(data, 0, data.Length);
 }
예제 #3
0
 /// <summary>Helper: Serialize into a MemoryStream and return its byte array</summary>
 public static byte[] SerializeToBytes(Vector instance)
 {
     using (var ms = new MemoryStream())
     {
         Serialize(ms, instance);
         return ms.ToArray();
     }
 }
예제 #4
0
 /// <summary>Serialize the instance into the stream</summary>
 public static void Serialize(Stream stream, Vector instance)
 {
     BinaryWriter bw = new BinaryWriter(stream);
     var msField = global::SilentOrbit.ProtocolBuffers.ProtocolParser.Stack.Pop();
     // Key for field: 1, Fixed32
     stream.WriteByte(13);
     bw.Write(instance.N);
     // Key for field: 2, Fixed32
     stream.WriteByte(21);
     bw.Write(instance.E);
     // Key for field: 3, Fixed32
     stream.WriteByte(29);
     bw.Write(instance.D);
     global::SilentOrbit.ProtocolBuffers.ProtocolParser.Stack.Push(msField);
 }
예제 #5
0
 /// <summary>Helper: create a new instance to deserializing into</summary>
 public static Vector DeserializeLengthDelimited(Stream stream)
 {
     Vector instance = new Vector();
     DeserializeLengthDelimited(stream, instance);
     return instance;
 }
예제 #6
0
 /// <summary>Helper: create a new instance to deserializing into</summary>
 public static Vector DeserializeLength(Stream stream, int length)
 {
     Vector instance = new Vector();
     DeserializeLength(stream, length, instance);
     return instance;
 }
예제 #7
0
 /// <summary>Helper: put the buffer into a MemoryStream and create a new instance to deserializing into</summary>
 public static Vector Deserialize(byte[] buffer)
 {
     Vector instance = new Vector();
     using (var ms = new MemoryStream(buffer))
         Deserialize(ms, instance);
     return instance;
 }
예제 #8
0
 /// <summary>Helper: create a new instance to deserializing into</summary>
 public static Vector Deserialize(Stream stream)
 {
     Vector instance = new Vector();
     Deserialize(stream, instance);
     return instance;
 }