Пример #1
0
        public void AddDbConnectionCommand() {
            var coll = new ConfigurationSettingCollection();
            coll.Add(new ConfigurationSetting("dbConnection1", "1", ConfigurationSettingValueType.String));
            coll.Add(new ConfigurationSetting("dbConnection2", "1", ConfigurationSettingValueType.String));
            coll.Add(new ConfigurationSetting("dbConnection4", "1", ConfigurationSettingValueType.String));

            var configuredProject = Substitute.For<ConfiguredProject>();
            var ac = Substitute.For<IProjectConfigurationSettingsAccess>();
            ac.Settings.Returns(coll);
            var csp = Substitute.For<IProjectConfigurationSettingsProvider>();
            csp.OpenProjectSettingsAccessAsync(configuredProject).Returns(ac);

            var properties = new ProjectProperties(Substitute.For<ConfiguredProject>());
            var dbcs = Substitute.For<IDbConnectionService>();
            dbcs.EditConnectionString(null).Returns("DSN");

            var session = Substitute.For<IRSession>();
            session.EvaluateAsync(null, REvaluationKind.NoResult).ReturnsForAnyArgs(Task.FromResult(new REvaluationResult()));
            session.IsHostRunning.Returns(true);
            var operations = Substitute.For<IRInteractiveWorkflowOperations>();

            var workflow = Substitute.For<IRInteractiveWorkflow>();
            workflow.RSession.Returns(session);
            workflow.Operations.Returns(operations);

            var ucp = Substitute.For<UnconfiguredProject>();
            ucp.LoadedConfiguredProjects.Returns(new ConfiguredProject[] { configuredProject });
            var vsbc = Substitute.For<IVsBrowseObjectContext>();
            vsbc.UnconfiguredProject.Returns(ucp); // IVsBrowseObjectContext.ConfiguredProject

            var dteProj = Substitute.For<EnvDTE.Project>();
            dteProj.Object.Returns(vsbc); // dteProject?.Object as IVsBrowseObjectContext

            object extObject;
            var hier = Substitute.For<IVsHierarchy>();
            hier.GetProperty(VSConstants.VSITEMID_ROOT, (int)__VSHPROPID.VSHPROPID_ExtObject, out extObject)
                .Returns(x => {
                    x[2] = dteProj;
                    return VSConstants.S_OK;
                });

            var pss = Substitute.For<IProjectSystemServices>();
            pss.GetSelectedProject<IVsHierarchy>().Returns(hier);

            var cmd = new AddDbConnectionCommand(dbcs, pss, csp, workflow);
            cmd.Enabled.Should().BeTrue();
            cmd.Invoke(null, IntPtr.Zero, OLECMDEXECOPT.OLECMDEXECOPT_DODEFAULT);

            coll.Should().HaveCount(4);
            var s = coll.GetSetting("dbConnection3");
            s.Value.Should().Be("DSN");
            s.ValueType.Should().Be(ConfigurationSettingValueType.String);
            s.Category.Should().Be(ConnectionStringEditor.ConnectionStringEditorCategory);
            s.EditorType.Should().Be(ConnectionStringEditor.ConnectionStringEditorName);
            s.Description.Should().Be(Resources.ConnectionStringDescription);

            var expected = "if (!exists('settings')) { settings <- as.environment(list()); }; if (is.environment(settings)) { settings$dbConnection3 = \"DSN\"; }";
            operations.Received(1).EnqueueExpression(expected, true);
        }
 private CrcsProject(string fileSystemPath, CrcsSolution solution)
     : base(fileSystemPath, false, null)
 {
     Solution = solution;
     FrameWorkFolder = FindFrameWorkFolder();
     _properties = new ProjectProperties(this);
     _properties.PropertyChanged += ProjectPropertiesPropertyChanged;
     string apkToolFrameWorkFolder = CrcsSettings.Current.ApkToolFrameWorkFolder;
     FolderUtility.DeleteDirectory(apkToolFrameWorkFolder);
     Directory.CreateDirectory(apkToolFrameWorkFolder);
      //           Project = this;
 }
