Пример #1
0
 public override void Setup()
 {
     base.Setup();
     PluginLoader.Instance.EnsureLoaded();
     _directoryFactory = Mvx.Resolve<IDirectoryFactory<IStorageFolder>>();
     _fileFactory = Mvx.Resolve<IFileFactory<IStorageFile>>();
 }
Пример #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="man"></param>
        /// <returns></returns>
        public override bool OnInit(ManagerEngine man)
        {
            string       fs      = man.Config.Get("filesystem", "LocalFileFactory");
            IFileFactory factory = null;

            // Register local file system factroy
            if (fs != "LocalFileFactory")
            {
                if (fs.IndexOf('.') == -1)
                {
                    factory = (IFileFactory)InstanceFactory.CreateInstance("Moxiecode.Manager.FileSystems." + fs);
                }

                if (factory == null)
                {
                    factory = (IFileFactory)InstanceFactory.CreateInstance(fs);
                }

                man.FileSystems["file"] = factory;
            }
            else
            {
                man.FileSystems["file"] = new LocalFileFactory();
            }

            man.FileSystems["root"] = new RootFileFactory();

            return(true);            // Pass to next
        }
Пример #3
0
 /// <summary>
 /// Конструктор.
 /// </summary>
 /// <param name="fileFactory">Фабрика создания моделей файлов.</param>
 /// <param name="processPoolSize">Разрешённый размер пула обрабатываемых файлов. Если в обработку поступает больше файлов, они становятся в очередь.</param>
 internal FileProcessor(IFileFactory fileFactory, short processPoolSize)
 {
     _fileFactory     = fileFactory;
     _processPoolSize = processPoolSize;
     _files           = new Dictionary <string, IFile>();
     processFilesMQ   = new List <IFile>();
 }
Пример #4
0
 public FileInput(IFileFactory fileFactory, string fileName) : this(fileFactory.CreateFile(fileName))
 {
     if (!this.file.Exists)
     {
         this.reader = this.file.OpenText();
     }
 }
Пример #5
0
 public FileOutput(IFileFactory fileFactory, string fileName) : this(fileFactory.CreateFile(fileName))
 {
     if (!this.file.Exists)
     {
         this.writer = this.file.CreateText();
     }
 }
Пример #6
0
 public FileModelHandler(IHostingEnvironment appEnvironment,
                         IFileFactory fileFactory,
                         IEntityRepository <ILKGEntity> entityRepository)
 {
     this.appEnvironment   = appEnvironment;
     this.fileFactory      = fileFactory;
     this.entityRepository = entityRepository;
 }
Пример #7
0
 public SolutionBuilder(ISolutionContext solutionContext, ISolutionFactory solutionFactory, IFileFactory fileFactory)
 {
     _solutionContext = solutionContext;
     _solutionFactory = solutionFactory;
     _fileFactory     = fileFactory;
     _projects        = new List <Project>();
     _plainFiles      = new List <PlainFile>();
     _solution        = new Solution();
 }
Пример #8
0
 /// <summary>
 /// Initialise instance
 /// </summary>
 public RecentFileList(IMostRecentFilesData data, IFileFactory fileFactory, ISettingsHelper settingsHelper)
 {
     this.SettingsHelper = settingsHelper;
     this.FileFactory = fileFactory;
     this.Data = data;
     this.Load();
     this.Header = LanguageHelper.GetLocalisedText((Application.Current as IApplication), Constants.RECENT_FILES_MENUITEM_HEADER);
     this.Loaded += (s, e) => GetParentItem();
 }
Пример #9
0
 /// <summary>
 /// Initialise instance
 /// </summary>
 public RecentFileList(IMostRecentFilesData data, IFileFactory fileFactory, ISettingsHelper settingsHelper)
 {
     this.SettingsHelper = settingsHelper;
     this.FileFactory    = fileFactory;
     this.Data           = data;
     this.Load();
     this.Header  = LanguageHelper.GetLocalisedText((Application.Current as IApplication), Constants.RECENT_FILES_MENUITEM_HEADER);
     this.Loaded += (s, e) => GetParentItem();
 }
Пример #10
0
 public RsaFactory(IFileFactory fileFactory,
                   Options options,
                   IEnvironmentHelper environmentHelper,
                   IZipAlgorithm zipAlgorithm)
 {
     this.fileFactory       = fileFactory;
     this.options           = options;
     this.environmentHelper = environmentHelper;
     this.zipAlgorithm      = zipAlgorithm;
 }
