private Stream OpenFbx(string path) { using (var cacheBundle = new PackedAssetBundle(Orange.The.Workspace.TangerineCacheBundle, AssetBundleFlags.Writable)) { var fbxPath = Path.ChangeExtension(path, "fbx"); if (!cacheBundle.FileExists(path) || GetFileLastWriteTime(fbxPath) > cacheBundle.GetFileLastWriteTime(path)) { var fullPath = Path.Combine(Orange.The.Workspace.AssetsDirectory, fbxPath); var model = new Orange.FbxModelImporter(fullPath, Orange.The.Workspace.ActiveTarget, new Dictionary <string, Orange.CookingRules>()).Model; TangerineYuzu.Instance.Value.WriteObjectToBundle(cacheBundle, path, model, Serialization.Format.Binary, ".t3d", AssetAttributes.None, new byte[0]); } } using (var cacheBundle = new PackedAssetBundle(Orange.The.Workspace.TangerineCacheBundle)) { return(cacheBundle.OpenFile(path)); } }
public bool IsActual() { using (var cacheBundle = new PackedAssetBundle(Orange.The.Workspace.TangerineCacheBundle, AssetBundleFlags.Writable)) { if (!cacheBundle.FileExists(VersionFile)) { return(false); } try { using (var stream = cacheBundle.OpenFile(VersionFile)) { var cacheMeta = Serialization.ReadObject <CacheMeta>(VersionFile, stream); if (!cacheMeta.IsActual) { return(false); } } } catch { return(false); } } return(true); }