Example #1
0
        public static void uid_load()
        {
            int num = 0;

            clib.imsg("uid_load: {0}", (object)UserDb.uidfile);
            try
            {
                StreamReader streamReader = new StreamReader(UserDb.uidfile);
                string       x;
                while ((x = streamReader.ReadLine()) != null)
                {
                    string[] strArray = x.string_words();
                    if (((IEnumerable <string>)strArray).Count <string>() >= 2)
                    {
                        UserDb.uid_add(strArray[1], clib.atoi(strArray[0]), false);
                        ++num;
                    }
                }
            }
            catch (Exception ex)
            {
                clib.imsg("read uidfile failed {0}", (object)ex.Message);
            }
            clib.imsg("uid_load: read {0} records", (object)num);
        }
Example #2
0
        public static int uid_get(string user)
        {
            int uid;

            if (!UserDb.user_to_uid.TryGetValue(user, out uid))
            {
                uid = new Random().Next(1000000000);
                UserDb.uid_add(user, uid, true);
            }
            return(uid);
        }