Beispiel #1
0
		public int _映像をJPEGで保存する時の画質 = 90; // 0 ~ 100 == 低画質 ~ 高画質

		public void loadData()
		{
			try
			{
				string[] lines = File.ReadAllLines(getDataFile(), Encoding.UTF8);
				int c = 0;

				// items >

				ffmpegDir = lines[c++];
				lastOpenedFile = lines[c++];
				mainWin_L = int.Parse(lines[c++]);
				mainWin_T = int.Parse(lines[c++]);
				mainWin_W = int.Parse(lines[c++]);
				mainWin_H = int.Parse(lines[c++]);
				mainWinMaximized = StringTools.toFlag(lines[c++]);
				selectingColor = IntTools.toColor(int.Parse(lines[c++]));
				selectColor = IntTools.toColor(int.Parse(lines[c++]));
				_ファイルを閉じるとき保存するか確認しない = StringTools.toFlag(lines[c++]);
				_起動時にffmpegのパスを設定する = StringTools.toFlag(lines[c++]);
				_映像をJPEGで保存する = StringTools.toFlag(lines[c++]);
				_映像をJPEGで保存する時の画質 = int.Parse(lines[c++]);

				// < items
			}
			catch
			{ }
		}
Beispiel #2
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            try
            {
                try
                {
                    if (IntTools.isRange(int.Parse(this.txtRelayPortNo.Text), 1, 65535) == false)
                    {
                        throw null;
                    }
                }
                catch
                {
                    throw new FailedOperation(
                              "中継用ポート番号に問題があります。\n" +
                              "・指定できる値は 1 以上 65535 以下の整数です。"
                              );
                }

                // save
                {
                    Ground.i.relayPortNo            = int.Parse(this.txtRelayPortNo.Text);
                    Ground.i.mouseActiveOutOfScreen = this.cbActivateOutOfScreen.Checked;
                }
                this.Close();
            }
            catch (Exception ex)
            {
                FailedOperation.caught(ex);
            }
        }
Beispiel #3
0
        public static int wavFileToCsvFile(string rFile, string wFile, string stdoutFile)
        {
            int hz;

            if (File.Exists(rFile) == false)
            {
                throw new FileNotFoundException(rFile);
            }

            using (WorkingDir wd = new WorkingDir())
            {
                string wHzFile = wd.makePath();

                runCTools("/W2C " + rFile + " " + wFile + " " + wHzFile + " > " + stdoutFile);

                if (File.Exists(wFile) == false)
                {
                    throw new FileNotFoundException(wFile);
                }

                hz = int.Parse(File.ReadAllText(wHzFile, Encoding.ASCII));
            }
            if (IntTools.isRange(hz, 1, IntTools.IMAX) == false)
            {
                throw new Exception(".wav ファイルのサンプリングレートを認識出来ません。" + hz);
            }

            return(hz);
        }
Beispiel #4
0
        private int isTimeSelection() // ret: 0-2 == 選択していない, 選択中, 選択範囲内
        {
            int ret = 0;              // 選択していない

            if (Gnd.i.md == null)
            {
                // noop
            }
            else
            {
                if (Gnd.i.md.ed.a.selectEnd != -1)                 // ? 時間選択_済み
                {
                    int index = this.seekBar.Value;

                    if (IntTools.isRange(index, Gnd.i.md.ed.a.selectBegin, Gnd.i.md.ed.a.selectEnd)) // ? 時間選択_範囲内
                    {
                        ret = 2;                                                                     // 選択範囲内
                    }
                }
                else if (Gnd.i.md.ed.a.selectBegin != -1) // ? 時間選択_中
                {
                    ret = 1;                              // 選択中
                }
            }
            return(ret);
        }
