/// <summary> /// 将数组转换为BsonArray以放入MongoDB,数组中每个元素都可转换为BsonDocument /// </summary> /// <param name="obj">待转换的数组对象</param> /// <returns>转换后的BsonArray对象</returns> public static MongoDB.Bson.BsonArray ToMongoArray(object obj) { object[] objs = (object[])obj; MongoDB.Bson.BsonArray array = new MongoDB.Bson.BsonArray(); for (int i = 0; i < objs.Length; ++i) { array.Add(ToMongoDocument(objs[i])); } return(array); }
static int _g_get_Values(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); MongoDB.Bson.BsonArray gen_to_be_invoked = (MongoDB.Bson.BsonArray)translator.FastGetCSObj(L, 1); translator.PushAny(L, gen_to_be_invoked.Values); } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } return(1); }
static int _s_set_Capacity(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); MongoDB.Bson.BsonArray gen_to_be_invoked = (MongoDB.Bson.BsonArray)translator.FastGetCSObj(L, 1); gen_to_be_invoked.Capacity = LuaAPI.xlua_tointeger(L, 2); } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } return(0); }
static int _m_IndexOf(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); MongoDB.Bson.BsonArray gen_to_be_invoked = (MongoDB.Bson.BsonArray)translator.FastGetCSObj(L, 1); int gen_param_count = LuaAPI.lua_gettop(L); if (gen_param_count == 2 && translator.Assignable <MongoDB.Bson.BsonValue>(L, 2)) { MongoDB.Bson.BsonValue _value = (MongoDB.Bson.BsonValue)translator.GetObject(L, 2, typeof(MongoDB.Bson.BsonValue)); int gen_ret = gen_to_be_invoked.IndexOf(_value); LuaAPI.xlua_pushinteger(L, gen_ret); return(1); } if (gen_param_count == 3 && translator.Assignable <MongoDB.Bson.BsonValue>(L, 2) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3)) { MongoDB.Bson.BsonValue _value = (MongoDB.Bson.BsonValue)translator.GetObject(L, 2, typeof(MongoDB.Bson.BsonValue)); int _index = LuaAPI.xlua_tointeger(L, 3); int gen_ret = gen_to_be_invoked.IndexOf(_value, _index); LuaAPI.xlua_pushinteger(L, gen_ret); return(1); } if (gen_param_count == 4 && translator.Assignable <MongoDB.Bson.BsonValue>(L, 2) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 4)) { MongoDB.Bson.BsonValue _value = (MongoDB.Bson.BsonValue)translator.GetObject(L, 2, typeof(MongoDB.Bson.BsonValue)); int _index = LuaAPI.xlua_tointeger(L, 3); int _count = LuaAPI.xlua_tointeger(L, 4); int gen_ret = gen_to_be_invoked.IndexOf(_value, _index, _count); LuaAPI.xlua_pushinteger(L, gen_ret); return(1); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } return(LuaAPI.luaL_error(L, "invalid arguments to MongoDB.Bson.BsonArray.IndexOf!")); }
public static bool ContainsTreeInBsonDocument(this MongoDB.Bson.BsonArray nodes, Guid id) { foreach (var node in nodes) { if (node["_id"].AsGuid == id) { return(true); } if (node["Children"] != MongoDB.Bson.BsonNull.Value) { if (node["Children"].AsBsonArray.ContainsTreeInBsonDocument(id)) { return(true); } } } return(false); }
static int __EqMeta(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); if (translator.Assignable <MongoDB.Bson.BsonArray>(L, 1) && translator.Assignable <MongoDB.Bson.BsonArray>(L, 2)) { MongoDB.Bson.BsonArray leftside = (MongoDB.Bson.BsonArray)translator.GetObject(L, 1, typeof(MongoDB.Bson.BsonArray)); MongoDB.Bson.BsonArray rightside = (MongoDB.Bson.BsonArray)translator.GetObject(L, 2, typeof(MongoDB.Bson.BsonArray)); LuaAPI.lua_pushboolean(L, leftside == rightside); return(1); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } return(LuaAPI.luaL_error(L, "invalid arguments to right hand of == operator, need MongoDB.Bson.BsonArray!")); }
static int _m_Clear(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); MongoDB.Bson.BsonArray gen_to_be_invoked = (MongoDB.Bson.BsonArray)translator.FastGetCSObj(L, 1); { gen_to_be_invoked.Clear( ); return(0); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } }
static int _m_Create_xlua_st_(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); { object _value = translator.GetObject(L, 1, typeof(object)); MongoDB.Bson.BsonArray gen_ret = MongoDB.Bson.BsonArray.Create(_value); translator.Push(L, gen_ret); return(1); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } }
public static int __NewIndexer(RealStatePtr L) { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); try { if (translator.Assignable <MongoDB.Bson.BsonArray>(L, 1) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2) && translator.Assignable <MongoDB.Bson.BsonValue>(L, 3)) { MongoDB.Bson.BsonArray gen_to_be_invoked = (MongoDB.Bson.BsonArray)translator.FastGetCSObj(L, 1); int key = LuaAPI.xlua_tointeger(L, 2); gen_to_be_invoked[key] = (MongoDB.Bson.BsonValue)translator.GetObject(L, 3, typeof(MongoDB.Bson.BsonValue)); LuaAPI.lua_pushboolean(L, true); return(1); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } LuaAPI.lua_pushboolean(L, false); return(1); }
static int _m_Equals(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); MongoDB.Bson.BsonArray gen_to_be_invoked = (MongoDB.Bson.BsonArray)translator.FastGetCSObj(L, 1); int gen_param_count = LuaAPI.lua_gettop(L); if (gen_param_count == 2 && translator.Assignable <MongoDB.Bson.BsonArray>(L, 2)) { MongoDB.Bson.BsonArray _obj = (MongoDB.Bson.BsonArray)translator.GetObject(L, 2, typeof(MongoDB.Bson.BsonArray)); bool gen_ret = gen_to_be_invoked.Equals(_obj); LuaAPI.lua_pushboolean(L, gen_ret); return(1); } if (gen_param_count == 2 && translator.Assignable <object>(L, 2)) { object _obj = translator.GetObject(L, 2, typeof(object)); bool gen_ret = gen_to_be_invoked.Equals(_obj); LuaAPI.lua_pushboolean(L, gen_ret); return(1); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } return(LuaAPI.luaL_error(L, "invalid arguments to MongoDB.Bson.BsonArray.Equals!")); }
static int _m_CompareTo(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); MongoDB.Bson.BsonArray gen_to_be_invoked = (MongoDB.Bson.BsonArray)translator.FastGetCSObj(L, 1); int gen_param_count = LuaAPI.lua_gettop(L); if (gen_param_count == 2 && translator.Assignable <MongoDB.Bson.BsonArray>(L, 2)) { MongoDB.Bson.BsonArray _rhs = (MongoDB.Bson.BsonArray)translator.GetObject(L, 2, typeof(MongoDB.Bson.BsonArray)); int gen_ret = gen_to_be_invoked.CompareTo(_rhs); LuaAPI.xlua_pushinteger(L, gen_ret); return(1); } if (gen_param_count == 2 && translator.Assignable <MongoDB.Bson.BsonValue>(L, 2)) { MongoDB.Bson.BsonValue _other = (MongoDB.Bson.BsonValue)translator.GetObject(L, 2, typeof(MongoDB.Bson.BsonValue)); int gen_ret = gen_to_be_invoked.CompareTo(_other); LuaAPI.xlua_pushinteger(L, gen_ret); return(1); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } return(LuaAPI.luaL_error(L, "invalid arguments to MongoDB.Bson.BsonArray.CompareTo!")); }
static int _m_ToString(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); MongoDB.Bson.BsonArray gen_to_be_invoked = (MongoDB.Bson.BsonArray)translator.FastGetCSObj(L, 1); { string gen_ret = gen_to_be_invoked.ToString( ); LuaAPI.lua_pushstring(L, gen_ret); return(1); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } }
static int _m_ToList(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); MongoDB.Bson.BsonArray gen_to_be_invoked = (MongoDB.Bson.BsonArray)translator.FastGetCSObj(L, 1); { System.Collections.Generic.List <MongoDB.Bson.BsonValue> gen_ret = gen_to_be_invoked.ToList( ); translator.Push(L, gen_ret); return(1); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } }
static int _m_Remove(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); MongoDB.Bson.BsonArray gen_to_be_invoked = (MongoDB.Bson.BsonArray)translator.FastGetCSObj(L, 1); { MongoDB.Bson.BsonValue _value = (MongoDB.Bson.BsonValue)translator.GetObject(L, 2, typeof(MongoDB.Bson.BsonValue)); bool gen_ret = gen_to_be_invoked.Remove(_value); LuaAPI.lua_pushboolean(L, gen_ret); return(1); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } }
static int _m_Insert(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); MongoDB.Bson.BsonArray gen_to_be_invoked = (MongoDB.Bson.BsonArray)translator.FastGetCSObj(L, 1); { int _index = LuaAPI.xlua_tointeger(L, 2); MongoDB.Bson.BsonValue _value = (MongoDB.Bson.BsonValue)translator.GetObject(L, 3, typeof(MongoDB.Bson.BsonValue)); gen_to_be_invoked.Insert(_index, _value); return(0); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } }
static int _m_SerializeValues(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); MongoDB.Bson.Serialization.BsonSerializationInfo gen_to_be_invoked = (MongoDB.Bson.Serialization.BsonSerializationInfo)translator.FastGetCSObj(L, 1); { System.Collections.IEnumerable _values = (System.Collections.IEnumerable)translator.GetObject(L, 2, typeof(System.Collections.IEnumerable)); MongoDB.Bson.BsonArray gen_ret = gen_to_be_invoked.SerializeValues(_values); translator.Push(L, gen_ret); return(1); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } }
static int _m_Materialize(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); MongoDB.Bson.RawBsonArray gen_to_be_invoked = (MongoDB.Bson.RawBsonArray)translator.FastGetCSObj(L, 1); { MongoDB.Bson.IO.BsonBinaryReaderSettings _binaryReaderSettings = (MongoDB.Bson.IO.BsonBinaryReaderSettings)translator.GetObject(L, 2, typeof(MongoDB.Bson.IO.BsonBinaryReaderSettings)); MongoDB.Bson.BsonArray gen_ret = gen_to_be_invoked.Materialize(_binaryReaderSettings); translator.Push(L, gen_ret); return(1); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } }
static int _m_CopyTo(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); MongoDB.Bson.BsonArray gen_to_be_invoked = (MongoDB.Bson.BsonArray)translator.FastGetCSObj(L, 1); { MongoDB.Bson.BsonValue[] _array = (MongoDB.Bson.BsonValue[])translator.GetObject(L, 2, typeof(MongoDB.Bson.BsonValue[])); int _arrayIndex = LuaAPI.xlua_tointeger(L, 3); gen_to_be_invoked.CopyTo(_array, _arrayIndex); return(0); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } }
static int _m_Add(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); MongoDB.Bson.MaterializedOnDemandBsonArray gen_to_be_invoked = (MongoDB.Bson.MaterializedOnDemandBsonArray)translator.FastGetCSObj(L, 1); { MongoDB.Bson.BsonValue _value = (MongoDB.Bson.BsonValue)translator.GetObject(L, 2, typeof(MongoDB.Bson.BsonValue)); MongoDB.Bson.BsonArray gen_ret = gen_to_be_invoked.Add(_value); translator.Push(L, gen_ret); return(1); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } }
static int __CreateInstance(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); if (LuaAPI.lua_gettop(L) == 1) { MongoDB.Bson.BsonArray gen_ret = new MongoDB.Bson.BsonArray(); translator.Push(L, gen_ret); return(1); } if (LuaAPI.lua_gettop(L) == 2 && translator.Assignable <System.Collections.Generic.IEnumerable <bool> >(L, 2)) { System.Collections.Generic.IEnumerable <bool> _values = (System.Collections.Generic.IEnumerable <bool>)translator.GetObject(L, 2, typeof(System.Collections.Generic.IEnumerable <bool>)); MongoDB.Bson.BsonArray gen_ret = new MongoDB.Bson.BsonArray(_values); translator.Push(L, gen_ret); return(1); } if (LuaAPI.lua_gettop(L) == 2 && translator.Assignable <System.Collections.Generic.IEnumerable <MongoDB.Bson.BsonValue> >(L, 2)) { System.Collections.Generic.IEnumerable <MongoDB.Bson.BsonValue> _values = (System.Collections.Generic.IEnumerable <MongoDB.Bson.BsonValue>)translator.GetObject(L, 2, typeof(System.Collections.Generic.IEnumerable <MongoDB.Bson.BsonValue>)); MongoDB.Bson.BsonArray gen_ret = new MongoDB.Bson.BsonArray(_values); translator.Push(L, gen_ret); return(1); } if (LuaAPI.lua_gettop(L) == 2 && translator.Assignable <System.Collections.Generic.IEnumerable <System.DateTime> >(L, 2)) { System.Collections.Generic.IEnumerable <System.DateTime> _values = (System.Collections.Generic.IEnumerable <System.DateTime>)translator.GetObject(L, 2, typeof(System.Collections.Generic.IEnumerable <System.DateTime>)); MongoDB.Bson.BsonArray gen_ret = new MongoDB.Bson.BsonArray(_values); translator.Push(L, gen_ret); return(1); } if (LuaAPI.lua_gettop(L) == 2 && translator.Assignable <System.Collections.Generic.IEnumerable <double> >(L, 2)) { System.Collections.Generic.IEnumerable <double> _values = (System.Collections.Generic.IEnumerable <double>)translator.GetObject(L, 2, typeof(System.Collections.Generic.IEnumerable <double>)); MongoDB.Bson.BsonArray gen_ret = new MongoDB.Bson.BsonArray(_values); translator.Push(L, gen_ret); return(1); } if (LuaAPI.lua_gettop(L) == 2 && translator.Assignable <System.Collections.Generic.IEnumerable <int> >(L, 2)) { System.Collections.Generic.IEnumerable <int> _values = (System.Collections.Generic.IEnumerable <int>)translator.GetObject(L, 2, typeof(System.Collections.Generic.IEnumerable <int>)); MongoDB.Bson.BsonArray gen_ret = new MongoDB.Bson.BsonArray(_values); translator.Push(L, gen_ret); return(1); } if (LuaAPI.lua_gettop(L) == 2 && translator.Assignable <System.Collections.Generic.IEnumerable <long> >(L, 2)) { System.Collections.Generic.IEnumerable <long> _values = (System.Collections.Generic.IEnumerable <long>)translator.GetObject(L, 2, typeof(System.Collections.Generic.IEnumerable <long>)); MongoDB.Bson.BsonArray gen_ret = new MongoDB.Bson.BsonArray(_values); translator.Push(L, gen_ret); return(1); } if (LuaAPI.lua_gettop(L) == 2 && translator.Assignable <System.Collections.Generic.IEnumerable <MongoDB.Bson.ObjectId> >(L, 2)) { System.Collections.Generic.IEnumerable <MongoDB.Bson.ObjectId> _values = (System.Collections.Generic.IEnumerable <MongoDB.Bson.ObjectId>)translator.GetObject(L, 2, typeof(System.Collections.Generic.IEnumerable <MongoDB.Bson.ObjectId>)); MongoDB.Bson.BsonArray gen_ret = new MongoDB.Bson.BsonArray(_values); translator.Push(L, gen_ret); return(1); } if (LuaAPI.lua_gettop(L) == 2 && translator.Assignable <System.Collections.Generic.IEnumerable <string> >(L, 2)) { System.Collections.Generic.IEnumerable <string> _values = (System.Collections.Generic.IEnumerable <string>)translator.GetObject(L, 2, typeof(System.Collections.Generic.IEnumerable <string>)); MongoDB.Bson.BsonArray gen_ret = new MongoDB.Bson.BsonArray(_values); translator.Push(L, gen_ret); return(1); } if (LuaAPI.lua_gettop(L) == 2 && translator.Assignable <System.Collections.IEnumerable>(L, 2)) { System.Collections.IEnumerable _values = (System.Collections.IEnumerable)translator.GetObject(L, 2, typeof(System.Collections.IEnumerable)); MongoDB.Bson.BsonArray gen_ret = new MongoDB.Bson.BsonArray(_values); translator.Push(L, gen_ret); return(1); } if (LuaAPI.lua_gettop(L) == 2 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2)) { int _capacity = LuaAPI.xlua_tointeger(L, 2); MongoDB.Bson.BsonArray gen_ret = new MongoDB.Bson.BsonArray(_capacity); translator.Push(L, gen_ret); return(1); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } return(LuaAPI.luaL_error(L, "invalid arguments to MongoDB.Bson.BsonArray constructor!")); }
protected void WhenReceiveDocument(MongoDB.Bson.BsonDocument userDoc) { string userName = this.textBox_name.Text; string userPassword = this.textBox_password.Text; // 아이피 얻어옴 var hostIPList = Util.Utility.GetHostIPList(); // 아이피 배열 만듬 MongoDB.Bson.BsonArray ipArr = new MongoDB.Bson.BsonArray(hostIPList); if (userDoc == null) { var selection = MessageBox.Show(@"해당 계정이 없습니다. 현재 정보로 가입하시겠습니까? ※ 자주 쓰시는 계정정보로 설정하시면 보안문제가 있을 수 있습니다.", "Login Error!", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (selection == DialogResult.Yes) { RijndaelManaged aes = new RijndaelManaged(); aes.KeySize = 256; aes.BlockSize = 128; aes.Mode = CipherMode.CBC; aes.Padding = PaddingMode.PKCS7; aes.GenerateKey(); List<MongoDB.Bson.BsonDocument> overlapDocList; // 계정 중복 확인 if (m_db.CheckCountIf("Users", "Unique", ipArr, out overlapDocList) > 0) { // 중복 var retryResult = MessageBox.Show(@"동일한 IP로 등록된 다른 계정이 존재하여 진행할 수 없습니다. 이전 계정을 삭제하고 이 정보로 다시 가입을 시도하시겠습니까? ※ 이전 계정이 소유한 타일은 전부 초기화됩니다.", "Login Error!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (retryResult == DialogResult.Yes) { DeleteUser(overlapDocList); } else { EnableUI(); return; } } // 개인정보수집 동의 if (MessageBox.Show(@"[안내] 계정의 중복을 확인하기 위해서 로그인시 현재 PC의 IP주소와 MAC주소를 DB로 전송합니다. 계정의 정보를 확인하는 것 외의 목적으로 사용되지 않습니다. 동의하시겠습니까?", "Agreement", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes) { EnableUI(); return; } // 계정정보 암호화 string encryptKey = BitConverter.ToString(aes.Key).Replace("-", ""); string encryptedPass = Util.EncoderDecoder.Encode(userPassword, aes.Key); // 계정 생성 userDoc = m_db.CreateDocument("Users", userName, new MongoDB.Bson.BsonDocument { { "Name", userName }, { "Pass", encryptedPass }, { "Key", encryptKey }, { "Unique", ipArr } }); // 계정 생성 실패시 if (userDoc == null) { MessageBox.Show("계정을 생성할 수 없습니다.", "DB Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); EnableUI(); return; } } else { EnableUI(); return; } } else { // 암호화된 암호 해독 string encryptKey = userDoc["Key"].AsString; string decryptedPass = Util.EncoderDecoder.Decode(userDoc["Pass"].AsString, Enumerable.Range(0, encryptKey.Length) .Where(x => x % 2 == 0) .Select(x => Convert.ToByte(encryptKey.Substring(x, 2), 16)) .ToArray()); // 로그인 정보 대조 if (userDoc["Name"] != userName || decryptedPass != userPassword) { MessageBox.Show("로그인 정보가 올바르지 않습니다.", "Login Error!", MessageBoxButtons.OK, MessageBoxIcon.Warning); EnableUI(); return; } else { // 계정의 아이피 정보 갱신 if (userDoc["Unique"] != ipArr) { userDoc["Unique"] = ipArr; m_db.UpdateDocument("Users", userName, userDoc); } // 계정 중복 확인 List<MongoDB.Bson.BsonDocument> overlapDocList; if (m_db.CheckCountIf("Users", "Unique", ipArr, out overlapDocList) > 1) { var retryResult = MessageBox.Show(@"동일한 IP로 등록된 다른 계정이 존재하여 진행할 수 없습니다. 이전 계정을 삭제하고 이 정보로 다시 가입을 시도하시겠습니까? ※ 이전 계정이 소유한 타일은 전부 초기화됩니다.", "Login Error!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (retryResult == DialogResult.Yes) { // 현재 계정은 삭제될 계정 목록에서 제거 overlapDocList.RemoveAll(delegate (MongoDB.Bson.BsonDocument doc) { return (doc["Name"] == userName); }); DeleteUser(overlapDocList); } else { EnableUI(); return; } } } } // 여기까지 왔으면 로그인 성공 EnableUI(); // 자동 로그인 정보 갱신 this.Invoke(new MethodInvoker(() => this.UpdateAutoLogin())); // 게임 화면 띄우기 this.Invoke(new MethodInvoker(() => this.SequenceToGame())); }
public async Task <object> SaveBOsAsync(List <BO2> bos) { var saveBOs = new List <string>(); var updateOptions = new UpdateOptions { IsUpsert = true }; var filterDict = new Dictionary <string, object[]>(); filterDict["bot"] = new object[] { string.Empty }; filterDict["bo"] = new object[] { string.Empty }; foreach (var bo in bos) { filterDict["bot"][0] = bo.BOT; filterDict["bo"][0] = bo.BO; var filter = this.BOBsonDocumentCollection.BuildFilter(filterDict); using (var cursor = (await this.BOBsonDocumentCollection.FindAsync(filter))) { var oldDoc = await cursor.FirstOrDefaultAsync(); if (oldDoc == null) { var doc = ConvertFrom <BO2>(bo); await this.BOBsonDocumentCollection.ReplaceOneAsync(filter, doc, updateOptions); saveBOs.Add(bo.BO); continue; } if (!bo.BOID.IsNullOrEmpty()) { oldDoc["boid"] = new MongoDB.Bson.BsonString(bo.BOID); } if (!bo.Alias.IsNullOrEmpty()) { oldDoc["alias"] = new MongoDB.Bson.BsonArray(bo.Alias); } if (bo.Location != null) { var js = bo.Location.ToJson(); var doc = MongoDB.Bson.BsonDocument.Parse(js); oldDoc["location"] = doc; } if (!bo.Properties.IsNullOrEmpty()) { var oldProperties = oldDoc["properties"]; if (oldProperties == null) { oldDoc["properties"] = MongoDB.Bson.BsonValue.Create(bo.Properties); } else { foreach (var pair in bo.Properties) { oldProperties[pair.Key] = MongoDB.Bson.BsonValue.Create(pair.Value); } } } await this.BOBsonDocumentCollection.ReplaceOneAsync(filter, oldDoc, updateOptions); saveBOs.Add(bo.BO); } } return(saveBOs); }
static int _m_AddRange(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); MongoDB.Bson.BsonArray gen_to_be_invoked = (MongoDB.Bson.BsonArray)translator.FastGetCSObj(L, 1); int gen_param_count = LuaAPI.lua_gettop(L); if (gen_param_count == 2 && translator.Assignable <System.Collections.Generic.IEnumerable <bool> >(L, 2)) { System.Collections.Generic.IEnumerable <bool> _values = (System.Collections.Generic.IEnumerable <bool>)translator.GetObject(L, 2, typeof(System.Collections.Generic.IEnumerable <bool>)); MongoDB.Bson.BsonArray gen_ret = gen_to_be_invoked.AddRange(_values); translator.Push(L, gen_ret); return(1); } if (gen_param_count == 2 && translator.Assignable <System.Collections.Generic.IEnumerable <MongoDB.Bson.BsonValue> >(L, 2)) { System.Collections.Generic.IEnumerable <MongoDB.Bson.BsonValue> _values = (System.Collections.Generic.IEnumerable <MongoDB.Bson.BsonValue>)translator.GetObject(L, 2, typeof(System.Collections.Generic.IEnumerable <MongoDB.Bson.BsonValue>)); MongoDB.Bson.BsonArray gen_ret = gen_to_be_invoked.AddRange(_values); translator.Push(L, gen_ret); return(1); } if (gen_param_count == 2 && translator.Assignable <System.Collections.Generic.IEnumerable <System.DateTime> >(L, 2)) { System.Collections.Generic.IEnumerable <System.DateTime> _values = (System.Collections.Generic.IEnumerable <System.DateTime>)translator.GetObject(L, 2, typeof(System.Collections.Generic.IEnumerable <System.DateTime>)); MongoDB.Bson.BsonArray gen_ret = gen_to_be_invoked.AddRange(_values); translator.Push(L, gen_ret); return(1); } if (gen_param_count == 2 && translator.Assignable <System.Collections.Generic.IEnumerable <double> >(L, 2)) { System.Collections.Generic.IEnumerable <double> _values = (System.Collections.Generic.IEnumerable <double>)translator.GetObject(L, 2, typeof(System.Collections.Generic.IEnumerable <double>)); MongoDB.Bson.BsonArray gen_ret = gen_to_be_invoked.AddRange(_values); translator.Push(L, gen_ret); return(1); } if (gen_param_count == 2 && translator.Assignable <System.Collections.Generic.IEnumerable <int> >(L, 2)) { System.Collections.Generic.IEnumerable <int> _values = (System.Collections.Generic.IEnumerable <int>)translator.GetObject(L, 2, typeof(System.Collections.Generic.IEnumerable <int>)); MongoDB.Bson.BsonArray gen_ret = gen_to_be_invoked.AddRange(_values); translator.Push(L, gen_ret); return(1); } if (gen_param_count == 2 && translator.Assignable <System.Collections.Generic.IEnumerable <long> >(L, 2)) { System.Collections.Generic.IEnumerable <long> _values = (System.Collections.Generic.IEnumerable <long>)translator.GetObject(L, 2, typeof(System.Collections.Generic.IEnumerable <long>)); MongoDB.Bson.BsonArray gen_ret = gen_to_be_invoked.AddRange(_values); translator.Push(L, gen_ret); return(1); } if (gen_param_count == 2 && translator.Assignable <System.Collections.Generic.IEnumerable <MongoDB.Bson.ObjectId> >(L, 2)) { System.Collections.Generic.IEnumerable <MongoDB.Bson.ObjectId> _values = (System.Collections.Generic.IEnumerable <MongoDB.Bson.ObjectId>)translator.GetObject(L, 2, typeof(System.Collections.Generic.IEnumerable <MongoDB.Bson.ObjectId>)); MongoDB.Bson.BsonArray gen_ret = gen_to_be_invoked.AddRange(_values); translator.Push(L, gen_ret); return(1); } if (gen_param_count == 2 && translator.Assignable <System.Collections.Generic.IEnumerable <string> >(L, 2)) { System.Collections.Generic.IEnumerable <string> _values = (System.Collections.Generic.IEnumerable <string>)translator.GetObject(L, 2, typeof(System.Collections.Generic.IEnumerable <string>)); MongoDB.Bson.BsonArray gen_ret = gen_to_be_invoked.AddRange(_values); translator.Push(L, gen_ret); return(1); } if (gen_param_count == 2 && translator.Assignable <System.Collections.IEnumerable>(L, 2)) { System.Collections.IEnumerable _values = (System.Collections.IEnumerable)translator.GetObject(L, 2, typeof(System.Collections.IEnumerable)); MongoDB.Bson.BsonArray gen_ret = gen_to_be_invoked.AddRange(_values); translator.Push(L, gen_ret); return(1); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } return(LuaAPI.luaL_error(L, "invalid arguments to MongoDB.Bson.BsonArray.AddRange!")); }