Merge pull request #2 from vladjerca/feature/configure_root_ctor

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

View file

@ -14,12 +14,27 @@ public abstract class FFBase : IDisposable
protected string ConfiguredRoot; protected string ConfiguredRoot;
protected Process Process; protected Process Process;
protected FFBase() protected FFBase(FFMpegOptions opts = null)
{ {
ConfiguredRoot = var options = opts;
!File.Exists(_ConfigFile) ?
_DefaultRoot : if (
JsonConvert.DeserializeObject<Dictionary<string, string>>(File.ReadAllText(_ConfigFile))["RootDirectory"]; opts == null &&
File.Exists(_ConfigFile)
)
{
options = JsonConvert.DeserializeObject<FFMpegOptions>(File.ReadAllText(_ConfigFile));
}
if (options == null)
{
options = new FFMpegOptions
{
RootDirectory = _DefaultRoot
};
}
ConfiguredRoot = options.RootDirectory;
} }
/// <summary> /// <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> <PackageProjectUrl>https://github.com/vladjerca/FFMpegCore</PackageProjectUrl>
<Copyright>Vlad Jerca</Copyright> <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> <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> <Version>1.0.3</Version>
<AssemblyVersion>1.0.2.0</AssemblyVersion> <AssemblyVersion>1.0.3.0</AssemblyVersion>
<FileVersion>1.0.2.0</FileVersion> <FileVersion>1.0.3.0</FileVersion>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>