Exemplo n.º 1
0
        static void Main(string[] args)
        {
            kernel     = new StandardKernel(new DIContainer());
            jsonHandle = kernel.Get <JsonHandle>();

            ProducerTimer = Int32.Parse(jsonHandle.JsonKey("ProducerTimer"));
            ConsumerTimer = Int32.Parse(jsonHandle.JsonKey("ConsumerTimer"));
            identificador = jsonHandle.JsonKey("Identificador");

            appMessage = kernel.Get <AppMessageService>();

            thread = new Thread[] { new Thread(new ThreadStart(ThreadProducer))
                                    {
                                        Priority = ThreadPriority.Highest
                                    }, new Thread(new ThreadStart(ThreadConsumer))
                                    {
                                        Priority = ThreadPriority.Lowest
                                    } };

            thread[0].Start();

            thread[1].Start();

            key = new ConsoleKeyInfo();
            key = Console.ReadKey();



            //Console.WriteLine("Hello World!");
        }
Exemplo n.º 2
0
 public AppMessageService()
 {
     kernel     = new StandardKernel(new DIContainer());
     jsonHandle = kernel.Get <JsonHandle>();
     mapper     = kernel.Get <IMapper>();
     logger     = kernel.Get <ILogger>();
 }
Exemplo n.º 3
0
 public ActionResult loadTreeMenuDetail(Guid menuId)
 {
     return(JsonHandle.GetResult(_db.Queryable <SysBest_MenuAddress>()
                                 .Where(it => it.MenuId == menuId)
                                 .Where("IsDeleted = @IsDeleted",
                                        new { IsDeleted = 0 }).ToList()));
 }
Exemplo n.º 4
0
 public void SetUp()
 {
     kernel        = new StandardKernel(new DIContainer());
     jsonHandle    = kernel.Get <JsonHandle>();
     identificador = jsonHandle.JsonKey("Identificador");
     //appMessage = kernel.Get<AppMessageService>();
 }
        private void 导入数据ToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            if (ofd.ShowDialog() == DialogResult.OK)
            {
                if (ofd.FileName != "")
                {
                    StreamReader  sr = new StreamReader(ofd.FileName);
                    StringBuilder sb = new StringBuilder("");
                    while (true)
                    {
                        string line = sr.ReadLine();
                        if (line == null)
                        {
                            break;
                        }
                        if (line.Equals(""))
                        {
                            continue;
                        }
                        try
                        {
                            ExpModule exp = (ExpModule)JsonHandle.toBean <ExpModule>(line);
                            modifyExpInfo(exp, -1);
                        }
                        catch { }
                    }
                    sr.Close();
                }
            }
        }
Exemplo n.º 6
0
        private void userLogout(ref string strResult)
        {
            base.checkLoginByHandler(0);
            this.Session.Abandon();
            ReturnResult result = new ReturnResult();

            result.set_success(200);
            strResult = JsonHandle.ObjectToJson(result);
        }
Exemplo n.º 7
0
        protected bool IsUserLoginByMobileForAjax()
        {
            string         str;
            cz_stat_online _online;

            if (HttpContext.Current.Session["user_name"] == null)
            {
                this.Session.Abandon();
                return(false);
            }
            if (FileCacheHelper.get_RedisStatOnline().Equals(1))
            {
                if (PageBase.IsNeedPopBrower(HttpContext.Current.Session["user_name"].ToString()))
                {
                    this.Session.Abandon();
                    return(false);
                }
                str = HttpContext.Current.Session["user_name"].ToString();
                if (CallBLL.redisHelper.HashExists("useronline:list", str))
                {
                    _online = CallBLL.redisHelper.HashGet <cz_stat_online>("useronline:list", str);
                    if ((_online != null) && _online.get_is_out().Equals(1))
                    {
                        this.Session.Abandon();
                        return(false);
                    }
                }
            }
            else if (FileCacheHelper.get_RedisStatOnline().Equals(2))
            {
                if (PageBase.IsNeedPopBrower(HttpContext.Current.Session["user_name"].ToString()))
                {
                    this.Session.Abandon();
                    return(false);
                }
                str = HttpContext.Current.Session["user_name"].ToString();
                using (RedisClient client = new RedisClient(RedisConnectSplit.get_RedisIP(), RedisConnectSplit.get_RedisPort(), RedisConnectSplit.get_RedisPassword(), (long)FileCacheHelper.get_GetRedisDBIndex()))
                {
                    client.set_ConnectTimeout(int.Parse(RedisConnectSplit.get_RedisConnectTimeout()));
                    if (client.HashContainsEntry("useronline:list", str))
                    {
                        _online = JsonHandle.JsonToObject <cz_stat_online>(client.GetValueFromHash("useronline:list", str)) as cz_stat_online;
                        if ((_online != null) && _online.get_is_out().Equals(1))
                        {
                            this.Session.Abandon();
                            return(false);
                        }
                    }
                }
            }
            else if (base.IsUserOut(HttpContext.Current.Session["user_name"].ToString()) || PageBase.IsNeedPopBrower(HttpContext.Current.Session["user_name"].ToString()))
            {
                this.Session.Abandon();
                return(false);
            }
            return(true);
        }
