public override void Initialize(DrawArgs drawArgs) { DirectoryInfo pathsDir = new DirectoryInfo(pathsDirectoryPath); if (!pathsDir.Exists) { return; } FileInfo indexFileInfo = new FileInfo(Path.Combine(pathsDir.FullName, "pathlist.idx")); FileInfo dataFileInfo = new FileInfo(Path.Combine(pathsDir.FullName, "pathlist.pkg")); if (indexFileInfo.Exists && dataFileInfo.Exists) { using (BufferedStream indexFileStream = new BufferedStream(indexFileInfo.OpenRead())) { using (BinaryReader indexFileReader = new BinaryReader(indexFileStream, Encoding.ASCII)) { dataArchiveReader = new BinaryReader(new BufferedStream(dataFileInfo.OpenRead()), Encoding.ASCII); int count = indexFileReader.ReadInt32(); for (int i = 0; i < count; i++) { string fileName = indexFileReader.ReadString(); double west = indexFileReader.ReadDouble(); double south = indexFileReader.ReadDouble(); double east = indexFileReader.ReadDouble(); double north = indexFileReader.ReadDouble(); long offset = indexFileReader.ReadInt64(); TerrainPath tp = new TerrainPath(fileName, parentWorld, minDisplayAltitude, maxDisplayAltitude, dataArchiveReader, offset, 0, north, south, east, west, (float)altitude, color, terrainAccessor); tp.ParentList = this; m_children.Add(tp); } } } } else { foreach (FileInfo file in pathsDir.GetFiles("*.wwb")) { m_children.Add(new TerrainPath(file.Name, parentWorld, minDisplayAltitude, maxDisplayAltitude, file.FullName, (float)altitude, color, terrainAccessor)); } } Inited = true; }
public override void Initialize(DrawArgs drawArgs) { DirectoryInfo pathsDir = new DirectoryInfo(pathsDirectoryPath); if(!pathsDir.Exists) { return; } FileInfo indexFileInfo = new FileInfo( Path.Combine( pathsDir.FullName, "pathlist.idx" )); FileInfo dataFileInfo = new FileInfo( Path.Combine( pathsDir.FullName, "pathlist.pkg" )); if(indexFileInfo.Exists && dataFileInfo.Exists) { using( BufferedStream indexFileStream = new BufferedStream(indexFileInfo.OpenRead()) ) using( BinaryReader indexFileReader = new BinaryReader(indexFileStream, System.Text.Encoding.ASCII) ) { dataArchiveReader = new BinaryReader(new BufferedStream(dataFileInfo.OpenRead()), System.Text.Encoding.ASCII); int count = indexFileReader.ReadInt32(); for(int i = 0; i < count; i++) { string fileName = indexFileReader.ReadString(); double west = indexFileReader.ReadDouble(); double south = indexFileReader.ReadDouble(); double east = indexFileReader.ReadDouble(); double north = indexFileReader.ReadDouble(); long offset = indexFileReader.ReadInt64(); TerrainPath tp = new TerrainPath( fileName, parentWorld, minDisplayAltitude, maxDisplayAltitude, dataArchiveReader, offset, 0, north, south, east, west, (float)altitude, color, terrainAccessor); tp.ParentList = this; m_children.Add(tp); } } } else { foreach(FileInfo file in pathsDir.GetFiles("*.wwb")) { m_children.Add(new TerrainPath(file.Name, parentWorld, minDisplayAltitude, maxDisplayAltitude, file.FullName, (float)altitude, color, terrainAccessor)); } } isInitialized = true; }