Merge pull request #2 from vladjerca/feature/configure_root_ctor

FFMpegCore:  enable root configuration view ctor
Former-commit-id: 0e95615261
This commit is contained in:
Vlad Jerca 2019-03-01 20:48:07 +02:00
commit 7c25a5e8e7
3 changed files with 30 additions and 8 deletions

View file

@ -14,12 +14,27 @@ public abstract class FFBase : IDisposable
protected string ConfiguredRoot;
protected Process Process;
protected FFBase()
protected FFBase(FFMpegOptions opts = null)
{
ConfiguredRoot =
!File.Exists(_ConfigFile) ?
_DefaultRoot :
JsonConvert.DeserializeObject<Dictionary<string, string>>(File.ReadAllText(_ConfigFile))["RootDirectory"];
var options = opts;
if (
opts == null &&
File.Exists(_ConfigFile)
)
{
options = JsonConvert.DeserializeObject<FFMpegOptions>(File.ReadAllText(_ConfigFile));
}
if (options == null)
{
options = new FFMpegOptions
{
RootDirectory = _DefaultRoot
};
}
ConfiguredRoot = options.RootDirectory;
}
/// <summary>

View file

@ -0,0 +1,7 @@
namespace FFMpegCore.FFMPEG
{
public class FFMpegOptions
{
public string RootDirectory { get; set; }
}
}

View file

@ -7,9 +7,9 @@
<PackageProjectUrl>https://github.com/vladjerca/FFMpegCore</PackageProjectUrl>
<Copyright>Vlad Jerca</Copyright>
<Description>A great way to use FFMpeg encoding when writing video applications, client-side and server-side. It has wrapper methods that allow conversion to all web formats: MP4, OGV, TS and methods of capturing screens from the videos.</Description>
<Version>1.0.2</Version>
<AssemblyVersion>1.0.2.0</AssemblyVersion>
<FileVersion>1.0.2.0</FileVersion>
<Version>1.0.3</Version>
<AssemblyVersion>1.0.3.0</AssemblyVersion>
<FileVersion>1.0.3.0</FileVersion>
</PropertyGroup>
<ItemGroup>