Exemple #1
0
        public void ProfileOpenAction(object sender, EventArgs e)
        {
            OpenFileDialog dialog   = new OpenFileDialog();
            FileInfo       fileInfo = new FileInfo(m_options.coreOptionsFileName);

            if (fileInfo.Exists)
            {
                dialog.FileName         = m_options.coreOptionsFileName;
                dialog.InitialDirectory = fileInfo.Directory.ToString();
            }
            else
            {
                dialog.InitialDirectory = Resources.ProfilesPath;
            }
            dialog.DefaultExt = "xml";
            dialog.Filter     = "Antidupl profile files (*.xml)|*.xml";
            if (dialog.ShowDialog() == DialogResult.OK)
            {
                if (string.Compare(dialog.FileName, m_options.coreOptionsFileName) != 0)
                {
                    m_coreOptions.Save(m_options.coreOptionsFileName);
                    ProgressForm saveProgressForm = new ProgressForm(ProgressForm.Type.SaveResults, m_core, m_options, m_coreOptions, m_mainSplitContainer);
                    saveProgressForm.Execute();
                    m_options.coreOptionsFileName = dialog.FileName;
                }

                CoreOptions coreOptions = CoreOptions.Load(m_options.coreOptionsFileName, m_core, m_options.onePath);
                coreOptions.CopyTo(ref m_coreOptions);
                ProgressForm loadProgressForm = new ProgressForm(ProgressForm.Type.LoadResults, m_core, m_options, m_coreOptions, m_mainSplitContainer);
                loadProgressForm.Execute();

                m_mainForm.UpdateCaption();
                m_options.Change();
            }
        }
        public MainSplitContainer(CoreLib core, Options options, CoreOptions coreOptions, MainForm mainForm)
        {
            m_mainForm    = mainForm;
            m_options     = options;
            m_core        = core;
            m_coreOptions = coreOptions;

            m_resultsListView         = new ResultsListView(m_core, m_options, m_coreOptions, this);
            m_resultsPreviewContainer = new ResultsPreviewContainer(m_core, m_options, m_coreOptions, this);

            //m_resultsListView.UpdateResults();

            m_thumbnailGroupTable = new ThumbnailGroupTable(m_core, m_options, this);
            m_thumbnailPreview    = new ThumbnailPreview(m_core, m_options, this);
            m_thumbnailPreview.ContextMenuStrip              = new ThumbnailPreviewContextMenu(m_core, m_options, m_thumbnailPreview, m_thumbnailGroupTable);
            m_thumbnailGroupTable.OnCurrentThumbnailChanged += m_thumbnailPreview.SetThumbnail;

            //m_thumbnailGroupTable.UpdateGroups();

            InitializeComponents();

            // —в¤зываем, чтобы при вызове событи¤ OnViewModeChange вызывалась функци¤ SetViewMode
            m_options.resultsOptions.OnViewModeChange += new ResultsOptions.ViewModeChangeHandler(SetViewMode);

            SplitterMoved += new SplitterEventHandler(OnSplitterPositionChanged);
            Resize        += new EventHandler(OnSizeChanged);
        }
Exemple #3
0
        static public CoreOptions Load(string fileName, CoreLib core, bool onePath)
        {
            FileInfo fileInfo = new FileInfo(fileName);

            if (fileInfo.Exists)
            {
                FileStream fileStream = null;
                try
                {
                    XmlSerializer xmlSerializer = new XmlSerializer(typeof(CoreOptions));
                    fileStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
                    CoreOptions coreOptions = (CoreOptions)xmlSerializer.Deserialize(fileStream);
                    fileStream.Close();
                    coreOptions.Validate(core, onePath);
                    return(coreOptions);
                }
                catch
                {
                    if (fileStream != null)
                    {
                        fileStream.Close();
                    }
                    return(new CoreOptions(core));
                }
            }
            else
            {
                return(new CoreOptions(core));
            }
        }
