コード例 #1
0
        public static RoomPieceData GetData(string data)
        {
            RoomPieceData roomPieceData = new RoomPieceData();

            StringReader reader = new StringReader(data);

            string line = "";
            int lineNumber = 0;

            while ((line = reader.ReadLine()) != null)
            {
                lineNumber++;

                if (line == "[/ROOMPIECES]")
                {
                    break;
                }
                else if (line == "[LEVELSET]")
                {
                    roomPieceData.LevelSets.Add(ReadLevelSet(ref reader, ref lineNumber));
                }
            }

            reader.Close();
            reader.Dispose();

            return roomPieceData;
        }
コード例 #2
0
        public static string GetString(RoomPieceData roomPieceData)
        {
            StringBuilder builder = new StringBuilder();
            builder.AppendLine("[ROOMPIECES]");

            if (roomPieceData.LevelSets.Count > 0)
            {
                foreach (var levelSet in roomPieceData.LevelSets)
                {
                    builder.AppendLevelSet(levelSet);
                }
            }

            builder.Append("[/ROOMPIECES]");

            return builder.ToString();
        }
コード例 #3
0
ファイル: RawWriter.cs プロジェクト: andreberg/TLII.IO
        private void WriteRoomPieceDataFile(RoomPieceData roomPieceData)
        {
            _writer.Write(roomPieceData.LevelSets.Count);
            foreach (var levelset in roomPieceData.LevelSets)
            {
                WriteLevelset(levelset);
            }

            for (int i = 0; i < roomPieceData.LevelSets.Count; i++)
            {
                _writer.Write(roomPieceData.LevelSets[i].GUIDS.Count);
                foreach(var guid in roomPieceData.LevelSets[i].GUIDS)
                {
                    _writer.Write(guid); ;
                }
            }
        }
コード例 #4
0
ファイル: RawReader.cs プロジェクト: andreberg/TLII.IO
        private RoomPieceData ReadRoomPieceDataFile()
        {
            RoomPieceData rawFile = new RoomPieceData();

            int levelSetCount = _reader.ReadInt32();
            for (int i = 0; i < levelSetCount; i++)
            {
                rawFile.LevelSets.Add(ReadLevelset());
            }

            for (int i = 0; i < levelSetCount; i++)
            {
                int guidCount = _reader.ReadInt32();
                for (int j = 0; j < guidCount; j++)
                {
                    rawFile.LevelSets[i].GUIDS.Add(_reader.ReadInt64());
                }
            }

            return rawFile;
        }