/// <summary> /// If auth was succesfull do save /// LocalAccount /// </summary> private void SaveDataOnAuthSuccess() { try { CLocalAccount localAccount = new CLocalAccount { ConnectionNum = _lastUserConReq.ConnNum, LoginHash = _encryptor.GetEncrypted(_lastUserConReq.AuthRequest.User), PwdHash = _encryptor.GetEncrypted(_lastUserConReq.AuthRequest.Password) }; //2017-11-30 /* //found * if (_listLocalAccounts.FirstOrDefault(a => a.ConnectionNum == _lastUserConReq.ConnNum) != null) * { * //_listLocalAccounts.Add(localAccount); * a = localAccount; * * } * //not found * else * { * _listLocalAccounts.Add(localAccount); * } */ bool bFound = false; for (int i = 0; i < _listLocalAccounts.Count; i++) { if (_listLocalAccounts[i].ConnectionNum == localAccount.ConnectionNum) { _listLocalAccounts[i] = localAccount; bFound = true; // return; break; } } if (!bFound) { _listLocalAccounts.Add(localAccount); } WriteToFile(); } catch (Exception e) { _alarmer.Error("SavePassword", e); } }
private static void Error(string msg, Exception e = null) { if (_alarmer != null) { _alarmer.Error(msg, e); } }
public List <CRemoteFileStruct> GetDirectoriesListDetail(string dirOnSite = "") { var list = new List <CRemoteFileStruct>(); var request = CreateRequest(WebRequestMethods.Ftp.ListDirectoryDetails, String.Format(@"{0}/{1}", _uri, dirOnSite)); try { var response = request.GetResponse(); var stream = response.GetResponseStream(); var reader = new StreamReader(stream, true); while (!reader.EndOfStream) { string st = reader.ReadLine(); list.Add(CRemoteFileParser.GetFileStruct(st)); } } catch (Exception e) { _alarmer.Error("CFTPCOnnector.GetDirectoriesListDetail", e); } return(list); }
public void Error(string msg, Exception e = null) { Log("Error ! " + msg); string msgAlarm = String.Format(@"=={0}== {1}", _name, msg); if (_alarmer != null) { _alarmer.Error(msgAlarm, e); } }
/*public void CheckLim(double val, double maxVal, string msg) * { * * * }*/ public void CheckLim(long val, long maxVal, string msg) { if (IsWorkingMode()) { if (val > maxVal) { if (_alarmer != null) { _alarmer.Error(msg + " val =" + val.ToString() + " maxVal=" + maxVal.ToString() + " "); } } } }
public void CheckLimit(int countLim, bool bOutAlarm = true, int secRepeatAlarm = 20, IAlarmable alarmer = null, string queueName = "Unknown") { if (this.Count > countLim) { if ((DateTime.Now - _lastAlarm).TotalSeconds > secRepeatAlarm && bOutAlarm) { if (alarmer != null) { alarmer.Error(queueName + " quee more than max =" + this.Count); } _lastAlarm = DateTime.Now; } } }
public void Error(string msg, Exception e = null) { _alarmer.Error(msg, e); string msgLog = String.Format("Error ! {0}", msg); if (e != null) { msgLog += String.Format(" Message={0} StackTrace={1}", e.Message, e.StackTrace); } Log(msg); }
public void Error(string msg, Exception e = null) { _alarmer.Error(msg, e); Log(String.Format("ERROR ! {0} Message={1} StackTrace={2} ", msg, e.Message, e.StackTrace)); }
public void Error(string msg, Exception e = null) { _alarmer.Error(msg, e); }
public void Error(string err, Exception e) { _client.Error(err, e); }