Пример #11
0
        public FileService(
            IFileRepository repository,
            IFileFactory factory)
        {
            repository.CheckArgumentIsNull(nameof(repository));
            _repository = repository;

            factory.CheckArgumentIsNull(nameof(factory));
            _factory = factory;
        }
 public JsonFileRepository(
     IFileFactory fileFactory,
     IJsonFileReader jsonFileReader,
     IJsonFileWriter jsonFileWriter,
     string storagePath)
 {
     this.fileFactory    = fileFactory;
     this.jsonFileReader = jsonFileReader;
     this.jsonFileWriter = jsonFileWriter;
     this.storagePath    = storagePath;
 }
Пример #13
0
 public TrelloRepository(
     string location,
     IFileFactory fileFactory,
     IJsonFileReader jsonFileReader,
     IJsonFileWriter jsonFileWriter)
 {
     this.Location       = location;
     this.fileFactory    = fileFactory;
     this.jsonFileReader = jsonFileReader;
     this.jsonFileWriter = jsonFileWriter;
 }
Пример #14
0
 public ConversationUsersRepository(
     IFileFactory fileFactory,
     IJsonFileReader jsonFileReader,
     IJsonFileWriter jsonFileWriter,
     IConsole console,
     WhatsAppDataSettings settings)
 {
     this.fileFactory    = fileFactory;
     this.jsonFileReader = jsonFileReader;
     this.jsonFileWriter = jsonFileWriter;
     this.console        = console;
     this.settings       = settings;
 }
Пример #15
0
        public AdminSliderService(
            IPostFactory postFactory,
            IFileFactory fileFactory,
            IPostFileFactory postFileFactory)
        {
            postFactory.CheckArgumentIsNull(nameof(postFactory));
            _postFactory = postFactory;

            fileFactory.CheckArgumentIsNull(nameof(fileFactory));
            _fileFactory = fileFactory;

            postFileFactory.CheckArgumentIsNull(nameof(postFileFactory));
            _postFileFactory = postFileFactory;
        }
Пример #16
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="path"></param>
        /// <param name="child"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public IFile GetFile(string path, string child, FileType type)
        {
            string fs = "file";
            Match  match;
            IFile  file;

            if (path == null)
            {
                throw new ManagerException("{#error.file_not_exists}");
            }

            // Parse file system
            match = Regex.Match(path, @"([a-z]+):\/\/(.+)", RegexOptions.IgnoreCase);
            if (match.Groups.Count == 3)
            {
                fs   = match.Groups[1].Value;
                path = match.Groups[2].Value;
            }

            // Get file from factory
            IFileFactory factory = this.fileSystems[fs];

            if (factory == null)
            {
                throw new ManagerException(ManagerErrorLevel.Fatal, "{#error.no_filesystem}");
            }

            if (fs == "file" && !VerifyPath(path))
            {
                throw new ManagerException(ManagerErrorLevel.Fatal, "{#error.no_access}");
            }

            file = factory.GetFile(this, path, child, type);

            if (fs == "file" && !VerifyPath(file.AbsolutePath))
            {
                throw new ManagerException(ManagerErrorLevel.Fatal, "{#error.no_access}");
            }

            if (fs == "file" && (child.IndexOf('/') != -1 || child.IndexOf('\\') != -1))
            {
                throw new ManagerException(ManagerErrorLevel.Fatal, "{#error.no_access}");
            }

            return(file);
        }
