/// <summary> /// Ctor /// </summary> /// <param name="reader">Reader</param> public WorkbookExtractor(VirtualStreamReader reader, WorkBookData workBookData) : base(reader) { this.boundsheets = new List <BoundSheet8>(); this.supBooks = new List <SupBook>(); this.externSheets = new List <ExternSheet>(); this.XCTList = new List <XCT>(); this.CRNList = new List <CRN>(); this.workBookData = workBookData; this.oldOffset = 0; this.extractData(); }
/// <summary> /// Ctor /// </summary> /// <param name="file"></param> public XlsDocument(StructuredStorageReader reader) { this.WorkBookData = new WorkBookData(); this.Storage = reader; if (reader.FullNameOfAllStreamEntries.Contains("\\" + WORKBOOK)) { this.workBookStreamReader = new VirtualStreamReader(reader.GetStream(WORKBOOK)); } else if (reader.FullNameOfAllStreamEntries.Contains("\\" + ALTERNATE1)) { this.workBookStreamReader = new VirtualStreamReader(reader.GetStream(ALTERNATE1)); } else { throw new ExtractorException(ExtractorException.WORKBOOKSTREAMNOTFOUND); } this.workBookExtr = new WorkbookExtractor(this.workBookStreamReader, this.WorkBookData); }
void ConvertCharacterData(WorkBookData data) { // 取得工作頁的數量 var len1 = data.WorkSheetCount; // 指派 jobs 屬性 var property = serializedObject.FindProperty("jobs"); property.ClearArray(); property.arraySize = len1; for (int i = 0; i < len1; i++) { // 取得工作頁內容 var sheet = data.GetWorkSheetData(i); // 指派 m_index 參數 property.GetArrayElementAtIndex(i).FindPropertyRelative("m_index").stringValue = sheet.TabName; // 取得工作頁的 row 數量 var len2 = sheet.Rows; // 指派 m_level 元素寬度,排除掉工作頁的第一行 var levels = property.GetArrayElementAtIndex(i).FindPropertyRelative("m_level"); levels.ClearArray(); levels.arraySize = len2 - 1; // 在此迴圈內賦值 for (int j = 1; j < len2; j++) { levels.GetArrayElementAtIndex(j - 1).FindPropertyRelative("m_level").intValue = int.Parse(sheet.Data[j, 0]); levels.GetArrayElementAtIndex(j - 1).FindPropertyRelative("m_attack").intValue = int.Parse(sheet.Data[j, 1]); levels.GetArrayElementAtIndex(j - 1).FindPropertyRelative("m_defense").intValue = int.Parse(sheet.Data[j, 2]); levels.GetArrayElementAtIndex(j - 1).FindPropertyRelative("m_luck").intValue = int.Parse(sheet.Data[j, 3]); } } }