Ejemplo n.º 1
0
        public Optional <AbsoluteFilePath> GetDefaultApplicationForFile(AbsoluteFilePath fileName)
        {
            var pathRes = new StringBuilder();
            var res     = FindExecutable(fileName.ToString(), null, pathRes);

            return(res > 32 ? Optional.Some(AbsoluteFilePath.Parse(pathRes.ToString())) : Optional.None <AbsoluteFilePath>());
        }
Ejemplo n.º 2
0
        Optional <FileDialogResult> OpenFileSync(FileDialogOptions options)
        {
            var ofd = new Microsoft.Win32.OpenFileDialog
            {
                Title           = options.Caption,
                Filter          = options.Filters.CreateFilterString(),
                CheckPathExists = true,
                CheckFileExists = true,
            };

            FilterString.Parse(ofd.Filter).Each(f => Console.WriteLine(f));

            if (options.Directory != null)
            {
                ofd.InitialDirectory = options.Directory.NativePath;
            }

            var success = _window == null?ofd.ShowDialog() : ofd.ShowDialog(_window);

            var filename = ofd.FileName;
            var result   = new FileDialogResult();

            if (success.Value)
            {
                result.Path   = AbsoluteFilePath.Parse(ofd.FileName);
                result.Filter = FilterAtIndex(ofd.Filter, ofd.FilterIndex);
            }

            Focus();

            return(success.Value
                                ? Optional.Some(result)
                                : Optional.None <FileDialogResult>());
        }
Ejemplo n.º 3
0
        Optional <Source> ProcessGotoDefintion(GotoDefinitionRequest gotoDefinitionRequest, IObserver <Error> errors)
        {
            var path = TryCatchWithError(
                errors,
                ErrorCode.InvalidData,
                "Failed to parse path.",
                () => AbsoluteFilePath.Parse(gotoDefinitionRequest.Path));

            if (!path.HasValue)
            {
                return(Optional.None());
            }

            Compile(gotoDefinitionRequest.Text, path.Value);

            var source = GotoDefinitionFeature.TryGoToDefinition(
                _engine,
                errors,
                _gotoDefinitionFactory,
                gotoDefinitionRequest);

            source.Do(s => {}, () => errors.OnNext(new Error(ErrorCode.Unknown, "Failed to goto definition.")));

            return(source);
        }
Ejemplo n.º 4
0
        Optional <FileDialogResult> SaveFileSync(FileDialogOptions options)
        {
            var ofd = new Microsoft.Win32.SaveFileDialog
            {
                Title           = options.Caption,
                Filter          = options.Filters.CreateFilterString(),
                OverwritePrompt = true,
            };

            if (options.Directory != null)
            {
                ofd.InitialDirectory = options.Directory.NativePath;
            }

            var success = _window == null?ofd.ShowDialog() : ofd.ShowDialog(_window);

            var filename = ofd.FileName;
            var result   = new FileDialogResult();

            if (success.Value)
            {
                result.Path   = AbsoluteFilePath.Parse(ofd.FileName);
                result.Filter = FilterAtIndex(ofd.Filter, ofd.FilterIndex);
            }
            Focus();

            return(success.Value
                                ? Optional.Some(result)
                                : Optional.None <FileDialogResult>());
        }
Ejemplo n.º 5
0
        public IAbsolutePath ResolveAbsolutePath(string nativePath)
        {
            try
            {
                var absPath = Path.IsPathRooted(nativePath)
                                        ? nativePath
                                        : Path.GetFullPath(nativePath);

                var isDirectory = Directory.Exists(nativePath);

                return(isDirectory
                                        ? (IAbsolutePath)AbsoluteDirectoryPath.Parse(absPath)
                                        : (IAbsolutePath)AbsoluteFilePath.Parse(absPath));
            }
            catch (ArgumentException e)
            {
                throw new InvalidPath(nativePath, e);
            }
            catch (NotSupportedException e)
            {
                throw new InvalidPath(nativePath, e);
            }
            catch (PathTooLongException e)
            {
                throw new InvalidPath(nativePath, e);
            }
        }
Ejemplo n.º 6
0
 public static AssemblyBuilt ReadDataFrom(BinaryReader reader)
 {
     return(new AssemblyBuilt
     {
         Assembly = AbsoluteFilePath.Parse(reader.ReadString()),
     });
 }
