Пример #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());
 }
Пример #2
0
        /// <summary>
        /// Функция которая будет выполнять основные действия.
        /// </summary>
        private void CoreThreadTask()
        {
            m_startDateTime = DateTime.Now;
            m_state         = State.Work;
            m_coreOptions.Set(m_core, m_options.onePath);
            switch (m_type)
            {
            case Type.ApplyAction:
            {
                m_updateResults = m_core.ApplyToResult(m_action, m_target);
                m_type          = Type.ClearTemporary;
                m_core.Clear(CoreDll.FileType.Temporary);
                break;
            }

            case Type.RenameCurrent:
            {
                m_updateResults = m_core.RenameCurrent(m_renameCurrentType, m_newFileName);
                m_type          = Type.ClearTemporary;
                m_core.Clear(CoreDll.FileType.Temporary);
                break;
            }

            case Type.MoveCurrentGroup:
            {
                m_updateResults = m_core.MoveCurrentGroup(m_directoryForMove);
                m_type          = Type.ClearTemporary;
                m_core.Clear(CoreDll.FileType.Temporary);
                break;
            }

            case Type.RenameCurrentGroupAs:
            {
                m_updateResults = m_core.RenameCurrentGroupAs(m_newFileName);
                m_type          = Type.ClearTemporary;
                m_core.Clear(CoreDll.FileType.Temporary);
                break;
            }

            case Type.RefreshResults:
            {
                m_updateResults = m_core.ApplyToResult(CoreDll.GlobalActionType.Refresh);
                m_type          = Type.ClearTemporary;
                m_core.Clear(CoreDll.FileType.Temporary);
                break;
            }

            case Type.Undo:
            {
                m_updateResults = m_core.ApplyToResult(CoreDll.GlobalActionType.Undo);
                break;
            }

            case Type.Redo:
            {
                m_updateResults = m_core.ApplyToResult(CoreDll.GlobalActionType.Redo);
                break;
            }

            case Type.LoadResults:
            {
                m_type = Type.ClearResults;
                m_core.Clear(CoreDll.FileType.Result);
                m_type = Type.ClearTemporary;
                m_core.Clear(CoreDll.FileType.Temporary);
                m_type = Type.LoadResults;
                m_core.Load(CoreDll.FileType.Result, m_options.GetResultsFileName(), m_options.checkResultsAtLoading);
                m_updateResults = true;
                break;
            }

            case Type.SaveResults:
            {
                m_core.Save(CoreDll.FileType.Result, m_options.GetResultsFileName());
                m_updateResults = false;
                break;
            }

            case Type.ClearDatabase:
            {
                m_type = Type.LoadImages;
                m_core.Load(CoreDll.FileType.ImageDataBase, m_coreOptions.GetImageDataBasePath(), true);
                m_updateResults = false;
                break;
            }

            default:
                throw new Exception("Unknown Action!!!");
            }
            m_state = State.Finish;
        }