Пример #1
0
        private void BtnSelectDir_Click(object sender, EventArgs e)
        {
            string dir = this.SelectedDir.Text;

            if (this.Dirじゃなくて読み込みファイル)
            {
                string file = dir;

                file = SaveLoadDialogs.LoadFile(
                    this.DirKindTitle + "を選択して下さい。",
                    "",
                    file == "" ? Environment.GetFolderPath(Environment.SpecialFolder.Desktop) : Path.GetDirectoryName(file),
                    file == "" ? this.File_InitialFile : Path.GetFileName(file),
                    dlg => dlg.Filter = this.File_Filter
                    );

                if (file != null)
                {
                    this.SelectedDir.Text = file;
                }
            }
            else
            {
                if (SaveLoadDialogs.SelectFolder(ref dir, this.DirKindTitle + "を選択して下さい。"))
                {
                    this.SelectedDir.Text = dir;
                }
            }
        }
Пример #2
0
        private void  像用の画像を設定するToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.BeforeDialog();

            try
            {
                this.GetSelectedRow();                 // 行を選択しているか確認

                string file = SaveLoadDialogs.LoadFile(
                    "映像用の画像を選択して下さい。",
                    "",
                    Environment.GetFolderPath(Environment.SpecialFolder.Desktop),
                    Consts.IMAGE_INITIAL_FILE,
                    dlg => dlg.Filter = Consts.IMAGE_FILTER
                    );

                if (file != null)
                {
                    this.MS_SetImageFiles(new string[] { file });
                }
            }
            catch (Exception ex)
            {
                ProcMain.WriteLog(ex);

                MessageBox.Show(ex.Message, "映像用の画像の設定に失敗しました", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }

            this.AfterDialog();
        }
Пример #3
0
        private void btnExport_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtIdent.Text == "")                 // ? 未生成
                {
                    throw new FailedOperation("鍵を生成して下さい。");
                }

                string keyFile = SaveLoadDialogs.SaveFile(
                    "保存先の鍵ファイルを選択してください",
                    "鍵:unreal-remo-key",
                    Environment.GetFolderPath(Environment.SpecialFolder.Desktop),
                    this.txtIdent.Text + ".unreal-remo-key"
                    );

                if (keyFile != null)
                {
                    XNode root = new XNode("UnrealRemoco-Key");

                    root.children.Add(new XNode("Ident", this.txtIdent.Text));
                    root.children.Add(new XNode("Key", this.txtRaw.Text));
                    root.children.Add(new XNode("Hash", this.txtHash.Text));

                    root.save(keyFile);

                    throw new Completed("鍵ファイルに保存しました。");
                }
            }
            catch (Exception ex)
            {
                FailedOperation.caught(ex);
            }
        }
Пример #4
0
        private void ファイルから読み込みRToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.mtEnabled = false;
            try
            {
                string initDir   = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
                string initLFile = "きららプレイリスト.krrpl";

                if (Gnd.i.lastPlayListFile != "")
                {
                    initDir   = Path.GetDirectoryName(Gnd.i.lastPlayListFile);
                    initLFile = Path.GetFileName(Gnd.i.lastPlayListFile);
                }

                string plFile = SaveLoadDialogs.LoadFile("開くプレイリスト・ファイルを選択してください", "きららプレイリスト:krrpl", initDir, initLFile);

                if (plFile != null)
                {
                    plFile = FileTools.toFullPath(plFile);
                    Gnd.i.lastPlayListFile = plFile;

                    List <MediaInfo> mis = new List <MediaInfo>();

                    foreach (string file in FileTools.readAllLines(plFile, Encoding.UTF8))
                    {
                        if (
                            file != "" &&
                            file[0] != ';'
                            )
                        {
                            mis.Add(MediaInfo.create(file));
                        }
                    }
                    int startPos = plSheet.RowCount;

                    plSheet.RowCount += mis.Count;

                    for (int index = 0; index < mis.Count; index++)
                    {
                        plSheetSetRow(startPos + index, mis[index]);
                    }
                }
            }
            catch (Exception ex)
            {
                FailedOperation.caught(ex);
            }
            finally
            {
                this.mtEnabled = true;
            }
        }