Exemple #4
0
 public ProgressForm(Type type, CoreLib core, Options options, CoreOptions coreOptions, MainSplitContainer mainSplitContainer)
 {
     if (type == Type.ApplyAction)
     {
         throw new Exception("Wrong using of ProgressForm type!");
     }
     m_type = type;
     Initialize(core, options, coreOptions, mainSplitContainer);
 }
Exemple #5
0
 /// <summary>
 /// Инициализируем форму.
 /// </summary>
 /// <param name="core"></param>
 /// <param name="options"></param>
 /// <param name="coreOptions"></param>
 /// <param name="mainSplitContainer"></param>
 private void Initialize(CoreLib core, Options options, CoreOptions coreOptions, MainSplitContainer mainSplitContainer)
 {
     m_core               = core;
     m_options            = options;
     m_coreOptions        = coreOptions;
     m_mainSplitContainer = mainSplitContainer;
     InitializeComponent();
     UpdateStrings();
 }
 public ResultsPreviewDefect(CoreLib core, Options options, CoreOptions coreOptions, ResultsListView resultsListView)
     : base(core, options, coreOptions, resultsListView)
 {
     InitializeComponents();
     UpdateStrings();
     Resources.Strings.OnCurrentChange += new Resources.Strings.CurrentChangeHandler(UpdateStrings);
     OnOptionsChanged();
     m_options.OnChange += new Options.ChangeHandler(OnOptionsChanged);
 }
 public ResultsListViewContextMenu(CoreLib core, Options options, CoreOptions coreOptions, MainSplitContainer mainSplitContainer)
 {
     m_core               = core;
     m_options            = options;
     m_coreOptions        = coreOptions;
     m_mainSplitContainer = mainSplitContainer;
     InitializeComponents();
     UpdateStrings();
     OnOptionsChanged();
 }
Exemple #8
0
        public ResultsPreviewBase(CoreLib core, Options options, CoreOptions coreOptions, ResultsListView resultsListView)
        {
            m_core            = core;
            m_options         = options;
            m_coreOptions     = coreOptions;
            m_resultsListView = resultsListView;

            InitializeComponents();
            UpdateStrings();
            Resources.Strings.OnCurrentChange += new Resources.Strings.CurrentChangeHandler(UpdateStrings);
        }
Exemple #9
0
 public CorePathsForm(CoreLib core, Options options, CoreOptions coreOptions)
 {
     m_core           = core;
     m_options        = options;
     m_oldCoreOptions = coreOptions;
     m_newCoreOptions = m_oldCoreOptions.Clone();
     InitializeComponent();
     UpdateStrings();
     UpdatePath();
     UpdateButtonEnabling();
 }
Exemple #10
0
        public CoreOptions(CoreOptions options)
        {
            searchOptions   = options.searchOptions.Clone();
            compareOptions  = options.compareOptions.Clone();
            defectOptions   = options.defectOptions.Clone();
            advancedOptions = options.advancedOptions.Clone();

            searchPath = PathClone(options.searchPath);
            ignorePath = PathClone(options.ignorePath);
            validPath  = PathClone(options.validPath);
            deletePath = PathClone(options.deletePath);
        }
Exemple #11
0
        public void CopyTo(ref CoreOptions options)
        {
            options.searchOptions   = searchOptions.Clone();
            options.compareOptions  = compareOptions.Clone();
            options.defectOptions   = defectOptions.Clone();
            options.advancedOptions = advancedOptions.Clone();

            PathCopy(searchPath, ref options.searchPath);
            PathCopy(ignorePath, ref options.ignorePath);
            PathCopy(validPath, ref options.validPath);
            PathCopy(deletePath, ref options.deletePath);
        }
 public ImagePreviewContextMenu(CoreLib core, Options options, CoreOptions coreOptions, ImagePreviewPanel imagePreviewPanel, ResultsListView resultsListView)
 {
     m_core              = core;
     m_options           = options;
     m_coreOptions       = coreOptions;
     m_imagePreviewPanel = imagePreviewPanel;
     m_resultsListView   = resultsListView;
     InitializeComponents();
     UpdateStrings();
     Resources.Strings.OnCurrentChange += new Resources.Strings.CurrentChangeHandler(UpdateStrings);
     Opening += new CancelEventHandler(OnOpening);
 }