Exemplo n.º 8
0
        private void exhausitiverThread(Object obj)
        {
            Dictionary <String, String> currentParam = dicHandle.nextParam();

            while (currentParam != null && currentParam.Count > 0 && running && dicHandle.totalNums >= currentPersion)
            {
                try
                {
                    Int32  length           = commConfig.General.Body.Length;
                    string postBody         = commConfig.General.Body;
                    string currentParamJson = JsonHandle.toJson(currentParam);
                    foreach (string paraName in currentParam.Keys)
                    {
                        postBody = postBody.Replace("${" + paraName + "}", currentParam[paraName]);
                    }
                    ExhausitiverEntity threadExhausitiverEntity = ExhausitiverEntity.parseExhausitiver(commConfig.General.Protocol, commConfig.General.Encode, commConfig.General.TimeOut, postBody);
                    ExhaustiverResult  result = ExhausitiverHandle.doExhausitiver(threadExhausitiverEntity, commConfig.Verification);
                    result.Param = currentParam;
                    if (result.Success == true)
                    {
                        if (SuccessStopCheckBox.Checked)
                        {
                            running = false;
                        }
                        ExhaustiverResultTextBox.AppendText(currentParamJson + "\r\n");
                    }
                    ListViewItem lvi = new ListViewItem();
                    lvi.Text = "0";
                    lvi.SubItems.Add(currentParamJson);
                    lvi.SubItems.Add(Convert.ToString(result.Code));
                    lvi.SubItems.Add(Convert.ToString(result.Length));
                    lvi.SubItems.Add(result.Success ? "成功" : "失败");
                    lvi.SubItems.Add(threadExhausitiverEntity.Body + "\n\n" + result.Result);
                    if (result.Success)
                    {
                        lvi.ForeColor = Color.Green;
                    }
                    paramPersion = lvi;
                    lviQueues.Enqueue(lvi);
                    if (result.Success)
                    {
                        if (SuccessStopCheckBox.Checked)
                        {
                            break;
                        }
                    }
                }
                catch { }
                finally
                {
                    speed++;
                    currentPersion++;
                    currentParam = dicHandle.nextParam();
                }
                Thread.Sleep(1);
            }
        }
Exemplo n.º 9
0
        public void initLvi()
        {
            if (lvi == null)
            {
                for (int i = 0; i < parentMain.HeaderListview.Items.Count; i++)
                {
                    addOrModifyHeader(parentMain.HeaderListview.Items[i].SubItems[0].Text, parentMain.HeaderListview.Items[i].SubItems[1].Text, -1);
                }
                return;
            }
            String expName  = lvi.SubItems[1].Text;
            String language = lvi.SubItems[2].Text;
            String status   = lvi.SubItems[5].Text;

            ExpNameTextBox.Text    = expName;
            LanguafeComboBox.Text  = language;
            ExpStatusComboBox.Text = status;
            //解析Header
            String    json = lvi.SubItems[3].Text;
            ExpModule exp  = (ExpModule)JsonHandle.toBean <ExpModule>(json);

            if (exp == null)
            {
                return;
            }
            if (exp.ExpContext != null)
            {
                //解析Header
                if (exp.ExpContext.Header != null)
                {
                    foreach (String key in exp.ExpContext.Header.Keys)
                    {
                        ListViewItem lvitmp = new ListViewItem();
                        lvitmp.SubItems[0].Text = key;
                        lvitmp.SubItems.Add(exp.ExpContext.Header[key]);
                        HeaderListview.Items.Add(lvitmp);
                    }
                }
                BodyTextBox.Text           = exp.ExpContext.Body;
                EncodeComBox.Text          = exp.ExpContext.Encode;
                FormatUrlComboBox.Text     = "否";
                RequestMethodComboBox.Text = exp.ExpContext.Method;
                if (exp.FormatUrl)
                {
                    FormatUrlComboBox.Text = "是";
                }
            }
            if (exp.Verification != null)
            {
                VerificationValueTextBox.Text = exp.Verification.Context;
                CalcComboBox.Text             = exp.Verification.Calc;
                VerificationComboBox.Text     = MainForm.verificationTypes[exp.Verification.Type];
            }
        }
 private void loadConfig()
 {
     try
     {
         StreamReader  sr = new StreamReader(System.Diagnostics.Process.GetCurrentProcess().ProcessName + ".conf", Encoding.Default);
         String        line;
         StringBuilder configContext = new StringBuilder();
         while ((line = sr.ReadLine()) != null)
         {
             configContext.AppendLine(line);
         }
         sr.Close();
         CoodyConfig config = (CoodyConfig)JsonHandle.toBean <CoodyConfig>(configContext.ToString());
         ThreadNumComboBox.Text = config.ThreadNum;
         TimeOutComboBox.Text   = config.TimeOut;
         if (config.ExpListViews != null)
         {
             foreach (String[] lines in config.ExpListViews)
             {
                 ListViewItem lvi = new ListViewItem();
                 lvi.SubItems[0].Text = Convert.ToString(ExpListView.Items.Count + 1);
                 lvi.SubItems.Add(lines[1]);
                 lvi.SubItems.Add(lines[2]);
                 lvi.SubItems.Add(lines[3]);
                 lvi.SubItems.Add(lines[4]);
                 lvi.SubItems.Add(lines[5]);
                 ExpListView.Items.Add(lvi);
             }
         }
         if (config.HeaderListviews != null)
         {
             foreach (String[] lines in config.HeaderListviews)
             {
                 addOrModifyHeader(lines[0], lines[1], -1);
             }
         }
     }
     catch { }
     finally
     {
         if (ExpListView.Items.Count == 0)
         {
             String   jsons = Properties.Resources.Struts2_exp;
             String[] lines = jsons.Split(Environment.NewLine.ToCharArray());
             foreach (String line in lines)
             {
                 ExpModule exp = (ExpModule)JsonHandle.toBean <ExpModule>(line);
                 modifyExpInfo(exp, -1);
             }
         }
     }
 }
