Ejemplo n.º 1
0
        private void UIRefresh()
        {
            {
                bool flag = this.ProxyMode.SelectedIndex == 2;

                this.ProxyHost.Enabled = flag;
                this.ProxyPort.Enabled = flag;

                if (flag == false)
                {
                    if (this.ProxyHost.Text == "")
                    {
                        this.ProxyHost.Text = "none";
                    }

                    this.ProxyPort.Text = "" + IntTools.ToInt(this.ProxyPort.Text, 1, 65535, 8080);
                }
            }

            {
                string message = this.GetWarning();

                this.BtnOk.Enabled = message == "";

                this.SouthText.Text     = message;
                this.SouthEastText.Text = "";
            }
        }
Ejemplo n.º 2
0
        public static void LoadConf()
        {
            try
            {
                List <string> lines = new List <string>();

                foreach (string line in File.ReadAllLines(ConfFile, StringTools.ENCODING_SJIS))
                {
                    if (line != "" && line.StartsWith(";") == false)
                    {
                        lines.Add(line);
                    }
                }

                int c = 0;

                // ---- data ----

                ClientInfoCountMax    = IntTools.ToInt(lines[c++], 1, IntTools.IMAX, 20);
                HeaderFieldCountMax   = IntTools.ToInt(lines[c++], 1, IntTools.IMAX, 20);
                ColorOkCancel         = ColorTools.FromRRGGBB(lines[c++]);
                Color行番号              = ColorTools.FromRRGGBB(lines[c++]);
                Count失敗Min_ChangeIcon = IntTools.ToInt(lines[c++], 1, IntTools.IMAX, 3);

                // ----
            }
            catch
            { }
        }
Ejemplo n.º 3
0
        private void SaveData()
        {
            Gnd.ProxyMode = (Gnd.ProxyMode_e) this.ProxyMode.SelectedIndex;
            Gnd.ProxyHost = this.ProxyHost.Text;
            Gnd.ProxyPort = IntTools.ToInt(this.ProxyPort.Text, 1, 65535, 8080);

            // normalize
            {
                if (Gnd.ProxyHost == "")
                {
                    Gnd.ProxyHost = "none";
                }

                Gnd.ProxyHost = JString.ToAsciiToken(Gnd.ProxyHost, 1, 300);
            }

            Gnd.SaveToFile();
        }
Ejemplo n.º 4
0
 private void SaveData()
 {
     Gnd.I.SndInputBatLocal  = this.SndInputBatLocal.Checked;
     Gnd.I.RecStrokeMillis   = IntTools.ToInt(this.RecStrokeMillis.Text, 0, 60000, Gnd.I.RecStrokeMillis);
     Gnd.I.RecClickMillis    = IntTools.ToInt(this.RecClickMillis.Text, 0, 60000, Gnd.I.RecClickMillis);
     Gnd.I.RecDblClickMillis = IntTools.ToInt(this.RecDblClickMillis.Text, 0, 60000, Gnd.I.RecDblClickMillis);
     Gnd.I.Recまとめ            = this.Recまとめ.Checked;
     Gnd.I.StrokeMillis      = IntTools.ToInt(this.StrokeMillis.Text, 0, 60000, Gnd.I.StrokeMillis);
     Gnd.I.ClickMillis       = IntTools.ToInt(this.ClickMillis.Text, 0, 60000, Gnd.I.ClickMillis);
     Gnd.I.DblClickMillis    = IntTools.ToInt(this.DblClickMillis.Text, 0, 60000, Gnd.I.DblClickMillis);
     Gnd.I.SamplingMillis    = IntTools.ToInt(this.SamplingMillis.Text, 1, 60000, Gnd.I.SamplingMillis);
     Gnd.I.RecStartMin       = this.RecStartMin.Checked;
     Gnd.I.RecEndUnmin       = this.RecEndUnmin.Checked;
     Gnd.I.RecRCtrl停止        = this.RecRCtrl停止.Checked;
     Gnd.I.StartMin          = this.StartMin.Checked;
     Gnd.I.EndUnmin          = this.EndUnmin.Checked;
     Gnd.I.RCtrl中断           = this.RCtrl中断.Checked;
     // ここへ追加..
 }
