Skip to content

Commit

Permalink
Fix csv import of LibDat2
Browse files Browse the repository at this point in the history
  • Loading branch information
aianlinb committed Nov 2, 2021
1 parent 1f854be commit 987f0a3
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion LibDat2/DatContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ public virtual void FromCsv(string csv) {
var s = new StringBuilder();
var list = new List<IFieldData[]>(FieldDatas.Count);

for (var chr = 0; chr != -1; chr = sr.Read())
for (var chr = sr.Read(); chr != -1; chr = sr.Read())
switch (chr) {
case '"':
if (sr.Peek() == '"') {
Expand Down
2 changes: 1 addition & 1 deletion LibDat2/LibDat2.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>net5.0</TargetFramework>
<Authors>aianlinb</Authors>
<Copyright>Copyright © 2020-2021 aianlinb.</Copyright>
<Version>0.12.16</Version>
<Version>0.12.17</Version>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand Down
2 changes: 1 addition & 1 deletion LibDat2/Types/Float32Data.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public override void FromString(string value) {

/// <inheritdoc/>
public override string ToString() {
return Value.ToString() + "F";
return Value.ToString() + "f";
}
}
}
2 changes: 1 addition & 1 deletion LibDat2/Types/Float64Data.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public override void FromString(string value) {

/// <inheritdoc/>
public override string ToString() {
return Value.ToString() + "D";
return Value.ToString() + "d";
}
}
}
2 changes: 1 addition & 1 deletion LibGGPK2/GGPKContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public GGPKContainer(string path, bool BundleMode = false, bool SteamMode = fals

// Read ROOT Directory Record
BaseRecord ggpk;
while (!((ggpk = GetRecord()) is GGPKRecord));
while ((ggpk = GetRecord()) is not GGPKRecord);
ggpkRecord = ggpk as GGPKRecord;
rootDirectory = GetRecord(ggpkRecord.RootDirectoryOffset) as DirectoryRecord;
rootDirectory.Name = "ROOT";
Expand Down
2 changes: 1 addition & 1 deletion LibGGPK2/Records/DirectoryRecord.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public DirectoryEntry(uint entryNameHash, long offset)
/// <summary>
/// Use for sort the children of directory.
/// </summary>
public static readonly SortComp Comparer = new SortComp();
public static readonly SortComp Comparer = new();

/// <summary>
/// Records (File/Directory) this directory contains.
Expand Down
2 changes: 1 addition & 1 deletion VisualGGPK2/ErrorWindow.xaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Window x:Class="VisualGGPK2.ErrorWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="ErrorWindow (v0.12.16)" Width="560" Height="500" WindowStartupLocation="CenterScreen" Closing="OnClosing">
Title="ErrorWindow (v0.12.17)" Width="560" Height="500" WindowStartupLocation="CenterScreen" Closing="OnClosing">
<Grid>
<TextBox x:Name="ErrorBox" Text="Loading Exception . . ." Padding="2" IsReadOnly="True" TextWrapping="Wrap" AcceptsReturn="True" Margin="0,0,0,31" ScrollViewer.CanContentScroll="True" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto"/>
<TextBlock FontSize="14"
Expand Down
2 changes: 1 addition & 1 deletion VisualGGPK2/MainWindow.xaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Window x:Class="VisualGGPK2.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="VisualGGPK2 (v0.12.16)" Width="960" Height="560" AllowDrop="True" Loaded="OnLoaded" DragEnter="OnDragEnter" Drop="OnDragDrop">
Title="VisualGGPK2 (v0.12.17)" Width="960" Height="560" AllowDrop="True" Loaded="OnLoaded" DragEnter="OnDragEnter" Drop="OnDragDrop">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="280" MinWidth="10"/>
Expand Down
4 changes: 2 additions & 2 deletions VisualGGPK2/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ private static string GetPatchServer(bool garena = false) {
private void OnSavePngClicked(object sender, RoutedEventArgs e) {
var o = (Tree.SelectedItem as TreeViewItem)?.Tag;
if (o is RecordTreeNode rtn && rtn is not IFileRecord) {
var sfd = new SaveFileDialog { FileName = rtn.Name + ".dir" };
var sfd = new SaveFileDialog { FileName = rtn.Name + ".dir", Filter= "*.png|*.png" };
if (sfd.ShowDialog() == true) {
var bkg = new BackgroundDialog();
Task.Run(() => {
Expand Down Expand Up @@ -688,7 +688,7 @@ private void OnSavePngClicked(object sender, RoutedEventArgs e) {
} else if (o is IFileRecord fr && !(fr as RecordTreeNode).Name.EndsWith(".dds") && !(fr as RecordTreeNode).Name.EndsWith(".dds.header")) {
MessageBox.Show(this, "Selected file is not a DDS file", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
} else {
var sfd = new SaveFileDialog { FileName = Path.GetFileNameWithoutExtension((string)Image.Tag) + ".png" };
var sfd = new SaveFileDialog { FileName = Path.GetFileNameWithoutExtension((string)Image.Tag) + ".png", Filter = "*.png|*.png" };
if (sfd.ShowDialog() == true) {
BitmapSourceSave((BitmapSource)Image.Source, sfd.FileName);
MessageBox.Show(this, "Saved " + sfd.FileName, "Done", MessageBoxButton.OK, MessageBoxImage.Information);
Expand Down
6 changes: 4 additions & 2 deletions VisualGGPK2/MainWindow_Dat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,8 @@ private void OnCSVClicked(object sender, RoutedEventArgs e) {
var dat = DatTable.Tag as DatContainer;
var sfd = new SaveFileDialog() {
FileName = dat.Name + ".csv",
DefaultExt = "csv"
DefaultExt = "csv",
Filter = "*.csv|*.csv"
};
if (sfd.ShowDialog() != true)
return;
Expand All @@ -236,7 +237,8 @@ private void OnImportClicked(object sender, RoutedEventArgs e) {
var dat = DatTable.Tag as DatContainer;
var ofd = new OpenFileDialog() {
FileName = dat.Name + ".csv",
DefaultExt = "csv"
DefaultExt = "csv",
Filter = "*.csv|*.csv|*.*|*.*"
};
if (ofd.ShowDialog() != true)
return;
Expand Down
2 changes: 1 addition & 1 deletion VisualGGPK2/VisualGGPK2.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>net5.0-windows</TargetFramework>
<Authors>aianlinb</Authors>
<Copyright>Copyright © 2020-2021 aianlinb.</Copyright>
<Version>0.12.16</Version>
<Version>0.12.17</Version>
<Platforms>x64</Platforms>
<OutputType>WinExe</OutputType>
<UseWPF>true</UseWPF>
Expand Down

0 comments on commit 987f0a3

Please sign in to comment.