Exemple #1
0
 public static void Readdata_RedZimo(ref zimoxinxi zi, int index)
 {
     byte[] array = new byte[(int)Readdata.zimoxinxisize];
     Readdata.myapp.upapp.filesr.BaseStream.Position = (long)((ulong)Readdata.myapp.app.zimoxinxiadd + (ulong)((long)((int)Readdata.zimoxinxisize * index)));
     Readdata.myapp.upapp.filesr.BaseStream.Read(array, 0, (int)Readdata.zimoxinxisize);
     zi = (zimoxinxi)array.BytesTostruct(default(zimoxinxi).GetType());
 }
Exemple #2
0
        private unsafe static uint Findziadd(byte h, byte l, ref zimoxinxi mzimo)
        {
            uint result;

            fixed(zimoxinxi *ptr = &mzimo)
            {
                result = Showfont.Findziadd(h, l, ptr);
            }

            return(result);
        }
Exemple #3
0
        public static bool readdatathis(this Myapp_inf Myapp, StreamReader sr)
        {
            byte[]        array   = new byte[4];
            List <byte[]> list    = new List <byte[]>();
            appinf0       appinf  = default(appinf0);
            appinf1       appinf2 = default(appinf1);
            bool          result;

            try
            {
                sr.BaseStream.Position = 0L;
                byte[] array2 = new byte[datasize.appxinxisize0];
                sr.BaseStream.Read(array2, 0, datasize.appxinxisize0);
                appinf = (appinf0)array2.BytesTostruct(default(appinf0).GetType());
                if (appinf.banbenh > 0 || appinf.banbenl > 35)
                {
                    sr.BaseStream.Position = 196L;
                    sr.BaseStream.Read(array, 0, 4);
                    if ((uint)array.BytesTostruct(0u.GetType()) != array2.getcrc(4294967295u, 0, datasize.appxinxisize0))
                    {
                        result = false;
                        return(result);
                    }
                }
                if (appinf.banbenh == 0 && appinf.banbenl < 33)
                {
                    sr.BaseStream.Position = 0L;
                    array2 = new byte[datasize.appxinxisize0];
                    sr.BaseStream.Read(array2, 0, 16);
                    appinf = (appinf0)array2.BytesTostruct(default(appinf0).GetType());
                    sr.BaseStream.Position = 16L;
                    array2 = new byte[datasize.appxinxisize1];
                    sr.BaseStream.Read(array2, 0, 45);
                    appinf2 = (appinf1)array2.BytesTostruct(default(appinf1).GetType());
                }
                else
                {
                    sr.BaseStream.Position = 200L;
                    array2 = new byte[datasize.appxinxisize1];
                    sr.BaseStream.Read(array2, 0, datasize.appxinxisize1);
                }
                if (appinf.banbenh == 0 && appinf.banbenl > 32 && appinf.banbenl < 36)
                {
                    byte b    = (byte)appinf.Modelcrc;
                    byte mark = appinf.mark;
                    byte b2   = (byte)(appinf.Modelcrc >> 1);
                    byte b3   = (byte)(datasize.hmibiaoshiH >> 1);
                    for (int i = 0; i < 16; i++)
                    {
                        byte[] expr_249_cp_0 = array2;
                        int    expr_249_cp_1 = i;
                        expr_249_cp_0[expr_249_cp_1] ^= b3;
                        byte[] expr_261_cp_0 = array2;
                        int    expr_261_cp_1 = i;
                        expr_261_cp_0[expr_261_cp_1] ^= b2;
                        byte[] expr_279_cp_0 = array2;
                        int    expr_279_cp_1 = i;
                        expr_279_cp_0[expr_279_cp_1] ^= mark;
                        byte[] expr_291_cp_0 = array2;
                        int    expr_291_cp_1 = i;
                        expr_291_cp_0[expr_291_cp_1] ^= b;
                    }
                }
                else if (appinf.banbenh > 0 || appinf.banbenl > 35)
                {
                    if (appinf.filever < 3)
                    {
                        sr.BaseStream.Position = 396L;
                        sr.BaseStream.Read(array, 0, 4);
                        if ((uint)array.BytesTostruct(0u.GetType()) != array2.getcrc(4294967295u, 0, datasize.appxinxisize1 - 14))
                        {
                            result = false;
                            return(result);
                        }
                    }
                    else if (appinf.filever == 3)
                    {
                        sr.BaseStream.Position = 396L;
                        sr.BaseStream.Read(array, 0, 4);
                        if ((uint)array.BytesTostruct(0u.GetType()) != array2.getcrc(4294967295u, 0, datasize.appxinxisize1 - 12))
                        {
                            result = false;
                            return(result);
                        }
                    }
                    else if (appinf.filever < 17)
                    {
                        sr.BaseStream.Position = 396L;
                        sr.BaseStream.Read(array, 0, 4);
                        if ((uint)array.BytesTostruct(0u.GetType()) != array2.getcrc(4294967295u, 0, datasize.appxinxisize1 - 8))
                        {
                            result = false;
                            return(result);
                        }
                    }
                    else
                    {
                        sr.BaseStream.Position = 396L;
                        sr.BaseStream.Read(array, 0, 4);
                        if ((uint)array.BytesTostruct(0u.GetType()) != array2.getcrc(4294967295u, 0, datasize.appxinxisize1))
                        {
                            result = false;
                            return(result);
                        }
                    }
                }
                if (appinf.filever > 5 && appinf.filever < 10)
                {
                    array2 = array2.Appfree8(datasize.apppasseord);
                }
                else if (appinf.filever >= 10)
                {
                    array2 = array2.Appfree10(datasize.apppasseord, appinf.Modelcrc);
                }
                appinf2 = (appinf1)array2.BytesTostruct(default(appinf1).GetType());
                Myapp.images.Clear();
                sr.BaseStream.Position = (long)((ulong)appinf2.picxinxiadd);
                int j;
                for (j = 0; j < (int)appinf2.picqyt; j++)
                {
                    guiimagetype guiimagetype = default(guiimagetype);
                    array2 = new byte[datasize.picxinxisize];
                    sr.BaseStream.Read(array2, 0, datasize.picxinxisize);
                    guiimagetype.picturexinxi = (Picturexinxi)array2.BytesTostruct(default(Picturexinxi).GetType());
                    Myapp.images.Add(guiimagetype);
                }
                sr.BaseStream.Position = (long)((ulong)appinf2.picdataadd);
                for (j = 0; j < Myapp.images.Count; j++)
                {
                    guiimagetype guiimagetype = Myapp.images[j];
                    guiimagetype.imagebytes = new byte[guiimagetype.picturexinxi.imgbytesize];
                    sr.BaseStream.Read(guiimagetype.imagebytes, 0, guiimagetype.imagebytes.Length);
                    Myapp.images[j] = guiimagetype;
                }
                sr.BaseStream.Position = (long)((ulong)appinf2.zimoxinxiadd);
                Myapp.zimos.Clear();
                for (j = 0; j < (int)appinf2.zimoqyt; j++)
                {
                    array2 = new byte[datasize.zimoxinxisize];
                    sr.BaseStream.Read(array2, 0, datasize.zimoxinxisize);
                    zimoxinxi item = (zimoxinxi)array2.BytesTostruct(default(zimoxinxi).GetType());
                    Myapp.zimos.Add(item);
                }
                sr.BaseStream.Position = (long)((ulong)appinf2.zimodataadd);
                Myapp.zimodatas.Clear();
                for (j = 0; j < Myapp.zimos.Count; j++)
                {
                    array2 = new byte[Myapp.zimos[(int)((ushort)j)].size];
                    sr.BaseStream.Read(array2, 0, array2.Length);
                    Myapp.zimodatas.Add(array2);
                }
                sr.BaseStream.Position = (long)((ulong)appinf2.strxinxiadd);
                readdata0.strs.Clear();
                j = 0;
                while ((long)j < (long)((ulong)appinf2.strqyt))
                {
                    array2 = new byte[datasize.strxinxisize];
                    sr.BaseStream.Read(array2, 0, datasize.strxinxisize);
                    readdata0.strs.Add((strxinxi)array2.BytesTostruct(default(strxinxi).GetType()));
                    j++;
                }
                sr.BaseStream.Position = (long)((ulong)appinf2.strdataadd);
                readdata0.strbytes.Clear();
                for (j = 0; j < readdata0.strs.Count; j++)
                {
                    array2 = new byte[(int)readdata0.strs[(int)((ushort)j)].size];
                    sr.BaseStream.Read(array2, 0, array2.Length);
                    readdata0.strbytes.Add(array2);
                }
                sr.BaseStream.Position = (long)((ulong)appinf2.pageadd);
                readdata0.Lpages.Clear();
                for (j = 0; j < (int)appinf2.pageqyt; j++)
                {
                    array2 = new byte[datasize.pagexinxisize_up];
                    sr.BaseStream.Read(array2, 0, array2.Length);
                    readdata0.Lpages.Add((pagexinxi_up)array2.BytesTostruct(default(pagexinxi_up).GetType()));
                }
                sr.BaseStream.Position = (long)((ulong)appinf2.objadd);
                readdata0.Lobjs.Clear();
                for (j = 0; j < (int)appinf2.objqyt; j++)
                {
                    array2 = new byte[datasize.objxinxisize];
                    if (appinf.banbenh == 0 && appinf.banbenl < 33)
                    {
                        sr.BaseStream.Read(array2, 0, array2.Length - 8);
                        array2[array2.Length - 1] = array2[array2.Length - 8 - 1];
                        array2[array2.Length - 2] = array2[array2.Length - 8 - 2];
                        array2[array2.Length - 3] = array2[array2.Length - 8 - 3];
                        array2[array2.Length - 4] = array2[array2.Length - 8 - 4];
                    }
                    else
                    {
                        sr.BaseStream.Read(array2, 0, array2.Length);
                    }
                    readdata0.Lobjs.Add((objxinxi)array2.BytesTostruct(default(objxinxi).GetType()));
                }
                for (j = 0; j < Myapp.zimos.Count; j++)
                {
                    zimoxinxi value = Myapp.zimos[j];
                    if ((int)value.encode < datasize.encodes_App.Length)
                    {
                        if (value.ver == 0 || value.ver == 1)
                        {
                            if (value.encode == 0)
                            {
                                if (value.state == 0 && datasize.Language == 1)
                                {
                                    value.encode = (byte)((value.qyt < 100u) ? 1 : 3);
                                }
                                else
                                {
                                    value.encode = 2;
                                }
                            }
                            value.codelT0    = 255;
                            value.codelV0    = 0;
                            value.codeh_star = datasize.encodes_App[(int)value.encode].codeh_star;
                            value.codeh_end  = datasize.encodes_App[(int)value.encode].codeh_end;
                            value.codel_star = datasize.encodes_App[(int)value.encode].codel_star;
                            value.codel_end  = datasize.encodes_App[(int)value.encode].codel_end;
                        }
                        if (value.ver != 0)
                        {
                            value.ver = datasize.zikuver;
                        }
                        Myapp.zimos[j] = value;
                    }
                    else
                    {
                        Myapp.zimos.RemoveAt(j);
                        Myapp.zimodatas.RemoveAt(j);
                        j--;
                    }
                }
                if (appinf.banbenh == 0 && appinf.banbenl < 33)
                {
                    appinf2.encode = 0;
                    if (readdata0.strbytes.Count > 1)
                    {
                        string @string = Encoding.ASCII.GetString(readdata0.strbytes[1]);
                        if (@string.Length >= 7 && @string.Substring(0, 7) == "encode:")
                        {
                            appinf2.encode = readdata0.strbytes[1][7];
                        }
                    }
                    if ((appinf.old_screenw == 800 && appinf.old_screenh == 480) || (appinf.old_screenw == 480 && appinf.old_screenh == 272))
                    {
                        appinf.lcdscreenw = appinf.old_screenw;
                        appinf.lcdscreenh = appinf.old_screenh;
                        appinf.guidire    = appinf.old_lcddire;
                    }
                    else
                    {
                        appinf.lcdscreenw = appinf.old_screenh;
                        appinf.lcdscreenh = appinf.old_screenw;
                        appinf.guidire    = (byte)((appinf.old_lcddire == 0) ? 1 : 0);
                    }
                    Myapp.guidire = appinf.guidire;
                    new datazhuan(Myapp).ShowDialog();
                }
                Myapp.myencode = appinf2.encode;
                if (Myapp.myencode == 0 || (int)Myapp.myencode >= datasize.encodes_App.Length)
                {
                    Myapp.myencode = ((datasize.Language == 0) ? "gb2312".GetencodeId() : "iso-8859-1".GetencodeId());
                }
                datasize.Myencoding = Encoding.GetEncoding(datasize.encodes_App[(int)Myapp.myencode].encodename);
                Myapp.xilie         = (byte)((appinf.xilie > 2) ? 0 : appinf.xilie);
                Myapp.guidire       = appinf.guidire;
                Myapp.lcdwidth      = ((Myapp.guidire % 2 == 0) ? appinf.lcdscreenw : appinf.lcdscreenh);
                Myapp.lcdheight     = ((Myapp.guidire % 2 == 0) ? appinf.lcdscreenh : appinf.lcdscreenw);
                Myapp.Model         = datasize.Getmodelxinxi(appinf.Modelcrc, (int)Myapp.xilie);
                if (appinf.banbenh == 0 && appinf.banbenl < 30)
                {
                    datasize.Opentouming = false;
                    for (int k = 0; k < Myapp.images.Count; k++)
                    {
                        for (j = 0; j < Myapp.images[k].imagebytes.Length - 1; j += 2)
                        {
                            if ((ushort)Myapp.images[k].imagebytes[j] == datasize.Color_touming && Myapp.images[k].imagebytes[j + 1] == 0)
                            {
                                Myapp.images[k].imagebytes[j] = (byte)datasize.Color_toumingtihuan;
                            }
                        }
                    }
                }
                else
                {
                    datasize.Opentouming = false;
                }
                progform progform = null;
                int      num      = 1;
                int      num2     = 0;
                if (Myapp.images.Count > 0)
                {
                    progform = new progform();
                    num      = (int)(appinf2.zimodataadd - appinf2.picdataadd);
                    num2     = 0;
                    progform.Show();
                    Application.DoEvents();
                    Thread.Sleep(300);
                }
                for (int k = 0; k < Myapp.images.Count; k++)
                {
                    guiimagetype guiimagetype = Myapp.images[k];
                    if (appinf.filever > 6)
                    {
                        guiimagetype.imgxulie    = guiimagetype.imagebytes.subbytes((int)guiimagetype.picturexinxi.imgxuliebeg, (int)((long)guiimagetype.imagebytes.Length - (long)((ulong)guiimagetype.picturexinxi.imgxuliebeg)));
                        guiimagetype.imagebitbmp = (guiimagetype.imgxulie.BytesToClass() as Bitmap);
                        guiimagetype.imagebytes  = guiimagetype.imagebytes.subbytes(0, (int)guiimagetype.picturexinxi.imgxuliebeg);
                        guiimagetype.picturexinxi.imgbytesize = (uint)guiimagetype.imagebytes.Length;
                    }
                    else
                    {
                        guiimagetype.imagebitbmp = Myapp.images[k].imagebytes.GetBitmap(Myapp.images[k].picturexinxi, datasize.Opentouming);
                        guiimagetype.imgxulie    = guiimagetype.imagebitbmp.ClassToBytes();
                    }
                    Myapp.images[k] = guiimagetype;
                    num2           += (int)guiimagetype.picturexinxi.imgbytesize;
                    progform.setprogval(num2 * 100 / num);
                    Application.DoEvents();
                }
                if (progform != null)
                {
                    Application.DoEvents();
                    Thread.Sleep(300);
                    progform.Close();
                }
                Myapp.pages.Clear();
                for (int l = 0; l < readdata0.Lpages.Count; l++)
                {
                    mpage mpage = new mpage(Myapp);
                    if (readdata0.Lpages[l].objqyt == 0)
                    {
                        pagexinxi_up value2 = readdata0.Lpages[l];
                        value2.objqyt       = (byte)((ushort)value2.pagelock - value2.objstar + 1);
                        readdata0.Lpages[l] = value2;
                    }
                    if (appinf.banbenh == 0 && appinf.banbenl < 42)
                    {
                        pagexinxi_up value3 = readdata0.Lpages[l];
                        value3.pagelei      = 0;
                        value3.pagelock     = 0;
                        value3.password     = 0u;
                        readdata0.Lpages[l] = value3;
                    }
                    if (appinf.filever < 13)
                    {
                        pagexinxi_up value3 = readdata0.Lpages[l];
                        value3.password     = 0u;
                        readdata0.Lpages[l] = value3;
                    }
                    mpage.mypage   = readdata0.Lpages[l];
                    mpage.pagename = mpage.mypage.name.structToBytes().Getstring(datasize.Myencoding);
                    if (mpage.mypage.pagelei == 0 && mpage.pagename.ishefaname() != "")
                    {
                        mpage.pagename    = Myapp.getpagename_key(mpage.pagename);
                        mpage.mypage.name = (bytes_14)mpage.pagename.GetbytesssASCII(14).BytesTostruct(default(bytes_14).GetType());
                    }
                    if (mpage.mypage.objqyt > 0)
                    {
                        int num3 = (int)(mpage.mypage.objstar + (ushort)mpage.mypage.objqyt - 1);
                        for (j = (int)mpage.mypage.objstar; j <= num3; j++)
                        {
                            mobj mobj = new mobj(Myapp, mpage);
                            mobj.myobj   = readdata0.Lobjs[j];
                            mobj.objname = readdata0.Lobjs[j].name.structToBytes().Getstring(datasize.Myencoding);
                            list.Clear();
                            for (int m = (int)readdata0.Lobjs[j].zhilingstar; m < (int)(readdata0.Lobjs[j].zhilingend + 1); m++)
                            {
                                list.Add(readdata0.strbytes[m]);
                            }
                            if (appinf.filever < 5)
                            {
                                mobj.Putcodes(list, "end", appinf.filever);
                            }
                            else
                            {
                                mobj.Putcodes(list, "E", appinf.filever);
                            }
                            if (appinf.banbenh == 0 && appinf.banbenl < 36 && mobj.myobj.objType == objtype.Timer)
                            {
                                mobj.Codes[7].AddListString(mobj.Codes[2]);
                                mobj.Codes[2].Clear();
                            }
                            mpage.objs.Add(mobj);
                        }
                    }
                    mpage.objs[0].objname = mpage.pagename;
                    Myapp.pages.Add(mpage);
                }
                Myapp.RefAllID();
                if (appinf.banbenh == 0 && appinf.banbenl == 8)
                {
                    foreach (mpage current in Myapp.pages)
                    {
                        if (current.objs[0].atts.Count == 4 && current.objs[0].atts[2].name.Getstring(datasize.Myencoding) == "pco")
                        {
                            current.objs[0].atts[2].name = "bco".GetbytesssASCII(8);
                        }
                    }
                }
                result = true;
            }
            catch (Exception ex)
            {
                MessageOpen.Show(ex.Message);
                result = false;
            }
            return(result);
        }
