예제 #1
0
파일: Auth.cs 프로젝트: nastys/PD_Tool
        public void MsgPackWriter(string file, bool JSON)
        {
            MsgPack AuthDB = new MsgPack("AuthDB");

            if (Category != null)
            {
                MsgPack Category = new MsgPack("Category", this.Category.Length);
                for (int i = 0; i < this.Category.Length; i++)
                {
                    Category[i] = this.Category[i];
                }
                AuthDB.Add(Category);
            }

            if (_UID != null)
            {
                MsgPack UID = new MsgPack("UID", _UID.Length);
                for (int i = 0; i < _UID.Length; i++)
                {
                    UID[i] = new MsgPack()
                             .Add("C", _UID[i].Category)
                             .Add("O", _UID[i].OrgUid)
                             .Add("S", _UID[i].Size)
                             .Add("V", _UID[i].Value);
                }
                AuthDB.Add(UID);
            }

            AuthDB.Write(true, file, JSON);
        }
        public void MsgPackWriter(string file, bool json)
        {
            MsgPack authDB = new MsgPack("AuthDB");

            if (Category != null)
            {
                MsgPack category = new MsgPack(Category.Length, "Category");
                for (int i = 0; i < Category.Length; i++)
                {
                    category[i] = (MsgPack)Category[i];
                }
                authDB.Add(category);
            }

            if (UIDs != null)
            {
                MsgPack uid = new MsgPack(UIDs.Length, "UID");
                for (int i = 0; i < UIDs.Length; i++)
                {
                    uid[i] = MsgPack.New.Add("Category", UIDs[i].Category)
                             .Add("OrgUid", UIDs[i].OrgUid)
                             .Add("Size", UIDs[i].Size)
                             .Add("Value", UIDs[i].Value);
                }
                authDB.Add(uid);
            }

            authDB.Write(true, file, json);
        }
예제 #3
0
        public void MsgPackWriter(string file, bool JSON, bool Compact = true)
        {
            if (!Success)
            {
                return;
            }
            MsgPack msgPack = MsgPack.New;

            if (file.Contains("psrData"))
            {
                MsgPack psrData = new MsgPack(psrDat.Length, "psrData");
                for (i = 0; i < psrDat.Length; i++)
                {
                    psrData[i] = psrDat[i].WriteMP();
                }
                msgPack.Add(psrData);
            }
            else if (file.Contains("PvList"))
            {
                if (Compact)
                {
                    msgPack.Add("Compact", Compact);
                }

                MsgPack PvList = new MsgPack(pvList.Length, "PvList");
                for (i = 0; i < pvList.Length; i++)
                {
                    PvList[i] = pvList[i].WriteMP(Compact);
                }
                msgPack.Add(PvList);
            }
            msgPack.Write(file, JSON).Dispose();
        }
예제 #4
0
        public void MsgPackWriter(string file, bool JSON)
        {
            int     i0  = 0;
            int     i1  = 0;
            MsgPack Dex = new MsgPack("Dex", this.Dex.Length);

            for (i0 = 0; i0 < this.Dex.Length; i0++)
            {
                MsgPack EXP  = new MsgPack().Add("Name", this.Dex[i0].Name);
                MsgPack Main = new MsgPack("Main", this.Dex[i0].Main.Count);
                for (i1 = 0; i1 < this.Dex[i0].Main.Count; i1++)
                {
                    Main[i1] = WriteEXP(this.Dex[i0].Main[i1]);
                }
                EXP.Add(Main);

                MsgPack Eyes = new MsgPack("Eyes", this.Dex[i0].Eyes.Count);
                for (i1 = 0; i1 < this.Dex[i0].Eyes.Count; i1++)
                {
                    Eyes[i1] = WriteEXP(this.Dex[i0].Eyes[i1]);
                }
                EXP.Add(Eyes);
                Dex[i0] = EXP;
            }

            Dex.Write(true, file, JSON);
        }
