예제 #1
0
        void IDisposable.Dispose()
        {
            Dispose(true);

            // see spec, suppress finalization of this object.
            GC.SuppressFinalize(this);
        }
 protected override void Dispose(bool disposing)
 {
     if (!m_disposed)
     {
         x = 0;
         y = 0;
         if (key != null)
         {
             Array.Clear(key, 0, key.Length);
             key = null;
         }
         Array.Clear(state, 0, state.Length);
         state = null;
         GC.SuppressFinalize(this);
         m_disposed = true;
     }
 }
예제 #3
0
 public void Dispose()
 {
     Dispose(true);
     GC.SuppressFinalize(this);
 }
        public override void Close()
        {
            Dispose(true);

            GC.SuppressFinalize(this);
        }
예제 #5
0
        void IDisposable.Dispose()
#endif
        {
            Dispose(true);
            GC.SuppressFinalize(this);               // Finalization is now unnecessary
        }
예제 #6
0
        private static void SetupStreams(Encoding inputEncoding, Encoding outputEncoding)
        {
#if !NET_2_1 && !SSHARP
            if (!Environment.IsRunningOnWindows && ConsoleDriver.IsConsole)
            {
                StreamWriter w = new CStreamWriter(OpenStandardOutput(0), outputEncoding);
                w.AutoFlush = true;
                stdout      = TextWriter.Synchronized(w, true);

                w           = new CStreamWriter(OpenStandardOutput(0), outputEncoding);
                w.AutoFlush = true;
                stderr      = TextWriter.Synchronized(w, true);

#if CONSOLEIN
                stdin = new CStreamReader(OpenStandardInput(0), inputEncoding);
#endif
            }
            else
            {
#endif
// FULL_AOT_RUNTIME is used (instead of MONOTOUCH) since we only want this code when running on
// iOS (simulator or devices) and *not* when running tools (e.g. btouch #12179) that needs to use
// the mscorlib.dll shipped with Xamarin.iOS
#if MONOTOUCH && FULL_AOT_RUNTIME
            stdout = new NSLogWriter();
#else
#if SSHARP
            stdout = new StdTextWriter();
#else
            stdout = new UnexceptionalStreamWriter(OpenStandardOutput(0), outputEncoding);
            ((StreamWriter)stdout).AutoFlush = true;
#endif
#endif
            stdout = TextWriter.Synchronized(stdout, true);

#if MONOTOUCH && FULL_AOT_RUNTIME
            stderr = new NSLogWriter();
#else
#if SSHARP
            stderr = new StdErrWriter();
#else
            stderr = new UnexceptionalStreamWriter(OpenStandardError(0), outputEncoding);
            ((StreamWriter)stderr).AutoFlush = true;
#endif
#endif
            stderr = TextWriter.Synchronized(stderr, true);

#if CONSOLEIN
            stdin = new UnexceptionalStreamReader(OpenStandardInput(0), inputEncoding);
            stdin = TextReader.Synchronized(stdin);
#endif
#if !NET_2_1 && !SSHARP
        }
#endif

#if MONODROID
            if (LogcatTextWriter.IsRunningOnAndroid())
            {
                stdout = TextWriter.Synchronized(new LogcatTextWriter("mono-stdout", stdout));
                stderr = TextWriter.Synchronized(new LogcatTextWriter("mono-stderr", stderr));
            }
#endif // MONODROID

            GC.SuppressFinalize(stdout);
            GC.SuppressFinalize(stderr);
#if CONSOLEIN
            GC.SuppressFinalize(stdin);
#endif

#if SSHARP
            IsOutputRedirected = false;
            IsErrorRedirected  = false;
#endif
        }
예제 #7
0
 void IDisposable.Dispose()
 {
     Dispose(true);
     GC.SuppressFinalize(this);
 }