Esempio n. 1
0
 private void OpenFile(string file)
 {
     currentFile    = file;
     CurrentProject = ContentProject.Load(file);
     CurrentProject.CollectionChanged += CurrentProject_CollectionChanged;
     CurrentProject.PropertyChanged   += CurrentProject_PropertyChanged;
     RecalcTreeView();
 }
Esempio n. 2
0
        /// <summary>
        /// Opens a file with the given filename
        /// </summary>
        /// <param name="file"></param>
        private void OpenFile(string file)
        {
            Program.Configuration.LastFile = file;
            Program.Configuration.Save();

            CurrentProject = ContentProject.Load(file);
            CurrentProject.CollectionChanged += CurrentProject_CollectionChanged;
            CurrentProject.PropertyChanged   += CurrentProject_PropertyChanged;
            RecalcTreeView();
        }
Esempio n. 3
0
        public static int Main(string[] args)
        {
            Arguments = new Arguments();
            Arguments.ParseArguments(args);

            if (Arguments.Hidden)
            {
                ContentBuilder builder = new ContentBuilder(ContentProject.Load(Arguments.ContentProject));
                if (Arguments.Configuration.HasValue)
                {
                    builder.Project.Configuration = Arguments.Configuration.Value;
                }
                if (Arguments.OutputDirectory != null)
                {
                    builder.Project.OutputDir = Arguments.OutputDirectory;
                }
                builder.BuildMessage += (sender, e) =>
                {
                    if (e.MessageType == engenious.Content.Pipeline.BuildMessageEventArgs.BuildMessageType.Error)
                    {
                        Console.Error.WriteLine(Program.MakePathRelative(e.FileName) + e.Message);
                    }
                    else
                    {
                        Console.WriteLine(Program.MakePathRelative(e.FileName) + e.Message);
                    }
                };
                builder.BuildStatusChanged += (sender, buildStep) =>
                {
                    string message = (buildStep & (BuildStep.Build | BuildStep.Clean)).ToString() + " ";
                    bool   error   = false;
                    if (buildStep.HasFlag(Builder.BuildStep.Abort))
                    {
                        message += "aborted!";
                        error    = true;
                    }
                    else if (buildStep.HasFlag(Builder.BuildStep.Finished))
                    {
                        message += "finished!";
                        if (builder.FailedBuilds != 0)
                        {
                            message += " " + builder.FailedBuilds.ToString() + " files failed to build!";
                            error    = true;
                        }
                    }
                    if (error)
                    {
                        Console.Error.WriteLine(message);
                    }
                    else
                    {
                        Console.WriteLine(message);
                    }
                };
                builder.ItemProgress += (sender, e) =>
                {
                    string message = e.Item + " " + (e.BuildStep & (BuildStep.Build | BuildStep.Clean)).ToString().ToLower() + "ing ";

                    bool error = false;
                    if (e.BuildStep.HasFlag(Builder.BuildStep.Abort))
                    {
                        message += "failed!";
                        error    = true;
                    }
                    else if (e.BuildStep.HasFlag(Builder.BuildStep.Finished))
                    {
                        message += "finished!";
                    }
                    if (error)
                    {
                        Console.Error.WriteLine(message);
                    }
                    else
                    {
                        Console.WriteLine(message);
                    }
                };

                builder.Build();

                builder.Join();

                if (builder.FailedBuilds != 0)
                {
                    return(-1);
                }
            }
            else
            {
                System.Windows.Forms.Application.EnableVisualStyles();
                using (frmMain mainForm = new frmMain())
                {
                    System.Windows.Forms.Application.Run(mainForm);
                }
            }
            return(0);
        }