コード例 #1
0
ファイル: MyTime.cs プロジェクト: wwkkww1983/ExchangeApp
        public int CompareTo(Object obj)
        {
            int flg = 0;

            try
            {
                MyTime sObj = (MyTime)obj;
                flg = this.Day.CompareTo(sObj.Day); //先按照“天”进行排序
                if (flg == 0)                       //如果 天 相同,再按照“小时“的大小进行排序
                {
                    if (this.Hour > sObj.Hour)
                    {
                        flg = 1;
                    }
                    else if (this.Hour < sObj.Hour)
                    {
                        flg = -1;
                    }
                    else
                    {
                        if (this.Min > sObj.Min)
                        {
                            flg = 1;
                        }
                        else if (this.Min < sObj.Min)
                        {
                            flg = -1;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("比较异常", ex.InnerException);
            }
            return(flg);
        }
コード例 #2
0
ファイル: MyTime.cs プロジェクト: wwkkww1983/ExchangeApp
        public static int GetTimeDiff(MyTime startTime)
        {
            MyTime timeDiff = MyTime.nowTime - startTime;

            return(timeDiff.Min);
        }
コード例 #3
0
 public TimeCountDown(string source)
 {
     Name      = source.Substring(0, 3);
     CountDown = new MyTime(source.Substring(3));
 }
コード例 #4
0
        public static void PlayMusic()
        {
            try
            {
                Thread.Sleep(3000);

                //离场符号提示音           !
                if (Setup.isPlayOutMusic != 0)
                {
                    if (isPlayOutMusicNum == 0)
                    {
                        Setup.outStartTime = new MyTime(DateTime.Now.Day, MyTime.nowTime.Hour, MyTime.nowTime.Min);
                    }
                    if (MyTime.GetTimeDiff(Setup.outStartTime) > Setup.sAfterMinNum || (isPlayOutMusicNum == 0))
                    {
                        Setup.outStartTime = new MyTime(DateTime.Now.Day, MyTime.nowTime.Hour, MyTime.nowTime.Min);
                        isPlayOutMusicNum++;
                        player.PlayEachSound(@".\jingbao.wav", 2000);
                    }
                    Setup.isPlayOutMusic = 0;
                }
                else
                {
                    isPlayOutMusicNum = 0;
                }

                #region 已经去掉的提示音
                ////接口文件出错
                //if(Setup.isFoundError)
                //{
                //    player.PlayEachSound(@".\jingbao.wav", 2000);
                //    Setup.isFoundError = false;
                //}


                ////走势图 红灯
                //if (Setup.isStartRedMusic)
                //{
                //    if (isPlayRedMusicNum == 0)
                //    {
                //        Setup.redStartTime = new MyTime(0, MyTime.nowTime.Hour, MyTime.nowTime.Min);
                //    }
                //    if (MyTime.GetTimeDiff(Setup.redStartTime) > Setup.zoushiRed || (isPlayRedMusicNum == 0))
                //    {
                //        Setup.redStartTime = new MyTime(0, MyTime.nowTime.Hour, MyTime.nowTime.Min);
                //        isPlayRedMusicNum++;
                //        player.PlayEachSound(@".\jingbao.wav", 2000);
                //    }
                //    Setup.isPlayOutMusic = 0;
                //    //Setup.isStartRedMusic = false;
                //}
                //else
                //{
                //    isPlayRedMusicNum = 0;


                //    //走势图 绿灯
                //    if (Setup.isStartGreenMusic)
                //    {
                //        player.PlayLoopingSound( @".\jiji.wav",6000,Setup.zoushiGreen);

                //        Setup.isStartGreenMusic = false;
                //    }
                //}

                ////黄灯
                //if(Setup.isStartYellowMusic)
                //{
                //    player.PlayLoopingSound(@".\jingbao.wav", 2000, 1);
                //    Setup.isStartYellowMusic = false;
                //}

                /*
                 * //绿色提示符
                 * if (Setup.gIsUseSound)
                 * {
                 *  foreach (MoneyGroup mgp in DataFiler.basicMoneyGroup)
                 *  {
                 *      foreach (MoneyBoth mbth in mgp.allMoneyBoth)
                 *      {
                 *          if (mbth.CirMarkState && mbth.CirMarkPlayNum == 0)
                 *          {
                 *              player.PlayEachSound(@".\circle.wav", 2000);
                 *              mbth.CirMarkPlayNum++;
                 *          }
                 *      }
                 *  }
                 * }
                 */
                #endregion

                if (Setup.isPlaySignnumMusic)
                {
                    player.PlayEachSound(@".\circle.wav", 2000);
                    Setup.isPlaySignnumMusic = false;
                }

                PlayMusic();
            }
            catch (Exception ex)
            {
                BasicData.mainUI.Invoke(BasicData.mainUI.ShowFormText, new object[] {
                    DataFiler.basicFormText + "*未找到音效文件*",
                    BasicData.mainUI
                });
                PlayMusic();
            }
        }
コード例 #5
0
 public TimeCountDown(string n, MyTime c)
 {
     name      = n;
     countDown = c;
 }
コード例 #6
0
        public void fenzhong()
        {
            try
            {
                StreamReader sr = new StreamReader(Setup.pathTemp + "/fenzhong.txt", Encoding.Default);
                string       line;
                int          lineNum = 0;
                int          hour1, hour2;
                int          min1, min2;
                line = sr.ReadLine();
                string[] Data = line.Split(new char[] { ';' });
                Setup.timeWaihui        = Data[0];
                DataShow.zsDownTimeLast = Data[0].Substring(11, 5).ToString();

                hour1 = int.Parse(line.Substring(11, 2));
                min1  = int.Parse(line.Substring(14, 2));
                hour2 = hour1;
                min2  = min1;
                for (int i = 1; i <= (Data.Length - 1) / 2; i++)    //2016.01.27 02:20;USD;56;JPY;65;EUR;73;GBP;60;CHF;69;CAD;90;AUD;84;NZD;90;
                {
                    string name  = Data[2 * i - 1];
                    Money  money = FindMoney(name);
                    money.OrderLeft      = int.Parse(Data[2 * i]);
                    money.fengzhong[119] = money.OrderLeft;
                }
                lineNum++;
                while ((line = sr.ReadLine()) != null)
                {
                    Data = line.Split(new char[] { ';' });
                    for (int i = 1; i <= (Data.Length - 1) / 2; i++)    //2016.01.27 02:20;USD;56;JPY;65;EUR;73;GBP;60;CHF;69;CAD;90;AUD;84;NZD;90;
                    {
                        string name  = Data[2 * i - 1];
                        Money  money = FindMoney(name);
                        money.fengzhong[119 - lineNum] = int.Parse(Data[2 * i]);
                    }
                    if (lineNum == 60)
                    {
                        DataShow.zsDownTimeMid = Data[0].Substring(11, 5).ToString();
                    }
                    hour2 = int.Parse(line.Substring(11, 2));
                    min2  = int.Parse(line.Substring(14, 2));
                    lineNum++;
                }
                MyTime timeDiff    = new MyTime(DateTime.Now.Day, hour1, min1) - new MyTime(DateTime.Now.Day, hour2, min2);
                int    planLineNum = timeDiff.Hour * 60 + timeDiff.Min + 1;
                if (planLineNum > lineNum)
                {
                    Setup.isFoundError = true;

                    BasicData.mainUI.Invoke(BasicData.mainUI.ShowFormText, new object[] {
                        basicFormText + "*走势数据缺失" + (planLineNum - lineNum).ToString() + "条*",
                        BasicData.mainUI
                    });
                }

                sr.Close();
            }
            catch (FileNotFoundException ex)
            {
                Setup.isFoundError = true;

                BasicData.mainUI.Invoke(BasicData.mainUI.ShowFormText, new object[] {
                    basicFormText + "*找不到fenzhong.txt*",
                    BasicData.mainUI
                });
            }
            catch (Exception ex)
            {
                Setup.isFoundError = true;

                BasicData.mainUI.Invoke(BasicData.mainUI.ShowFormText, new object[] {
                    basicFormText + "*走势数据有误*",
                    BasicData.mainUI
                });
            }
        }
コード例 #7
0
        public void DDD()       //2016.01.27 02:20;USD;16;7;JPY;25;-1;EUR;13;3;GBP;10;-3;CHF;6;5;CAD;9;1;AUD;42;-7;NZD;30;-5
        {
            try
            {
                int          lineNum = 0;
                int          hour1, hour2;
                int          min1, min2;
                StreamReader sr   = new StreamReader(Setup.pathTemp + "/DDD.txt", Encoding.Default);
                string       line = sr.ReadLine();
                string[]     Data = line.Split(new char[] { ';' });

                hour1 = int.Parse(line.Substring(11, 2));
                min1  = int.Parse(line.Substring(14, 2));
                hour2 = hour1;
                min2  = min1;
                for (int i = 1; i <= (Data.Length - 1) / 3; i++)    //1...8
                {
                    string name  = Data[3 * i - 2];
                    Money  money = FindMoney(name);
                    money.LengthY = int.Parse(Data[3 * i - 1]);
                    money.ColorX  = int.Parse(Data[3 * i]);
                    GetMaxLengthY(money.LengthY);
                    GetYingxianData(money, money.LengthY, money.ColorX);
                }
                lineNum++;
                while ((line = sr.ReadLine()) != null)
                {
                    Data = line.Split(new char[] { ';' });
                    for (int i = 1; i <= (Data.Length - 1) / 3; i++)    //1...8
                    {
                        string name        = Data[3 * i - 2];
                        Money  money       = FindMoney(name);
                        int    tempLengthY = int.Parse(Data[3 * i - 1]);
                        int    tempColorX  = int.Parse(Data[3 * i]);
                        GetMaxLengthY(tempLengthY);
                        GetYingxianData(money, tempLengthY, tempColorX);
                    }
                    hour2 = int.Parse(line.Substring(11, 2));
                    min2  = int.Parse(line.Substring(14, 2));
                    lineNum++;
                }
                MyTime timeDiff    = new MyTime(DateTime.Now.Day, hour1, min1) - new MyTime(DateTime.Now.Day, hour2, min2);
                int    planLineNum = timeDiff.Hour * 60 + timeDiff.Min + 1;
                if (planLineNum > lineNum)
                {
                    Setup.isFoundError = true;

                    BasicData.mainUI.Invoke(BasicData.mainUI.ShowFormText, new object[] {
                        basicFormText + "*日行图数据缺失" + (planLineNum - lineNum).ToString() + "条*",
                        BasicData.mainUI
                    });
                }

                sr.Close();
            }
            catch (FileNotFoundException ex)
            {
                Setup.isFoundError = true;

                BasicData.mainUI.Invoke(BasicData.mainUI.ShowFormText, new object[] {
                    basicFormText + "*找不到DDD.txt*",
                    BasicData.mainUI
                });
            }
            catch (Exception ex)
            {
                Setup.isFoundError = true;

                BasicData.mainUI.Invoke(BasicData.mainUI.ShowFormText, new object[] {
                    basicFormText + "*日行图数据有误*",
                    BasicData.mainUI
                });
            }
        }
コード例 #8
0
        public void jjj()
        {   //2016.01.27 02:20;USDJPY.lmx;10;USDCAD.lmx;13;USDCHF.lmx;9;EURUSD.lmx;12;GBPUSD.lmx;16;AUDUSD.lmx;20;NZDUSD.lmx;15;EURJPY.lmx;6;EURCAD.lmx;1;EURCHF.lmx;-2;EURGBP.lmx;-6;EURAUD.lmx;-8;EURNZD.lmx;9;GBPJPY.lmx;7;CADJPY.lmx;-5;CHFJPY.lmx;3;AUDJPY.lmx;15;NZDJPY.lmx;32;GBPAUD.lmx;9;GBPCAD.lmx;3;GBPCHF.lmx;14;GBPNZD.lmx;4;AUDNZD.lmx;-5;AUDCAD.lmx;-9;AUDCHF.lmx;3;NZDCAD.lmx;2;NZDCHF.lmx;9;CADCHF.lmx;10
            try
            {
                StreamReader sr = new StreamReader(Setup.pathTemp + "/jjj.txt", Encoding.Default);
                string       line;
                int          lineNum = 0;
                int          hour1, hour2;
                int          min1, min2;
                line = sr.ReadLine();
                string[] Data = line.Split(new char[] { ';' });

                hour1 = int.Parse(line.Substring(11, 2));
                min1  = int.Parse(line.Substring(14, 2));
                hour2 = hour1;
                min2  = min1;
                for (int i = 1; i <= (Data.Length - 1) / 2; i++)
                {
                    string    name = Data[2 * i - 1].Substring(0, 6);
                    MoneyBoth both = FindMoneyBoth(name);
                    both.PriceChange = Math.Abs(int.Parse(Data[2 * i]));
                }
                lineNum++;

                while ((line = sr.ReadLine()) != null)
                {
                    hour2 = int.Parse(line.Substring(11, 2));
                    min2  = int.Parse(line.Substring(14, 2));
                    lineNum++;
                    if (lineNum == 60)
                    {
                        break;
                    }
                }

                MyTime timeDiff    = new MyTime(DateTime.Now.Day, hour1, min1) - new MyTime(DateTime.Now.Day, hour2, min2);
                int    planLineNum = timeDiff.Hour * 60 + timeDiff.Min + 1;
                if (planLineNum > lineNum)
                {
                    Setup.isFoundError = true;

                    BasicData.mainUI.Invoke(BasicData.mainUI.ShowFormText, new object[] {
                        basicFormText + "*价格行程数据缺失" + (planLineNum - lineNum).ToString() + "条*",
                        BasicData.mainUI
                    });
                }

                sr.Close();
            }
            catch (FileNotFoundException ex)
            {
                Setup.isFoundError = true;

                BasicData.mainUI.Invoke(BasicData.mainUI.ShowFormText, new object[] {
                    basicFormText + "*找不到jjj.txt*",
                    BasicData.mainUI
                });
            }
            catch (Exception ex)
            {
                Setup.isFoundError = true;

                BasicData.mainUI.Invoke(BasicData.mainUI.ShowFormText, new object[] {
                    basicFormText + "*价格行程有误*",
                    BasicData.mainUI
                });
            }
        }
コード例 #9
0
        public void TTT()   // 2016.01.27 02:20;USDJPY.lmx;82S;USDCHF.lmx;2B;USDCAD.lmx;38B;EURUSD.lmx;37S;........
        {
            try
            {
                StreamReader sr = new StreamReader(Setup.pathTemp + "/TTT.txt", Encoding.Default);
                string       line;
                int          lineNum = 0;
                int          hour1, hour2;
                int          min1, min2;
                line = sr.ReadLine();
                string[] Data = line.Split(new char[] { ';' });
                hour1 = int.Parse(line.Substring(11, 2));
                min1  = int.Parse(line.Substring(14, 2));
                hour2 = hour1;
                min2  = min1;
                for (int i = 1; i <= (Data.Length - 1) / 2; i++)
                {
                    string    name = Data[2 * i - 1].Substring(0, 6);
                    MoneyBoth both = FindMoneyBoth(name);
                    both.BuyOrSellNum = int.Parse(Data[2 * i].Substring(0, Data[2 * i].Length - 1));
                    both.BuyOrSell    = char.Parse(Data[2 * i].Substring(Data[2 * i].Length - 1, 1));
                }
                lineNum++;

                while ((line = sr.ReadLine()) != null)
                {
                    hour2 = int.Parse(line.Substring(11, 2));
                    min2  = int.Parse(line.Substring(14, 2));
                    lineNum++;
                    if (lineNum == 60)
                    {
                        break;
                    }
                }
                MyTime timeDiff    = new MyTime(DateTime.Now.Day, hour1, min1) - new MyTime(DateTime.Now.Day, hour2, min2);
                int    planLineNum = timeDiff.Hour * 60 + timeDiff.Min + 1;
                if (planLineNum > lineNum)
                {
                    Setup.isFoundError = true;

                    BasicData.mainUI.Invoke(BasicData.mainUI.ShowFormText, new object[] {
                        basicFormText + "*进退数据缺失" + (planLineNum - lineNum).ToString() + "条*",
                        BasicData.mainUI
                    });
                }

                sr.Close();
            }
            catch (FileNotFoundException ex)
            {
                Setup.isFoundError = true;

                BasicData.mainUI.Invoke(BasicData.mainUI.ShowFormText, new object[] {
                    basicFormText + "*找不到TTT.txt*",
                    BasicData.mainUI
                });
            }
            catch (Exception ex)
            {
                Setup.isFoundError = true;

                BasicData.mainUI.Invoke(BasicData.mainUI.ShowFormText, new object[] {
                    basicFormText + "*进退数据有误*",
                    BasicData.mainUI
                });
            }
        }