internal SendTextEvent InvokeEvent(SendTextEvent arg)
 {
     if (_api.ValidateEvent(arg))
     {
         SendText?.Invoke(_api, arg);
     }
     return(arg);
 }
示例#2
0
        protected string SetSecret(int type)
        {
            string path = type > 0 ? @"\Statistics\Kosdaq150" : @"\Statistics\Kospi200";

            string[] file = Directory.GetFiles(string.Concat(Environment.CurrentDirectory, path), "*.csv", SearchOption.AllDirectories), arr;
            int      temp;

            foreach (string val in file)
            {
                arr  = val.Split('.');
                arr  = arr[0].Split('\\');
                temp = int.Parse(arr[arr.Length - 1]);

                if (temp > RecentDate)
                {
                    RecentDate = temp;
                }
            }
            try
            {
                using (StreamReader sr = new StreamReader(string.Concat(Environment.CurrentDirectory, path, @"\", RecentDate.ToString(), ".csv")))
                {
                    List <string> list = new List <string>(128);

                    if (sr != null)
                    {
                        while (sr.EndOfStream == false)
                        {
                            list.Add(sr.ReadLine());
                        }
                    }

                    Dictionary <string, long> max = new Dictionary <string, long>(128);
                    file = list[0].Split(',');
                    arr  = list[list.Count - 1].Split(',');

                    for (temp = 1; temp < file.Length - 1; temp++)
                    {
                        max[file[temp]] = long.Parse(arr[temp]);
                    }

                    using (Choice ch = new Choice())
                    {
                        SendText += ch.OnReceiveText;

                        foreach (KeyValuePair <string, long> kv in max.OrderByDescending(o => o.Value))
                        {
                            if (ch.Count > 29)
                            {
                                break;
                            }

                            SendText.Invoke(this, new Memorize(string.Concat(kv.Key, " ₩", kv.Value.ToString("N0"))));
                        }
                        ch.ShowDialog();
                        Box.Show(string.Concat(ch.TempText), "The Chosen Strategy is Number. . .", waiting);
                        arr = ch.TempText.Split('₩');
                        ch.Dispose();

                        return(arr[0].Trim());
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
            return("1^1");
        }