Exemple #4
0
        public static bool Savelinfile(this Myapp_inf Myapp, string path, int isbianyi)
        {
            dataput.bianyi = isbianyi;
            StreamWriter streamWriter = new StreamWriter(path);
            appinf0      appinf       = default(appinf0);
            appinf1      appinf2      = default(appinf1);
            uint         num          = Convert.ToUInt32("0xFFFFFFFF", 16);
            bool         result;

            try
            {
                if ((int)Myapp.myencode > datasize.encodes_App.Length)
                {
                    Myapp.myencode = ((datasize.Language == 0) ? "gb2312".GetencodeId() : "iso-8859-1".GetencodeId());
                }
                appinf.banbenh      = datasize.banbenh;
                appinf.banbenl      = datasize.banbenl;
                appinf.filever      = datasize.filever;
                appinf.mark         = ((dataput.bianyi == 1) ? datasize.hmibiaoshiL : datasize.hmibiaoshiH);
                appinf.encodeh_star = datasize.encodes_App[(int)Myapp.myencode].codeh_star;
                if (!Myapp.StructHtoL(ref appinf, ref appinf2))
                {
                    if (dataput.bianyi == 1)
                    {
                        if (datasize.Language == 0)
                        {
                            Myapp.Addbianyierr(string.Concat(new object[]
                            {
                                "编译失败!".Language(),
                                " ",
                                Myapp.errors,
                                "个错误,".Language(),
                                " ",
                                Myapp.warnings.ToString(),
                                "个警告".Language()
                            }));
                        }
                        else
                        {
                            Myapp.Addbianyierr(string.Concat(new object[]
                            {
                                "编译失败!".Language(),
                                " ",
                                Myapp.errors,
                                " ",
                                "个错误,".Language(),
                                " ",
                                Myapp.warnings.ToString(),
                                " ",
                                "个警告".Language()
                            }));
                        }
                    }
                    streamWriter.Close();
                    streamWriter.Dispose();
                    result = false;
                }
                else
                {
                    appinf.datasize += 4u;
                    byte[] array = new byte[400];
                    appinf.structToBytes().CopyTo(array, 0);
                    appinf2.structToBytes().Appfree10(datasize.apppasseord, appinf.Modelcrc).CopyTo(array, 200);
                    uint num2 = array.getcrc(4294967295u, 0, datasize.appxinxisize0);
                    num2.structToBytes().CopyTo(array, 196);
                    num2 = array.getcrc(4294967295u, 200, datasize.appxinxisize1);
                    num2.structToBytes().CopyTo(array, 396);
                    num = array.getcrc(num, 0);
                    streamWriter.BaseStream.Write(array, 0, array.Length);
                    int i;
                    if (dataput.bianyi == 1)
                    {
                        array = new byte[3696];
                        for (i = 0; i < array.Length; i++)
                        {
                            array[i] = 0;
                        }
                        num = array.getcrc(num, 0);
                        streamWriter.BaseStream.Write(array, 0, array.Length);
                    }
                    for (i = 0; i < Myapp.images.Count; i++)
                    {
                        num = Myapp.images[i].imagebytes.getcrc(num, 0);
                        if (dataput.bianyi != 1)
                        {
                            num = Myapp.images[i].imgxulie.getcrc(num, 0);
                        }
                        streamWriter.BaseStream.Write(Myapp.images[i].imagebytes, 0, Myapp.images[i].imagebytes.Length);
                        if (dataput.bianyi != 1)
                        {
                            streamWriter.BaseStream.Write(Myapp.images[i].imgxulie, 0, Myapp.images[i].imgxulie.Length);
                        }
                    }
                    for (i = 0; i < Myapp.zimos.Count; i++)
                    {
                        num = Myapp.zimodatas[i].getcrc(num, 0);
                        streamWriter.BaseStream.Write(Myapp.zimodatas[i], 0, Myapp.zimodatas[i].Length);
                    }
                    if (dataput.bianyi == 1)
                    {
                        int num3 = (Myapp.Getallimgsize(dataput.bianyi) + Myapp.Getallzimosize(false)) % 4096;
                        if (num3 != 0)
                        {
                            array = new byte[4096 - num3];
                            for (i = 0; i < array.Length; i++)
                            {
                                array[i] = 0;
                            }
                            num = array.getcrc(num, 0);
                            streamWriter.BaseStream.Write(array, 0, array.Length);
                        }
                    }
                    for (i = 0; i < dataput.strbytes.Count; i++)
                    {
                        num = dataput.strbytes[i].getcrc(num, 0);
                        streamWriter.BaseStream.Write(dataput.strbytes[i], 0, dataput.strbytes[i].Length);
                    }
                    if (dataput.bianyi == 1)
                    {
                        StreamReader streamReader = new StreamReader(Application.StartupPath + "\\asp" + appinf.xilie.ToString() + ".dll");
                        array = new byte[streamReader.BaseStream.Length];
                        streamReader.BaseStream.Position = 0L;
                        streamReader.BaseStream.Read(array, 0, array.Length);
                        num = array.getcrc(num, 0);
                        streamWriter.BaseStream.Write(array, 0, array.Length);
                        streamReader.Close();
                        streamReader = new StreamReader(Application.StartupPath + "\\cd" + appinf.xilie.ToString() + ".dll");
                        array        = new byte[streamReader.BaseStream.Length];
                        streamReader.BaseStream.Position = 0L;
                        streamReader.BaseStream.Read(array, 0, array.Length);
                        num = array.getcrc(num, 0);
                        streamWriter.BaseStream.Write(array, 0, array.Length);
                        streamReader.Close();
                        streamReader = new StreamReader(Application.StartupPath + "\\syscom.bin");
                        array        = new byte[streamReader.BaseStream.Length];
                        streamReader.BaseStream.Position = 0L;
                        streamReader.BaseStream.Read(array, 0, array.Length);
                        num = array.getcrc(num, 0);
                        streamWriter.BaseStream.Write(array, 0, array.Length);
                        streamReader.Close();
                        streamReader = new StreamReader(Application.StartupPath + "\\input.bin");
                        array        = new byte[streamReader.BaseStream.Length];
                        streamReader.BaseStream.Position = 0L;
                        streamReader.BaseStream.Read(array, 0, array.Length);
                        num = array.getcrc(num, 0);
                        streamWriter.BaseStream.Write(array, 0, array.Length);
                        streamReader.Close();
                    }
                    if (dataput.bianyi == 1)
                    {
                        for (i = 0; i < dataput.pages_down.Count; i++)
                        {
                            array = dataput.pages_down[i].structToBytes();
                            num   = array.getcrc(num, 0);
                            streamWriter.BaseStream.Write(array, 0, array.Length);
                        }
                    }
                    else
                    {
                        for (i = 0; i < Myapp.pages.Count; i++)
                        {
                            array = Myapp.pages[i].mypage.structToBytes();
                            num   = array.getcrc(num, 0);
                            streamWriter.BaseStream.Write(array, 0, array.Length);
                        }
                    }
                    for (i = 0; i < dataput.Lobjs.Count; i++)
                    {
                        array = dataput.Lobjs[i].structToBytes();
                        num   = array.getcrc(num, 0);
                        streamWriter.BaseStream.Write(array, 0, datasize.objxinxisize);
                        if (dataput.bianyi == 1)
                        {
                            num = dataput.Lobjattdatapianyi[i].getcrc(num, 0);
                            streamWriter.BaseStream.Write(dataput.Lobjattdatapianyi[i], 0, dataput.Lobjattdatapianyi[i].Length);
                        }
                    }
                    uint num4 = 0u;
                    for (i = 0; i < (int)appinf2.picqyt; i++)
                    {
                        guiimagetype guiimagetype = Myapp.images[i];
                        guiimagetype.picturexinxi.addbeg    = num4;
                        guiimagetype.picturexinxi.pictureid = (ushort)i;
                        if (dataput.bianyi != 1)
                        {
                            guiimagetype.picturexinxi.imgxuliebeg = guiimagetype.picturexinxi.imgbytesize;
                        }
                        if (dataput.bianyi != 1)
                        {
                            guiimagetype.picturexinxi.imgbytesize = guiimagetype.picturexinxi.imgbytesize + (uint)guiimagetype.imgxulie.Length;
                        }
                        array = guiimagetype.picturexinxi.structToBytes();
                        num   = array.getcrc(num, 0);
                        streamWriter.BaseStream.Write(array, 0, datasize.picxinxisize);
                        num4 += (uint)Myapp.images[i].imagebytes.Length;
                    }
                    i = 0;
                    while ((long)i < (long)((ulong)appinf2.strqyt))
                    {
                        array = dataput.strxinxis[i].structToBytes();
                        num   = array.getcrc(num, 0);
                        streamWriter.BaseStream.Write(array, 0, datasize.strxinxisize);
                        i++;
                    }
                    num4 = 0u;
                    for (i = 0; i < (int)appinf2.zimoqyt; i++)
                    {
                        zimoxinxi zimoxinxi = Myapp.zimos[i];
                        zimoxinxi.addbeg = num4;
                        array            = zimoxinxi.structToBytes();
                        num = array.getcrc(num, 0);
                        streamWriter.BaseStream.Write(array, 0, datasize.zimoxinxisize);
                        num4 += (uint)Myapp.zimodatas[i].Length;
                    }
                    num ^= (uint)((byte)appinf.Modelcrc);
                    num ^= (uint)appinf.mark;
                    num ^= (uint)((byte)appinf.datasize);
                    streamWriter.BaseStream.Write(num.structToBytes(), 0, 4);
                    streamWriter.Close();
                    streamWriter.Dispose();
                    if (dataput.bianyi == 1)
                    {
                        if (datasize.Language == 0)
                        {
                            Myapp.addbianyisuc(string.Concat(new object[]
                            {
                                "编译成功!".Language(),
                                " ",
                                Myapp.errors,
                                "个错误,".Language(),
                                " ",
                                Myapp.warnings.ToString(),
                                "个警告,文件大小:".Language(),
                                appinf.datasize.ToString("000,000")
                            }), (Myapp.warnings > 0) ? Color.Blue : Color.Black);
                        }
                        else
                        {
                            Myapp.addbianyisuc(string.Concat(new object[]
                            {
                                "编译成功!".Language(),
                                " ",
                                Myapp.errors,
                                " ",
                                "个错误,".Language(),
                                " ",
                                Myapp.warnings.ToString(),
                                " ",
                                "个警告,文件大小:".Language(),
                                appinf.datasize.ToString("000,000")
                            }), (Myapp.warnings > 0) ? Color.Blue : Color.Black);
                        }
                    }
                    result = true;
                }
            }
            catch (Exception ex)
            {
                MessageOpen.Show(ex.Message);
                result = false;
            }
            return(result);
        }