Пример #3
0
 public override void OnInitialize(ProjectProperties properties)
 {
     FindVariables(properties.Model);
 }
Пример #4
0
 public TargetFrameworkValueProvider(ProjectProperties properties)
 {
     _properties = properties;
 }
 private VisualBasicProjectConfigurationProperties CreateInstance(ProjectProperties projectProperties, IProjectThreadingService projectThreadingService)
 {
     return(new VisualBasicProjectConfigurationProperties(projectProperties, projectThreadingService));
 }
Пример #6
0
 public override void OnInitialize(ProjectProperties properties)
 {
 }
Пример #7
0
 public virtual void OnInitialize(ProjectProperties model)
 {
 }
Пример #8
0
        public void AddDbConnectionCommand()
        {
            var coll = new ConfigurationSettingCollection();

            coll.Add(new ConfigurationSetting("dbConnection1", "1", ConfigurationSettingValueType.String));
            coll.Add(new ConfigurationSetting("dbConnection2", "1", ConfigurationSettingValueType.String));
            coll.Add(new ConfigurationSetting("dbConnection4", "1", ConfigurationSettingValueType.String));

            var configuredProject = Substitute.For <ConfiguredProject>();
            var ac = Substitute.For <IProjectConfigurationSettingsAccess>();

            ac.Settings.Returns(coll);
            var csp = Substitute.For <IProjectConfigurationSettingsProvider>();

            csp.OpenProjectSettingsAccessAsync(configuredProject).Returns(ac);

            var properties = new ProjectProperties(Substitute.For <ConfiguredProject>());
            var dbcs       = Substitute.For <IDbConnectionService>();

            dbcs.EditConnectionString(null).Returns("DSN");

            var session = Substitute.For <IRSession>();

            session.EvaluateAsync(null, REvaluationKind.NoResult).ReturnsForAnyArgs(Task.FromResult(new REvaluationResult()));
            session.IsHostRunning.Returns(true);
            var operations = Substitute.For <IRInteractiveWorkflowOperations>();

            var workflow = Substitute.For <IRInteractiveWorkflow>();

            workflow.RSession.Returns(session);
            workflow.Operations.Returns(operations);

            var ucp = Substitute.For <UnconfiguredProject>();

            ucp.LoadedConfiguredProjects.Returns(new ConfiguredProject[] { configuredProject });
            var vsbc = Substitute.For <IVsBrowseObjectContext>();

            vsbc.UnconfiguredProject.Returns(ucp); // IVsBrowseObjectContext.ConfiguredProject

            var dteProj = Substitute.For <EnvDTE.Project>();

            dteProj.Object.Returns(vsbc); // dteProject?.Object as IVsBrowseObjectContext

            object extObject;
            var    hier = Substitute.For <IVsHierarchy>();

            hier.GetProperty(VSConstants.VSITEMID_ROOT, (int)__VSHPROPID.VSHPROPID_ExtObject, out extObject)
            .Returns(x => {
                x[2] = dteProj;
                return(VSConstants.S_OK);
            });

            var pss = Substitute.For <IProjectSystemServices>();

            pss.GetSelectedProject <IVsHierarchy>().Returns(hier);

            var cmd = new AddDbConnectionCommand(dbcs, pss, csp, workflow);

            cmd.Enabled.Should().BeTrue();
            cmd.Invoke(null, IntPtr.Zero, OLECMDEXECOPT.OLECMDEXECOPT_DODEFAULT);

            coll.Should().HaveCount(4);
            var s = coll.GetSetting("dbConnection3");

            s.Value.Should().Be("DSN");
            s.ValueType.Should().Be(ConfigurationSettingValueType.String);
            s.Category.Should().Be(ConnectionStringEditor.ConnectionStringEditorCategory);
            s.EditorType.Should().Be(ConnectionStringEditor.ConnectionStringEditorName);
            s.Description.Should().Be(Resources.ConnectionStringDescription);

            var expected = "if (!exists('settings')) { settings <- as.environment(list()); }; if (is.environment(settings)) { settings$dbConnection3 = \"DSN\"; }";

            operations.Received(1).EnqueueExpression(expected, true);
        }
 public AppDesignerFolderSpecialFileProvider(IPhysicalProjectTree projectTree, ProjectProperties properties)
     : base(projectTree, isFolder: true)
 {
     _properties = properties;
 }
 public AppDesignerFolderSpecialFileProvider(Lazy <IPhysicalProjectTree> projectTree, ProjectProperties properties)
 {
     _projectTree = projectTree;
     _properties  = properties;
 }
