summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrakeWPF/Services
diff options
context:
space:
mode:
authorsr55 <[email protected]>2020-03-31 20:24:58 +0100
committersr55 <[email protected]>2020-03-31 20:25:09 +0100
commit83dde24b82284b287dc784582ebce06e4dcbfd74 (patch)
tree6384324da7dd1ad16e45b960a951d5d17babdce6 /win/CS/HandBrakeWPF/Services
parentf34280f1c619dae0b4e1a1ea09cea5b39f17d695 (diff)
WinGui: Further work on the isolated process articecture.
Diffstat (limited to 'win/CS/HandBrakeWPF/Services')
-rw-r--r--win/CS/HandBrakeWPF/Services/Encode/LibEncode.cs2
-rw-r--r--win/CS/HandBrakeWPF/Services/Logging/LogService.cs87
-rw-r--r--win/CS/HandBrakeWPF/Services/UserSettingService.cs2
3 files changed, 7 insertions, 84 deletions
diff --git a/win/CS/HandBrakeWPF/Services/Encode/LibEncode.cs b/win/CS/HandBrakeWPF/Services/Encode/LibEncode.cs
index 417d77855..481c8cebd 100644
--- a/win/CS/HandBrakeWPF/Services/Encode/LibEncode.cs
+++ b/win/CS/HandBrakeWPF/Services/Encode/LibEncode.cs
@@ -108,7 +108,7 @@ namespace HandBrakeWPF.Services.Encode
this.TimedLogMessage(string.Format("base preset: {0}", basePresetName));
}
- this.instance = task.IsPreviewEncode ? HandBrakeInstanceManager.GetPreviewInstance(configuration.Verbosity, configuration) : HandBrakeInstanceManager.GetEncodeInstance(configuration.Verbosity, configuration);
+ this.instance = task.IsPreviewEncode ? HandBrakeInstanceManager.GetPreviewInstance(configuration.Verbosity, configuration) : HandBrakeInstanceManager.GetEncodeInstance(configuration.Verbosity, configuration, this.log);
this.instance.EncodeCompleted += this.InstanceEncodeCompleted;
this.instance.EncodeProgress += this.InstanceEncodeProgress;
diff --git a/win/CS/HandBrakeWPF/Services/Logging/LogService.cs b/win/CS/HandBrakeWPF/Services/Logging/LogService.cs
index c11b764b0..738cb2b3a 100644
--- a/win/CS/HandBrakeWPF/Services/Logging/LogService.cs
+++ b/win/CS/HandBrakeWPF/Services/Logging/LogService.cs
@@ -22,8 +22,10 @@ namespace HandBrakeWPF.Services.Logging
using HandBrake.Interop.Interop;
using HandBrake.Interop.Interop.EventArgs;
+ using HandBrake.Worker.Logging.Interfaces;
using HandBrake.Worker.Logging.Models;
+ using HandBrakeWPF.Instance;
using HandBrakeWPF.Instance.Model;
using HandBrakeWPF.Services.Interfaces;
using HandBrakeWPF.Services.Logging.Model;
@@ -34,7 +36,7 @@ namespace HandBrakeWPF.Services.Logging
using ILog = Interfaces.ILog;
using LogEventArgs = EventArgs.LogEventArgs;
- public class LogService : HttpRequestBase, ILog
+ public class LogService : ILog
{
// TODO List.
// Maybe make the event weak?
@@ -52,23 +54,11 @@ namespace HandBrakeWPF.Services.Logging
private bool isDiskLoggingEnabled;
private StreamWriter fileWriter;
private string logHeader;
- private Timer remoteLogPollTimer;
- private int remoteIndex = 0;
- private bool isRemotePollingEnabled = false;
public LogService(IUserSettingService userSettingService)
{
HandBrakeUtils.MessageLogged += this.HandBrakeUtils_MessageLogged;
HandBrakeUtils.ErrorLogged += this.HandBrakeUtils_ErrorLogged;
-
- if (userSettingService.GetUserSetting<bool>(UserSettingConstants.RemoteServiceEnabled))
- {
- this.ActivateRemoteLogPolling();
- this.isRemotePollingEnabled = true;
-
- this.port = userSettingService.GetUserSetting<int>(UserSettingConstants.RemoteServicePort);
- this.serverUrl = string.Format("http://127.0.0.1:{0}/", this.port);
- }
}
public event EventHandler<LogEventArgs> MessageLogged;
@@ -175,21 +165,6 @@ namespace HandBrakeWPF.Services.Logging
public async void Reset()
{
- //if (this.isRemotePollingEnabled)
- //{
- // try
- // {
- // await this.MakeHttpGetRequest("ResetLogging");
- // }
- // catch (Exception e)
- // {
- // if (this.remoteLogPollTimer != null)
- // {
- // this.remoteLogPollTimer.Stop();
- // }
- // }
- //}
-
lock (this.lockObject)
{
this.logMessages.Clear();
@@ -359,61 +334,9 @@ namespace HandBrakeWPF.Services.Logging
this.LogMessage(e.Message);
}
- private void ActivateRemoteLogPolling()
- {
- this.remoteLogPollTimer = new Timer();
- this.remoteLogPollTimer.Interval = 1000;
-
- this.remoteLogPollTimer.Elapsed += (o, e) =>
- {
- try
- {
- this.PollRemoteLog();
- }
- catch (Exception exc)
- {
- Debug.WriteLine(exc);
- }
- };
- this.remoteLogPollTimer.Start();
- }
-
- private async void PollRemoteLog()
+ void ILogHandler.ShutdownFileWriter()
{
- ServerResponse response = null;
- try
- {
- int nextIndex = this.remoteIndex + 1;
- string json = JsonConvert.SerializeObject(nextIndex, Formatting.Indented, this.jsonNetSettings);
-
- response = await this.MakeHttpJsonPostRequest("GetLogMessagesFromIndex", json);
- }
- catch (Exception e)
- {
- Debug.WriteLine("No Endpoint");
- }
-
- if (response == null || !response.WasSuccessful)
- {
- return;
- }
-
- string statusJson = response.JsonResponse;
-
- List<LogMessage> messages = null;
- if (!string.IsNullOrEmpty(statusJson))
- {
- messages = JsonConvert.DeserializeObject<List<LogMessage>>(statusJson, this.jsonNetSettings);
- }
-
- if (messages != null)
- {
- foreach (var item in messages)
- {
- this.LogMessage(item.Content);
- this.remoteIndex = item.MessageIndex;
- }
- }
+ throw new NotImplementedException();
}
}
}
diff --git a/win/CS/HandBrakeWPF/Services/UserSettingService.cs b/win/CS/HandBrakeWPF/Services/UserSettingService.cs
index 7e7b49e4a..4c181541a 100644
--- a/win/CS/HandBrakeWPF/Services/UserSettingService.cs
+++ b/win/CS/HandBrakeWPF/Services/UserSettingService.cs
@@ -305,7 +305,7 @@ namespace HandBrakeWPF.Services
// Experimental
defaults.Add(UserSettingConstants.RemoteServiceEnabled, false);
- defaults.Add(UserSettingConstants.RemoteServicePort, true);
+ defaults.Add(UserSettingConstants.RemoteServicePort, 8037);
// Misc
defaults.Add(UserSettingConstants.ShowPresetPanel, false);