コード例 #1
0
ファイル: ModelStorage.cs プロジェクト: adm244/CC98Unpacker
        public static bool SaveToStream(BinaryWriter outputWriter, Model model)
        {
            ModelStorage storage = new ModelStorage(string.Empty, model);

            if (!storage.Write(outputWriter))
            {
                Debug.Assert(false, "Cannot write a model file!");
                return(false);
            }

            return(true);
        }
コード例 #2
0
ファイル: ModelStorage.cs プロジェクト: adm244/CC98Unpacker
        public static bool SaveToFile(string filePath, Model model)
        {
            if (string.IsNullOrEmpty(filePath))
            {
                return(false);
            }

            ModelStorage storage = new ModelStorage(filePath, model);

            using (FileStream stream = new FileStream(storage.LibraryPath, FileMode.Create))
            {
                using (BinaryWriter outputWriter = new BinaryWriter(stream, storage.Encoding))
                {
                    if (!storage.Write(outputWriter))
                    {
                        Debug.Assert(false, "Cannot write a model file!");
                        return(false);
                    }
                }
            }

            return(true);
        }