コード例 #1
0
        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);
        }
コード例 #2
0
ファイル: UcAdsl.cs プロジェクト: lucio-c/TaskSemaphoreSlim
 public UcAdsl(ADSLItem adsl, LogManagerBase logManager)
 {
     InitializeComponent();
     this.Load      += UcAdsl_Load;
     this.adslItem   = adsl;
     this.LogManager = logManager;
 }
コード例 #3
0
 public UcVpnList(VPNFile vpn, LogManagerBase logManager)
 {
     InitializeComponent();
     this.Load      += new EventHandler(UcVpnList_Load);
     this.vpnFile    = vpn;
     this.LogManager = logManager;
 }
コード例 #4
0
        /// <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();
        }
コード例 #5
0
        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;
        }
コード例 #6
0
 public UcVpnItem(VPNItem item, LogManagerBase logManager)
 {
     InitializeComponent();
     this.vpnItem    = item;
     this.LogManager = logManager;
     this.Load      += UcVpnItem_Load;
 }
コード例 #7
0
 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;
 }
コード例 #8
0
        /// <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);
        }
コード例 #9
0
        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;
        }
コード例 #10
0
        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;
        }
コード例 #11
0
        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;
        }
コード例 #12
0
 public GameHttperBase(DetectionParamsItem paramsItem, LogManagerBase logManager)
     : base(logManager)
 {
     this.DetectionParamsItem = paramsItem;
 }
コード例 #13
0
 public RouterBase(LogManagerBase logManager)
     : base(logManager)
 {
 }
コード例 #14
0
 public HttpHelperBase(LogManagerBase logManager)
 {
     this.LogManager = logManager;
 }
コード例 #15
0
 public VPNManager(LogManagerBase logManager)
 {
     this.LogManager = logManager;
 }
コード例 #16
0
 public TL_R402Router(LogManagerBase logManager)
     : base(logManager)
 {
 }
コード例 #17
0
 public HttpProcessorBase(HttperManagerBase <T, P> hm, LogManagerBase logManager)
 {
     this.httperManager = hm;
     this.isRunning     = true;
     this.LogManager    = logManager;
 }
コード例 #18
0
 public ADSLManager(LogManagerBase logManager)
 {
     this.LogManager = logManager;
 }
コード例 #19
0
 public CaptchaHelper(LogManagerBase logManager)
     : base(logManager)
 {
 }
コード例 #20
0
 public RouterManager(LogManagerBase logManager)
 {
     this.LogManager = logManager;
     routerDic.Add(RouterType.TL_R402, new TL_R402Router(this.LogManager));
 }
コード例 #21
0
 public HttperManagerBase(LogManagerBase logManager)
 {
     this.LogManager = logManager;
     MultiGameNetManager.Register(this);
 }
コード例 #22
0
 public FileExportBase(string filePath, bool isAppended, LogManagerBase logManager)
 {
     this.rawFilePath = filePath;
     this.IsAppended  = isAppended;
     this.LogManager  = logManager;
 }
コード例 #23
0
        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);
        }
コード例 #24
0
ファイル: UcRouter.cs プロジェクト: lucio-c/TaskSemaphoreSlim
 public UcRouter(RouterItem router, LogManagerBase logManager)
 {
     InitializeComponent();
     this.Load      += UcRouter_Load;
     this.LogManager = logManager;
 }
コード例 #25
0
        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);
        }