Beispiel #1
0
    public static void WriteToFile(ModelResourceInfo resourceInfo, string path)
    {
        using (var memoryStream = new MemoryStream())
        {
            var writer = new BinaryWriter(memoryStream);

            WriteStringDuplicateLengthPrefixed(writer, "mr"); // Header

            writer.Write(resourceInfo.ModelInfoList.Count);
            foreach (var modelInfo in resourceInfo.ModelInfoList)
            {
                WriteStringDuplicateLengthPrefixed(writer, modelInfo.file);
            }

            writer.Write(resourceInfo.AnimationInfoList.Count);
            foreach (var animationInfo in resourceInfo.AnimationInfoList)
            {
                WriteStringDuplicateLengthPrefixed(writer, animationInfo.symbol);
                WriteStringDuplicateLengthPrefixed(writer, animationInfo.skeletal);
                WriteStringDuplicateLengthPrefixed(writer, animationInfo.material);
            }

            File.WriteAllBytes(path, memoryStream.ToArray());
        }
    }
Beispiel #2
0
    public static ModelResourceInfo CreateResourceInfo(string[] modelNames, ModelResourceInfo.AnimationInfo[] animationInfos)
    {
        var resourceInfo = new ModelResourceInfo();

        resourceInfo.ModelInfoList.AddRange(modelNames.Select(fileName => new ModelResourceInfo.ModelInfo(fileName)));
        resourceInfo.AnimationInfoList.AddRange(animationInfos);
        return(resourceInfo);
    }