Beispiel #1
0
        public static PageDataList read(BinaryReader binaryReader)
        {
            PageDataList newObj = new PageDataList();

            newObj.i_bookID           = binaryReader.ReadUInt32();
            newObj.i_maxNumPages      = binaryReader.ReadUInt32();
            newObj.numPages           = binaryReader.ReadUInt32();
            newObj.maxNumCharsPerPage = binaryReader.ReadUInt32();

            uint used_pages = binaryReader.ReadUInt32();

            for (uint i = 0; i < used_pages; i++)
            {
                newObj.pageData.Add(BookPageDataResponse.read(binaryReader));
            }

            newObj.inscription = PStringChar.read(binaryReader);
            newObj.authorId    = binaryReader.ReadUInt32();
            newObj.authorName  = PStringChar.read(binaryReader);

            return(newObj);
        }
Beispiel #2
0
        //コンストラクタ
        internal AdvScenarioLabelData(string scenarioLabel, AdvCommandScenarioLabel scenarioLabelCommand, List <AdvCommand> commandList)
        {
            this.ScenarioLabel        = scenarioLabel;
            this.scenarioLabelCommand = scenarioLabelCommand;
            this.CommandList          = commandList;
            this.PageDataList         = new List <AdvScenarioPageData>();
            if (CommandList.Count <= 0)
            {
                return;
            }

            int commandIndex = 0;

            do
            {
                int begin = commandIndex;
                int end   = GetPageEndCommandIndex(begin);
                //ページデータ追加
                PageDataList.Add(new AdvScenarioPageData(this, PageDataList.Count, CommandList.GetRange(begin, end - begin + 1)));
                commandIndex = end + 1;
            } while (commandIndex < CommandList.Count);

            this.PageDataList.ForEach(x => x.Init());
        }
Beispiel #3
0
 //データのダウンロード
 public void Download(AdvDataManager dataManager)
 {
     PageDataList.ForEach((item) => item.Download(dataManager));
 }
Beispiel #4
0
    public override bool acceptMessageData(BinaryReader messageDataReader, TreeView outputTreeView)
    {
        bool handled = true;

        PacketOpcode opcode = Util.readOpcode(messageDataReader);

        switch (opcode)
        {
        case PacketOpcode.BOOK_DATA_RESPONSE_EVENT:
        {
            PageDataList message = PageDataList.read(messageDataReader);
            message.contributeToTreeView(outputTreeView);
            break;
        }

        case PacketOpcode.BOOK_MODIFY_PAGE_RESPONSE_EVENT:
        {
            BookModifyPageResponse message = BookModifyPageResponse.read(messageDataReader);
            message.contributeToTreeView(outputTreeView);
            break;
        }

        case PacketOpcode.BOOK_ADD_PAGE_RESPONSE_EVENT:
        {
            BookAddPageResponse message = BookAddPageResponse.read(messageDataReader);
            message.contributeToTreeView(outputTreeView);
            break;
        }

        case PacketOpcode.BOOK_DELETE_PAGE_RESPONSE_EVENT:
        {
            BookDeletePageResponse message = BookDeletePageResponse.read(messageDataReader);
            message.contributeToTreeView(outputTreeView);
            break;
        }

        case PacketOpcode.BOOK_PAGE_DATA_RESPONSE_EVENT:
        {
            PageData message = PageData.read(messageDataReader);
            message.contributeToTreeView(outputTreeView);
            break;
        }

        case PacketOpcode.Evt_Writing__BookData_ID:
        {
            BookData message = BookData.read(messageDataReader);
            message.contributeToTreeView(outputTreeView);
            break;
        }

        case PacketOpcode.Evt_Writing__BookModifyPage_ID: {
            BookModifyPage message = BookModifyPage.read(messageDataReader);
            message.contributeToTreeView(outputTreeView);
            break;
        }

        case PacketOpcode.Evt_Writing__BookAddPage_ID: {
            BookAddPage message = BookAddPage.read(messageDataReader);
            message.contributeToTreeView(outputTreeView);
            break;
        }

        case PacketOpcode.Evt_Writing__BookDeletePage_ID: {
            BookDeletePage message = BookDeletePage.read(messageDataReader);
            message.contributeToTreeView(outputTreeView);
            break;
        }

        case PacketOpcode.Evt_Writing__BookPageData_ID: {
            BookPageData message = BookPageData.read(messageDataReader);
            message.contributeToTreeView(outputTreeView);
            break;
        }

        // TODO: Evt_Writing__GetInscription_ID
        case PacketOpcode.Evt_Writing__SetInscription_ID: {
            SetInscription message = SetInscription.read(messageDataReader);
            message.contributeToTreeView(outputTreeView);
            break;
        }

        default: {
            handled = false;
            break;
        }
        }

        return(handled);
    }