Exemplo n.º 11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            base.Response.End();
            base.Response.End();
            ITransaction transaction = CallBLL.redisHelper.CreateTransaction();

            CallBLL.redisHelper.GetDatabase().CreateBatch(null).Execute();
            List <string> stringKeysByPattern      = CallBLL.redisHelper.GetStringKeysByPattern("*online*");
            Dictionary <string, string> dictionary = new Dictionary <string, string>();

            dictionary.Add("A1", "A11111");
            dictionary.Add("B1", "B11111");
            CallBLL.redisHelper.StringSet("DictTest:dict", JsonHandle.ObjectToJson(dictionary), FileCacheHelper.get_RedisExpiryDay());
            RedisDemoObject obj2 = new RedisDemoObject {
                Id   = 1,
                Name = "123"
            };

            CallBLL.redisHelper.StringSet <RedisDemoObject>("test1:RedisDemoObject", obj2, FileCacheHelper.get_RedisExpiryDay());
            RedisDemoObject obj3 = CallBLL.redisHelper.StringGet <RedisDemoObject>("test1:RedisDemoObject");
            string          str  = "select * from cz_stat_online";
            Dictionary <string, cz_stat_online> dictionary2 = new Dictionary <string, cz_stat_online>();
            DataTable table = DbHelperSQL.Query(str, null).Tables[0];

            foreach (DataRow row in table.Rows)
            {
                cz_stat_online _online = new cz_stat_online();
                _online.set_id(int.Parse(row["id"].ToString()));
                _online.set_u_name(row["u_name"].ToString());
                _online.set_u_type(row["u_type"].ToString());
                _online.set_u_flag(row["u_flag"].ToString());
                _online.set_first_time(new DateTime?(DateTime.Parse(row["first_time"].ToString())));
                _online.set_last_time(new DateTime?(DateTime.Parse(row["last_time"].ToString())));
                _online.set_ip(row["ip"].ToString());
                _online.set_is_out(new int?(int.Parse(row["is_out"].ToString())));
                CallBLL.redisHelper.HashSet <cz_stat_online>("useronline:list", _online.get_u_name(), _online);
            }
            long           num      = CallBLL.redisHelper.HashLength("useronline:list");
            cz_stat_online _online2 = CallBLL.redisHelper.HashGet <cz_stat_online>("useronline:list", "yt668833");
            cz_stat_online _online3 = new cz_stat_online();

            _online3.set_u_name("fgs_1111111111111111111111");
            if (CallBLL.redisHelper.HashExists("useronline:list", "fgs_1111111111111111111111"))
            {
                CallBLL.redisHelper.HashDelete("list", "useronlinefgs_1111111111111111111111");
            }
            _online3.set_u_flag("zj");
            CallBLL.redisHelper.HashSet <cz_stat_online>("useronline:list", _online3.get_u_name(), _online3);
            List <cz_stat_online> list2 = CallBLL.redisHelper.HashValues <cz_stat_online>("useronline:list");
            bool flag2 = transaction.Execute(0);
        }
        private ExpModule getExpByIndex(Int32 expIndex)
        {
            if (expDics.ContainsKey(expIndex))
            {
                return(expDics[expIndex]);
            }
            String    expJson = ExpListView.Items[expIndex].SubItems[3].Text;
            ExpModule exp     = (ExpModule)JsonHandle.toBean <ExpModule>(expJson);

            try { expDics.Add(expIndex, exp); }
            catch { }

            return(exp);
        }
Exemplo n.º 13
0
    protected void Page_Load(object sender, EventArgs e)
    {
        IDictionary <string, object> dictionary = new Dictionary <string, object>();

        if (!base.IsUserLoginByMobileForAjax())
        {
            dictionary.Add("status", "2");
            base.OutJson(JsonHandle.ObjectToJson(dictionary));
        }
        else
        {
            this.out_odds_info();
        }
    }
Exemplo n.º 14
0
 public static bool ChildOperateValid(agent_userinfo_session sessionInfo, string permissions_name, HttpContext context)
 {
     if ((sessionInfo.get_u_type().Trim().Equals("zj") && (context.Session["child_user_name"] != null)) && (sessionInfo.get_users_child_session().get_permissions_name().IndexOf(permissions_name) < 0))
     {
         ReturnResult result = new ReturnResult();
         result.set_success(400);
         result.set_tipinfo(PageBase.GetMessageByCache("u100013", "MessageHint"));
         string s = JsonHandle.ObjectToJson(result);
         HttpContext.Current.Response.ContentType = "text/json";
         HttpContext.Current.Response.Write(s);
         return(false);
     }
     return(true);
 }