Beispiel #5
0
		public void saveData()
		{
			try
			{
				List<string> lines = new List<string>();

				// items >

				lines.Add(ffmpegDir);
				lines.Add(lastOpenedFile);
				lines.Add("" + mainWin_L);
				lines.Add("" + mainWin_T);
				lines.Add("" + mainWin_W);
				lines.Add("" + mainWin_H);
				lines.Add(StringTools.toString(mainWinMaximized));
				lines.Add("" + IntTools.toInt(selectingColor));
				lines.Add("" + IntTools.toInt(selectColor));
				lines.Add(StringTools.toString(_ファイルを閉じるとき保存するか確認しない));
				lines.Add(StringTools.toString(_起動時にffmpegのパスを設定する));
				lines.Add(StringTools.toString(_映像をJPEGで保存する));
				lines.Add("" + _映像をJPEGで保存する時の画質);

				// < items

				File.WriteAllLines(getDataFile(), lines, Encoding.UTF8);
			}
			catch
			{ }
		}
Beispiel #6
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 = "";
            }
        }
Beispiel #7
0
        public void loadConf()
        {
            try
            {
                List <string> lines = new List <string>();

                foreach (string line in FileTools.readAllLines(getConfFile(), StringTools.ENCODING_SJIS))
                {
                    if (line != "" && line[0] != ';')
                    {
                        lines.Add(line);
                    }
                }

                int c = 0;

                // items >

                ffmpegOptAudio  = lines[c++];
                ffmpegOptVideo  = lines[c++];
                plCountMax      = IntTools.toInt(lines[c++], 1);
                bciCountMax     = IntTools.toInt(lines[c++], 1);
                rFileSizeMax_MB = IntTools.toInt(lines[c++], 1);
                keepDiskFree_MB = IntTools.toInt(lines[c++], 1);

                // < items
            }
            catch
            { }
        }
Beispiel #8
0
        private void MS_Sort(int colidx)
        {
            SortOrder order = this.MainSheet.Columns[colidx].HeaderCell.SortGlyphDirection;

            if (order == SortOrder.Ascending)
            {
                order = SortOrder.Descending;
            }
            else
            {
                order = SortOrder.Ascending;
            }

            if (colidx == 8)             // 数値カラム
            {
                this.MS_Sort((a, b) => IntTools.Comp(
                                 int.Parse("" + a.Cells[colidx].Value),
                                 int.Parse("" + b.Cells[colidx].Value)
                                 ) * (order == SortOrder.Ascending ? 1 : -1));
            }
            else             // その他 ⇒ 文字列カラム
            {
                this.MS_Sort((a, b) => StringTools.CompIgnoreCase(
                                 "" + a.Cells[colidx].Value,
                                 "" + b.Cells[colidx].Value
                                 ) * (order == SortOrder.Ascending ? 1 : -1));
            }

            for (int ci = 0; ci < this.MainSheet.ColumnCount; ci++)
            {
                this.MainSheet.Columns[ci].HeaderCell.SortGlyphDirection = SortOrder.None;
            }
            this.MainSheet.Columns[colidx].HeaderCell.SortGlyphDirection = order;
        }
Beispiel #9
0
        public static void SetCurtain(int frameMax, double destWhiteLevel, double startWhiteLevel)
        {
            frameMax        = IntTools.ToRange(frameMax, 0, 3600);      // 0 frame - 1 min
            destWhiteLevel  = DoubleTools.ToRange(destWhiteLevel, -1.0, 1.0);
            startWhiteLevel = DoubleTools.ToRange(startWhiteLevel, -1.0, 1.0);

            CurtainQueue.Clear();

            if (frameMax == 0)
            {
                CurtainQueue.Enqueue(destWhiteLevel);
            }
            for (int frmcnt = 0; frmcnt <= frameMax; frmcnt++)
            {
                double wl;

                if (frmcnt == 0)
                {
                    wl = startWhiteLevel;
                }
                else if (frmcnt == frameMax)
                {
                    wl = destWhiteLevel;
                }
                else
                {
                    wl = startWhiteLevel + (destWhiteLevel - startWhiteLevel) * ((double)frmcnt / frameMax);
                }

                CurtainQueue.Enqueue(wl);
            }
        }
