diff --git a/Lumina.Example/Program.cs b/Lumina.Example/Program.cs
index 72900fa5..ba0bb335 100644
--- a/Lumina.Example/Program.cs
+++ b/Lumina.Example/Program.cs
@@ -4,6 +4,7 @@
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
+using Lumina.Data;
using Lumina.Data.Structs;
using Lumina.Data.Structs.Excel;
using Lumina.Excel;
@@ -69,7 +70,7 @@ static void Main( string[] args )
Console.WriteLine($"ActionTimeline GetRows(): {actionTimelineRows.Count}");
var zoneSharedGroup = lumina.GetExcelSheet< ZoneSharedGroup >();
- var zsgRows = zoneSharedGroup.GetSubRows();
+ var zsgRows = zoneSharedGroup.GetRows();
Console.WriteLine($"ZoneSharedGroup GetSubRows(): {zsgRows.Count}");
diff --git a/Lumina/Data/Category.cs b/Lumina/Data/Category.cs
index c55aed71..1c0e9f4e 100644
--- a/Lumina/Data/Category.cs
+++ b/Lumina/Data/Category.cs
@@ -9,7 +9,7 @@ namespace Lumina.Data
{
public class Category
{
- public DirectoryInfo RootDir { get; private set; }
+ public DirectoryInfo RootDir { get; }
public byte CategoryId { get; }
@@ -17,11 +17,11 @@ public class Category
public int Chunk { get; }
- public Structs.PlatformId Platform { get; }
+ public PlatformId Platform { get; }
public SqPackIndex SqPackIndex { get; }
- public Dictionary< byte, SqPack > DatFiles { get; internal set; }
+ public Dictionary< byte, SqPack > DatFiles { get; }
public Category(
byte category,
diff --git a/Lumina/Excel/ExcelSheet.cs b/Lumina/Excel/ExcelSheet.cs
index 24532e7e..517c90cd 100644
--- a/Lumina/Excel/ExcelSheet.cs
+++ b/Lumina/Excel/ExcelSheet.cs
@@ -67,14 +67,14 @@ internal T GetRowInternal( int row, int subRow, Language lang )
return rowObj;
}
- public Dictionary< int, T > GetRows()
+ public List< T > GetRows()
{
return GetRows( Lumina.Options.DefaultExcelLanguage );
}
- public Dictionary< int, T > GetRows( Language lang )
+ public List< T > GetRows( Language lang )
{
- var rows = new Dictionary< int, T >();
+ var rows = new List< T >();
var segments = GetLangSegments( lang );
foreach( var segment in segments )
@@ -84,59 +84,31 @@ public Dictionary< int, T > GetRows( Language lang )
var parser = new RowParser( this, file );
- foreach( var rowPtr in rowPtrs )
- {
- var id = (int)rowPtr.RowId;
- parser.SeekToRow( id );
-
- var obj = Activator.CreateInstance< T >();
- obj.PopulateData( parser );
-
- rows[ id ] = obj;
- }
- }
-
- return rows;
- }
-
- public Dictionary< Tuple< int, int >, T > GetSubRows()
- {
- return GetSubRows( Lumina.Options.DefaultExcelLanguage );
- }
-
- public Dictionary< Tuple< int, int >, T > GetSubRows( Language lang )
- {
- if( Header.Variant != ExcelVariant.Subrows )
- {
- throw new InvalidOperationException( "can't use GetSubRows to iterate a sheet that doesn't contain subrows!" );
- }
-
- var rows = new Dictionary< Tuple< int, int >, T >();
- var segments = GetLangSegments( lang );
-
- foreach( var segment in segments )
- {
- var file = segment.File;
-
- var rowPtrs = file.RowData;
-
- var parser = new RowParser( this, file );
-
foreach( var rowPtr in rowPtrs )
{
parser.SeekToRow( (int)rowPtr.RowId );
- // read subrows
- for( int i = 0; i < parser.RowCount; i++ )
+ if( Header.Variant == ExcelVariant.Subrows )
{
- parser.SeekToRow( (int)rowPtr.RowId, i );
+ // read subrows
+ for( int i = 0; i < parser.RowCount; i++ )
+ {
+ parser.SeekToRow( (int)rowPtr.RowId, i );
+ var obj = Activator.CreateInstance< T >();
+
+ obj.PopulateData( parser );
+ rows.Add( obj );
+ }
+ }
+ else
+ {
+ parser.SeekToRow( (int)rowPtr.RowId );
var obj = Activator.CreateInstance< T >();
+
obj.PopulateData( parser );
- var rowIndex = Tuple.Create( (int)rowPtr.RowId, i );
-
- rows[ rowIndex ] = obj;
+ rows.Add( obj );
}
}
}
diff --git a/Lumina/Excel/Generated/ActionTimeline.cs b/Lumina/Excel/Generated/ActionTimeline.cs
index 0b6a6de1..22445b31 100644
--- a/Lumina/Excel/Generated/ActionTimeline.cs
+++ b/Lumina/Excel/Generated/ActionTimeline.cs
@@ -24,8 +24,14 @@ public class ActionTimeline : IExcelRow
public bool IsMotionCanceledByMoving;
public bool IsLoop;
+ public int RowId { get; set; }
+ public int SubRowId { get; set; }
+
public void PopulateData( RowParser parser )
{
+ RowId = parser.Row;
+ SubRowId = parser.SubRow;
+
Name = parser.ReadOffset< string >( 0x0 );
Type = parser.ReadOffset< byte >( 0x6 );
Priority = parser.ReadOffset< byte >( 0x7 );
diff --git a/Lumina/Excel/Generated/ZoneSharedGroup.cs b/Lumina/Excel/Generated/ZoneSharedGroup.cs
index a0059d31..17d7d445 100644
--- a/Lumina/Excel/Generated/ZoneSharedGroup.cs
+++ b/Lumina/Excel/Generated/ZoneSharedGroup.cs
@@ -6,8 +6,14 @@ public class ZoneSharedGroup : IExcelRow
public uint col0;
public uint Quest1;
+ public int RowId { get; set; }
+ public int SubRowId { get; set; }
+
public void PopulateData( RowParser parser )
{
+ RowId = parser.Row;
+ SubRowId = parser.SubRow;
+
col0 = parser.ReadColumn< uint >( 0 );
Quest1 = parser.ReadColumn< uint >( 2 );
}
diff --git a/Lumina/Excel/IExcelRow.cs b/Lumina/Excel/IExcelRow.cs
index e7b73954..a2042635 100644
--- a/Lumina/Excel/IExcelRow.cs
+++ b/Lumina/Excel/IExcelRow.cs
@@ -2,6 +2,9 @@ namespace Lumina.Excel
{
public interface IExcelRow
{
+ int RowId { get; set; }
+ int SubRowId { get; set; }
+
void PopulateData( RowParser parser );
}
}
\ No newline at end of file
diff --git a/Lumina/Lumina.csproj b/Lumina/Lumina.csproj
index 38aabf80..ba19d653 100644
--- a/Lumina/Lumina.csproj
+++ b/Lumina/Lumina.csproj
@@ -7,7 +7,7 @@
https://github.com/NotAdam/Lumina
LICENSE
https://github.com/NotAdam/Lumina
- 1.0.0-preview3
+ 1.0.0-preview4
Lumina is a small, performant and simple library for interacting with FINAL FANTASY XIV game data.
true