public static void Apply(string name, string gameDataFile, int videoBitRate, string destFile, bool highlights, Action <long, long> progressReporter, CancellationToken token) { var domain = AppDomain.CreateDomain(name, null, new AppDomainSetup()); try { var hostArgs = new TranscodeAndOverlayArguments(progressReporter, () => token.IsCancellationRequested); var arg = (TranscodeAndOverlayArguments)domain.CreateInstanceFromAndUnwrap( typeof(TranscodeAndOverlayArguments).Assembly.Location, typeof(TranscodeAndOverlayArguments).FullName, false, BindingFlags.CreateInstance, null, new object[] { gameDataFile, videoBitRate, destFile, highlights, (Action <long, long>)hostArgs.ProgressReporter, (Func <bool>)hostArgs.IsAborted, hostArgs.LogRepeater, Settings.Default.PluginName }, null, null); arg.Apply(); } catch (Exception e) { TraceError.WriteLine(e.Message); TraceError.WriteLine(e.StackTrace); throw e; } finally { AppDomain.Unload(domain); } }
public static void Apply(string name, string gameDataFile, int videoBitRate, string destFile, bool highlights, Action<long, long> progressReporter, CancellationToken token) { var domain = AppDomain.CreateDomain(name, null, new AppDomainSetup()); try { var hostArgs = new TranscodeAndOverlayArguments(progressReporter, () => token.IsCancellationRequested); var arg = (TranscodeAndOverlayArguments)domain.CreateInstanceFromAndUnwrap( typeof(TranscodeAndOverlayArguments).Assembly.Location, typeof(TranscodeAndOverlayArguments).FullName, false, BindingFlags.CreateInstance, null, new object[] { gameDataFile, videoBitRate, destFile, highlights, (Action<long, long>)hostArgs.ProgressReporter, (Func<bool>)hostArgs.IsAborted, hostArgs.LogRepeater, Settings.Default.PluginName }, null, null); arg.Apply(); } catch (Exception e) { TraceError.WriteLine(e.Message); TraceError.WriteLine(e.StackTrace); throw e; } finally { AppDomain.Unload(domain); } }