Exemple #1
0
        /// <summary>
        /// Authenticates a user with a credentials header
        /// </summary>
        /// <param name="userid">A username to be used by the server for authentication.</param>
        /// <param name="password"> password to be used by the server for authentication.</param>
        public void SetCredentials(string userid, string password)
        {
            ASObject aso = new ASObject();

            aso.Add("userid", userid);
            aso.Add("password", password);
            AddHeader("Credentials", false, aso);
        }
Exemple #2
0
        public void SetCredentials(string userid, string password)
        {
            ASObject param = new ASObject();

            param.Add("userid", userid);
            param.Add("password", password);
            this.AddHeader("Credentials", false, param);
        }
 public FluorineFx.ASObject ToRequestObject()
 {
     FluorineFx.ASObject retVal = new ASObject();
     retVal.Add("sigTime", _sigTime);
     retVal.Add("token", _token);
     retVal.Add("flashRevision", _flashRevision);
     retVal.Add("userId", _userId);
     return retVal;
 }
Exemple #4
0
        public void WriteData(AMFWriter writer, object data)
        {
            NameObjectCollectionBase base2 = data as NameObjectCollectionBase;

            object[] customAttributes = base2.GetType().GetCustomAttributes(typeof(DefaultMemberAttribute), false);
            if ((customAttributes != null) && (customAttributes.Length > 0))
            {
                DefaultMemberAttribute attribute = customAttributes[0] as DefaultMemberAttribute;
                PropertyInfo           property  = base2.GetType().GetProperty(attribute.MemberName, new Type[] { typeof(string) });
                if (property != null)
                {
                    ASObject obj2 = new ASObject();
                    for (int i = 0; i < base2.Keys.Count; i++)
                    {
                        string key  = base2.Keys[i];
                        object obj3 = property.GetValue(base2, new object[] { key });
                        obj2.Add(key, obj3);
                    }
                    writer.WriteByte(10);
                    writer.WriteAMF3Object(obj2);
                    return;
                }
            }
            writer.WriteByte(10);
            writer.WriteAMF3Object(data);
        }
        public void WriteData(AMFWriter writer, object data)
        {
            var collection = data as NameObjectCollectionBase;
            var attributes = collection.GetType().GetCustomAttributes(typeof(DefaultMemberAttribute), false);

            if (attributes != null && attributes.Length > 0)
            {
                var defaultMemberAttribute = attributes[0] as DefaultMemberAttribute;
                var pi = collection.GetType().GetProperty(defaultMemberAttribute.MemberName, new[] { typeof(string) });
                if (pi != null)
                {
                    var aso = new ASObject();
                    for (var i = 0; i < collection.Keys.Count; i++)
                    {
                        var key   = collection.Keys[i];
                        var value = pi.GetValue(collection, new object[] { key });
                        aso.Add(key, value);
                    }
                    writer.WriteASO(ObjectEncoding.AMF0, aso);
                    return;
                }
            }

            //We could not access an indexer so write out as it is.
            writer.WriteObject(ObjectEncoding.AMF0, data);
        }
