Ejemplo n.º 1
0
 internal static void Serialize <T>(IIOServices ioServices, string fileName, T instance) where T : class, new()
 {
     using (var fs = ioServices.GetFileStream(fileName, System.IO.FileMode.Create, System.IO.FileAccess.Write, System.IO.FileShare.Read))
     {
         Serializer <T> .Serialize(fs, instance);
     }
 }
Ejemplo n.º 2
0
 internal static T Deserialize <T>(IIOServices ioServices, string fileName) where T : class, new()
 {
     using (var fs = ioServices.GetFileStream(fileName, System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.Read))
     {
         return(Serializer <T> .Deserialize(fs));
     }
 }
Ejemplo n.º 3
0
        public MainModel(IUIServices uiServices
                         , IIOServices ioServices)
        {
            UIServices = uiServices;
            IOServices = ioServices;

            HashedEntries = new HashSet <String>();
        }
Ejemplo n.º 4
0
        internal static void Init(IIOServices ioServices)
        {
            MyDocumentsFolder = GetMyDocumentsFolder(ioServices);

            SettingsFile = ioServices.Path.Combine(MyDocumentsFolder, "Settings.xml");

            DataFile = ioServices.Path.Combine(MyDocumentsFolder, "Files.xml");
        }
Ejemplo n.º 5
0
 public WindowFactory(IIOServices ioServices, IUIServices uiServices, IClipboardServices clipboardServices, IDataManager dataManager, AddYoutubeLink.IYoutubeManager youtubeManager)
 {
     _ioServices        = ioServices;
     _uiServices        = uiServices;
     _clipboardServices = clipboardServices;
     _dataManager       = dataManager;
     _youtubeManager    = youtubeManager;
 }
Ejemplo n.º 6
0
        public WindowFactory()
        {
            IOServices = new IOServices();
            UIServices = new WindowUIServices();

            //For the old forms
            System.Windows.Forms.Application.EnableVisualStyles();
            System.Windows.Forms.Application.SetCompatibleTextRenderingDefault(false);
        }
Ejemplo n.º 7
0
#pragma warning restore IDE1006 // Naming Styles

        public FileEntryViewModel(FileEntry entry, string userName, IDataManager dataManager, IIOServices ioServices)
        {
            Entry        = entry;
            _userName    = userName;
            _dataManager = dataManager;
            _ioServices  = ioServices;

            _user = TryGetUser();
        }
Ejemplo n.º 8
0
#pragma warning restore IDE1006 // Naming Styles

        public IgnoreEntryViewModel(IIgnoreEntryModel model, IDataManager dataManager, IIOServices ioServices, string userName)
        {
            _model       = model;
            _dataManager = dataManager;
            _ioServices  = ioServices;
            _userName    = userName;

            UndoIgnoreCommand = new ParameterizedRelayCommand(UndoIgnore);
        }
Ejemplo n.º 9
0
        public static void Main()
        {
            IOServices = new IOServices();

            Environment.Init(IOServices);

            try
            {
                TryClean();
            }
            catch
            { }
        }
Ejemplo n.º 10
0
        private static string GetMyDocumentsFolder(IIOServices ioServices)
        {
            var myDocumentsFolder = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments);

            myDocumentsFolder = ioServices.Path.Combine(myDocumentsFolder, "WatchHistory");

            if (ioServices.Folder.Exists(myDocumentsFolder) == false)
            {
                ioServices.Folder.CreateFolder(myDocumentsFolder);
            }

            return(myDocumentsFolder);
        }
Ejemplo n.º 11
0
        public ShowReportViewModel(IDataManager dataManager, IIOServices ioServices, IUIServices uiServices, IClipboardServices clipboardServices, string userName)
        {
            _dataManager       = dataManager;
            _ioServices        = ioServices;
            _uiServices        = uiServices;
            _clipboardServices = clipboardServices;
            _userName          = userName;

            ReportDayCommand   = new RelayCommand(ReportDay);
            ReportMonthCommand = new RelayCommand(ReportMonth);
            CancelCommand      = new RelayCommand(Cancel);

            _date = DateTime.Now.Date;
        }
Ejemplo n.º 12
0
        public AddYoutubeLinkViewModel(IDataManager dataManager, IIOServices ioServices, IUIServices uiServices, IClipboardServices clipboardServices, IYoutubeManager youtubeManager, string userName)
        {
            _youtubeManager    = youtubeManager;
            _uiServices        = uiServices;
            _clipboardServices = clipboardServices;

            _youtubeFileManager = new YoutubeFileManager(dataManager, ioServices, userName);
            AcceptCommand       = new RelayCommand(Accept);
            CancelCommand       = new RelayCommand(Cancel);
            ScanCommand         = new RelayCommand(Scan);

            var now = DateTime.Now;

            _date = now.Date;

            _hour = (byte)(now.Hour);

            _minute = (byte)(now.Minute);
        }
