public static BigInteger NumUserSiegeHistory(User user)
 {
     return(Op.Bytes2BigInt(
                IO.GetStorageWithKeyPath(
                    Const.preUser, user.email,
                    Const.keyTotSiege
                    )
                ));
 }
 public static byte[] FindDataCity(BigInteger serverId, BigInteger cityId)
 {
     return(IO.GetStorageWithKeyPath(
                Const.preServer,
                Op.BigInt2String(serverId),
                Const.preCity,
                Op.BigInt2String(cityId)
                ));
 }
 public static byte[] FindDataSiege(BigInteger serverId, byte[] seigeId)
 {
     return(IO.GetStorageWithKeyPath(
                Const.preServer,
                Op.BigInt2String(serverId),
                Const.preSeige,
                Op.Bytes2String(seigeId)
                ));
 }
 public static byte SaveCity(BigInteger serverID, City city)
 {
     return(IO.SetStorageWithKeyPath(City2Bytes(city)
                                     , Const.preServer
                                     , Op.BigInt2String(serverID)
                                     , Const.preCity
                                     , Op.BigInt2String(city.cityId)
                                     ));
 }
 public static BigInteger NumCitySiegeHistory(BigInteger serverId, BigInteger cityId)
 {
     return(Op.Bytes2BigInt(
                IO.GetStorageWithKeyPath(
                    Const.preServer, Op.BigInt2String(serverId),
                    Const.preCity, Op.BigInt2String(cityId),
                    Const.keyTotSiege
                    )
                ));
 }
 public static byte SaveSiege(Siege siege)
 {
     byte[] data = Seige2Bytes(siege);
     return(IO.SetStorageWithKeyPath(data,
                                     Const.preServer,
                                     Op.BigInt2String(siege.serverID),
                                     Const.preCity,
                                     Op.BigInt2String(siege.cityID)
                                     ));
 }
        public static byte[] FindSiegeDataByCityHistId(BigInteger serverId, BigInteger cityId, BigInteger histId)
        {
            byte[] siegeId = IO.GetStorageWithKeyPath(
                Const.preServer, Op.BigInt2String(serverId),
                Const.preCity, Op.BigInt2String(cityId),
                Const.preSeige, Op.BigInt2String(histId)
                );

            return(FindDataSiege(serverId, siegeId));
        }
        public static BigInteger AddSiegeCityHist(BigInteger serverId, BigInteger cityId, byte[] siegeId)
        {
            BigInteger histId = NumCitySiegeHistory(serverId, cityId);

            IO.SetStorageWithKeyPath(siegeId,
                                     Const.preServer, Op.BigInt2String(serverId),
                                     Const.preCity, Op.BigInt2String(cityId),
                                     Const.preSeige, Op.BigInt2String(histId)
                                     );

            IO.SetStorageWithKeyPath(Op.BigInt2Bytes(histId + 1),
                                     Const.preServer, Op.BigInt2String(serverId),
                                     Const.preCity, Op.BigInt2String(cityId),
                                     Const.keyTotSiege
                                     );
            return(histId);
        }
 public static byte[] ReadWeathers()
 {
     return(IO.GetStorageWithKey(Const.preWeather));
 }
 public static byte SaveWeathers(byte[] weathers)
 {
     return(IO.SetStorageWithKey(Const.preWeather, weathers));
 }
 public static byte[] FindDataUser(string email)
 {
     return(IO.GetStorageWithKeyPath(Const.preUser, email));
 }
 public static byte SaveUser(User user)
 {
     return(IO.SetStorageWithKeyPath(User2Bytes(user), Const.preUser, user.email));
 }
 public static byte[] FindDataCard(byte[] cardID)
 {
     return(IO.GetStorageWithKeyPath(Const.preCard, Op.Bytes2String(cardID)));
 }
 public static byte SaveCard(Card card)
 {
     return(IO.SetStorageWithKeyPath(Card2Bytes(card), Const.preCard, Op.Bytes2String(card.cardID)));
 }