Exemple #6
0
        public void WriteData(AMFWriter writer, object data)
        {
            NameObjectCollectionBase collection = data as NameObjectCollectionBase;

            object[] attributes = collection.GetType().GetCustomAttributes(typeof(DefaultMemberAttribute), false);
            if (attributes != null && attributes.Length > 0)
            {
                DefaultMemberAttribute defaultMemberAttribute = attributes[0] as DefaultMemberAttribute;
                PropertyInfo           pi = collection.GetType().GetProperty(defaultMemberAttribute.MemberName, new Type[] { typeof(string) });
                if (pi != null)
                {
                    ASObject aso = new ASObject();
                    for (int i = 0; i < collection.Keys.Count; i++)
                    {
                        string key   = collection.Keys[i];
                        object value = pi.GetValue(collection, new object[] { key });
                        aso.Add(key, value);
                    }
                    writer.WriteByte(AMF3TypeCode.Object);
                    writer.WriteAMF3Object(aso);
                    return;
                }
            }

            //We could not access an indexer so write out as it is.
            writer.WriteByte(AMF3TypeCode.Object);
            writer.WriteAMF3Object(data);
        }
        public void WriteData(AMFWriter writer, object data)
        {
            NameObjectCollectionBase collection = data as NameObjectCollectionBase;
            object[] attributes = collection.GetType().GetCustomAttributes(typeof(DefaultMemberAttribute), false);
            if (attributes != null  && attributes.Length > 0)
            {
                DefaultMemberAttribute defaultMemberAttribute = attributes[0] as DefaultMemberAttribute;
                PropertyInfo pi = collection.GetType().GetProperty(defaultMemberAttribute.MemberName, new Type[] { typeof(string) });
                if (pi != null)
                {
                    ASObject aso = new ASObject();
                    for (int i = 0; i < collection.Keys.Count; i++)
                    {
                        string key = collection.Keys[i];
                        object value = pi.GetValue(collection, new object[]{ key });
                        aso.Add(key, value);
                    }
                    writer.WriteByte(AMF3TypeCode.Object);
                    writer.WriteAMF3Object(aso);
                    return;
                }
            }

            //We could not access an indexer so write out as it is.
            writer.WriteByte(AMF3TypeCode.Object);
            writer.WriteAMF3Object(data);
        }
        public void WriteData(AMFWriter writer, object data)
        {
            var collection = data as NameObjectCollectionBase;
            var attributes = collection.GetType().GetCustomAttributes(typeof(DefaultMemberAttribute), false);
            if (attributes != null  && attributes.Length > 0)
            {
                var defaultMemberAttribute = attributes[0] as DefaultMemberAttribute;
                var pi = collection.GetType().GetProperty(defaultMemberAttribute.MemberName, new[] { typeof(string) });
                if (pi != null)
                {
                    var aso = new ASObject();
                    for (var i = 0; i < collection.Keys.Count; i++)
                    {
                        var key = collection.Keys[i];
                        var value = pi.GetValue(collection, new object[]{ key });
                        aso.Add(key, value);
                    }
                    writer.WriteASO(ObjectEncoding.AMF0, aso);
                    return;
                }
            }

            //We could not access an indexer so write out as it is.
            writer.WriteObject(ObjectEncoding.AMF0, data);
        }
        //IEventDispatcher _streamEventDispatcher = null;


        public RtmpClient(NetConnection netConnection)
        {
            _netConnection        = netConnection;
            _connectionParameters = new ASObject();
            _connectionParameters.Add("pageUrl", _netConnection.PageUrl);
            _connectionParameters.Add("objectEncoding", (double)_netConnection.ObjectEncoding);
            _connectionParameters.Add("capabilities", 15);
            _connectionParameters.Add("audioCodecs", (double)1639);
            _connectionParameters.Add("flashVer", _netConnection.PlayerVersion);
            _connectionParameters.Add("swfUrl", _netConnection.SwfUrl);
            _connectionParameters.Add("videoFunction", (double)1);
            _connectionParameters.Add("fpad", false);
            _connectionParameters.Add("videoCodecs", (double)252);
        }
Exemple #10
0
        /// <summary>
        /// Encode the ObjectProxy for a data stream.
        /// </summary>
        /// <param name="output">IDataOutput interface.</param>
        public void WriteExternal(IDataOutput output)
        {
            ASObject asObject = new ASObject();

            foreach (KeyValuePair <string, object> entry in this)
            {
                asObject.Add(entry.Key, entry.Value);
            }
            output.WriteObject(asObject);
        }
Exemple #11
0
        public void WriteExternal(IDataOutput output)
        {
            ASObject obj2 = new ASObject();

            foreach (KeyValuePair <string, object> pair in this)
            {
                obj2.Add(pair.Key, pair.Value);
            }
            output.WriteObject(obj2);
        }
		public object ReadData(AMFReader reader, ClassDefinition classDefinition) {
			ASObject aso = new ASObject(_typeIdentifier);
			reader.AddAMF3ObjectReference(aso);
			string key = reader.ReadAMF3String();
			aso.TypeName = _typeIdentifier;
			while (key != string.Empty) {
				object value = reader.ReadAMF3Data();
				aso.Add(key, value);
				key = reader.ReadAMF3String();
			}
			return aso;
		}
