コード例 #1
0
        public static void ShowDialog(string path, FileNameFormat fn)
        {
            RemTrackDialog dlg = new RemTrackDialog(path, fn);

            dlg.Owner = MainForm.Main;
            dlg.ShowDialog();
        }
コード例 #2
0
        public static void ShowDialog(string path, FileNameFormat fn)
        {
            FileMarkerDialog dlg = new FileMarkerDialog(path, fn);

            dlg.Owner = MainForm.Main;
            dlg.ShowDialog();
        }
コード例 #3
0
ファイル: RemTrackDialog.cs プロジェクト: jollywho/LFI
        public RemTrackDialog(string path, FileNameFormat fn)
        {
            InitializeComponent();
            MainForm.Main.WindowState = FormWindowState.Normal;
            this.WindowState = MainForm.Main.WindowState;
            this.TopMost = MainForm.Main.TopMost;

            file = fn;
            fileformat = fn.Format;
            dirname = path;
        }
コード例 #4
0
        public RemTrackDialog(string path, FileNameFormat fn)
        {
            InitializeComponent();
            MainForm.Main.WindowState = FormWindowState.Normal;
            this.WindowState          = MainForm.Main.WindowState;
            this.TopMost = MainForm.Main.TopMost;

            file       = fn;
            fileformat = fn.Format;
            dirname    = path;
        }
コード例 #5
0
ファイル: FileMarkerDialog.cs プロジェクト: jollywho/LFI
        public FileMarkerDialog(string path, FileNameFormat fn)
        {
            InitializeComponent();
            MainForm.Main.WindowState = FormWindowState.Normal;
            this.WindowState = MainForm.Main.WindowState;
            this.TopMost = MainForm.Main.TopMost;

            file = fn;
            fileformat = fn.Format;
            dirname = path;

            txtGroup.Text = fn.EstimateGroup();
            txtStart.Text = fn.EstimateEpisode();
            txtSeason.Text = fn.EstimateSeason();
            txtTitle.Text = fn.EstimateTitle();
        }
コード例 #6
0
        public FileMarkerDialog(string path, FileNameFormat fn)
        {
            InitializeComponent();
            MainForm.Main.WindowState = FormWindowState.Normal;
            this.WindowState          = MainForm.Main.WindowState;
            this.TopMost = MainForm.Main.TopMost;

            file       = fn;
            fileformat = fn.Format;
            dirname    = path;

            txtGroup.Text  = fn.EstimateGroup();
            txtStart.Text  = fn.EstimateEpisode();
            txtSeason.Text = fn.EstimateSeason();
            txtTitle.Text  = fn.EstimateTitle();
        }
コード例 #7
0
 private void LoadFormatFields()
 {
     if (!showFields || multiRun)
     {
         Console.WriteLine("----DENIED");
         return;
     }
     Console.WriteLine("----FORMATS");
     for (int i = 0; i < gvFiles.RowCount; i++)
     {
         if (!Directory.Exists(gvFiles.Rows[i].Cells[3].Value.ToString()))
         {
             FileNameFormat fn = new FileNameFormat(gvFiles.Rows[i].Cells[2].Value.ToString(), (EPFORMAT)ddFormat.SelectedValue);
             gvFiles.Rows[i].Cells[4].Value = fn.EstimateGroup();
             gvFiles.Rows[i].Cells[5].Value = fn.EstimateSeason();
             gvFiles.Rows[i].Cells[6].Value = fn.EstimateEpisode();
             gvFiles.Rows[i].Cells[7].Value = fn.EstimateCRC();
         }
     }
 }
コード例 #8
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (!ValidateFields())
            {
                return;
            }
            string filename = string.Empty;

            try
            {
                if (txtGroup.Text.Length > 1)
                {
                    filename = '[' + txtGroup.Text + ']' + ' ';
                }
                filename += txtTitle.Text + FileNameFormat.ToFormat(txtStart.Text, txtSeason.Text, fileformat);

                string fullpath = Path.Combine(dirname, filename.Replace(' ', '_'));
                file.FileName = fullpath;
                if (txtEnd.Text.Length > 1)
                {
                    fullpath = file.FileName.Replace(file.EstimateEpisode(), file.EstimateEpisode() + "-" + txtEnd.Text);
                }

                fullpath = Path.ChangeExtension(fullpath, radType_Filler.Checked ? "filler" : "missing");

                if (File.Exists(fullpath))
                {
                    Error_Handle.TipError("Title Already Exists\n", toolTip, txtTitle);
                    return;
                }
                imgWorking.Visible = true;
                File.CreateText(fullpath);
                Close();
            }
            catch (Exception ex)
            {
                Error_Handle.TipError("Error Creating File : " + ex.Message, toolTip, txtTitle);
            }
        }