Ejemplo n.º 5
0
        private string GetWarning()
        {
            if (this.ProxyHost.Text == "")
            {
                return("ホスト名を入力して下さい。");
            }

            {
                string text = this.ProxyPort.Text;

                text = "" + IntTools.ToInt(text, 1, 65535);

                if (text != this.ProxyPort.Text)
                {
                    return("ポート番号に 1 ~ 65535 の整数を指定して下さい。");
                }
            }

            return("");
        }
Ejemplo n.º 6
0
        // ----

        public static void LoadConf()
        {
            string confFile = Path.Combine(ProcMain.SelfDir, Path.GetFileNameWithoutExtension(ProcMain.SelfFile) + ".conf");

            if (File.Exists(confFile) == false)
            {
                return;
            }

            string[] lines = File.ReadAllLines(confFile, StringTools.ENCODING_SJIS).Where(line => line != "" && line.StartsWith(";") == false).ToArray();
            int      c     = 0;

            if (lines.Length != int.Parse(lines[c++]))             // 有効項目数
            {
                throw new Exception();
            }

            // ---- Conf 項目 ----

            MillerRabin_K = IntTools.ToInt(lines[c++], 1, IntTools.IMAX, 30);

            // ----
        }
Ejemplo n.º 7
0
        //
        //	copied the source file by https://github.com/stackprobe/Factory/blob/master/SubTools/CopyLib.c
        //
        public static void Load()
        {
            if (File.Exists(DDConsts.SaveDataFile) == false)
            {
                return;
            }

            byte[][] blocks = BinTools.Split(DDJammer.Decode(File.ReadAllBytes(DDConsts.SaveDataFile)));
            int      bc     = 0;

            string[] lines = DDUtils.Split(blocks[bc++]);
            int      c     = 0;

            if (lines[c++] != Program.APP_IDENT)
            {
                throw new DDError();
            }

            if (lines[c++] != Program.APP_TITLE)
            {
                throw new DDError();
            }

            // アプリのアップデートによって項目の更新・増減があっても処理を続行するように try ~ catch しておく。

            try             // Donut3 のセーブデータ
            {
                // TODO int.Parse -> IntTools.ToInt

                DDGround.RealScreen_W = int.Parse(lines[c++]);
                DDGround.RealScreen_H = int.Parse(lines[c++]);

                DDGround.RealScreenDraw_L = int.Parse(lines[c++]);
                DDGround.RealScreenDraw_T = int.Parse(lines[c++]);
                DDGround.RealScreenDraw_W = int.Parse(lines[c++]);
                DDGround.RealScreenDraw_H = int.Parse(lines[c++]);

                DDGround.MusicVolume = long.Parse(lines[c++]) / (double)IntTools.IMAX;
                DDGround.SEVolume    = long.Parse(lines[c++]) / (double)IntTools.IMAX;

                DDInput.DIR_2.BtnId = int.Parse(lines[c++]);
                DDInput.DIR_4.BtnId = int.Parse(lines[c++]);
                DDInput.DIR_6.BtnId = int.Parse(lines[c++]);
                DDInput.DIR_8.BtnId = int.Parse(lines[c++]);
                DDInput.A.BtnId     = int.Parse(lines[c++]);
                DDInput.B.BtnId     = int.Parse(lines[c++]);
                DDInput.C.BtnId     = int.Parse(lines[c++]);
                DDInput.D.BtnId     = int.Parse(lines[c++]);
                DDInput.E.BtnId     = int.Parse(lines[c++]);
                DDInput.F.BtnId     = int.Parse(lines[c++]);
                DDInput.L.BtnId     = int.Parse(lines[c++]);
                DDInput.R.BtnId     = int.Parse(lines[c++]);
                DDInput.PAUSE.BtnId = int.Parse(lines[c++]);
                DDInput.START.BtnId = int.Parse(lines[c++]);

                DDInput.DIR_2.KeyId = int.Parse(lines[c++]);
                DDInput.DIR_4.KeyId = int.Parse(lines[c++]);
                DDInput.DIR_6.KeyId = int.Parse(lines[c++]);
                DDInput.DIR_8.KeyId = int.Parse(lines[c++]);
                DDInput.A.KeyId     = int.Parse(lines[c++]);
                DDInput.B.KeyId     = int.Parse(lines[c++]);
                DDInput.C.KeyId     = int.Parse(lines[c++]);
                DDInput.D.KeyId     = int.Parse(lines[c++]);
                DDInput.E.KeyId     = int.Parse(lines[c++]);
                DDInput.F.KeyId     = int.Parse(lines[c++]);
                DDInput.L.KeyId     = int.Parse(lines[c++]);
                DDInput.R.KeyId     = int.Parse(lines[c++]);
                DDInput.PAUSE.KeyId = int.Parse(lines[c++]);
                DDInput.START.KeyId = int.Parse(lines[c++]);

                DDGround.RO_MouseDispMode = int.Parse(lines[c++]) != 0;

                // 新しい項目をここへ追加...
            }
            catch (Exception e)
            {
                ProcMain.WriteLog(e);
            }

            Load_Delay = () =>
            {
                lines = DDUtils.Split(blocks[bc++]);
                c     = 0;

                try                 // アプリ固有のセーブデータ
                {
                    // app > @ Load

                    //DDUtils.Noop(lines[c++]); // Dummy

                    Ground.I.MessageSpeed = IntTools.ToInt(lines[c++],
                                                           Charlotte.Games.GameConsts.MESSAGE_SPEED_MIN,
                                                           Charlotte.Games.GameConsts.MESSAGE_SPEED_MAX,
                                                           Charlotte.Games.GameConsts.MESSAGE_SPEED_DEF
                                                           );

                    // 新しい項目をここへ追加...

                    // < app
                }
                catch (Exception e)
                {
                    ProcMain.WriteLog(e);
                }

                Load_Delay = () => { };                 // reset
            };
        }
