Пример #1
0
 private void GetUSSharesValue()
 {
     while (true)
     {
         if (refreshUs)
         {
             int      index = 0;
             string[] vs    = new KeysHelper().GetAllText("us_shares");
             if (vs != null && vs.Length > 0)
             {
                 foreach (string v in vs)
                 {
                     if (string.IsNullOrEmpty(v))
                     {
                         continue;
                     }
                     string c   = v.Split('>')[0].ToLower();
                     string url = "https://hq.sinajs.cn/etag.php?_=" + ((DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000) + new Random().Next(100, 999) + "&list=gb_" + c;
                     string k   = "var hq_str_gb_" + c + "=";
                     GetSharesData(listView2, url, k, index, 1, 2);
                     index++;
                 }
             }
             Thread.Sleep(refreshUSTs);
             continue;
         }
         Thread.Sleep(1000);
     }
 }
Пример #2
0
        private void AddKeysToFile(string create_time, string rich_text)
        {
            KeysHelper kh = new KeysHelper();

            string[] keys = kh.GetAllText("keys");
            if (keys != null && keys.Length > 0)
            {
                foreach (string k in keys)
                {
                    if (!string.IsNullOrEmpty(k) && rich_text.IndexOf(k) > -1)
                    {
                        string text = create_time + ">" + rich_text;
                        kh.AddTextToFile(k, text, true);
                        for (int i = 0; i < tabControl1.TabPages.Count; i++)
                        {
                            if (tabControl1.TabPages[i].Text == k)
                            {
                                string[] es = new string[] { Convert.ToDateTime(create_time).ToString("HH:mm:ss"), rich_text };
                                for (int j = 0; j < tabControl1.TabPages[i].Controls.Count; j++)
                                {
                                    if (tabControl1.TabPages[i].Controls[j] is ListView)
                                    {
                                        (tabControl1.TabPages[i].Controls[j] as ListView).Items.Insert(0, new ListViewItem(es));
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Пример #3
0
 private void GetHKSharesValue()
 {
     while (true)
     {
         if (refreshHk)
         {
             int      index = 0;
             string[] vs    = new KeysHelper().GetAllText("hk_shares");
             if (vs != null && vs.Length > 0)
             {
                 foreach (string v in vs)
                 {
                     if (string.IsNullOrEmpty(v))
                     {
                         continue;
                     }
                     string c   = v.Split('>')[0];
                     string url = "https://hq.sinajs.cn/?_=0.5245967248715309&list=rt_hk" + c;
                     string k   = "var hq_str_rt_hk" + c + "=";
                     GetSharesData(listView1, url, k, index, 6, 8);
                     index++;
                 }
             }
             Thread.Sleep(refreshHkTs);
             continue;
         }
         Thread.Sleep(1000);
     }
 }
Пример #4
0
        private void Evt_NewsKeyAdd(object sender, string e)
        {
            TabPage  tp = new TabPage();
            ListView lv = new ListView();

            lv.Columns.AddRange(new ColumnHeader[]
            {
                new ColumnHeader()
                {
                    Text = "Time", Width = 100, Name = "time"
                },
                new ColumnHeader()
                {
                    Text = "Content", Width = 1200, Name = "content"
                }
            }
                                );
            lv.Dock             = DockStyle.Fill;
            lv.View             = View.Details;
            lv.HeaderStyle      = ColumnHeaderStyle.Nonclickable;
            lv.FullRowSelect    = true;
            lv.BorderStyle      = BorderStyle.None;
            lv.GridLines        = true;
            lv.Font             = new Font(FontFamily.GenericSansSerif, 10);
            lv.ShowItemToolTips = true;
            tp.Text             = e;
            tp.Controls.Add(lv);
            this.tabControl1.TabPages.Add(tp);
            string[] keyTexts = new KeysHelper().GetAllText(e);
            if (keyTexts == null || keyTexts.Length == 0)
            {
                return;
            }
            foreach (string text in keyTexts)
            {
                if (!string.IsNullOrEmpty(text) && text.IndexOf(">") > -1)
                {
                    string time = text.Split('>')[0];
                    if (Convert.ToDateTime(time) < Convert.ToDateTime(DateTime.Now.ToShortDateString()))
                    {
                        continue;
                    }
                    string   content = text.Split('>')[1];
                    string[] es      = new string[] { Convert.ToDateTime(time).ToString("HH:mm:ss"), content };
                    lv.Items.Insert(0, new ListViewItem(es));
                }
            }
        }
Пример #5
0
        private void AddTabs()
        {
            KeysHelper kh = new KeysHelper();

            string[] keys = kh.GetAllText("keys");
            if (keys != null && keys.Length > 0)
            {
                foreach (string k in keys)
                {
                    if (!string.IsNullOrEmpty(k))
                    {
                        Evt.AddNewsKey(k);
                    }
                }
            }
        }
Пример #6
0
        private void LoadKeys()
        {
            KeysHelper kh = new KeysHelper();

            string[] keys = kh.GetAllText("keys");
            if (keys != null && keys.Length > 0)
            {
                foreach (string k in keys)
                {
                    if (!String.IsNullOrEmpty(k))
                    {
                        listBox1.Items.Add(k);
                    }
                }
            }
        }
Пример #7
0
 private void LoadShares(ListView listview, string filename)
 {
     string[] vs = new KeysHelper().GetAllText(filename);
     if (vs != null && vs.Length > 0)
     {
         foreach (string v in vs)
         {
             if (string.IsNullOrEmpty(v))
             {
                 continue;
             }
             string   code = v.Split('>')[0];
             string   name = v.Split('>')[1];
             string[] item = new string[] { "(" + code + ")" + name, "" };
             if (filename == "us_shares")
             {
                 item = new string[] { "(" + code + ")" + name, "", "" };
             }
             listview.Items.Add(new ListViewItem(item));
         }
     }
 }
Пример #8
0
        private void RemoveKeysFromFile(string key)
        {
            KeysHelper kh = new KeysHelper();

            kh.RemoveTextFromFile("keys", key);
        }
Пример #9
0
        private void AddKeyToFile(string key)
        {
            KeysHelper kh = new KeysHelper();

            kh.AddTextToFile("keys", key);
        }