Пример #1
0
        private void IL_A4Imp(ref string text, ref bool flag, ref char[] array, ref int iHex, ref int intSaveLengh)
        {
            for (int i = 0; i < 4; i++)
            {
                text += array[i].ToString();
            }
            if (flag)
            {
                this.txtString.Text = text;
                this.txtFolder.Text = "\\private\\wii\\title\\" + text + "\\";
                this.txtWeizhi.Text = Convert.ToString(iHex, 16) + "h";
                if (iHex != 61732 && iHex != 0)
                {
                    this.txtTest.Text = "非标准存档";
                }
                else
                {
                    this.txtTest.Text = "标准存档";
                }
                this.myMessage(array);
            }
            else
            {
                this.txtString.Text = "无法识别";
                this.ErrorMessage();
            }
            int SaveFileLength;

            if (array[0].ToString() == "G")
            {
                SaveFileLength = intSaveLengh / 1024 / 8 + 1;
            }
            else
            {
                SaveFileLength = intSaveLengh / 1024 / 128 + 1;
            }
            this.txtSize.Text = SaveFileLength.ToString();
        }
Пример #2
0
        private void ReadTest()                 //寻找标识字符串
        {
            int    i = 0;
            int    SaveFileLength;
            int    iHex    = new int();
            string strCode = "";
            bool   flag    = false;

            char[] charCode = new char[4];
            try
            {
                if (dialogOpenWiiSave.FileName != "")
                {
                    FileStream   sri          = new FileStream(dialogOpenWiiSave.FileName, FileMode.Open, FileAccess.Read);
                    int          intSaveLengh = (int)sri.Length;
                    BinaryReader r            = new BinaryReader(sri);

                    for (i = 0; i < intSaveLengh / 4; i++)
                    {
                        charCode[0] = (char)r.ReadByte();
                        charCode[1] = (char)r.ReadByte();
                        charCode[2] = (char)r.ReadByte();
                        charCode[3] = (char)r.ReadByte();

                        flag = IsMyString(charCode);

                        if (flag)
                        {
                            iHex = i * 4;
                            break;
                        }
                    }

                    for (i = 0; i < 4; i++)
                    {
                        strCode += charCode[i].ToString();
                    }

                    if (flag)
                    {
                        txtString.Text = strCode;
                        txtWeizhi.Text = Convert.ToString(iHex, 16) + "h";
                        if (iHex == 61732 || iHex == 0)
                        {
                            txtTest.Text = "标准存档";
                        }
                        else
                        {
                            txtTest.Text = "非标准存档";
                        }
                        myMessage(charCode);
                    }
                    else
                    {
                        txtString.Text = "无法识别";
                        ErrorMessage();
                    }

                    if (charCode[0].ToString() == "G")
                    {
                        SaveFileLength = intSaveLengh / 1024 / 8 + 1;
                    }
                    else
                    {
                        SaveFileLength = intSaveLengh / 1024 / 128 + 1;
                    }
                    txtSize.Text = SaveFileLength.ToString();
                }
            }
            catch
            {
                txtString.Text = "错误!";
                ErrorMessage();
            }
            finally
            {
            }
        }