public static int GetEmailIndex(string[] values, LogManagerBase logManager) { if (values.Length == 0) { logManager.Error(string.Format("GetEmailIndex():the raw data is incorrect ,this is a empty line")); return(-1); } for (int i = values.Length - 1; i >= 0; i--) { if (TextHelper.IsMail(values[i])) { return(i); } } string valueStr = string.Empty; foreach (string item in values) { valueStr += item; } logManager.Error(string.Format("GetEmailIndex({0}):不是用效的邮箱格式,请检查数据格式是否正确", valueStr)); return(-1); }
public UcAdsl(ADSLItem adsl, LogManagerBase logManager) { InitializeComponent(); this.Load += UcAdsl_Load; this.adslItem = adsl; this.LogManager = logManager; }
public UcVpnList(VPNFile vpn, LogManagerBase logManager) { InitializeComponent(); this.Load += new EventHandler(UcVpnList_Load); this.vpnFile = vpn; this.LogManager = logManager; }
/// <summary> /// Run command list in cmd.exe /// </summary> /// <param name="cmdList">commands</param> public static void RunCmd(IList <string> cmdList, LogManagerBase logManager) { Process p = new Process(); p.StartInfo.FileName = @"cmd.exe"; p.StartInfo.UseShellExecute = false; p.StartInfo.RedirectStandardInput = true; p.StartInfo.RedirectStandardOutput = true; p.StartInfo.RedirectStandardError = true; p.StartInfo.CreateNoWindow = true; p.Start(); foreach (string cmd in cmdList) { p.StandardInput.WriteLine(cmd); //string content = p.StandardOutput.ReadToEnd(); //string errmsg = p.StandardError.ReadToEnd(); } p.StandardInput.WriteLine("exit"); string content = p.StandardOutput.ReadToEnd(); string errmsg = p.StandardError.ReadToEnd(); logManager.Info(string.Format("重拔ADSL结果:{0}", content)); p.WaitForExit(); p.Close(); }
public ProxySpeedTester(GameServer server, LogManagerBase logManager, IList <ProxyItem> proxyList, string proxyFile) { if (null == server) { throw new ArgumentNullException("server"); } if (null == logManager) { throw new ArgumentNullException("logManager"); } if (null == proxyList) { throw new ArgumentNullException("proxyList"); } if (string.IsNullOrEmpty(proxyFile)) { throw new ArgumentNullException("proxyFile"); } this.Server = server; this.LogManager = logManager; this.ProxyList = proxyList; this.ProxyFile = proxyFile; }
public UcVpnItem(VPNItem item, LogManagerBase logManager) { InitializeComponent(); this.vpnItem = item; this.LogManager = logManager; this.Load += UcVpnItem_Load; }
public void ResetLogManager(LogManagerBase logManager) { if (this.LogManager == logManager) { return; } this.LogManager = logManager; this.routerManager.LogManager = logManager; this.adslManager.LogManager = logManager; this.VPNManager.LogManager = logManager; }
/// <summary> /// Index from last /// </summary> /// <param name="rawContent"></param> /// <param name="subString"></param> /// <returns></returns> public static string GetUser(string rawContent, string subString, LogManagerBase logManager) { int index = rawContent.LastIndexOf(subString); if (index >= 0) { return(rawContent.Substring(0, index)); } logManager.Error(string.Format("GetUser({0}): password index must bigger than 0", rawContent)); return(string.Empty); }
private ReconnectManager(LogManagerBase logManager) { this.routerManager = new RouterManager(logManager); reconnectFactories.Add(ReconnectType.Router, this.routerManager); this.adslManager = new ADSLManager(logManager); reconnectFactories.Add(ReconnectType.ADSL, this.adslManager); this.VPNManager = new VPNManager(logManager); reconnectFactories.Add(ReconnectType.VPN, this.VPNManager); //NetworkChange.NetworkAddressChanged += NetworkChange_NetworkAddressChanged; //NetworkChange.NetworkAvailabilityChanged += NetworkChange_NetworkAvailabilityChanged; //SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged; }
public AdslDialer(ADSLItem adslItem, LogManagerBase logManager) { this.LogManager = logManager; if (null == adslItem) { LogManager.Error("ADSL dialer parameters can't be null!"); } this.ADSLItem = adslItem; this.Timeout = 5 * 60 * 1000; this.rasDialer.StateChanged += RasDialer_StateChanged; this.rasDialer.DialCompleted += RasDialer_DialCompleted; }
public VPNDialer(VPNItem vpnItem, ManualResetEvent manualReset, LogManagerBase logManager) { this.LogManager = logManager; if ((null == vpnItem) || (null == manualReset)) { LogManager.Error("Vpn dialer parameters can't be null!"); } this.VPNItem = vpnItem; this.vpnManualReset = manualReset; this.Timeout = 5 * 60 * 1000; this.rasDialer.StateChanged += rasDialer_StateChanged; this.rasDialer.DialCompleted += rasDialer_DialCompleted; }
public GameHttperBase(DetectionParamsItem paramsItem, LogManagerBase logManager) : base(logManager) { this.DetectionParamsItem = paramsItem; }
public RouterBase(LogManagerBase logManager) : base(logManager) { }
public HttpHelperBase(LogManagerBase logManager) { this.LogManager = logManager; }
public VPNManager(LogManagerBase logManager) { this.LogManager = logManager; }
public TL_R402Router(LogManagerBase logManager) : base(logManager) { }
public HttpProcessorBase(HttperManagerBase <T, P> hm, LogManagerBase logManager) { this.httperManager = hm; this.isRunning = true; this.LogManager = logManager; }
public ADSLManager(LogManagerBase logManager) { this.LogManager = logManager; }
public CaptchaHelper(LogManagerBase logManager) : base(logManager) { }
public RouterManager(LogManagerBase logManager) { this.LogManager = logManager; routerDic.Add(RouterType.TL_R402, new TL_R402Router(this.LogManager)); }
public HttperManagerBase(LogManagerBase logManager) { this.LogManager = logManager; MultiGameNetManager.Register(this); }
public FileExportBase(string filePath, bool isAppended, LogManagerBase logManager) { this.rawFilePath = filePath; this.IsAppended = isAppended; this.LogManager = logManager; }
public static bool GetLoginAccountItem(string rawString, ref string account, ref string pwd, ref string email, DataFormat dataFormat, LogManagerBase logManager) { if (string.IsNullOrEmpty(rawString)) { return(false); } account = string.Empty; pwd = string.Empty; email = string.Empty; string[] values = rawString.Split(TextToItemHelper.SplitChars, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < values.Length; i++) { values[i] = values[i].Trim(); } if (values.Length == 2) { if (dataFormat == DataFormat.MailPassword) { email = values[0]; account = email; pwd = values[1]; return(true); } else if (dataFormat == DataFormat.AccountPassword) { account = values[0]; email = account; pwd = values[1]; return(true); } } else if (values.Length >= 3) { // user name may contains space int emailIndex = GetEmailIndex(values, logManager); if (emailIndex < 0) { logManager.Error(string.Format("GetAccountInfo({0}): Email address can't be the first item", rawString)); } //Trace.Assert(emailIndex >= 0, "GetAccountInfo(): Email address can't be the first item"); if (emailIndex >= 0) { if (dataFormat == DataFormat.AccountMailPassword) { email = values[emailIndex]; account = GetUser(rawString, email, logManager); if (emailIndex + 1 != (values.Length - 1)) { logManager.Error("GetAccountInfo(): Email address can't be the last item. it's miss password item"); } //Trace.Assert(emailIndex + 1 == (values.Length - 1), "GetAccountInfo(): Email address can't be the last item. it's miss password item"); pwd = values[emailIndex + 1]; return(true); } if (dataFormat == DataFormat.AccountPasswordMail) { email = values[emailIndex]; if (emailIndex - 1 < 0) { logManager.Error(string.Format("GetAccountInfo({0}): Email address can't be the first item. it's miss password item", rawString)); } //Trace.Assert(emailIndex - 1 >= 0, "GetAccountInfo(): Email address can't be the first item. it's miss password item"); pwd = values[emailIndex - 1]; account = GetUser(rawString, pwd, logManager); return(true); } } } return(false); }
public UcRouter(RouterItem router, LogManagerBase logManager) { InitializeComponent(); this.Load += UcRouter_Load; this.LogManager = logManager; }
public static PwdResetItem GetPwdResetItem(string rawString, DataFormat dataFormat, LogManagerBase logManager) { if (string.IsNullOrEmpty(rawString)) { return(null); } string[] values = rawString.Split(TextToItemHelper.AccountSplitChars, StringSplitOptions.RemoveEmptyEntries); if (values.Length >= 3) { // user name may contains space int emailIndex = GetEmailIndex(values, logManager); if (emailIndex != 0) { logManager.Error(string.Format("GetAccountInfo({0}): Email address can't be the first item", rawString)); return(null); } else { PwdResetItem item = new PwdResetItem(); item.EMail = values[0]; if (dataFormat == DataFormat.MailFstNSecN) { item.FirstName = values[1]; item.SecondName = values[2]; } else if (dataFormat == DataFormat.MailSecNFstN) { item.SecondName = values[1]; item.FirstName = values[2]; } return(item); } } return(null); }