public static RubyIO /*!*/ Reopen(RubyIO /*!*/ self, [NotNull] RubyIO /*!*/ source) { self.Context.RedirectFileDescriptor(self.GetFileDescriptor(), source.GetFileDescriptor()); self.SetStream(source.GetStream()); self.Mode = source.Mode; return(self); }
public static bool IsAtty(RubyIO /*!*/ self) { ConsoleStreamType?console = self.ConsoleStreamType; if (console == null) { return(self.GetStream().BaseStream == Stream.Null); } int fd = GetStdHandleFd(console.Value); switch (Environment.OSVersion.Platform) { case PlatformID.Win32NT: case PlatformID.Win32S: case PlatformID.Win32Windows: case PlatformID.WinCE: IntPtr handle = GetStdHandle(fd); if (handle == IntPtr.Zero) { throw new Win32Exception(); } return(GetFileType(handle) == FILE_TYPE_CHAR); default: return(isatty(fd) == 1); } }
public static RubyIO /*!*/ InitializeCopy(RubyIO /*!*/ self, [NotNull] RubyIO /*!*/ source) { Stream stream = source.GetStream(); int descriptor = self.Context.DuplicateFileDescriptor(source.GetFileDescriptor()); self.SetStream(stream); self.SetFileDescriptor(descriptor); self.Mode = source.Mode; return(self); }
public static bool IsAtty(RubyIO/*!*/ self) { ConsoleStreamType? console = self.ConsoleStreamType; if (console == null) { return self.GetStream().BaseStream == Stream.Null; } int fd = GetStdHandleFd(console.Value); switch (Environment.OSVersion.Platform) { case PlatformID.Win32NT: case PlatformID.Win32S: case PlatformID.Win32Windows: case PlatformID.WinCE: IntPtr handle = GetStdHandle(fd); if (handle == IntPtr.Zero) { throw new Win32Exception(); } return GetFileType(handle) == FILE_TYPE_CHAR; default: return isatty(fd) == 1; } }