mirror of
https://github.com/mm201/pkmn-classic-framework.git
synced 2026-04-24 23:36:51 -05:00
Added C array formatting option to pkgdsprod decoder.
This commit is contained in:
parent
3840a90332
commit
cbe2c5d6f9
|
|
@ -9,9 +9,19 @@
|
|||
<form id="theForm" runat="server">
|
||||
<div>
|
||||
<p>Uplaod your Generation IV box upload, battle video, or dressup capture:</p>
|
||||
<asp:FileUpload ID="fuBox" runat="server" />
|
||||
<asp:Button ID="btnSend" Text="Send" OnClick="btnSend_Click" runat="server" />
|
||||
<div>
|
||||
<asp:Label Text="Format:" AssociatedControlID="rblFormat" runat="server" />
|
||||
<asp:RadioButtonList ID="rblFormat" RepeatDirection="Horizontal" runat="server">
|
||||
<asp:ListItem Text="Hex dump" Value="hd" Selected="True" />
|
||||
<asp:ListItem Text="C array" Value="ca" />
|
||||
</asp:RadioButtonList>
|
||||
</div>
|
||||
<div>
|
||||
<asp:FileUpload ID="fuBox" runat="server" />
|
||||
<asp:Button ID="btnSend" Text="Send" OnClick="btnSend_Click" runat="server" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<asp:Literal ID="litMessage" runat="server" />
|
||||
<asp:PlaceHolder ID="phDecoded" Visible="false" runat="server">
|
||||
<div>
|
||||
|
|
|
|||
|
|
@ -34,11 +34,20 @@ namespace PkmnFoundations.GTS.debug
|
|||
|
||||
CryptMessage(data);
|
||||
|
||||
litDecoded.Text = RenderHex(data.ToHexStringLower());
|
||||
switch (rblFormat.SelectedValue)
|
||||
{
|
||||
case "hd":
|
||||
default:
|
||||
litDecoded.Text = RenderHex(data.ToHexStringLower());
|
||||
break;
|
||||
case "ca":
|
||||
litDecoded.Text = RenderCArray(data.ToHexStringLower());
|
||||
break;
|
||||
}
|
||||
phDecoded.Visible = true;
|
||||
}
|
||||
|
||||
private String RenderHex(String hex)
|
||||
private string RenderHex(string hex)
|
||||
{
|
||||
StringBuilder builder = new StringBuilder();
|
||||
for (int x = 0; x < hex.Length; x += 16)
|
||||
|
|
@ -55,6 +64,22 @@ namespace PkmnFoundations.GTS.debug
|
|||
return builder.ToString();
|
||||
}
|
||||
|
||||
private string RenderCArray(string hex)
|
||||
{
|
||||
StringBuilder builder = new StringBuilder();
|
||||
for (int x = 0; x < hex.Length; x += 2)
|
||||
{
|
||||
if (x > 0)
|
||||
{
|
||||
builder.Append(", ");
|
||||
if (x % 16 == 0) builder.Append("<br />\r\n");
|
||||
}
|
||||
builder.Append("0x");
|
||||
builder.Append(hex.Substring(x, Math.Min(2, hex.Length - x)));
|
||||
}
|
||||
return builder.ToString();
|
||||
}
|
||||
|
||||
private void CryptMessage(byte[] message)
|
||||
{
|
||||
if (message.Length < 5) return;
|
||||
|
|
|
|||
33
web/test/BoxUp.aspx.designer.cs
generated
33
web/test/BoxUp.aspx.designer.cs
generated
|
|
@ -7,11 +7,13 @@
|
|||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace PkmnFoundations.GTS.debug {
|
||||
|
||||
|
||||
public partial class BoxUp {
|
||||
|
||||
namespace PkmnFoundations.GTS.debug
|
||||
{
|
||||
|
||||
|
||||
public partial class BoxUp
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// HeaderColour1 control.
|
||||
/// </summary>
|
||||
|
|
@ -20,7 +22,7 @@ namespace PkmnFoundations.GTS.debug {
|
|||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::PkmnFoundations.Web.HeaderColour HeaderColour1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// theForm control.
|
||||
/// </summary>
|
||||
|
|
@ -29,7 +31,16 @@ namespace PkmnFoundations.GTS.debug {
|
|||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlForm theForm;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// rblFormat control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.RadioButtonList rblFormat;
|
||||
|
||||
/// <summary>
|
||||
/// fuBox control.
|
||||
/// </summary>
|
||||
|
|
@ -38,7 +49,7 @@ namespace PkmnFoundations.GTS.debug {
|
|||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.FileUpload fuBox;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// btnSend control.
|
||||
/// </summary>
|
||||
|
|
@ -47,7 +58,7 @@ namespace PkmnFoundations.GTS.debug {
|
|||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Button btnSend;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// litMessage control.
|
||||
/// </summary>
|
||||
|
|
@ -56,7 +67,7 @@ namespace PkmnFoundations.GTS.debug {
|
|||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Literal litMessage;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// phDecoded control.
|
||||
/// </summary>
|
||||
|
|
@ -65,7 +76,7 @@ namespace PkmnFoundations.GTS.debug {
|
|||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.PlaceHolder phDecoded;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// litDecoded control.
|
||||
/// </summary>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user