Exemple #1
0
        public void RenameSubForm_Resize(object sender, EventArgs e)
        {
            P_CurrentWork.Height      = (int)(Height / 7.25);
            progressBar.Font          = new Font("Century Gothic", (float)(27.75).Scale(Math.Min(P_Main.Width, P_Main.Height) - 432, 27.75, 36, 0.014), FontStyle.Bold);
            progressBar.Size          = new Size(250 + (Math.Min(P_Main.Width, P_Main.Height) - 432) * 25 / 100, 250 + (Math.Min(P_Main.Width, P_Main.Height) - 432) * 25 / 100);
            progressBar.OuterMargin   = progressBar.Width / -10;
            progressBar.OuterWidth    = progressBar.Width / 10;
            progressBar.ProgressWidth = progressBar.Width / 10 + 3;
            P_InfoTextContainer.Size  = new Size(75 + P_Main.Width * 40 / 100, 100 + P_Main.Height * 40 / 100);
            P_InfoText.Size           = new Size(P_InfoTextContainer.Width - 30, P_InfoTextContainer.Height - 30);
            P_InfoLeft.Size           = new Size(P_InfoText.Width / 2, P_InfoText.Height);
            var h = P_InfoText.Height / (P_InfoLeft.Controls.Count - (MovieMode ? 2 : 1) - (O_IncludeSubs ? 0 : 1));

            foreach (var item in P_InfoLeft.Controls)
            {
                if (item is Label)
                {
                    (item as Label).Height = h;
                }
            }
            foreach (var item in P_InfoRight.Controls)
            {
                if (item is Label)
                {
                    (item as Label).Height = h;
                }
            }
            P_InfoTextContainer.Center(P_Main, .1);
            P_InfoText.Center(P_InfoTextContainer, 1);
            progressBar.Location = new Point((P_Main.Width - P_InfoTextContainer.Width - P_InfoTextContainer.Location.X - progressBar.Width) / 2 + P_InfoTextContainer.Width + P_InfoTextContainer.Location.X, (P_Main.Height - progressBar.Height) / 2);
            B_Done.Center(P_CurrentWork, .5, .9);
        }
Exemple #2
0
 public override void Refresh()
 {
     P_Main.BackColor    = inputboxName.BackColor = inputBoxYear.BackColor = Design.BackColor;
     ForeColor           = inputboxName.ForeColor = inputBoxYear.ForeColor = Design.ForeColor;
     L_Message.ForeColor = Design.TitleForeColor;
     B_Done.Refresh();
 }
Exemple #3
0
 private void B_Done_Click(object sender, EventArgs e)
 {
     Form1.mainSubForm.RefreshFolder();
     Form1.mainSubForm.Show();
     Hide();
     B_Done.Hide();
     progressBar.Value = 0;
 }
Exemple #4
0
        public void Start()
        {
            LoadingTimer.Start();
            new Action(() =>
            {
                CurrentFormState = FormState.Running;
                if (MovieMode)
                {
                    foreach (var Movie in Movies.OrderBy(x => x.Name))
                    {
                        try
                        {
                            foreach (var Sub in Movie.Subs)
                            {
                                try
                                {
                                    if (!File.Exists(Sub.Destination))
                                    {
                                        File.Move(Sub.FilePath, Sub.Destination);
                                    }
                                    SubsDone++;
                                    UpdateNumbers(Sub.ToString());
                                    Thread.Sleep(100);
                                }
                                catch (Exception ex)
                                { IncreaseError(ex); }
                            }
                            if (!File.Exists(Movie.Destination))
                            {
                                File.Move(Movie.FilePath, Movie.Destination);
                            }
                            MoviesDone++;
                            UpdateNumbers(Movie.ToString());
                            Thread.Sleep(100);
                        }
                        catch (Exception ex)
                        { IncreaseError(ex); }
                    }
                }
                else
                {
                    foreach (var Season in Seasons.OrderBy(x => x.SeasonNumber))
                    {
                        foreach (var Episode in Season.Episodes.OrderBy(x => x.EpisodeNumber))
                        {
                            try
                            {
                                foreach (var Sub in Episode.Subs)
                                {
                                    try
                                    {
                                        if (!File.Exists(Sub.Destination))
                                        {
                                            File.Move(Sub.FilePath, Sub.Destination);
                                        }
                                        SubsDone++;
                                        UpdateNumbers(Sub.ToString());
                                        Thread.Sleep(100);
                                    }
                                    catch (Exception ex)
                                    { IncreaseError(ex); }
                                }
                                if (!File.Exists(Episode.Destination))
                                {
                                    File.Move(Episode.FilePath, Episode.Destination);
                                }
                                EpisodesDone++;
                                UpdateNumbers(Episode.ToString());
                                Thread.Sleep(100);
                            }
                            catch (Exception ex)
                            { IncreaseError(ex); }
                        }
                        SeasonsDone++;
                        UpdateNumbers(Season.ToString());
                    }
                }
                Invoke(new Action(() => { L_CurrentWork.Text = "Cleaning Up..."; }));

                if (O_CleanFolders)
                {
                    try
                    {
                        foreach (var item in JunkFiles)
                        {
                            try
                            {
                                var file        = new FileInfo(item);
                                file.Attributes = file.Attributes & ~FileAttributes.ReadOnly;
                                file.Delete();
                            }
                            catch (Exception ex) { IncreaseError(ex); }
                        }


                        foreach (var item in Directory.GetDirectories(FolderPath, "*", SearchOption.AllDirectories))
                        {
                            if (DirectoryIsEmpty(item))
                            {
                                try
                                {
                                    var dir        = new DirectoryInfo(item);
                                    dir.Attributes = dir.Attributes & ~FileAttributes.ReadOnly;
                                    foreach (var fil in Directory.GetFiles(item, "*", SearchOption.AllDirectories))
                                    {
                                        var file        = new FileInfo(fil);
                                        file.Attributes = file.Attributes & ~FileAttributes.ReadOnly;
                                        file.Delete();
                                    }
                                    dir.Delete();
                                }
                                catch (Exception ex) { IncreaseError(ex); }
                            }
                        }

                        if (!MovieMode && !Directory.Exists(Directory.GetParent(FolderPath).FullName + "\\" + SeriesName))
                        {
                            Directory.Move(FolderPath, Directory.GetParent(FolderPath).FullName + "\\" + SeriesName);
                        }
                    }
                    catch (Exception ex) { IncreaseError(ex); }
                }

                Invoke(new Action(() =>
                {
                    CurrentFormState = FormState.Normal;
                    B_Done.Show();
                    L_CurrentWork.Text = "";
                    if (L_Errors.Text != "0")
                    {
                        progressBar.Value         = progressBar.Maximum;
                        progressBar.Text          = "100";
                        progressBar.ProgressColor = Color.FromArgb(242, 60, 53);
                        LoadingTimer.Dispose();
                        LoadingTimer = null;
                    }
                    if (ErrorList != "")
                    {
#if DEBUG
                        File.WriteAllText(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\Renamer Log.txt", ErrorList);
#else
                        if (MessageBox.Show("Errors Occured, would you like to save the Error Log?", "Save Error Log?", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
                        {
                            File.WriteAllText(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\Renamer Log.txt", ErrorList);
                        }
#endif
                    }
                }));
            }).RunInBackground(1250);
        }