Esempio n. 1
0
        /// <summary>
        /// Writes a BSON JavaScript to the writer.
        /// </summary>
        /// <param name="code">The JavaScript code.</param>
        public override void WriteJavaScript(string code)
        {
            if (Disposed)
            {
                throw new ObjectDisposedException("BsonBinaryWriter");
            }
            if (State != BsonWriterState.Value)
            {
                ThrowInvalidState("WriteJavaScript", BsonWriterState.Value);
            }

            _bsonStream.WriteBsonType(BsonType.JavaScript);
            WriteNameHelper();
            _bsonStream.WriteString(code, _settings.Encoding);

            State = GetNextState();
        }
        static int _m_WriteString(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


                MongoDB.Bson.IO.BsonStream gen_to_be_invoked = (MongoDB.Bson.IO.BsonStream)translator.FastGetCSObj(L, 1);



                {
                    string _value = LuaAPI.lua_tostring(L, 2);
                    System.Text.UTF8Encoding _encoding = (System.Text.UTF8Encoding)translator.GetObject(L, 3, typeof(System.Text.UTF8Encoding));

                    gen_to_be_invoked.WriteString(_value, _encoding);



                    return(0);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }