(KiriKiri.ICrypt): override ToString method.

This commit is contained in:
morkt 2018-02-18 04:09:50 +04:00
parent f2ae663ae8
commit 590c1b563a
3 changed files with 26 additions and 1 deletions

View File

@ -53,6 +53,11 @@ namespace GameRes.Formats.KiriKiri
/// </summary>
public bool ObfuscatedIndex { get; set; }
public override string ToString ()
{
return this.GetType().Name;
}
public virtual byte Decrypt (Xp3Entry entry, long offset, byte value)
{
byte[] buffer = new byte[1] { value };
@ -308,6 +313,11 @@ namespace GameRes.Formats.KiriKiri
m_key = (byte)key;
}
public override string ToString ()
{
return string.Format ("{0}(0x{1:X02})", base.ToString(), m_key);
}
public override byte Decrypt (Xp3Entry entry, long offset, byte value)
{
return (byte)(value ^ m_key);
@ -814,6 +824,11 @@ namespace GameRes.Formats.KiriKiri
m_seed = seed;
}
public override string ToString ()
{
return string.Format ("{0}(0x{1:X08})", base.ToString(), m_seed);
}
public override byte Decrypt (Xp3Entry entry, long offset, byte value)
{
int key_pos = (int)offset & 0x1F;
@ -881,6 +896,11 @@ namespace GameRes.Formats.KiriKiri
m_key = key;
}
public override string ToString ()
{
return string.Format ("{0}(0x{1:X02})", base.ToString(), m_key);
}
public override byte Decrypt (Xp3Entry entry, long offset, byte value)
{
return (byte)((value ^ m_key) + 1);

View File

@ -87,6 +87,11 @@ namespace GameRes.Formats.KiriKiri
TpmFileName = scheme.TpmFileName;
}
public override string ToString ()
{
return string.Format ("{0}(0x{1:X}, 0x{2:X})", base.ToString(), m_mask, m_offset);
}
static readonly byte[] s_ctl_block_signature = Encoding.ASCII.GetBytes (" Encryption control block");
/// <summary>

View File

@ -12,5 +12,5 @@
DisplayMemberPath="Key" SelectedValuePath="Key"
SelectedValue="{Binding Source={x:Static p:Settings.Default}, Path=XP3Scheme, Mode=TwoWay}"/>
<TextBlock Name="AlgorithmName" DataContext="{Binding ElementName=Scheme, Path=SelectedItem}" Margin="0,5,0,0"
Text="{Binding Path=Value, Mode=OneWay, Converter={StaticResource ClassNameConverter}}"/>
Text="{Binding Path=Value, Mode=OneWay}"/>
</StackPanel>