Пример #5
0
        private void ファイルに保存AToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.mtEnabled = false;
            try
            {
                List <string> pl = new List <string>();

                pl.Add("; きららプレイリスト");
                pl.Add("; 空行と ; で始まる行は無視します。");
                pl.Add("; エンコード = UTF-8");

                for (int rowidx = 0; rowidx < plSheet.RowCount; rowidx++)
                {
                    pl.Add(plSheetGetRow(rowidx).file);
                }

                string initDir   = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
                string initLFile = "きららプレイリスト.krrpl";

                if (Gnd.i.lastPlayListFile != "")
                {
                    initDir   = Path.GetDirectoryName(Gnd.i.lastPlayListFile);
                    initLFile = Path.GetFileName(Gnd.i.lastPlayListFile);
                }

                string plFile = SaveLoadDialogs.SaveFile("プレイリストの保存先を選択してください", "きららプレイリスト:krrpl", initDir, initLFile);

                if (plFile != null)
                {
                    plFile = FileTools.toFullPath(plFile);
                    Gnd.i.lastPlayListFile = plFile;

                    File.WriteAllLines(plFile, pl, Encoding.UTF8);

                    MessageBox.Show(
                        "プレイリストを保存しました。",
                        "情報",
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Information
                        );
                }
            }
            catch (Exception ex)
            {
                FailedOperation.caught(ex);
            }
            finally
            {
                this.mtEnabled = true;
            }
        }
Пример #6
0
        private void btnImport_Click(object sender, EventArgs e)
        {
            try
            {
                string keyFile = SaveLoadDialogs.LoadFile(
                    "鍵ファイルを選択してください",
                    "鍵:unreal-remo-key",
                    Environment.GetFolderPath(Environment.SpecialFolder.Desktop),
                    "default.unreal-remo-key"
                    );

                if (keyFile != null)
                {
                    XNode root = XNode.load(keyFile);

                    string ident = root.get("Ident").value;
                    string key   = root.get("Key").value;
                    string hash  = root.get("Hash").value;

                    if (ident != JString.toJString(ident, false, false, false, false))
                    {
                        throw new FailedOperation("鍵ファイルが壊れています。(Ident format)");
                    }

                    if (ident.Length < 1 || 100 < ident.Length)                     // HACK: 上限適当
                    {
                        throw new FailedOperation("鍵ファイルが壊れています。(Ident length)");
                    }

                    if (StringTools.hex(key).Length != 64)
                    {
                        throw new FailedOperation("鍵ファイルが壊れています。(Key length)");
                    }

                    if (hash != Ground.KeyData.getHash(key))
                    {
                        throw new FailedOperation("鍵ファイルが壊れています。(Hash)");
                    }

                    txtIdent.Text = ident;
                    txtRaw.Text   = key;
                    txtHash.Text  = hash;

                    throw new Completed("鍵をインポートしました。");
                }
            }
            catch (Exception ex)
            {
                FailedOperation.caught(ex);
            }
        }
Пример #7
0
        public static void ChooseFolder(Form parent, TextBox tb, bool newFolderOk = true)
        {
            string dir = tb.Text;

            if (dir == "" || Directory.Exists(dir) == false)
            {
                dir = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
            }

            if (SaveLoadDialogs.SelectFolder(ref dir, "フォルダを指定してください。"))
            {
                tb.Text = dir;
            }
        }
