Esempio n. 1
0
        public override StepDetail RunNextStep()
        {
            StepDetail detail = new StepDetail();
            detail.Description = string.Format("Importing from {0} ...", SourcePath);

            _abortScan = false;

            try
            {
                Catalog cat = new Catalog(CatalogPath);
                CatalogItem parent = cat.GetByItemID(InsertionPointID);

                ScanFolder(cat, new System.IO.DirectoryInfo(SourcePath), parent);

                finished = true;

                if (!_abortScan)
                {
                    cat.CatalogDescription = CatalogDescription;
                    cat.Save(CatalogPath);
                }

                detail.Results = (_abortScan) ? Translator.Translate("TXT_ABORTED") : Translator.Translate("TXT_SUCCESS");
                detail.IsSuccess = !_abortScan;
            }
            catch(Exception ex)
            {
                detail.Results = ex.Message;
                detail.IsSuccess = false;
            }
            finally
            {
                finished = true;
            }

            return detail;
        }
Esempio n. 2
0
        private void DisplayCatalogContents(object state)
        {
            Catalog cat = null;

            try
            {
                ShowWaitDialog("TXT_WAIT_LOADING_CATALOG");

                string path = (BkgTask as Task).CatalogPath;
                NativeFileInfo nfi = new NativeFileInfo(path, false);
                if (nfi.IsValid)
                {
                    cat = new Catalog(path);
                }
                else if (!string.IsNullOrEmpty(path))
                {
                    cat = new Catalog();
                    cat.Save(path);
                }
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
            }
            finally
            {
                if (cat != null && cat.IsValid)
                {
                    DisplayCatalog(cat);
                }
                CloseWaitDialog();
            }
        }