internal void SetConnectAttrs() { // Sets connect attributes if ((connectionFlags & ClientFlags.CONNECT_ATTRS) != 0) { string connectAttrs = string.Empty; MySqlConnectAttrs attrs = new MySqlConnectAttrs(); foreach (PropertyInfo property in attrs.GetType().GetProperties()) { string name = property.Name; object[] customAttrs = property.GetCustomAttributes(typeof(DisplayNameAttribute), false).ToArray <object>(); if (customAttrs.Length > 0) { name = (customAttrs[0] as DisplayNameAttribute).DisplayName; } string value = (string)property.GetValue(attrs, null); connectAttrs += string.Format("{0}{1}", (char)name.Length, name); connectAttrs += string.Format("{0}{1}", (char)value.Length, value); } packet.WriteLenString(connectAttrs); } }
internal void SetConnectAttrs() { if ((this.connectionFlags & ClientFlags.CONNECT_ATTRS) != (ClientFlags)0uL) { string text = string.Empty; MySqlConnectAttrs mySqlConnectAttrs = new MySqlConnectAttrs(); PropertyInfo[] properties = mySqlConnectAttrs.GetType().GetProperties(); for (int i = 0; i < properties.Length; i++) { PropertyInfo propertyInfo = properties[i]; string text2 = propertyInfo.Name; object[] customAttributes = propertyInfo.GetCustomAttributes(typeof(DisplayNameAttribute), false); if (customAttributes.Length > 0) { text2 = (customAttributes[0] as DisplayNameAttribute).DisplayName; } string text3 = (string)propertyInfo.GetValue(mySqlConnectAttrs, null); text += string.Format("{0}{1}", (char)text2.Length, text2); text += string.Format("{0}{1}", (char)text3.Length, text3); } this.packet.WriteLenString(text); } }
internal void SetConnectAttrs() { // Sets connect attributes if ((connectionFlags & ClientFlags.CONNECT_ATTRS) != 0) { string connectAttrs = string.Empty; MySqlConnectAttrs attrs = new MySqlConnectAttrs(); foreach (PropertyInfo property in attrs.GetType().GetProperties()) { string name = property.Name; #if RT object[] customAttrs = property.GetCustomAttributes(typeof(DisplayNameAttribute), false).ToArray<object>(); #else object[] customAttrs = property.GetCustomAttributes(typeof(DisplayNameAttribute), false); #endif if (customAttrs.Length > 0) name = (customAttrs[0] as DisplayNameAttribute).DisplayName; string value = (string)property.GetValue(attrs, null); connectAttrs += string.Format("{0}{1}", (char)name.Length, name); connectAttrs += string.Format("{0}{1}", (char)value.Length, value); } packet.WriteLenString(connectAttrs); } }