コード例 #9
0
ファイル: RemTrackDialog.cs プロジェクト: jollywho/LFI
 public static void ShowDialog(string path, FileNameFormat fn)
 {
     RemTrackDialog dlg = new RemTrackDialog(path, fn);
     dlg.Owner = MainForm.Main;
     dlg.ShowDialog();
 }
コード例 #10
0
ファイル: FileMarkerDialog.cs プロジェクト: jollywho/LFI
 public static void ShowDialog(string path, FileNameFormat fn)
 {
     FileMarkerDialog dlg = new FileMarkerDialog(path, fn);
     dlg.Owner = MainForm.Main;
     dlg.ShowDialog();
 }
コード例 #11
0
ファイル: folderView.cs プロジェクト: jollywho/LFI
 private void LoadFormatFields()
 {
     if (!showFields || multiRun)
     {
         Console.WriteLine("----DENIED");
         return;
     }
     Console.WriteLine("----FORMATS");
     for (int i = 0; i < gvFiles.RowCount; i++)
     {
         if (!Directory.Exists(gvFiles.Rows[i].Cells[3].Value.ToString()))
         {
             FileNameFormat fn = new FileNameFormat(gvFiles.Rows[i].Cells[2].Value.ToString(), (EPFORMAT)ddFormat.SelectedValue);
             gvFiles.Rows[i].Cells[4].Value = fn.EstimateGroup();
             gvFiles.Rows[i].Cells[5].Value = fn.EstimateSeason();
             gvFiles.Rows[i].Cells[6].Value = fn.EstimateEpisode();
             gvFiles.Rows[i].Cells[7].Value = fn.EstimateCRC();
         }
     }
 }
コード例 #12
0
        /// <summary>
        /// Renames a file with a prefix, title, episode, and suffix into a standard format.
        /// </summary>
        /// <param name="filename">The fullpath filename.</param>
        /// <param name="prefix">The prefix for the front.</param>
        /// <param name="title">The title.</param>
        /// <param name="episode">The episode.</param>
        /// <param name="suffix">The suffix for the end.</param>
        /// <param name="newfilename">Just the filename.</param>
        /// <param name="skipped">A skipped message.</param>
        /// <returns>The fullpath filename.</returns>
        public static string RenameFile(string filename,
                                        string prefix, string title, string season, string episode, string suffix, EPFORMAT format,
                                        out string newfilename, out bool skipped)
        {
            FileInfo file         = new FileInfo(filename);
            string   destfilename = string.Empty;

            skipped = false;
            int outIgnore;

            try
            {
                if (prefix.Trim().Length >= 1)
                {
                    destfilename = '[' + prefix + ']' + ' ';
                }
                destfilename += title;

                if (episode.Trim().Length < 1)
                {
                    skipped = true;
                }
                else if (!int.TryParse(episode, out outIgnore))
                {
                    skipped = true;
                }
                else if (season.Trim().Length >= 1 && !int.TryParse(season, out outIgnore))
                {
                    skipped = true;
                }
                else
                {
                    destfilename += FileNameFormat.ToFormat(episode, season, format);
                }

                if (suffix.Trim().Length >= 1)
                {
                    destfilename += " [" + suffix + "]";
                }
                destfilename = destfilename.Replace(' ', '_');
                FixExtension(file);
                file.Refresh();
                if (!skipped)
                {
                    file.MoveTo(file.FullName.Replace(file.Name, destfilename) + file.Extension);
                }
                file.Refresh();
            }
            catch (IOException)
            {
                skipped = true;
                BetterDialog.ShowDialog("Rename Error",
                                        string.Format("Cannot Rename File: {0}\nFile Already Exists As: {1}", file.Name, destfilename),
                                        "", "", "OK", null, BetterDialog.ImageStyle.Icon);
            }
            finally
            {
                newfilename = Path.GetFileName(file.Name);
            }
            return(file.FullName);
        }