예제 #5
0
        public void MsgPackWriter(string file, bool json)
        {
            if (Dex == null || Dex.Length < 1)
            {
                return;
            }

            MsgPack dex = new MsgPack(Dex.Length, "Dex");

            for (i0 = 0; i0 < Dex.Length; i0++)
            {
                MsgPack exp  = MsgPack.New.Add("Name", this.Dex[i0].Name);
                MsgPack main = new MsgPack(Dex[i0].Main.Count, "Main");
                for (i1 = 0; i1 < Dex[i0].Main.Count; i1++)
                {
                    main[i1] = Dex[i0].Main[i1].Write();
                }
                exp.Add(main);

                MsgPack eyes = new MsgPack(Dex[i0].Eyes.Count, "Eyes");
                for (i1 = 0; i1 < Dex[i0].Eyes.Count; i1++)
                {
                    eyes[i1] = Dex[i0].Eyes[i1].Write();
                }
                exp.Add(eyes);
                dex[i0] = exp;
            }

            dex.Write(true, file, json);
        }
예제 #6
0
파일: STR.cs 프로젝트: korenkonder/PD_Tool
        public void MsgPackWriter(string file, bool json)
        {
            if (Strings == null || Strings.Length == 0)
            {
                return;
            }
            MsgPack str = new MsgPack("STR").Add("Format", header.Format.ToString());

            if (header.UseBigEndian)
            {
                str.Add("UseBigEndian", header.UseBigEndian);
            }
            MsgPack strings = new MsgPack(Strings.Length, "Strings");

            for (int i = 0; i < Strings.Length; i++)
            {
                strings[i] = MsgPack.New.Add("ID", Strings[i].ID);
                if (Strings[i].Str.V != null)
                {
                    if (Strings[i].Str.V != "")
                    {
                        strings[i] = strings[i].Add("Str", Strings[i].Str.V);
                    }
                }
            }
            str.Add(strings);

            str.WriteAfterAll(false, true, file, json);
        }
예제 #7
0
        public void MsgPackWriter(string file, bool JSON)
        {
            MsgPack BoneDB = new MsgPack("BoneDB", Data.Skeleton.Length);

            for (i0 = 0; i0 < Data.Skeleton.Length; i0++)
            {
                MsgPack Skeleton = new MsgPack().Add("Name", Data.Skeleton[i0].Name)
                                   .Add("Field02", Data.Skeleton[i0].Field02);

                MsgPack Bone = new MsgPack("Bone", Data.Skeleton[i0].Bone.Length);
                for (i = 0; i < Data.Skeleton[i0].Bone.Length; i++)
                {
                    Bone[i] = new MsgPack().Add("Type", (byte)Data.Skeleton[i0].Bone[i].Type)
                              .Add("HasParent", Data.Skeleton[i0].Bone[i].HasParent)
                              .Add("ParentNameIndex", Data.Skeleton[i0].Bone[i].ParentNameIndex)
                              .Add("Field01", Data.Skeleton[i0].Bone[i].Field01)
                              .Add("PairNameIndex", Data.Skeleton[i0].Bone[i].PairNameIndex)
                              .Add("Field02", Data.Skeleton[i0].Bone[i].Field02)
                              .Add("Name", Data.Skeleton[i0].Bone[i].Name);
                }
                Skeleton.Add(Bone);

                MsgPack Position = new MsgPack("Position", Data.Skeleton[i0].Position.Length);
                for (i = 0; i < Data.Skeleton[i0].Position.Length; i++)
                {
                    Position[i] = new MsgPack().Add("X", Data.Skeleton[i0].Position[i].X)
                                  .Add("Y", Data.Skeleton[i0].Position[i].Y)
                                  .Add("Z", Data.Skeleton[i0].Position[i].Z);
                }
                Skeleton.Add(Position);

                MsgPack BoneName1 = new MsgPack("BoneName1", Data.Skeleton[i0].BoneName1.Length);
                for (i = 0; i < Data.Skeleton[i0].BoneName1.Length; i++)
                {
                    BoneName1[i] = Data.Skeleton[i0].BoneName1[i];
                }
                Skeleton.Add(BoneName1);

                MsgPack BoneName2 = new MsgPack("BoneName2", Data.Skeleton[i0].BoneName2.Length);
                for (i = 0; i < Data.Skeleton[i0].BoneName2.Length; i++)
                {
                    BoneName2[i] = Data.Skeleton[i0].BoneName2[i];
                }
                Skeleton.Add(BoneName2);

                MsgPack ParentIndice = new MsgPack("ParentIndice", Data.Skeleton[i0].ParentIndice.Length);
                for (i = 0; i < Data.Skeleton[i0].ParentIndice.Length; i++)
                {
                    ParentIndice[i] = Data.Skeleton[i0].ParentIndice[i];
                }
                BoneDB[i0] = Skeleton.Add(ParentIndice);
            }

            BoneDB.Write(true, file, JSON);
        }
