public void Initialize()
        {
            FileSystem = LocalFileSystem.Instance;
            SystemRepositoryDirectory = SystemRepositoryDirectory ?? FileSystem.GetDirectory(DefaultInstallationPaths.SystemRepositoryDirectory);
            var descriptors = new PackageDescriptorReader().ReadAll(CurrentDirectory);

            if (descriptors.ContainsKey(string.Empty))
            {
                DescriptorFile = descriptors[string.Empty].File;
                Descriptor     = descriptors[string.Empty].Value;
            }

            ScopedDescriptors = descriptors;
            TryInitializeProjectRepository();

            CurrentDirectoryRepository = new CurrentDirectoryRepository();

            SystemRepository = new FolderRepository(SystemRepositoryDirectory)
            {
                Name = "System repository"
            };

            ConfigurationDirectory = FileSystem.GetDirectory(DefaultInstallationPaths.ConfigurationDirectory);

            RemoteRepositories   = new RemoteRepositoryBuilder(FileSystem, Services.ServiceLocator.GetService <IConfigurationManager>()).GetConfiguredPackageRepositories().ToList();
            ExecutionEnvironment = new ExecutionEnvironment
            {
                Platform = IntPtr.Size == 4 ? "x86" : "x64",
                Profile  = Environment.Version.Major >= 4 ? "net40" : "net35"
            };
        }
        void RefreshProjects()
        {
            var descriptors = new PackageDescriptorReader().ReadAll(_rootDirectory);
            var projects =
                _solution.AllProjects.Where(x => x.OpenWrapEnabled)
                    .Select(x => new
                    {
                        project = x,
                        scope = PathFinder.GetCurrentScope(descriptors[string.Empty].Value.DirectoryStructure, x.File.Path)
                    });

            var resolvedAssemblies = (
                                         from project in projects
                                         where descriptors.ContainsKey(project.scope)
                                         let descriptor = descriptors[project.scope].Value
                                         let ee = new ExecutionEnvironment(project.project.TargetPlatform, project.project.TargetFramework.ToOpenWrapMoniker())
                                         let projectAssemblyReferences = _packageManager.GetProjectAssemblyReferences(descriptor, _projectRepository, ee, false)
                                         select new { path = project.project.File.Path.FullPath, asm = projectAssemblyReferences.Select(x => x.File.Path.FullPath).ToList() }
                                     ).ToDictionary(_ => _.path, _ => _.asm);

            var vsAppDomain = (AppDomain)AppDomain.CurrentDomain.GetData("openwrap.vs.appdomain");

            vsAppDomain.SetData(ASSEMBLY_DATA, resolvedAssemblies);
            _assembliesChanged.Set();
        }
Пример #3
0
        void RefreshProjects()
        {
            var descriptors = new PackageDescriptorReader().ReadAll(_rootDirectory);
            var projects    =
                _solution.AllProjects.Where(x => x.OpenWrapEnabled)
                .Select(x => new
            {
                project = x,
                scope   = PathFinder.GetCurrentScope(descriptors[string.Empty].Value.DirectoryStructure, x.File.Path)
            });
            var resolvedAssemblies = (
                from project in projects
                where descriptors.ContainsKey(project.scope)
                let descriptor = descriptors[project.scope].Value
                                 let ee = new ExecutionEnvironment(project.project.TargetPlatform, project.project.TargetFramework.ToOpenWrapMoniker())
                                          let projectAssemblyReferences = _packageManager.GetProjectAssemblyReferences(descriptor, _projectRepository, ee, false)
                                                                          select new { path = project.project.File.Path.FullPath, asm = projectAssemblyReferences.Select(x => x.File.Path.FullPath).ToList() }
                ).ToDictionary(_ => _.path, _ => _.asm);

            var vsAppDomain = (AppDomain)AppDomain.CurrentDomain.GetData("openwrap.vs.appdomain");

            vsAppDomain.SetData(ASSEMBLY_DATA, resolvedAssemblies);
            _assembliesChanged.Set();
        }
        public void Initialize()
        {
            FileSystem = LocalFileSystem.Instance;

            var descriptors = new PackageDescriptorReader().ReadAll(CurrentDirectory);
            if (descriptors.ContainsKey(string.Empty))
            {
                DescriptorFile = descriptors[string.Empty].File;
                Descriptor = descriptors[string.Empty].Value;
            }

            ScopedDescriptors = descriptors;
            TryInitializeProjectRepository();

            CurrentDirectoryRepository = new CurrentDirectoryRepository();

            SystemRepository = new FolderRepository(FileSystem.GetDirectory(DefaultInstallationPaths.SystemRepositoryDirectory))
            {
                    Name = "System repository"
            };

            ConfigurationDirectory = FileSystem.GetDirectory(DefaultInstallationPaths.ConfigurationDirectory);

            RemoteRepositories = new RemoteRepositoryBuilder(FileSystem, Services.Services.GetService<IConfigurationManager>()).GetConfiguredPackageRepositories().ToList();
            ExecutionEnvironment = new ExecutionEnvironment
            {
                    Platform = IntPtr.Size == 4 ? "x86" : "x64",
                    Profile = Environment.Version.Major >= 4 ? "net40" : "net35"
            };
        }