Пример #17
0
        // If DI is about removing all "new" operators from your logic to enable a plugin architecture where
        // every component can be changed in one place and that we must rely on abstraction rather than concretions
        // then everything must implement an interface and be passed in on the constructor (even other windows)
        // Thiscould be useful as for instance: if you wanted to replace the Expression builder then we change it
        // when we load our Ninject Kernel in App.xaml (Via IExpressionBuilderWindowFactory). Then if we called
        // that screen from other windows (such as we do in Find) later on in the stack the change is only in one place
        // I fully intend to remove all "new" operators from this code file as a test to see how plausible it is to do!
        // I have left += new event handlers and any temporary news like StringBuilder
        public MainWindow(RecentFileList recentFileList, ILastOpenFilesData lastOpenFilesData,
                          IHighlightItemData highlightItemData, IWindowFactory windowFactory, IFindWindowFactory findWindowFactory, ISystemTray systemTray,
                          System.Windows.Forms.NotifyIcon notifyIcon, ISaveExpressionMessageWindowFactory saveExpressionMessageWindowFactory,
                          IExpressionBuilderWindowFactory expressionBuilderWindowFactory, IFileFactory fileFactory, ITabItemFactory tabItemFactory, ISettingsHelper settingsHelper,
                          IHighlightWindowFactory highlightWindowFactory, IHighlightsHelper highlightsHelper)
        {
            this.SettingsHelper    = settingsHelper;
            this.LastOpenFilesData = lastOpenFilesData;
            this.recentFileList    = recentFileList;
            this.WindowFactory     = windowFactory;
            this.FindWindowFactory = findWindowFactory;
            this.HighlightItemData = highlightItemData;
            this.SaveExpressionMessageWindowFactory = saveExpressionMessageWindowFactory;
            this.ExpressionBuilderWindowFactory     = expressionBuilderWindowFactory;
            this.SystemTray             = systemTray;
            this.FileFactory            = fileFactory;
            this.TabItemFactory         = tabItemFactory;
            this.HighlightWindowFactory = highlightWindowFactory;
            this.HighlightHelper        = highlightsHelper;

            InitializeComponent();

            this.recentFileList.SubMenuClick += new EventHandler <EventArgs>(recentFileList_SubMenuClick);
            this.MenuItemFile.Items.Insert(2, this.recentFileList);

            // Null Object pattern (http://en.wikipedia.org/wiki/Null_Object_pattern)
            this.OpenWindows   = new List <IWindow>(0);
            this.LastOpenFiles = new List <IFile>(0);

            this.Notify              = notifyIcon;
            this.Notify.Icon         = this.SystemTray.Icon;
            this.Notify.DoubleClick += new EventHandler(Notify_DoubleClick);
            this.Notify.ContextMenu  = this.SystemTray.ContextMenu;

            this.Notify.ContextMenu.MenuItems[0].Click += new EventHandler(disableSoundsMenuItem_Click);
            this.Notify.ContextMenu.MenuItems[1].Click += new EventHandler(minimuseToTrayItem_Click);
            this.Notify.ContextMenu.MenuItems[3].Click += new EventHandler(exitItem_Click);

            this.Notify.Visible = true;
        }
Пример #18
0
 public MostRecentFilesData(IFileFactory fileFactory, List<IFile> files)
 {
     this.MostRecentFiles = new MostRecentFilesDataHelper(fileFactory);
 }
Пример #19
0
 public LastOpenFilesDataHelper(List <IFile> files, IFileFactory fileFactory)
 {
     this.Files       = files;
     this.FileFactory = fileFactory;
 }
Пример #20
0
 public BackupTaskLauncher(IBackupService backupFileService, IFileFactory fileFactory, BackupServiceSettings settings)
 {
     this.backupFileService = backupFileService;
     this.fileFactory       = fileFactory;
     this.settings          = settings;
 }
 public ConversationsRepository(IFileFactory fileFactory, WhatsAppDataSettings settings)
 {
     this.fileFactory = fileFactory;
     this.settings    = settings;
 }
Пример #22
0
 public FileService(IFileFactory fileFactory)
 {
     _fileFactory = fileFactory;
 }
Пример #23
0
 public ResumeService(IUnitOfWork uow, IFileFactory fileFactory, ITemporaryFileService tempFileService)
 {
     this.uow             = uow;
     this.fileFactory     = fileFactory;
     this.tempFileService = tempFileService;
 }
Пример #24
0
 public MostRecentFilesDataHelper(IFileFactory fileFactory)
 {
     this.FileFactory = fileFactory;
 }
 /// <exception cref="ArgumentNullException">factory is null</exception>
 public RsaFileCipher(IFileFactory factory) : base(factory)
 {
 }
Пример #26
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="key"></param>
 /// <param name="file_factory"></param>
 public void Add(string key, IFileFactory file_factory)
 {
     this.Dictionary.Add(key, file_factory);
 }
Пример #27
0
 public MostRecentFilesData(IFileFactory fileFactory, List <IFile> files)
 {
     this.MostRecentFiles = new MostRecentFilesDataHelper(fileFactory);
 }
Пример #28
0
 public LastOpenFilesDataHelper(List<IFile> files, IFileFactory fileFactory)
 {
     this.Files = files;
     this.FileFactory = fileFactory;
 }
