public override void Setup()
 {
     base.Setup();
     PluginLoader.Instance.EnsureLoaded();
     _directoryFactory = Mvx.Resolve<IDirectoryFactory<IStorageFolder>>();
     _fileFactory = Mvx.Resolve<IFileFactory<IStorageFile>>();
 }
Esempio n. 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
        }
Esempio n. 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>();
 }
Esempio n. 4
0
 public FileInput(IFileFactory fileFactory, string fileName) : this(fileFactory.CreateFile(fileName))
 {
     if (!this.file.Exists)
     {
         this.reader = this.file.OpenText();
     }
 }
Esempio n. 5
0
 public FileOutput(IFileFactory fileFactory, string fileName) : this(fileFactory.CreateFile(fileName))
 {
     if (!this.file.Exists)
     {
         this.writer = this.file.CreateText();
     }
 }
Esempio n. 6
0
 public FileModelHandler(IHostingEnvironment appEnvironment,
                         IFileFactory fileFactory,
                         IEntityRepository <ILKGEntity> entityRepository)
 {
     this.appEnvironment   = appEnvironment;
     this.fileFactory      = fileFactory;
     this.entityRepository = entityRepository;
 }
Esempio n. 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();
 }
Esempio n. 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();
 }
Esempio n. 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();
 }
 public RsaFactory(IFileFactory fileFactory,
                   Options options,
                   IEnvironmentHelper environmentHelper,
                   IZipAlgorithm zipAlgorithm)
 {
     this.fileFactory       = fileFactory;
     this.options           = options;
     this.environmentHelper = environmentHelper;
     this.zipAlgorithm      = zipAlgorithm;
 }
Esempio n. 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;
 }
Esempio n. 13
0
 public TrelloRepository(
     string location,
     IFileFactory fileFactory,
     IJsonFileReader jsonFileReader,
     IJsonFileWriter jsonFileWriter)
 {
     this.Location       = location;
     this.fileFactory    = fileFactory;
     this.jsonFileReader = jsonFileReader;
     this.jsonFileWriter = jsonFileWriter;
 }
Esempio n. 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;
 }
Esempio n. 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;
        }
Esempio n. 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);
        }
Esempio n. 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;
        }
Esempio n. 18
0
 public MostRecentFilesData(IFileFactory fileFactory, List<IFile> files)
 {
     this.MostRecentFiles = new MostRecentFilesDataHelper(fileFactory);
 }
Esempio n. 19
0
 public LastOpenFilesDataHelper(List <IFile> files, IFileFactory fileFactory)
 {
     this.Files       = files;
     this.FileFactory = fileFactory;
 }
Esempio n. 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;
 }
Esempio n. 22
0
 public FileService(IFileFactory fileFactory)
 {
     _fileFactory = fileFactory;
 }
Esempio n. 23
0
 public ResumeService(IUnitOfWork uow, IFileFactory fileFactory, ITemporaryFileService tempFileService)
 {
     this.uow             = uow;
     this.fileFactory     = fileFactory;
     this.tempFileService = tempFileService;
 }
Esempio n. 24
0
 public MostRecentFilesDataHelper(IFileFactory fileFactory)
 {
     this.FileFactory = fileFactory;
 }
 /// <exception cref="ArgumentNullException">factory is null</exception>
 public RsaFileCipher(IFileFactory factory) : base(factory)
 {
 }
Esempio n. 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);
 }
Esempio n. 27
0
 public MostRecentFilesData(IFileFactory fileFactory, List <IFile> files)
 {
     this.MostRecentFiles = new MostRecentFilesDataHelper(fileFactory);
 }
Esempio n. 28
0
 public LastOpenFilesDataHelper(List<IFile> files, IFileFactory fileFactory)
 {
     this.Files = files;
     this.FileFactory = fileFactory;
 }
Esempio n. 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;
        }
Esempio n. 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);
 }
Esempio n. 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));
        }
Esempio n. 32
0
 public MostRecentFilesDataHelper(IFileFactory fileFactory)
 {
     this.FileFactory = fileFactory;
 }
Esempio n. 33
0
 /// <exception cref="ArgumentNullException">factory is null</exception>
 public RsaCryptoFile(IFileFactory factory)
 {
     Checker.CheckNull(factory);
     this.factory = factory;
 }
Esempio n. 34
0
 public LastOpenFilesData(IFileFactory fileFactory, List <IFile> files)
 {
     this.LastOpenFiles = new LastOpenFilesDataHelper(files, fileFactory);
 }
 /// <summary>
 /// Create a TextFileLogger that write messages to the file determined by "fileFactory".
 /// </summary>
 /// <param name="fileFactory"></param>
 public TextFileLogger(IFileFactory fileFactory)
 {
     _fileFactory = fileFactory;
 }
 /// <summary>
 /// Create a TextFileLogger that write messages to the file determined by "fileFactory".
 /// </summary>
 /// <param name="fileFactory"></param>
 public TextFileLogger(IFileFactory fileFactory)
 {
     _fileFactory = fileFactory;
 }
Esempio n. 37
0
 public LastOpenFilesData(IFileFactory fileFactory, List<IFile> files)
 {
     this.LastOpenFiles = new LastOpenFilesDataHelper(files, fileFactory);
 }