Beispiel #1
0
        private void Save(
            string errorOutputPath,
            FarmSimulatorVersion version,
            ReverseEngineeringNamedShape1Object errorShape,
            byte[] rawData
            )
        {
            var outputDirectory = Path.Combine(errorOutputPath, errorShape.RawType.ToString(), errorShape.Flag);

            if (!Directory.Exists(outputDirectory))
            {
                Directory.CreateDirectory(outputDirectory);
            }

            var fileName = $"{errorShape.Flag}_[{errorShape.Id}]_{FileTools.CleanFileName(errorShape.Name)}.bin";
            var filePath = Path.Combine(outputDirectory, fileName);

            File.WriteAllBytes(filePath, rawData);
        }
Beispiel #2
0
        /// <summary>
        /// Save error parse shape in directory.
        /// </summary>
        /// <param name="version">Farming simulator version.</param>
        /// <param name="containerVersion">Container version.</param>
        /// <param name="shapeFileName">Shape file name.</param>
        /// <param name="rawShape"><inheritdoc cref="IRawNamedShapeObject"/></param>
        private static void SaveErrorShape(
            FarmSimulatorVersion version,
            short containerVersion,
            string shapeFileName,
            IRawNamedShapeObject rawShape
            )
        {
            var curentPath      = Directory.GetCurrentDirectory();
            var outputPath      = "Output";
            var outputDirectory = Path.Combine(
                curentPath,
                outputPath,
                version.ToString(),
                Path.GetFileName(shapeFileName)
                .Replace(GameConstants.SchapesFileExtension, "")
                );

            if (!Directory.Exists(outputDirectory))
            {
                Directory.CreateDirectory(outputDirectory);
            }

            var fileName = $"({containerVersion})[{rawShape.Id}]_[{rawShape.RawType}]_{FileTools.CleanFileName(rawShape.Name)}.bin";

            File.WriteAllBytes(Path.Combine(outputDirectory, fileName), rawShape.RawData);
        }