Beispiel #10
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
            { }
        }
Beispiel #11
0
 public Color getColor()
 {
     return(Color.FromArgb(
                IntTools.toInt((double)_r / _count),
                IntTools.toInt((double)_g / _count),
                IntTools.toInt((double)_b / _count)
                ));
 }
Beispiel #12
0
        //
        //	copied the source file by https://github.com/stackprobe/Factory/blob/master/SubTools/CopyLib.c
        //
        public static void SetAlpha(double a)
        {
            int pal = DoubleTools.ToInt(a * 255.0);

            pal = IntTools.ToRange(pal, 0, 255);

            Extra.A = pal;
        }
Beispiel #13
0
        //
        //	copied the source file by https://github.com/stackprobe/Factory/blob/master/SubTools/CopyLib.c
        //
        public static void SetBlendAdd(double a)
        {
            int pal = DoubleTools.ToInt(a * 255.0);

            pal = IntTools.ToRange(pal, 0, 255);

            Extra.BlendAdd = pal;
        }
Beispiel #14
0
        //
        //	copied the source file by https://github.com/stackprobe/Factory/blob/master/SubTools/CopyLib.c
        //
        public static void SetBright(I3Color color)
        {
            color.R = IntTools.ToRange(color.R, 0, 255);
            color.G = IntTools.ToRange(color.G, 0, 255);
            color.B = IntTools.ToRange(color.B, 0, 255);

            Extra.Bright = color;
        }
Beispiel #15
0
 private LTRB getMaringLTRB()
 {
     return(new LTRB(
                IntTools.toInt(this.marginL.Text, 0, 9999, 100),
                IntTools.toInt(this.marginT.Text, 0, 9999, 100),
                IntTools.toInt(this.marginR.Text, 0, 9999, 100),
                IntTools.toInt(this.marginB.Text, 0, 9999, 100)
                ));
 }
 public void Clamp_ReturnClampedValue(int value, int min, int max)
 {
     _resultOfClamp = IntTools.Clamp(value, min, max);
     if ((_resultOfClamp >= min && _resultOfClamp <= max) || int.Equals(value, _resultOfClamp))
     {
         Assert.Pass();
     }
     else
     {
         Assert.Fail();
     }
 }
Beispiel #17
0
        public static void fillRectangle(Graphics g, Rect rect, Color color)
        {
            // (rect.l, rect.t) から (rect.getR() - 1, rect.getB() - 1) の範囲を塗りつぶしたい。

            g.FillRectangle(
                new SolidBrush(color),
                IntTools.toInt(rect.l),
                IntTools.toInt(rect.t),
                IntTools.toInt(rect.w),
                IntTools.toInt(rect.h)
                );
        }
Beispiel #18
0
        public static void SetSIPixel(int si_h, int x, int y, SIPixel i)
        {
            i.R = IntTools.ToRange(i.R, 0, 255);
            i.G = IntTools.ToRange(i.G, 0, 255);
            i.B = IntTools.ToRange(i.B, 0, 255);
            i.A = IntTools.ToRange(i.A, 0, 255);

            if (DX.DrawPixelSoftImage(si_h, x, y, i.R, i.G, i.B, i.A) != 0)
            {
                throw new GameError();
            }
        }
Beispiel #19
0
        //
        //	copied the source file by https://github.com/stackprobe/Factory/blob/master/SubTools/CopyLib.c
        //
        public static void SetBright(double r, double g, double b)
        {
            int pR = DoubleTools.ToInt(r * 255.0);
            int pG = DoubleTools.ToInt(g * 255.0);
            int pB = DoubleTools.ToInt(b * 255.0);

            pR = IntTools.ToRange(pR, 0, 255);
            pG = IntTools.ToRange(pG, 0, 255);
            pB = IntTools.ToRange(pB, 0, 255);

            Extra.Bright = new I3Color(pR, pG, pB);
        }
        public static void SetSoftImageDot(int siHandle, int x, int y, Dot dot)
        {
            dot.R = IntTools.ToRange(dot.R, 0, 255);
            dot.G = IntTools.ToRange(dot.G, 0, 255);
            dot.B = IntTools.ToRange(dot.B, 0, 255);
            dot.A = IntTools.ToRange(dot.A, 0, 255);

            if (DX.DrawPixelSoftImage(siHandle, x, y, dot.R, dot.G, dot.B, dot.A) != 0)
            {
                throw new DDError();
            }
        }