Ejemplo n.º 7
0
        public static IControl Debug(this IControl ctrl, string name, [CallerFilePath] string filepath = "", [CallerLineNumber] int lineNumber = 0)
        {
#if DEBUG
            var location = new ReplaySubject <IMountLocation>(1);
            ctrl = ctrl.WithMountLocation(
                oldLocation =>
            {
                location.OnNext(oldLocation);
                return(oldLocation);
            });

            var debugCtrl = new DebugControl(
                name,
                ctrl,
                location.Select(l => l.NativeFrame).Switch(),
                location.Select(l => l.AvailableSize).Switch(),
                AbsoluteFilePath.Parse(filepath),
                lineNumber);

            DebugControls.OnNext(DebugControls.Value.SetItem(debugCtrl.Name, debugCtrl));

            var selected = Command.Enabled(action: () => SelectedControl.OnNext(name));

            return(ctrl.WithOverlay(
                       SelectedControl.StartWithNone()
                       .Select(selCtrl => selCtrl.MatchWith(n => n == name, () => false))
                       .Select(isSelected => isSelected
                                                ? Shapes.Rectangle(stroke: Stroke.Create(2, Color.FromBytes(0x6d, 0xc0, 0xd2)), fill: Color.FromBytes(0x6d, 0xc0, 0xd2, 50))
                                                : Shapes.Rectangle().OnMouse(pressed: selected))
                       .Switch()
                       ));
#else
            return(ctrl);
#endif
        }
Ejemplo n.º 8
0
        bool SuggestionsBasedOnSyntax(GetCodeSuggestionsRequest codeCompletion, out IList <SuggestItem> suggestItems)
        {
            suggestItems = new List <SuggestItem>();

            if (!ValidateData(codeCompletion))
            {
                return(false);
            }

            var textPosition = new TextPosition(
                new LineNumber(codeCompletion.CaretPosition.Line),
                new CharacterNumber(codeCompletion.CaretPosition.Character));

            var syntax         = SyntaxLanguage.FromString(codeCompletion.SyntaxType).Syntax;
            var normalizedText = codeCompletion.Text.NormalizeLineEndings();
            var success        = _suggestionFactory.SuggestionsBasedOnSyntax(
                syntax,
                new SuggestionDependentData(
                    _engine.MainPackage,
                    _engine.Compiler,
                    AbsoluteFilePath.Parse(codeCompletion.Path),
                    normalizedText,
                    textPosition.ToOffset(normalizedText)),
                out suggestItems);

            if (success)
            {
                return(true);
            }

            _errors.OnNext(new Error(ErrorCode.InvalidData, string.Format("Tried to create suggestions for unknown syntax type {0}", new[] { codeCompletion.SyntaxType })));

            return(false);
        }
Ejemplo n.º 9
0
        public void ParseAndMakeAbsolute_AbsoluteWithoutRoot()
        {
            var nativePath = Platform.OperatingSystem == OS.Windows ? @"C:\foo" : "/foo";

            Assert.That(
                FilePath.ParseAndMakeAbsolute(nativePath),
                Is.EqualTo(AbsoluteFilePath.Parse(nativePath)));
        }
Ejemplo n.º 10
0
        public void ParseAndMakeAbsolute_AbsoluteWithRoot()
        {
            var root = Platform.OperatingSystem == OS.Windows ? @"C:\root" : "/root";
            var foo  = Platform.OperatingSystem == OS.Windows ? @"C:\foo" : "/foo";

            Assert.That(
                FilePath.ParseAndMakeAbsolute(foo, AbsoluteDirectoryPath.Parse(root)),
                Is.EqualTo(AbsoluteFilePath.Parse(foo)));
        }
Ejemplo n.º 11
0
        internal static AbsoluteFilePath SketchListFilePath(AbsoluteFilePath projectFilePath)
        {
            if (!projectFilePath.NativePath.EndsWith(".unoproj"))
            {
                throw new ArgumentException(projectFilePath.NativePath + " does not seem to be a .unoproj");
            }
            var regex = new Regex(@"\.unoproj$");

            return(AbsoluteFilePath.Parse(regex.Replace(projectFilePath.NativePath, SketchFilesExtension)));
        }
Ejemplo n.º 12
0
 void OpenDocumentWindow(string projectPath)
 {
     try
     {
         var projPath = AbsoluteFilePath.Parse(projectPath);
         OpenDocumentWindow(projPath);
     }
     catch (Exception e)
     {
         _reporter.Exception("Failed to load project '" + projectPath + "'", e, ReportTo.Log | ReportTo.Headquarters);
     }
 }