Exemplo n.º 15
0
        public ActionResult loadTreeMenu()
        {
            var menuList = new List <TreeViewModel>();
            //查出SysBest_Menu表的所有数据按创建时间倒序
            var data = _db.SqlQuery <SysBest_Menu>("select * from SysBest_Menu order by Sort asc,CreateTime desc;").ToList();

            foreach (SysBest_Menu it in data)
            {
                var model = new TreeViewModel();
                model.id       = it.Id.TryToString().Replace("/", "_");
                model.parentid = it.ParentId.TryToString().Replace("/", "_");
                model.text     = $"{it.Id.TryToString()}\t{it.MenuName.TryToString()}";
                model.value    = it.TreeId;
                menuList.Add(model);
            }
            return(JsonHandle.GetResult(menuList));
        }
Exemplo n.º 16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string str = this.Session["user_name"].ToString();
            agent_userinfo_session model = this.Session[str + "lottery_session_user_info"] as agent_userinfo_session;

            this.skin = model.get_u_skin();
            if (!model.get_u_type().Equals("zj"))
            {
                base.Response.Redirect("/MessagePage.aspx?code=u100057&url=&issuccess=1&isback=0");
                base.Response.End();
            }
            base.Permission_Aspx_ZJ(model, "po_3_5");
            this.lotteryId = LSRequest.qq("lid");
            this.lotteryDT = base.GetLotteryList();
            base.IsLotteryExist(this.lotteryId, "u100032", "1", "");
            Dictionary <string, Dictionary <string, string> > dictionary = new Dictionary <string, Dictionary <string, string> >();

            DataRow[] rowArray  = this.lotteryDT.Select(string.Format(" master_id={0} ", 1));
            DataRow[] rowArray2 = this.lotteryDT.Select(string.Format(" master_id={0} ", 2));
            if ((rowArray != null) && (rowArray.Length > 0))
            {
                string str2 = "";
                Dictionary <string, string> dictionary2 = new Dictionary <string, string>();
                foreach (DataRow row in rowArray)
                {
                    dictionary2.Add(row["id"].ToString(), row["lottery_name"].ToString());
                    str2          = row["name"].ToString();
                    this.six_list = this.six_list + string.Format("<option value='{0}' {1}>{2}</option>", row["id"].ToString(), "selected=selected", row["lottery_name"].ToString());
                }
                dictionary.Add(1.ToString() + "," + str2, dictionary2);
            }
            if ((rowArray2 != null) && (rowArray2.Length > 0))
            {
                string str3 = "";
                Dictionary <string, string> dictionary3 = new Dictionary <string, string>();
                foreach (DataRow row2 in rowArray2)
                {
                    dictionary3.Add(row2["id"].ToString(), row2["lottery_name"].ToString());
                    str3         = row2["name"].ToString();
                    this.kc_list = this.kc_list + string.Format("<option value='{0}'>{1}</option>", row2["id"].ToString(), row2["lottery_name"].ToString());
                }
                dictionary.Add(2.ToString() + "," + str3, dictionary3);
            }
            this.jsonLottery = JsonHandle.ObjectToJson(dictionary);
        }
Exemplo n.º 17
0
        private void button2_Click(object sender, EventArgs e)
        {
            try
            {
                ExhausitiverConfig config = parseConfig();

                String json = JsonHandle.toJson(config);
                json = JsonHandle.JsonTree(json);
                String     fileName = System.Diagnostics.Process.GetCurrentProcess().ProcessName + ".conf";
                FileStream fs       = new FileStream(fileName, FileMode.Create);
                byte[]     data     = System.Text.Encoding.Default.GetBytes(json);
                fs.Write(data, 0, data.Length);
                fs.Flush();
                fs.Close();
                MessageBox.Show("保存成功(" + fileName + ")");
            }
            catch { }
        }
Exemplo n.º 18
0
    protected void Page_Load(object sender, EventArgs e)
    {
        IDictionary <string, object> dictionary = new Dictionary <string, object>();
        cz_phase_six currentPhaseClose          = CallBLL.cz_phase_six_bll.GetCurrentPhaseClose();

        if (currentPhaseClose != null)
        {
            string str  = (currentPhaseClose != null) ? currentPhaseClose.get_phase() : "";
            string str2 = (currentPhaseClose != null) ? string.Format("{0},{1},{2},{3},{4},{5},{6}", new object[] { currentPhaseClose.get_n1(), currentPhaseClose.get_n2(), currentPhaseClose.get_n3(), currentPhaseClose.get_n4(), currentPhaseClose.get_n5(), currentPhaseClose.get_n6(), currentPhaseClose.get_sn() }) : "";
            dictionary.Add("draw_phase", str);
            dictionary.Add("draw_result", str2.Split(new char[] { ',' }).ToArray <string>());
        }
        dictionary.Add("type", "get_drawinfo");
        dictionary.Add("status", "1");
        string strResult = JsonHandle.ObjectToJson(dictionary);

        base.OutJson(strResult);
    }