Пример #11
0
        private CreateFileFromTemplateService CreateInstance(IUnconfiguredProjectVsServices projectVsServices, IDteServices dteServices, ProjectProperties properties)
        {
            projectVsServices = projectVsServices ?? IUnconfiguredProjectVsServicesFactory.Create();
            dteServices       = dteServices ?? IDteServicesFactory.Create();
            properties        = properties ?? ProjectPropertiesFactory.CreateEmpty();

            return(new CreateFileFromTemplateService(projectVsServices, dteServices, properties));
        }
Пример #12
0
        private static string ParseProjectProperties(BridgeOptions bridgeOptions, string parameters, ILogger logger)
        {
            var properties = new ProjectProperties();

            bridgeOptions.ProjectProperties = properties;

            if (string.IsNullOrWhiteSpace(parameters))
            {
                return(null);
            }

            if (parameters != null && parameters.Length > 1 && parameters[0] == '"' && parameters.Last() == '"')
            {
                parameters = parameters.Trim('"');
            }

            var settings = new Dictionary <string, string>();

            var splitParameters = parameters.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

            foreach (var pair in splitParameters)
            {
                if (pair == null)
                {
                    continue;
                }

                var parts = pair.Split(new char[] { ':' }, 2);
                if (parts.Length < 2)
                {
                    logger.Warn("Skipped " + pair + " when parsing --settings as it is not well-formed like name:value");
                    continue;
                }

                var name = parts[0].Trim();

                if (string.IsNullOrWhiteSpace(name))
                {
                    logger.Warn("Skipped " + pair + " when parsing --settings as name is empty in name:value");
                    continue;
                }

                string value;

                if (settings.ContainsKey(name))
                {
                    value = settings[name];
                    logger.Warn("Skipped " + pair + " when parsing --settings as it already found in " + name + ":" + value);
                    continue;
                }

                value = parts[1];

                if (value != null && value.Length > 1 && (value[0] == '"' || value.Last() == '"'))
                {
                    value = value.Trim('"');
                }

                settings.Add(name, value);
            }

            try
            {
                properties.SetValues(settings);
            }
            catch (ArgumentException ex)
            {
                return(ex.Message);
            }

            return(null);
        }
 public CreateFileFromTemplateService(IUnconfiguredProjectVsServices projectVsServices, IVsUIService <SDTE, DTE2> dte, ProjectProperties properties)
 {
     _projectVsServices = projectVsServices;
     _dte        = dte;
     _properties = properties;
 }
 public OutputTypeValueProviderBase(ProjectProperties properties)
 {
     _properties = properties;
 }
Пример #15
0
 public OutputTypeChecker2(ProjectProperties properties) : base(properties)
 {
 }
Пример #16
0
 public override void OnLoad(ProjectProperties properties)
 {
     LoadModel(properties.Model);
 }
Пример #17
0
 public RDebugLaunchProvider(ConfiguredProject configuredProject, IRInteractiveWorkflowProvider interactiveWorkflowProvider, IProjectSystemServices pss)
     : base(configuredProject) {
     _properties = configuredProject.Services.ExportProvider.GetExportedValue<ProjectProperties>();
     _interactiveWorkflow = interactiveWorkflowProvider.GetOrCreate();
     _pss = pss;
 }
Пример #18
0
 public override void OnLoad(ProjectProperties properties)
 {
     TopModel = GetStrategy("ExampleOrderStrategy");
 }