Ejemplo n.º 8
0
        private void MainTimer_Tick(object sender, EventArgs e)
        {
            if (this.MT_Enabled == false || this.MT_Busy)
            {
                return;
            }

            this.MT_Busy = true;

            try
            {
                if (this.XBtnPressed)
                {
                    this.XBtnPressed = false;
                    this._中止ボタン_Click(null, null);
                    return;
                }

                // ----

                if (Gnd.Conv.Cancelled || Gnd.Conv.Errored)
                {
                    if (this.Th.IsAlive == false)
                    {
                        this.MT_Enabled = false;
                        this.Close();
                        return;
                    }
                }
                else if (1 <= this.FinishedCount)
                {
                    if (this.FinishedCount == 10)
                    {
                        this.MT_Enabled = false;
                        this.Close();
                        return;
                    }

                    {
                        int prog = IntTools.IMAX;

                        if (this.ProgBar.Value != prog)
                        {
                            this.ProgBar.Value = prog;
                        }
                    }

                    this.FinishedCount++;
                }
                else
                {
                    if (this.Th.IsAlive == false)
                    {
                        this.FinishedCount = 1;
                        return;
                    }

                    {
                        double curr = this.CurrProg;
                        double dest;

                        lock (SYNCROOT)
                        {
                            dest = this.DestProg;
                        }
                        curr -= dest;
                        curr *= 0.9985;
                        curr += dest;

                        this.CurrProg = curr;
                    }

                    {
                        int prog = IntTools.ToInt(this.CurrProg * IntTools.IMAX);

                        prog = IntTools.ToRange(prog);

                        if (this.ProgBar.Value != prog)
                        {
                            this.ProgBar.Value = prog;
                        }
                    }

                    {
                        string message = null;

                        lock (SYNCROOT)
                        {
                            if (this.NextMessage != null)
                            {
                                message          = this.NextMessage;
                                this.NextMessage = null;
                            }
                        }
                        if (message != null)
                        {
                            _メッセージ.Text = message;
                        }
                    }

                    if (this.MT_Count % 20 == 0)
                    {
                        string status;
                        Color  statusColor;

                        lock (SYNCROOT)
                        {
                            status      = this.NextStatus;
                            statusColor = this.NextStatusColor;
                        }
                        if (status != null)
                        {
                            if (_ステータス.Text != status)
                            {
                                _ステータス.Text = status;
                            }
                        }
                        if (statusColor != null)
                        {
                            if (_ステータス.ForeColor != statusColor)
                            {
                                _ステータス.ForeColor = statusColor;
                            }
                        }
                    }

                    if (this.RequestGC)
                    {
                        GC.Collect();
                        this.RequestGC = false;
                    }
                }
            }
            finally
            {
                this.MT_Busy = false;
                this.MT_Count++;
            }
        }