Exemplo n.º 19
0
 protected void Page_Load(object sender, EventArgs e)
 {
     IDictionary<string, object> dictionary = new Dictionary<string, object>();
     string str = "";
     DataTable kCOpenBall = base.GetKCOpenBall(0x15);
     string[] strArray = null;
     if ((kCOpenBall != null) && (kCOpenBall.Rows.Count > 0))
     {
         string str2 = kCOpenBall.Rows[0]["previousphase"].ToString().Trim();
         string str3 = kCOpenBall.Rows[0]["sold"].ToString().Trim();
         string str4 = kCOpenBall.Rows[0]["surplus"].ToString().Trim();
         str = kCOpenBall.Rows[0]["nns"].ToString().Trim();
         strArray = (str2 + "," + str).Split(new char[] { ',' }).ToArray<string>();
     }
     dictionary.Add("status", "1");
     dictionary.Add("kaijiang", strArray);
     string strResult = JsonHandle.ObjectToJson(dictionary);
     base.OutJson(strResult);
 }
Exemplo n.º 20
0
        private ExhausitiverConfig parseConfig()
        {
            ExhausitiverConfig config  = new ExhausitiverConfig();
            ExhausitiverEntity general = new ExhausitiverEntity();

            general.Protocol  = ConfigProtocolComboBox.Text;
            general.Host      = ConfigHostTextBox.Text.Trim();
            general.Method    = ConfigMethodComboBox.Text;
            general.Port      = Convert.ToInt32(ConfigPortTextBox.Text);
            general.TimeOut   = Convert.ToInt32(ConfigTimeOutCombox.Text.Replace("秒", "")) * 1000;
            general.Encode    = ConfigEncodeComboBox.Text;
            general.Data      = Encoding.GetEncoding(ConfigEncodeComboBox.Text.Equals("自动") ? "UTF-8" : ConfigEncodeComboBox.Text).GetBytes(ConfigBodyTextBox.Text);
            general.Body      = ConfigBodyTextBox.Text;
            general.ThreadNum = Convert.ToInt32(ConfigThreadNumComboBox.Text);
            config.General    = general;
            ExhaustiverVerification verification = new ExhaustiverVerification();

            verification.CalcType         = ConfigCalcComboBox.SelectedIndex;
            verification.VerificationType = ConfigVerificationTypeComboBox.SelectedIndex;
            verification.Value            = ConfigVerificationValueTextBox.Text;
            verification.SuccessThenStop  = (SuccessStopCheckBox.Checked)?true:false;
            config.Verification           = verification;
            List <ExhausitiverDic> dics = new List <ExhausitiverDic>();

            for (int i = 0; i < DicsListview.Items.Count; i++)
            {
                ExhausitiverDic dic = new ExhausitiverDic();
                dic.ParamName = DicsListview.Items[i].SubItems[0].Text;
                dic.Path      = DicsListview.Items[i].SubItems[1].Text;
                dics.Add(dic);
            }
            config.Dics = dics;
            String     json = JsonHandle.toJson(config);
            FileStream fs   = new FileStream(System.Diagnostics.Process.GetCurrentProcess().ProcessName + ".conf", FileMode.Create);

            byte[] data = System.Text.Encoding.Default.GetBytes(json);
            fs.Write(data, 0, data.Length);
            fs.Flush();
            fs.Close();
            return(config);
        }
 public void modifyExpInfo(ExpModule exp, Int32 index)
 {
     try
     {
         String configJson = JsonHandle.toJson(exp);
         if (index == -1)
         {
             ListViewItem lvi = new ListViewItem();
             lvi.SubItems[0].Text = Convert.ToString(ExpListView.Items.Count + 1);
             lvi.SubItems.Add(exp.Name);
             lvi.SubItems.Add(exp.Language);
             lvi.SubItems.Add(configJson);
             lvi.SubItems.Add(verificationTypes[exp.Verification.Type] + ":" + exp.Verification.Context);
             lvi.SubItems.Add(exp.Status == 0 ? "禁用" : "启用");
             for (int i = 0; i < ExpListView.Items.Count; i++)
             {
                 if (ExpListView.Items[i].SubItems[1].Text.Equals(exp.Name))
                 {
                     ExpListView.Items[i] = lvi;
                     ExpListView.Update();
                     return;
                 }
             }
             ExpListView.Items.Add(lvi);
             return;
         }
         ExpListView.Items[index].SubItems[0].Text = Convert.ToString(ExpListView.Items.Count + 1);
         ExpListView.Items[index].SubItems[1].Text = exp.Name;
         ExpListView.Items[index].SubItems[2].Text = exp.Language;
         ExpListView.Items[index].SubItems[3].Text = configJson;
         ExpListView.Items[index].SubItems[4].Text = (verificationTypes[exp.Verification.Type] + ":" + exp.Verification.Context);
         ExpListView.Items[index].SubItems[5].Text = (exp.Status == 0 ? "禁用" : "启用");
         return;
     }
     catch { }
     finally
     {
         resetListViewIndex(ExpListView);
         saveConfig();
     }
 }