Пример #8
0
        private void BtnExport_Click(object sender, EventArgs e)
        {
            try
            {
                string destFile = TimeData.Now().GetSimpleString() + ".xml";

                for (; ;)
                {
                    destFile = SaveLoadDialogs.SaveFile("保存先の設定ファイルを入力してください", "設定:xml", GetSettingDir(), Path.GetFileName(destFile));

                    if (destFile != null)
                    {
#if false
                        if (destFile.StartsWith("\\\\"))
                        {
                            MessageBox.Show(
                                "ネットワークパスは使用できません。",
                                "ファイル名に問題があります",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Warning
                                );
                            continue;
                        }
                        if (JString.IsJString(destFile, true, false, false, true, false) == false)
                        {
                            MessageBox.Show(
                                "Shift_JIS で表現出来ない文字は使用できません。",
                                "ファイル名に問題があります",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Warning
                                );
                            continue;
                        }
#endif
                        this.DoExport(destFile);
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(
                    this,
                    "" + ex,
                    "エクスポートに失敗しました",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Warning
                    );
            }
        }
Пример #9
0
        private void editColor(Panel pnl)
        {
            int[] customColors = new int[]
            {
                0x33, 0x66, 0x99, 0xCC, 0x3300, 0x3333,
                0x3366, 0x3399, 0x33CC, 0x6600, 0x6633,
                0x6666, 0x6699, 0x66CC, 0x9900, 0x9933,
            };

            Color color = pnl.BackColor;

            if (SaveLoadDialogs.SelectColor(ref color, customColors))
            {
                pnl.BackColor = color;
            }
        }
Пример #10
0
        private void RecEnded()
        {
            if (Gnd.I.RecEndUnmin)
            {
                this.WindowState = FormWindowState.Normal;
            }

            string destFile = TimeData.Now().GetSimpleString() + ".bat";

            for (; ;)
            {
                destFile = SaveLoadDialogs.SaveFile("保存先のバッチファイルを入力してください", "バッチ:bat", Gnd.I.OutDir, Path.GetFileName(destFile));

                if (destFile != null)
                {
                    if (destFile.StartsWith("\\\\"))
                    {
                        MessageBox.Show(
                            "ネットワークパスは使用できません。",
                            "ファイル名に問題があります",
                            MessageBoxButtons.OK,
                            MessageBoxIcon.Warning
                            );
                        continue;
                    }
                    if (JString.IsJString(destFile, true, false, false, true, false) == false)
                    {
                        MessageBox.Show(
                            "Shift_JIS で表現出来ない文字は使用できません。",
                            "ファイル名に問題があります",
                            MessageBoxButtons.OK,
                            MessageBoxIcon.Warning
                            );
                        continue;
                    }
                    Gnd.I.OutDir = Path.GetDirectoryName(destFile);

                    this.SaveData();                     // 設定反映!!!

                    BusyDlg.Perform(delegate
                    {
                        new BatchConv(Gnd.I.RecFile, destFile).Perform();
                    });
                }
                break;
            }
        }
Пример #11
0
        private void ファイルを開くOToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.mtEnabled = false;

            try
            {
                confirmSaveFile(false, true, false);

                string presetFile = Gnd.i.lastOpenedFile;

                string selectedFile = selectedFile = SaveLoadDialogs.LoadFile(
                    "動画ファイルを選択してください",
                    "",
                    Path.GetDirectoryName(presetFile),
                    Path.GetFileName(presetFile),
                    dlg =>
                {
                    dlg.Filter      = Gnd.i.movieExtensions.getFilter();
                    dlg.FilterIndex = Gnd.i.movieExtensions.indexOf(".mp4") + 1;
                });

                if (selectedFile != null)
                {
                    BusyDlg.perform(delegate
                    {
                        if (Gnd.i.md != null)
                        {
                            Gnd.i.md.Dispose();
                            Gnd.i.md = null;
                        }
                        Gnd.i.md = new MediaData(selectedFile);
                    });
                }
            }
            catch (Exception ex)
            {
                FailedOperation.caught(ex);
            }

            refreshTitle();
            refreshVideo();
            refreshEnable();

            this.mtEnabled = true;
        }
Пример #12
0
        private void chooseFFmpegDir()
        {
            string description = "ffmpeg のパスを指定してください。\n例) C:\\app\\ffmpeg-3.2.4-win64-shared";

            if (Environment.Is64BitOperatingSystem == false)             // ? OS == 32-bit
            {
                description = description.Replace("64", "32");
            }

            if (SaveLoadDialogs.SelectFolder(ref Gnd.i.ffmpegDir, description, dlg =>
            {
                dlg.RootFolder = Environment.SpecialFolder.MyComputer;
                dlg.ShowNewFolderButton = false;
            }
                                             ))
            {
                Gnd.i.ffmpegDir = FileTools.toFullPath(Gnd.i.ffmpegDir);
            }
        }
Пример #13
0
        private void  前を付けて保存AToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.mtEnabled = false;

            try
            {
                if (Gnd.i.md == null)
                {
                    return;
                }

                string presetFile = Gnd.i.md.ed.getLastSavedFile();
                //string presetFile = Gnd.i.md.getOriginalFile(); // old

                string selectedFile = SaveLoadDialogs.SaveFile(
                    "保存先のファイルを選択してください",
                    "",
                    Path.GetDirectoryName(presetFile),
                    Path.GetFileName(presetFile),
                    dlg =>
                {
                    dlg.Filter      = Gnd.i.movieExtensions.getFilter();
                    dlg.FilterIndex = Gnd.i.movieExtensions.indexOf(".mp4") + 1;
                });

                if (selectedFile != null)
                {
                    BusyDlg.perform(delegate
                    {
                        Gnd.i.md.ed.saveFile(selectedFile);
                    });
                }
            }
            catch (Exception ex)
            {
                FailedOperation.caught(ex);
            }

            refreshTitle();

            this.mtEnabled = true;
        }