Beispiel #5
0
        /*
         * AppendToDocument() is the function that performs the operations designated for this script.
         * This sub will retrieve all of the pages from the source document and
         * append them to the destination document.
         * NOTE: This script uses IOBXDocumentArchiver and the IOBXFileManager.
         * Both objects are required to store a document in this fashion.
         * DocumentArchiver is used to retireve and append pages
         * FileManager is used to commit changes to document already stored in OnBase
         */

        private bool AppendToDocument(Application app, WorkflowEventArgs args, Int64 sourceDocHandle, Int64 destinationDocHandle)
        {
            try
            {
                Document destDocument = app.Core.GetDocumentByID(destinationDocHandle);
                if (destDocument == null)
                {
                    WriteLog(app, string.Format("No Destination document found with handle ( {0} ).", destinationDocHandle.ToString()));
                    strProcessingErrors = string.Format("{0}{1}{2}   No Destination document found with handle ( {4} ).", strProcessingErrors, Environment.NewLine, DateTime.Now, destinationDocHandle.ToString());
                    return(false);
                }
                Rendition         destRendition         = destDocument.DefaultRenditionOfLatestRevision;
                ImageDataProvider destImageDataProvider = app.Core.Retrieval.Image;
                PageData          destPageData          = destImageDataProvider.GetDocument(destRendition);

                Document sourceDocument = app.Core.GetDocumentByID(sourceDocHandle);
                if (sourceDocument == null)
                {
                    WriteLog(app, string.Format("No Source document found with handle ( {0}.", sourceDocHandle.ToString()));
                    strProcessingErrors = String.Format("{0}{1}{2}    No Source document found with handle ({3}).", strProcessingErrors, Environment.NewLine, DateTime.Now, sourceDocHandle.ToString());
                    return(false);
                }

                Rendition         sourceRendition         = sourceDocument.DefaultRenditionOfLatestRevision;
                ImageDataProvider sourceImageDataProvider = app.Core.Retrieval.Image;
                PageData          sourcePageData          = sourceImageDataProvider.GetDocument(sourceRendition);
                PageRangeSet      sourcePageRangeSet      = sourceImageDataProvider.CreatePageRangeSet();
                sourcePageRangeSet.AddRange(1, sourceRendition.NumberOfPages);
                PageDataList sourcePageDataList = sourceImageDataProvider.GetPages(sourceRendition, sourcePageRangeSet);

                if (sourcePageDataList == null)
                {
                    WriteLog(app, string.Format("No pages found in Source document  (ID: {0}.", sourceDocHandle.ToString()));
                    return(false);
                }
                else
                {
                    app.Diagnostics.Write(string.Format("Source Document Handle {0} has {1} pages.", sourceDocHandle.ToString()), sourcePageDataList.Count);
                    // Create a page range object

                    using (DocumentLock documentLock = destDocument.LockDocument())
                    {
                        // Ensure lock was obtained
                        if (documentLock.Status != DocumentLockStatus.LockObtained)
                        {
                            throw new Exception("Document lock not obtained");
                        }

                        long lngPageCount = destDocument.DefaultRenditionOfLatestRevision.NumberOfPages;
                        int  intPageLoc   = Convert.ToInt32(lngPageCount) + 1;

                        destDocument.DefaultRenditionOfLatestRevision.Imaging.AddPages(sourcePageDataList, intPageLoc);
                    }

                    app.Diagnostics.Write(string.Format("Pages added to document {0}", destinationDocHandle.ToString()));
                }
            }
            catch (Exception ex)
            {
                throw new Exception(string.Format("Error in AppendDocument: {0}", ex.Message));
            }
            return(true);
        }