Пример #19
0
        public virtual string[] GetProjectReferenceAssemblies()
        {
            var baseDir = Path.GetDirectoryName(Location);

            XDocument  projDefinition = XDocument.Load(Location);
            XNamespace rootNs         = projDefinition.Root.Name.Namespace;
            var        helper         = new ConfigHelper <H5DotJson_AssemblySettings>();
            var        tokens         = ProjectProperties.GetValues();

            var referencesPathes = projDefinition
                                   .Element(rootNs + "Project")
                                   .Elements(rootNs + "ItemGroup")
                                   .Elements(rootNs + "Reference")
                                   .Where(el => (el.Attribute("Include")?.Value != "System") && (el.Attribute("Condition") == null || el.Attribute("Condition").Value.ToLowerInvariant() != "false"))
                                   .Select(refElem => (refElem.Element(rootNs + "HintPath") == null ? (refElem.Attribute("Include") == null ? "" : refElem.Attribute("Include").Value) : refElem.Element(rootNs + "HintPath").Value))
                                   .Select(path => helper.ApplyPathTokens(tokens, Path.IsPathRooted(path) ? path : Path.GetFullPath((new Uri(Path.Combine(baseDir, path))).LocalPath)))
                                   .ToList();

            var projectReferences = projDefinition
                                    .Element(rootNs + "Project")
                                    .Elements(rootNs + "ItemGroup")
                                    .Elements(rootNs + "ProjectReference")
                                    .Where(el => el.Attribute("Condition") == null || el.Attribute("Condition").Value.ToLowerInvariant() != "false")
                                    .Select(refElem => (refElem.Element(rootNs + "HintPath") == null ? (refElem.Attribute("Include") == null ? "" : refElem.Attribute("Include").Value) : refElem.Element(rootNs + "HintPath").Value))
                                    .Select(path => helper.ApplyPathTokens(tokens, Path.IsPathRooted(path) ? path : Path.GetFullPath((new Uri(Path.Combine(baseDir, path))).LocalPath)))
                                    .ToArray();

            if (projectReferences.Length > 0)
            {
                if (ProjectProperties.BuildProjects == null)
                {
                    ProjectProperties.BuildProjects = new List <string>();
                }

                foreach (var projectRef in projectReferences)
                {
                    var isBuilt = ProjectProperties.BuildProjects.Contains(projectRef);

                    if (!isBuilt)
                    {
                        ProjectProperties.BuildProjects.Add(projectRef);
                    }

                    var processor = new TranslatorProcessor(new CompilationOptions
                    {
                        Rebuild           = Rebuild,
                        ProjectLocation   = projectRef,
                        H5Location        = H5Location,
                        ProjectProperties = new ProjectProperties
                        {
                            BuildProjects = ProjectProperties.BuildProjects,
                            Configuration = ProjectProperties.Configuration
                        }
                    }, default);

                    processor.PreProcess();

                    var projectAssembly = processor.Translator.AssemblyLocation;

                    if (File.Exists(projectAssembly))
                    {
                        referencesPathes.Add(projectAssembly);
                    }
                }
            }

            return(referencesPathes.ToArray());
        }
