private void cleanup() { if (this.clip != null) { ((IDisposable)this.clip).Dispose(); this.clip = null; } if (this.enviroment != null) { ((IDisposable)this.enviroment).Dispose(); this.enviroment = null; } GC.SuppressFinalize(this); }
// Methods private AvsFile(string script, bool parse) { try { this.enviroment = new AviSynthScriptEnvironment(); this.clip = parse ? this.enviroment.ParseScript(script, AviSynthColorspace.RGB24) : this.enviroment.OpenScriptFile(script, AviSynthColorspace.RGB24); videoWidth = (ulong)this.clip.VideoWidth; videoHeight = (ulong)this.clip.VideoHeight; } catch (Exception) { this.cleanup(); throw; } }
// Methods public AviSynthClip(string func, string arg, AviSynthColorspace forceColorspace, AviSynthScriptEnvironment env) { if (dimzon_avs_init_2(ref this._avs, func, arg, ref this._vi, ref this._colorSpace, ref this._sampleType, forceColorspace.ToString()) != 0) { string message = this.getLastError(); this.cleanup(false); throw new AviSynthException(message); } }