Ejemplo n.º 1
0
        void timer_Tick(object sender, EventArgs e)
        {
            progressBar.Value += GibboHelper.RandomNumber(4, 5);

            if (progressBar.Value >= 100)
            {
                this.progresslbl.Content = "Success!";
                (sender as System.Windows.Forms.Timer).Enabled = false;
                this.Close();
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Tries to create a project with the given information
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void createBtn_Click(object sender, RoutedEventArgs e)
        {
            // are the pre-requirements done?
            if (nameTxt.Text.Trim() != string.Empty && pathTxt.Text != string.Empty)
            {
                nameTxt.Text = nameTxt.Text.Trim();
                string path = pathTxt.Text + "\\" + nameTxt.Text;

                // does the project already exist?
                if (Directory.Exists(path))
                {
                    MessageBox.Show("There is already a project with that name, please choose another", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }

                GibboProject gp = new GibboProject(nameTxt.Text, pathTxt.Text);
                gp.Save();

                File.Copy("Project Templates\\Gibbo.Engine.Windows.exe", path + "\\Gibbo.Engine.Windows.exe", true);
                File.Copy("Project Templates\\GameProject.csproj", path + "\\Scripts.csproj", true);
                File.Copy("Project Templates\\settings.ini", path + "\\settings.ini", true);


                // Solution Preparations
                string slnFile = File.ReadAllText("Project Templates\\GameProject.sln");
                slnFile = slnFile.Replace("{%P_NAME%}", nameTxt.Text);

                // Solution Save
                File.WriteAllText(path + "\\Scripts.sln", slnFile);

                File.Copy("Gibbo.Library.dll", path + "\\Gibbo.Library.dll", true);

                GibboHelper.CopyDirectory("Project Templates\\libs", path + "", true);
                GibboHelper.CopyDirectory("Project Templates\\samples", path + "\\samples", true);

                File.Copy("MonoGame.Framework.dll", path + "\\MonoGame.Framework.dll", true);
                File.Copy("OpenTK.dll", path + "\\OpenTK.dll", true);

                ProjectPath  = gp.ProjectFilePath;
                DialogResult = true;
                this.Close();
            }
            else
            {
                MessageBox.Show("Fill all the required fields please.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Saves the current project using a different thread
        /// </summary>
        internal static void SaveProject()
        {
            if (SceneManager.GameProject != null)
            {
                // Save project in a different thread
                Thread saveThread = new Thread(() =>
                {
                    SceneManager.GameProject.Save();
                    if (UserPreferences.Instance != null)
                    {
                        GibboHelper.SerializeObject(SceneManager.GameProject.ProjectPath + "\\_userPrefs.pgb", UserPreferences.Instance);
                    }
                });

                EditorCommands.ShowOutputMessage("Project Saved");
                saveThread.Start();
            }
        }
        //private void AddNodes(GameObject obj)
        //{
        //    foreach (GameObject _obj in obj.Children)
        //    {
        //        AddGameObject(_obj.Transform.GameObject, null);
        //        //if (_obj.Children.Count > 0)
        //        //    AddNodes(_obj);
        //    }
        //}

        internal void AddFromState()
        {
            System.Windows.Forms.OpenFileDialog ofd = new System.Windows.Forms.OpenFileDialog();
            ofd.Title  = "Open State";
            ofd.Filter = @"(*.state)|*.state";

            if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                try
                {
                    GameObject gameObject = (GameObject)GibboHelper.DeserializeObject(ofd.FileName);
                    gameObject.Initialize();

                    AddGameObject(gameObject, string.Empty);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        ///
        /// </summary>
        public static bool ReloadScripts()
        {
            if (SceneManager.GameProject == null)
            {
                return(false);
            }

            lock (locker)
            {
                try
                {
                    if (File.Exists(SceneManager.GameProject.ProjectPath + @"\_Scripts.csproj"))
                    {
                        File.Delete(SceneManager.GameProject.ProjectPath + @"\_Scripts.csproj");
                    }
                    //search for .sln and .csproj files
                    foreach (string filename in Directory.GetFiles(SceneManager.GameProject.ProjectPath))
                    {
                        if (System.IO.Path.GetExtension(filename).ToLower().Equals(".csproj"))
                        {
                            UserPreferences.Instance.ProjectCsProjFilePath = filename;
                        }
                        else if (System.IO.Path.GetExtension(filename).ToLower().Equals(".sln"))
                        {
                            UserPreferences.Instance.ProjectSlnFilePath = filename;
                        }
                    }

                    // Check if scripts were removed:
                    bool removed = false;

                    string      projectFileName = UserPreferences.Instance.ProjectCsProjFilePath;
                    XmlDocument doc             = new XmlDocument();
                    doc.Load(projectFileName);

                    while (doc.GetElementsByTagName("ItemGroup").Count < 2)
                    {
                        doc.GetElementsByTagName("Project").Item(0).AppendChild(doc.CreateElement("ItemGroup"));
                    }

                    foreach (XmlNode _node in doc.GetElementsByTagName("ItemGroup").Item(1).ChildNodes)
                    {
                        if (_node.Name.ToLower().Equals("compile"))
                        {
                            if (!File.Exists(SceneManager.GameProject.ProjectPath + "\\" + _node.Attributes.GetNamedItem("Include").Value))
                            {
                                doc.GetElementsByTagName("ItemGroup").Item(1).RemoveChild(_node);
                                removed = true;
                            }
                        }
                    }

                    if (removed)
                    {
                        doc.Save(projectFileName);
                    }

                    string tmpProjectFileName = SceneManager.GameProject.ProjectPath + @"\_Scripts.csproj";
                    string hash = string.Empty;

                    hash = GibboHelper.EncryptMD5(DateTime.Now.ToString());

                    //try
                    //{
                    /* Change the assembly Name */
                    doc = new XmlDocument();
                    doc.Load(projectFileName);
                    doc.GetElementsByTagName("Project").Item(0).ChildNodes[0]["AssemblyName"].InnerText = hash;
                    doc.Save(tmpProjectFileName);
                    //}
                    //catch (Exception ex)
                    //{
                    //    Console.WriteLine(ex.Message);
                    //}

                    /* Compile project */
                    ProjectCollection           projectCollection = new ProjectCollection();
                    Dictionary <string, string> GlobalProperty    = new Dictionary <string, string>();
                    GlobalProperty.Add("Configuration", SceneManager.GameProject.Debug ? "Debug" : "Release");
                    GlobalProperty.Add("Platform", "x86");

                    //FileLogger logger = new FileLogger() { Parameters = @"logfile=C:\gibbo_log.txt" };
                    logger = new ErrorLogger();

                    BuildRequestData buildRequest = new BuildRequestData(tmpProjectFileName, GlobalProperty, null, new string[] { "Build" }, null);
                    BuildResult      buildResult  = BuildManager.DefaultBuildManager.Build(
                        new BuildParameters(projectCollection)
                    {
                        BuildThreadPriority = System.Threading.ThreadPriority.AboveNormal,
                        Loggers             = new List <ILogger>()
                        {
                            logger
                        }
                    },
                        buildRequest);

                    //foreach (var tr in logger.Errors)
                    //{
                    //    Console.WriteLine(tr.ToString());
                    //}

                    //Console.WriteLine(buildResult.OverallResult);

                    string cPath = SceneManager.GameProject.ProjectPath + @"\bin\" + (SceneManager.GameProject.Debug ? "Debug" : "Release") + "\\" + hash + ".dll";

                    if (File.Exists(cPath))
                    {
                        /* read assembly to memory without locking the file */
                        byte[] readAllBytes = File.ReadAllBytes(cPath);
                        SceneManager.ScriptsAssembly = Assembly.Load(readAllBytes);

                        if (SceneManager.ActiveScene != null)
                        {
                            SceneManager.ActiveScene.SaveComponentValues();
                            SceneManager.ActiveScene.Initialize();
                        }

                        //Console.WriteLine("Path: " + SceneManager.ScriptsAssembly.GetName().Name);
                    }
                    else
                    {
                        File.Delete(tmpProjectFileName);
                        return(false);
                    }

                    File.Delete(tmpProjectFileName);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
                return(true);
            }
        }
        void contextMenu_Opened(object sender, RoutedEventArgs e)
        {
            // check disabled :
            if (TreeViewExtension.GetSelectedTreeViewItems(treeView).Count > 1)
            {
                // more than one selected:
                renameItem.IsEnabled    = false;
                moveUpItem.IsEnabled    = false;
                moveDownItem.IsEnabled  = false;
                saveStateItem.IsEnabled = false;
            }
            else
            {
                renameItem.IsEnabled    = true;
                moveUpItem.IsEnabled    = true;
                moveDownItem.IsEnabled  = true;
                saveStateItem.IsEnabled = true;
            }

            addComponentItem.Items.Clear();
            GibboMenuItem item = null;

            if (SceneManager.ScriptsAssembly == null)
            {
                addComponentItem.Visibility = System.Windows.Visibility.Collapsed;
                return;
            }
            else
            {
                addComponentItem.Visibility = System.Windows.Visibility.Visible;

                //ObjectComponent dummy = new ObjectComponent();
                foreach (Type type in SceneManager.ScriptsAssembly.GetTypes())
                {
                    // is a game object component?
                    if (type.IsSubclassOf(typeof(ObjectComponent)))
                    {
                        string        fullname = type.FullName;
                        GibboMenuItem lastItem = addComponentItem;

                        if (fullname != type.Name && fullname.Contains('.'))
                        {
                            string[] splitted = fullname.Split('.');
                            int      scount   = splitted.Count() - 1;

                            for (int i = 0; i < scount; i++)
                            {
                                item = null;
                                string camelCaseFix = GibboHelper.SplitCamelCase(splitted[i]);

                                for (int j = 0; j < lastItem.Items.Count; j++)
                                {
                                    if ((lastItem.Items[j] as GibboMenuItem).TagText.Equals(camelCaseFix))
                                    {
                                        item = lastItem.Items[j] as GibboMenuItem;
                                        break;
                                    }
                                }

                                if (item == null)
                                {
                                    item         = EditorUtils.CreateMenuItem(camelCaseFix, null);
                                    item.TagText = camelCaseFix;
                                    lastItem.Items.Insert(0, item);
                                }

                                lastItem = item;
                            }
                        }

                        string        camelCase = GibboHelper.SplitCamelCase(type.Name);
                        GibboMenuItem newItem   = EditorUtils.CreateMenuItem(camelCase, (ImageSource)FindResource("ComponentItemIcon"));
                        newItem.Tag     = type;
                        newItem.TagText = camelCase;
                        newItem.Click  += newItem_Click;

                        SearchAndAttachInfo(newItem, type);

                        lastItem.Items.Add(newItem);
                    }
                }
            }

            // System Components :
            GibboMenuItem subItem;

            addComponentItem.Items.Add(new Separator());
            item = EditorUtils.CreateMenuItem("Physics");

            subItem         = EditorUtils.CreateMenuItem("Physical Body", (ImageSource)FindResource("ComponentItemIcon"));
            subItem.Tag     = typeof(PhysicalBody);
            subItem.TagText = typeof(PhysicalBody).Name;
            subItem.Click  += newItem_Click;

            SearchAndAttachInfo(subItem, typeof(PhysicalBody));

            item.Items.Add(subItem);

            subItem         = EditorUtils.CreateMenuItem("Rectangle Body", (ImageSource)FindResource("ComponentItemIcon"));
            subItem.Tag     = typeof(RectangleBody);
            subItem.TagText = typeof(RectangleBody).Name;
            subItem.Click  += newItem_Click;

            SearchAndAttachInfo(subItem, typeof(RectangleBody));

            item.Items.Add(subItem);

            subItem         = EditorUtils.CreateMenuItem("Circle Body", (ImageSource)FindResource("ComponentItemIcon"));
            subItem.Tag     = typeof(CircleBody);
            subItem.TagText = typeof(CircleBody).Name;
            subItem.Click  += newItem_Click;

            SearchAndAttachInfo(subItem, typeof(CircleBody));

            item.Items.Add(subItem);

            subItem         = EditorUtils.CreateMenuItem("Texture Body", (ImageSource)FindResource("ComponentItemIcon"));
            subItem.Tag     = typeof(TextureBody);
            subItem.TagText = typeof(TextureBody).Name;
            subItem.Click  += newItem_Click;

            SearchAndAttachInfo(subItem, typeof(TextureBody));

            item.Items.Add(subItem);

            addComponentItem.Items.Add(item);
        }
Ejemplo n.º 7
0
        public static bool DeployProject(string projectPath, string destinationPath, string platform)
        {
            List <string> blockedDirs = new List <string>();

            blockedDirs.Add("bin");
            blockedDirs.Add("obj");

            List <string> blockedFileExtensions = new List <string>();

            blockedFileExtensions.Add(".cs");
            //blockedFileExtensions.Add(".gibbo");
            blockedFileExtensions.Add(".csproj");
            blockedFileExtensions.Add(".sln");

            switch (platform.ToLower())
            {
            case "windows":
                // creates shadow directories
                foreach (string dirPath in Directory.GetDirectories(projectPath, "*", SearchOption.AllDirectories))
                {
                    Directory.CreateDirectory(dirPath.Replace(projectPath, destinationPath));
                }

                // clear blocked directories from the root folder:
                foreach (string dirPath in Directory.GetDirectories(destinationPath, "*", SearchOption.TopDirectoryOnly))
                {
                    if (blockedDirs.Contains(System.IO.Path.GetFileName(dirPath)))
                    {
                        Directory.Delete(dirPath, true);
                    }
                }

                // copy all the files
                foreach (string path in Directory.GetFiles(projectPath, "*.*", SearchOption.AllDirectories))
                {
                    string filename = System.IO.Path.GetFileName(path);
                    string ext      = System.IO.Path.GetExtension(path);
                    if (!blockedFileExtensions.Contains(ext) &&
                        Directory.Exists(System.IO.Path.GetDirectoryName(path.Replace(projectPath, destinationPath))))
                    {
                        if (filename.ToLower().Equals("gibbo.engine.windows.exe"))
                        {
                            File.Copy(path, System.IO.Path.GetDirectoryName(path.Replace(projectPath, destinationPath)) + "\\" + SceneManager.GameProject.ProjectName + ".exe", true);
                        }
                        else
                        {
                            File.Copy(path, path.Replace(projectPath, destinationPath), true);
                        }
                    }
                }

                RemoveEmptyFolders(destinationPath, SearchOption.AllDirectories);

                return(true);

            case "windowsstore":
                // creates shadow directories
                foreach (string dirPath in Directory.GetDirectories(projectPath, "*", SearchOption.AllDirectories))
                {
                    Directory.CreateDirectory(destinationPath.Replace(projectPath, destinationPath));
                }

                //Copy all the files
                foreach (string path in Directory.GetFiles(projectPath, "*.*", SearchOption.AllDirectories))
                {
                    if (!Directory.Exists(System.IO.Path.GetDirectoryName(path.Replace(projectPath, destinationPath))))
                    {
                        Directory.CreateDirectory(System.IO.Path.GetDirectoryName(path.Replace(projectPath, destinationPath)));
                    }

                    if (path.ToLower().EndsWith(".scene"))
                    {
                        GameScene scene = (GameScene)GibboHelper.DeserializeObject(path);
                        GibboHelper.SerializeObjectXML(path.Replace(projectPath, destinationPath), scene);
                    }
                    else if (path.ToLower().EndsWith(".gibbo"))
                    {
                        GibboProject gp = (GibboProject)GibboHelper.DeserializeObject(path);
                        GibboHelper.SerializeObjectXML(path.Replace(projectPath, destinationPath), gp);
                    }
                    else
                    {
                        File.Copy(path, path.Replace(projectPath, destinationPath), true);
                    }
                }

                RemoveEmptyFolders(destinationPath, SearchOption.AllDirectories);

                return(true);
            }

            return(false);
        }
Ejemplo n.º 8
0
        /// <summary>
        ///
        /// </summary>
        internal static void DebugGame()
        {
            if (SceneManager.ActiveScene == null)
            {
                MessageBox.Show("Ups!\n\nThere is no scene loaded", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            SceneManager.GameProject.SceneStartPath = GibboHelper.MakeExclusiveRelativePath(SceneManager.GameProject.ProjectPath, SceneManager.ActiveScenePath);

            SaveProject();
            SaveScene(false);

            if (File.Exists(SceneManager.GameProject.ProjectPath + "\\Gibbo.Engine.Windows.exe"))
            {
                if (File.Exists(SceneManager.GameProject.ProjectPath + "\\libs\\Scripts.dll"))
                {
                    File.Delete(SceneManager.GameProject.ProjectPath + "\\libs\\Scripts.dll");
                }

                if (!Directory.Exists(SceneManager.GameProject.ProjectPath + "\\libs"))
                {
                    Directory.CreateDirectory(SceneManager.GameProject.ProjectPath + "\\libs");
                }

                // Compile scripts:
                // old (depracated): CompileScripts(false);
                //if (SceneManager.ScriptsAssembly != null)
                //{
                string dllpath = SceneManager.GameProject.ProjectPath + "\\bin\\" + (SceneManager.GameProject.Debug ? "Debug" : "Release") + "\\" + SceneManager.ScriptsAssembly.GetName().Name + ".dll";

                // The scripts .dll exists?
                if (!File.Exists(dllpath))
                {
                    // Compile scripts
                    CompilerWindow cf = new CompilerWindow();
                    cf.ShowDialog();

                    if (cf.DialogResult.Value)
                    {
                        return;
                    }

                    // Update path
                    dllpath = SceneManager.GameProject.ProjectPath + "\\bin\\" + (SceneManager.GameProject.Debug ? "Debug" : "Release") + "\\" + SceneManager.ScriptsAssembly.GetName().Name + ".dll";
                }

                File.Copy(dllpath, SceneManager.GameProject.ProjectPath + "\\libs\\Scripts.dll", true);

                try
                {
                    Process debug = new Process();
                    debug.StartInfo.WorkingDirectory = SceneManager.GameProject.ProjectPath;
                    debug.StartInfo.FileName         = SceneManager.GameProject.ProjectPath + "\\Gibbo.Engine.Windows.exe";
                    debug.StartInfo.Arguments        = "";
                    debug.StartInfo.CreateNoWindow   = true;
                    debug.Start();

                    if (Properties.Settings.Default.AttachVisualStudio)
                    {
                        EnvDTE.DTE vsInstance;

                        // Try to restore the current project visual studio solution instance, returning it if successful
                        if (TryToRestoreSolution(out vsInstance))
                        {
                            // Tries to attach the retrieved instance to the game debug process
                            debug.Attach(vsInstance);
                        }

                        /*
                         * if (VisualStudioInstancePID != 0 && Extensions.TryToRetrieveVSInstance(VisualStudioInstancePID, out vsInstance))
                         * {
                         *  // restore window, in case the process is only running on background
                         *  vsInstance.MainWindow.Visible = true;
                         *
                         *  debug.Attach(vsInstance);
                         * }
                         * else // if PID attempt failed, try using the project solution name
                         * {
                         *  // reset PID
                         *  VisualStudioInstancePID = 0;
                         *
                         *  // try to retrieve instance based on solution name
                         *  vsInstance = Extensions.GetInstance(UserPreferences.Instance.ProjectSlnFilePath);
                         *  if (vsInstance != null)
                         *  {
                         *      // restore window, in case the process is only running on background
                         *      vsInstance.MainWindow.Visible = true;
                         *
                         *      debug.Attach(vsInstance); // Attach visual studio dte
                         *  }
                         * }*/
                    }

                    debug.WaitForExit();
                    debug.Close();
                }
                catch (Exception ex)
                {
                    Console.WriteLine("ERROR: " + ex.Message);
                }
            }
            else
            {
                MessageBox.Show("Ups!\n\nIt seems there is no engine set up for your game!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 9
0
        internal static bool LoadProject(string filename)
        {
            try
            {
                if (File.Exists(filename))
                {
                    SceneManager.GameProject = GibboProject.Load(filename);

                    //File.Copy("Farseer Engine MonoGame OpenGL.dll", SceneManager.GameProject.ProjectPath + "\\Farseer Engine MonoGame OpenGL.dll", true);
                    File.Copy("Gibbo.Library.dll", SceneManager.GameProject.ProjectPath + "\\Gibbo.Library.dll", true);
                    File.Copy("Project Templates\\Gibbo.Library.xml", SceneManager.GameProject.ProjectPath + "\\Gibbo.Library.xml", true);
                    File.Copy("Project Templates\\Gibbo.Engine.Windows.exe", SceneManager.GameProject.ProjectPath + "\\Gibbo.Engine.Windows.exe", true);
                    GibboHelper.CopyDirectory("Project Templates\\libs", SceneManager.GameProject.ProjectPath + "", true);
                    File.Copy("MonoGame.Framework.dll", SceneManager.GameProject.ProjectPath + "\\MonoGame.Framework.dll", true);
                    File.Copy("OpenTK.dll", SceneManager.GameProject.ProjectPath + "\\OpenTK.dll", true);
                    // load user settings:
                    if (!File.Exists(SceneManager.GameProject.ProjectPath + "\\_userPrefs.pgb"))
                    {
                        UserPreferences.Instance = new UserPreferences();
                        GibboHelper.SerializeObject(SceneManager.GameProject.ProjectPath + "\\_userPrefs.pgb", UserPreferences.Instance);
                    }
                    else
                    {
                        UserPreferences.Instance = GibboHelper.DeserializeObject(SceneManager.GameProject.ProjectPath + "\\_userPrefs.pgb") as Model.UserPreferences;
                    }

                    SceneManager.ActiveScene = null;
                    EditorHandler.SelectedGameObjects.Clear();
                    EditorHandler.ChangeSelectedObjects();
                    EditorHandler.SceneTreeView.CreateView();
                    EditorHandler.ProjectTreeView.CreateView();

                    CompilerWindow cf = new CompilerWindow();
                    cf.ShowDialog();
                    bool success = cf.Result;

                    Reload();

                    if (success)
                    {
                        LoadLastScene();

                        EditorCommands.ShowOutputMessage("Project loaded with success");

                        //kryptonNavigator1.SelectedIndex = 1;
                    }
                    else
                    {
                        EditorCommands.ShowOutputMessage("Project loaded with script errors");
                    }

                    EditorHandler.Settings = new IniFile(SceneManager.GameProject.ProjectPath + "\\settings.ini");

                    return(true);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Invalid File\n\n" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            return(false);
        }
Ejemplo n.º 10
0
        public StartupForm()
        {
            if (System.Deployment.Application.ApplicationDeployment.IsNetworkDeployed)
            {
                new SplashWindow().ShowDialog(); // display splash only on releases
            }
            while (Gibbo.Editor.WPF.Properties.Settings.Default.UserEmail.Equals(string.Empty))
            {
                new FirstLoginWindow().ShowDialog();
            }

            // is this a deployed application?
            // we don't want it to send requests while debbuging.
            if (IsConnectedToInternet() && System.Deployment.Application.ApplicationDeployment.IsNetworkDeployed)
            {
                try
                {
                    // send login information
                    Task loginTask = new Task(() =>
                    {
                        string url = "http://anlagehub.com/public/gibbo2d_stats.php?opt=login&email=" +
                                     Gibbo.Editor.WPF.Properties.Settings.Default.UserEmail + "&version=" +
                                     ApplicationDeployment.CurrentDeployment.CurrentVersion.ToString();

                        HttpWebRequest request   = (HttpWebRequest)WebRequest.Create(url);
                        HttpWebResponse response = (HttpWebResponse)request.GetResponse();
                    });

                    loginTask.Start();
                }
                catch (Exception ex)
                {
                    Console.WriteLine("error on login send information: " + ex.Message);
                }
            }

            try
            {
                InitializeComponent();
            }
            catch (Exception ex)
            {
                System.Windows.MessageBox.Show(ex.Message);
            }

            this.ContentRendered += StartupForm_ContentRendered;

            if (AppDomain.CurrentDomain.SetupInformation.ActivationArguments != null)
            {
                string[] activationData = AppDomain.CurrentDomain.SetupInformation.ActivationArguments.ActivationData;
                if (activationData != null && activationData.Length > 0)
                {
                    Uri    uri  = new Uri(activationData[0]);
                    string path = uri.LocalPath.ToString();

                    if (File.Exists(path))
                    {
                        StartEditor(path);
                        return;
                    }
                }
            }

            if (Properties.Settings.Default.LastLoadedProjects.Trim() != string.Empty)
            {
                string[] splitted = Properties.Settings.Default.LastLoadedProjects.Split('|');
                foreach (string split in splitted)
                {
                    if (split.Trim() != string.Empty && File.Exists(split))
                    {
                        ListBoxItem item = new ListBoxItem();

                        item.Content = GibboHelper.SplitCamelCase(System.IO.Path.GetDirectoryName(split).Split('\\').Last());
                        item.Tag     = split;

                        ProjectsListBox.Items.Add(item);
                    }
                }
            }

            if (Properties.Settings.Default.LoadLastProject && ProjectsListBox.Items.Count > 0)
            {
                StartEditor((string)((ProjectsListBox.Items[0] as ListBoxItem).Tag));
            }
        }