public void RenderTo(IFilesystem filesystem, string basePath) { var path = Path.GetFullPath(basePath); Log.InfoFormat("Rendering documentation to '{0}'...", path); foreach (var typeCreator in _types) { var documentationWriter = new TypeDocumentationMarkdownWriter(_assemblyDocumentationReader, typeCreator.Type); var directory = Path.Combine(path, typeCreator.Type.FullName); var fileName = Path.Combine(directory, "README.md"); typeCreator.RenderTo(filesystem, directory, documentationWriter); var stream = new MemoryStream(); var streamWriter = new StreamWriter(stream); documentationWriter.WriteTo(streamWriter); streamWriter.Flush(); stream.Position = 0; WriteDocumentationTo(filesystem, fileName, stream); } Log.InfoFormat("Rendering documentation finished!"); }
public SharedLibAnalyzer(IFilesystem filesystem, IFileInfo coredump, SDResult analysisResult, bool addBackingFiles) { this.coredump = coredump ?? throw new ArgumentNullException("Coredump must not be null!"); this.filesystem = filesystem ?? throw new ArgumentNullException("Filesystem must not be null!"); this.analysisResult = analysisResult ?? throw new ArgumentNullException("Analysis result must not be null!"); this.addBackingFiles = addBackingFiles; }
public FileOperationView(IFilesystem filesystem) { InitializeComponent(); ViewModel = new FileOperationViewModel(filesystem); this.WhenActivated(d => { d(this.BindCommand(ViewModel, vm => vm.PauseOrResume, v => v.btnPause)); d(this.BindCommand(ViewModel, vm => vm.Cancel, v => v.btnCancel)); d(this.WhenAnyValue(x => x.ViewModel.FileCount, x => x.ViewModel.Mode) .ObserveOn(RxApp.MainThreadScheduler) .Select(_ => FormatTitle()) .BindTo(lblTitle, x => x.Text)); d(this.WhenAnyValue(x => x.ViewModel.Destination) .ObserveOn(RxApp.MainThreadScheduler) .Select(Path.GetFileName) .Subscribe(str => { if (str == null) { lblDestination.Visible = false; } else { lblDestination.Text = str; } })); d(this.WhenAnyValue(x => x.ViewModel.Destination) .ObserveOn(RxApp.MainThreadScheduler) .Subscribe(destination => toolTip.SetToolTip(lblDestination, destination))); d(lblDestination.Events() .LinkClicked .ObserveOn(RxApp.MainThreadScheduler) .Subscribe(_ => Process.Start(ViewModel.Destination))); d(this.WhenAnyValue(x => x.ViewModel.Status, x => x.ViewModel.Progress, x => x.ViewModel.FileCount) .ObserveOn(RxApp.MainThreadScheduler) .Select(_ => FormatProgressText()) .BindTo(lblProgress, x => x.Text)); d(this.WhenAnyValue(x => x.ViewModel.Status) .ObserveOn(RxApp.MainThreadScheduler) .Subscribe(UpdateProgressBarStyle)); d(this.WhenAnyValue(x => x.ViewModel.Status) .ObserveOn(RxApp.MainThreadScheduler) .Select(status => status == OperationStatus.Paused ? Properties.Resources.control_180 : Properties.Resources.control_pause) .BindTo(btnPause, x => x.Image)); d(this.WhenAnyValue(x => x.ViewModel.Progress) .ObserveOn(RxApp.MainThreadScheduler) .Select(_ => (int)(ViewModel.Progress / (float)ViewModel.FileCount * 100)) .BindTo(pbProgress, x => x.Value)); }); }
public BedrockResourcePack(IFilesystem archive, ResourcePack.LoadProgress progressReporter = null) { _archive = archive; Info = GetManifest(archive); Load(progressReporter); }
public CoreDumpAnalyzer(IArchiveHandler archiveHandler, IFilesystem filesystem, IProcessHandler processHandler, IHttpRequestHandler requestHandler) { this.archiveHandler = archiveHandler ?? throw new ArgumentNullException("ArchiveHandler must not be null!"); this.filesystem = filesystem ?? throw new ArgumentNullException("Filesystem must not be null!"); this.processHandler = processHandler ?? throw new ArgumentNullException("ProcessHandler must not be null!"); this.requestHandler = requestHandler ?? throw new ArgumentNullException("RequestHandler must not be null!"); }
public static Task Add(IWin32Window window, Overlay overlay, IFilesystem filesystem, IFolder folder, string[] files) { var view = new FileOperationView(filesystem); overlay.Show(view); return(Task.Run(() => view.ViewModel.StartAdd(folder, files))); }
/// <summary> /// Initializes this text log file. /// </summary> /// <param name="filesystem"></param> /// <param name="taskScheduler"></param> /// <param name="fileName"></param> /// <param name="format"></param> /// <param name="encoding"></param> internal StreamingTextLogSource(IFilesystem filesystem, ITaskScheduler taskScheduler, string fileName, ILogFileFormat format, Encoding encoding) { _filesystem = filesystem; _taskScheduler = taskScheduler; _encoding = encoding; _listeners = new LogSourceListenerCollection(this); _sourceDoesNotExist = new SourceDoesNotExist(fileName); _sourceCannotBeAccessed = new SourceCannotBeAccessed(fileName); _fileName = fileName ?? throw new ArgumentNullException(nameof(fileName)); _index = new LogBufferList(StreamingTextLogSource.LineOffsetInBytes); _propertiesBuffer = new PropertiesBufferList(); _propertiesBuffer.SetValue(Core.Properties.Name, _fileName); _propertiesBuffer.SetValue(Core.Properties.Format, format); _propertiesBuffer.SetValue(TextProperties.RequiresBuffer, true); _propertiesBuffer.SetValue(TextProperties.LineCount, 0); _properties = new ConcurrentPropertiesList(Core.Properties.Minimum); SynchronizeProperties(); _cancellationTokenSource = new CancellationTokenSource(); _columns = new IColumnDescriptor[] { Core.Columns.Index, StreamingTextLogSource.LineOffsetInBytes, Core.Columns.RawContent }; _pendingReadRequests = new ConcurrentQueue <IReadRequest>(); _fileScanTask = _taskScheduler.StartPeriodic(() => RunFileScan(_cancellationTokenSource.Token)); _fileReadTask = _taskScheduler.StartPeriodic(() => RunFileRead(_cancellationTokenSource.Token)); }
public FileLogSource(IServiceContainer services, string fileName, TimeSpan maximumWaitTime) : base(services.Retrieve <ITaskScheduler>()) { _syncRoot = new object(); _filesystem = services.Retrieve <IFilesystem>(); _services = services; _fullFilename = Path.IsPathRooted(fileName) ? fileName : Path.Combine(Directory.GetCurrentDirectory(), fileName); _maximumWaitTime = maximumWaitTime; _sourceDoesNotExist = new SourceDoesNotExist(fileName); _sourceCannotBeAccessed = new SourceCannotBeAccessed(fileName); var formatMatcher = services.Retrieve <ILogFileFormatMatcher>(); _encodingDetector = new EncodingDetector(); _formatDetector = new FileFormatDetector(formatMatcher); _buffer = new LogBufferArray(MaximumLineCount, Core.Columns.RawContent); _pendingSections = new ConcurrentQueue <KeyValuePair <ILogSource, LogSourceModification> >(); _propertiesBuffer = new PropertiesBufferList(); _propertiesBuffer.SetValue(Core.Properties.Name, _fullFilename); _properties = new ConcurrentPropertiesList(); StartTask(); }
/// <summary> /// Mount root partition to VFS /// </summary> /// <param name="node">Partition node</param> /// <param name="name">Mount name</param> /// <param name="fsType">Filesystem type</param> /// <returns>Status</returns> public static DiskMountResult Mount(Node node, string name, string fsType) { IFilesystem fs = (IFilesystem)mFilesystems.Get(fsType); if (fs == null) { return(DiskMountResult.FS_TYPE_NOT_FOUND); } Node retNode = fs.Init(node); if (retNode == null) { return(DiskMountResult.INIT_FAIL); } RootPoint point = VFS.RootMountPoint.GetEntry(name); if (point != null) { return(DiskMountResult.MOUNT_POINT_ALREADY_USED); } RootPoint dev = new RootPoint(name, retNode); VFS.RootMountPoint.AddEntry(dev); return(DiskMountResult.SUCCESS); }
public DirectoryCopyCommand(IFilesystem filesystem, string source, string destination) { this.filesystem = filesystem; this.source = source; this.destination = destination; }
public GdbAnalyzer(IFilesystem filesystem, IProcessHandler processHandler, IFileInfo coredump, SDResult result) { this.filesystem = filesystem ?? throw new ArgumentNullException("FilesystemHelper must not be null!"); this.processHandler = processHandler ?? throw new ArgumentNullException("ProcessHandler must not be null!"); this.coredump = coredump ?? throw new ArgumentNullException("Coredump must not be null!"); this.analysisResult = result ?? throw new ArgumentNullException("SD Result Path must not be null!"); }
public SameDomainHandlerFactory(AssemblyGenerator assemblyGenerator, AssemblyRegistry assemblyRegistry, IFilesystem filesystem) { _assemblyGenerator = assemblyGenerator; _assemblyRegistry = assemblyRegistry; _filesystem = filesystem; }
/// <summary> /// </summary> /// <param name="filesystem"></param> /// <param name="pluginPaths"></param> public PluginArchiveLoader(IFilesystem filesystem, params string[] pluginPaths) { _filesystem = filesystem; _plugins = new Dictionary <PluginId, PluginGroup>(); AppDomain.CurrentDomain.AssemblyResolve += ResolveAssembly; try { // TODO: How would we make this truly async? Currently the app has to block until all plugins are loaded which is sad foreach (var path in pluginPaths) { TryLoadPluginsFrom(filesystem, path); } foreach (var plugin in _plugins.Values) { plugin.Load(); } } catch (Exception e) { Log.ErrorFormat("Caught exception while trying to load plugins:\r\n{0}", e); } }
public ExitCode Run(IFilesystem filesystem, IInternalPluginRepository repository, AddUserOptions options) { try { var accessToken = repository.AddUser(options.Username, options.Email, options.AccessToken); Log.InfoFormat("Added user {0}, {1}", options.Username, options.Email); Log.InfoFormat("The following access token has been generated for this user"); Log.InfoFormat("DO NOT SHARE THIS TOKEN WITH ANYONE AS IT CAN BE USED TO PUSH PLUGINS TO THIS REPOSITORY"); Log.InfoFormat("\t{0}", accessToken); return(ExitCode.Success); } catch (CannotAddUserException e) { if (!e.IsError) { Log.WarnFormat(e.Message); return(ExitCode.Success); } Log.ErrorFormat(e.Message); return(ExitCode.GenericFailure); } }
public RemoteHandlerFactory(AssemblyGenerator assemblyGenerator, AssemblyRegistry assemblyRegistry, IFilesystem filesystem) { _assemblyGenerator = assemblyGenerator; _assemblyRegistry = assemblyRegistry; _filesystem = filesystem; }
public FolderDataSource(ITaskScheduler taskScheduler, ILogFileFactory logFileFactory, IFilesystem filesystem, DataSource settings) : this(taskScheduler, logFileFactory, filesystem, settings, TimeSpan.FromMilliseconds(value : 10)) { }
public void SetupContext() { FakeFilesystem = MockRepository.GenerateMock<IFilesystem>(); _fakeParser = MockRepository.GenerateMock<IConfigParser>(); FilesystemConfigReader = new FilesystemConfigReader(FakeFilesystem, _fakeParser); }
private static bool TryLoadPlugin(IFilesystem filesystem, string fileName, out byte[] plugin, out ExitCode exitCode) { try { plugin = filesystem.ReadAllBytes(fileName); exitCode = ExitCode.Success; return(true); } catch (DirectoryNotFoundException e) { Log.ErrorFormat("Unable to add plugin: {0}", e.Message); plugin = null; exitCode = ExitCode.DirectoryNotFound; return(false); } catch (FileNotFoundException e) { Log.ErrorFormat("Unable to add plugin: {0}", e.Message); plugin = null; exitCode = ExitCode.FileNotFound; return(false); } }
public FilesystemStoryReader(IFilesystem filesystem, ConfigSettings settings) { _settings = settings; Filesystem = filesystem; _filter = new FileExtensionFilter(_settings); }
/// <summary> /// </summary> /// <param name="filesystem"></param> /// <param name="path"></param> public PluginArchiveLoader(IFilesystem filesystem, string path) { _filesystem = filesystem; _plugins = new Dictionary <PluginId, PluginGroup>(); try { // TODO: How would we make this truly async? Currently the app has to block until all plugins are loaded wich is sad var files = filesystem.EnumerateFiles(path, string.Format("*.{0}", PluginArchive.PluginExtension)) .Result; foreach (var pluginPath in files) { TryOpenPlugin(pluginPath); } foreach (var plugin in _plugins.Values) { plugin.Load(); } } catch (DirectoryNotFoundException e) { Log.WarnFormat("Unable to find plugins in '{0}': {1}", path, e); } catch (Exception e) { Log.ErrorFormat("Unable to find plugins in '{0}': {1}", path, e); } }
void RegisterPlugin(IFilesystem plugin) { if (!PluginsList.ContainsKey(plugin.Name.ToLower())) { PluginsList.Add(plugin.Name.ToLower(), plugin); } }
public AnalysisStorage(ITaskScheduler taskScheduler, IFilesystem filesystem, ILogAnalyserEngine logAnalyserEngine, ITypeFactory typeFactory = null) { if (taskScheduler == null) { throw new ArgumentNullException(nameof(taskScheduler)); } if (filesystem == null) { throw new ArgumentNullException(nameof(filesystem)); } if (logAnalyserEngine == null) { throw new ArgumentNullException(nameof(logAnalyserEngine)); } _taskScheduler = taskScheduler; _logAnalyserEngine = logAnalyserEngine; _filesystem = filesystem; _syncRoot = new object(); _snapshots = new SnapshotsWatchdog(taskScheduler, filesystem, typeFactory); _templates = new List <ActiveAnalysisConfiguration>(); _analyses = new Dictionary <AnalysisId, ActiveAnalysis>(); _lastSavedAnalyses = new Dictionary <AnalysisId, ActiveAnalysisConfiguration>(); }
public void SetupContext() { FakeFilesystem = MockRepository.GenerateMock<IFilesystem>(); Settings = new ConfigSettings { StoryBasePath = BasePath }; Reader = new SingleFileStoryReader(FakeFilesystem, Settings, "foo.feature"); FakeFilesystem.Stub(x => x.GetFileText("foo.feature")).Return("foo"); }
/// <summary> /// /// </summary> /// <param name="fs"></param> /// <param name="pathToCache">The directory that contains the cache files</param> /// <param name="jsonSerializerSettings"></param> public FilesystemDataProvider(IFilesystem fs, string pathToCache, JsonSerializerSettings jsonSerializerSettings) { _fs = fs ?? throw new ArgumentNullException(nameof(fs)); _cacheParentDirectory = string.IsNullOrWhiteSpace(pathToCache) ? throw new ArgumentNullException(nameof(pathToCache)) : pathToCache; _jsonSerializerSettings = jsonSerializerSettings ?? throw new ArgumentNullException(nameof(jsonSerializerSettings)); }
public RemoteStoryHandler(string assemblyLocation, IFilesystem filesystem, IResultListener listener, IEnumerable<string> assemblyLocations) { _assemblyLocation = assemblyLocation; _listener = listener; _assemblyLocations = assemblyLocations; _filesystem = filesystem; }
public void RenderTo(IFilesystem filesystem, string path, ITypeDocumentationWriter writer) { foreach (var creator in _creators) { var exampleWriter = writer.AddExample(creator.Name); creator.RenderTo(exampleWriter); } }
public ExitCode Run(IFilesystem filesystem, IInternalPluginRepository repository, ListPluginsOptions options) { foreach (var plugin in repository.FindAllPlugins()) { Console.WriteLine("\t{0}", plugin); } return(ExitCode.Success); }
public RemoteStoryHandler(string assemblyLocation, IFilesystem filesystem, IEventBus eventBus, IEnumerable <string> assemblyLocations) { _assemblyLocation = assemblyLocation; _assemblyLocations = assemblyLocations; _filesystem = filesystem; _eventBus = eventBus; }
public GdbSharedLibAnalyzer(IFilesystem filesystem, IProcessHandler processHandler, IFileInfo coredump, SDResult result) { this.filesystem = filesystem ?? throw new ArgumentNullException("FilesystemHelper must not be null!"); this.processHandler = processHandler ?? throw new ArgumentNullException("ProcessHandler must not be null!"); this.coredump = coredump ?? throw new ArgumentNullException("Coredump must not be null!"); this.systemContext = (SDCDSystemContext)result.SystemContext; this.systemContext.Modules = new List <SDModule>(); }
public RemoteStoryHandler(string assemblyLocation, IFilesystem filesystem,IEventBus eventBus, IEnumerable<string> assemblyLocations) { _assemblyLocation = assemblyLocation; _assemblyLocations = assemblyLocations; _filesystem = filesystem; _eventBus = eventBus; }
/// <summary> /// Register filesystems /// </summary> /// <param name="filesystem">Filesystem</param> /// <param name="name">Name</param> public static void RegisterFilesystem(IFilesystem filesystem, string name) { if (mFilesystems.Get(name) != null) { return; } mFilesystems.Add(name, filesystem); }
public void SetupContext() { FakeFilesystem = MockRepository.GenerateMock <IFilesystem>(); Settings = new ConfigSettings { StoryBasePath = BasePath }; Reader = new SingleFileStoryReader(FakeFilesystem, Settings, "foo.feature"); FakeFilesystem.Stub(x => x.GetFileText("foo.feature")).Return("foo"); }
public ConfigurationSetup(ILogger console, IRuntime runtime, IErrorHandler errors, IFilesystem filesystem) { _console = console; _runtime = runtime; _errors = errors; _filesystem = filesystem; }
/// <summary> /// Initializes a new instance of the <see cref="MqttConfigGenerator"/> class. /// </summary> /// <param name="actuatorTransformer"></param> /// <param name="sensorTransformer"></param> public MqttConfigGenerator(IFilesystem filesystem, MqttActuatorConfigTransformer actuatorTransformer, MqttSensorConfigTransformer sensorTransformer, TemplateSensorConfigTransformer templateSensorTransformer) : base(filesystem) { _actuatorTransformer = actuatorTransformer ?? throw new ArgumentNullException(nameof(actuatorTransformer)); _sensorTransformer = sensorTransformer ?? throw new ArgumentNullException(nameof(sensorTransformer)); _templateSensorTransformer = templateSensorTransformer ?? throw new ArgumentNullException(nameof(templateSensorTransformer)); }
public ClassGenerator(IFilesystem filesystem) { _filesystem = filesystem; string codeBase = Assembly.GetExecutingAssembly().CodeBase; UriBuilder uri = new UriBuilder(codeBase); string path = Uri.UnescapeDataString(uri.Path); ResourceDirectory = Path.Combine(Path.GetDirectoryName(path), "templates"); }
public void SetupContext() { FakeFilesystem = MockRepository.GenerateMock<IFilesystem>(); Settings = new ConfigSettings {StoryBasePath = BasePath}; Reader = new FilesystemStoryReader(FakeFilesystem, Settings); FakeFilesystem.Stub(x => x.GetFilesInFolder(BasePath)) .Return(new[] {"ignore.txt", "feature.feature","bar.story"}); FakeFilesystem.Stub(x => x.GetSubFolders(BasePath)) .Return(new string[0]); }
public void SetupContext() { FakeFilesystem = MockRepository.GenerateMock<IFilesystem>(); _fakeParser = MockRepository.GenerateMock<IConfigParser>(); FakeFilesystem .Stub(x => x.GetFilesInFolder(Arg<string>.Is.Anything)) .Return(new string[0]); FilesystemConfigReader = new FilesystemConfigReader(FakeFilesystem, _fakeParser); }
public static void Initialize() { Fl.Initialize(); Logger.Initialize(); Config.Initialize(); Locale.Initialize(); //The filesystem to use (Only for server actions! e.g. logging and config are handled through the normal filesystem //This can be changed later on //e.g. when FTP connection settings are read from config or user presses connect button ServerFileSystem = new LocalFileSystem(); }
public ResourceWriter(IFilesystem filesystem) { Filesystem = filesystem; }
public FilesystemStoryReader(IFilesystem filesystem, ConfigSettings settings) { _settings = settings; Filesystem = filesystem; }
public FilesystemConfigReader(IFilesystem filesystem, IConfigParser parser) { _filesystem = filesystem; _parser = parser; }
public SingleFileStoryReader(IFilesystem filesystem, ConfigSettings settings, string filename) { _filesystem = filesystem; _settings = settings; _filename = filename; }
public InitJob(IFilesystem filesystem) { Filesystem = filesystem; }
public ScriptScannerFactory(IFilesystem filesystem) { _filesystem = filesystem; }
public void SetupContext() { Filesystem = MockRepository.GenerateMock<IFilesystem>(); Job = new InitJob(Filesystem); Job.Run(); }
public void SetupContext() { FakeFilesystem = MockRepository.GenerateMock<IFilesystem>(); Settings = new ConfigSettings {StoryBasePath = BasePath, ScenarioExtensions = new string[] {}}; Reader = new FilesystemStoryReader(FakeFilesystem, Settings); FakeFilesystem.Stub(x => x.GetFilesInFolder(BasePath)) .Return(new[] { "ignore.txt", "feature.feature" }); FakeFilesystem.Stub(x => x.GetFileText(BasePath + "\\ignore.txt")) .Return(NotAStory); FakeFilesystem.Stub(x => x.GetFileText(BasePath + "\\feature.feature")) .Return(AStory); FakeFilesystem.Stub(x => x.GetSubFolders(BasePath)) .Return(new string[0]); }
public RemoteHandlerFactory(AssemblyGenerator assemblyGenerator, ConfigSettings settings, IFilesystem filesystem) { _assemblyGenerator = assemblyGenerator; _settings = settings; _filesystem = filesystem; }
public UpScriptScanner(IFilesystem filesystem) { _filesystem = filesystem; }
public InitScriptScanner(IFilesystem filesystem) : base(filesystem) { }
public InitJob(IFilesystem filesystem) { Filesystem = filesystem; ResourceWriter = new ResourceWriter(filesystem); }