Exemplo n.º 22
0
 private void loadConfig()
 {
     try
     {
         StreamReader  sr = new StreamReader(System.Diagnostics.Process.GetCurrentProcess().ProcessName + ".conf", Encoding.Default);
         String        line;
         StringBuilder configContext = new StringBuilder();
         while ((line = sr.ReadLine()) != null)
         {
             configContext.AppendLine(line);
         }
         sr.Close();
         List <KeywordCodeTrigger> triggers = (List <KeywordCodeTrigger>)JsonHandle.toBean <List <KeywordCodeTrigger> >(configContext.ToString());
         foreach (KeywordCodeTrigger keywordCodeTrigger in triggers)
         {
             try
             {
                 ListViewItem lvi = new ListViewItem();
                 lvi.SubItems[0].Text = Convert.ToString(ConfigListView.Items.Count + 1);
                 lvi.SubItems.Add(keywordCodeTrigger.keyword);
                 lvi.SubItems.Add(keywordCodeTrigger.code);
                 lvi.SubItems.Add(keywordCodeTrigger.nextPageCode);
                 ConfigListView.Items.Add(lvi);
             }
             catch { }
         }
     }
     catch { }
     finally
     {
         if (ConfigListView.Items.Count == 0)
         {
             ListViewItem lvi = new ListViewItem();
             lvi.SubItems[0].Text = Convert.ToString(ConfigListView.Items.Count + 1);
             lvi.SubItems.Add("https://www.google.com");
             lvi.SubItems.Add(GoogleSpider.Properties.Resources.GoogleCollScript);
             lvi.SubItems.Add(GoogleSpider.Properties.Resources.GoogleCollCallPageScript);
             ConfigListView.Items.Add(lvi);
         }
     }
 }
        private void checkExpForSign(object indexObj)
        {
            int       index   = (int)indexObj;
            String    url     = UrlTextBox.Text;
            String    expJson = ScannerExpListView.Items[index].SubItems[5].Text;
            ExpModule exp     = (ExpModule)JsonHandle.toBean <ExpModule>(expJson);

            ScannerExpListView.Items[index].SubItems[3].Text = "检测中";
            try
            {
                ExpVerificationResult result = ExpHandle.Verification(url, exp);
                ScannerExpListView.Items[index].SubItems[6].Text = result.Html;
                if (!String.IsNullOrEmpty(result.Html))
                {
                    ResultTextBox.Text = result.Html;
                }
                if (result.Code == 0)
                {
                    ScannerExpListView.Items[index].SubItems[4].Text = result.Result;
                    ScannerExpListView.Items[index].ForeColor        = Color.Red;

                    return;
                }
                if (result.Code == 1)
                {
                    ScannerExpListView.Items[index].SubItems[4].Text = result.Result;
                    ScannerExpListView.Items[index].ForeColor        = Color.Green;
                }
                if (result.Code == 2)
                {
                    ScannerExpListView.Items[index].SubItems[4].Text = "连接失败";
                    ScannerExpListView.Items[index].ForeColor        = Color.Red;
                }
            }
            catch { }
            finally
            {
                ScannerExpListView.Items[index].SubItems[3].Text = "检测完成";
            }
        }
Exemplo n.º 24
0
 private void loadConfig(String fileName)
 {
     try
     {
         if (String.IsNullOrEmpty(fileName))
         {
             fileName = System.Diagnostics.Process.GetCurrentProcess().ProcessName + ".conf";
         }
         StreamReader  sr = new StreamReader(fileName, Encoding.Default);
         String        line;
         StringBuilder configContext = new StringBuilder();
         while ((line = sr.ReadLine()) != null)
         {
             configContext.AppendLine(line);
         }
         sr.Close();
         ExhausitiverConfig config = (ExhausitiverConfig)JsonHandle.toBean <ExhausitiverConfig>(configContext.ToString());
         ConfigProtocolComboBox.Text = config.General.Protocol;
         ConfigHostTextBox.Text      = config.General.Host;
         ConfigMethodComboBox.Text   = config.General.Method;
         ConfigPortTextBox.Text      = Convert.ToString(config.General.Port);
         ConfigTimeOutCombox.Text    = (config.General.TimeOut * 1000) + "秒";
         ConfigEncodeComboBox.Text   = config.General.Encode;
         ConfigBodyTextBox.Text      = Encoding.GetEncoding(ConfigEncodeComboBox.Text.Equals("自动") ? "UTF-8" : ConfigEncodeComboBox.Text).GetString(config.General.Data);
         ConfigVerificationTypeComboBox.SelectedIndex = config.Verification.CalcType;
         ConfigCalcComboBox.SelectedIndex             = config.Verification.VerificationType;
         ConfigVerificationValueTextBox.Text          = config.Verification.Value;
         ConfigThreadNumComboBox.Text = Convert.ToString(config.General.ThreadNum);
         SuccessStopCheckBox.Checked  = config.Verification.SuccessThenStop;
         foreach (ExhausitiverDic dic in config.Dics)
         {
             ListViewItem lvi = new ListViewItem();
             lvi.SubItems[0].Text = dic.ParamName;
             lvi.SubItems.Add(dic.Path);
             DicsListview.Items.Add(lvi);
         }
     }
     catch { }
 }
