Пример #1
0
        /// <summary>
        /// Gets whether a project file is active that exists on the file system.
        /// </summary>
        public static bool HasProject(this DTE2 dte)
        {
            if (!dte.HasSolution())
            {
                return(false);
            }

            return(dte.ActiveSolutionProjects != null &&
                   dte.Solution.Projects != null && dte.Solution.Projects.Count > 0);
        }
Пример #2
0
        public void Save()
        {
            DTE2 dte = Globals.DTE;

            if (!dte.HasSolution())
            {
                return;
            }

            Solution4 solution = dte.Solution as Solution4;

            XmlFileSerializer <Options> .Serialize(loadedSettingsFile.FullName, Options.Instance);
        }
Пример #3
0
        public void Load()
        {
            DTE2 dte = Globals.DTE;

            if (!dte.HasSolution())
            {
                return;
            }

            Solution4 solution = dte.Solution as Solution4;

            var solutionDirectory = new DirectoryInfo(Path.GetDirectoryName(solution.FullName));

            var parentSettingsFile = new FileInfo(
                solutionDirectory.Parent.FullName +
                Path.DirectorySeparatorChar +
                "default.ivyvisual");

            FileInfo settingsFileToDeserialize = null;

            if (parentSettingsFile.Exists)
            {
                settingsFileToDeserialize = parentSettingsFile;
            }
            else
            {
                var settingsFile = new FileInfo(solution.FullName + ".ivyvisual");

                if (settingsFile.Exists)
                {
                    settingsFileToDeserialize = settingsFile;
                }
                else
                {
                    return;
                }
            }

            loadedSettingsFile = settingsFileToDeserialize;
            Options options = XmlFileSerializer <Options> .Deserialize(settingsFileToDeserialize.FullName);

            Instance.ResolveAndUnresolveReferencesOnOpenAndClose = options.ResolveAndUnresolveReferencesOnOpenAndClose;
            Instance.DependenciesPattern = options.DependenciesPattern;
            Instance.WorkspacePath       = options.WorkspacePath;
            Instance.RetrieveCommand     = options.RetrieveCommand;
        }