public void It_uses_the_reader_to_get_the_SourceInformation() { var type = typeof(GivenThatWeWantToUseSourceInformationProviderToGetSourceInformation); var methodInfo = type.GetMethod("It_uses_the_reader_to_get_the_SourceInformation"); var expectedSourceInformation = new SourceInformation("some file path.cs", 12); var pdbReaderMock = new Mock<IPdbReader>(); pdbReaderMock.Setup(p => p.GetSourceInformation(methodInfo)).Returns(expectedSourceInformation); var pdbReaderFactoryMock = new Mock<IPdbReaderFactory>(); pdbReaderFactoryMock.Setup(p => p.Create(_pdbPath)).Returns(pdbReaderMock.Object); var sourceInformationProvider = new SourceInformationProvider(_pdbPath, null, pdbReaderFactoryMock.Object); var actualSourceInformation = sourceInformationProvider.GetSourceInformation(methodInfo); actualSourceInformation.Should().Be(expectedSourceInformation); }
/// <inheritdoc /> public TfvcItem GetItem(SourceInformation searchInformation) { Validators.AssertIsNotNull(searchInformation, nameof(searchInformation)); searchInformation.AssertIsValid(); searchInformation.AssertIsSourceType(SourceType.TfsVc); Logger.Trace("Entering"); //var output = _tfVcClient.GetItemAsync(searchInformation.SourcePath).Result; var output = IgnoreExceptionsHelper.DoMethodIgnoringExceptions <TfvcItem>( new Func <string, TfvcItem>(GetItemWrapper), new[] { typeof(VssServiceException) }, searchInformation.SourcePath ); return(output); }
public void Update_ReturnsExpectedResult() { // Original Item var sourceInformation1 = new SourceInformation(SourceType.Filesystem, @"c:\git", true); var project1 = Helpers.CreateTestProject(); var pm1 = new ProjectMetadata(sourceInformation1, project1) { AppSettings = new List <ApplicationSetting>(), ConnectionStrings = new List <ConnectionStringSetting> { new ConnectionStringSetting { Name = "test1" } }, DatabaseInstances = new List <DatabaseInstance>(), DatabaseTypes = new List <DatabaseType>() }; // pm1 will be updated with information from pm2 var sourceInformation2 = new SourceInformation(SourceType.Filesystem, @"c:\git\dir2", true); var project2 = Helpers.CreateTestProject(); // ReSharper disable once StringLiteralTypo project2.Frameworks = new List <string> { "netcoreapp1.0" }; var pm2 = new ProjectMetadata(sourceInformation2, project2) { AppSettings = new List <ApplicationSetting> { new ApplicationSetting("name", "value") }, ConnectionStrings = new List <ConnectionStringSetting>(), DatabaseInstances = new List <DatabaseInstance>(), DatabaseTypes = new List <DatabaseType>() }; pm1.Update(pm2); Assert.That(pm1, Is.Not.Null); pm1.Should().BeEquivalentTo(pm2); }
public IEnumerable <IXunitTestCase> Discover(ITestFrameworkDiscoveryOptions discoveryOptions, ITestMethod testMethod, IAttributeInfo factAttribute) { var sourceInformation = new SourceInformation() { FileName = factAttribute.GetNamedArgument <string>(nameof(ScenarioFactAttribute.FileName)), LineNumber = factAttribute.GetNamedArgument <int>(nameof(ScenarioFactAttribute.LineNumber)) }; yield return(new ScenarioFactTestCase(_messageSink, discoveryOptions.MethodDisplayOrDefault(), discoveryOptions.MethodDisplayOptionsOrDefault(), testMethod, null, factAttribute.GetNamedArgument <string>(nameof(ScenarioFactAttribute.FactName)), sourceInformation, factAttribute.GetNamedArgument <int>(nameof(ScenarioFactAttribute.TheoryTestCaseLimit)), factAttribute.GetNamedArgument <ScenarioTestExecutionPolicy>(nameof(ScenarioFactAttribute.ExecutionPolicy)), factAttribute.GetNamedArgument <bool>(nameof(ScenarioFactAttribute.RunInIsolation)))); }
/// <summary> /// Gets Directory Information /// </summary> /// <param name="sourceInformation"></param> /// <returns></returns> public static SourceInformation GetDirectoryInformation(SourceInformation sourceInformation) { Validators.AssertIsNotNull(sourceInformation, nameof(sourceInformation)); sourceInformation.AssertIsValid(); Logger.Trace("Entering"); var newSourceInformation = new SourceInformation(sourceInformation) { SourcePath = Path.GetDirectoryName(sourceInformation.SourcePath), IsDirectory = true }; FixPathSeparators(newSourceInformation); FixPathEnding(newSourceInformation); return(newSourceInformation); }
public void UpdateSourceInformation_Succeeds([Values(true, false)] bool isDirectory) { var sourceTool = Helpers.SetUpFakeGitSourceTool(); var sourceInfo = new SourceInformation( SourceType.TfsGit, "sourcePath", isDirectory, "gitRepo", "getBranch"); var item = new GitItem { Path = "itemPath" }; sourceTool.UpdateSourceInformation(sourceInfo, item); Assert.That(sourceInfo.SourcePath, Is.EqualTo(item.Path)); }
/// <inheritdoc /> public void DeleteItem(SourceInformation sourceInformation, TfvcItem existingItem) { Validators.AssertIsNotNull(sourceInformation, nameof(sourceInformation)); Validators.AssertIsNotNull(existingItem, nameof(existingItem)); sourceInformation.AssertIsValid(); sourceInformation.AssertIsSourceType(SourceType.TfsVc); Logger.Trace("Entering"); var item = new TfvcItem { Path = sourceInformation.SourcePath, ContentMetadata = new FileContentMetadata { Encoding = 65001 }, ChangesetVersion = existingItem.ChangesetVersion }; var change = new TfvcChange { ChangeType = VersionControlChangeType.Delete, Item = item }; var changeset = new TfvcChangeset { Comment = "Automatically deleted from API", Changes = new List <TfvcChange> { change } //PolicyOverride = new TfvcPolicyOverrideInfo("API", null), }; // submit the changeset var result = _client.Value.CreateChangesetAsync( changeset, VsTsTool.GetProjectNameFromPath(sourceInformation.SourcePath)) .Result; Console.WriteLine($"Changeset created for delete. Id: {result.ChangesetId}."); }
/// <inheritdoc /> /// <summary> /// Create a new instance optionally with parameters and from a project. /// </summary> /// <param name="sourceInformation"></param> /// <param name="project"></param> /// <param name="logger">Optional Logger</param> public ProjectMetadata( SourceInformation sourceInformation, Project project = null, Logger logger = null) : this(logger) { _logger.Trace("Entering"); if (project != null) { MapFromProjectToProjectMetadata(project, this); } if (sourceInformation != null) { sourceInformation.AssertIsValid(); SourceInformation = sourceInformation; } _logger.Trace("Exiting"); }
/// <inheritdoc /> public FileInfo GetItem(SourceInformation searchInformation) { Validators.AssertIsNotNull(searchInformation, nameof(searchInformation)); searchInformation.AssertIsValid(); searchInformation.AssertIsSourceType(SourceType.Filesystem); Logger.Trace("Entering"); var output = IgnoreExceptionsHelper.DoConstructorIgnoringExceptions <FileInfo>( new[] { typeof(FileNotFoundException), typeof(DirectoryNotFoundException) }, searchInformation.SourcePath ); if (!output.Exists) { output = null; } return(output); }
public void It_uses_the_reader_to_get_the_SourceInformation() { var type = typeof(GivenThatWeWantToUseSourceInformationProviderToGetSourceInformation); var methodInfo = type.GetMethod("It_uses_the_reader_to_get_the_SourceInformation"); var expectedSourceInformation = new SourceInformation("some file path.cs", 12); var pdbReaderMock = new Mock <IPdbReader>(); pdbReaderMock.Setup(p => p.GetSourceInformation(methodInfo)).Returns(expectedSourceInformation); var pdbReaderFactoryMock = new Mock <IPdbReaderFactory>(); pdbReaderFactoryMock.Setup(p => p.Create(_pdbPath)).Returns(pdbReaderMock.Object); var sourceInformationProvider = new SourceInformationProvider(_pdbPath, pdbReaderFactoryMock.Object); var actualSourceInformation = sourceInformationProvider.GetSourceInformation(methodInfo); actualSourceInformation.Should().Be(expectedSourceInformation); }
public static void ChangeItemContent_Succeeds() { var vcSourceTool = SetUpMockSourceTool(out var vsTsToolMock, out var tfVcClientMock); var sourceInformation = new SourceInformation(SourceType.TfsVc, "$/Apollo/junkPath", true); var existingItem = new TfvcItem(); Assert.That( () => vcSourceTool.ChangeItemContent(sourceInformation, existingItem, "junk content"), Throws.Nothing); vsTsToolMock.VerifyGet(x => x.TfVcClient); tfVcClientMock.Verify( x => x.CreateChangesetAsync( It.IsAny <TfvcChangeset>(), It.IsAny <string>(), It.IsAny <object>(), It.IsAny <CancellationToken>()), Times.Once); }
public static void GetItems_Succeeds() { // Arrange var sourceTool = SetUpIntegration(); var sourceInformation = new SourceInformation( SourceType.TfsVc, "$/Apollo/HP/Source/Tools/DependencyGrapher", true); // Act var result = sourceTool.GetItems(sourceInformation); // Assert Assert.That(result, Is.Not.Null); Assert.That(result.Count(), Is.GreaterThan(2)); var myHandlers = new VariableDumpHandlers(); Console.WriteLine(result.DumpValues(0, handlers: myHandlers)); }
public static void GetItems_Succeeds() { // Arrange var sourceTool = Helpers.SetUpRealGitSourceTool(); var sourceInformation = new SourceInformation( SourceType.TfsGit, "/", true, "Upmc.DevTools.Common", "develop"); // Act var result = sourceTool.GetItems(sourceInformation); // Assert Assert.That(result, Is.Not.Null); Assert.That(result.Count, Is.GreaterThan(2)); Console.WriteLine(result.DumpValues(0)); }
internal void ProcessPackagesConfig(ProjectMetadata projectMetadata, SourceInformation projectDirectory) { _logger.Trace("Entering"); var packagesConfig = Tools.GetChildFileInformation( new SourceInformation(projectDirectory), "packages.config"); var sourceTool = GetSourceTool(); var sw = Stopwatch.StartNew(); var content = sourceTool.GetItemContent(packagesConfig); sw.Stop(); _logger.Trace($"GetItemContent took {sw.Elapsed}"); if (content != null) { projectMetadata.PackageReferences = PackageConfigParser.ParsePackagesConfigFileContent(content).ToList(); } }
private void ProcessAssemblyInfo(Project projectMetadata, SourceInformation projectDirectory) { _logger.Trace("Entering"); var propertiesInfo = Tools.GetChildDirectoryInformation( new SourceInformation(projectDirectory), "properties"); // ReSharper disable once StringLiteralTypo var assemblyInfo = Tools.GetChildFileInformation(propertiesInfo, "assemblyinfo.cs"); var sourceTool = GetSourceTool(); var sw = Stopwatch.StartNew(); var content = sourceTool.GetItemContent(assemblyInfo); sw.Stop(); _logger.Trace($"GetItemContent took {sw.Elapsed}"); if (content != null) { projectMetadata.AssemblyInformation = AssemblyInfoParser.ParseFileContent(content).ToList(); } }
public void ProcessPackagesConfig_ReturnsExpectedResult([Values(-1, 1)] int dop) { var performanceConfiguration = new PerformanceConfiguration { ParallelOptions = { MaxDegreeOfParallelism = dop } }; var directory = WriteTestFiles(); var parser = new ParserGeneric <FileInfo>( SourceType.Filesystem, logger: _logger, performanceConfiguration: performanceConfiguration); var projectMetadata = new ProjectMetadata(); var testSourceInformation = new SourceInformation( SourceType.Filesystem, directory + @"\SampleNew.csproj", false); parser.ProcessPackagesConfig(projectMetadata, testSourceInformation); Assert.That(projectMetadata.PackageReferences, Is.Not.Null); Assert.That(projectMetadata.PackageReferences.Count, Is.EqualTo(1)); }
public void ProcessSource_Git_ReturnsExpectedResult([Values(-1, 1)] int dop) { var performanceConfiguration = new PerformanceConfiguration { ParallelOptions = { MaxDegreeOfParallelism = dop } }; SetUpGitReal(out var serverUri, out var personalAccessToken, out var projectName); var parser = new ParserGeneric <GitItem>( SourceType.TfsGit, serverUri, personalAccessToken, projectName, logger: _logger, performanceConfiguration: performanceConfiguration); var searchInformation = new SourceInformation(SourceType.TfsGit, "/", true, "Upmc.DevTools.Common", "develop"); var result = parser.ProcessSource(searchInformation, (IEnumerable <string>)null); Assert.That(result, Is.Not.Null); Assert.Multiple( () => { Assert.That(result.Count(), Is.GreaterThanOrEqualTo(1), "result.Count"); Assert.That(result.First().ProjectMetadatas, Is.Not.Null, "projectMetadatas"); Assert.That(result.First().ProjectMetadatas.Count, Is.GreaterThanOrEqualTo(2), "projectMetadatas count"); Assert.That(result.Count(sln => sln.ProjectMetadatas.Any(x => x.SourceInformation != null)), Is.EqualTo(1), "projects with source information"); }); }
private static void GetRepositoryInformation( GitSourceTool client, out SourceInformation[] items, out SourceInformation[] files) { var searchInformation = new SourceInformation( SourceType.TfsGit, "/", true, AppSettings.GitRepository, AppSettings.GitBranch); WriteOutput("Getting repository content..."); items = client.GetItems(searchInformation) .Select(x => client.Map(x, AppSettings.GitRepository, AppSettings.GitBranch)) .ToArray(); WriteOutput("Selecting Markdown files..."); files = items.Where( x => !x.IsDirectory && x.SourcePath.EndsWith(".md", StringComparison.CurrentCultureIgnoreCase)) //.Take(50) .ToArray(); }
/// <summary> /// Get detailed information for all items based on input. /// </summary> /// <param name="searchInformation"></param> /// <param name="pathFilter">A file filter as used by System.IO.Directory.</param> /// <returns></returns> public IEnumerable <FileInfo> GetItems(SourceInformation searchInformation, string pathFilter) { Validators.AssertIsNotNull(searchInformation, nameof(searchInformation)); searchInformation.AssertIsValid(); searchInformation.AssertIsSourceType(SourceType.Filesystem); Logger.Trace("Entering"); IEnumerable <FileInfo> output; if (searchInformation.IsDirectory) { output = Directory.GetFiles(searchInformation.SourcePath, pathFilter, SearchOption.AllDirectories) .Select(f => new FileInfo(f)); } else { output = new List <FileInfo> { new FileInfo(searchInformation.SourcePath) }; } return(output); }
/// <inheritdoc /> public IEnumerable <FileInfo> GetItems(SourceInformation searchInformation) { Logger.Trace("Entering"); return(GetItems(searchInformation, "*.*")); }
public SourceInformation Source(TreeNode node) { SortedDictionary <int, float> metricOnLine; var sourceLocation = this.GetSourceLocation(node.BackingNode, node.BackingNode.Name, out metricOnLine); if (sourceLocation != null) { var sourceFile = sourceLocation.SourceFile; FieldInfo fi = typeof(SourceFile).GetField("m_symbolModule", BindingFlags.NonPublic | BindingFlags.Instance); if (fi != null) { PropertyInfo pi = typeof(SymbolModule).GetProperty("PdbForSourceServer", BindingFlags.NonPublic | BindingFlags.Instance); if (pi != null) { MethodInfo mi = typeof(SymbolModule).GetMethod("GetSrcSrvStream", BindingFlags.NonPublic | BindingFlags.Instance); if (mi != null) { string srcStream = mi.Invoke(pi.GetValue(fi.GetValue(sourceFile)), null) as string; if (srcStream != null) { string[] lines = srcStream.Split(new[] { "\r\n", "\n" }, StringSplitOptions.None); foreach (var line in lines) { // TFS DevDiv support if (line.StartsWith(sourceFile.BuildTimeFilePath)) { var split = line.Split('*'); var sourceInfo = new SourceInformation { Url = "http://vstfdevdiv:8080/DevDiv2/DevDiv/_versionControl/changeset/" + split[3].Trim() + "#path=" + split[2].Trim() + "&_a=contents", Type = "Url", Summary = metricOnLine.Select(m => new LineInformation { Metric = m.Value, LineNumber = m.Key + 1, Line = string.Empty }).ToList() }; return(sourceInfo); } } // support for source depot? return(null); } } } } // Source Database Format { var sdbFiles = Directory.GetFiles(this.reader.SourcePath, "*.sdb", SearchOption.AllDirectories); SourceInformation sourceInfo = null; foreach (var sdbFile in sdbFiles) { using (ZipArchive archive = ZipFile.OpenRead(sdbFile)) { foreach (ZipArchiveEntry entry in archive.Entries) { if (sourceFile.BuildTimeFilePath.EndsWith(entry.FullName, StringComparison.OrdinalIgnoreCase)) { int i = 0; var summaryLineMetrics = new List <LineInformation>(); var linemetrics = new List <LineInformation>(); sourceInfo = new SourceInformation(); sourceInfo.Lines = linemetrics; sourceInfo.Summary = summaryLineMetrics; sourceInfo.Type = "Lines"; using (var sr = new StreamReader(entry.Open())) { string line; while ((line = sr.ReadLine()) != null) { i++; float value = 0; if (metricOnLine.TryGetValue(i, out value)) { var lineInfo = new LineInformation { LineNumber = i, Metric = value, Line = line }; summaryLineMetrics.Add(lineInfo); linemetrics.Add(lineInfo); } else { linemetrics.Add(new LineInformation { LineNumber = i, Metric = value, Line = line }); } } } break; } } } } return(sourceInfo); } } return(null); }
public void AddSourceInformation(ulong address, string information) { SourceInformation.Add(address, information); }
public static DiscoveredExample MapToDiscovered(ExampleBase example, string binaryPath, SourceInformation sourceInfo) { var discoveredExample = new DiscoveredExample() { FullName = example.FullName(), SourceAssembly = binaryPath, SourceFilePath = sourceInfo.Filename, SourceLineNumber = sourceInfo.LineNumber, Tags = example.Tags .Select(tag => tag.Replace("_", " ")) .ToArray(), }; return(discoveredExample); }
public ScenarioFactTestCase(IMessageSink diagnosticMessageSink, TestMethodDisplay defaultMethodDisplay, TestMethodDisplayOptions defaultMethodDisplayOptions, ITestMethod testMethod, object[] testMethodArguments, string factName, SourceInformation sourceInformation, int theoryTestCaseLimit, ScenarioTestExecutionPolicy scenarioTestExecutionPolicy, bool runInIsolation) : base(diagnosticMessageSink, defaultMethodDisplay, defaultMethodDisplayOptions, testMethod, testMethodArguments) { _factName = factName; _theoryTestCaseLimit = theoryTestCaseLimit; _scenarioTestExecutionPolicy = scenarioTestExecutionPolicy; _runInIsolation = runInIsolation; SourceInformation = sourceInformation; }
/// <summary> /// Prüft, ob ein Regionalsender sein Daten verändert hat. /// </summary> /// <param name="fine">Gesetzt für den Aufruf im Sekundenrythmus.</param> public override void KeepAlive( bool fine ) { // Forward to base base.KeepAlive( fine ); // No source if (CurrentSelection == null) return; // Start reader if (m_InfoReader == null) { // Make sure that service configuration is reloaded if (!m_HasPendingGroupInformation) { // Once m_HasPendingGroupInformation = true; // Request new Device.ResetInformationReaders(); } // Check for match if (m_HasPendingGroupInformation) if (null == Device.GetGroupInformation( 0 )) return; else m_HasPendingGroupInformation = false; // Read in background m_InfoReader = CurrentSelection.GetSourceInformationAsync(); } // Only coarse if (fine) return; // See if we are done if (!m_InfoReader.IsCompleted) return; // Read the information var info = m_InfoReader.Result; // Stop reader using (var reader = m_InfoReader) { // Forget m_InfoReader = null; // Enforce proper shutdown if (reader != null) reader.Cancel(); } // Update recording if (RecordingStream != null) { // Forward RecordingStream.RetestSourceInformation( info ); // Restart silently if necessary RestartStreams(); } // See if something changed bool changed = CompareSourceInformation( info ); // Use the new one CurrentSourceConfiguration = info; // Update if (!changed) return; // Refresh audio list ResetAudio(); // Process Activate( null ); // Report ShowMessage( Properties.Resources.PSIUpdate, Properties.Resources.PSIUpdateTitle, true ); }
public static void Constructor2_Succeeds( [Values] bool sourceInformationIsNull, [Values] bool projectIsNull ) { // Arrange SourceInformation sourceInformation = null; if (!sourceInformationIsNull) { sourceInformation = Helpers.CreateTestSourceInformation(); } Project project = null; if (!projectIsNull) { project = Helpers.CreateTestProject(); } // Act var result = new ProjectMetadata(sourceInformation, project); // Assert Assert.Multiple( () => { Assert.That(result, Is.Not.Null); result.SourceInformation.Should().BeEquivalentTo(sourceInformation); if (projectIsNull) { Assert.That(result.AssemblyInformation, Is.Empty); Assert.That(result.AssemblyReferences, Is.Empty); Assert.That(result.Configurations, Is.Empty); Assert.That(result.Frameworks, Is.Empty); Assert.That(result.Id, Is.Null); Assert.That(result.NameInSolution, Is.Null); Assert.That(result.PackageReferences, Is.Empty); Assert.That(result.PathRelativeToSolution, Is.Null); Assert.That(result.ProjectFileFormat, Is.Null); Assert.That( result.ProjectOutputType, Is.EqualTo(ProjectOutputType.Library)); // This has a default value. Assert.That(result.ProjectReferences, Is.Empty); Assert.That(result.Sdk, Is.Null); Assert.That(result.TypeIds, Is.Empty); } else { result.Should().BeEquivalentTo( project, opt => opt .ExcludingMissingMembers() // Exclude Project fields which come from the Solution. .Excluding(y => y.NameInSolution) .Excluding(y => y.TypeIds) .Excluding(y => y.Id) .Excluding(y => y.PathRelativeToSolution) ); } }); }
/// <summary> /// Parse the Content of a Markdown file. /// </summary> /// <param name="content"></param> /// <param name="sourceInformation"></param> /// <returns></returns> public static MarkdownMetadata Parse(string content, SourceInformation sourceInformation) { var output = new MarkdownMetadata { Content = content, SourceInformation = sourceInformation }; var lines = content.Split(new[] { "\n" }, StringSplitOptions.None); var lineNumber = 0; foreach (var line in lines) { lineNumber++; var trimmedLine = line.Trim(); // todo Find Links. There could be multiple on a single line. "[text](ref)" // Process header line. if (trimmedLine.StartsWith("#")) { // Count number of #'s and store that in Level. var level = 1; while (trimmedLine.Substring(level, 1).Equals("#")) { level++; } var text = trimmedLine.Substring(level).Trim(); var item = new Heading(level, text); output.Headings.Add(item); // There can be nothing more to parse on this line. continue; } // Process Html Id var htmlMatch = HtmlRegex.Match(trimmedLine); if (htmlMatch.Success && htmlMatch.Groups.Count == 2) { var item = new HtmlId(htmlMatch.Groups["id"].Value, trimmedLine); output.HtmlIds.Add(item); // There can be nothing more to parse on this line. continue; } // Process Links var match = LinkRegex.Match(trimmedLine); if (match.Success && match.Groups.Count == 3) { var item = new Link(match.Groups["text"].Value, match.Groups["ref"].Value, lineNumber); output.Links.Add(item); } } return(output); }
/// <summary> /// Meldet, ob Bild, Ton und Videotext neu aufgebaut werden müssen. /// </summary> /// <param name="info">Vergleichswert.</param> /// <returns>Gesetzt, wenn eine relevante Veränderung erkannt wurde.</returns> private bool CompareSourceInformation( SourceInformation info ) { // Always changed if (null == CurrentSourceConfiguration) return true; // Picture if (CurrentSourceConfiguration.VideoStream != info.VideoStream) return true; if (0 != CurrentSourceConfiguration.VideoStream) if (CurrentSourceConfiguration.VideoType != info.VideoType) return true; // Videotext if (CurrentSourceConfiguration.TextStream != info.TextStream) return true; // Audio count if (CurrentSourceConfiguration.AudioTracks.Count != info.AudioTracks.Count) return true; // Compare all for (int i = CurrentSourceConfiguration.AudioTracks.Count; i-- > 0; ) { // Load AudioInformation oldAudio = CurrentSourceConfiguration.AudioTracks[i], newAudio = info.AudioTracks[i]; // Compare if (oldAudio.AudioStream != newAudio.AudioStream) return true; if (oldAudio.AudioType != newAudio.AudioType) return true; if (0 != string.Compare( oldAudio.Language, newAudio.Language, true )) return true; } // No change return false; }
/// <summary> /// Ändert den aktuellen Sender oder wählt einen NVOD Dienst zum aktuellen /// Portal aus. /// </summary> /// <param name="source">Eine DVB.NET <see cref="SourceSelection"/>.</param> /// <param name="portal">Optional ein Portal.</param> /// <param name="service">Optional ein Dienst des Portals.</param> /// <returns>Name und Tonspur des neuen Senders oder <i>null</i>, wenn kein /// Senderwechsel suchgeführt wurde.</returns> private string SetStation( SourceSelection source, SourceSelection portal, ServiceItem service ) { // Stop data transmission at once Accessor.Stop(); // Get rid of stream and recording StopReceivers( false ); // Tune source.SelectGroup(); // Check for encryption var station = (Station) source.Source; if (station.IsEncrypted) try { // Request clean stream Device.Decrypt( station ); } catch { // Ignore any error } // Retrieve the source information var info = source.GetSourceInformationAsync().Result; // Remember CurrentSourceConfiguration = info; CurrentSelection = source; CurrentService = service; CurrentPortal = portal; CurrentEntry = null; NextEntry = null; // Reset EPG display ShowCurrentEntry(); // Store to settings if not a service if (CurrentPortal == null) LocalInfo.LocalStation = source.DisplayName; // Load audio ResetAudio(); // Choose return LoadingDefaults ? null : SetAudio( null ); }
private SolutionMetadata ProcessSolution(SourceInformation solutionSourceInformation) { _logger.Trace("Entering"); var sourceTool = GetSourceTool(); var sw = Stopwatch.StartNew(); var content = sourceTool.GetItemContent(solutionSourceInformation); sw.Stop(); _logger.Trace($"GettItemContent took {sw.Elapsed}"); var solutionParser = new SolutionParser(); var solution = solutionParser.ParseSolutionFileContent(content); var name = Path.GetFileNameWithoutExtension(solutionSourceInformation.SourcePath); var solutionMetadata = new SolutionMetadata(name, solutionSourceInformation, solution); OnItemProcessing(new ItemParsingEventArgs(solutionSourceInformation)); if (_parseGitVersionFiles) { ProcessGitVersionFile(solutionMetadata); } if (solutionMetadata.Projects != null) { var exceptions = new ConcurrentQueue <Exception>(); Parallel.ForEach( solutionMetadata.Projects, _performanceConfiguration.ParallelOptions, project => { var projectSourceInformation = new SourceInformation(solutionSourceInformation) { SourcePath = Tools.GetDirectoryInformation(solutionSourceInformation).SourcePath + project.PathRelativeToSolution }; try { if (project.PathRelativeToSolution.EndsWith( ".csproj", StringComparison.CurrentCultureIgnoreCase)) { var projectMetadata = ProcessProject(projectSourceInformation); projectMetadata.SourceInformation = projectSourceInformation; var projectDirectory = Tools.GetDirectoryInformation(projectSourceInformation); if (_parsePackageConfigFiles) { ProcessPackagesConfig(projectMetadata, projectDirectory); } if (_parseConfigFiles) { ProcessConfigFiles(projectMetadata, projectDirectory); } if (_parseAssemblyInfoFiles) { ProcessAssemblyInfo(projectMetadata, projectDirectory); } solutionMetadata.ProjectMetadatas.Add(projectMetadata); } // todo Parse SQL Projects? } catch (Exception e) { OnExceptionThrown(new ExceptionEventArgs(projectSourceInformation, e)); exceptions.Enqueue(e); } } ); if (exceptions.Any()) { throw new AggregateException( $"Some project processing failed for {solutionSourceInformation}.", exceptions); } } return(solutionMetadata); }
public void DeleteItem(SourceInformation sourceInformation, GitItem existingItem) { throw new NotImplementedException(); }
public ExceptionEventArgs(SourceInformation sourceInformation, Exception exception) { SourceInformation = sourceInformation; Exception = exception; }
public void Merge() { var options = new TSqlObjectOptions(); //var pre = String.Empty; //var post = String.Empty; //Dictionary<string, Reference> externalReferences = new Dictionary<string, Reference>(); //Dictionary<string, SqlCmdVar> sqlVariables = new Dictionary<string, SqlCmdVar>(); foreach (var source in _sources) { TSqlModel model = new TSqlModel(source); /* * var customDatas = model.GetCustomData(); * foreach (CustomData customData in customDatas) * { * if (customData.Category == "Reference" && customData.DataType == "SqlSchema") * { * var reference = new Reference(customData); * if (!reference.IsSameDatabaseReference && !externalReferences.ContainsKey(reference.LogicalName)) * { * externalReferences.Add(reference.LogicalName, reference); * } * Console.WriteLine("DacPac Reference: {0} / {1} / {2} / {3}", * reference.Path, * reference.LogicalName, * reference.ExternalParts, * reference.SuppressMissingDependenciesErrors); * } * else if (customData.Category == "SqlCmdVariables") * { * var sqlVars = SqlCmdVar.ParseCustomData(customData); * foreach (SqlCmdVar sqlVar in sqlVars) * { * if (!sqlVariables.ContainsKey(sqlVar.Name)) * { * sqlVariables.Add(sqlVar.Name, sqlVar); * } * Console.WriteLine("DacPac SQL Variable: {0} / {1}", * sqlVar.Name, * sqlVar.Value); * } * } * } */ foreach (TSqlObject obj in model.GetObjects(DacQueryScopes.UserDefined)) { if (obj.TryGetAst(out TSqlScript ast)) //if (obj.TryGetScript(out string script)) { var name = obj.Name.ToString(); SourceInformation info = obj.GetSourceInformation(); if (info != null && !string.IsNullOrWhiteSpace(info.SourceName)) { name = info.SourceName; } if (!string.IsNullOrWhiteSpace(name) && !name.EndsWith(".xsd")) { _targetModel.AddOrUpdateObjects(ast, name, options); //_targetModel.AddObjects(ast); } } } //using (var package = DacPackage.Load(source)) //{ // pre += new StreamReader(package.PreDeploymentScript).ReadToEnd(); // post += new StreamReader(package.PostDeploymentScript).ReadToEnd(); //} } //Console.WriteLine("Start Compile..."); //foreach (Reference reference in externalReferences.Values) //{ // _target.AddReference( // reference.Path, // reference.LogicalName, // reference.ExternalParts, // reference.SuppressMissingDependenciesErrors); //} //_target.AddSqlVariables(sqlVariables.Values.ToList()); WriteFinalDacpac(_targetModel /*, pre, post*/); }
public static void GetChildDirectory_ThrowsArgumentException([Values(null, "", " ")] string childDirectory) { var inputInfo = new SourceInformation(SourceType.Filesystem, @"c:\git", true); Assert.That(() => Tools.GetChildDirectoryInformation(inputInfo, childDirectory), Throws.ArgumentException); }
/// <summary> /// Gibt alle verbundenen Ressourcen frei. Insbesondere wird eine laufende /// Aufzeichnung beendet. /// </summary> protected override void OnDispose() { // Stop data receiption. StopReceivers( false ); // Forget CurrentSourceConfiguration = null; CurrentSelection = null; CurrentAudio = null; CurrentEntry = null; NextEntry = null; // Reset EPG display ShowCurrentEntry(); }