Example #1
0
        private void MS_SetFPS(int value)
        {
            value = IntTools.ToRange(value, Consts.FPS_MIN, Consts.FPS_MAX);             // 2bs

            this.MS_CallSelectedRows(row =>
            {
                int rowidx     = row.Index;
                AudioInfo info = this.MS_GetRow(rowidx);

                if (info.Status == AudioInfo.Status_e.PROCESSING)
                {
                    throw new Exception("処理中の行は変更出来ません。");
                }

                info.FPS = value;

                this.MS_SetRow(rowidx, info);
            });
        }
Example #2
0
        private void MS_SetRowEffect(int rowidx)
        {
            DataGridViewRow row  = this.MainSheet.Rows[rowidx];
            AudioInfo       info = this.MS_GetRow(rowidx);

            Color backColor = Color.White;

            if (info.Status == AudioInfo.Status_e.PROCESSING)
            {
                backColor = Color.FromArgb(222, 255, 222);
            }
            else if (info.Status == AudioInfo.Status_e.ERROR)
            {
                backColor = Color.FromArgb(255, 222, 222);
            }
            else if (info.Status == AudioInfo.Status_e.SUCCESSFUL)
            {
                backColor = Color.FromArgb(222, 222, 255);
            }

            row.DefaultCellStyle.BackColor = backColor;
        }
Example #3
0
        private void 選択行のステータスを解除ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                this.MS_CallSelectedRows(row =>
                {
                    int rowidx     = row.Index;
                    AudioInfo info = this.MS_GetRow(rowidx);

                    if (info.Status != AudioInfo.Status_e.PROCESSING)
                    {
                        info.Status = AudioInfo.Status_e.READY;
                    }

                    this.MS_SetRow(rowidx, info);
                });

                this.StartMSMonitor();
            }
            catch (Exception ex)
            {
                ProcMain.WriteLog(ex);
            }
        }
Example #4
0
        private void AddFile(string file, string dropRootDir = null)
        {
            if (Ground.I.IgnoreBeginDot && Path.GetFileName(file).StartsWith("."))
            {
                ProcMain.WriteLog("半角ピリオドで始まるファイルは無視します。⇒ " + file);
                return;
            }
            if (Ground.I.Config.AudioInfoMax <= this.MainSheet.RowCount + this.AddedInfos.Count)
            {
                throw new Exception("ファイルが多すぎます。");
            }

            if (Ground.I.ImageExtensions.IsImageFile(file))
            {
                int addImageFileMax = Ground.I.Config.AudioInfoMax;                 // 代用

                if (addImageFileMax <= this.AddedImageFiles.Count)
                {
                    throw new Exception("画像ファイルが多すぎます。");
                }

                this.AddedImageFiles.Add(file);
                return;
            }
            AudioInfo info;

            try
            {
                if (File.Exists(file) == false)
                {
                    throw new Exception("no file");
                }

                file = FileTools.MakeFullPath(file);

                if (Ground.I.AudioExtensions.IsAudioFile(file) == false)
                {
                    ProcMain.WriteLog("音楽ファイルではないので追加しません。⇒ " + file);
                    return;
                }
                this.AddedImageFileRejected = true;

                if (Ground.I.じ音楽ファイルを追加させない)
                {
                    bool known = this.KnownAudioFiles.Add(file) == false;
                    //bool known = this.MS_GetRowIndex(row => StringTools.EqualsIgnoreCase(this.MS_GetRow(row.Index).AudioFile, file)) != -1; // old 遅い

                    if (known)
                    {
                        ProcMain.WriteLog("音楽ファイルは重複しています。⇒ " + file);
                        return;
                    }
                }
                string imgFile = Ground.I.DefaultImageFile;

                if (Ground.I.UseSameNameImageFile)
                {
                    string sameNameImgFile = this.TryGetSameNameImageFile(file);

                    if (sameNameImgFile != null)
                    {
                        imgFile = sameNameImgFile;
                    }
                }
                string wFile;

                if (dropRootDir == null)
                {
                    wFile = Path.Combine(Ground.I.OutputDir, Path.GetFileName(file));
                }
                else
                {
                    wFile = FileTools.ChangeRoot(file, dropRootDir, Ground.I.OutputDir);
                }

                wFile = Path.Combine(Path.GetDirectoryName(wFile), Path.GetFileNameWithoutExtension(wFile)) + Consts.MOVIE_EXT;

                info = new AudioInfo()
                {
                    AudioFile = file,
                    ImageFile = imgFile,
                    MovieFile = wFile,
                };
            }
            catch (Exception e)
            {
                ProcMain.WriteLog(e);

                info = new AudioInfo()
                {
                    Status       = AudioInfo.Status_e.ERROR,
                    ErrorMessage = e.Message,
                    AudioFile    = file,
                };
            }
            this.AddedInfos.Add(info);
        }
