Пример #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LogViewModel"/> class.
 /// </summary>
 /// <param name="encodeService">
 /// The encode service.
 /// </param>
 /// <param name="scanService">
 /// The scan service.
 /// </param>
 public LogViewModel(IEncode encodeService, IScan scanService)
 {
     this.encodeService  = encodeService;
     this.scanService    = scanService;
     this.Title          = "Log Viewer";
     this.encodeLogIndex = 0;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="LogViewModel"/> class.
 /// </summary>
 /// <param name="encodeService">
 /// The encode service.
 /// </param>
 /// <param name="scanService">
 /// The scan service.
 /// </param>
 public LogViewModel(IEncode encodeService, IScan scanService)
 {
     this.encodeService = encodeService;
     this.scanService = scanService;
     this.Title = "Log Viewer";
     this.encodeLogIndex = 0;
 }
Пример #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LogViewModel"/> class.
 /// </summary>
 /// <param name="encodeService">
 /// The encode service.
 /// </param>
 /// <param name="scanService">
 /// The scan service.
 /// </param>
 public LogViewModel(IEncode encodeService, IScan scanService)
 {
     this.encodeService = encodeService;
     this.scanService = scanService;
     this.Title = "Log Viewer";
     this.SelectedMode = 0;
 }
Пример #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LogViewModel"/> class.
 /// </summary>
 /// <param name="windowManager">
 /// The window manager.
 /// </param>
 /// <param name="encodeService">
 /// The encode service.
 /// </param>
 /// <param name="scanService">
 /// The scan service.
 /// </param>
 public LogViewModel(IWindowManager windowManager, IEncode encodeService, IScan scanService)
 {
     this.encodeService = encodeService;
     this.scanService   = scanService;
     this.Title         = "Log Viewer";
     this.SelectedMode  = 0;
 }
Пример #5
0
 public EncodeTest()
 {
     file = new byte[4] {
         7, 0, 2, 0
     };
     encoder = new Encode(file);
 }
Пример #6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="QueueProcessor"/> class.
        /// </summary>
        /// <param name="encodeService">
        /// The encode Service.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// Services are not setup
        /// </exception>
        public QueueProcessor(IEncode encodeService)
        {
            this.EncodeService = encodeService;

            // If this is the first instance, just use the main queue file, otherwise add the instance id to the filename.
            this.queueFile = string.Format("hb_queue_recovery{0}.xml", GeneralUtilities.ProcessId);
        }
Пример #7
0
 public ConvertURLController(IUnitOfWork UW, IEncode encode, IHttpContextAccessor accessor, IjwtService jwtService)
 {
     _UW         = UW;
     _encode     = encode;
     _accessor   = accessor;
     _jwtService = jwtService;
 }
Пример #8
0
 public SystemService(IUserSettingService userSettingService, IEncode encodeService, ILog logService, IQueueService queueService)
 {
     this.log                = logService;
     this.queueService       = queueService;
     this.userSettingService = userSettingService;
     this.encodeService      = encodeService;
 }
Пример #9
0
        /// <summary>
        /// Initializes a new instance of the <see cref="QueueProcessor"/> class.
        /// </summary>
        /// <param name="encodeService">
        /// The encode Service.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// Services are not setup
        /// </exception>
        public QueueProcessor(IEncode encodeService)
        {
            this.EncodeService = encodeService;

            // If this is the first instance, just use the main queue file, otherwise add the instance id to the filename.
            this.queueFile = string.Format("hb_queue_recovery{0}.xml", GeneralUtilities.ProcessId);
        }
Пример #10
0
        public static void EncodeDecodeTest(IEncode enc,
		                                     IDecode dec,
		                                     double passPercent)
        {
            byte[] origFile = enc.Data;
            string origHash = HashBytes (origFile);

            for (int i=0; i<enc.BlocksNeeded; i++)
            {
                dec.Catch (enc.Encode());
            }

            byte[] decFile;
            int numAttempts = 0;
            double decEfficiency;

            while (true)
            {
                // Calculate efficiency, when it drops below a certain amount we will fail the test
                decEfficiency = (double)enc.K / (double)dec.CaughtDroplets;
                decEfficiency *= 100;
                decEfficiency = Math.Round (decEfficiency, 2);

                if (decEfficiency < passPercent)
                {
                    Assert.Fail ("Decoding successful, however efficiency was to low: " +
                                decEfficiency + "%" + ", wanted: " + passPercent + "%");
                }

                decFile = dec.Decode ();
                if (decFile == null)
                {
                    dec.Catch (enc.Encode ());
                    numAttempts++;
                    continue;
                }

                if (HashBytes (decFile) == origHash)
                {
                    Console.WriteLine ("Efficiency: {0}%", decEfficiency);
                    break;
                }
                else
                {
                    for (int i=0; i<decFile.Length; i++)
                    {
                        Console.WriteLine ("[{0}]: {1} | {2}",
                                           i.ToString ("000"),
                                           origFile [i].ToString ("000"),
                                           decFile [i].ToString ("000"));

                    }
                    Assert.Fail ("Decoding returned data, but hash failed, check console for data dump.");
                }
            }

            // Default, if we exit the loop, we pass the test
            Assert.Pass ();
        }
        public FirstViewModel(IScreenSize screenSize, IEncode encode)
        {
            _screenSize = screenSize;
            Height = _screenSize.Height;
            Width = _screenSize.Width;

            _encode = encode;
            Foo = _encode.Encode(DateTime.Now.ToString());
        }
        public FirstViewModel(IScreenSize screenSize, IEncode encode)
        {
            _screenSize = screenSize;
            Height      = _screenSize.Height;
            Width       = _screenSize.Width;

            _encode = encode;
            Foo     = _encode.Encode(DateTime.Now.ToString());
        }
Пример #13
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MiniViewModel"/> class.
        /// </summary>
        /// <param name="encodeService">
        /// The encode Service.
        /// </param>
        /// <param name="queueProcessor">
        /// The queue Processor.
        /// </param>
        public MiniViewModel(IEncode encodeService, IQueueProcessor queueProcessor)
        {
            this.encodeService  = encodeService;
            this.queueProcessor = queueProcessor;

            this.Task        = "Ready";
            this.Progress    = string.Empty;
            this.QueueStatus = string.Format("{0} jobs pending", this.queueProcessor.Count);
        }
Пример #14
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MiniViewModel"/> class.
        /// </summary>
        /// <param name="encodeService">
        /// The encode Service.
        /// </param>
        /// <param name="queueProcessor">
        /// The queue Processor.
        /// </param>
        public MiniViewModel(IEncode encodeService, IQueueProcessor queueProcessor)
        {
            this.encodeService = encodeService;
            this.queueProcessor = queueProcessor;

            this.Task = "Ready";
            this.Progress = string.Empty;
            this.QueueStatus = string.Format("{0} jobs pending", this.queueProcessor.Count);
        }
Пример #15
0
        /* Constructor */
        /// <summary>
        /// Initializes a new instance of the <see cref="frmActivityWindow"/> class.
        /// </summary>
        /// <param name="encode">
        /// The encode.
        /// </param>
        /// <param name="scan">
        /// The scan.
        /// </param>
        public frmActivityWindow(IEncode encode, IScan scan)
        {
            InitializeComponent();

            this.encode = encode;
            this.scan = scan;
            this.position = 0;

            // Listen for Scan and Encode Starting Events
            scan.ScanStared += scan_ScanStared;
            encode.EncodeStarted += encode_EncodeStarted;
        }
Пример #16
0
        /* Constructor */

        /// <summary>
        /// Initializes a new instance of the <see cref="frmActivityWindow"/> class.
        /// </summary>
        /// <param name="encode">
        /// The encode.
        /// </param>
        /// <param name="scan">
        /// The scan.
        /// </param>
        public frmActivityWindow(IEncode encode, IScan scan)
        {
            InitializeComponent();

            this.encode   = encode;
            this.scan     = scan;
            this.position = 0;

            // Listen for Scan and Encode Starting Events
            scan.ScanStared      += scan_ScanStared;
            encode.EncodeStarted += encode_EncodeStarted;
        }
Пример #17
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PreviewViewModel"/> class.
        /// </summary>
        /// <param name="windowManager">
        /// The window manager.
        /// </param>
        /// <param name="encodeService">
        /// The encode Service.
        /// </param>
        /// <param name="errorService">
        /// The error Service.
        /// </param>
        /// <param name="userSettingService">
        /// The user Setting Service.
        /// </param>
        public PreviewViewModel(IWindowManager windowManager, IEncode encodeService, IErrorService errorService, IUserSettingService userSettingService)
        {
            this.encodeService      = encodeService;
            this.errorService       = errorService;
            this.userSettingService = userSettingService;
            this.Title           = "Preview";
            this.Percentage      = "0.00%";
            this.PercentageValue = 0;
            this.StartAt         = 1;
            this.Duration        = 30;

            UseSystemDefaultPlayer = userSettingService.GetUserSetting <bool>(UserSettingConstants.DefaultPlayer);
        }
Пример #18
0
        /// <summary>
        /// Initializes a new instance of the <see cref="QueueProcessor"/> class.
        /// </summary>
        /// <param name="queueManager">
        /// The queue manager.
        /// </param>
        /// <param name="encodeService">
        /// The encode Service.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// Services are not setup
        /// </exception>
        public QueueProcessor(IQueueManager queueManager, IEncode encodeService)
        {
            this.QueueManager  = queueManager;
            this.EncodeService = encodeService;

            if (this.QueueManager == null)
            {
                throw new ArgumentNullException("queueManager");
            }

            if (this.QueueManager == null)
            {
                throw new ArgumentNullException("queueManager");
            }
        }
Пример #19
0
        /// <summary>
        /// Initializes a new instance of the <see cref="QueueProcessor"/> class.
        /// </summary>
        /// <param name="queueManager">
        /// The queue manager.
        /// </param>
        /// <param name="encodeService">
        /// The encode Service.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// </exception>
        public QueueProcessor(IQueueManager queueManager, IEncode encodeService)
        {
            this.QueueManager = queueManager;
            this.EncodeService = encodeService;

            if (this.QueueManager == null)
            {
                throw new ArgumentNullException("queueManager");
            }

            if (this.QueueManager == null)
            {
                throw new ArgumentNullException("queueManager");
            }
        }
Пример #20
0
        /// <summary>
        /// Start the service
        /// </summary>
        /// <param name="port">
        /// The port.
        /// </param>
        public void Start(string port)
        {
            using (host = new ServiceHost(typeof(ServerService), new Uri(string.Format("net.tcp://127.0.0.1:{0}", port))))
            {
                // Setup a listener
                host.AddServiceEndpoint(typeof(IServerService), new NetTcpBinding(), "IHbService");
                host.Open();
                Console.WriteLine("::: HandBrake Isolation Server - Debug Console:::");
                Console.WriteLine("Service Started. Waiting for Clients...");

                // Setup the services we are going to use.
                encodeService = new LibEncode();
                shutdownFlag  = new ManualResetEvent(false);
                shutdownFlag.WaitOne();
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="EncodeServiceWrapper"/> class.
        /// </summary>
        /// <param name="userSettingService">
        /// The user setting service.
        /// </param>
        public EncodeServiceWrapper(IUserSettingService userSettingService)
        {
            var useLibHb = userSettingService.GetUserSetting<bool>(UserSettingConstants.EnableLibHb);
            var useProcessIsolation =
                userSettingService.GetUserSetting<bool>(UserSettingConstants.EnableProcessIsolation);
            var port = userSettingService.GetUserSetting<string>(UserSettingConstants.ServerPort);

            if (useLibHb)
            {
                try
                {
                    if (useProcessIsolation)
                    {
                        this.encodeService = new IsolatedEncodeService(port);
                    }
                    else
                    {
                        if (ScanServiceWrapper.HandbrakeInstance == null)
                        {
                            ScanServiceWrapper.HandbrakeInstance = new HandBrakeInstance();
                        }

                        this.encodeService = new LibEncode(userSettingService, ScanServiceWrapper.HandbrakeInstance);
                    }
                }
                catch (Exception exc)
                {
                    // Try to recover from errors.
                    userSettingService.SetUserSetting(UserSettingConstants.EnableLibHb, false);
                    throw new GeneralApplicationException(
                        "Unable to initialise LibHB or Background worker service",
                        "Falling back to using HandBrakeCLI.exe. Setting has been reset",
                        exc);
                }
            }
            else
            {
                this.encodeService = new Encode(userSettingService);
            }

            this.encodeService.EncodeCompleted += this.EncodeServiceEncodeCompleted;
            this.encodeService.EncodeStarted += this.EncodeServiceEncodeStarted;
            this.encodeService.EncodeStatusChanged += this.EncodeServiceEncodeStatusChanged;
        }
Пример #22
0
        /// <summary>
        /// Initializes a new instance of the <see cref="EncodeServiceWrapper"/> class.
        /// </summary>
        /// <param name="userSettingService">
        /// The user setting service.
        /// </param>
        public EncodeServiceWrapper(IUserSettingService userSettingService)
        {
            var useLibHb            = userSettingService.GetUserSetting <bool>(UserSettingConstants.EnableLibHb);
            var useProcessIsolation =
                userSettingService.GetUserSetting <bool>(UserSettingConstants.EnableProcessIsolation);
            var port = userSettingService.GetUserSetting <string>(UserSettingConstants.ServerPort);

            if (useLibHb)
            {
                try
                {
                    if (useProcessIsolation)
                    {
                        this.encodeService = new IsolatedEncodeService(port);
                    }
                    else
                    {
                        if (ScanServiceWrapper.HandbrakeInstance == null)
                        {
                            ScanServiceWrapper.HandbrakeInstance = new HandBrakeInstance();
                        }

                        this.encodeService = new LibEncode(userSettingService, ScanServiceWrapper.HandbrakeInstance);
                    }
                }
                catch (Exception exc)
                {
                    // Try to recover from errors.
                    userSettingService.SetUserSetting(UserSettingConstants.EnableLibHb, false);
                    throw new GeneralApplicationException(
                              "Unable to initialise LibHB or Background worker service",
                              "Falling back to using HandBrakeCLI.exe. Setting has been reset",
                              exc);
                }
            }
            else
            {
                this.encodeService = new Encode(userSettingService);
            }

            this.encodeService.EncodeCompleted     += this.EncodeServiceEncodeCompleted;
            this.encodeService.EncodeStarted       += this.EncodeServiceEncodeStarted;
            this.encodeService.EncodeStatusChanged += this.EncodeServiceEncodeStatusChanged;
        }
Пример #23
0
        /// <summary>
        /// Initializes a new instance of the <see cref="StaticPreviewViewModel"/> class.
        /// </summary>
        /// <param name="scanService">
        /// The scan service.
        /// </param>
        /// <param name="userSettingService">
        /// The user Setting Service.
        /// </param>
        /// <param name="errorService">
        /// The error Service.
        /// </param>
        public StaticPreviewViewModel(IScan scanService, IUserSettingService userSettingService, IErrorService errorService)
        {
            this.scanService          = scanService;
            this.selectedPreviewImage = 1;
            this.Title = Resources.Preview;
            this.PreviewNotAvailable = true;

            // Live Preview
            this.userSettingService = userSettingService;
            this.errorService       = errorService;
            this.encodeService      = new LibEncode(); // Preview needs a seperate instance rather than the shared singleton. This could maybe do with being refactored at some point

            this.Title           = "Preview";
            this.Percentage      = "0.00%";
            this.PercentageValue = 0;
            this.Duration        = 30;
            this.CanPlay         = true;

            UseSystemDefaultPlayer = userSettingService.GetUserSetting <bool>(UserSettingConstants.DefaultPlayer);
            this.Duration          = userSettingService.GetUserSetting <int>(UserSettingConstants.LastPreviewDuration);
        }
Пример #24
0
        public MainViewModel(IWindowManager windowManager, IUserSettingService userSettingService, IScan scanService, IEncode encodeService, IPresetService presetService)
            : base(windowManager)
        {
            this.userSettingService = userSettingService;
            this.scanService        = scanService;
            this.encodeService      = encodeService;
            this.presetService      = presetService;
            this.queueProcessor     = IoC.Get <IQueueProcessor>(); // TODO Instance ID!

            // Setup Properties
            this.WindowTitle   = "HandBrake WPF Test Application";
            this.CurrentTask   = new EncodeTask();
            this.ScannedSource = new Source();

            // Setup Events
            this.scanService.ScanStared        += this.ScanStared;
            this.scanService.ScanCompleted     += this.ScanCompleted;
            this.scanService.ScanStatusChanged += this.ScanStatusChanged;

            this.queueProcessor.QueueCompleted += this.QueueCompleted;
            this.queueProcessor.QueuePaused    += this.QueuePaused;
            this.queueProcessor.EncodeService.EncodeStarted       += this.EncodeStarted;
            this.queueProcessor.EncodeService.EncodeStatusChanged += this.EncodeStatusChanged;
        }
Пример #25
0
 public SystemService(IUserSettingService userSettingService, IEncode encodeService)
 {
     this.userSettingService = userSettingService;
     this.encodeService      = encodeService;
 }
Пример #26
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NotificationService"/> class.
 /// </summary>
 /// <param name="encodeService">
 /// The encode Service.
 /// </param>
 /// <param name="queueProcessor">
 /// The queue Processor.
 /// </param>
 /// <param name="userSettingService">
 /// The user Setting Service.
 /// </param>
 public NotificationService(IEncode encodeService, IQueueProcessor queueProcessor, IUserSettingService userSettingService)
 {
     this.userSettingService = userSettingService;
        // encodeService.EncodeCompleted += this.EncodeServiceEncodeCompleted;
        // queueProcessor.QueueCompleted += this.QueueProcessorQueueCompleted;
 }
Пример #27
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MainViewModel"/> class.
        /// The viewmodel for HandBrakes main window.
        /// </summary>
        /// <param name="userSettingService">
        /// The User Setting Service
        /// </param>
        /// <param name="scanService">
        /// The scan Service.
        /// </param>
        /// <param name="encodeService">
        /// The encode Service.
        /// </param>
        /// <param name="presetService">
        /// The preset Service.
        /// </param>
        /// <param name="errorService">
        /// The Error Service
        /// </param>
        /// <param name="updateService">
        /// The update Service.
        /// </param>
        /// <param name="whenDoneService">
        /// The when Done Service.
        /// *** Leave in Constructor. *** 
        /// </param>
        /// <param name="windowManager">
        /// The window Manager.
        /// </param>
        /// <param name="pictureSettingsViewModel">
        /// The picture Settings View Model.
        /// </param>
        /// <param name="videoViewModel">
        /// The video View Model.
        /// </param>
        /// <param name="filtersViewModel">
        /// The filters View Model.
        /// </param>
        /// <param name="audioViewModel">
        /// The audio View Model.
        /// </param>
        /// <param name="subtitlesViewModel">
        /// The subtitles View Model.
        /// </param>
        /// <param name="advancedViewModel">
        /// The advanced View Model.
        /// </param>
        /// <param name="chaptersViewModel">
        /// The chapters View Model.
        /// </param>
        /// <param name="staticPreviewViewModel">
        /// The static Preview View Model.
        /// </param>
        /// <param name="queueViewModel">
        /// The queue View Model.
        /// </param>
        public MainViewModel(IUserSettingService userSettingService, IScan scanService, IEncode encodeService, IPresetService presetService, 
            IErrorService errorService, IUpdateService updateService, 
            IPrePostActionService whenDoneService, IWindowManager windowManager, IPictureSettingsViewModel pictureSettingsViewModel, IVideoViewModel videoViewModel, 
            IFiltersViewModel filtersViewModel, IAudioViewModel audioViewModel, ISubtitlesViewModel subtitlesViewModel, 
            IAdvancedViewModel advancedViewModel, IChaptersViewModel chaptersViewModel, IStaticPreviewViewModel staticPreviewViewModel,
            IQueueViewModel queueViewModel)
        {
            this.scanService = scanService;
            this.encodeService = encodeService;
            this.presetService = presetService;
            this.errorService = errorService;
            this.updateService = updateService;
            this.windowManager = windowManager;
            this.QueueViewModel = queueViewModel;
            this.userSettingService = userSettingService;
            this.queueProcessor = IoC.Get<IQueueProcessor>();

            this.PictureSettingsViewModel = pictureSettingsViewModel;
            this.VideoViewModel = videoViewModel;
            this.FiltersViewModel = filtersViewModel;
            this.AudioViewModel = audioViewModel;
            this.SubtitleViewModel = subtitlesViewModel;
            this.ChaptersViewModel = chaptersViewModel;
            this.AdvancedViewModel = advancedViewModel;
            this.StaticPreviewViewModel = staticPreviewViewModel;

            // Setup Properties
            this.WindowTitle = Resources.HandBrake_Title;
            this.CurrentTask = new EncodeTask();
            this.CurrentTask.PropertyChanged += this.CurrentTask_PropertyChanged;
            this.ScannedSource = new Source();
            this.HasSource = false;

            // Setup Events
            this.scanService.ScanStarted += this.ScanStared;
            this.scanService.ScanCompleted += this.ScanCompleted;
            this.scanService.ScanStatusChanged += this.ScanStatusChanged;
            this.queueProcessor.JobProcessingStarted += this.QueueProcessorJobProcessingStarted;
            this.queueProcessor.QueueCompleted += this.QueueCompleted;
            this.queueProcessor.QueueChanged += this.QueueChanged;
            this.queueProcessor.EncodeService.EncodeStatusChanged += this.EncodeStatusChanged;
            this.userSettingService.SettingChanged += this.UserSettingServiceSettingChanged;

            this.Presets = this.presetService.Presets;
            this.Drives = new BindingList<SourceMenuItem>();

            // Set Process Priority
            switch (this.userSettingService.GetUserSetting<string>(UserSettingConstants.ProcessPriority))
            {
                case "Realtime":
                    Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.RealTime;
                    break;
                case "High":
                    Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.High;
                    break;
                case "Above Normal":
                    Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.AboveNormal;
                    break;
                case "Normal":
                    Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.Normal;
                    break;
                case "Low":
                    Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.Idle;
                    break;
                default:
                    Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.BelowNormal;
                    break;
            }

            HandBrakeInstanceManager.Init();
        }
Пример #28
0
 public ActiveJob(QueueTask task, IEncode encodeService)
 {
     this.job           = task;
     this.encodeService = encodeService;
 }
Пример #29
0
        /// <summary>
        /// The test isolation services.
        /// Swaps out the implementation of IScan to the IsolatedScanService version.
        /// </summary>
        public void EnableIsolationServices()
        {
            // Unhook the old services
            this.scanService.ScanStared -= this.ScanStared;
            this.scanService.ScanCompleted -= this.ScanCompleted;
            this.scanService.ScanStatusChanged -= this.ScanStatusChanged;
            this.queueProcessor.EncodeService.EncodeStatusChanged -= this.EncodeStatusChanged;

            // Replace the Services
            this.scanService = new IsolatedScanService(this.errorService, this.userSettingService);
            this.encodeService = new IsolatedEncodeService(this.errorService, this.userSettingService);
            this.queueProcessor.SwapEncodeService(this.encodeService);

            // Add the new Event Hooks
            this.scanService.ScanStared += this.ScanStared;
            this.scanService.ScanCompleted += this.ScanCompleted;
            this.scanService.ScanStatusChanged += this.ScanStatusChanged;
            this.queueProcessor.EncodeService.EncodeStatusChanged += this.EncodeStatusChanged;
        }
Пример #30
0
 /// <summary>
 /// Swap encode service.
 /// Temp method until Castle is hooked up.
 /// </summary>
 /// <param name="service">
 /// The service.
 /// </param>
 public void SwapEncodeService(IEncode service)
 {
     this.EncodeService = service;
 }
Пример #31
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NotificationService"/> class.
 /// </summary>
 /// <param name="encodeService">
 /// The encode Service.
 /// </param>
 /// <param name="queueProcessor">
 /// The queue Processor.
 /// </param>
 /// <param name="userSettingService">
 /// The user Setting Service.
 /// </param>
 public NotificationService(IEncode encodeService, IQueueProcessor queueProcessor, IUserSettingService userSettingService)
 {
     this.userSettingService = userSettingService;
     // encodeService.EncodeCompleted += this.EncodeServiceEncodeCompleted;
     // queueProcessor.QueueCompleted += this.QueueProcessorQueueCompleted;
 }
Пример #32
0
        public MainViewModel(IWindowManager windowManager, IUserSettingService userSettingService, IScan scanService, IEncode encodeService, IPresetService presetService,
            IErrorService errorService)
        {
            this.scanService = scanService;
            this.encodeService = encodeService;
            this.presetService = presetService;
            this.errorService = errorService;
            this.queueProcessor = IoC.Get<IQueueProcessor>(); // TODO Instance ID!

            // Setup Properties
            this.WindowTitle = "HandBrake WPF Test Application";
            this.CurrentTask = new EncodeTask();
            this.ScannedSource = new Source();
            this.SelectedPreset = this.presetService.DefaultPreset;

            // Setup Events
            this.scanService.ScanStared += this.ScanStared;
            this.scanService.ScanCompleted += this.ScanCompleted;
            this.scanService.ScanStatusChanged += this.ScanStatusChanged;

            this.queueProcessor.QueueCompleted += this.QueueCompleted;
            this.queueProcessor.QueuePaused += this.QueuePaused;
            this.queueProcessor.EncodeService.EncodeStarted += this.EncodeStarted;
            this.queueProcessor.EncodeService.EncodeStatusChanged += this.EncodeStatusChanged;
        }
 public UrlManipulationService(IEncode encode,IDecode decode)
 {
     Encode = encode;
     Decode = decode;
 }
Пример #34
0
 public EncodeService()
 {
     byte[] file = Encoding.ASCII.GetBytes(Resources.LongMessage);
     this.lubyEncoder = new Encode(file);
 }
Пример #35
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PreviewViewModel"/> class.
        /// </summary>
        /// <param name="encodeService">
        /// The encode Service.
        /// </param>
        /// <param name="errorService">
        /// The error Service.
        /// </param>
        /// <param name="userSettingService">
        /// The user Setting Service.
        /// </param>
        public PreviewViewModel(IEncodeServiceWrapper encodeService, IErrorService errorService, IUserSettingService userSettingService)
        {
            this.encodeService = encodeService;
            this.errorService = errorService;
            this.userSettingService = userSettingService;
            this.Title = "Preview";
            this.Percentage = "0.00%";
            this.PercentageValue = 0;
            this.StartAt = 1;
            this.Duration = 30;

            UseSystemDefaultPlayer = userSettingService.GetUserSetting<bool>(UserSettingConstants.DefaultPlayer);
        }
Пример #36
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MainViewModel"/> class.
        /// The viewmodel for HandBrakes main window.
        /// </summary>
        /// <param name="userSettingService">
        /// The User Setting Service
        /// </param>
        /// <param name="scanService">
        /// The scan Service.
        /// </param>
        /// <param name="encodeService">
        /// The encode Service.
        /// </param>
        /// <param name="presetService">
        /// The preset Service.
        /// </param>
        /// <param name="errorService">
        /// The Error Service
        /// </param>
        /// <param name="shellViewModel">
        /// The shell View Model.
        /// </param>
        /// <param name="updateService">
        /// The update Service.
        /// </param>
        /// <param name="notificationService">
        /// The notification Service.
        /// *** Leave in Constructor. *** 
        /// </param>
        /// <param name="whenDoneService">
        /// The when Done Service.
        /// *** Leave in Constructor. *** 
        /// </param>
        public MainViewModel(IUserSettingService userSettingService, IScan scanService, IEncode encodeService, IPresetService presetService,
            IErrorService errorService, IShellViewModel shellViewModel, IUpdateService updateService, INotificationService notificationService,
            IPrePostActionService whenDoneService)
        {
            this.scanService = scanService;
            this.encodeService = encodeService;
            this.presetService = presetService;
            this.errorService = errorService;
            this.shellViewModel = shellViewModel;
            this.updateService = updateService;
            this.userSettingService = userSettingService;
            this.queueProcessor = IoC.Get<IQueueProcessor>();

            // Setup Properties
            this.WindowTitle = Resources.HandBrake_Title;
            this.CurrentTask = new EncodeTask();
            this.CurrentTask.PropertyChanged += this.CurrentTask_PropertyChanged;
            this.ScannedSource = new Source();
            this.HasSource = false;

            // Setup Events
            this.scanService.ScanStarted += this.ScanStared;
            this.scanService.ScanCompleted += this.ScanCompleted;
            this.scanService.ScanStatusChanged += this.ScanStatusChanged;
            this.queueProcessor.JobProcessingStarted += this.QueueProcessorJobProcessingStarted;
            this.queueProcessor.QueueCompleted += this.QueueCompleted;
            this.queueProcessor.QueueChanged += this.QueueChanged;
            this.queueProcessor.EncodeService.EncodeStatusChanged += this.EncodeStatusChanged;
            this.userSettingService.SettingChanged += this.UserSettingServiceSettingChanged;

            this.Presets = this.presetService.Presets;
            this.Drives = new BindingList<SourceMenuItem>();

            HandBrakeInstanceManager.Init();
        }
Пример #37
0
 public AccountController(IProvideMembership membershipProvider, IProvideOAuth oAuthProvider, IEncode encoder)
 {
     _membershipProvider = membershipProvider;
     _oAuthProvider = oAuthProvider;
     _encoder = encoder;
 }
Пример #38
0
 public ActiveJob(QueueTask task, IHbFunctionsProvider hbFunctionsProvider, IUserSettingService userSettingService, ILogInstanceManager logInstanceManager, int jobId, IPortService portService)
 {
     this.job           = task;
     this.encodeService = new LibEncode(hbFunctionsProvider, userSettingService, logInstanceManager, jobId, portService);
 }
Пример #39
0
        public MainViewModel(IWindowManager windowManager, IUserSettingService userSettingService, IScan scanService, IEncode encodeService, IPresetService presetService)
            : base(windowManager)
        {
            this.userSettingService = userSettingService;
            this.scanService = scanService;
            this.encodeService = encodeService;
            this.presetService = presetService;
            this.queueProcessor = new QueueProcessor(Process.GetProcessesByName("HandBrake").Length);

            // Setup Properties
            this.WindowTitle = "HandBrake WPF Test Application";
            this.CurrentTask = new EncodeTask();
            this.ScannedSource = new Source();

            // Setup Events
            this.scanService.ScanStared += this.ScanStared;
            this.scanService.ScanCompleted += this.ScanCompleted;
            this.scanService.ScanStatusChanged += this.ScanStatusChanged;

            this.queueProcessor.QueueCompleted += this.QueueCompleted;
            this.queueProcessor.QueuePaused += this.QueuePaused;
            this.queueProcessor.EncodeService.EncodeStarted += this.EncodeStarted;
            this.queueProcessor.EncodeService.EncodeStatusChanged += this.EncodeStatusChanged;
        }
Пример #40
0
 public EncodeTest()
 {
     file = new byte[4] { 7, 0, 2, 0 };
     encoder = new Encode(file);
 }
Пример #41
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MainViewModel"/> class.
        /// The viewmodel for HandBrakes main window.
        /// </summary>
        /// <param name="userSettingService">
        /// The User Setting Service
        /// </param>
        /// <param name="scanService">
        /// The scan Service.
        /// </param>
        /// <param name="encodeService">
        /// The encode Service.
        /// </param>
        /// <param name="presetService">
        /// The preset Service.
        /// </param>
        /// <param name="errorService">
        /// The Error Service
        /// </param>
        /// <param name="updateService">
        /// The update Service.
        /// </param>
        /// <param name="whenDoneService">
        /// The when Done Service.
        /// *** Leave in Constructor. *** 
        /// </param>
        /// <param name="windowManager">
        /// The window Manager.
        /// </param>
        /// <param name="pictureSettingsViewModel">
        /// The picture Settings View Model.
        /// </param>
        /// <param name="videoViewModel">
        /// The video View Model.
        /// </param>
        /// <param name="filtersViewModel">
        /// The filters View Model.
        /// </param>
        /// <param name="audioViewModel">
        /// The audio View Model.
        /// </param>
        /// <param name="subtitlesViewModel">
        /// The subtitles View Model.
        /// </param>
        /// <param name="advancedViewModel">
        /// The advanced View Model.
        /// </param>
        /// <param name="chaptersViewModel">
        /// The chapters View Model.
        /// </param>
        /// <param name="staticPreviewViewModel">
        /// The static Preview View Model.
        /// </param>
        public MainViewModel(IUserSettingService userSettingService, IScan scanService, IEncode encodeService, IPresetService presetService, 
            IErrorService errorService, IUpdateService updateService,
            IPrePostActionService whenDoneService, IWindowManager windowManager, IPictureSettingsViewModel pictureSettingsViewModel, IVideoViewModel videoViewModel,
            IFiltersViewModel filtersViewModel, IAudioViewModel audioViewModel, ISubtitlesViewModel subtitlesViewModel,
            IAdvancedViewModel advancedViewModel, IChaptersViewModel chaptersViewModel, IStaticPreviewViewModel staticPreviewViewModel)
        {
            this.scanService = scanService;
            this.encodeService = encodeService;
            this.presetService = presetService;
            this.errorService = errorService;
            this.updateService = updateService;
            this.windowManager = windowManager;
            this.userSettingService = userSettingService;
            this.queueProcessor = IoC.Get<IQueueProcessor>();

            this.PictureSettingsViewModel = pictureSettingsViewModel;
            this.VideoViewModel = videoViewModel;
            this.FiltersViewModel = filtersViewModel;
            this.AudioViewModel = audioViewModel;
            this.SubtitleViewModel = subtitlesViewModel;
            this.ChaptersViewModel = chaptersViewModel;
            this.AdvancedViewModel = advancedViewModel;
            this.StaticPreviewViewModel = staticPreviewViewModel;

            // Setup Properties
            this.WindowTitle = Resources.HandBrake_Title;
            this.CurrentTask = new EncodeTask();
            this.CurrentTask.PropertyChanged += this.CurrentTask_PropertyChanged;
            this.ScannedSource = new Source();
            this.HasSource = false;

            // Setup Events
            this.scanService.ScanStarted += this.ScanStared;
            this.scanService.ScanCompleted += this.ScanCompleted;
            this.scanService.ScanStatusChanged += this.ScanStatusChanged;
            this.queueProcessor.JobProcessingStarted += this.QueueProcessorJobProcessingStarted;
            this.queueProcessor.QueueCompleted += this.QueueCompleted;
            this.queueProcessor.QueueChanged += this.QueueChanged;
            this.queueProcessor.EncodeService.EncodeStatusChanged += this.EncodeStatusChanged;
            this.userSettingService.SettingChanged += this.UserSettingServiceSettingChanged;

            this.Presets = this.presetService.Presets;
            this.Drives = new BindingList<SourceMenuItem>();

            HandBrakeInstanceManager.Init();
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="StaticPreviewViewModel"/> class.
        /// </summary>
        /// <param name="scanService">
        /// The scan service.
        /// </param>
        /// <param name="userSettingService">
        /// The user Setting Service.
        /// </param>
        public StaticPreviewViewModel(IScan scanService, IUserSettingService userSettingService)
        {
            this.scanService = scanService;
            this.selectedPreviewImage = 1;
            this.Title = Properties.Resources.Preview;
            this.PreviewNotAvailable = true;

            // Live Preview
            this.userSettingService = userSettingService;
            this.encodeService = new LibEncode(); // Preview needs a seperate instance rather than the shared singleton. This could maybe do with being refactored at some point

            this.Title = "Preview";
            this.Percentage = "0.00%";
            this.PercentageValue = 0;
            this.Duration = 30;
            this.CanPlay = true;

            UseSystemDefaultPlayer = userSettingService.GetUserSetting<bool>(UserSettingConstants.DefaultPlayer);
            this.Duration = userSettingService.GetUserSetting<int>(UserSettingConstants.LastPreviewDuration);
        }
Пример #43
0
        /// <summary>
        /// Start the service
        /// </summary>
        /// <param name="port">
        /// The port.
        /// </param>
        public void Start(string port)
        {
            using (host = new ServiceHost(typeof(ServerService), new Uri(string.Format("net.tcp://127.0.0.1:{0}", port))))
            {
                // Setup a listener
                host.AddServiceEndpoint(typeof(IServerService), new NetTcpBinding(), "IHbService");
                host.Open();
                Console.WriteLine("::: HandBrake Isolation Server - Debug Console:::");
                Console.WriteLine("Service Started. Waiting for Clients...");

                // Setup the services we are going to use.
                encodeService = new LibEncode(new UserSettingService()); // TODO this needs wired up with castle

                shutdownFlag = new ManualResetEvent(false);
                shutdownFlag.WaitOne();
            }
        }
Пример #44
0
        public MainViewModel(IWindowManager windowManager, IUserSettingService userSettingService, IScan scanService, IEncode encodeService, IPresetService presetService,
            IErrorService errorService, IShellViewModel shellViewModel, IUpdateService updateService)
        {
            this.scanService = scanService;
            this.encodeService = encodeService;
            this.presetService = presetService;
            this.errorService = errorService;
            this.shellViewModel = shellViewModel;
            this.updateService = updateService;
            this.userSettingService = userSettingService;
            this.queueProcessor = IoC.Get<IQueueProcessor>(); // TODO Instance ID!

            // Setup Properties
            this.WindowTitle = "HandBrake";
            this.CurrentTask = new EncodeTask();
            this.ScannedSource = new Source();

            // Setup Events
            this.scanService.ScanStared += this.ScanStared;
            this.scanService.ScanCompleted += this.ScanCompleted;
            this.scanService.ScanStatusChanged += this.ScanStatusChanged;
            this.queueProcessor.JobProcessingStarted += this.QueueProcessorJobProcessingStarted;
            this.queueProcessor.QueueCompleted += this.QueueCompleted;
            this.queueProcessor.EncodeService.EncodeStatusChanged += this.EncodeStatusChanged;

            this.Presets = this.presetService.Presets;
        }
Пример #45
0
 public EncodeService()
 {
     byte[] file = Encoding.ASCII.GetBytes(Resources.LongMessage);
     this.lubyEncoder = new Encode(file);
 }