Exemple #1
0
 private static void WritePath(BinaryWriter bw, Path path)
 {
     bw.WriteFixedLengthString(Encoding.UTF8, 128, path.Name);
     bw.WriteFixedLengthString(Encoding.UTF8, 128, path.Type);
     bw.Write((int)path.Direction);
     bw.Write(path.Nodes.Count);
     foreach (var node in path.Nodes)
     {
         WritePathNode(bw, node);
     }
 }
Exemple #2
0
 public Path Clone()
 {
     var p = new Path
                 {
                     Name = Name,
                     Type = Type,
                     Direction = Direction
                 };
     foreach (var n in Nodes.Select(node => node.Clone()))
     {
         n.Parent = p;
         p.Nodes.Add(n);
     }
     return p;
 }
Exemple #3
0
        private static Path ReadPath(BinaryReader br)
        {
            var path = new Path
            {
                Name      = br.ReadFixedLengthString(Encoding.UTF8, 128),
                Type      = br.ReadFixedLengthString(Encoding.UTF8, 128),
                Direction = (PathDirection)br.ReadInt32()
            };
            var numNodes = br.ReadInt32();

            for (var i = 0; i < numNodes; i++)
            {
                var node = ReadPathNode(br);
                node.Parent = path;
                path.Nodes.Add(node);
            }
            return(path);
        }
Exemple #4
0
 private static void WritePath(BinaryWriter bw, Path path)
 {
     bw.WriteFixedLengthString(Encoding.UTF8, 128, path.Name);
     bw.WriteFixedLengthString(Encoding.UTF8, 128, path.Type);
     bw.Write((int) path.Direction);
     bw.Write(path.Nodes.Count);
     foreach (var node in path.Nodes)
     {
         WritePathNode(bw, node);
     }
 }
Exemple #5
0
 private static Path ReadPath(BinaryReader br)
 {
     var path = new Path
         {
             Name = br.ReadFixedLengthString(Encoding.UTF8, 128),
             Type = br.ReadFixedLengthString(Encoding.UTF8, 128),
             Direction = (PathDirection) br.ReadInt32()
         };
     var numNodes = br.ReadInt32();
     for (var i = 0; i < numNodes; i++)
     {
         var node = ReadPathNode(br);
         node.Parent = path;
         path.Nodes.Add(node);
     }
     return path;
 }