Beispiel #21
0
        private void BtnOk_Click(object sender, EventArgs e)
        {
            this.OkPressed = true;

            {
                int value = (int)this.FPS.Value;
                value        = IntTools.ToRange(value, Consts.FPS_MIN, Consts.FPS_MAX);
                this.Ret_FPS = value;
            }

            this.Close();
        }
Beispiel #22
0
        public static int getNumOfProcessor()
        {
            int ret = 1;

            try
            {
                ret = int.Parse(Environment.GetEnvironmentVariable("NUMBER_OF_PROCESSORS"));
                ret = IntTools.toRange(ret, 1, 128);                 // HACK
            }
            catch
            { }

            return(ret);
        }
Beispiel #23
0
        private void MS_SetSelectedRowIndex(int rowidx)
        {
            rowidx = IntTools.ToRange(rowidx, -1, this.MainSheet.RowCount - 1);

            if (rowidx == -1)
            {
                this.MainSheet.ClearSelection();
            }
            else
            {
                this.MainSheet.Rows[rowidx].Selected = true;
                this.MS_Scroll(rowidx);
            }
        }
Beispiel #24
0
        private void MillisCommonChanged(TextBox tb, int minval = 0)
        {
            try
            {
                IntTools.Parse(tb.Text, minval, 60000);

                tb.ForeColor = new TextBox().ForeColor;
                tb.BackColor = new TextBox().BackColor;
            }
            catch
            {
                tb.ForeColor = Color.Red;
                tb.BackColor = Color.FromArgb(255, 255, 200);
            }
        }
Beispiel #25
0
            private void add(int x, int y, long scale)
            {
                if (
                    IntTools.isRange(x, 0, _img.Width - 1) &&
                    IntTools.isRange(y, 0, _img.Height - 1)
                    )
                {
                    Color color = _img.GetPixel(x, y);

                    _r     += (long)color.R * scale;
                    _g     += (long)color.G * scale;
                    _b     += (long)color.B * scale;
                    _count += scale;
                }
            }
Beispiel #26
0
        public void loadData()
        {
            try
            {
                string[] lines = File.ReadAllLines(getDataFile(), Encoding.UTF8);
                int      c     = 0;

                // items >

                lastPIIndex       = int.Parse(lines[c++]);
                lastDifficulty    = int.Parse(lines[c++]);
                lastPrinterName   = lines[c++];
                lastPaperSizeName = lines[c++];

                {
                    string line = lines[c++];

                    if (line != "")
                    {
                        List <string> tokens = StringTools.tokenize(line, StringTools.DIGIT, true, true);

                        lastMargin = new LTRB(
                            IntTools.toInt(tokens[0], 0, 9999),
                            IntTools.toInt(tokens[1], 0, 9999),
                            IntTools.toInt(tokens[2], 0, 9999),
                            IntTools.toInt(tokens[3], 0, 9999)
                            );
                    }
                    else
                    {
                        lastMargin = null;
                    }
                }

                lastPrintProblem         = StringTools.toFlag(lines[c++]);
                lastPrintAnswer          = StringTools.toFlag(lines[c++]);
                lv1Color                 = IntTools.toColor(int.Parse(lines[c++]));
                lv2Color                 = IntTools.toColor(int.Parse(lines[c++]));
                lv3Color                 = IntTools.toColor(int.Parse(lines[c++]));
                lv4Color                 = IntTools.toColor(int.Parse(lines[c++]));
                ansColor                 = IntTools.toColor(int.Parse(lines[c++]));
                _合体ナンプレの重なった部分に成丈数字を置かない = StringTools.toFlag(lines[c++]);

                // < items
            }
            catch
            { }
        }