Exemple #13
0
        public void SetDefault(CoreLib core, bool onePath)
        {
            CoreOptions old = new CoreOptions();

            old.Get(core, onePath);
            core.SetDefaultOptions();
            Get(core, onePath);
            old.Set(core, onePath);

            ignorePath         = new CorePathWithSubFolder[1];
            ignorePath[0]      = new CorePathWithSubFolder();
            ignorePath[0].path = Resources.DataPath;
        }
Exemple #14
0
 public MainMenu(CoreLib core, Options options, CoreOptions coreOptions, MainForm mainForm, MainSplitContainer mainSplitContainer)
 {
     m_core               = core;
     m_options            = options;
     m_coreOptions        = coreOptions;
     m_mainForm           = mainForm;
     m_mainSplitContainer = mainSplitContainer;
     InitializeComponents();
     UpdateStrings();
     UpdateResults();
     Resources.Strings.OnCurrentChange    += new Resources.Strings.CurrentChangeHandler(UpdateStrings);
     m_mainSplitContainer.OnUpdateResults += new MainSplitContainer.UpdateResultsHandler(UpdateResults);
 }
Exemple #15
0
 public SearchExecuterForm(CoreLib core, Options options, CoreOptions coreOptions, MainSplitContainer mainSplitContainer, MainForm mainForm)
 {
     m_core                = core;
     m_options             = options;
     m_coreOptions         = coreOptions;
     m_mainSplitContainer  = mainSplitContainer;
     m_mainForm            = mainForm;
     m_mainFormWindowState = m_mainForm.WindowState;
     InitializeComponent();
     UpdateStrings();
     Owner              = m_mainForm;
     m_mainForm.Resize += new EventHandler(OnMainFormResize);
 }
Exemple #16
0
 public MainToolStrip(CoreLib core, Options options, CoreOptions coreOptions, MainMenu mainMenu, MainForm mainForm, MainSplitContainer mainSplitContainer)
 {
     m_core               = core;
     m_options            = options;
     m_coreOptions        = coreOptions;
     m_mainMenu           = mainMenu;
     m_mainForm           = mainForm;
     m_mainSplitContainer = mainSplitContainer;
     InitializeComponents();
     UpdateStrings();
     UpdateResults();
     OnOptionsChanged();
     SetViewMode(m_options.resultsOptions.viewMode);
 }
        public ResultsPreviewContainer(CoreLib core, Options options, CoreOptions coreOptions, MainSplitContainer mainSplitContainer)
        {
            Location = new Point(0, 0);
            Dock     = DockStyle.Fill;

            m_mainSplitContainer            = mainSplitContainer;
            m_resultsPreviewDefect          = new ResultsPreviewDefect(core, options, coreOptions, m_mainSplitContainer.resultsListView);
            m_resultsPreviewDefect.Location = new System.Drawing.Point(0, 0);
            m_resultsPreviewDefect.Dock     = DockStyle.Fill;

            m_resultsPreviewDuplPair          = new ResultsPreviewDuplPair(core, options, coreOptions, m_mainSplitContainer.resultsListView);
            m_resultsPreviewDuplPair.Location = new System.Drawing.Point(0, 0);
            m_resultsPreviewDuplPair.Dock     = DockStyle.Fill;

            m_mainSplitContainer.OnCurrentResultChanged +=
                new MainSplitContainer.CurrentResultChangedHandler(CurrentResultChanged);
        }