Пример #20
0
        private async Task <AggregateWorkspaceProjectContext> CreateProjectContextAsyncCore()
        {
            string languageName = await GetLanguageServiceName();

            if (string.IsNullOrEmpty(languageName))
            {
                return(null);
            }

            Guid projectGuid = await _projectGuidService.GetProjectGuidAsync();

            string targetPath = await GetTargetPathAsync();

            if (string.IsNullOrEmpty(targetPath))
            {
                return(null);
            }


            // TODO: https://github.com/dotnet/roslyn-project-system/issues/353
            await _commonServices.ThreadingService.SwitchToUIThread();

            ProjectData projectData = GetProjectData();

            // Get the set of active configured projects ignoring target framework.
#pragma warning disable CS0618 // Type or member is obsolete
            ImmutableDictionary <string, ConfiguredProject> configuredProjectsMap = await _activeConfiguredProjectsProvider.GetActiveConfiguredProjectsMapAsync();

#pragma warning restore CS0618 // Type or member is obsolete

            // Get the unconfigured project host object (shared host object).
            var configuredProjectsToRemove = new HashSet <ConfiguredProject>(_configuredProjectHostObjectsMap.Keys);
            ProjectConfiguration activeProjectConfiguration = _commonServices.ActiveConfiguredProject.ProjectConfiguration;

            ImmutableDictionary <string, IWorkspaceProjectContext> .Builder innerProjectContextsBuilder = ImmutableDictionary.CreateBuilder <string, IWorkspaceProjectContext>();
            string activeTargetFramework = string.Empty;
            IConfiguredProjectHostObject activeIntellisenseProjectHostObject = null;

            foreach ((string targetFramework, ConfiguredProject configuredProject) in configuredProjectsMap)
            {
                if (!TryGetConfiguredProjectState(configuredProject, out IWorkspaceProjectContext workspaceProjectContext, out IConfiguredProjectHostObject configuredProjectHostObject))
                {
                    // Get the target path for the configured project.
                    ProjectProperties    projectProperties = configuredProject.Services.ExportProvider.GetExportedValue <ProjectProperties>();
                    ConfigurationGeneral configurationGeneralProperties = await projectProperties.GetConfigurationGeneralPropertiesAsync();

                    targetPath = (string)await configurationGeneralProperties.TargetPath.GetValueAsync();

                    string targetFrameworkMoniker = (string)await configurationGeneralProperties.TargetFrameworkMoniker.GetValueAsync();

                    string workspaceProjectContextId = GetWorkspaceContextId(configuredProject);
                    configuredProjectHostObject = _projectHostProvider.GetConfiguredProjectHostObject(_unconfiguredProjectHostObject, workspaceProjectContextId, targetFrameworkMoniker);

                    // TODO: https://github.com/dotnet/roslyn-project-system/issues/353
                    await _commonServices.ThreadingService.SwitchToUIThread();

                    // NOTE: Despite CreateProjectContext taking a "displayName"; it's actually sets both "WorkspaceProjectContextId", "DisplayName", and default "AssemblyName".
                    // Unlike the latter properties, we cannot change WorkspaceProjectContextId once set, so we pass it as the display name.
                    workspaceProjectContext             = _contextFactory.Value.CreateProjectContext(languageName, workspaceProjectContextId, projectData.FullPath, projectGuid, configuredProjectHostObject, targetPath);
                    workspaceProjectContext.DisplayName = GetDisplayName(configuredProject, projectData, targetFramework);

                    // By default, set "LastDesignTimeBuildSucceeded = false" to turn off diagnostics until first design time build succeeds for this project.
                    workspaceProjectContext.LastDesignTimeBuildSucceeded = false;

                    AddConfiguredProjectState(configuredProject, workspaceProjectContext, configuredProjectHostObject);
                }

                innerProjectContextsBuilder.Add(targetFramework, workspaceProjectContext);

                if (activeIntellisenseProjectHostObject == null && configuredProject.ProjectConfiguration.Equals(activeProjectConfiguration))
                {
                    activeIntellisenseProjectHostObject = configuredProjectHostObject;
                    activeTargetFramework = targetFramework;
                }
            }

            _unconfiguredProjectHostObject.ActiveIntellisenseProjectHostObject = activeIntellisenseProjectHostObject;

            return(new AggregateWorkspaceProjectContext(innerProjectContextsBuilder.ToImmutable(), configuredProjectsMap, activeTargetFramework, _unconfiguredProjectHostObject));
        }
Пример #21
0
 internal VcProjectDeploymentToolElement(VcProjectContainerElement parent,
                                         VcProjectRootElement root)
     : base(parent, root)
 {
     _properties = new ProjectProperties();
 }
Пример #22
0
 public OutputTypeChecker(ProjectProperties properties)
 {
     _properties = properties;
 }