Exemplo n.º 25
0
        private string UserStatus(string status)
        {
            ReturnResult result = new ReturnResult();
            string       str    = "";

            if (status != "0")
            {
                if (status == "1")
                {
                    result.set_success(400);
                    result.set_tipinfo(PageBase.GetMessageByCache("u100004", "MessageHint"));
                    str = JsonHandle.ObjectToJson(result);
                }
                if (status == "2")
                {
                    result.set_success(400);
                    result.set_tipinfo(PageBase.GetMessageByCache("u100005", "MessageHint"));
                    str = JsonHandle.ObjectToJson(result);
                }
            }
            return(str);
        }
Exemplo n.º 26
0
 private void saveConfig()
 {
     try
     {
         List <KeywordCodeTrigger> keys = new List <KeywordCodeTrigger>();
         for (int i = 0; i < ConfigListView.Items.Count; i++)
         {
             KeywordCodeTrigger key = new KeywordCodeTrigger();
             key.keyword      = ConfigListView.Items[i].SubItems[1].Text;
             key.code         = ConfigListView.Items[i].SubItems[2].Text;
             key.nextPageCode = ConfigListView.Items[i].SubItems[3].Text;
             keys.Add(key);
         }
         String     json = JsonHandle.toJson(keys);
         FileStream fs   = new FileStream(System.Diagnostics.Process.GetCurrentProcess().ProcessName + ".conf", FileMode.Create);
         byte[]     data = System.Text.Encoding.Default.GetBytes(json);
         fs.Write(data, 0, data.Length);
         fs.Flush();
         fs.Close();
     }
     catch { }
 }
        private void saveConfig()
        {
            CoodyConfig config = new CoodyConfig();

            config.ThreadNum = ThreadNumComboBox.Text;
            config.TimeOut   = TimeOutComboBox.Text;
            List <String[]> headerListviews = new List <string[]>();

            for (int i = 0; i < HeaderListview.Items.Count; i++)
            {
                String[] lines = new String[2];
                lines[0] = HeaderListview.Items[i].SubItems[0].Text;
                lines[1] = HeaderListview.Items[i].SubItems[1].Text;
                headerListviews.Add(lines);
            }
            config.HeaderListviews = headerListviews;
            List <String[]> expListViews = new List <string[]>();

            for (int i = 0; i < ExpListView.Items.Count; i++)
            {
                String[] lines = new String[6];
                lines[0] = ExpListView.Items[i].SubItems[0].Text;
                lines[1] = ExpListView.Items[i].SubItems[1].Text;
                lines[2] = ExpListView.Items[i].SubItems[2].Text;
                lines[3] = ExpListView.Items[i].SubItems[3].Text;
                lines[4] = ExpListView.Items[i].SubItems[4].Text;
                lines[5] = ExpListView.Items[i].SubItems[5].Text;
                expListViews.Add(lines);
            }
            config.ExpListViews = expListViews;
            String     json = JsonHandle.toJson(config);
            FileStream fs   = new FileStream(System.Diagnostics.Process.GetCurrentProcess().ProcessName + ".conf", FileMode.Create);

            byte[] data = System.Text.Encoding.Default.GetBytes(json);
            fs.Write(data, 0, data.Length);
            fs.Flush();
            fs.Close();
        }
Exemplo n.º 28
0
        /// <summary>
        /// Initialize the corresponding file processing object.
        /// </summary>
        /// <typeparam name="TEntity">file entity</typeparam>
        /// <param name="handleEnum">handle enum</param>
        /// <returns>handle</returns>
        private IHandle <TEntity> InitHandle <TEntity>(HandleEnum handleEnum) where TEntity : class
        {
            IHandle <TEntity> handle = null;

            switch (handleEnum)
            {
            case HandleEnum.DB:
                handle = new DBHandle <TEntity>();
                break;

            case HandleEnum.INI:
                handle = new IniHandle <TEntity>();
                break;

            case HandleEnum.JSON:
                handle = new JsonHandle <TEntity>();
                break;

            case HandleEnum.XML:
                handle = new XmlHandle <TEntity>();
                break;
            }
            return(handle);
        }