Exemple #18
0
 public ProgressForm(Type type, string path, CoreLib core, Options options, CoreOptions coreOptions, MainSplitContainer mainSplitContainer)
 {
     m_type = type;
     if (m_type == Type.MoveCurrentGroup)
     {
         m_directoryForMove = path;
     }
     else if (m_type == Type.RenameCurrentGroupAs)
     {
         m_newFileName = path;
     }
     else
     {
         throw new Exception("Unknown Type for action!");
     }
     Initialize(core, options, coreOptions, mainSplitContainer);
 }
Exemple #19
0
        public bool Equals(CoreOptions options)
        {
            if (!searchOptions.Equals(options.searchOptions))
            {
                return(false);
            }
            if (!compareOptions.Equals(options.compareOptions))
            {
                return(false);
            }
            if (!defectOptions.Equals(options.defectOptions))
            {
                return(false);
            }
            if (!advancedOptions.Equals(options.advancedOptions))
            {
                return(false);
            }
            if (!hintOptions.Equals(options.hintOptions))
            {
                return(false);
            }
            if (!Equals(searchPath, options.searchPath))
            {
                return(false);
            }
            if (!Equals(ignorePath, options.ignorePath))
            {
                return(false);
            }
            if (!Equals(validPath, options.validPath))
            {
                return(false);
            }
            if (!Equals(deletePath, options.deletePath))
            {
                return(false);
            }

            return(true);
        }
Exemple #20
0
        public MainForm()
        {
            m_core    = new CoreLib(Resources.UserPath);
            m_options = Options.Load();
            if (m_options.loadProfileOnLoading)
            {
                m_coreOptions = CoreOptions.Load(m_options.coreOptionsFileName, m_core, m_options.onePath);
            }
            else
            {
                m_options.coreOptionsFileName = Options.GetDefaultCoreOptionsFileName();
                m_coreOptions = new CoreOptions(m_core);
            }
            Resources.Strings.SetCurrent(m_options.Language);

            StartFinishForm startFinishForm = new StartFinishForm(m_core, m_options);

            startFinishForm.ExecuteStart();

            InitializeComponents();
        }
Exemple #21
0
 public ResultsListView(CoreLib core, AntiDupl.NET.Options options, CoreOptions coreOptions, MainSplitContainer mainSplitContainer)
 {
     m_core               = core;
     m_options            = options;
     m_coreOptions        = coreOptions;
     m_mainSplitContainer = mainSplitContainer;
     m_results            = new CoreResult[0];
     m_resultRowSetter    = new ResultRowSetter(m_options, this);
     InitializeComponents();
     if (m_options.resultsOptions.viewMode == ResultsOptions.ViewMode.VerticalPairTable)
     {
         m_viewMode = ResultsOptions.ViewMode.HorizontalPairTable;
         SetViewMode(ResultsOptions.ViewMode.VerticalPairTable);
     }
     else
     {
         m_viewMode = ResultsOptions.ViewMode.VerticalPairTable;
         SetViewMode(ResultsOptions.ViewMode.HorizontalPairTable);
     }
     SetCurrentRow(0);
     Resources.Strings.OnCurrentChange += new Resources.Strings.CurrentChangeHandler(UpdateStrings);
 }
Exemple #22
0
 public ProgressForm(CoreDll.LocalActionType action, CoreDll.TargetType target, CoreLib core, Options options, CoreOptions coreOptions, MainSplitContainer mainSplitContainer)
 {
     m_type   = Type.ApplyAction;
     m_action = action;
     m_target = target;
     Initialize(core, options, coreOptions, mainSplitContainer);
 }
Exemple #23
0
 public ProgressForm(CoreDll.RenameCurrentType renameCurrentType, string newFileName, CoreLib core, Options options, CoreOptions coreOptions, MainSplitContainer mainSplitContainer)
 {
     m_type = Type.RenameCurrent;
     m_renameCurrentType = renameCurrentType;
     m_newFileName       = newFileName;
     Initialize(core, options, coreOptions, mainSplitContainer);
 }