Exemple #5
0
        private void qumozhuan()
        {
            guiimagetype value     = default(guiimagetype);
            zimoxinxi    zimoxinxi = default(zimoxinxi);
            byte         b         = Convert.ToByte(this.Myapp.guidire + 10);

            for (int i = 0; i < this.Myapp.images.Count; i++)
            {
                this.label3.Visible = true;
                if (this.Myapp.images[i].picturexinxi.qumo != b)
                {
                    this.label3.Text = "正在转换资源文件:".Language() + i.ToString() + "/" + this.Myapp.images.Count.ToString();
                    Application.DoEvents();
                    int num = (int)this.Myapp.images[i].picturexinxi.qumo;
                    value = this.Myapp.images[i];
                    if (num == 1)
                    {
                        Kuozhan.zhuanimg(this.Myapp.images[i].imagebytes, ref value.imagebytes, (int)this.Myapp.images[i].picturexinxi.W, (int)this.Myapp.images[i].picturexinxi.H);
                        num = 10;
                    }
                    else if (num == 0)
                    {
                        num = 10;
                    }
                    if (num != (int)b)
                    {
                        Kuozhan.getxuanzhuanimage(this.Myapp.images[i].imagebytes, ref value.imagebytes, (int)this.Myapp.images[i].picturexinxi.W, (int)this.Myapp.images[i].picturexinxi.H, num - 10, (int)(b - 10));
                    }
                    value.picturexinxi.qumo = b;
                    this.Myapp.images[i]    = value;
                }
            }
            for (int i = 0; i < this.Myapp.zimos.Count; i++)
            {
                zimoxinxi = this.Myapp.zimos[i];
                if ((int)zimoxinxi.encode < datasize.encodes_App.Length)
                {
                    if (zimoxinxi.ver == 0 || zimoxinxi.ver == 1)
                    {
                        if (zimoxinxi.encode == 0)
                        {
                            if (zimoxinxi.state == 0 && datasize.Language == 1)
                            {
                                zimoxinxi.encode = (byte)((zimoxinxi.qyt < 100u) ? 1 : 3);
                            }
                            else
                            {
                                zimoxinxi.encode = 2;
                            }
                        }
                        zimoxinxi.codelT0    = 255;
                        zimoxinxi.codelV0    = 0;
                        zimoxinxi.codeh_star = datasize.encodes_App[(int)zimoxinxi.encode].codeh_star;
                        zimoxinxi.codeh_end  = datasize.encodes_App[(int)zimoxinxi.encode].codeh_end;
                        zimoxinxi.codel_star = datasize.encodes_App[(int)zimoxinxi.encode].codel_star;
                        zimoxinxi.codel_end  = datasize.encodes_App[(int)zimoxinxi.encode].codel_end;
                    }
                }
                if (zimoxinxi.ver != 0)
                {
                    zimoxinxi.ver = datasize.zikuver;
                }
                this.label3.Visible = true;
                if (this.Myapp.zimos[i].qumo != b)
                {
                    this.label3.Text = "正在转换字库文件:".Language() + i.ToString() + "/" + this.Myapp.zimos.Count.ToString();
                    Application.DoEvents();
                    int num = (int)this.Myapp.zimos[i].qumo;
                    if (zimoxinxi.ver == 0)
                    {
                        if (zimoxinxi.state == 2)
                        {
                            byte[] array = new byte[this.Myapp.zimodatas[i].Length];
                            int    j;
                            for (j = 0; j <= (int)zimoxinxi.datastar; j++)
                            {
                                array[j] = this.Myapp.zimodatas[i][j];
                            }
                            int num2 = (int)(zimoxinxi.datastar + 1);
                            int num3 = num2;
                            int num4 = (int)(zimoxinxi.w * zimoxinxi.h / 8 + 2);
                            j = 0;
                            while ((long)j < (long)((ulong)zimoxinxi.qyt))
                            {
                                array[num2]     = this.Myapp.zimodatas[i][num3];
                                array[num2 + 1] = this.Myapp.zimodatas[i][num3 + 1];
                                num2           += 2;
                                num3           += num4;
                                j++;
                            }
                            num3 = (int)(zimoxinxi.datastar + 1);
                            j    = 0;
                            while ((long)j < (long)((ulong)zimoxinxi.qyt))
                            {
                                num3 += 2;
                                for (int k = 0; k < num4 - 2; k++)
                                {
                                    array[num2] = this.Myapp.zimodatas[i][num3];
                                    num2++;
                                    num3++;
                                }
                                j++;
                            }
                            this.Myapp.zimodatas[i] = array;
                            zimoxinxi.ascstar       = (byte)(this.Myapp.zimos[i].datastar + 1);
                            zimoxinxi.datastar      = (ushort)((uint)zimoxinxi.ascstar + zimoxinxi.qyt * 2u);
                        }
                        else
                        {
                            zimoxinxi.ascstar  = (byte)(this.Myapp.zimos[i].datastar + 1);
                            zimoxinxi.datastar = (ushort)zimoxinxi.ascstar;
                        }
                        this.Myapp.zimodatas[i] = Kuozhan.getxuanzhuanziku(zimoxinxi, this.Myapp.zimodatas[i], 4, 0);
                        num           = 10;
                        zimoxinxi.ver = datasize.zikuver;
                    }
                    if (num != (int)b)
                    {
                        this.Myapp.zimodatas[i] = Kuozhan.getxuanzhuanziku(zimoxinxi, this.Myapp.zimodatas[i], num - 10, (int)(b - 10));
                    }
                    zimoxinxi.qumo      = b;
                    this.Myapp.zimos[i] = zimoxinxi;
                }
            }
        }