Пример #1
0
        private void S3_Work()
        {
            while (Data.Session.Stage == 3 && Data.Session.SecondPassFolders.Count >= Data.Session.LastSecondPass + 1)
            {
                if (Data.Session.LastSecondPass >= Data.Session.SecondPassFolders.Count)
                {
                    break;
                }

                var item = Data.Session.SecondPassFolders[Data.Session.LastSecondPass++];

                Invoke(new Action(() =>
                {
                    L_SecondPass_Info.Text = item.Name;
                    TaskbarProgress.SetValue(Handle, 5000 + 2500d * Data.Session.LastSecondPass / Data.Session.SecondPassFolders.Count, 10000);
                }));

                var error = IconMatcher.ReMatch(item);

                PGB_SecondPass.Percentage = 100d * Data.Session.LastSecondPass / Data.Session.SecondPassFolders.Count;

                if (error != null)
                {
                    Data.Session.StageErrors[3]++;
#if DEBUG
                    Data.Session.Exceptions.Add(error);
#endif
                }
            }

            if (Data.Session.Stage == 3)
            {
                Stage_4();
            }
        }
Пример #2
0
        private void S2_Work()
        {
            while (Data.Session.Stage == 2 && Data.Session.Folders.Count >= Data.Session.LastFolder + 1)
            {
                if (Data.Session.LastFolder >= Data.Session.Folders.Count)
                {
                    break;
                }

                var item = Data.Session.Folders[Data.Session.LastFolder++];

                Invoke(new Action(() =>
                {
                    L_Folders_Info.Text = item.Name;
                    TaskbarProgress.SetValue(Handle, 2500 + 2500d * Data.Session.LastFolder / Data.Session.Folders.Count, 10000);
                }));

                var error = IconMatcher.Match(item);

                PGB_Folders.Percentage = 100d * Data.Session.LastFolder / Data.Session.Folders.Count;

                if (error != null)
                {
                    Data.Session.StageErrors[2]++;
#if DEBUG
                    Data.Session.Exceptions.Add(error);
#endif
                }
            }

            if (Data.Session.Stage == 2)
            {
                Stage_3();
            }
        }
Пример #3
0
        private void S1_Work()
        {
            while (Data.Session.Stage == 1 && Data.Session.Shortcuts.Count >= Data.Session.LastShortcut + 1)
            {
                if (Data.Session.LastShortcut >= Data.Session.Shortcuts.Count)
                {
                    break;
                }

                var item = Data.Session.Shortcuts[Data.Session.LastShortcut++];

                Invoke(new Action(() =>
                {
                    L_Shortcuts_Info.Text = item.Name;
                    TaskbarProgress.SetValue(Handle, 2500d * Data.Session.LastShortcut / Data.Session.Shortcuts.Count, 10000);
                }));

                var error = IconMatcher.Match(item);

                PGB_Shortcuts.Percentage = 100d * Data.Session.LastShortcut / Data.Session.Shortcuts.Count;

                if (error != null)
                {
                    Data.Session.StageErrors[0]++;
#if DEBUG
                    Data.Session.Exceptions.Add(error);
#endif
                }
            }

            if (Data.Session.Stage == 1)
            {
                Stage_2();
            }
        }
Пример #4
0
        private void B_Change_Click(object sender, EventArgs e)
        {
#if DEBUG
            if (DebugMode)
            {
                var itemFile = new ItemFile(TB_FolderPath.Text, out var error);

                IconMatcher.Match(itemFile);

                if (itemFile.Match == null && itemFile.Type != IconType.Normal)
                {
                    IconMatcher.ReMatch(itemFile);
                    MessageBox.Show($"'{itemFile}' was re-matched with '{itemFile.Match}'");
                }
                else
                {
                    MessageBox.Show($"'{itemFile}' was matched with '{itemFile.Match}'");
                }
            }
#endif
            if (ValidationCheck(2))
            {
                Data.Session.SessionAction = SessionAction.Change;
                Data.Session.WorkingPaths.Add(TB_FolderPath.Text);
                SetCurrentSessionOptions();

                (new WorkForm()
                {
                    Size = Size, Location = Location
                }).Show();
                Hide();
            }
        }
Пример #5
0
        private static bool ParentNameCheck(ItemFile file, string[] querry, int depth)
        {
            if (file.Type == IconType.Normal)
            {
                depth++;
            }

            var parents = file.Parents.Trim(0, depth).Convert(x => Path.GetFileName(x).ToLower());

            return(parents.Any(x => querry.Any(y => y == x ||
                                               IconMatcher.SpellCheck(x, y) < 3 ||
                                               x.Contains(y))));
        }