Пример #23
0
 public OutputTypeValueProvider(ProjectProperties properties)
     : base(properties)
 {
 }
Пример #24
0
 public TargetFrameworkMonikerValueProvider(IUnconfiguredProjectVsServices unconfiguredProjectVsServices, ProjectProperties properties, IVsFrameworkParser frameworkParser)
 {
     _unconfiguredProjectVsServices = unconfiguredProjectVsServices;
     _properties      = properties;
     _frameworkParser = frameworkParser;
 }
Пример #25
0
 public override void OnLoad(ProjectProperties model)
 {
     TopModel = new LimitBracketStrategy();
 }
 public void OnInitialize(ProjectProperties properties)
 {
     throw new NotImplementedException();
 }
Пример #27
0
 public abstract void OnLoad(ProjectProperties model);
Пример #28
0
        private static SdkReference CreateSdkReferenceProperties(System.Threading.Tasks.Task <System.Collections.Immutable.IImmutableDictionary <string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog> > namedCatalogs, object state)
        {
            ProjectProperties that = ((ProjectProperties)(state));

            return(new SdkReference(that.ConfiguredProject, namedCatalogs.Result, "Project", that.File, that.ItemType, that.ItemName));
        }
        public ManagedDebuggerImageTypeService(ProjectProperties properties)
        {
            Requires.NotNull(properties, nameof(properties));

            _properties = properties;
        }
Пример #30
0
		private void projectProperties_Click(object sender, EventArgs e)
		{
			ProjectProperties properties = new ProjectProperties();
			if (properties.DisplaySettings() == DialogResult.OK)
			{
				Project.Instance.IsSaved = false;
				ShowDebuggerState(DebuggerState.DebuggeeStopped);
			}

			ProjectExplorer.ProjectElements.Nodes[0].Text = Project.Instance.Name;
		}
 public void OnLoad(ProjectProperties properties)
 {
     throw new NotImplementedException();
 }
Пример #32
0
 /// <summary>
 /// Load settings into page.
 /// </summary>
 public override void LoadSettings()
 {
     var props = new ProjectProperties(this);
     control.LoadFrom(props);
     IsDirty = false;
     control.Enabled = true;
 }
 internal CSharpProjectConfigurationProperties(
     ProjectProperties projectProperties,
     IProjectThreadingService threadingService)
     : base(projectProperties, threadingService)
 {
 }
Пример #34
0
 internal VisualBasicProjectConfigurationProperties(
     ProjectProperties projectProperties,
     IProjectThreadingService threadingService)
     : base(projectProperties, threadingService)
 {
 }
Пример #35
0
		private void newProjectMenu_Click(object sender, EventArgs e)
		{
			if (!WarningToSaveProject())
			{
				ProjectProperties properties = new ProjectProperties();
				Project.Instance = new Project();

				properties.DisplaySettings();
				
				ClearOutputPanel();
				ProjectExplorer.ShowProject();
				ResetPanels();
				ShowDebuggerState(DebuggerState.DebuggeeStopped);
			}
		}
        private static VsContainedLanguageComponentsFactory CreateInstance(IVsContainedLanguageFactory containedLanguageFactory = null, IVsProject4 project = null, ProjectProperties properties = null, IConfiguredProjectHostObject hostObject = null, ILanguageServiceHost languageServiceHost = null)
        {
            var hostProvider    = IProjectHostProviderFactory.ImplementActiveIntellisenseProjectHostObject(hostObject);
            var serviceProvider = IOleAsyncServiceProviderFactory.ImplementQueryServiceAsync(containedLanguageFactory, new Guid(LanguageServiceId));

            var projectVsServices = new IUnconfiguredProjectVsServicesMock();

            projectVsServices.ImplementVsProject(project);
            projectVsServices.ImplementThreadingService(IProjectThreadingServiceFactory.Create());
            projectVsServices.ImplementActiveConfiguredProjectProperties(properties);

            return(CreateInstance(serviceProvider, projectVsServices.Object, hostProvider, languageServiceHost));
        }