예제 #1
0
 internal Sheet(DraftDocument draftFile, int index, string name, SheetPaperUnit units, SHEETINFO info)
 {
     _draftFile = draftFile;
     _index     = index;
     _name      = name;
     _units     = units;
     _info      = info;
 }
        private void LoadSheets()
        {
            List <Sheet> list         = new List <Sheet>();
            MemoryStream memoryStream = null;

            try
            {
                memoryStream = RootStorage.StreamToMemoryStream(StreamName.JDraftDocumentInfo, StorageName.JDraftViewerInfo);

                _documentInfo = memoryStream.ReadStructure <DRAFTDOCUMENTINFO>();

                for (int i = 0; i < _documentInfo.NumberOfSheets; i++)
                {
                    int    sheetNameLength;
                    string name;

                    sheetNameLength  = memoryStream.ReadInt32();
                    sheetNameLength *= 2;

                    name = memoryStream.ReadString(Encoding.Unicode, sheetNameLength, true);

                    SHEETINFO sheetInfo = memoryStream.ReadStructure <SHEETINFO>();

                    list.Add(new Sheet(this, i + 1, name, _documentInfo.Units, sheetInfo));
                }
            }
            catch
            {
                // Swallow exception.
#if DEBUG
                System.Diagnostics.Debugger.Break();
#endif
            }
            finally
            {
                if (memoryStream != null)
                {
                    memoryStream.Close();
                }
            }

            _sheets = list.ToArray();
        }