private NotesAccessor GetNotesAccessor() { if (this._notesAccessor == null) { this._notesAccessor = Accessor.AccessorFactory.GetNotesAccessor(); this._notesAccessor.TryConnect(Config.NotesPassword); } return(this._notesAccessor); }
private void frmNotesView_Load(object sender, EventArgs e) { try { noteAccessor = NotesAccessor.CreateInstance(); noteAccessor.TryConnect(Engines.Common.Config.NotesPassword); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
/// <summary> /// 画面初期化 /// </summary> private void InitControls() { //Notes設定 this.txtNotesPassword.Text = Config.NotesPassword; NotesAccessor nsAccessor = Accessor.AccessorFactory.GetNotesAccessor(); if (!string.IsNullOrEmpty(Config.NotesPassword) && nsAccessor.TryConnect(Config.NotesPassword)) { this.lblUserId.Text = nsAccessor.GetCurrentUser(); } //出力フォルダを this.txtOutputFolder.Text = Config.ExportFolder; //Sharepoint設定 this.txtSPWebSite.Text = Config.SPDefaultWebSite; this.txtSPUser.Text = Config.SPUserId; this.txtSPPassword.Text = Config.SPPassword; //SqlServer this.txtSqlServer.Text = Config.SqlServer; this.txtSqlServer.Tag = Config.SqlServer; AuthenticateMode mode = (AuthenticateMode)Config.DBAuthenticateMode; if (mode == AuthenticateMode.SqlServer) { this.txtDbUserId.Enabled = true; this.txtDBPassword.Enabled = true; this.txtDbUserId.Text = Config.DBUserId; this.txtDbUserId.Tag = Config.DBUserId; this.txtDBPassword.Text = Config.DBPassWord; this.txtDBPassword.Tag = Config.DBPassWord; } else { this.txtDbUserId.Enabled = false; this.txtDbUserId.Text = System.Security.Principal.WindowsIdentity.GetCurrent().Name; this.txtDBPassword.Clear(); this.txtDBPassword.Enabled = false; } InitAuthModeComb(); //Detabase List if (!string.IsNullOrEmpty(Config.DataBaseName) && !string.IsNullOrEmpty(Config.SqlServer)) { using (SqlAccessor sqlAccessor = Accessor.AccessorFactory.GetSqlAccessor()) { if (this.InitDatabaseList(sqlAccessor)) { this.cmbDataBase.SelectedItem = Config.DataBaseName; } } } }
private void btnTryAccessNotes_Click(object sender, EventArgs e) { string password = this.txtNotesPassword.Text; NotesAccessor nsAccessor = Accessor.AccessorFactory.GetNotesAccessor(); if (nsAccessor.TryConnect(password)) { this.lblUserId.Text = nsAccessor.GetCurrentUser(); RSM.ShowMessage(this, RS.Informations.TryConnectOK); } else { RSM.ShowMessage(this, RS.Exclamations.InvalidNotesPassword); } }
/// <summary> /// アイコンを出力する /// </summary> /// <param name="nsAccessor"></param> /// <param name="task"></param> /// <param name="databaseDir"></param> private void ExportDBIcon(NotesAccessor nsAccessor, IMigrateTask task, string databaseDir) { Image rawIcon = nsAccessor.ExportIcon(task.CurrentDb); Image smallIcon = nsAccessor.GetSmallIcon(rawIcon); Image LargeIcon = nsAccessor.GetLargeNotesIcon(rawIcon, task.NotesDbTitle); //元アイコン string iconFile = System.IO.Path.Combine(databaseDir, RSM.GetMessage(RS.StringTable.DBIconName)); rawIcon.Save(iconFile, ImageFormat.Png); //Smallアイコン iconFile = System.IO.Path.Combine(databaseDir, RSM.GetMessage(RS.StringTable.DBSmallIconName)); smallIcon.Save(iconFile, ImageFormat.Png); //大きいアイコン iconFile = System.IO.Path.Combine(databaseDir, RSM.GetMessage(RS.StringTable.DBLargeIconName)); LargeIcon.Save(iconFile, ImageFormat.Png); }
internal Database(NotesAccessor accessor, Domino.NotesDatabase notesDb) { if (!notesDb.IsOpen) { notesDb.Open(); } this._accessor = accessor; this._notesDb = notesDb; this._title = notesDb.Title; this._server = notesDb.Server; this._sourceType = (NotesDbType)(int)notesDb.type; this._targetType = MappingInfo.GetTagetDbType(this._sourceType); this._fileName = notesDb.FileName; this._notesUrl = notesDb.NotesURL; this._replicaId = notesDb.ReplicaID; this._sourcePath = notesDb.FilePath; }
/// <summary> /// /ノーツ設計情報を出力する /// </summary> /// <param name="task"></param> private void ExportNotesInfo(IMigrateTask task) { //データベース接続 Reporter.SetStep(5, 1, RS.Informations.NotesDbConnecting, task.NotesDbTitle); NotesAccessor nsAccessor = GetNotesAccessor(); IDatabase db = null; if (task.CurrentDb == null && !string.IsNullOrEmpty(task.NotesFilePath)) { db = nsAccessor.GetDataBase(task.NotesFilePath, task.NotesServer); task.CurrentDb = db; } //出力フォルダ Reporter.SetStep(10, 2, RS.Informations.NotesDbExporting, task.NotesDbTitle); string baseDir = System.IO.Path.Combine(Config.ExportFolder, task.TaskId); if (System.IO.Directory.Exists(baseDir)) { System.IO.Directory.Delete(baseDir, true); } System.IO.Directory.CreateDirectory(baseDir); //データベースフォルダ string databaseDir = System.IO.Path.Combine(baseDir, "Database"); if (!System.IO.Directory.Exists(databaseDir)) { System.IO.Directory.CreateDirectory(databaseDir); } //アイコン出力する Reporter.ReportStep(RS.Informations.NotesDbExporting, true, task.NotesDbTitle); ExportDBIcon(nsAccessor, task, databaseDir); //DXLファイルを出力する Reporter.ReportStep(RS.Informations.NotesDbExporting, true, task.NotesDbTitle); IDxlReader dxlReader = nsAccessor.ExportDatabaseDxl(db, databaseDir); //イメージソースを出力する Reporter.SetStep(10, 1, RS.Informations.ImageResourceExporting); string imageDir = System.IO.Path.Combine(baseDir, "ImageResource"); dxlReader.SaveImageResources(imageDir, false); //フォームDXLを出力する Reporter.SetStep(5, task.TargetForms.Count * 2, RS.Informations.FormDesignExportStart); ExportFormDxl(task, dxlReader, baseDir); }
/// <summary> /// 入力情報をチェックする /// </summary> private bool ValidNotes() { //NotesPasswordが未入力の場合 if (string.IsNullOrEmpty(this.txtNotesPassword.Text)) { RSM.ShowMessage(this, RS.Exclamations.NotNotesPassword); FocusControl(this.txtNotesPassword); return(false); } //NotesPasswordが違います NotesAccessor nsAccessor = Accessor.AccessorFactory.GetNotesAccessor(); if (nsAccessor.TryConnect(this.txtNotesPassword.Text)) { this.lblUserId.Text = nsAccessor.GetCurrentUser(); } else { RSM.ShowMessage(this, RS.Exclamations.InvalidNotesPassword); FocusControl(this.txtNotesPassword); return(false); } //出力フォルダ if (string.IsNullOrEmpty(this.txtOutputFolder.Text)) { RSM.ShowMessage(this, RS.Exclamations.NotExportFolder); FocusControl(this.txtOutputFolder); return(false); } //出力フォルダの存在チェック if (!System.IO.Directory.Exists(this.txtOutputFolder.Text)) { RSM.ShowMessage(this, RS.Exclamations.ExportFolderNotExists); FocusControl(this.txtOutputFolder); return(false); } return(true); }
/// <summary> /// ノーツアクセサーのインスタンスを取得する /// </summary> /// <param name="password"></param> /// <returns></returns> public static NotesAccessor GetNotesAccessor() { return(NotesAccessor.CreateInstance()); }