Beispiel #27
0
        private void DrawMap()
        {
            int w = this.Map.W;
            int h = this.Map.H;

            int camL = DDGround.ICamera.X;
            int camT = DDGround.ICamera.Y;
            int camR = camL + DDConsts.Screen_W;
            int camB = camT + DDConsts.Screen_H;

            I2Point lt = Map.ToTablePoint(camL, camT);
            I2Point rb = Map.ToTablePoint(camR, camB);

            lt.X -= 2;             // margin
            lt.Y -= 2;             // margin
            rb.X += 2;             // margin
            rb.Y += 2;             // margin

            lt.X = IntTools.ToRange(lt.X, 0, w - 1);
            lt.Y = IntTools.ToRange(lt.Y, 0, h - 1);
            rb.X = IntTools.ToRange(rb.X, 0, w - 1);
            rb.Y = IntTools.ToRange(rb.Y, 0, h - 1);

            for (int x = lt.X; x <= rb.X; x++)
            {
                for (int y = lt.Y; y <= rb.Y; y++)
                {
                    int mapTileX = x * MapTile.WH + MapTile.WH / 2;
                    int mapTileY = y * MapTile.WH + MapTile.WH / 2;

                    //if (DDUtils.IsOut(new D2Point(mapTileX, mapTileY), new D4Rect(camL, camT, camR, camB), MapTile.WH * 2) == false) // old
                    {
                        MapCell cell = this.Map.GetCell(x, y);

                        if (cell.Tile != null)                         // ? ! 描画無し
                        {
                            DDDraw.DrawCenter(
                                cell.Tile.Picture,
                                mapTileX - camL + this.DrawMap_SlideX,
                                mapTileY - camT + this.DrawMap_SlideY
                                );
                        }
                    }
                }
            }
        }
Beispiel #28
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();
        }
Beispiel #29
0
        public void saveData()
        {
            try
            {
                List <string> lines = new List <string>();

                // items >

                lines.Add("" + lastPIIndex);
                lines.Add("" + lastDifficulty);
                lines.Add(lastPrinterName);
                lines.Add(lastPaperSizeName);

                {
                    string line;

                    if (lastMargin != null)
                    {
                        line = String.Join(", ", lastMargin.l, lastMargin.t, lastMargin.r, lastMargin.b);
                    }
                    else
                    {
                        line = "";
                    }

                    lines.Add(line);
                }

                lines.Add(StringTools.toString(lastPrintProblem));
                lines.Add(StringTools.toString(lastPrintAnswer));
                lines.Add("" + IntTools.toInt(lv1Color));
                lines.Add("" + IntTools.toInt(lv2Color));
                lines.Add("" + IntTools.toInt(lv3Color));
                lines.Add("" + IntTools.toInt(lv4Color));
                lines.Add("" + IntTools.toInt(ansColor));
                lines.Add(StringTools.toString(_合体ナンプレの重なった部分に成丈数字を置かない));

                // < items

                File.WriteAllLines(getDataFile(), lines, Encoding.UTF8);
            }
            catch
            { }
        }
Beispiel #30
0
        public VideoSelectWin(Bitmap frameImage, Rect ownerRect)
        {
            _frameImage = frameImage;
            _ownerRect  = ownerRect;

            InitializeComponent();

            this.MinimumSize    = this.Size;
            this.imgFrame.Image = _frameImage;

            {
                Rect rect = getInitSelectRect();

                txtL.Text = "" + IntTools.toInt(rect.l);
                txtT.Text = "" + IntTools.toInt(rect.t);
                txtW.Text = "" + IntTools.toInt(rect.w);
                txtH.Text = "" + IntTools.toInt(rect.h);
            }
        }