예제 #1
0
        public void ToFile(string Path)
        {
            RijndaelManaged Rijndael = new RijndaelManaged();
            Stream stream = new FileStream(Path, FileMode.Create);

            using (stream)
            {
                using (CryptoStream cryptoStream = new CryptoStream(stream, Rijndael.CreateEncryptor(new UnicodeEncoding().GetBytes("h3y_gUyZ"), new UnicodeEncoding().GetBytes("h3y_gUyZ")), CryptoStreamMode.Write))
                {
                    using (BinaryWriter Writer = new BinaryWriter(cryptoStream))
                    {
                        Writer.Write(Release);

                        Writer.Write(27981915666277746uL | (ulong)((byte)3) << 56);
                        Writer.Write(Revision);
                        Writer.Write((ulong)((long)(IsFavorite ? 1 : 0 & 1)));

                        Writer.Write(Name);
                        Writer.Write(Difficulty);
                        Writer.Write(PlayTime.Ticks);
                        Writer.Write(Hair);
                        Writer.Write(HairDye);

                        BitArray bb = new BitArray(new bool[] { false, false, false, false, false, false, false, false });
                        for (int i = 0; i < 8; i++)
                        {
                            bb[i] = HideVisual[i];
                        }
                        Writer.Write(bb.ToByte());
                        bb = new BitArray(new bool[] { false, false, false, false, false, false, false, false });
                        for (int j = 0; j < 2; j++)
                        {
                            bb[j] = HideVisual[j + 8];
                        }
                        Writer.Write(bb.ToByte());

                        Writer.Write(HideMisc);
                        Writer.Write((byte)SkinVariant);
                        Writer.Write(Life);
                        Writer.Write(MaxLife);
                        Writer.Write(Mana);
                        Writer.Write(MaxMana);
                        Writer.Write(ExtraAccessory);
                        Writer.Write(TaxMoney);
                        Writer.Write(HairColor.R);
                        Writer.Write(HairColor.G);
                        Writer.Write(HairColor.B);
                        Writer.Write(SkinColor.R);
                        Writer.Write(SkinColor.G);
                        Writer.Write(SkinColor.B);
                        Writer.Write(EyeColor.R);
                        Writer.Write(EyeColor.G);
                        Writer.Write(EyeColor.B);
                        Writer.Write(ShirtColor.R);
                        Writer.Write(ShirtColor.G);
                        Writer.Write(ShirtColor.B);
                        Writer.Write(UnderShirtColor.R);
                        Writer.Write(UnderShirtColor.G);
                        Writer.Write(UnderShirtColor.B);
                        Writer.Write(PantsColor.R);
                        Writer.Write(PantsColor.G);
                        Writer.Write(PantsColor.B);
                        Writer.Write(ShoeColor.R);
                        Writer.Write(ShoeColor.G);
                        Writer.Write(ShoeColor.B);

                        //Might have to write count = 1 for empty slots

                        for (int k = 0; k < Armor.Length; k++)
                        {
                            Writer.Write(Armor[k].ID);
                            Writer.Write(Armor[k].Prefix);
                        }
                        for (int l = 0; l < Dye.Length; l++)
                        {
                            Writer.Write(Dye[l].ID);
                            Writer.Write(Dye[l].Prefix);
                        }
                        for (int m = 0; m < 58; m++)
                        {
                            Writer.Write(Inventory[m].ID);
                            Writer.Write(Inventory[m].Count);
                            Writer.Write(Inventory[m].Prefix);

                            //Favorited
                            Writer.Write(false);
                        }
                        for (int n = 0; n < MiscEquips.Length; n++)
                        {
                            Writer.Write(MiscEquips[n].ID);
                            Writer.Write(MiscEquips[n].Prefix);
                            Writer.Write(MiscDye[n].ID);
                            Writer.Write(MiscDye[n].Prefix);
                        }
                        for (int num = 0; num < 40; num++)
                        {
                            Writer.Write(Bank[num].ID);
                            Writer.Write(Bank[num].Count);
                            Writer.Write(Bank[num].Prefix);
                        }
                        for (int num2 = 0; num2 < 40; num2++)
                        {
                            Writer.Write(Safe[num2].ID);
                            Writer.Write(Safe[num2].Count);
                            Writer.Write(Safe[num2].Prefix);
                        }
                        for (int num3 = 0; num3 < 22; num3++)
                        {
                            Writer.Write(Buffs[num3].BuffType);
                            Writer.Write(Buffs[num3].BuffTime);
                        }
                        for (int num4 = 0; num4 < 200; num4++)
                        {
                            if (SpN[num4] == null)
                            {
                                Writer.Write(-1);
                                break;
                            }
                            Writer.Write(SpX[num4]);
                            Writer.Write(SpY[num4]);
                            Writer.Write(SpI[num4]);
                            Writer.Write(SpN[num4]);
                        }
                        Writer.Write(HotBarLocked);
                        for (int num5 = 0; num5 < HideInfo.Length; num5++)
                        {
                            Writer.Write(HideInfo[num5]);
                        }
                        Writer.Write(AnglerQuestsFinished);
                        Writer.Flush();
                        cryptoStream.FlushFinalBlock();
                        stream.Flush();
                    }
                }
            }
        }
예제 #2
0
        internal byte GetLedState()
        {
            var ledStateBits = new BitArray (
                new []{
                    FinalRedLedState,
                    FinalGreenLedState,
                    UpdateRedLedState,
                    UpdateGreenLedState,
                    InitialRedLedBlinkingState,
                    InitialGreenLedBlinkingState,
                    RedBlinking,
                    GreenBlinking}
            );

            return ledStateBits.ToByte();
        }