Ejemplo n.º 13
0
 public IObservable <CoalesceEntry> UpdateChangedDependencies(IObservable <IImmutableSet <ProjectDependency> > dependencies)
 {
     return(WatchSet(
                dependencies,
                onItemAdded: projDep =>
     {
         var path = AbsoluteFilePath.Parse(projDep.Path);
         return Watch(path)
         .Select(data => _dependencyFileSender.CreateMessages(data.WithMetadata(projDep)))
         .Switch();
     }));
 }
Ejemplo n.º 14
0
 public static string CreateApplicationClass(BuildProject args, string projectName, TypeName generatedClassName)
 {
     return(CreateApplicationClass(
                NetworkHelper
                .GetInterNetworkIps()
                .Select(ip => new IPEndPoint(ip, 12124)),
                AbsoluteFilePath.Parse(args.ProjectPath),
                args.Defines,
                projectName,
                args.OutputDir,
                generatedClassName));
 }
Ejemplo n.º 15
0
        /// <exception cref="Exception"></exception>
        /// <exception cref="FailedToCreateOutputDir"></exception>
        public SimulatorUnoProject CreateSimulatorProject(BuildProject args, PreviewTarget target, bool directToDevice, bool quitAfterApkLaunch)
        {
            var project      = AbsoluteFilePath.Parse(args.ProjectPath);
            var buildProject = Project.Load(project.NativePath);
            var projectDir   = project.ContainingDirectory;

            var basePath = AbsoluteDirectoryPath.Parse(buildProject.BuildDirectory) / target.ToString();

            var outputDir = FindOutputDir(args, basePath);

            var preambleDir = outputDir / "preamble";
            var cacheDir    = outputDir / "cache";

            _cacheCleaner.CleanIfNecessary(cacheDir);
            SetCacheDir(buildProject, projectDir, cacheDir);

            var applicationClassName = TypeName.Parse("Outracks.Simulator.GeneratedApplication");
            var applicationClass     = ApplicationClassGenerator.CreateApplicationClass(args, buildProject.Name, applicationClassName);
            var dependencies         = ApplicationClassGenerator.Dependencies;

            AddPreamble(buildProject, preambleDir, projectDir, applicationClass, dependencies);
            AddIcons(buildProject, preambleDir, projectDir);
            ChangePackageName(buildProject);
            ChangeTitle(buildProject, oldTitle => oldTitle + " (preview)");

            var buildOptions = new BuildOptions
            {
                OutputDirectory = outputDir.NativePath,
                Configuration   = BuildConfiguration.Preview,
                MainClass       = applicationClassName.FullName,
                Strip           = target != PreviewTarget.Local,
            };

            foreach (var define in args.Defines.UnionOne("Designer"))
            {
                buildOptions.Defines.Add(define);
            }

            if (target == PreviewTarget.iOS && !directToDevice)
            {
                // 17.12.15 - Prevent double building when exporting to iOS. (Uno bug)
                buildOptions.RunArguments = "debug";
                buildOptions.Native       = false;
            }

            if (quitAfterApkLaunch)
            {
                buildOptions.RunArguments += " -L";
            }

            return(new SimulatorUnoProject(buildProject, buildOptions, "", args.Verbose, args.BuildLibraries));
        }
Ejemplo n.º 16
0
        static IElement CreateTree(string xmlText = "<Parent><FirstChild /><SecondChild /></Parent>")
        {
            var parent = new LiveElement(
                AbsoluteFilePath.Parse("foo/bar"),
                Observable.Never <ILookup <Simulator.ObjectIdentifier, Simulator.ObjectIdentifier> >(),
                Observable.Return(true),
                new Subject <Unit>(),
                Observer.Create <IBinaryMessage>(msg => { }),
                s => Element.Empty);

            parent.UpdateFrom(SourceFragment.FromString(xmlText).ToXml());

            return(parent);
        }
Ejemplo n.º 17
0
        public void TestBundleFileDiffing()
        {
            var scheduler     = new TestScheduler();
            var assetsWatcher = CreateAssetsWatcher(scheduler, CreateFileChangesForDiff());

            var path = AbsoluteFilePath.Parse("/c/Foo.png");

            var whatHappened = assetsWatcher.UpdateChangedBundleFiles(Observable.Return(ImmutableHashSet.Create(path))).Check();

            scheduler.Start();

            Assert.AreEqual(4, whatHappened.Results.Count, "Seems like our file diffing routine is broken, got incorrect number of file changed events.");
            Assert.IsNull(whatHappened.Error, "Did not expect any errors in the observable stream.");
        }
