Ejemplo n.º 1
0
        /// <param name="bytes">2 bytes are required to be passed in.</param>
        public MethodSelectionResponse(byte[] bytes)
        {
            Guard.Same($"{nameof(bytes)}.{nameof(bytes.Length)}", 2, bytes.Length);

            Ver    = new VerField(bytes[0]);
            Method = new MethodField(bytes[1]);
        }
        public override void FromBytes(byte[] bytes)
        {
            Guard.NotNullOrEmpty(nameof(bytes), bytes);
            Guard.Same($"{nameof(bytes)}.{nameof(bytes.Length)}", 2, bytes.Length);

            Ver    = new VerField(bytes[0]);
            Method = new MethodField(bytes[1]);
        }
Ejemplo n.º 3
0
        public static void DrawMethodField(MethodField field)
        {
            if (field.Style != ShowInEditorStyle.Button)
            {
                object v = field.GetValue();

                if (v != null)
                {
                    if (v.GetType().IsArray)
                    {
                        IList arr = (IList)v;
                        EditorGUILayout.LabelField(field.GetName() + System.String.Format(": ({0} Elements)", arr.Count));

                        EditorGUI.indentLevel = 1 + field.IndentLevel;
                        for (int i = 0; i < arr.Count; ++i)
                        {
                            EditorGUILayout.LabelField(string.Format("[{0}]", i), arr[i].ToString());
                        }
                    }
                    else
                    {
                        EditorGUILayout.LabelField(field.GetName(), v.ToString());
                    }
                }
                else
                {
                    EditorGUILayout.LabelField(field.GetName(), "null");
                }
            }
            else
            {
                if (GUILayout.Button(field.GetName()))
                {
                    field.Invoke();
                }
            }
        }
Ejemplo n.º 4
0
 public MethodSelectionResponse(MethodField method)
 {
     Method = Guard.NotNull(nameof(method), method);
     Ver    = VerField.Socks5;
 }