public IntPtr Connect(string deviceId, ConnectionParams parameters)
 {
     if (!this.connections.ContainsKey(deviceId))
     {
         try
         {
             this.BreakConnection(deviceId, 10 * 60 * 1000);
             IntPtr handle = ZKApi.Connect(parameters.ToString());
             connections.Add(deviceId, handle);
             return(handle);
         }
         catch (Exception ex)
         {
             return(IntPtr.Zero);
         }
     }
     return(connections[deviceId]);
 }
 public bool Disconnect(string deviceId)
 {
     if (this.connections.ContainsKey(deviceId))
     {
         IntPtr handle = this.connections[deviceId];
         this.connections.Remove(deviceId);
         try
         {
             ZKApi.Disconnect(handle);
             return(true);
         }
         catch (Exception ex)
         {
             return(false);
         }
     }
     else
     {
         return(true);
     }
 }