Compare commits
2 Commits
3aeaef9229
...
master
Author | SHA1 | Date | |
---|---|---|---|
d4226132c5 | |||
157ebda24d |
1
App.xaml
1
App.xaml
@ -33,6 +33,7 @@
|
|||||||
<BooleanToVisibilityConverter />
|
<BooleanToVisibilityConverter />
|
||||||
</c:ValueConverterAggregate>
|
</c:ValueConverterAggregate>
|
||||||
<c:MultiValueEqualityConverter x:Key="MultiValueEqualityConverter" />
|
<c:MultiValueEqualityConverter x:Key="MultiValueEqualityConverter" />
|
||||||
|
<c:SizeConverter x:Key="SizeConverter" />
|
||||||
<Style x:Key="CommonStyle" TargetType="Control">
|
<Style x:Key="CommonStyle" TargetType="Control">
|
||||||
<Setter
|
<Setter
|
||||||
Property="Foreground"
|
Property="Foreground"
|
||||||
|
@ -19,6 +19,8 @@ namespace HashCalculator.GUI
|
|||||||
public string InstanceIdString { get; }
|
public string InstanceIdString { get; }
|
||||||
public string TypeIdString { get; }
|
public string TypeIdString { get; }
|
||||||
|
|
||||||
|
public int Size { get; }
|
||||||
|
|
||||||
public string LocalizedNames
|
public string LocalizedNames
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@ -121,6 +123,7 @@ namespace HashCalculator.GUI
|
|||||||
}
|
}
|
||||||
InstanceIdString = $"{InstanceId:x8} ({InstanceId,10})";
|
InstanceIdString = $"{InstanceId:x8} ({InstanceId,10})";
|
||||||
TypeIdString = $"{TypeId:x8} ({TypeId,10})";
|
TypeIdString = $"{TypeId:x8} ({TypeId,10})";
|
||||||
|
Size = asset.InstanceDataSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
private AssetEntry(string kind, string type)
|
private AssetEntry(string kind, string type)
|
||||||
|
@ -175,6 +175,7 @@ namespace HashCalculator.GUI
|
|||||||
}).ConfigureAwait(true);
|
}).ConfigureAwait(true);
|
||||||
AddEntries(entries);
|
AddEntries(entries);
|
||||||
ViewModel.StatusText = $"Manifest文件读取完毕,加载了{_loadedAssets.Count}个素材";
|
ViewModel.StatusText = $"Manifest文件读取完毕,加载了{_loadedAssets.Count}个素材";
|
||||||
|
ViewModel.SizeAvailable = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task CancelLoadingXml()
|
public async Task CancelLoadingXml()
|
||||||
@ -210,6 +211,7 @@ namespace HashCalculator.GUI
|
|||||||
};
|
};
|
||||||
ViewModel.IsXml = true;
|
ViewModel.IsXml = true;
|
||||||
ViewModel.IsXsd = type == InputEntryType.XsdFile;
|
ViewModel.IsXsd = type == InputEntryType.XsdFile;
|
||||||
|
ViewModel.SizeAvailable = false;
|
||||||
var task = LoadXmlInternal(await modXml, tokenSource.Token);
|
var task = LoadXmlInternal(await modXml, tokenSource.Token);
|
||||||
_lastXmlTask = (tokenSource, task).ToTuple();
|
_lastXmlTask = (tokenSource, task).ToTuple();
|
||||||
|
|
||||||
|
33
Converters/SizeConverter.cs
Normal file
33
Converters/SizeConverter.cs
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
using System;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Windows.Data;
|
||||||
|
|
||||||
|
namespace HashCalculator.GUI.Converters
|
||||||
|
{
|
||||||
|
internal class SizeConverter : IValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
var size = (int)value;
|
||||||
|
var suffixes = new[]
|
||||||
|
{
|
||||||
|
(1024, 1.0, ""),
|
||||||
|
(1024 * 1024, 1024.0, "K"),
|
||||||
|
(1024 * 1024 * 1024, 1024 * 1024.0, "M"),
|
||||||
|
};
|
||||||
|
foreach (var (limit, divisor, suffix) in suffixes)
|
||||||
|
{
|
||||||
|
if (size < limit)
|
||||||
|
{
|
||||||
|
return $"{size / divisor:0.00}{suffix}B";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $"{size / (1024.0 * 1024.0 * 1024.0):0.00}GB";
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -291,6 +291,14 @@
|
|||||||
Path=DataContext.ConsiderTypeId,
|
Path=DataContext.ConsiderTypeId,
|
||||||
Converter={StaticResource BooleanToVisibilityConverter}}"
|
Converter={StaticResource BooleanToVisibilityConverter}}"
|
||||||
/>
|
/>
|
||||||
|
<DataGridTextColumn
|
||||||
|
Header="大小"
|
||||||
|
Binding="{Binding Size, Converter={StaticResource SizeConverter}}"
|
||||||
|
FontFamily="Courier New"
|
||||||
|
Visibility="{Binding Source={x:Reference Name=ReferenceProvider},
|
||||||
|
Path=DataContext.SizeAvailable,
|
||||||
|
Converter={StaticResource BooleanToVisibilityConverter}}"
|
||||||
|
/>
|
||||||
</DataGrid.Columns>
|
</DataGrid.Columns>
|
||||||
</DataGrid>
|
</DataGrid>
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
|
@ -150,8 +150,12 @@ namespace HashCalculator.GUI
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
var previousPath = _assets[item];
|
var previousPath = _assets[item];
|
||||||
|
if(!fullPath.Contains("SageXml"))
|
||||||
|
{
|
||||||
TracerListener.WriteLine($"[ModXml] `{fullPath}`: Attempted to add item `{item.Type}:{item.Name}` multiple times - already processed in `{previousPath}`");
|
TracerListener.WriteLine($"[ModXml] `{fullPath}`: Attempted to add item `{item.Type}:{item.Name}` multiple times - already processed in `{previousPath}`");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await Task.WhenAll(includesTasks);
|
await Task.WhenAll(includesTasks);
|
||||||
|
@ -89,6 +89,13 @@ namespace HashCalculator.GUI
|
|||||||
set => SetField(ref _considerTypeId, value, () => GameObjectOnly &= !value);
|
set => SetField(ref _considerTypeId, value, () => GameObjectOnly &= !value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool _sizeAvailable;
|
||||||
|
public bool SizeAvailable
|
||||||
|
{
|
||||||
|
get => _sizeAvailable;
|
||||||
|
set => SetField(ref _sizeAvailable, value);
|
||||||
|
}
|
||||||
|
|
||||||
public Command FilterDisplayEntries { get; }
|
public Command FilterDisplayEntries { get; }
|
||||||
|
|
||||||
private int _totalCount;
|
private int _totalCount;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user