예제 #8
0
        public void MsgPackWriter(string file, bool json, bool Compact = true)
        {
            if (!Success)
            {
                return;
            }
            MsgPack msgPack = MsgPack.New;

            if (file.Contains("psrData"))
            {
                if (psrData != null)
                {
                    MsgPack psrData = new MsgPack(this.psrData.Length, "psrData");
                    for (i = 0; i < this.psrData.Length; i++)
                    {
                        psrData[i] = this.psrData[i].WriteMP();
                    }
                    msgPack.Add(psrData);
                }
                else
                {
                    msgPack.Add(new MsgPack("psrData", null));
                }
            }
            else if (file.Contains("PvList"))
            {
                if (pvList != null)
                {
                    if (Compact)
                    {
                        msgPack.Add("Compact", Compact);
                    }

                    MsgPack PvList = new MsgPack(pvList.Length, "PvList");
                    for (i = 0; i < pvList.Length; i++)
                    {
                        PvList[i] = pvList[i].WriteMP(Compact);
                    }
                    msgPack.Add(PvList);
                }
                else
                {
                    msgPack.Add(new MsgPack("PvList", null));
                }
            }
            msgPack.Write(file, json).Dispose();
        }
예제 #9
0
 public static MsgPack Add(this MsgPack MsgPack, string Name, CountPointer <float> val)
 {
     if (val.Count == 1)
     {
         return(MsgPack.Add(new MsgPack(Name, val.Entries[0])));
     }
     else if (val.Count > 1)
     {
         MsgPack Val = new MsgPack(val.Count, Name);
         for (int i = 0; i < val.Count; i++)
         {
             Val[i] = val.Entries[i];
         }
         return(MsgPack.Add(Val));
     }
     return(MsgPack);
 }
예제 #10
0
        public static MsgPack WriteMP(this Key Key, string name)
        {
            if (Key == null)
            {
                return(MsgPack.Null);
            }
            if (Key.Type == null)
            {
                return(MsgPack.Null);
            }

            MsgPack Keys = new MsgPack(name).Add("T", Key.Type);

            if (Key.Trans != null)
            {
                Keys.Add("Post", Key.EPTypePost).Add("Pre", Key.EPTypePre).Add("M", Key.Max);

                if (Key.RawData != null)
                {
                    Keys.Add("RD", true);
                }

                byte    i0    = 0;
                MsgPack Trans = new MsgPack("Trans", Key.Trans.Length);
                for (int i = 0; i < Key.Trans.Length; i++)
                {
                    MsgPack K = new MsgPack(Key.Trans[i].Type + 1);
                    K[0] = Key.Trans[i].Frame;
                    for (i0 = 1; i0 < Key.Trans[i].Type + 1; i0++)
                    {
                        K[i0] = Key.Trans[i].Value[i0 - 1];
                    }
                    Trans[i] = K;
                }
                Keys.Add(Trans);
            }
            else if (Key.Value != 0)
            {
                Keys.Add("V", Key.Value);
            }
            return(Keys);
        }
