Beispiel #1
0
        void DisableSyncing(bool closeProject)
        {
            if (!SyncingEnabled)
            {
                return;
            }

            XC4Debug.Log("Disabled syncing for project: {0}", dnp.Name);

            XC4Debug.Indent();
            try {
                if (closeProject)
                {
                    xcode.CloseProject();
                }
                xcode.DeleteProjectDirectory();
            } finally {
                MonoDevelop.Ide.IdeApp.CommandService.ApplicationFocusIn -= AppRegainedFocus;
                dnp.FileAddedToProject           -= FileAddedToProject;
                dnp.FilePropertyChangedInProject -= FilePropertyChangedInProject;;
                dnp.FileRemovedFromProject       -= FileRemovedFromProject;
                dnp.FileChangedInProject         -= FileChangedInProject;
                dnp.NameChanged -= ProjectNameChanged;

                XC4Debug.Unindent();
                xcode = null;
            }
        }
Beispiel #2
0
        void FileRemovedFromProject(object sender, ProjectFileEventArgs e)
        {
            lock (xcode_lock) {
                if (!SyncingEnabled)
                {
                    return;
                }

                XC4Debug.Log("Files removed from project '{0}'", dnp.Name);
                foreach (var file in e)
                {
                    XC4Debug.Log("   * Removed: {0}", file.ProjectFile.ProjectVirtualPath);
                }

                XC4Debug.Indent();
                try {
                    if (e.Any(finf => finf.Project == dnp && IsInterfaceDefinition(finf.ProjectFile)))
                    {
                        if (!dnp.Files.Any(IsInterfaceDefinition))
                        {
                            XC4Debug.Log("Last Interface Definition file removed from '{0}', disabling Xcode sync.", dnp.Name);
                            DisableSyncing(true);
                            return;
                        }
                    }
                } finally {
                    XC4Debug.Unindent();
                }

                CheckFileChanges(e);
            }
        }
Beispiel #3
0
        void ProjectNameChanged(object sender, SolutionItemRenamedEventArgs e)
        {
            XC4Debug.Log("Project '{0}' was renamed to '{1}', resetting Xcode sync.", e.OldName, e.NewName);

            XC4Debug.Indent();
            try {
                xcode.CloseProject();
                xcode.DeleteProjectDirectory();
            } finally {
                XC4Debug.Unindent();
            }

            xcode = new XcodeMonitor(dnp.BaseDirectory.Combine("obj", "Xcode"), dnp.Name);
        }
        public void DeleteProjectDirectory()
        {
            bool isRunning = CheckRunning();

            XC4Debug.Log("Deleting temporary Xcode project directories.");

            try
            {
                if (Directory.Exists(projectDir))
                {
                    Directory.Delete(projectDir, true);
                }
            }
            catch (Exception ex)
            {
                XC4Debug.Indent();
                XC4Debug.Log(ex.Message);
                XC4Debug.Unindent();
            }

            if (isRunning)
            {
                XC4Debug.Log("Xcode still running, leaving empty directory in place to prevent name re-use.");
                if (!Directory.Exists(projectDir))
                {
                    Directory.CreateDirectory(projectDir);
                }
            }
            else
            {
                XC4Debug.Log("Xcode not running, removing all temporary directories.");
                try
                {
                    if (Directory.Exists(originalProjectDir))
                    {
                        Directory.Delete(originalProjectDir, true);
                    }
                }
                catch (Exception ex)
                {
                    XC4Debug.Indent();
                    XC4Debug.Log(ex.Message);
                    XC4Debug.Unindent();
                }
            }
        }