Example #5
0
        private void MainTimer_Tick(object sender, EventArgs e)
        {
            if (this.MTEnabled == false || this.MTBusy)
            {
                return;
            }

            this.MTBusy = true;

            try
            {
                // ---- 3001

                if (this.RequestCloseWindow)
                {
                    this.RequestCloseWindow = false;
                    this.CloseWindow();
                    this.XPressed = false;
                    return;
                }

                // North >

                if (Ground.I.NorthMessage != "")
                {
                    this.NextNorthMessage = Ground.I.NorthMessage;
                    Ground.I.NorthMessage = "";
                    this.NorthMessageDisplayTimerCountDown = Ground.I.Config.MessageDisplayTimerCountMax;
                }
                if (1 <= this.NorthMessageDisplayTimerCountDown && --this.NorthMessageDisplayTimerCountDown == 0)
                {
                    this.NextNorthMessage = "";
                }

                if (this.NextNorthMessage != null && this.WindowState != FormWindowState.Minimized)                 // 最小化時にコントロールを移動・リサイズすると変になるので、
                {
                    this.North.Text       = this.NextNorthMessage;
                    this.NextNorthMessage = null;

                    if (this.North.Text == "")
                    {
                        this.MainSheet.Top = this.North.Top;
                    }
                    else
                    {
                        this.MainSheet.Top = this.North.Top + this.North.Height + 2;

                        if (Ground.I.NorthStickRight)
                        {
                            this.North.Left = this.MainSheet.Left + this.MainSheet.Width - this.North.Width;
                        }
                        else
                        {
                            this.North.Left = this.MainSheet.Left;
                        }
                    }
                    this.MainSheet.Height = this.SouthBar.Top - this.MainSheet.Top - 3;
                }

                // < North

                if (this.MSMonitor != null && this.MSMonitor.IsStarted())
                {
                    MSMonitor mon = this.MSMonitor;

                    for (int c = 0; c < 300; c++)                     // HACK: ループ回数_適当
                    {
                        if (this.MainSheet.RowCount <= mon.RowIndex)
                        {
                            this.MSMonitorOutput = mon.GetOutput();
                            this.MSMonitorStatus = mon.GetStatus();

                            if (this.MSMonitor.Again)
                            {
                                this.MSMonitor = new MSMonitor();
                            }
                            else
                            {
                                this.MSMonitor = null;
                            }

                            break;
                        }

                        {
                            AudioInfo info = this.MS_GetRow(mon.RowIndex);

                            if (info.Status == AudioInfo.Status_e.READY)
                            {
                                mon.ReadyCount++;
                            }
                            else if (info.Status == AudioInfo.Status_e.PROCESSING)
                            {
                                mon.ProcessingCount++;
                            }
                            else if (info.Status == AudioInfo.Status_e.ERROR)
                            {
                                mon.ErrorCount++;
                            }
                            else if (info.Status == AudioInfo.Status_e.SUCCESSFUL)
                            {
                                mon.SuccessfulCount++;
                            }
                            else
                            {
                                throw null;                                 // never
                            }
                        }

                        mon.RowIndex++;
                    }
                }

                if (this.MTCount % 5 == 0)                 // 頻度を下げる。
                {
                    Ground.I.SouthWestMessage = string.Format(
                        "{0}{1} / {2} 行 中 {3} 行 選択中 / {4}",
                        this.MSMonitor == null ? "" : this.MSMonitor.RowIndex + " ",
                        Ground.I.ConverterActive ? this.PatrolRowIndex + " [コンバータ実行中]" : "[コンバータ停止]",
                        this.MainSheet.RowCount,
                        this.MainSheet.SelectedRows.Count,
                        this.MSMonitorOutput
                        );
                }

                if (Ground.I.Converter.IsCompleted())
                {
                    ConverterTask task   = Ground.I.Converter.GetTask();
                    AudioInfo     info   = task.Info;
                    int           rowidx = this.MS_GetProcessingRowIndex();

                    if (rowidx == -1)
                    {
                        throw null;
                    }

                    this.MS_SetRow(rowidx, info);
                    this.PatrolRowIndex = rowidx + 1;
                    Ground.I.Converter.Reset();

                    this.StartMSMonitor();
                }

                if (1 <= this.MainSheet.RowCount)
                {
                    if (this.MainSheet.RowCount <= this.PatrolRowIndex)
                    {
                        this.PatrolRowIndex = 0;
                    }

                    // ---- Patrol ----

                    if (Ground.I.ConverterActive && Ground.I.Converter.IsReady())
                    {
                        AudioInfo info = this.MS_GetRow(this.PatrolRowIndex);

                        if (info.Status == AudioInfo.Status_e.READY)
                        {
                            info.Status = AudioInfo.Status_e.PROCESSING;
                            this.MS_SetRow(this.PatrolRowIndex, info);
                            Ground.I.Converter.Start(new ConverterTask()
                            {
                                Info = info,
                            });

                            this.StartMSMonitor();
                        }
                    }

                    // ----

                    this.PatrolRowIndex++;
                }

                if (Ground.I.SouthMessage != "")
                {
                    this.South.Text       = Ground.I.SouthMessage;
                    Ground.I.SouthMessage = "";
                    this.SouthMessageDisplayTimerCountDown = Ground.I.Config.MessageDisplayTimerCountMax;
                }
                if (1 <= this.SouthMessageDisplayTimerCountDown && --this.SouthMessageDisplayTimerCountDown == 0)
                {
                    this.South.Text = "";
                }

                if (Ground.I.SouthWestMessage != "")
                {
                    if (this.SouthWest.Text != Ground.I.SouthWestMessage)
                    {
                        this.SouthWest.Text = Ground.I.SouthWestMessage;
                    }

                    Ground.I.SouthWestMessage = "";
                }

                {
                    Color foreColor     = Consts.LabelDefForeColor;
                    Color backColor     = Consts.LabelDefBackColor;
                    bool  completedFlag = false;

                    if (Ground.I.ConverterActive)
                    {
                        bool blink = (this.MTCount / 10) % 2 == 0;

                        switch (this.MSMonitorStatus)
                        {
                        case MSMonitor.Status_e.READY:
                            if (blink)
                            {
                                foreColor = Color.White;
                                backColor = Color.Green;
                            }
                            break;

                        case MSMonitor.Status_e.完了:
                        case MSMonitor.Status_e.完了エラーあり:
                            completedFlag = true;
                            break;

                        case MSMonitor.Status_e.処理中:
                            if (blink)
                            {
                                foreColor = Color.White;
                                backColor = Color.Blue;
                            }
                            break;

                        case MSMonitor.Status_e.処理中エラーあり:
                            if (blink)
                            {
                                foreColor = Color.White;
                                backColor = Color.OrangeRed;
                            }
                            break;

                        default:
                            throw null;                                     // never
                        }
                    }
                    else
                    {
                        switch (this.MSMonitorStatus)
                        {
                        case Charlotte.MSMonitor.Status_e.READY:
                            break;

                        case MSMonitor.Status_e.完了:
                            backColor = Color.Cyan;
                            break;

                        case MSMonitor.Status_e.完了エラーあり:
                            backColor = Color.Orange;
                            break;

                        case MSMonitor.Status_e.処理中:
                            foreColor = Color.FromArgb(0, 0, 100);
                            break;

                        case MSMonitor.Status_e.処理中エラーあり:
                            foreColor = Color.FromArgb(100, 0, 0);
                            break;

                        default:
                            throw null;                                     // never
                        }
                    }
                    if (this.SouthWest.ForeColor != foreColor)
                    {
                        this.SouthWest.ForeColor = foreColor;
                    }

                    if (this.SouthWest.BackColor != backColor)
                    {
                        this.SouthWest.BackColor = backColor;
                    }

                    if (completedFlag)
                    {
                        Ground.I.ConverterActive = false;
                        this.RefreshUI();

                        Ground.I.SouthMessage = "処理完了によりコンバータを停止しました。";
                    }
                }

                if (this.MTCount % 20 == 0)                 // 頻度を下げる。
                {
                    if (Ground.I.ConverterActive && this.MainSheet.RowCount == 0)
                    {
                        Ground.I.ConverterActive = false;
                        this.RefreshUI();

                        Ground.I.SouthMessage = "処理すべきデータが無いのでコンバータを停止しました。";
                    }
                }
            }
            catch (Exception ex)
            {
                ProcMain.WriteLog(ex);
            }
            finally
            {
                this.MTBusy = false;
                this.MTCount++;
            }
        }