From 590c1b563a56e1f8a42e4448d6fb67a44a676a76 Mon Sep 17 00:00:00 2001 From: morkt Date: Sun, 18 Feb 2018 04:09:50 +0400 Subject: [PATCH] (KiriKiri.ICrypt): override ToString method. --- ArcFormats/KiriKiri/CryptAlgorithms.cs | 20 ++++++++++++++++++++ ArcFormats/KiriKiri/KiriKiriCx.cs | 5 +++++ ArcFormats/KiriKiri/WidgetXP3.xaml | 2 +- 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/ArcFormats/KiriKiri/CryptAlgorithms.cs b/ArcFormats/KiriKiri/CryptAlgorithms.cs index d6f4fc2a..99dc4230 100644 --- a/ArcFormats/KiriKiri/CryptAlgorithms.cs +++ b/ArcFormats/KiriKiri/CryptAlgorithms.cs @@ -53,6 +53,11 @@ namespace GameRes.Formats.KiriKiri /// 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); diff --git a/ArcFormats/KiriKiri/KiriKiriCx.cs b/ArcFormats/KiriKiri/KiriKiriCx.cs index 55bcd9fa..91aaa509 100644 --- a/ArcFormats/KiriKiri/KiriKiriCx.cs +++ b/ArcFormats/KiriKiri/KiriKiriCx.cs @@ -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"); /// diff --git a/ArcFormats/KiriKiri/WidgetXP3.xaml b/ArcFormats/KiriKiri/WidgetXP3.xaml index 31e60a30..f5a36dab 100644 --- a/ArcFormats/KiriKiri/WidgetXP3.xaml +++ b/ArcFormats/KiriKiri/WidgetXP3.xaml @@ -12,5 +12,5 @@ DisplayMemberPath="Key" SelectedValuePath="Key" SelectedValue="{Binding Source={x:Static p:Settings.Default}, Path=XP3Scheme, Mode=TwoWay}"/> + Text="{Binding Path=Value, Mode=OneWay}"/>