コード例 #1
0
ファイル: fileio.cs プロジェクト: maxarmin/NetCheatPS3
 /*
  * Appends res to a NetCheat text dump
  */
 public static void AppendDump(MainForm.CodeRes res, String filen)
 {
     using (System.IO.StreamWriter file = new System.IO.StreamWriter(filen, true))
     {
         file.WriteLine(res.addr + " " + misc.ByteAToStringInt(res.val, " ") + " " + res.align);
     }
 }
コード例 #2
0
ファイル: fileio.cs プロジェクト: maxarmin/NetCheatPS3
        /*
         * Reads a single line in a NetCheat text dump int a CodeRes struct
         * Used only by the search results copy feature
         */
        public static MainForm.CodeRes ReadDump(String filen, int index, int align)
        {
            MainForm.CodeRes ret = new MainForm.CodeRes();
            string           a   = "";
            int i = 0;

            using (var sr = new StreamReader(filen))
            {
                for (i = 0; i < index; i++)
                {
                    sr.ReadLine();
                }
                a = sr.ReadLine();
            }

            string[] s = a.Split(' ');
            ret.addr = ulong.Parse(s[0]);
            string val = "";

            ret.align = int.Parse(s[s.Length - 1]);
            if (ret.align < 0)
            {
                int lenStr = int.Parse(s[s.Length - 2]);
                for (i = 0; i < lenStr; i++)
                {
                    val = val + s[i + 1];
                }
                ret.val = misc.StringToByteArray(val);
            }
            else
            {
                for (i = 0; i < align; i++)
                {
                    val = int.Parse(s[i + 1]).ToString("X2") + val;
                }
                if (val != "")
                {
                    ret.val = misc.ValueToByteArray(val, align);
                }
            }


            ret.state = false; //bool.Parse(s[i]);

            return(ret);
        }
コード例 #3
0
ファイル: fileio.cs プロジェクト: maxarmin/NetCheatPS3
        /*
         * Reads a NetCheat text dump into a CodeRes struct array
         */
        public static MainForm.CodeRes[] ReadDumpArray(String filen, long start, long stop, int align)
        {
            if (stop <= start)
            {
                return(null);
            }

            MainForm.CodeRes[] ret = new MainForm.CodeRes[stop - start + 1];
            String[]           a   = new String[stop - start + 1];
            int i = 0;

            if (File.Exists(filen) == false)
            {
                return(null);
            }

            using (var sr = new StreamReader(filen))
            {
                for (i = 0; i <= stop; i++)
                {
                    if (i >= start)
                    {
                        a[i - start] = sr.ReadLine();
                    }
                    else
                    {
                        sr.ReadLine();
                    }
                }
            }

            Application.DoEvents();

            for (int x = 0; x <= (stop - start); x++)
            {
                if (a[x] == null)
                {
                    break;
                }
                string[] s = a[x].Split(' ');
                ret[x].addr = ulong.Parse(s[0]);
                string val = "";
                ret[x].align = int.Parse(s[s.Length - 1]);
                if (align == 0)
                {
                    align = ret[x].align;
                }
                if (ret[x].align < 0)
                {
                    int lenStr = int.Parse(s[s.Length - 2]);
                    ret[x].val = new byte[lenStr];
                    for (i = 0; i < lenStr; i++)
                    {
                        //val = int.Parse(s[i + 1]).ToString("X2") + val;
                        //val = val + (char)int.Parse(s[i + 1]);
                        ret[x].val[i] = (byte)int.Parse(s[i + 1]);
                    }
                    //ret[x].val = misc.GetBytesFromString(val);
                }
                else
                {
                    for (i = 0; i < align; i++)
                    {
                        val = int.Parse(s[i + 1]).ToString("X2") + val;
                    }
                    if (val != "")
                    {
                        ret[x].val = misc.ValueToByteArray(val, align);
                    }
                }

                ret[x].state = false; //bool.Parse(s[i]);
                ret[x].align = align;
                Application.DoEvents();
            }

            return(ret);
        }