Ejemplo n.º 1
0
 public string ToStringFull()
 {
     return(string.Format("OperationResponse {0}: ReturnCode: {1} ({3}). Parameters: {2}", new object[]
     {
         this.OperationCode,
         this.ReturnCode,
         SupportClass.DictionaryToString(this.Parameters),
         this.DebugMessage
     }));
 }
Ejemplo n.º 2
0
        public virtual bool Connect(string serverAddress, string applicationName, object custom)
        {
            object dispatchLockObject = this.DispatchLockObject;
            bool   result;

            lock (dispatchLockObject)
            {
                object sendOutgoingLockObject = this.SendOutgoingLockObject;
                lock (sendOutgoingLockObject)
                {
                    this.CreatePeerBase();
                    bool flag = this.peerBase == null;
                    if (flag)
                    {
                        result = false;
                    }
                    else
                    {
                        bool flag2 = this.peerBase.SocketImplementation == null;
                        if (flag2)
                        {
                            this.peerBase.EnqueueDebugReturn(DebugLevel.ERROR, string.Concat(new object[]
                            {
                                "Connect failed. SocketImplementationConfig is null for protocol ",
                                this.TransportProtocol,
                                ": ",
                                SupportClass.DictionaryToString(this.SocketImplementationConfig)
                            }));
                            result = false;
                        }
                        else
                        {
                            bool flag3 = custom == null;
                            if (flag3)
                            {
                                this.DgramEncryptor            = null;
                                this.RandomizedSequenceNumbers = null;
                                this.RandomizeSequenceNumbers  = false;
                            }
                            this.peerBase.CustomInitData = custom;
                            this.peerBase.AppId          = applicationName;
                            result = this.peerBase.Connect(serverAddress, applicationName, custom);
                        }
                    }
                }
            }
            return(result);
        }
Ejemplo n.º 3
0
        public static string DictionaryToString(IDictionary dictionary, bool includeTypes)
        {
            if (dictionary == null)
            {
                return("null");
            }
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append("{");
            foreach (object key in (IEnumerable)dictionary.Keys)
            {
                if (stringBuilder.Length > 1)
                {
                    stringBuilder.Append(", ");
                }
                Type   type;
                string str;
                if (dictionary[key] == null)
                {
                    type = typeof(object);
                    str  = "null";
                }
                else
                {
                    type = dictionary[key].GetType();
                    str  = dictionary[key].ToString();
                }
                if (typeof(IDictionary) == type || typeof(Hashtable) == type)
                {
                    str = SupportClass.DictionaryToString((IDictionary)dictionary[key]);
                }
                if (typeof(string[]) == type)
                {
                    str = string.Format("{{{0}}}", (object)string.Join(",", (string[])dictionary[key]));
                }
                if (includeTypes)
                {
                    stringBuilder.AppendFormat("({0}){1}=({2}){3}", (object)key.GetType().Name, key, (object)type.Name, (object)str);
                }
                else
                {
                    stringBuilder.AppendFormat("{0}={1}", key, (object)str);
                }
            }
            stringBuilder.Append("}");
            return(stringBuilder.ToString());
        }
 /// <summary>
 /// Brief summary string of the Player. Includes name or player.ID and if it's the Master Client.
 /// </summary>
 public override string ToString()
 {
     return((string.IsNullOrEmpty(this.NickName) ? this.ActorNumber.ToString() : this.nickName) + " " + SupportClass.DictionaryToString(this.CustomProperties));
 }
Ejemplo n.º 5
0
 /// <summary>
 /// This Player's NickName and custom properties as string.
 /// </summary>
 public override string ToString()
 {
     return(this.NickName + " " + SupportClass.DictionaryToString(this.CustomProperties));
 }
Ejemplo n.º 6
0
 public static string HashtableToString(Hashtable hash)
 {
     return(SupportClass.DictionaryToString((IDictionary)hash));
 }
