public FirebirdDataAccess(TCommonFireBirdDB manager) { if (manager == null) { throw new ArgumentNullException("manager"); } this.manager = manager; this.connection = manager.Connection; XsltSettings settings = new XsltSettings(); this.xslt = new XslCompiledTransform(); this.xslt.Load("fb2_text_annotation.xsl", settings, new XmlResourceResolver()); format = new SevenZipFormat("other/7z.dll"); }
public BookFilterEditor(TCommonFireBirdDB db) { if (db == null) { throw new ArgumentNullException("db"); } InitializeComponent(); firstActivate = true; database = db; FilterColumnCollection columnCollection = new FilterColumnCollection(); genreEditor = new RepositoryItemGridLookUpEdit(); genreEditor.ValueMember = "Name"; genreEditor.DisplayMember = "Name"; genreEditor.ViewType = GridLookUpViewType.Default; GridColumn genreNameColumn = new GridColumn(); genreNameColumn.Caption = "Name"; genreNameColumn.FieldName = "Name"; genreNameColumn.VisibleIndex = 0; GridColumn genreDescColumn = new GridColumn(); genreDescColumn.Caption = "Description"; genreDescColumn.FieldName = "RuDescription"; genreDescColumn.VisibleIndex = 1; genreEditor.View.Columns.Add(genreNameColumn); genreEditor.View.Columns.Add(genreDescColumn); columnCollection.Add(new UnboundFilterColumn("Genre", "Genres", typeof(string), this.genreEditor, FilterColumnClauseClass.String)); columnCollection.Add(new UnboundFilterColumn("Language", "Lang", typeof(string), new RepositoryItemComboBox(), FilterColumnClauseClass.String)); columnCollection.Add(new UnboundFilterColumn("Source Language", "SrcLang", typeof(string), new RepositoryItemComboBox(), FilterColumnClauseClass.String)); columnCollection.Add(new UnboundFilterColumn("Book Author", "BookAuthors", typeof(string), new RepositoryItemComboBox(), FilterColumnClauseClass.String)); this.filterControl.SetFilterColumnsCollection(columnCollection); }
internal ImportForm(object pluginParams, ImportOptions options) : this() { if (pluginParams == null) { throw new ArgumentNullException("pluginParams"); } object pluginCallBack = CommonParams.GetParam(CommonConsts.cParamCallbackMethod, pluginParams, null, 1); this.callback = pluginCallBack as PluginCallBack; this.db = ConnectionManager.Instance().Connection<TCommonFireBirdDB>("MainConnection"); object callParams = CommonParams.AddParam(CommonConsts.cParamCallbackMethod, callback, null); callParams = CommonParams.AddParam(CommonConsts.cParamPlugin, "Configuration", callParams); callParams = CommonParams.AddParam(CommonConsts.cParamAction, "Configuration.Get", callParams); callParams = CommonParams.AddParam("Info", "SystemFolders", callParams); object result = this.callback(callParams); this.tempFolder = CommonParams.GetParam("TempFolder", result, Path.GetTempPath(), 1); if(!Directory.Exists(this.tempFolder)) { this.tempFolder = Path.GetTempPath(); } this.badFolder = CommonParams.GetParam("BadFolder", result, String.Empty, 1); this.sourceFolder = CommonParams.GetParam("SourcesFolder", result, String.Empty, 1); this.dupFolder = CommonParams.GetParam("DupFolder", result, String.Empty, 1); this.lastFolder = CommonParams.GetParam("LastFolder", result, String.Empty, 1); this.oldFileFolder = CommonParams.GetParam("OldFileFolder", result, String.Empty, 1); if(!String.IsNullOrEmpty(this.lastFolder)) { this.txtImportPath.Text = this.lastFolder; } callParams = CommonParams.AddParam(CommonConsts.cParamCallbackMethod, callback, null); callParams = CommonParams.AddParam(CommonConsts.cParamPlugin, "Configuration", callParams); callParams = CommonParams.AddParam(CommonConsts.cParamAction, "Configuration.Get", callParams); callParams = CommonParams.AddParam("Info", "MountPoint", callParams); result = this.callback(callParams); this.database = new FirebirdDataAccess(this.db); this.database.CheckDatabaseSchema(); DatabaseInfo databaseInfo = this.database.DatabaseInfo; databaseInfo.MountPoint = CommonParams.GetParam("MountPoint", result, String.Empty, 1); databaseInfo.WorkMode = CommonParams.GetParam("WorkMode", result, (short) StorageMode.FileSystem, 1); callParams = CommonParams.AddParam(CommonConsts.cParamCallbackMethod, callback, null); callParams = CommonParams.AddParam(CommonConsts.cParamPlugin, "Configuration", callParams); callParams = CommonParams.AddParam(CommonConsts.cParamAction, "Configuration.Get", callParams); callParams = CommonParams.AddParam("Info", "CurrentUserInfo", callParams); result = this.callback(callParams); databaseInfo.CurrentUserId = CommonParams.GetParam("UserID", result, -1, 1); databaseInfo.CurrentUserName = CommonParams.GetParam("UserName", result, String.Empty, 1); GenreTable.ReadGenreList(this.database); ZipConstants.DefaultCodePage = 866; SevenZipFormat.DefaultCodePage = 866; manager = new DefaultFileSystemManager(); manager.setCacheStrategy(CacheStrategy.ON_RESOLVE); manager.init(); SevenZipFileProvider provider = new SevenZipFileProvider(); provider.addListener(this); manager.addProvider("file", new DefaultLocalFileProvider()); manager.addProvider("zip", provider); manager.addExtensionMap("zip", "zip"); manager.addMimeTypeMap("application/zip", "zip"); manager.addProvider("sevenzip", provider); manager.addExtensionMap("7z", "sevenzip"); manager.addMimeTypeMap("application/x-7z-compressed", "sevenzip"); manager.addProvider("rar", provider); manager.addExtensionMap("rar", "rar"); manager.addMimeTypeMap("application/x-rar-compressed", "rar"); manager.Replicator = new DefaultFileReplicator(); properties = TypeDescriptor.GetProperties(typeof(FilterAdapter)); bufferPool = new BufferPool(4, 16384); legendViewMode = LegendViewMode.None; if (File.Exists("FBScanner.xml")) { ScannerState scannerState = LoadImportState("FBScanner.xml"); if(scannerState != null) { txtImportPath.Text = scannerState.SearchPath ?? this.lastFolder; chkIncludeSubDirs.Checked = scannerState.IncludeSubDirs ?? false; chkSelectFoundFiles.Checked = scannerState.SelectFoundFiles ?? false; filterCriteria = scannerState.Filter; if (!String.IsNullOrEmpty(filterCriteria)) { filter = new FilterEvaluator(properties, filterCriteria); } if(scannerState.Entries != null) { fileEntries = scannerState.Entries.ConvertAll(x => new ImportFileEntry(x)); foreach (ImportFileEntry fileEntry in fileEntries) { excludeList.Add(fileEntry.Uri, fileEntry); } grdSelectedFiles.DataSource = fileEntries; } if(scannerState.Legend != null) { foreach (XmlLegendItem legendItem in scannerState.Legend) { processLegend.SetCounterValue(legendItem.Status, legendItem.Counter); } } if(scannerState.Log != null) { processLog = scannerState.Log.ConvertAll(x => new Fb2DocumentEntry(x)); grdResult.DataSource = processLog; } } } dontCheckForDuplicate = options.DontCheckForDuplicate; }