示例#1
0
        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);
        }
示例#2
0
        /// <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;
            }
        }
示例#3
0
        /// <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;
            }
        }
示例#4
0
        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;
        }