Inheritance: IDisposable
Ejemplo n.º 1
0
 public void TestTestFile()
 {
     var path = Path.GetTempFileName();
       Assert.That(MsysSocket.TestFile(path), Is.False);
       File.Delete(path);
       using (var socket = new CygwinSocket(path)) {
     Assert.That(MsysSocket.TestFile(path), Is.False);
       }
       using (var socket = new MsysSocket(path)) {
     Assert.That(MsysSocket.TestFile(path), Is.True);
       }
 }
Ejemplo n.º 2
0
 public void StopCygwinSocket()
 {
     if (disposed)
     {
         throw new ObjectDisposedException("PagentAgent");
     }
     if (cygwinSocket == null)
     {
         return;
     }
     cygwinSocket.Dispose();
     cygwinSocket = null;
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Starts a cygwin style socket that can be used by the ssh program
 /// that comes with cygwin.
 /// </summary>
 /// <param name="path">The path to the socket file that will be created.</param>
 public void StartCygwinSocket(string path)
 {
     if (disposed)
     {
         throw new ObjectDisposedException("PagentAgent");
     }
     if (cygwinSocket != null)
     {
         return;
     }
     // only overwrite a file if it looks like a CygwinSocket file.
     // TODO: Might be good to test that there are not network sockets using
     // the port specified in this file.
     if (File.Exists(path) && CygwinSocket.TestFile(path))
     {
         File.Delete(path);
     }
     cygwinSocket = new CygwinSocket(path);
     cygwinSocket.ConnectionHandler = connectionHandler;
 }
Ejemplo n.º 4
0
 public void StopCygwinSocket()
 {
     if (disposed)
     throw new ObjectDisposedException("PagentAgent");
       if (cygwinSocket == null)
     return;
       cygwinSocket.Dispose();
       cygwinSocket = null;
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Starts a cygwin style socket that can be used by the ssh program
 /// that comes with cygwin.
 /// </summary>
 /// <param name="path">The path to the socket file that will be created.</param>
 public void StartCygwinSocket(string path)
 {
     if (disposed) {
     throw new ObjectDisposedException("PagentAgent");
       }
       if (cygwinSocket != null) {
     return;
       }
       // only overwrite a file if it looks like a CygwinSocket file.
       // TODO: Might be good to test that there are not network sockets using
       // the port specified in this file.
       if (File.Exists(path) && CygwinSocket.TestFile(path)) {
     File.Delete(path);
       }
       cygwinSocket = new CygwinSocket(path);
       cygwinSocket.ConnectionHandler = connectionHandler;
 }