Ejemplo n.º 18
0
        static AbsoluteFilePath GetPathForPid(int pid)
        {
            const int maxPath    = 1024 * 4;
            var       pathBuffer = new StringBuilder(maxPath);
            var       res        = proc_pidpath(pid, pathBuffer, maxPath);

            if (res <= 0)
            {
                throw new FailedToAcquirePathForPid(res);
            }

            var path = AbsoluteFilePath.Parse(pathBuffer.ToString());

            return(path);
        }
Ejemplo n.º 19
0
        static void AssertIfDiffers(MessageDatabase database, string filePathStr)
        {
#if DUMP_MODE
            var relativePath = RelativeFilePath.Parse(filePathStr);
            var dumpPath     = AbsoluteDirectoryPath.Parse("../../") / relativePath;
            database.Dump(dumpPath);
#endif
            var filePath         = AbsoluteFilePath.Parse(filePathStr);
            var originalDatabase = MessageDatabase.From(filePath);
            MessageDatabase.From(filePath);

            var errors = new Subject <string>();
            errors.Subscribe(Console.WriteLine);
            Assert.True(MessageDatabase.IsEqualWhileIgnoreComments(originalDatabase, database, errors), "Looks like you have changed the plugin API");
        }
Ejemplo n.º 20
0
        static AbsoluteFilePath GetPathForProcess(Process process)
        {
            int maxPath = 1024 * 4;
            var exePath = new StringBuilder(maxPath);
            var res     = QueryFullProcessImageName(process.Handle, 0, exePath, ref maxPath);

            if (!res)
            {
                throw new FailedToAcquirePathForPid(Marshal.GetLastWin32Error());
            }

            var path = AbsoluteFilePath.Parse(exePath.ToString());

            return(path);
        }
Ejemplo n.º 21
0
        /// <remarks> This function will update Result as a side-effect </remarks>
        /// <returns> (RebuildRequired | (Started (LogEvent)* [BytecodeGenerated] Ended))* </returns>
        public IObservable <IBinaryMessage> Reify(IObservable <GenerateBytecode> args)
        {
            return(_builder.Result.Switch(maybeBuild =>
                                          maybeBuild.MatchWith(
                                              none: () =>
            {
                // Can't do any reifying without a build
                _result.OnNext(Optional.None());
                return args.Select(arg =>
                                   (IBinaryMessage) new RebuildRequired());
            },
                                              some: build =>
            {
                var markupParser = new MarkupParser(
                    build,
                    new UxParser(
                        build.Project,
                        new GhostCompilerFactory(build.TypeInfo)));

                // Let's answer those reify calls with some proper bytecode and build events
                return args
                .Select(a =>
                        Observable.Create <IBinaryMessage>(observer =>
                {
                    observer.OnNext(new Started {
                        Command = a
                    });

                    var markup = markupParser.TryParseDocuments(a, observer, a.Id);
                    _result.OnNext(markup);

                    var bytecode = TryCompile(markup, observer, a.Id);
                    if (bytecode.HasValue)
                    {
                        observer.OnNext(new BytecodeGenerated(bytecode.Value));
                    }

                    observer.OnNext(new Ended {
                        Command = a, Success = bytecode.HasValue, BuildDirectory = AbsoluteFilePath.Parse(build.Assembly).ContainingDirectory
                    });

                    observer.OnCompleted();

                    return Disposable.Empty;
                }))
                .Concat();
            })));
        }
Ejemplo n.º 22
0
        bool ChangeProject(string projectPath)
        {
            _currentProject = Project.Load(projectPath);

            new Shell()
            .Watch(AbsoluteFilePath.Parse(projectPath).ContainingDirectory, "*.unoproj")
            .Where(e => e.Event == FileSystemEvent.Changed || e.Event == FileSystemEvent.Removed)
            .Subscribe(f => _currentProject = null);

            MainPackage = PackageCache.GetPackage(Log.Default, _currentProject);
            MainPackage.SetCacheDirectory((AbsoluteDirectoryPath.Parse(MainPackage.CacheDirectory) / new DirectoryName("CodeCompletion")).NativePath);

            TriggerBuild();

            return(true);
        }
        static IElement CreateTree(string uxSource)
        {
            var parent = new LiveElement(
                AbsoluteFilePath.Parse("foo/bar"),
                Observable.Never <ILookup <Simulator.ObjectIdentifier, Simulator.ObjectIdentifier> >(),
                Observable.Return(true),
                new Subject <Unit>(),
                Observer.Create <IBinaryMessage>(msg => { }),
                s => Element.Empty);

            // Panel is an example of an instance
            // Circle is an example of a class (called MyClass)
            parent.UpdateFrom(SourceFragment.FromString(uxSource).ToXml());

            return(parent);
        }