Exemplo n.º 29
0
    private void out_odds_info()
    {
        string str = LSRequest.qq("GT");

        if (string.IsNullOrEmpty(str))
        {
            base.Response.End();
        }
        else
        {
            string str2 = this.Session["user_name"].ToString();
            cz_userinfo_session getUserModelInfo = base.GetUserModelInfo;
            string    str3  = getUserModelInfo.get_su_type().ToString();
            string    str4  = getUserModelInfo.get_u_name().ToString();
            string    str5  = getUserModelInfo.get_kc_kind().Trim();
            DataTable table = CallBLL.cz_users_bll.GetCredit(str2, str3).Tables[0];
            if (table == null)
            {
                base.Response.End();
            }
            else
            {
                double num = double.Parse(table.Rows[0]["kc_usable_credit"].ToString());
                Dictionary <string, object> dictionary = new Dictionary <string, object>();
                dictionary.Add("type", "get_oddsinfo");
                DataSet set = CallBLL.cz_play_car168_bll.GetPlay(str, str4, str3);
                if (set == null)
                {
                    base.Response.End();
                }
                else
                {
                    this.phaseDT = set.Tables["phase"];
                    DataTable table2 = set.Tables["odds"];
                    if ((this.phaseDT == null) || (table2 == null))
                    {
                        base.Response.End();
                    }
                    else if (!this.isOpenLottery())
                    {
                        dictionary.Add("status", "3");
                        base.OutJson(JsonHandle.ObjectToJson(dictionary));
                    }
                    else
                    {
                        DataRow row   = this.phaseDT.Rows[0];
                        string  str6  = row["openning"].ToString();
                        string  str7  = row["isopen"].ToString();
                        string  str8  = row["opendate"].ToString();
                        string  str9  = row["endtime"].ToString();
                        string  str10 = row["nn"].ToString();
                        string  str11 = row["p_id"].ToString();
                        double  num2  = double.Parse(base.GetKCProfit());
                        dictionary.Add("status", "1");
                        dictionary.Add("open", str6);
                        dictionary.Add("k_open_time", str8);
                        dictionary.Add("k_stop_time", str9);
                        dictionary.Add("qishu", str10);
                        dictionary.Add("credit", num.ToString("F1"));
                        dictionary.Add("amount", num2.ToString("F1"));
                        dictionary.Add("k_id", str11);
                        Dictionary <string, object> dictionary2 = new Dictionary <string, object>();
                        Dictionary <string, object> dictionary3 = new Dictionary <string, object>();
                        string        str12 = "";
                        string        pl    = "";
                        List <double> list  = new List <double>();
                        foreach (DataRow row2 in table2.Rows)
                        {
                            str12 = row2["play_id"].ToString() + "_" + row2["odds_id"].ToString();
                            string s = row2["current_odds"].ToString();
                            if (str6 == "n")
                            {
                                s = "-";
                            }
                            string str18 = row2[str5 + "_diff"].ToString().Trim();
                            if (s != "-")
                            {
                                pl = (double.Parse(s) + double.Parse(str18)).ToString();
                            }
                            else
                            {
                                pl = s;
                            }
                            if (s != "-")
                            {
                                base.GetOdds_KC(0x10, row2["odds_id"].ToString(), ref pl);
                            }
                            this.oddsList.Add(str12 + "," + pl);
                        }
                        string str19 = string.Join("|", this.oddsList.ToArray());
                        if (this.oddsList.Count <string>() > 0)
                        {
                            dictionary.Add("play_odds", str19);
                        }
                        base.OutJson(JsonHandle.ObjectToJson(dictionary));
                    }
                }
            }
        }
    }
Exemplo n.º 30
0
    protected void output_cl_cql_lryl()
    {
        IDictionary <string, object> dictionary = new Dictionary <string, object>();

        if (!base.IsUserLoginByMobileForAjax())
        {
            dictionary.Add("status", "2");
            base.OutJson(JsonHandle.ObjectToJson(dictionary));
        }
        else
        {
            string        str   = "_m_xyftoa_lmcl";
            string        str2  = "_m_xyftoa_cql";
            List <object> cache = new List <object>();
            if (CacheHelper.GetCache("balance_kc_FileCacheKey" + str) != null)
            {
                cache = CacheHelper.GetCache("balance_kc_FileCacheKey" + str) as List <object>;
            }
            else
            {
                DataTable table = CallBLL.cz_phase_xyftoa_bll.GetChangLong().Tables[0];
                if (table.Rows.Count > 0)
                {
                    foreach (DataRow row in table.Rows)
                    {
                        cache.Add(row["c_name"].ToString() + "," + row["c_qs"].ToString());
                    }
                }
                CacheHelper.SetCache("balance_kc_FileCacheKey" + str, cache);
                CacheHelper.SetPublicFileCache("balance_kc_FileCacheKey" + str, cache, PageBase.GetPublicForderPath(base.get_KC_BalanceFileName()));
            }
            string str5 = string.Join("|", cache.ToArray());
            dictionary.Add("long", str5);
            string str6 = LSRequest.qq("page_type").Trim();
            if (!string.IsNullOrEmpty(str6) && ((str6 == "21") || (str6 == "18")))
            {
                Dictionary <string, object> dictionary2 = new Dictionary <string, object>();
                if (CacheHelper.GetCache("balance_kc_FileCacheKey" + str2) != null)
                {
                    dictionary2 = CacheHelper.GetCache("balance_kc_FileCacheKey" + str2) as Dictionary <string, object>;
                    dictionary.Add("ph_title", dictionary2["ph_title"]);
                    dictionary.Add("ph_content", dictionary2["ph_content"]);
                }
                else
                {
                    List <string> list2 = CallBLL.cz_phase_xyftoa_bll.PaihangList_LMP("xyftoa_lmp", 10);
                    string        str7  = string.Join("|", new List <string> {
                        "冠亞軍和", "冠亞軍和大小", "冠亞軍和單雙"
                    }.ToArray());
                    dictionary.Add("ph_title", str7);
                    dictionary.Add("ph_content", list2);
                    dictionary2.Add("ph_title", str7);
                    dictionary2.Add("ph_content", list2);
                    CacheHelper.SetCache("balance_kc_FileCacheKey" + str2, dictionary2);
                    CacheHelper.SetPublicFileCache("balance_kc_FileCacheKey" + str2, dictionary2, PageBase.GetPublicForderPath(base.get_KC_BalanceFileName()));
                }
            }
            dictionary.Add("status", "1");
            base.OutJson(JsonHandle.ObjectToJson(dictionary));
        }
    }