void ReadPhysics(string pText)
 {
     switch (pText)
     {
         case "Physics":
             string fileName = $"Physics_{PhysicsCount}.xml";
             xw = XmlWriter.Create(Path.Combine(Folder, fileName), xws);
             filelist.Add(fileName);
             PhysicsCount++;
             xw.WriteStartDocument();
             xw.WriteStartElement("Physics");
             break;
         case "SizeRatio":
             xw.WriteStartElement("SizeRatio");
             xw.WriteAttributeString("Value", br.ReadSingle());
             xw.WriteEndElement();
             break;
         case "Gravity":
             xw.WriteStartElement("Gravity");
             xw.WriteAttributeString("Value", br.ReadSingle());
             xw.WriteEndElement();
             break;
         case "RigidBody":
             xw.WriteStartElement("RigidBody");
             xw.WriteAttributeString("Count", br.ReadInt32());
             xw.WriteEndElement();
             break;
         case "Name":
             xw.WriteStartElement("Name");
             xw.WriteAttributeString("Text", ReadText());
             break;
         case "BoneIdx":
             xw.WriteStartElement("BoneIdx");
             xw.WriteAttributeString("Value", br.ReadInt32());
             xw.WriteEndElement();
             break;
         case "GroupNo":
             xw.WriteStartElement("GroupNo");
             xw.WriteAttributeString("Value", br.ReadByte());
             xw.WriteEndElement();
             break;
         case "UnCollisionGroup":
             xw.WriteStartElement("UnCollisionGroup");
             xw.WriteAttributeString("Value", br.ReadInt16());
             xw.WriteEndElement();
             break;
         case "Shape":
             xw.WriteStartElement("Shape");
             xw.WriteAttributeString("Value", br.ReadByte());
             xw.WriteEndElement();
             break;
         case "Size":
             xw.WriteStartElement("Size");
             xw.WriteVector(br.ReadSingle(), br.ReadSingle(), br.ReadSingle());
             xw.WriteEndElement();
             break;
         case "Pos":
             xw.WriteStartElement("Pos");
             xw.WriteVector(br.ReadSingle(), br.ReadSingle(), br.ReadSingle());
             xw.WriteEndElement();
             break;
         case "Rota":
             xw.WriteStartElement("Rota");
             xw.WriteVector(br.ReadSingle(), br.ReadSingle(), br.ReadSingle());
             xw.WriteEndElement();
             break;
         case "Mass":
             xw.WriteStartElement("Mass");
             xw.WriteAttributeString("Value", br.ReadSingle());
             xw.WriteEndElement();
             break;
         case "MoveAtte":
             xw.WriteStartElement("MoveAtte");
             xw.WriteAttributeString("Value", br.ReadSingle());
             xw.WriteEndElement();
             break;
         case "RotaAtte":
             xw.WriteStartElement("RotaAtte");
             xw.WriteAttributeString("Value", br.ReadSingle());
             xw.WriteEndElement();
             break;
         case "Repulsion":
             xw.WriteStartElement("Repulsion");
             xw.WriteAttributeString("Value", br.ReadSingle());
             xw.WriteEndElement();
             break;
         case "Fric":
             xw.WriteStartElement("Fric");
             xw.WriteAttributeString("Value", br.ReadSingle());
             xw.WriteEndElement();
             break;
         case "CalcType":
             xw.WriteStartElement("CalcType");
             xw.WriteAttributeString("Value", br.ReadByte());
             xw.WriteEndElement();
             break;
         case "EndRigid":
             xw.WriteEndElement();
             break;
         case "Joint":
             xw.WriteStartElement("Joint");
             xw.WriteAttributeString("Count", br.ReadInt32());
             xw.WriteEndElement();
             break;
         case "Type":
             xw.WriteStartElement("Type");
             xw.WriteAttributeString("Value", br.ReadByte());
             xw.WriteEndElement();
             break;
         case "CFM":
             xw.WriteStartElement("CFM");
             xw.WriteAttributeString("Value", br.ReadSingle());
             xw.WriteEndElement();
             break;
         case "ERP":
             xw.WriteStartElement("ERP");
             xw.WriteAttributeString("Value", br.ReadSingle());
             xw.WriteEndElement();
             break;
         case "RigidAIdx":
             xw.WriteStartElement("RigidAIdx");
             xw.WriteAttributeString("Value", br.ReadInt32());
             xw.WriteEndElement();
             break;
         case "RigidBIdx":
             xw.WriteStartElement("RigidBIdx");
             xw.WriteAttributeString("Value", br.ReadInt32());
             xw.WriteEndElement();
             break;
         case "MoveLimMin":
             xw.WriteStartElement("MoveLimMin");
             xw.WriteVector(br.ReadSingle(), br.ReadSingle(), br.ReadSingle());
             xw.WriteEndElement();
             break;
         case "MoveLimMax":
             xw.WriteStartElement("MoveLimMax");
             xw.WriteVector(br.ReadSingle(), br.ReadSingle(), br.ReadSingle());
             xw.WriteEndElement();
             break;
         case "RotaLimMin":
             xw.WriteStartElement("RotaLimMin");
             xw.WriteVector(br.ReadSingle(), br.ReadSingle(), br.ReadSingle());
             xw.WriteEndElement();
             break;
         case "RotaLimMax":
             xw.WriteStartElement("RotaLimMax");
             xw.WriteVector(br.ReadSingle(), br.ReadSingle(), br.ReadSingle());
             xw.WriteEndElement();
             break;
         case "SpringMoveVal":
             xw.WriteStartElement("SpringMoveVal");
             xw.WriteVector(br.ReadSingle(), br.ReadSingle(), br.ReadSingle());
             xw.WriteEndElement();
             break;
         case "SpringRotaVal":
             xw.WriteStartElement("SpringRotaVal");
             xw.WriteVector(br.ReadSingle(), br.ReadSingle(), br.ReadSingle());
             xw.WriteEndElement();
             break;
         case "SpringMoveDamp":
             xw.WriteStartElement("SpringMoveDamp");
             xw.WriteVector(br.ReadSingle(), br.ReadSingle(), br.ReadSingle());
             xw.WriteEndElement();
             break;
         case "SpringRotaDamp":
             xw.WriteStartElement("SpringRotaDamp");
             xw.WriteVector(br.ReadSingle(), br.ReadSingle(), br.ReadSingle());
             xw.WriteEndElement();
             break;
         case "EndJoint":
             xw.WriteEndElement();
             break;
         case "EndPhysics":
             xw.WriteEndElement();
             xw.WriteEndDocument();
             xw.Close();
             break;
     }
 }
 void ReadAnimation(string ptext)
 {
     switch (ptext)
     {
         case "AnimeName":
             string fileName = $"Anime_{AnimeCount}.xml";
             xw = XmlWriter.Create(Path.Combine(Folder, fileName), xws);
             filelist.Add(fileName);
             AnimeCount++;
             xw.WriteStartDocument();
             xw.WriteStartElement("AnimeName");
             xw.WriteAttributeString("Name", ReadText());
             xw.WriteAttributeString("ID", br.ReadInt32());
             break;
         case "Windom_TopScript":
             xw.WriteStartElement("Windom_TopScript");
             xw.WriteString(ReadText());
             xw.WriteEndElement();
             break;
         case "ScriptKey":
             xw.WriteStartElement("ScriptKey");
             xw.WriteAttributeString("Count", br.ReadInt32());
             xw.WriteEndElement();
             break;
         case "Time":
             xw.WriteStartElement("Time");
             xw.WriteAttributeString("Value", br.ReadInt32());
             break;
         case "ScriptText":
             xw.WriteStartElement("ScriptText");
             xw.WriteString(ReadText());
             xw.WriteEndElement();
             break;
         case "End":
             xw.WriteEndElement();
             break;
         case "BoneData":
             xw.WriteStartElement("BoneData");
             break;
         case "BoneName":
             if (lastbone != "")
                 xw.WriteEndElement();
             xw.WriteStartElement("BoneName");
             lastbone = ReadText();
             xw.WriteAttributeString("Text", lastbone);
             break;
         case "CalcType":
             xw.WriteStartElement("CalcType");
             xw.WriteAttributeString("Value", br.ReadByte());
             xw.WriteEndElement();
             break;
         case "PowVal":
             xw.WriteStartElement("PowVal");
             xw.WriteAttributeString("Value", br.ReadSingle());
             xw.WriteEndElement();
             break;
         case "Pos":
             xw.WriteStartElement("Pos");
             xw.WriteVector(br.ReadSingle(), br.ReadSingle(), br.ReadSingle());
             xw.WriteEndElement();
             break;
         case "PosKey":
             xw.WriteStartElement("PosKey");
             xw.WriteAttributeString("Count", br.ReadInt32());
             xw.WriteEndElement();
             break;
         case "Rota":
             xw.WriteStartElement("Rota");
             xw.WriteVector(br.ReadSingle(), br.ReadSingle(), br.ReadSingle(), br.ReadSingle());
             xw.WriteEndElement();
             break;
         case "RotateKey":
             xw.WriteStartElement("RotateKey");
             xw.WriteAttributeString("Count", br.ReadInt32());
             xw.WriteEndElement();
             break;
         case "Scale":
             xw.WriteStartElement("Scale");
             xw.WriteVector(br.ReadSingle(), br.ReadSingle(), br.ReadSingle());
             xw.WriteEndElement();
             break;
         case "ScaleKey":
             xw.WriteStartElement("ScaleKey");
             xw.WriteAttributeString("Count", br.ReadInt32());
             xw.WriteEndElement();
             break;
     }
 }