mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-06-27 01:50:53 +01:00
Some minor code cleanups
This commit is contained in:
parent
016590529f
commit
670a53258e
@@ -67,7 +67,7 @@ namespace MediaBrowser.Common.Kernel
|
||||
/// </summary>
|
||||
public abstract KernelContext KernelContext { get; }
|
||||
|
||||
public BaseKernel()
|
||||
protected BaseKernel()
|
||||
{
|
||||
ApplicationPaths = new TApplicationPathsType();
|
||||
}
|
||||
@@ -76,13 +76,13 @@ namespace MediaBrowser.Common.Kernel
|
||||
{
|
||||
ReloadLogger();
|
||||
|
||||
progress.Report(new TaskProgress() { Description = "Loading configuration", PercentComplete = 0 });
|
||||
progress.Report(new TaskProgress { Description = "Loading configuration", PercentComplete = 0 });
|
||||
ReloadConfiguration();
|
||||
|
||||
progress.Report(new TaskProgress() { Description = "Starting Http server", PercentComplete = 5 });
|
||||
progress.Report(new TaskProgress { Description = "Starting Http server", PercentComplete = 5 });
|
||||
ReloadHttpServer();
|
||||
|
||||
progress.Report(new TaskProgress() { Description = "Loading Plugins", PercentComplete = 10 });
|
||||
progress.Report(new TaskProgress { Description = "Loading Plugins", PercentComplete = 10 });
|
||||
await ReloadComposableParts().ConfigureAwait(false);
|
||||
}
|
||||
|
||||
@@ -192,7 +192,7 @@ namespace MediaBrowser.Common.Kernel
|
||||
|
||||
HttpServer = new HttpServer(HttpServerUrlPrefix);
|
||||
|
||||
HttpListener = HttpServer.Subscribe((ctx) =>
|
||||
HttpListener = HttpServer.Subscribe(ctx =>
|
||||
{
|
||||
BaseHandler handler = HttpHandlers.FirstOrDefault(h => h.HandlesRequest(ctx.Request));
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace MediaBrowser.Common.Logging
|
||||
|
||||
Thread currentThread = Thread.CurrentThread;
|
||||
|
||||
LogRow row = new LogRow()
|
||||
LogRow row = new LogRow
|
||||
{
|
||||
Severity = severity,
|
||||
Message = message,
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace MediaBrowser.Common.Logging
|
||||
{
|
||||
@@ -17,7 +15,7 @@ namespace MediaBrowser.Common.Logging
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
List<string> data = new List<string>();
|
||||
var data = new List<string>();
|
||||
|
||||
data.Add(Time.ToString(TimePattern));
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace MediaBrowser.Common.Logging
|
||||
/// <summary>
|
||||
/// Provides a Logger that can write to any Stream
|
||||
/// </summary>
|
||||
public class StreamLogger : ThreadedLogger
|
||||
public class StreamLogger : BaseLogger
|
||||
{
|
||||
private Stream Stream { get; set; }
|
||||
|
||||
@@ -17,11 +17,15 @@ namespace MediaBrowser.Common.Logging
|
||||
Stream = stream;
|
||||
}
|
||||
|
||||
protected override void AsyncLogMessage(LogRow row)
|
||||
protected override void LogEntry(LogRow row)
|
||||
{
|
||||
byte[] bytes = new UTF8Encoding().GetBytes(row.ToString() + Environment.NewLine);
|
||||
Stream.Write(bytes, 0, bytes.Length);
|
||||
Stream.Flush();
|
||||
|
||||
lock (Stream)
|
||||
{
|
||||
Stream.Write(bytes, 0, bytes.Length);
|
||||
Stream.Flush();
|
||||
}
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
|
||||
@@ -1,73 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
|
||||
namespace MediaBrowser.Common.Logging
|
||||
{
|
||||
public abstract class ThreadedLogger : BaseLogger
|
||||
{
|
||||
Thread loggingThread;
|
||||
Queue<Action> queue = new Queue<Action>();
|
||||
AutoResetEvent hasNewItems = new AutoResetEvent(false);
|
||||
volatile bool terminate = false;
|
||||
bool waiting = false;
|
||||
|
||||
public ThreadedLogger()
|
||||
: base()
|
||||
{
|
||||
loggingThread = new Thread(new ThreadStart(ProcessQueue));
|
||||
loggingThread.IsBackground = true;
|
||||
loggingThread.Start();
|
||||
}
|
||||
|
||||
|
||||
void ProcessQueue()
|
||||
{
|
||||
while (!terminate)
|
||||
{
|
||||
waiting = true;
|
||||
hasNewItems.WaitOne(10000, true);
|
||||
waiting = false;
|
||||
|
||||
Queue<Action> queueCopy;
|
||||
lock (queue)
|
||||
{
|
||||
queueCopy = new Queue<Action>(queue);
|
||||
queue.Clear();
|
||||
}
|
||||
|
||||
foreach (var log in queueCopy)
|
||||
{
|
||||
log();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void LogEntry(LogRow row)
|
||||
{
|
||||
lock (queue)
|
||||
{
|
||||
queue.Enqueue(() => AsyncLogMessage(row));
|
||||
}
|
||||
hasNewItems.Set();
|
||||
}
|
||||
|
||||
protected abstract void AsyncLogMessage(LogRow row);
|
||||
|
||||
protected override void Flush()
|
||||
{
|
||||
while (!waiting)
|
||||
{
|
||||
Thread.Sleep(1);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
Flush();
|
||||
terminate = true;
|
||||
hasNewItems.Set();
|
||||
base.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -83,7 +83,6 @@
|
||||
<ItemGroup>
|
||||
<Compile Include="Kernel\BaseApplicationPaths.cs" />
|
||||
<Compile Include="Drawing\DrawingUtils.cs" />
|
||||
<Compile Include="Logging\ThreadedLogger.cs" />
|
||||
<Compile Include="Logging\TraceLogger.cs" />
|
||||
<Compile Include="Net\Handlers\StaticFileHandler.cs" />
|
||||
<Compile Include="Net\MimeTypes.cs" />
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace MediaBrowser.Common.Net.Handlers
|
||||
{
|
||||
public abstract class BaseEmbeddedResourceHandler : BaseHandler
|
||||
{
|
||||
public BaseEmbeddedResourceHandler(string resourcePath)
|
||||
protected BaseEmbeddedResourceHandler(string resourcePath)
|
||||
: base()
|
||||
{
|
||||
ResourcePath = resourcePath;
|
||||
@@ -15,7 +15,7 @@ namespace MediaBrowser.Common.Net.Handlers
|
||||
|
||||
public override Task<string> GetContentType()
|
||||
{
|
||||
return Task.FromResult<string>(MimeTypes.GetMimeType(ResourcePath));
|
||||
return Task.FromResult(MimeTypes.GetMimeType(ResourcePath));
|
||||
}
|
||||
|
||||
protected override Task WriteResponseToOutputStream(Stream stream)
|
||||
|
||||
@@ -25,8 +25,8 @@ namespace MediaBrowser.Common.Net.Handlers
|
||||
}
|
||||
}
|
||||
|
||||
private bool _TotalContentLengthDiscovered = false;
|
||||
private long? _TotalContentLength = null;
|
||||
private bool _TotalContentLengthDiscovered;
|
||||
private long? _TotalContentLength;
|
||||
public long? TotalContentLength
|
||||
{
|
||||
get
|
||||
@@ -34,6 +34,7 @@ namespace MediaBrowser.Common.Net.Handlers
|
||||
if (!_TotalContentLengthDiscovered)
|
||||
{
|
||||
_TotalContentLength = GetTotalContentLength();
|
||||
_TotalContentLengthDiscovered = true;
|
||||
}
|
||||
|
||||
return _TotalContentLength;
|
||||
@@ -64,7 +65,7 @@ namespace MediaBrowser.Common.Net.Handlers
|
||||
}
|
||||
}
|
||||
|
||||
protected List<KeyValuePair<long, long?>> _RequestedRanges = null;
|
||||
private List<KeyValuePair<long, long?>> _RequestedRanges;
|
||||
protected IEnumerable<KeyValuePair<long, long?>> RequestedRanges
|
||||
{
|
||||
get
|
||||
@@ -367,7 +368,7 @@ namespace MediaBrowser.Common.Net.Handlers
|
||||
{
|
||||
DateTime? value = null;
|
||||
|
||||
return Task.FromResult<DateTime?>(value);
|
||||
return Task.FromResult(value);
|
||||
}
|
||||
|
||||
private bool IsResponseValid
|
||||
@@ -378,7 +379,7 @@ namespace MediaBrowser.Common.Net.Handlers
|
||||
}
|
||||
}
|
||||
|
||||
private Hashtable _FormValues = null;
|
||||
private Hashtable _FormValues;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value from form POST data
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace MediaBrowser.Common.Net.Handlers
|
||||
|
||||
if (string.IsNullOrEmpty(format))
|
||||
{
|
||||
return Handlers.SerializationFormat.Json;
|
||||
return SerializationFormat.Json;
|
||||
}
|
||||
|
||||
return (SerializationFormat)Enum.Parse(typeof(SerializationFormat), format, true);
|
||||
@@ -26,16 +26,16 @@ namespace MediaBrowser.Common.Net.Handlers
|
||||
{
|
||||
switch (SerializationFormat)
|
||||
{
|
||||
case Handlers.SerializationFormat.Jsv:
|
||||
return Task.FromResult<string>("text/plain");
|
||||
case Handlers.SerializationFormat.Protobuf:
|
||||
return Task.FromResult<string>("application/x-protobuf");
|
||||
case SerializationFormat.Jsv:
|
||||
return Task.FromResult("text/plain");
|
||||
case SerializationFormat.Protobuf:
|
||||
return Task.FromResult("application/x-protobuf");
|
||||
default:
|
||||
return Task.FromResult<string>(MimeTypes.JsonMimeType);
|
||||
return Task.FromResult(MimeTypes.JsonMimeType);
|
||||
}
|
||||
}
|
||||
|
||||
private bool _ObjectToSerializeEnsured = false;
|
||||
private bool _ObjectToSerializeEnsured;
|
||||
private T _ObjectToSerialize;
|
||||
|
||||
private async Task EnsureObjectToSerialize()
|
||||
@@ -66,14 +66,14 @@ namespace MediaBrowser.Common.Net.Handlers
|
||||
|
||||
switch (SerializationFormat)
|
||||
{
|
||||
case Handlers.SerializationFormat.Jsv:
|
||||
JsvSerializer.SerializeToStream<T>(_ObjectToSerialize, stream);
|
||||
case SerializationFormat.Jsv:
|
||||
JsvSerializer.SerializeToStream(_ObjectToSerialize, stream);
|
||||
break;
|
||||
case Handlers.SerializationFormat.Protobuf:
|
||||
ProtobufSerializer.SerializeToStream<T>(_ObjectToSerialize, stream);
|
||||
case SerializationFormat.Protobuf:
|
||||
ProtobufSerializer.SerializeToStream(_ObjectToSerialize, stream);
|
||||
break;
|
||||
default:
|
||||
JsonSerializer.SerializeToStream<T>(_ObjectToSerialize, stream);
|
||||
JsonSerializer.SerializeToStream(_ObjectToSerialize, stream);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,8 +33,8 @@ namespace MediaBrowser.Common.Net.Handlers
|
||||
}
|
||||
}
|
||||
|
||||
private bool _SourceStreamEnsured = false;
|
||||
private Stream _SourceStream = null;
|
||||
private bool _SourceStreamEnsured;
|
||||
private Stream _SourceStream;
|
||||
private Stream SourceStream
|
||||
{
|
||||
get
|
||||
@@ -116,12 +116,12 @@ namespace MediaBrowser.Common.Net.Handlers
|
||||
value = File.GetLastWriteTimeUtc(Path);
|
||||
}
|
||||
|
||||
return Task.FromResult<DateTime?>(value);
|
||||
return Task.FromResult(value);
|
||||
}
|
||||
|
||||
public override Task<string> GetContentType()
|
||||
{
|
||||
return Task.FromResult<string>(MimeTypes.GetMimeType(Path));
|
||||
return Task.FromResult(MimeTypes.GetMimeType(Path));
|
||||
}
|
||||
|
||||
protected override Task PrepareResponse()
|
||||
@@ -141,21 +141,17 @@ namespace MediaBrowser.Common.Net.Handlers
|
||||
{
|
||||
return ServeCompleteRangeRequest(requestedRange, stream);
|
||||
}
|
||||
else if (TotalContentLength.HasValue)
|
||||
if (TotalContentLength.HasValue)
|
||||
{
|
||||
// This will have to buffer a portion of the content into memory
|
||||
return ServePartialRangeRequestWithKnownTotalContentLength(requestedRange, stream);
|
||||
}
|
||||
else
|
||||
{
|
||||
// This will have to buffer the entire content into memory
|
||||
return ServePartialRangeRequestWithUnknownTotalContentLength(requestedRange, stream);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return SourceStream.CopyToAsync(stream);
|
||||
|
||||
// This will have to buffer the entire content into memory
|
||||
return ServePartialRangeRequestWithUnknownTotalContentLength(requestedRange, stream);
|
||||
}
|
||||
|
||||
return SourceStream.CopyToAsync(stream);
|
||||
}
|
||||
|
||||
protected override void DisposeResponseStream()
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace MediaBrowser.Common.Net
|
||||
private IObservable<HttpListenerContext> ObservableHttpContext()
|
||||
{
|
||||
return Observable.Create<HttpListenerContext>(obs =>
|
||||
Observable.FromAsync<HttpListenerContext>(() => listener.GetContextAsync())
|
||||
Observable.FromAsync(() => listener.GetContextAsync())
|
||||
.Subscribe(obs))
|
||||
.Repeat()
|
||||
.Retry()
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace MediaBrowser.Common.Net
|
||||
|
||||
public static string GetMimeType(string path)
|
||||
{
|
||||
string ext = Path.GetExtension(path);
|
||||
var ext = Path.GetExtension(path);
|
||||
|
||||
// http://en.wikipedia.org/wiki/Internet_media_type
|
||||
// Add more as needed
|
||||
@@ -19,137 +19,137 @@ namespace MediaBrowser.Common.Net
|
||||
{
|
||||
return "video/mpeg";
|
||||
}
|
||||
else if (ext.EndsWith("mp4", StringComparison.OrdinalIgnoreCase))
|
||||
if (ext.EndsWith("mp4", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return "video/mp4";
|
||||
}
|
||||
else if (ext.EndsWith("ogv", StringComparison.OrdinalIgnoreCase))
|
||||
if (ext.EndsWith("ogv", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return "video/ogg";
|
||||
}
|
||||
else if (ext.EndsWith("mov", StringComparison.OrdinalIgnoreCase))
|
||||
if (ext.EndsWith("mov", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return "video/quicktime";
|
||||
}
|
||||
else if (ext.EndsWith("webm", StringComparison.OrdinalIgnoreCase))
|
||||
if (ext.EndsWith("webm", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return "video/webm";
|
||||
}
|
||||
else if (ext.EndsWith("mkv", StringComparison.OrdinalIgnoreCase))
|
||||
if (ext.EndsWith("mkv", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return "video/x-matroska";
|
||||
}
|
||||
else if (ext.EndsWith("wmv", StringComparison.OrdinalIgnoreCase))
|
||||
if (ext.EndsWith("wmv", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return "video/x-ms-wmv";
|
||||
}
|
||||
else if (ext.EndsWith("flv", StringComparison.OrdinalIgnoreCase))
|
||||
if (ext.EndsWith("flv", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return "video/x-flv";
|
||||
}
|
||||
else if (ext.EndsWith("avi", StringComparison.OrdinalIgnoreCase))
|
||||
if (ext.EndsWith("avi", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return "video/avi";
|
||||
}
|
||||
else if (ext.EndsWith("m4v", StringComparison.OrdinalIgnoreCase))
|
||||
if (ext.EndsWith("m4v", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return "video/x-m4v";
|
||||
}
|
||||
else if (ext.EndsWith("asf", StringComparison.OrdinalIgnoreCase))
|
||||
if (ext.EndsWith("asf", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return "video/x-ms-asf";
|
||||
}
|
||||
else if (ext.EndsWith("3gp", StringComparison.OrdinalIgnoreCase))
|
||||
if (ext.EndsWith("3gp", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return "video/3gpp";
|
||||
}
|
||||
else if (ext.EndsWith("3g2", StringComparison.OrdinalIgnoreCase))
|
||||
if (ext.EndsWith("3g2", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return "video/3gpp2";
|
||||
}
|
||||
else if (ext.EndsWith("ts", StringComparison.OrdinalIgnoreCase))
|
||||
if (ext.EndsWith("ts", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return "video/mp2t";
|
||||
}
|
||||
|
||||
// Type text
|
||||
else if (ext.EndsWith("css", StringComparison.OrdinalIgnoreCase))
|
||||
if (ext.EndsWith("css", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return "text/css";
|
||||
}
|
||||
else if (ext.EndsWith("csv", StringComparison.OrdinalIgnoreCase))
|
||||
if (ext.EndsWith("csv", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return "text/csv";
|
||||
}
|
||||
else if (ext.EndsWith("html", StringComparison.OrdinalIgnoreCase) || ext.EndsWith("html", StringComparison.OrdinalIgnoreCase))
|
||||
if (ext.EndsWith("html", StringComparison.OrdinalIgnoreCase) || ext.EndsWith("html", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return "text/html";
|
||||
}
|
||||
else if (ext.EndsWith("txt", StringComparison.OrdinalIgnoreCase))
|
||||
if (ext.EndsWith("txt", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return "text/plain";
|
||||
}
|
||||
|
||||
// Type image
|
||||
else if (ext.EndsWith("gif", StringComparison.OrdinalIgnoreCase))
|
||||
if (ext.EndsWith("gif", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return "image/gif";
|
||||
}
|
||||
else if (ext.EndsWith("jpg", StringComparison.OrdinalIgnoreCase) || ext.EndsWith("jpeg", StringComparison.OrdinalIgnoreCase))
|
||||
if (ext.EndsWith("jpg", StringComparison.OrdinalIgnoreCase) || ext.EndsWith("jpeg", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return "image/jpeg";
|
||||
}
|
||||
else if (ext.EndsWith("png", StringComparison.OrdinalIgnoreCase))
|
||||
if (ext.EndsWith("png", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return "image/png";
|
||||
}
|
||||
else if (ext.EndsWith("ico", StringComparison.OrdinalIgnoreCase))
|
||||
if (ext.EndsWith("ico", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return "image/vnd.microsoft.icon";
|
||||
}
|
||||
|
||||
// Type audio
|
||||
else if (ext.EndsWith("mp3", StringComparison.OrdinalIgnoreCase))
|
||||
if (ext.EndsWith("mp3", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return "audio/mpeg";
|
||||
}
|
||||
else if (ext.EndsWith("m4a", StringComparison.OrdinalIgnoreCase) || ext.EndsWith("aac", StringComparison.OrdinalIgnoreCase))
|
||||
if (ext.EndsWith("m4a", StringComparison.OrdinalIgnoreCase) || ext.EndsWith("aac", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return "audio/mp4";
|
||||
}
|
||||
else if (ext.EndsWith("webma", StringComparison.OrdinalIgnoreCase))
|
||||
if (ext.EndsWith("webma", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return "audio/webm";
|
||||
}
|
||||
else if (ext.EndsWith("wav", StringComparison.OrdinalIgnoreCase))
|
||||
if (ext.EndsWith("wav", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return "audio/wav";
|
||||
}
|
||||
else if (ext.EndsWith("wma", StringComparison.OrdinalIgnoreCase))
|
||||
if (ext.EndsWith("wma", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return "audio/x-ms-wma";
|
||||
}
|
||||
else if (ext.EndsWith("flac", StringComparison.OrdinalIgnoreCase))
|
||||
if (ext.EndsWith("flac", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return "audio/flac";
|
||||
}
|
||||
else if (ext.EndsWith("aac", StringComparison.OrdinalIgnoreCase))
|
||||
if (ext.EndsWith("aac", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return "audio/x-aac";
|
||||
}
|
||||
else if (ext.EndsWith("ogg", StringComparison.OrdinalIgnoreCase) || ext.EndsWith("oga", StringComparison.OrdinalIgnoreCase))
|
||||
if (ext.EndsWith("ogg", StringComparison.OrdinalIgnoreCase) || ext.EndsWith("oga", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return "audio/ogg";
|
||||
}
|
||||
|
||||
// Playlists
|
||||
else if (ext.EndsWith("m3u8", StringComparison.OrdinalIgnoreCase))
|
||||
if (ext.EndsWith("m3u8", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return "application/x-mpegURL";
|
||||
}
|
||||
|
||||
// Misc
|
||||
else if (ext.EndsWith("dll", StringComparison.OrdinalIgnoreCase))
|
||||
if (ext.EndsWith("dll", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return "application/x-msdownload";
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace MediaBrowser.Common.Plugins
|
||||
}
|
||||
}
|
||||
|
||||
private DateTime? _ConfigurationDateLastModified = null;
|
||||
private DateTime? _ConfigurationDateLastModified;
|
||||
public DateTime ConfigurationDateLastModified
|
||||
{
|
||||
get
|
||||
@@ -123,7 +123,7 @@ namespace MediaBrowser.Common.Plugins
|
||||
}
|
||||
}
|
||||
|
||||
private string _DataFolderPath = null;
|
||||
private string _DataFolderPath;
|
||||
/// <summary>
|
||||
/// Gets the full path to the data folder, where the plugin can store any miscellaneous files needed
|
||||
/// </summary>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace MediaBrowser.Common.Serialization
|
||||
{
|
||||
Configure();
|
||||
|
||||
ServiceStack.Text.JsonSerializer.SerializeToStream<T>(obj, stream);
|
||||
ServiceStack.Text.JsonSerializer.SerializeToStream(obj, stream);
|
||||
}
|
||||
|
||||
public static void SerializeToFile<T>(T obj, string file)
|
||||
@@ -21,7 +21,7 @@ namespace MediaBrowser.Common.Serialization
|
||||
|
||||
using (Stream stream = File.Open(file, FileMode.Create))
|
||||
{
|
||||
ServiceStack.Text.JsonSerializer.SerializeToStream<T>(obj, stream);
|
||||
ServiceStack.Text.JsonSerializer.SerializeToStream(obj, stream);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace MediaBrowser.Common.Serialization
|
||||
return ServiceStack.Text.JsonSerializer.DeserializeFromStream(type, stream);
|
||||
}
|
||||
|
||||
private static bool IsConfigured = false;
|
||||
private static bool IsConfigured;
|
||||
private static void Configure()
|
||||
{
|
||||
if (!IsConfigured)
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace MediaBrowser.Common.Serialization
|
||||
{
|
||||
public static void SerializeToStream<T>(T obj, Stream stream)
|
||||
{
|
||||
ServiceStack.Text.TypeSerializer.SerializeToStream<T>(obj, stream);
|
||||
ServiceStack.Text.TypeSerializer.SerializeToStream(obj, stream);
|
||||
}
|
||||
|
||||
public static T DeserializeFromStream<T>(Stream stream)
|
||||
@@ -29,7 +29,7 @@ namespace MediaBrowser.Common.Serialization
|
||||
{
|
||||
using (Stream stream = File.Open(file, FileMode.Create))
|
||||
{
|
||||
SerializeToStream<T>(obj, stream);
|
||||
SerializeToStream(obj, stream);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace MediaBrowser.Common.Serialization
|
||||
/// This means that this class can currently only handle types within the Model project.
|
||||
/// If we need to, we can always add a param indicating whether or not the model serializer should be used.
|
||||
/// </summary>
|
||||
private static ProtobufModelSerializer ProtobufModelSerializer = new ProtobufModelSerializer();
|
||||
private static readonly ProtobufModelSerializer ProtobufModelSerializer = new ProtobufModelSerializer();
|
||||
|
||||
public static void SerializeToStream<T>(T obj, Stream stream)
|
||||
{
|
||||
@@ -37,7 +37,7 @@ namespace MediaBrowser.Common.Serialization
|
||||
{
|
||||
using (Stream stream = File.Open(file, FileMode.Create))
|
||||
{
|
||||
SerializeToStream<T>(obj, stream);
|
||||
SerializeToStream(obj, stream);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace MediaBrowser.Common.Serialization
|
||||
{
|
||||
using (FileStream stream = new FileStream(file, FileMode.Create))
|
||||
{
|
||||
SerializeToStream<T>(obj, stream);
|
||||
SerializeToStream(obj, stream);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace MediaBrowser.Common.UI
|
||||
protected override void OnStartup(StartupEventArgs e)
|
||||
{
|
||||
// Without this the app will shutdown after the splash screen closes
|
||||
this.ShutdownMode = ShutdownMode.OnExplicitShutdown;
|
||||
ShutdownMode = ShutdownMode.OnExplicitShutdown;
|
||||
|
||||
LoadKernel();
|
||||
}
|
||||
@@ -42,7 +42,7 @@ namespace MediaBrowser.Common.UI
|
||||
Logger.LogInfo("Kernel.Init completed in {0} seconds.", (DateTime.UtcNow - now).TotalSeconds);
|
||||
splash.Close();
|
||||
|
||||
this.ShutdownMode = System.Windows.ShutdownMode.OnLastWindowClose;
|
||||
ShutdownMode = System.Windows.ShutdownMode.OnLastWindowClose;
|
||||
InstantiateMainWindow().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
@@ -13,18 +13,17 @@ namespace Microsoft.Shell
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.Remoting;
|
||||
using System.Runtime.Remoting.Channels;
|
||||
using System.Runtime.Remoting.Channels.Ipc;
|
||||
using System.Runtime.Serialization.Formatters;
|
||||
using System.Security;
|
||||
using System.Threading;
|
||||
using System.Windows;
|
||||
using System.Windows.Threading;
|
||||
using System.Xml.Serialization;
|
||||
using System.Security;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.ComponentModel;
|
||||
|
||||
internal enum WM
|
||||
{
|
||||
@@ -184,7 +183,7 @@ namespace Microsoft.Shell
|
||||
finally
|
||||
{
|
||||
|
||||
IntPtr p = _LocalFree(argv);
|
||||
_LocalFree(argv);
|
||||
// Otherwise LocalFree failed.
|
||||
// Assert.AreEqual(IntPtr.Zero, p);
|
||||
}
|
||||
|
||||
@@ -27,8 +27,8 @@ namespace MediaBrowser.Common.UI
|
||||
Logger.LogInfo(e.Description);
|
||||
}
|
||||
|
||||
this.lblProgress.Content = e.Description;
|
||||
this.pbProgress.Value = (double)e.PercentComplete;
|
||||
lblProgress.Content = e.Description;
|
||||
pbProgress.Value = (double)e.PercentComplete;
|
||||
}
|
||||
|
||||
private void Splash_Loaded(object sender, RoutedEventArgs e)
|
||||
|
||||
Reference in New Issue
Block a user