public PlaygroundPointClass From(PlaygroundPoint point) { this.FID = point.FID; this.OBJECTID = point.OBJECTID; this.SHAPE = point.SHAPE; this.ANL_NAME = point.ANL_NAME; this.BEZIRK = point.BEZIRK; this.SPIELPLATZ_DETAIL = point.SPIELPLATZ_DETAIL; this.TYP_DETAIL = point.TYP_DETAIL; this.SE_ANNO_CAD_DATA = point.SE_ANNO_CAD_DATA; return(this); }
/// <summary> /// Read binary data based on index file. /// </summary> /// <returns></returns> private static void ReadBinaryData() { Console.Write("Enter an object id: "); var searchedObjectId = int.Parse(Console.ReadLine() ?? "0"); using Stream readStreamBinary = File.OpenRead("custom.dat"); using Stream readStreamIndexBinary = File.OpenRead("custom.idx.dat"); using var indexReader = new BinaryReader(readStreamIndexBinary, Encoding.UTF8); using var reader = new BinaryReader(readStreamBinary, Encoding.UTF8); while (indexReader.BaseStream.Position < indexReader.BaseStream.Length) { var position = indexReader.ReadInt64(); var objectId = indexReader.ReadInt32(); if (objectId != searchedObjectId) { continue; } Console.WriteLine($"found at position: {position}"); reader.BaseStream.Position = position; var currentItem = new PlaygroundPoint( FID: reader.ReadString(), OBJECTID: reader.ReadBoolean() ? new int?(reader.ReadInt32()) : null, SHAPE: reader.ReadString(), ANL_NAME: reader.ReadString(), BEZIRK: reader.ReadBoolean() ? new int?(reader.ReadInt32()) : null, SPIELPLATZ_DETAIL: reader.ReadString(), TYP_DETAIL: reader.ReadString(), SE_ANNO_CAD_DATA: reader.ReadString() ); WriteCollectionAsCsv(new[] { currentItem }, Console.OpenStandardOutput()); } }