void eventSource_ProjectFinished(object sender, ProjectFinishedEventArgs e)
        {
            int           idx = IndexOfProjectTimeStamp(e.ProjectFile);
            DateTime      outputfiledatetime = DateTime.MinValue;
            StudioProject proj = new StudioProject(e.ProjectFile);
            FileInfo      outputFile;

            if (File.Exists(e.ProjectFile))
            {
                outputFile         = new FileInfo(proj.OutputFile());
                outputfiledatetime = outputFile.LastWriteTime;
            }

            //keep track of the mod date/time of the project output.
            //if the mod date changes as a result of the build, then that means the project changed.
            //this is necessary because the MSBuild engine doesn't tell us which projects were actually recompiled during a "build".
            //see also: http://stackoverflow.com/questions/34903800
            ProjectOutputTimeStamp p = outputs[idx];

            p.OutputDateTime_AfterBuild = outputfiledatetime;

            if (-1 < idx)
            {
                outputs[idx] = p;
            }

            indent--;
            WriteLine(String.Empty, e);
        }
Beispiel #2
0
        public void CreateProject()
        {
            var newProjDialog = new NewProjectWizard();

            if (newProjDialog.ShowDialog(this) == DialogResult.OK)
            {
                StudioCore.Instance.Project =
                    StudioProject.CreateProject(newProjDialog.ProjectPath, newProjDialog.ProjectName);
                StudioSettings.Instance.PushRecentProject(StudioCore.Instance.Project);
            }
        }
Beispiel #3
0
 public void LoadProject(String path)
 {
     if (StudioCore.Instance.Project != null)
     {
         StudioCore.Instance.Project.CacheManager.Dispose();
     }
     StudioCore.Instance.Project = StudioProject.OpenProject(path);
     StudioCore.Instance.Project.ThumbnailSize = (Int32)StudioSettings.Instance.ThumbnailSize;
     StudioSettings.Instance.PushRecentProject(StudioCore.Instance.Project);
     StartPage.Instance.Close();
 }
        /// <summary>
        ///     Creates a new instance of AssetBase.
        ///     Implementation depends on the file type.
        /// </summary>
        /// <param name="arguments">StudioProject project, String displayName, String filename</param>
        /// <returns></returns>
        public AssetBase Create(params object[] arguments)
        {
            // Check arguments
            if (arguments.Length != 3)
            {
                throw new ArgumentOutOfRangeException("Unexpected number of arguments!");
            }

            StudioProject project     = arguments[0] as StudioProject;
            string        displayName = arguments[1] as String;
            string        fileName    = arguments[2] as String;

            if (project == null || displayName == null || fileName == null)
            {
                throw new ArgumentException("Unexpected argument types!");
            }

            // Get extension and create loaders
            string extension = Path.GetExtension(fileName).ToLower();

            if (extension == ".jpg" || extension == ".bmp" || extension == ".png")
            {
                return new SingleFrameImageAsset(project, displayName, fileName)
                       {
                           FactoryName = GetType().FullName
                       }
            }
            ;
            if (extension == ".gif")
            {
                return new MultiFrameImageAsset(project, displayName, fileName)
                       {
                           FactoryName = GetType().FullName
                       }
            }
            ;

            throw new NotSupportedException("The file type is not supported by the asset loader factory!");
        }

        /// <summary>
        ///     Creates a new instance of AssetBase.
        ///     Implementation depends on the file type.
        /// </summary>
        /// <param name="arguments">StudioProject project, String displayName, String filename</param>
        /// <returns></returns>
        object IComponentFactory.Create(params object[] arguments)
        {
            return(Create(arguments));
        }
Beispiel #5
0
        /// <summary>
        /// Pushes a project into the recent projects list.
        /// Pinned projects will not be removed.
        /// </summary>
        /// <param name="project"></param>
        public void PushRecentProject(StudioProject project)
        {
            var existing =
                RecentProjects.FindIndex(i => i.ID.Equals(project.Guid));

            if (existing == -1)
            {
                logger.Info("Adding {0} to the recent project list.", project.Name);
                var info = new RecentProjectInfo
                {
                    ID       = project.Guid,
                    Name     = project.Name,
                    Path     = Path.Combine(project.ProjectDirectory, StudioProject.PROJECT_FILE),
                    IsPinned = false
                };

                // If the list if at capacity
                if (RecentProjects.Count >= RecentProjectsListCapacity)
                {
                    // Remove the last unpinned entry
                    var unpinned = RecentProjects.FindLastIndex(i => !i.IsPinned);
                    if (unpinned != -1)
                    {
                        RecentProjects.RemoveAt(unpinned);
                        RecentProjects.Insert(0, info);
                        FirePropertyChanged("RecentProjects");
                        logger.Trace("Recent projects list at capacity, removed the last unpinned.");
                    }
                    else
                    {
                        logger.Trace("Recent projects list at capacity, no unpinned entries to remove.");
                    }
                }
                else
                {
                    RecentProjects.Insert(0, info);
                    FirePropertyChanged("RecentProjects");
                }
            }
            else
            {
                logger.Info("Moving {0} to the top of the RecentProjects list.", project.Name);
                var info = RecentProjects[existing];
                RecentProjects.RemoveAt(existing);
                RecentProjects.Insert(0, info);
            }
        }
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="project">The project that this asset is associated with.</param>
        /// <param name="name">The name of the asset that is displayed to the user.</param>
        /// <param name="filename">The name of the asset file.</param>
        public MultiFrameImageAsset(StudioProject project, String name, String filename)
            : base(project, name, filename)
        {
            try
            {
                string path = Path.Combine(Project.GetAssetDirectory(), filename);

                // Load the image and get the frame count
                using (Image img = Image.FromFile(path))
                {
                    FrameDimension dimension = new FrameDimension(img.FrameDimensionsList[0]);
                    frameCount = img.GetFrameCount(dimension);
                }

                thumbnails = new Image[frameCount];
            }
            catch (Exception x) {
                Error = x;
            }
        }
Beispiel #7
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="project">The project that this asset is associated with.</param>
        /// <param name="name">The name of the asset that is displayed to the user.</param>
        /// <param name="filename">The name of the asset file.</param>
        public MultiFrameImageAsset(StudioProject project, String name, String filename)
            : base(project, name, filename)
        {
            try
            {
                string path = Path.Combine(Project.GetAssetDirectory(), filename);

                // Load the image and get the frame count
                using (Image img = Image.FromFile(path))
                {
                    FrameDimension dimension = new FrameDimension(img.FrameDimensionsList[0]);
                    frameCount = img.GetFrameCount(dimension);
                }

                thumbnails = new Image[frameCount];
            }
            catch (Exception x) {
                Error = x;
            }
        }
Beispiel #8
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="project">Project that this asset is associated with.</param>
 /// <param name="name">Display name of the asset file.</param>
 /// <param name="filename">Name of the asset file inside the asset directory.</param>
 public SingleFrameImageAsset(StudioProject project, String name, String filename)
     : base(project, name, filename)
 {
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="project">Project that this asset is associated with.</param>
 /// <param name="name">Display name of the asset file.</param>
 /// <param name="filename">Name of the asset file inside the asset directory.</param>
 public SingleFrameImageAsset(StudioProject project, String name, String filename)
     : base(project, name, filename)
 {
 }