Esempio n. 1
0
 private void CoreThreadTask()
 {
     m_startDateTime = DateTime.Now;
     m_coreOptions.Set(m_core, m_options.onePath);
     m_state = State.ClearResults;
     m_core.Clear(CoreDll.FileType.Result);
     m_state = State.ClearTemporary;
     m_core.Clear(CoreDll.FileType.Temporary);
     if (m_options.useImageDataBase)
     {
         m_state = State.LoadImages;
         m_core.Load(CoreDll.FileType.ImageDataBase, m_coreOptions.GetImageDataBasePath(), false);
     }
     m_state = State.Search;
     m_core.Search();
     m_state = State.SetGroup;
     m_core.ApplyToResult(CoreDll.GlobalActionType.SetGroup);
     m_state = State.SetHint;
     m_core.ApplyToResult(CoreDll.GlobalActionType.SetHint);
     if (m_options.useImageDataBase)
     {
         m_state = State.SaveImages;
         m_core.Save(CoreDll.FileType.ImageDataBase, m_coreOptions.GetImageDataBasePath());
     }
     m_core.Clear(CoreDll.FileType.ImageDataBase);
     m_core.SortResult((CoreDll.SortType)m_options.resultsOptions.sortTypeDefault, m_options.resultsOptions.increasingDefault);
     m_state = State.Finish;
     LogPerformance(DateTime.Now - m_startDateTime, m_core.GetStatistic());
 }