Exemple #13
0
        /// <summary>
        /// Encode the ObjectProxy for a data stream.
        /// </summary>
        /// <param name="output">IDataOutput interface.</param>
        public void WriteExternal(IDataOutput output)
        {
            ASObject asObject = new ASObject();

#if !(NET_1_1)
            foreach (KeyValuePair <string, object> entry in this)
#else
            foreach (DictionaryEntry entry in this)
#endif
            {
                asObject.Add(entry.Key, entry.Value);
            }
            output.WriteObject(asObject);
        }
        public object ReadData(AMFReader reader, ClassDefinition classDefinition)
        {
            ASObject aso = new ASObject(_typeIdentifier);

            reader.AddAMF3ObjectReference(aso);
            string key = reader.ReadAMF3String();

            aso.TypeName = _typeIdentifier;
            while (key != string.Empty)
            {
                object value = reader.ReadAMF3Data();
                aso.Add(key, value);
                key = reader.ReadAMF3String();
            }
            return(aso);
        }
        public object ReadData(AMFReader reader, ClassDefinition classDefinition)
        {
            ASObject instance = new ASObject(this._typeIdentifier);

            reader.AddAMF3ObjectReference(instance);
            string key = reader.ReadAMF3String();

            instance.TypeName = this._typeIdentifier;
            while (key != string.Empty)
            {
                object obj3 = reader.ReadAMF3Data();
                instance.Add(key, obj3);
                key = reader.ReadAMF3String();
            }
            return(instance);
        }
Exemple #16
0
        public object SubmitQuery(string url, string sql)
        {
            Hashtable result = new Hashtable();

            try
            {
                DomainUrl domainUrl = new DomainUrl(url);
                Driver    driver    = DriverFactory.GetDriver(domainUrl);
                using (IDbConnection dbConnection = driver.OpenConnection())
                {
                    IDbCommand     command = driver.GetDbCommand(sql, dbConnection);
                    IDbDataAdapter adapter = driver.GetDbDataAdapter();
                    adapter.SelectCommand = command;
                    DataSet dataSet = new DataSet();
                    adapter.Fill(dataSet);

                    ASObject  asoResult = new ASObject();
                    DataTable dataTable = dataSet.Tables[0];
                    ArrayList rows      = new ArrayList(dataTable.Rows.Count);
                    for (int i = 0; i < dataTable.Rows.Count; i++)
                    {
                        DataRow  dataRow = dataTable.Rows[i];
                        ASObject asoRow  = new ASObject();
                        for (int j = 0; j < dataTable.Columns.Count; j++)
                        {
                            DataColumn column = dataTable.Columns[j];
                            asoRow.Add(column.ColumnName, dataRow[column]);
                        }
                        rows.Add(asoRow);
                    }
                    result["result"] = rows;
                }
            }
            catch (Exception ex)
            {
                result["message"] = ex.Message;
            }
            return(result);
        }
Exemple #17
0
        public object SubmitQuery(string url, string sql)
        {
            Hashtable result = new Hashtable();
            try
            {
                DomainUrl domainUrl = new DomainUrl(url);
                Driver driver = DriverFactory.GetDriver(domainUrl);
                using (IDbConnection dbConnection = driver.OpenConnection())
                {
                    IDbCommand command = driver.GetDbCommand(sql, dbConnection);
                    IDbDataAdapter adapter = driver.GetDbDataAdapter();
                    adapter.SelectCommand = command;
                    DataSet dataSet = new DataSet();
                    adapter.Fill(dataSet);

                    ASObject asoResult = new ASObject();
                    DataTable dataTable = dataSet.Tables[0];
                    ArrayList rows = new ArrayList(dataTable.Rows.Count);
                    for (int i = 0; i < dataTable.Rows.Count; i++)
                    {
                        DataRow dataRow = dataTable.Rows[i];
                        ASObject asoRow = new ASObject();
                        for (int j = 0; j < dataTable.Columns.Count; j++)
                        {
                            DataColumn column = dataTable.Columns[j];
                            asoRow.Add(column.ColumnName, dataRow[column]);
                        }
                        rows.Add(asoRow);
                    }
                    result["result"] = rows;
                }
            }
            catch (Exception ex)
            {
                result["message"] = ex.Message;
            }
            return result;
        }
        private void SendLoginInfo()
        {
            ASObject body = new ASObject();

            body.Add("username", Username.ToLower());
            body.Add("password", Password);
            body.Add("authToken", AuthToken);
            body.Add("clientVersion", ClientVersion);
            body.Add("ipAddress", IPAddress);
            body.Add("locale", "en_US");
            body.Add("domain", "lolclient.lol.riotgames.com");
            body.Add("operatingSystem", "LolService");
            body.Add("securityAnswer", null);
            body.Add("oldPassword", null);
            body.Add("partnerCredentials", null);
            body.TypeName = "com.riotgames.platform.login.AuthenticationCredentials";

            Notify result = base.InvokeRemotingMessage("loginService", "login", new object[] { body });

            if (RtmpUtil.IsError(result))
            {
                ErrorMessage error = RtmpUtil.GetError(result);
                Form1.Log("Error = " + error.faultString);
                return;
            }

            ASObject args           = (ASObject)RtmpUtil.GetBodies(result).FirstOrDefault().Item1;
            ASObject AccountSummary = (ASObject)args["accountSummary"];

            this.SessionToken = (string)args["token"];
            this.AccountID    = Convert.ToInt32(AccountSummary["accountId"]);
            Form1.Log("SessionToken = " + SessionToken);
            Form1.Log("Account ID: " + AccountID);
        }
		private ArrayList ConvertDataTable(DataTable dataTable)
		{
			ArrayList result = new ArrayList(dataTable.Rows.Count);
			for(int i = 0; i < dataTable.Rows.Count; i++)
			{
				DataRow dataRow = dataTable.Rows[i];
				ASObject aso = new ASObject(_remoteClass);
				for(int j = 0; j < dataTable.Columns.Count; j++)
				{
					DataColumn column = dataTable.Columns[j];
					/*
					object value = null;
					if( !dataRow.IsNull(column) )
						value = dataRow[column];
					*/
					aso.Add(column.ColumnName, dataRow[column]);
				}
				result.Add(aso);
			}
			return result;
		}
