예제 #1
0
        private void TestCommon(byte[] data, bool isBinary)
        {
            // Binary
            using (var streamIn = new MemoryStream(data))
                using (var streamOut = new MemoryStream())
                    using (var streamTmp = new MemoryStream())
                    {
                        if (isBinary)
                        {
                            var reader = new FbxBinaryReader(streamIn);
                            var doc    = reader.Read();
                            FbxIO.WriteAscii(doc, streamOut);

                            // read output again and ensure for correct output data
                            streamOut.Position = 0;
                            reader             = new FbxBinaryReader(streamOut);
                            FbxIO.WriteBinary(doc, streamTmp);
                        }
                        else
                        {
                            var reader = new FbxAsciiReader(streamIn);
                            var doc    = reader.Read();
                            FbxIO.WriteAscii(doc, streamOut);

                            // read output again and ensure for correct output data
                            streamOut.Position = 0;
                            reader             = new FbxAsciiReader(streamOut);
                            FbxIO.WriteAscii(doc, streamTmp);
                        }
                    }
        }
예제 #2
0
 public static FbxDocument AsciiToBinary(string data)
 {
     using (var s = data.ToStream()) {
         var reader = new FbxAsciiReader(s);
         return(reader.Read());
     }
 }
예제 #3
0
파일: Program.cs 프로젝트: hozuki0/Sazanka
        static void Main(string[] args)
        {
            //var document = FbxIO.ReadBinary(args[0]);
            //FbxIO.WriteAscii(document, Path.GetDirectoryName(args[0]) + "/test_ascii.fbx");
            var reader = new FbxAsciiReader(new FileStream(Path.GetDirectoryName(args[0]) + "/test_ascii.fbx", FileMode.Open));
            var doc    = reader.Read();

            FbxIO.WriteAscii(doc, Path.GetDirectoryName(args[0]) + "/test_ascii_2.fbx");
        }
예제 #4
0
 /// <summary>
 /// Reads an ASCII FBX file
 /// </summary>
 /// <param name="path"></param>
 /// <returns>The top level document node</returns>
 public static FbxDocument ReadAscii(string path)
 {
     if (path == null)
     {
         throw new ArgumentNullException(nameof(path));
     }
     using (var stream = new FileStream(path, FileMode.Open))
     {
         var reader = new FbxAsciiReader(stream);
         return(reader.Read());
     }
 }