Ejemplo n.º 24
0
        static IElement CreateRootElement(SourceFragment fragment, string filename)
        {
            var parent = new LiveElement(
                AbsoluteFilePath.Parse("/project/" + filename),
                Observable.Never <ILookup <ObjectIdentifier, ObjectIdentifier> >(),
                Observable.Return(true),
                new Subject <Unit>(),
                Observer.Create <IBinaryMessage>(msg => { }),
                s => Element.Empty);

            // Panel is an example of an instance
            // Circle is an example of a class (called MyClass)
            parent.UpdateFrom(fragment.ToXml());

            return(parent);
        }
Ejemplo n.º 25
0
        public Optional <ProjectBuild> TryBuild(BuildProject args, Log logger)
        {
            try
            {
                var project = _simulatorBuilder.CreateSimulatorProject(args);

                var libraryBuilder = new LibraryBuilder(new Disk(logger), BuildTargets.Package)
                {
                    Express = true
                };
                var projectBuilder = new ProjectBuilder(logger, new LocalSimulatorTarget(), project.Options);

                if (project.IsVerboseBuild)
                {
                    logger.Level = Uno.Logging.LogLevel.Verbose;
                }

                if (project.BuildLibraries)
                {
                    libraryBuilder.Build();
                }

                var buildResult = projectBuilder.Build(project.Project);

                if (buildResult.ErrorCount != 0)
                {
                    return(Optional.None());
                }

                var b = new LocalBuild(buildResult, AbsoluteFilePath.Parse(args.ProjectPath));
                return(new ProjectBuild(b.Path.NativePath, b.SaveSimulatorMetadata(_fileSystem).NativePath, b.GetTypeInformation()));
            }
            catch (ThreadAbortException)
            {
            }
            catch (SourceException e)
            {
                logger.Error(e.Source, null, e.Message);
            }
            catch (Exception e)
            {
                logger.Error(e.Message);
            }
            return(Optional.None());
        }
Ejemplo n.º 26
0
        public void SketchFilePaths_ParsesJson()
        {
            var absPathFile = Platform.OperatingSystem == OS.Windows ? @"C:\\File2.sketch" : @"/File2.sketch";
            var relPathFile = Platform.OperatingSystem == OS.Windows ? @"SketchFiles\\File1.sketch" : "SketchFiles/File1.sketch";
            var content     = "[\"" + relPathFile + "\",\"" + absPathFile + "\"]";

            File.WriteAllText(_sketchListFile.NativePath, content);
            var report      = Substitute.For <IReport>();
            var fs          = Substitute.For <IFileSystem>();
            var sketchFiles = new SketchWatcher(report, fs).SketchFilePaths(_sketchListFile);

            var expected = new List <IFilePath>
            {
                RelativeFilePath.Parse(relPathFile),
                AbsoluteFilePath.Parse(absPathFile)
            };

            Assert.That(sketchFiles, Is.EqualTo(expected));
        }
