void Path_HandleDestroyed(object sender, EventArgs e) { Binding = null; Core.OnAfterNew -= Core_OnAfterNew; Core.OnAfterSave -= Core_OnAfterSave; Core.OnAfterLoad -= Core_OnAfterLoad; }
void Path_HandleDestroyed(object sender, EventArgs e) { Binding = null; Core.OnAfterNew -= Core_OnAfterNew; Core.OnAfterSave -= Core_OnAfterSave; Core.OnAfterLoad -= Core_OnAfterLoad; if (player != null) { player.Stop(); player.Dispose(); player = null; } }
public static string GetModelPath(Data.Value.Path path) { var relativePath = path.RelativePath; var ext = System.IO.Path.GetExtension(relativePath); if (string.IsNullOrEmpty(ext)) { return(relativePath); } if (string.IsNullOrEmpty(System.IO.Path.GetDirectoryName(relativePath))) { relativePath = System.IO.Path.GetFileNameWithoutExtension(relativePath) + ".efkmodel"; } else { relativePath = System.IO.Path.ChangeExtension(relativePath, ".efkmodel"); } return(relativePath); }
public void SetBinding(object o) { var o_ = o as Data.Value.Path; Binding = o_; }
private FileInfo[] AddResourceDependencies(FileInfo file, Data.Value.Path resource) { if (resource is Data.Value.PathForModel) { if (Path.GetExtension(resource.AbsolutePath) != ".efkmodel") { FileInfo subfile = AddResource( Path.ChangeExtension(resource.AbsolutePath, ".efkmodel"), Path.ChangeExtension(resource.RelativePath, ".efkmodel"), FileType.Model); if (subfile != null) { return(new FileInfo[] { subfile }); } } } else if (resource is Data.Value.PathForCurve) { if (Path.GetExtension(resource.AbsolutePath) != ".efkcurve") { FileInfo subfile = AddResource( Path.ChangeExtension(resource.AbsolutePath, ".efkcurve"), Path.ChangeExtension(resource.RelativePath, ".efkcurve"), FileType.Curve); if (subfile != null) { return(new FileInfo[] { subfile }); } } } else if (resource is Data.Value.PathForMaterial) { var material = new MaterialInformation(); if (material.Load(file.Data)) { HashSet <FileInfo> dependencies = new HashSet <FileInfo>(); bool result = ReplaceMaterialPaths(material, (path) => { FileInfo subfile = AddResource( Utils.Misc.GetAbsolutePath(resource.AbsolutePath, path), path, FileType.Texture); if (subfile != null) { dependencies.Add(subfile); return(subfile.HashName); } return(path); }); if (result == false) { return(null); } file.Data = material.SaveToBytes(); return(dependencies.ToArray()); } } return(null); }