Пример #14
0
        private void btnRGB_Click(object sender, EventArgs e)
        {
            int[] customColors = new int[]
            {
                0x33, 0x66, 0x99, 0xCC, 0x3300, 0x3333,
                0x3366, 0x3399, 0x33CC, 0x6600, 0x6633,
                0x6666, 0x6699, 0x66CC, 0x9900, 0x9933,
            };

            Color color = _color;

            if (SaveLoadDialogs.SelectColor(ref color, customColors))
            {
                _color = Color.FromArgb(
                    _color.A,
                    color.R,
                    color.G,
                    color.B
                    );
            }
            refreshUI();
        }
Пример #15
0
        private void Btn再生開始_Click(object sender, EventArgs e)
        {
            if (Gnd.I.Proc再生 != null)             // ? already started
            {
                return;
            }

            this.MT_Enabled = false;

            try
            {
                string selFile = SaveLoadDialogs.LoadFile("実行するバッチファイルを選択して下さい", "バッチ:bat", Gnd.I.OutDir, "*.bat");

                if (selFile != null)
                {
                    if (selFile.StartsWith("\\\\"))
                    {
                        MessageBox.Show(
                            "ネットワークパスは開けません。",
                            "ファイル名に問題があります",
                            MessageBoxButtons.OK,
                            MessageBoxIcon.Warning
                            );
                        return;
                    }
                    if (JString.IsJString(selFile, true, false, false, true, false) == false)
                    {
                        MessageBox.Show(
                            "Shift_JIS で表現出来ない文字を含むパスは開けません。",
                            "ファイル名に問題があります",
                            MessageBoxButtons.OK,
                            MessageBoxIcon.Warning
                            );
                        return;
                    }
                    if (StringTools.IsSame(".bat", Path.GetExtension(selFile), true) == false)
                    {
                        MessageBox.Show(
                            "選択されたパスはバッチファイルではありません。",
                            "ファイル名に問題があります",
                            MessageBoxButtons.OK,
                            MessageBoxIcon.Warning
                            );
                        return;
                    }
                    Gnd.I.LastRanBatFile = selFile;
                    Gnd.I.OutDir         = Path.GetDirectoryName(Gnd.I.LastRanBatFile);

                    Gnd.I.Proc再生 = CommonTools.StartProc(Gnd.I.LastRanBatFile);
                    this.RefreshUi();

                    if (Gnd.I.StartMin)
                    {
                        this.WindowState = FormWindowState.Minimized;
                    }
                }
            }
            finally
            {
                GC.Collect();
                this.MT_Enabled = true;
            }
        }