Exemple #20
0
    public static MeshData exportMeshData(Mesh mesh, GameObject gameObject)
    {
        MeshData data = new MeshData();

        /*pos*/
        Vector3[] vectors = formatVertices(mesh.vertices, TransformToMatrix4x4(gameObject.transform));
        /*normal*/
        Vector3[] normals = mesh.normals;
        /*uv*/
        Vector2[] uvs      = mesh.uv;
        Vector4[] tangnets = mesh.tangents;
        Color[]   colors   = mesh.colors;

        data.vertex = vector3toByte(vectors, normals, uvs, tangnets, colors);

        int numVertices = vectors.Length;

        data.numVertices = numVertices;


        int offset = 0;



        ASObject variables = new ASObject();

        if (null != vectors && numVertices == vectors.Length)
        {
            variables.Add("pos", new Variable(3, offset));
            offset += 3;
        }

        if (null != normals && numVertices == normals.Length)
        {
            variables.Add("normal", new Variable(3, offset));
            offset += 3;
        }

        // if(null != tangnets && 0 != tangnets.Length){
        //     variables.Add("tangnet",new Variable(4,offset));
        //     offset += 4;
        // }

        if (null != uvs && numVertices == uvs.Length)
        {
            variables.Add("uv", new Variable(2, offset));
            offset += 2;
        }


        if (null != colors && numVertices == colors.Length)
        {
            variables.Add("color", new Variable(4, offset));
            offset += 4;
        }

        variables.Add("data32PerVertex", new Variable(offset, offset));

        data.data32PerVertex = offset;
        data.variables       = variables;



        data.index = ToUnit16(mesh.triangles);

        data.numTriangles = mesh.triangles.Length / 3;


        data.hitare = toHitArea(mesh.bounds);


        return(data);
    }
Exemple #21
0
        private void SendLoginInfo()
        {
            ASObject body = new ASObject();
            body.Add("username", Username.ToLower());
            body.Add("password", Password);
            body.Add("authToken", AuthToken);
            body.Add("clientVersion", ClientVersion);
            body.Add("ipAddress", IPAddress);
            body.Add("locale", "en_US");
            body.Add("domain", "lolclient.lol.riotgames.com");
            body.Add("operatingSystem", "LolService");
            body.Add("securityAnswer", null);
            body.Add("oldPassword", null);
            body.Add("partnerCredentials", null);
            body.TypeName = "com.riotgames.platform.login.AuthenticationCredentials";

            Notify result = base.InvokeRemotingMessage("loginService", "login", new object[] { body });
            if (RtmpUtil.IsError(result))
            {
                ErrorMessage error = RtmpUtil.GetError(result);
                Form1.Log("Error = " + error.faultString);
                return;
            }

            ASObject args = (ASObject)RtmpUtil.GetBodies(result).FirstOrDefault().Item1;
            ASObject AccountSummary = (ASObject)args["accountSummary"];
            this.SessionToken = (string)args["token"];
            this.AccountID = Convert.ToInt32(AccountSummary["accountId"]);
            Form1.Log("SessionToken = " + SessionToken);
            Form1.Log("Account ID: " + AccountID);
        }
