Exemplo n.º 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;
                }
            }
        }
Exemplo n.º 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();
        }
Exemplo n.º 3
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;
            }
        }
Exemplo n.º 4
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);
            }
        }
Exemplo n.º 5
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;
        }
Exemplo n.º 6
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;
            }
        }