aboutsummaryrefslogtreecommitdiff
path: root/Emby.Common.Implementations
diff options
context:
space:
mode:
Diffstat (limited to 'Emby.Common.Implementations')
-rw-r--r--Emby.Common.Implementations/BaseApplicationHost.cs2
-rw-r--r--Emby.Common.Implementations/EnvironmentInfo/EnvironmentInfo.cs6
-rw-r--r--Emby.Common.Implementations/IO/ManagedFileSystem.cs29
-rw-r--r--Emby.Common.Implementations/ScheduledTasks/ScheduledTaskWorker.cs20
4 files changed, 24 insertions, 33 deletions
diff --git a/Emby.Common.Implementations/BaseApplicationHost.cs b/Emby.Common.Implementations/BaseApplicationHost.cs
index 02d7cb31f..9c9e14ec6 100644
--- a/Emby.Common.Implementations/BaseApplicationHost.cs
+++ b/Emby.Common.Implementations/BaseApplicationHost.cs
@@ -795,6 +795,8 @@ return null;
/// </summary>
public void NotifyPendingRestart()
{
+ Logger.Info("App needs to be restarted.");
+
var changed = !HasPendingRestart;
HasPendingRestart = true;
diff --git a/Emby.Common.Implementations/EnvironmentInfo/EnvironmentInfo.cs b/Emby.Common.Implementations/EnvironmentInfo/EnvironmentInfo.cs
index 6cc4626ea..dcc974413 100644
--- a/Emby.Common.Implementations/EnvironmentInfo/EnvironmentInfo.cs
+++ b/Emby.Common.Implementations/EnvironmentInfo/EnvironmentInfo.cs
@@ -10,11 +10,17 @@ namespace Emby.Common.Implementations.EnvironmentInfo
public class EnvironmentInfo : IEnvironmentInfo
{
public MediaBrowser.Model.System.Architecture? CustomArchitecture { get; set; }
+ public MediaBrowser.Model.System.OperatingSystem? CustomOperatingSystem { get; set; }
public MediaBrowser.Model.System.OperatingSystem OperatingSystem
{
get
{
+ if (CustomOperatingSystem.HasValue)
+ {
+ return CustomOperatingSystem.Value;
+ }
+
#if NET46
switch (Environment.OSVersion.Platform)
{
diff --git a/Emby.Common.Implementations/IO/ManagedFileSystem.cs b/Emby.Common.Implementations/IO/ManagedFileSystem.cs
index 62d285072..78070a5d9 100644
--- a/Emby.Common.Implementations/IO/ManagedFileSystem.cs
+++ b/Emby.Common.Implementations/IO/ManagedFileSystem.cs
@@ -490,38 +490,13 @@ namespace Emby.Common.Implementations.IO
var temp1 = Path.GetTempFileName();
// Copying over will fail against hidden files
- RemoveHiddenAttribute(file1);
- RemoveHiddenAttribute(file2);
+ SetHidden(file1, false);
+ SetHidden(file2, false);
CopyFile(file1, temp1, true);
CopyFile(file2, file1, true);
CopyFile(temp1, file2, true);
-
- DeleteFile(temp1);
- }
-
- /// <summary>
- /// Removes the hidden attribute.
- /// </summary>
- /// <param name="path">The path.</param>
- private void RemoveHiddenAttribute(string path)
- {
- if (string.IsNullOrEmpty(path))
- {
- throw new ArgumentNullException("path");
- }
-
- var currentFile = new FileInfo(path);
-
- // This will fail if the file is hidden
- if (currentFile.Exists)
- {
- if ((currentFile.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden)
- {
- currentFile.Attributes &= ~FileAttributes.Hidden;
- }
- }
}
public bool ContainsSubPath(string parentPath, string path)
diff --git a/Emby.Common.Implementations/ScheduledTasks/ScheduledTaskWorker.cs b/Emby.Common.Implementations/ScheduledTasks/ScheduledTaskWorker.cs
index cbc7c7c2d..de528a94f 100644
--- a/Emby.Common.Implementations/ScheduledTasks/ScheduledTaskWorker.cs
+++ b/Emby.Common.Implementations/ScheduledTasks/ScheduledTaskWorker.cs
@@ -282,9 +282,12 @@ namespace Emby.Common.Implementations.ScheduledTasks
throw new ArgumentNullException("value");
}
- SaveTriggers(value);
+ // This null check is not great, but is needed to handle bad user input, or user mucking with the config file incorrectly
+ var triggerList = value.Where(i => i != null).ToArray();
- InternalTriggers = value.Select(i => new Tuple<TaskTriggerInfo, ITaskTrigger>(i, GetTrigger(i))).ToArray();
+ SaveTriggers(triggerList);
+
+ InternalTriggers = triggerList.Select(i => new Tuple<TaskTriggerInfo, ITaskTrigger>(i, GetTrigger(i))).ToArray();
}
}
@@ -535,7 +538,8 @@ namespace Emby.Common.Implementations.ScheduledTasks
/// <returns>IEnumerable{BaseTaskTrigger}.</returns>
private Tuple<TaskTriggerInfo, ITaskTrigger>[] LoadTriggers()
{
- var settings = LoadTriggerSettings();
+ // This null check is not great, but is needed to handle bad user input, or user mucking with the config file incorrectly
+ var settings = LoadTriggerSettings().Where(i => i != null).ToArray();
return settings.Select(i => new Tuple<TaskTriggerInfo, ITaskTrigger>(i, GetTrigger(i))).ToArray();
}
@@ -544,8 +548,12 @@ namespace Emby.Common.Implementations.ScheduledTasks
{
try
{
- return JsonSerializer.DeserializeFromFile<IEnumerable<TaskTriggerInfo>>(GetConfigurationFilePath())
- .ToArray();
+ var list = JsonSerializer.DeserializeFromFile<IEnumerable<TaskTriggerInfo>>(GetConfigurationFilePath());
+
+ if (list != null)
+ {
+ return list.ToArray();
+ }
}
catch (FileNotFoundException)
{
@@ -555,8 +563,8 @@ namespace Emby.Common.Implementations.ScheduledTasks
catch (DirectoryNotFoundException)
{
// File doesn't exist. No biggie. Return defaults.
- return ScheduledTask.GetDefaultTriggers().ToArray();
}
+ return ScheduledTask.GetDefaultTriggers().ToArray();
}
/// <summary>