Exemple #22
0
        private ASObject saveMail(Mail_Message m, string uid, string mail_uid, string file)
        {
            workInfo.IsNewMail = true;
            DirectoryInfo dirinfo = Directory.GetParent(store_path + file);
            string dir = dirinfo.FullName + "/" + uid + ".parts";
            Directory.CreateDirectory(dir);

            ASObject record = new ASObject();

            record.Add("uuid", uid);
            record.Add("owner_user_id", wos.library.Desktop.instance.loginedPrincipal.id);
            try
            {
                string subject = m.Subject;
                if (subject == null)
                    subject = "";
                else if (subject.IndexOf("&#") != -1)
                {
                    subject = HttpUtility.HtmlDecode(subject);
                }
                record.Add("subject", subject);
            }
            catch (Exception)
            {
                record.Add("subject", "");
            }
            try
            {
                record.Add("sender", m.Sender == null ? "" : m.Sender.ToString());
            }
            catch (Exception)
            {
                record.Add("sender", "");
            }
            try
            {
                record.Add("mail_to", m.To == null ? "" : m.To.ToString());
                if (m.To != null && m.To.Mailboxes.Count() > 0)
                    record.Add("mail_to_label", getMailBoxLabel(m.To.Mailboxes[0]));
            }
            catch (Exception)
            {
                record.Add("mail_to", "");
            }
            try
            {
                record.Add("reply_to", m.ReplyTo == null ? "" : m.ReplyTo.ToString());
            }
            catch (Exception)
            {
                record.Add("reply_to", "");
            }
            try
            {
                record.Add("mail_from", m.From == null ? "" : m.From.ToString());
                if (m.From != null && m.From.Count > 0)
                {
                    record.Add("mail_from_label", getMailBoxLabel(m.From[0]));
                    record.Add("contact_mail", m.From[0].Address);
                }
            }
            catch (Exception)
            {
                record.Add("mail_from", "");
                record.Add("contact_mail", "");
            }
            //阅读回折
            if (m.DispositionNotificationTo != null && m.DispositionNotificationTo.Count > 0)
                record.Add("flags", "RECEIPT");
            else
                record.Add("flags", "RECENT");

            try
            {
                if (Setting.IsSpamMail(m))
                {
                    record.Add("mail_type", (int)DBWorker.MailType.SpamMail);
                    record.Add("folder", "SPAM");
                }
                else
                {
                    record.Add("mail_type", (int)DBWorker.MailType.RecvMail);
                    record.Add("folder", "INBOX");
                }
            }
            catch (Exception)
            {
                record.Add("mail_type", (int)DBWorker.MailType.RecvMail);
                record.Add("folder", "INBOX");
            }
            try
            {
                record.Add("cc", m.Cc == null ? "" : m.Cc.ToString());
            }
            catch (Exception)
            {
                record.Add("cc", "");
            }
            try
            {
                record.Add("bcc", m.Bcc == null ? "" : m.Bcc.ToString());
            }
            catch (Exception)
            {
                record.Add("bcc", "");
            }

            record.Add("message_id", m.MessageID == null ? uid : m.MessageID);
            record.Add("create_time", DateTimeUtil.now());
            record.Add("mail_date", m.Date == DateTime.MinValue ? DateTimeUtil.now() : m.Date);
            record.Add("send_time", null);
            record.Add("mail_account", mailAccount.account);
            record.Add("mail_file", file);
            record.Add("reply_for", null);
            record.Add("reply_header", null);
            record.Add("mail_uid", mail_uid);
            record.Add("client_or_server", "client");
            record.Add("is_synced", (short)0);
            record.Add("is_handled", is_handled);
            record.Add("priority", m.Priority);
            if (m.Received != null && m.Received.Count() > 0)
            {
                try
                {
                    if (m.Received[0].From_TcpInfo != null)
                        record.Add("ip_from", m.Received[0].From_TcpInfo.IP.ToString());
                }
                catch (Exception)
                {
                }
            }
            return record;
        }