public void Connect(string host, int port, string user, string password, string serverDirectory) { try { if (host.Trim() == "") { UtilException ex = new UtilException("Host is empty.", Exception_ExceptionSeverity.High); throw ex; } ftp.ServerAddress = host.Trim(); ftp.ServerPort = port; ftp.UserName = user.Trim(); ftp.Password = password; ftp.ServerDirectory = serverDirectory; ftp.Connect(); } catch (Exception ex) { if (ftp.IsConnected) { ftp.Close(); } throw ex; } finally { } }
private static string subParseUtilException(UtilException _ex, string _additionalMessageFront, string _additionalMessageBack) { string sReturn = string.Empty; switch (_ex.Code) { case 2291: //Oracle Exception: FK violation sReturn = _ex.Message;// + "[" + AddLinkToTrace(_ex.TraceFileName) + "]"; break; case 1: //Oracle Exception: Unique violation sReturn = _ex.Message ;//+ "[" + AddLinkToTrace(_ex.TraceFileName) + "]"; break; case 1400://Oracle Exception: Cannot insert null sReturn = _ex.Message ;//+ "[" + AddLinkToTrace(_ex.TraceFileName) + "]"; break; default: sReturn = _ex.Message; break; } if (!_additionalMessageFront.Equals(string.Empty)) sReturn = _additionalMessageFront + "[" + sReturn + "]"; if (!_additionalMessageBack.Equals(string.Empty)) sReturn = sReturn + "[" + _additionalMessageFront + "]"; return sReturn.ToString(); }