コード例 #1
0
ファイル: YoutubeDL.cs プロジェクト: java4fun/YoutubeDL-NET
        private bool disposedValue = false; // To detect redundant calls

        protected virtual void Dispose(bool disposing)
        {
            if (!disposedValue)
            {
                if (disposing)
                {
                    // TODO: dispose managed state (managed objects).
                    if (httpClient != null)
                    {
                        httpClient.Dispose();
                        httpClient = null;
                    }
                    if (httpClientHandler != null)
                    {
                        httpClientHandler.Dispose();
                        httpClientHandler = null;
                    }
                    if (Options != null)
                    {
                        Options = null;
                    }
                    RemoveAllExtractors();
                }

                // TODO: free unmanaged resources (unmanaged objects) and override a finalizer below.
                // TODO: set large fields to null.
                //MethodInfo i = this.GetType().GetMethod("DisposePython", BindingFlags.NonPublic | BindingFlags.Instance);
                //if (i != null) i.Invoke(this, new object[] { disposing });


                disposedValue = true;
            }
        }
コード例 #2
0
ファイル: YoutubeDL.cs プロジェクト: java4fun/YoutubeDL-NET
 public void SetupHttpClient()
 {
     httpClientHandler = new YTDL_HttpClientHandler
     {
         CookieContainer   = new CookieContainer(),
         AllowAutoRedirect = true,
     };
     httpClient = new HttpClient(httpClientHandler, true);
 }