Exemplo n.º 1
0
        /// <summary>
        /// データベースのアイコンを出力する
        /// </summary>
        /// <param name="db"></param>
        /// <returns></returns>
        public Image ExportIcon(IDatabase db)
        {
            EnsureSession();
            string xml = "";

            Domino.NotesDXLExporter exporter = this._session.CreateDXLExporter();
            exporter.OutputDOCTYPE            = false;
            exporter.ConvertNotesbitmapsToGIF = true;
            Domino.NotesDatabase ndb = db.InnerObject as Domino.NotesDatabase;
            if (!string.IsNullOrEmpty(ndb.Server))
            {
                //Server中のファイルをコピーする
                ndb = this.CloneDatabase(ndb);
            }
            try
            {
                Domino.NotesDocument iconDoc = ndb.GetDocumentByID("FFFF0010");
                xml = exporter.Export(iconDoc);
            }
            catch (Exception)
            {
                Domino.NotesNoteCollection notes = ndb.CreateNoteCollection(false);
                notes.SelectIcon = true;
                notes.BuildCollection();
                xml = exporter.Export(notes);
            }
            byte[]      rawData = GetRawIconData(xml);
            IconCreator creator = new IconCreator();
            Image       rawIcon = creator.getRawIconImage(rawData);

            return(rawIcon);
        }
Exemplo n.º 2
0
        /// <summary>
        /// DXLへ出力
        /// </summary>
        /// <param name="db"></param>
        /// <returns></returns>
        public string ExportDxl(IDatabase db, ExportMode mode)
        {
            EnsureSession();
            bool isColned = false;

            Domino.NotesDXLExporter exporter = this._session.CreateDXLExporter();
            exporter.ForceNoteFormat          = false;
            exporter.OutputDOCTYPE            = false;
            exporter.ConvertNotesbitmapsToGIF = true;
            Domino.NotesDatabase ndb = db.InnerObject as Domino.NotesDatabase;
            if (!string.IsNullOrEmpty(ndb.Server))
            {
                //Server中のファイルをコピーする
                ndb      = this.CloneDatabase(ndb);
                isColned = true;
            }
            try
            {
                Domino.NotesNoteCollection coll = ndb.CreateNoteCollection(false);
                switch (mode)
                {
                case ExportMode.Forms:
                    coll.SelectSharedFields = true;
                    coll.SelectForms        = true;
                    coll.SelectSubforms     = true;
                    break;

                case ExportMode.Icon:
                    coll.SelectIcon = true;
                    break;

                case ExportMode.Views:
                    coll.SelectViews = true;
                    break;

                case ExportMode.Resources:
                    coll.SelectImageResources = true;
                    break;

                case ExportMode.All:
                    coll.SelectAllDesignElements(true);
                    break;

                default:
                    break;
                }
                coll.BuildCollection();
                string xml = exporter.Export(coll);
                return(xml);
            }
            finally
            {
                if (isColned && ndb != null)
                {
                    try
                    {
                        string tempfile = ndb.FilePath;
                        if (System.IO.File.Exists(tempfile))
                        {
                            System.IO.File.Delete(tempfile);
                        }
                    }
                    catch
                    {
                        //一時ファイル削除できない
                    }
                }
            }
        }