mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-05-27 19:08:27 +01:00
Switched all i/o to win32 methods and added protobuf serialization for ffprobe caching
This commit is contained in:
parent
882e364326
commit
c80c8c1cfd
@@ -33,6 +33,9 @@
|
||||
<ItemGroup>
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
<Reference Include="protobuf-net">
|
||||
<HintPath>..\packages\protobuf-net.2.0.0.480\lib\net40\protobuf-net.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="ServiceStack.Text, Version=3.9.5.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\ServiceStack.Text.3.9.5\lib\net35\ServiceStack.Text.dll</HintPath>
|
||||
@@ -89,6 +92,7 @@
|
||||
<Compile Include="Plugins\BasePlugin.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Serialization\JsvSerializer.cs" />
|
||||
<Compile Include="Serialization\ProtobufSerializer.cs" />
|
||||
<Compile Include="Serialization\XmlSerializer.cs" />
|
||||
<Compile Include="UI\BaseApplication.cs" />
|
||||
<Compile Include="UI\Splash.xaml.cs">
|
||||
|
||||
38
MediaBrowser.Common/Serialization/ProtobufSerializer.cs
Normal file
38
MediaBrowser.Common/Serialization/ProtobufSerializer.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.IO;
|
||||
|
||||
namespace MediaBrowser.Common.Serialization
|
||||
{
|
||||
public static class ProtobufSerializer
|
||||
{
|
||||
public static void SerializeToStream<T>(T obj, Stream stream)
|
||||
{
|
||||
ProtoBuf.Serializer.Serialize<T>(stream, obj);
|
||||
}
|
||||
|
||||
public static T DeserializeFromStream<T>(Stream stream)
|
||||
{
|
||||
return ProtoBuf.Serializer.Deserialize<T>(stream);
|
||||
}
|
||||
|
||||
public static void SerializeToFile<T>(T obj, string file)
|
||||
{
|
||||
using (Stream stream = File.Open(file, FileMode.Create))
|
||||
{
|
||||
SerializeToStream<T>(obj, stream);
|
||||
}
|
||||
}
|
||||
|
||||
public static T DeserializeFromFile<T>(string file)
|
||||
{
|
||||
using (Stream stream = File.OpenRead(file))
|
||||
{
|
||||
return DeserializeFromStream<T>(stream);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -48,6 +48,11 @@ namespace MediaBrowser.Common.UI
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (Logger.LoggerInstance != null)
|
||||
{
|
||||
Logger.LogException(ex);
|
||||
}
|
||||
|
||||
MessageBox.Show("There was an error launching Media Browser: " + ex.Message);
|
||||
splash.Close();
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="protobuf-net" version="2.0.0.480" targetFramework="net45" />
|
||||
<package id="Rx-Core" version="2.0.20814" targetFramework="net45" />
|
||||
<package id="Rx-Interfaces" version="2.0.20814" targetFramework="net45" />
|
||||
<package id="Rx-Linq" version="2.0.20814" targetFramework="net45" />
|
||||
|
||||
Reference in New Issue
Block a user