Exemplo n.º 1
0
        public void LoadDataDir()
        {
            this.DataDir = Consts.DATA_DIR_01;

            if (Directory.Exists(this.DataDir) == false)
            {
                this.DataDir = Consts.DATA_DIR_02;

                if (Directory.Exists(this.DataDir) == false)
                {
                    throw new Exception("データ・ディレクトリが見つかりません。");
                }
            }

            string periodFile = Path.Combine(this.DataDir, "_Period.txt");

            {
                string[] lines = File.ReadAllLines(periodFile);
                int      c     = 0;

                this.Period_DateTimeSt = long.Parse(StringUtils.KVToValue(lines[c++]));
                this.Period_DateTimeEd = long.Parse(StringUtils.KVToValue(lines[c++]));
            }

            // ここからチェック

            if (DateTimeToSecUtils.IsFairDateTime(this.Period_DateTimeSt) == false)
            {
                throw new Exception("不正な開始日時");
            }

            if (DateTimeToSecUtils.IsFairDateTime(this.Period_DateTimeEd) == false)
            {
                throw new Exception("不正な開始日時");
            }
        }
Exemplo n.º 2
0
        private GrphCond GetGrphCond()
        {
            GrphCond cond = new GrphCond();

            {
                string currPair = this.CurrPair.SelectedItem.ToString();

                if (StringTools.LiteValidate(currPair, StringTools.ALPHA, 6, 6) == false)
                {
                    throw new Exception("通貨ペアが選択されていません。");
                }

                cond.CurrPair = currPair;
            }

            {
                long st = long.Parse(this.DateTimeSt.Text);
                long ed = long.Parse(this.DateTimeEd.Text);

                if (DateTimeToSecUtils.IsFairDateTime(st) == false)
                {
                    throw new Exception("開始日時の書式エラー");
                }

                if (DateTimeToSecUtils.IsFairDateTime(ed) == false)
                {
                    throw new Exception("終了日時の書式エラー");
                }

                if (st < Ground.I.Period_DateTimeSt)
                {
                    throw new Exception("開始日時が古すぎる。");
                }

                if (Ground.I.Period_DateTimeEd < ed)
                {
                    throw new Exception("終了日時が先すぎる。");
                }

                if (ed <= st)
                {
                    throw new Exception("終了日時 <= 開始日時");
                }

                cond.DateTimeSt = st;
                cond.DateTimeEd = ed;
            }

            CheckBox[] maDayCBs = GetMaDayCheckBoxes();

            {
                List <GrphCond.MaDayInfo> dest = new List <GrphCond.MaDayInfo>();

                for (int index = 0; index < maDayCBs.Length; index++)
                {
                    CheckBox maDayCB = maDayCBs[index];

                    if (maDayCB.Checked)
                    {
                        dest.Add(new GrphCond.MaDayInfo()
                        {
                            Index = index,
                            Day   = int.Parse(maDayCB.Tag.ToString()),
                        });
                    }
                }
                cond.MaDays = dest.ToArray();
            }

            return(cond);
        }