Ejemplo n.º 7
0
 public static string DictionaryToString(IDictionary dictionary)
 {
     return(SupportClass.DictionaryToString(dictionary, true));
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Returns a string-representation of the IDictionary's content, inlcuding type-information.
 /// Note: This might turn out a "heavy-duty" call if used frequently but it's usfuly to debug Dictionary or Hashtable content.
 /// </summary>
 /// <param name="origin">Some Dictionary or Hashtable.</param>
 /// <returns>String of the content of the IDictionary.</returns>
 public static string ToStringFull(this IDictionary origin)
 {
     return(SupportClassPun.DictionaryToString(origin, false));
 }
 /// <summary>Turns the response into an easier to read string.</summary>
 /// <returns>String resembling the result.</returns>
 public string ToStringFull()
 {
     return(string.Format("{0}={2}: {1} \"{3}\"", this.Name, SupportClass.DictionaryToString(this.Parameters), this.ResultCode, this.Message));
 }
Ejemplo n.º 10
0
 public string ToStringFull()
 {
     return(string.Format("{0}={2}: {1} \"{3}\"", Name, SupportClass.DictionaryToString(Parameters), ReturnCode, DebugMessage));
 }
Ejemplo n.º 11
0
 /// <summary>Returns a summary of this Room instance as longer string, including Custom Properties.</summary>
 /// <returns>Summary of this Room instance.</returns>
 public new string ToStringFull()
 {
     return(string.Format("Room: '{0}' {1},{2} {4}/{3} players.\ncustomProps: {5}", this.name, this.isVisible ? "visible" : "hidden", this.isOpen ? "open" : "closed", this.maxPlayers, this.PlayerCount, SupportClass.DictionaryToString(this.CustomProperties)));
 }
Ejemplo n.º 12
0
        public static string DictionaryToString(IDictionary dictionary, bool includeTypes)
        {
            bool   flag = dictionary == null;
            string result;

            if (flag)
            {
                result = "null";
            }
            else
            {
                StringBuilder stringBuilder = new StringBuilder();
                stringBuilder.Append("{");
                foreach (object obj in dictionary.Keys)
                {
                    bool flag2 = stringBuilder.Length > 1;
                    if (flag2)
                    {
                        stringBuilder.Append(", ");
                    }
                    bool   flag3 = dictionary[obj] == null;
                    Type   type;
                    string text;
                    if (flag3)
                    {
                        type = typeof(object);
                        text = "null";
                    }
                    else
                    {
                        type = dictionary[obj].GetType();
                        text = dictionary[obj].ToString();
                    }
                    bool flag4 = typeof(IDictionary) == type || typeof(Hashtable) == type;
                    if (flag4)
                    {
                        text = SupportClass.DictionaryToString((IDictionary)dictionary[obj]);
                    }
                    bool flag5 = typeof(string[]) == type;
                    if (flag5)
                    {
                        text = string.Format("{{{0}}}", string.Join(",", (string[])dictionary[obj]));
                    }
                    bool flag6 = typeof(byte[]) == type;
                    if (flag6)
                    {
                        text = string.Format("byte[{0}]", ((byte[])dictionary[obj]).Length);
                    }
                    if (includeTypes)
                    {
                        stringBuilder.AppendFormat("({0}){1}=({2}){3}", new object[]
                        {
                            obj.GetType().Name,
                            obj,
                            type.Name,
                            text
                        });
                    }
                    else
                    {
                        stringBuilder.AppendFormat("{0}={1}", obj, text);
                    }
                }
                stringBuilder.Append("}");
                result = stringBuilder.ToString();
            }
            return(result);
        }
Ejemplo n.º 13
0
 public string ToStringFull()
 {
     return(string.Format("Event {0}: {1}", this.Code, SupportClass.DictionaryToString(this.Parameters)));
 }
Ejemplo n.º 14
0
 public string ToStringFull()
 {
     return(string.Format("OperationResponse {0}: ReturnCode: {1} ({3}). Parameters: {2}", (object)this.OperationCode, (object)this.ReturnCode, (object)SupportClass.DictionaryToString((IDictionary)this.Parameters), (object)this.DebugMessage));
 }