public static StudioProject CreateProject(String path, String name) { // Check argument if (path == null) { throw new ArgumentNullException("path"); } // Make sure root directory is there if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } // Set up the project var project = new StudioProject { Name = name, Fps = 10 }; project.ProjectDirectory = path; // Set up directories if (!Directory.Exists(project.GetAssetDirectory())) { Directory.CreateDirectory(project.GetAssetDirectory()); } project.SaveProject(); // Create cache project.CacheManager = new CacheManager(project); return(project); }
/// <summary> /// Constructor. /// </summary> /// <param name="project">The project that this asset is associated with.</param> /// <param name="name">Name of the asset.</param> /// <param name="filename">Name of the asset file in the asset folder.</param> protected AssetBase(StudioProject project, String name, String filename) { try { Project = project; Name = name; Filename = filename; string strID = Path.GetFileNameWithoutExtension(filename); ID = Guid.Parse(strID); if (!File.Exists(Path.Combine(Project.GetAssetDirectory(), Filename))) throw new FileNotFoundException("Asset file not found!"); } catch (Exception x) { Error = x; } }
/// <summary> /// Constructor. /// </summary> /// <param name="project">The project that this asset is associated with.</param> /// <param name="name">Name of the asset.</param> /// <param name="filename">Name of the asset file in the asset folder.</param> protected AssetBase(StudioProject project, String name, String filename) { try { Project = project; Name = name; Filename = filename; string strID = Path.GetFileNameWithoutExtension(filename); ID = Guid.Parse(strID); if (!File.Exists(Path.Combine(Project.GetAssetDirectory(), Filename))) { throw new FileNotFoundException("Asset file not found!"); } } catch (Exception x) { Error = x; } }
public static StudioProject CreateProject(String path, String name) { // Check argument if (path == null) throw new ArgumentNullException("path"); // Make sure root directory is there if (!Directory.Exists(path)) Directory.CreateDirectory(path); // Set up the project var project = new StudioProject { Name = name, Fps = 10 }; project.ProjectDirectory = path; // Set up directories if (!Directory.Exists(project.GetAssetDirectory())) Directory.CreateDirectory(project.GetAssetDirectory()); project.SaveProject(); // Create cache project.CacheManager = new CacheManager(project); return project; }