Пример #1
0
        private static async void ConvertChr(string path, string file)
        {
            var chrFiles = await S3DConverter.ReadS3DAsync($@"{path}{file}_chr.s3d");

            var zone = new Zone();

            ConvertCharacters(chrFiles, path, file, zone);
        }
Пример #2
0
        private static void ConvertS3Ds(string path, string file)
        {
            var taskS3dObjFiles = S3DConverter.ReadS3DAsync($@"{path}{file}_obj.s3d");
            var taskS3dFiles    = S3DConverter.ReadS3DAsync($@"{path}{file}.s3d");

            // We need the S3D to be fully parsed before we can continue.
            Task.WaitAll(taskS3dObjFiles, taskS3dFiles);

            // Left merge both so that we keep values in dictionary A if they exist in A and B.
            // Verified behavior with a smaller set of dictionaries.
            var s3dObjFilesDict = taskS3dObjFiles.Result.Merge(taskS3dFiles.Result);
            var s3dFilesDict    = taskS3dFiles.Result.Merge(taskS3dObjFiles.Result);

            var zone = new Zone();

            ConvertObjects(s3dObjFilesDict, $"{file}_obj.wld", zone);
            ConvertObjects(s3dFilesDict, "objects.wld", zone);
            ConvertLights(s3dFilesDict, "lights.wld", zone);
            ConvertZone(s3dFilesDict, $"{file}.wld", zone);

            zone.Output($@"{path}{file}.zip");
        }