Ejemplo n.º 13
0
        public MainViewModel(IMainModel model
                             , IIOServices ioServices
                             , IUIServices uiServices
                             , IWindowFactory windowFactory)
        {
            Model         = model;
            IOServices    = ioServices;
            UIServices    = uiServices;
            WindowFactory = windowFactory;

            m_TaskIsRunning           = false;
            m_SelectedOverwriteOption = OverwriteOptions.First();

            RemainingTimeCalculator   = new RemainingTimeCalculator();
            WindowsProgressBarHandler = new WindowsProgressBarHandler();
            Synchronizer = new Synchronizer(Application.Current.Dispatcher);

            ReadLastRecentFile();
        }
Ejemplo n.º 14
0
        public AddManualEntryViewModel(IDataManager dataManager
                                       , IIOServices ioServices
                                       , IUIServices uiServices
                                       , string userName)
        {
            _dataManager = dataManager;
            _ioServices  = ioServices;
            _uiServices  = uiServices;
            _userName    = userName;

            this.AcceptCommand = new RelayCommand(this.Accept);
            this.CancelCommand = new RelayCommand(this.Cancel);

            var now = DateTime.Now;

            _watchedDate = now.Date;

            _watchedHour = (byte)(now.Hour);

            _watchedMinute = (byte)(now.Minute);
        }
Ejemplo n.º 15
0
        public DataManager(string settingsFile, string dataFile, IIOServices ioServices)
        {
            _ioServices = ioServices;

            _filesLock = new object();

            _settingsFile = settingsFile;

            _dataFile = dataFile;

            _fileObserver = new FileObserver(ioServices);

            _filesSerializer = new FilesSerializer(ioServices);

            _filesSerializer.CreateBackup(settingsFile);

            this.LoadSettings();

            _filesSerializer.CreateBackup(dataFile);

            this.LoadData();
        }
Ejemplo n.º 16
0
 public VideoInfoAdder(IIOServices ioServices, FileEntry entry)
 {
     _ioServices = ioServices;
     _entry      = entry;
 }
Ejemplo n.º 17
0
 internal DayTextProcessor(IIOServices ioServices, DateTime date, IEnumerable <FileEntry> entries, string userName) : base(date, entries, userName)
 {
     _ioServices = ioServices;
 }
Ejemplo n.º 18
0
 public YoutubeFileManager(IDataManager dataManager, IIOServices ioServices, string userName)
 {
     _dataManager = dataManager;
     _ioServices  = ioServices;
     _userName    = userName;
 }
Ejemplo n.º 19
0
        public SelectFoldersViewModel(IIOServices ioServices)
        {
            Folders = ioServices.Folder.GetFolders(Properties.Settings.Default.SourcePath);

            Folders = Folders.Select(GetFolderName).Where(NotInExcludeList);
        }
Ejemplo n.º 20
0
 public YoutubeWatchesProcessor(IIOServices ioServices)
 {
     _ioServices = ioServices;
 }
Ejemplo n.º 21
0
 public CollectionProcessor(DVDP.Collection collection, IDataManager dataManager, IIOServices ioServices)
 {
     _collection  = collection;
     _dataManager = dataManager;
     _ioServices  = ioServices;
 }
Ejemplo n.º 22
0
 public DataUpgrader(IIOServices ioServices)
 {
     _ioServices = ioServices;
 }
Ejemplo n.º 23
0
 public DvdWatchesProcessor(IIOServices ioServices)
 {
     _ioServices = ioServices;
 }
Ejemplo n.º 24
0
 public MainModel(IDataManager dataManager, IIOServices ioServices, IUIServices uiServices, string userName) : base(dataManager, userName)
 {
     _ioServices   = ioServices;
     _uiServices   = uiServices;
     IgnoreWatched = true;
 }
Ejemplo n.º 25
0
 public FilesSerializer(IIOServices ioServices)
 {
     _ioServices = ioServices;
 }
Ejemplo n.º 26
0
        internal static ObservableCollection <IFileEntryViewModel> GetSortedEntries(IEnumerable <FileEntry> modelEntries, string userName, IDataManager dataManager, IIOServices ioServices, SortColumn sortColumn, bool ascending)
        {
            var viewModelEntries = modelEntries.Select(item => new FileEntryViewModel(item, userName, dataManager, ioServices)).ToList();

            viewModelEntries.Sort((left, right) => Compare(left, right, sortColumn, ascending, userName, dataManager));

            return(new ObservableCollection <IFileEntryViewModel>(viewModelEntries));
        }
Ejemplo n.º 27
0
 public FileObserver(IIOServices ioServices)
 {
     _ioServices = ioServices;
 }