예제 #11
0
            public MsgPack WriteMP()
            {
                MsgPack msgPack = MsgPack.New.Add("ID", PV_ID);

                if (Version != 1)
                {
                    msgPack.Add("Version", Version);
                }
                if (Edition != 0)
                {
                    msgPack.Add("Edition", Edition);
                }
                if (AdvDemoStart.WU)
                {
                    msgPack.Add("AdvDemoStart", AdvDemoStart.Int);
                }
                if (AdvDemoEnd.WL)
                {
                    msgPack.Add("AdvDemoEnd", AdvDemoEnd.Int);
                }
                if (StartShow.WL)
                {
                    msgPack.Add("StartShow", StartShow.Int);
                }
                if (EndShow.WU)
                {
                    msgPack.Add("EndShow", EndShow.Int);
                }
                return(msgPack);
            }
예제 #12
0
        public void MsgPackWriter(string file, bool JSON)
        {
            if (STRs == null || STRs.Length == 0)
            {
                return;
            }
            MsgPack STR_    = new MsgPack("STR").Add("Format", Header.Format.ToString());
            MsgPack Strings = new MsgPack(STRs.Length, "Strings");

            for (int i = 0; i < STRs.Length; i++)
            {
                Strings[i] = MsgPack.New.Add("ID", STRs[i].ID);
                if (STRs[i].Str.Value != null || STRs[i].Str.Value != "")
                {
                    Strings[i] = Strings[i].Add("Str", STRs[i].Str.Value);
                }
            }
            STR_.Add(Strings);

            STR_.WriteAfterAll(true, file, JSON);
        }
예제 #13
0
        public void MsgPackWriter(string file, bool JSON)
        {
            MsgPack STR_    = new MsgPack("STR").Add("Format", Header.Format.ToString());
            MsgPack Strings = new MsgPack(STRs.Length, "Strings");

            for (int i = 0; i < STRs.Length; i++)
            {
                Strings[i] = MsgPack.New.Add("ID", STRs[i].ID);
                if (STRs[i].Str != null)
                {
                    if (STRs[i].Str != "")
                    {
                        ((MsgPack)Strings[i]).Add("S", STRs[i].Str);
                    }
                }
                ;
            }
            STR_.Add(Strings);

            STR_.Write(true, file, JSON);
        }
예제 #14
0
            public MsgPack WriteMP(bool Compact)
            {
                MsgPack msgPack = MsgPack.New;

                msgPack.Add("ID", PV_ID);
                if (!Enable)
                {
                    msgPack.Add("Enable", Enable);
                }
                if (Extra)
                {
                    msgPack.Add("Extra", Extra);
                }
                if (Compact)
                {
                    if (AdvDemoStart.WriteLower)
                    {
                        msgPack.Add("AdvDemoStart", AdvDemoStart.WriteInt());
                    }
                    if (AdvDemoEnd.WriteLower)
                    {
                        msgPack.Add("AdvDemoEnd", AdvDemoEnd.WriteInt());
                    }
                    if (StartShow.WriteLower)
                    {
                        msgPack.Add("StartShow", StartShow.WriteInt());
                    }
                    if (EndShow.WriteUpper)
                    {
                        msgPack.Add("EndShow", EndShow.WriteInt());
                    }
                }
                else
                {
                    if (AdvDemoStart.WriteLower)
                    {
                        msgPack.Add(AdvDemoStart.WriteMP("AdvDemoStart"));
                    }
                    if (AdvDemoEnd.WriteLower)
                    {
                        msgPack.Add(AdvDemoEnd.WriteMP("AdvDemoEnd"));
                    }
                    if (StartShow.WriteLower)
                    {
                        msgPack.Add(StartShow.WriteMP("StartShow"));
                    }
                    if (EndShow.WriteUpper)
                    {
                        msgPack.Add(EndShow.WriteMP("EndShow"));
                    }
                }
                return(msgPack);
            }
예제 #15
0
 public static MsgPack WriteMP(this ModelTransform MT, MsgPack MTs) =>
 MTs.Add(MT.Rot.WriteMP("Rot"))
 .Add(MT.Scale.WriteMP("Scale"))
 .Add(MT.Trans.WriteMP("Trans"))
 .Add(MT.Visibility.WriteMP("Visibility"));