public static void BinaryToTree(String BinaryPath, String TreePath, String MainType) { var TypeName = ObjectSchemaExtensions.GetDotNetFullNameFromVersionedName(MainType); var a = SchemaAssembly(); var t = a.GetType(TypeName); if (t == null) { throw new InvalidOperationException("TypeNotExist: " + TypeName); } var tbc = TreeBinaryConverter(); Byte[] Data; using (var s = Streams.OpenReadable(BinaryPath)) { Data = s.Read((int)(s.Length)); } var x = tbc.BinaryToTree(t, Data); var Dir = FileNameHandling.GetFileDirectory(TreePath); if (Dir != "" && !Directory.Exists(Dir)) { Directory.CreateDirectory(Dir); } TreeFile.WriteFile(TreePath, x); }
public static void TreeToBinary(String TreePath, String BinaryPath, String MainType) { var TypeName = ObjectSchemaExtensions.GetDotNetFullNameFromVersionedName(MainType); var a = SchemaAssembly(); var t = a.GetType(TypeName); if (t == null) { throw new InvalidOperationException("TypeNotExist: " + TypeName); } var tbc = TreeBinaryConverter(); var Data = TreeFile.ReadFile(TreePath); var b = tbc.TreeToBinary(t, Data); var Dir = FileNameHandling.GetFileDirectory(BinaryPath); if (Dir != "" && !Directory.Exists(Dir)) { Directory.CreateDirectory(Dir); } using (var s = Streams.CreateWritable(BinaryPath)) { s.Write(b); } }