Ejemplo n.º 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);
     }
 }
Ejemplo n.º 2
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);
        }