Esempio n. 2
0
        protected override void OnColumnHeaderMouseClick(DataGridViewCellMouseEventArgs e)
        {
            DataGridViewColumn dataGridViewColumn = Columns[e.ColumnIndex];

            CoreDll.SortType sortType = CoreDll.SortType.ByType;
            if (m_options.resultsOptions.viewMode == ResultsOptions.ViewMode.VerticalPairTable)
            {
                switch ((ColumnsTypeVertical)e.ColumnIndex)
                {
                case ColumnsTypeVertical.Type:
                    sortType = CoreDll.SortType.ByType;
                    break;

                case ColumnsTypeVertical.Group:
                    sortType = CoreDll.SortType.ByGroup;
                    break;

                case ColumnsTypeVertical.GroupSize:
                    sortType = CoreDll.SortType.ByGroupSize;
                    break;

                case ColumnsTypeVertical.Difference:
                    sortType = CoreDll.SortType.ByDifference;
                    break;

                case ColumnsTypeVertical.Defect:
                    sortType = CoreDll.SortType.ByDefect;
                    break;

                case ColumnsTypeVertical.Transform:
                    sortType = CoreDll.SortType.ByTransform;
                    break;

                case ColumnsTypeVertical.Hint:
                    sortType = CoreDll.SortType.ByHint;
                    break;

                case ColumnsTypeVertical.FileName:
                    sortType = CoreDll.SortType.BySortedName;
                    break;

                case ColumnsTypeVertical.FileDirectory:
                    sortType = CoreDll.SortType.BySortedDirectory;
                    break;

                case ColumnsTypeVertical.ImageSize:
                    sortType = CoreDll.SortType.BySortedArea;
                    break;

                case ColumnsTypeVertical.ImageType:
                    sortType = CoreDll.SortType.BySortedType;
                    break;

                case ColumnsTypeVertical.Blockiness:
                    sortType = CoreDll.SortType.BySortedBlockiness;
                    break;

                case ColumnsTypeVertical.Blurring:
                    sortType = CoreDll.SortType.BySortedBlurring;
                    break;

                case ColumnsTypeVertical.FileSize:
                    sortType = CoreDll.SortType.BySortedSize;
                    break;

                case ColumnsTypeVertical.FileTime:
                    sortType = CoreDll.SortType.BySortedTime;
                    break;
                }
            }
            if (m_options.resultsOptions.viewMode == ResultsOptions.ViewMode.HorizontalPairTable)
            {
                switch ((ColumnsTypeHorizontal)e.ColumnIndex)
                {
                case ColumnsTypeHorizontal.Type:
                    sortType = CoreDll.SortType.ByType;
                    break;

                case ColumnsTypeHorizontal.Group:
                    sortType = CoreDll.SortType.ByGroup;
                    break;

                case ColumnsTypeHorizontal.GroupSize:
                    sortType = CoreDll.SortType.ByGroupSize;
                    break;

                case ColumnsTypeHorizontal.Difference:
                    sortType = CoreDll.SortType.ByDifference;
                    break;

                case ColumnsTypeHorizontal.Defect:
                    sortType = CoreDll.SortType.ByDefect;
                    break;

                case ColumnsTypeHorizontal.Transform:
                    sortType = CoreDll.SortType.ByTransform;
                    break;

                case ColumnsTypeHorizontal.Hint:
                    sortType = CoreDll.SortType.ByHint;
                    break;

                case ColumnsTypeHorizontal.FirstFileName:
                    sortType = CoreDll.SortType.ByFirstName;
                    break;

                case ColumnsTypeHorizontal.FirstFileDirectory:
                    sortType = CoreDll.SortType.ByFirstDirectory;
                    break;

                case ColumnsTypeHorizontal.FirstImageSize:
                    sortType = CoreDll.SortType.ByFirstArea;
                    break;

                case ColumnsTypeHorizontal.FirstImageType:
                    sortType = CoreDll.SortType.ByFirstType;
                    break;

                case ColumnsTypeHorizontal.FirstFileSize:
                    sortType = CoreDll.SortType.ByFirstSize;
                    break;

                case ColumnsTypeHorizontal.FirstBlockiness:
                    sortType = CoreDll.SortType.ByFirstBlockiness;
                    break;

                case ColumnsTypeHorizontal.FirstBlurring:
                    sortType = CoreDll.SortType.ByFirstBlurring;
                    break;

                case ColumnsTypeHorizontal.FirstFileTime:
                    sortType = CoreDll.SortType.ByFirstTime;
                    break;

                case ColumnsTypeHorizontal.SecondFileName:
                    sortType = CoreDll.SortType.BySecondName;
                    break;

                case ColumnsTypeHorizontal.SecondFileDirectory:
                    sortType = CoreDll.SortType.BySecondDirectory;
                    break;

                case ColumnsTypeHorizontal.SecondImageSize:
                    sortType = CoreDll.SortType.BySecondArea;
                    break;

                case ColumnsTypeHorizontal.SecondImageType:
                    sortType = CoreDll.SortType.BySecondType;
                    break;

                case ColumnsTypeHorizontal.SecondFileSize:
                    sortType = CoreDll.SortType.BySecondSize;
                    break;

                case ColumnsTypeHorizontal.SecondBlockiness:
                    sortType = CoreDll.SortType.BySecondBlockiness;
                    break;

                case ColumnsTypeHorizontal.SecondBlurring:
                    sortType = CoreDll.SortType.BySecondBlurring;
                    break;

                case ColumnsTypeHorizontal.SecondFileTime:
                    sortType = CoreDll.SortType.BySecondTime;
                    break;
                }
            }

            ListSortDirection direction = ListSortDirection.Ascending;

            switch (dataGridViewColumn.HeaderCell.SortGlyphDirection)
            {
            case SortOrder.None:
                direction = ListSortDirection.Ascending;
                dataGridViewColumn.HeaderCell.SortGlyphDirection = SortOrder.Ascending;
                break;

            case SortOrder.Ascending:
                direction = ListSortDirection.Descending;
                dataGridViewColumn.HeaderCell.SortGlyphDirection = SortOrder.Descending;
                break;

            case SortOrder.Descending:
                direction = ListSortDirection.Ascending;
                dataGridViewColumn.HeaderCell.SortGlyphDirection = SortOrder.Ascending;
                break;
            }

            for (int col = 0; col < ColumnCount; col++)
            {
                if (col != e.ColumnIndex)
                {
                    Columns[col].HeaderCell.SortGlyphDirection = SortOrder.None;
                }
            }

            m_options.resultsOptions.sortTypeDefault   = (int)sortType;
            m_options.resultsOptions.increasingDefault = direction == ListSortDirection.Ascending;
            m_core.SortResult(sortType, direction == ListSortDirection.Ascending);

            m_mainSplitContainer.UpdateResults();
        }