Ejemplo n.º 27
0
        public void TestAddingMoreAndRemovingFiles1()
        {
            var scheduler = new TestScheduler();

            var foo = AbsoluteFilePath.Parse("/c/Foo.js");
            var bar = AbsoluteFilePath.Parse("/c/Bar.js");
            var lol = AbsoluteFilePath.Parse("/c/lol.js");

            var fileSystem = Substitute.For <IFileSystem>();

            SetFilesChanges(fileSystem, foo, new[]
            {
                OnNext(0, Encoding.UTF8.GetBytes("let foo = 0;")),
                OnNext(TimeSpan.FromSeconds(4).Ticks, Encoding.UTF8.GetBytes("let foo = 40;")),
                OnNext(TimeSpan.FromSeconds(7.1).Ticks, Encoding.UTF8.GetBytes("let foo = 700;"))
            }, scheduler);
            SetFilesChanges(fileSystem, bar, new[]
            {
                OnNext(0, Encoding.UTF8.GetBytes("let bar = 0;")),
                OnNext(TimeSpan.FromSeconds(5).Ticks, Encoding.UTF8.GetBytes("let bar = 50;"))
            }, scheduler);
            SetFilesChanges(fileSystem, lol, new[]
            {
                OnNext(0, Encoding.UTF8.GetBytes("let lol = 0;")),
                OnNext(TimeSpan.FromSeconds(6).Ticks, Encoding.UTF8.GetBytes("let lol = 10;"))
            }, scheduler);

            var assetsWatcher = new AssetsWatcher(fileSystem, Observable.Return(DirectoryPath.GetTempPath()), scheduler);

            var whatHappened = assetsWatcher.UpdateChangedBundleFiles(
                scheduler.CreateColdObservable(
                    OnNext(TimeSpan.FromSeconds(0).Ticks, ImmutableHashSet.Create(foo)),
                    OnNext(TimeSpan.FromSeconds(1).Ticks, ImmutableHashSet.Create(foo, bar)),
                    OnNext(TimeSpan.FromSeconds(2).Ticks, ImmutableHashSet.Create(foo, bar, lol)),
                    OnNext(TimeSpan.FromSeconds(6).Ticks, ImmutableHashSet.Create(foo, bar)),
                    OnNext(TimeSpan.FromSeconds(7).Ticks, ImmutableHashSet.Create(foo))
                    )).Check();

            scheduler.Start();

            Assert.AreEqual(6, whatHappened.Results.Count, "Seems like adding and removing files doesn't work, got incorrect number of file changed events.\n{0}", string.Join("\n", whatHappened.Results.Select(e => e.CoalesceKey + ": " + e.BlobData.ToString())));
            Assert.IsNull(whatHappened.Error, "Did not expect any errors in the observable stream.");
        }
Ejemplo n.º 28
0
        internal static LiveElement CreateLiveElement(
            string xmlText,
            Optional <string> path = default(Optional <string>),
            Optional <ISubject <Unit> > invalidated = default(Optional <ISubject <Unit> >))
        {
            var root = new LiveElement(
                AbsoluteFilePath.Parse(path.Or("/project/MainView.ux")),
                Observable.Never <ILookup <ObjectIdentifier, ObjectIdentifier> >(),
                Observable.Return(true),
                invalidated.Or(() => (ISubject <Unit>) new Subject <Unit>()),
                Observer.Create <IBinaryMessage>(msg => { }),
                s => Element.Empty);

            // Panel is an example of an instance
            // Circle is an example of a class (called MyClass)
            root.UpdateFrom(SourceFragment.FromString(xmlText).ToXml());

            return(root);
        }
Ejemplo n.º 29
0
        public void TestThrottle()
        {
            var scheduler     = new TestScheduler();
            var assetsWatcher = CreateAssetsWatcher(scheduler, new[]
            {
                OnNext(TimeSpan.FromMilliseconds(0).Ticks, Encoding.UTF8.GetBytes("a")),
                OnNext(TimeSpan.FromMilliseconds(1).Ticks, Encoding.UTF8.GetBytes("bb")),
                OnNext(TimeSpan.FromMilliseconds(2).Ticks, Encoding.UTF8.GetBytes("ccc")),
                OnNext(TimeSpan.FromMilliseconds(2000).Ticks, Encoding.UTF8.GetBytes("ccc")),
            });

            var path = AbsoluteFilePath.Parse("/c/Foo.js");

            var whatHappened = assetsWatcher.UpdateChangedBundleFiles(Observable.Return(ImmutableHashSet.Create(path))).Check();

            scheduler.Start();

            Assert.AreEqual(2, whatHappened.Results.Count, "Seems like our throttle is broken, got incorrect number of file changed events.\n{0}", string.Join("\n", whatHappened.Results.Select(e => e.CoalesceKey + ": " + e.BlobData.ToString())));
            Assert.IsNull(whatHappened.Error, "Did not expect any errors in the observable stream.");
        }
Ejemplo n.º 30
0
        ErrorItem MapBuildIssue(BuildIssueDetected buildIssue)
        {
            var source = buildIssue.Source
                         .Select(
                s => s.Location.Select(
                    loc => new ErrorSourceInfo {
                Column = loc.Character, Line = loc.Line, File = AbsoluteFilePath.Parse(s.File)
            }))
                         .SelectMany(x => x);

            return(new ErrorItem
            {
                Message = buildIssue.Message,
                Source = source,
                Tags = new[] { new ErrorTag {
                                   Brush = Theme.ErrorColor, Name = "Build"
                               } },
                Title = buildIssue.Message.Contains(" Line") ? buildIssue.Message.BeforeFirst(" Line") : buildIssue.Message
            });
        }