Пример #29
0
        // If DI is about removing all "new" operators from your logic to enable a plugin architecture where
        // every component can be changed in one place and that we must rely on abstraction rather than concretions
        // then everything must implement an interface and be passed in on the constructor (even other windows)
        // Thiscould be useful as for instance: if you wanted to replace the Expression builder then we change it
        // when we load our Ninject Kernel in App.xaml (Via IExpressionBuilderWindowFactory). Then if we called
        // that screen from other windows (such as we do in Find) later on in the stack the change is only in one place
        // I fully intend to remove all "new" operators from this code file as a test to see how plausible it is to do!
        // I have left += new event handlers and any temporary news like StringBuilder
        public MainWindow(RecentFileList recentFileList, ILastOpenFilesData lastOpenFilesData,
            IHighlightItemData highlightItemData, IWindowFactory windowFactory, IFindWindowFactory findWindowFactory, ISystemTray systemTray,
            System.Windows.Forms.NotifyIcon notifyIcon, ISaveExpressionMessageWindowFactory saveExpressionMessageWindowFactory,
            IExpressionBuilderWindowFactory expressionBuilderWindowFactory, IFileFactory fileFactory, ITabItemFactory tabItemFactory, ISettingsHelper settingsHelper,
            IHighlightWindowFactory highlightWindowFactory, IHighlightsHelper highlightsHelper)
        {
            this.SettingsHelper = settingsHelper;
            this.LastOpenFilesData = lastOpenFilesData;
            this.recentFileList = recentFileList;
            this.WindowFactory = windowFactory;
            this.FindWindowFactory = findWindowFactory;
            this.HighlightItemData = highlightItemData;
            this.SaveExpressionMessageWindowFactory = saveExpressionMessageWindowFactory;
            this.ExpressionBuilderWindowFactory = expressionBuilderWindowFactory;
            this.SystemTray = systemTray;
            this.FileFactory = fileFactory;
            this.TabItemFactory = tabItemFactory;
            this.HighlightWindowFactory = highlightWindowFactory;
            this.HighlightHelper = highlightsHelper;

            InitializeComponent();

            this.recentFileList.SubMenuClick +=new EventHandler<EventArgs>(recentFileList_SubMenuClick);
            this.MenuItemFile.Items.Insert(2, this.recentFileList);

            // Null Object pattern (http://en.wikipedia.org/wiki/Null_Object_pattern)
            this.OpenWindows = new List<IWindow>(0);
            this.LastOpenFiles = new List<IFile>(0);

            this.Notify = notifyIcon;
            this.Notify.Icon = this.SystemTray.Icon;
            this.Notify.DoubleClick += new EventHandler(Notify_DoubleClick);
            this.Notify.ContextMenu = this.SystemTray.ContextMenu;

            this.Notify.ContextMenu.MenuItems[0].Click += new EventHandler(disableSoundsMenuItem_Click);
            this.Notify.ContextMenu.MenuItems[1].Click += new EventHandler(minimuseToTrayItem_Click);
            this.Notify.ContextMenu.MenuItems[3].Click += new EventHandler(exitItem_Click);

            this.Notify.Visible = true;
        }
Пример #30
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="key"></param>
 /// <param name="file_factory"></param>
 public void Add(string key, IFileFactory file_factory)
 {
     this.Dictionary.Add(key, file_factory);
 }
Пример #31
0
        public ListingService(IUnitOfWork uow, IGitHubAPI github, IListingPreprocessFactory preprocessFact, IFileFactory fileFact)
        {
            this.uow    = uow;
            this.github = github;

            var list = uow.ValueRepository.GetStopwords();

            ghPreprocess = (GitHubPreprocess)preprocessFact.GetPreprocess(ListingSource.Github, fileFact.GetStopwordsFile(DocumentType.Set, list));
        }
Пример #32
0
 public MostRecentFilesDataHelper(IFileFactory fileFactory)
 {
     this.FileFactory = fileFactory;
 }
Пример #33
0
 /// <exception cref="ArgumentNullException">factory is null</exception>
 public RsaCryptoFile(IFileFactory factory)
 {
     Checker.CheckNull(factory);
     this.factory = factory;
 }
Пример #34
0
 public LastOpenFilesData(IFileFactory fileFactory, List <IFile> files)
 {
     this.LastOpenFiles = new LastOpenFilesDataHelper(files, fileFactory);
 }
Пример #35
0
 /// <summary>
 /// Create a TextFileLogger that write messages to the file determined by "fileFactory".
 /// </summary>
 /// <param name="fileFactory"></param>
 public TextFileLogger(IFileFactory fileFactory)
 {
     _fileFactory = fileFactory;
 }
Пример #36
0
 /// <summary>
 /// Create a TextFileLogger that write messages to the file determined by "fileFactory".
 /// </summary>
 /// <param name="fileFactory"></param>
 public TextFileLogger(IFileFactory fileFactory)
 {
     _fileFactory = fileFactory;
 }
Пример #37
0
 public LastOpenFilesData(IFileFactory fileFactory, List<IFile> files)
 {
     this.LastOpenFiles = new LastOpenFilesDataHelper(files, fileFactory);
 }