Пример #1
0
    static int VersionToInt(GamePlatform platform, string version)
    {
        int max = 1000 * 1000 * 1000;

        if (!IsVersionDate(platform, version))
        {
            return(max);
        }
        FloatRef year  = new FloatRef();
        FloatRef month = new FloatRef();
        FloatRef day   = new FloatRef();

        if (platform.FloatTryParse(StringTools.StringSubstring(platform, version, 0, 4), year))
        {
            if (platform.FloatTryParse(StringTools.StringSubstring(platform, version, 5, 2), month))
            {
                if (platform.FloatTryParse(StringTools.StringSubstring(platform, version, 8, 2), day))
                {
                    int year_  = platform.FloatToInt(year.value);
                    int month_ = platform.FloatToInt(month.value);
                    int day_   = platform.FloatToInt(day.value);
                    return(year_ * 10000 + month_ * 100 + day_);
                }
            }
        }
        return(max);
    }
Пример #2
0
    float FloatParse(string s)
    {
        FloatRef ret = new FloatRef();

        p.FloatTryParse(s, ret);
        return(ret.value);
    }
Пример #3
0
    public int GetInt(string key, int default_)
    {
        if (GetString(key, null) == null)
        {
            return(default_);
        }
        FloatRef ret = new FloatRef();

        if (platform.FloatTryParse(GetString(key, null), ret))
        {
            return(platform.FloatToInt(ret.value));
        }
        return(default_);
    }
Пример #4
0
 static int VersionToInt(GamePlatform platform, string version)
 {
     int max = 1000 * 1000 * 1000;
     if (!IsVersionDate(platform, version))
     {
         return max;
     }
     FloatRef year = new FloatRef();
     FloatRef month = new FloatRef();
     FloatRef day = new FloatRef();
     if (platform.FloatTryParse(StringTools.StringSubstring(platform, version, 0, 4), year))
     {
         if (platform.FloatTryParse(StringTools.StringSubstring(platform, version, 5, 2), month))
         {
             if (platform.FloatTryParse(StringTools.StringSubstring(platform, version, 8, 2), day))
             {
                 int year_ = platform.FloatToInt(year.value);
                 int month_ = platform.FloatToInt(month.value);
                 int day_ = platform.FloatToInt(day.value);
                 return year_ * 10000 + month_ * 100 + day_;
             }
         }
     }
     return max;
 }