private static void AsyncClient_MessageReceived(object sender, string message) { IControlData data = _parser.Pars(message); if (data != null) { Console.WriteLine(data.Value.ToString()); } //Console.WriteLine(message); }
IControlData m_controlData; // 컨트롤 데이터 //------------------------------------------------------------------------------------- /// <summary> /// 타입 체크 후 지정된 형식의 OptionalData 할당 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="typeCheck"></param> private T CheckOptionData <T>(ControlType typeCheck) where T : class, IControlData, new() { if (controlType != typeCheck) // 타입체크 { Debug.LogError(string.Format("cannot call {0} without {1} controlType", typeof(T).Name, typeCheck.ToString())); } T data = m_controlData as T; if (data == null) // 생성 안된 경우에는 새로 생성 { data = new T(); m_controlData = data; } return(data); }
/// <summary> /// Récupère la valeur de la propriété associée au descripteur de propriété /// </summary> /// <param name="type">Type du controle</param> /// <param name="control">Les données associées au controle</param> /// <param name="propertyName">Le nom de la propriété</param> /// <returns>La valeur associée à la propriété</returns> public static object DoGetPropertyValue(Type type, IControlData control, string propertyName) { string controlLocationValue = control.Properties[propertyName]; PropertyDescriptor descriptor = Serializer.DoGetPropertyDescriptorType(type, propertyName); return Serializer.DeserializeProperty(descriptor, controlLocationValue); }