public static double GetCountdown() { var jsonStr = BaiduNet.GetForum(null).Result; var reply = new ErrorReply(); reply.Parse(jsonStr); var nextDay = DateTime.UtcNow.AddHours(8).Date.AddDays(1); Console.WriteLine($@"下次签到时间:{nextDay.ToString(CultureInfo.CurrentCulture)}"); var now = reply.Time.ToUniversalTime().AddHours(8); Console.WriteLine($@"现在时间:{now.ToString(CultureInfo.CurrentCulture)}"); return((nextDay - now).TotalMilliseconds); }
public IAsyncAction ServerErrorAsync(ErrorReply reply) { return(EnqueueMessage(reply).CastToAsyncAction()); }
/// <summary> /// 認証に失敗しその理由を指定して初期化します。 /// </summary> /// <param name="errorReply"></param> /// <param name="message"></param> public AuthenticateResult(ErrorReply errorReply, String message) { IsAuthenticated = false; ErrorReply = errorReply; ErrorMessage = message; }
public void ServerError(ErrorReply reply) { }
/// <summary> /// サーバからクライアントにエラーリプライを返します。 /// </summary> /// <param name="errorNum">エラーリプライ番号</param> /// <param name="commandParams">リプライコマンドパラメータ</param> public void SendErrorReply(ErrorReply errorNum, params String[] commandParams) { SendNumericReply((NumericReply)errorNum, commandParams); }
public IAsyncAction ServerErrorAsync(ErrorReply reply) { return(Task.CompletedTask.CastToAsyncAction()); }
public void ServerError(ErrorReply reply) { Logger.Error($"Server signaled error for message {reply.ReplyFor} with message {reply.ErrorMessage}"); }
public void ServerError(ErrorReply reply) { EnqueueMessage(reply); }
public override Reply Run <T>(ControlsStorage <T> controls, IDictionary <string, dynamic> args) { CheckParamExists(args, "element_id"); CheckValidControlId <T>(args["element_id"], controls); CheckParamExists(args, "name"); CheckParamExists(args, "value"); object c = controls.GetControl(args["element_id"]); bool isExists = false; Reply reply = null; Application.Current.Dispatcher.Invoke((Action) delegate { try { PropertyInfo prop = c.GetType().GetProperty(args["name"]); FieldInfo field = c.GetType().GetField(args["name"]); if (prop != null) { isExists = true; dynamic value = args["value"]; if (args.ContainsKey("is_enum") && args["is_enum"]) { value = Enum.Parse(prop.PropertyType, args["value"]); } try { value = ConvertType(value, prop.PropertyType); } catch (Exception e) { reply = new ErrorReply(ErrorCodes.UNSUPPORTED_TYPE, "can not convert to property type: " + e.ToString()); } prop.SetValue(c, value, null); } else if (field != null) { isExists = true; dynamic value = args["value"]; if (args.ContainsKey("is_enum") && args["is_enum"]) { value = Enum.Parse(field.FieldType, args["value"]); } try { value = ConvertType(value, field.FieldType); } catch (Exception e) { reply = new ErrorReply(ErrorCodes.UNSUPPORTED_TYPE, "can not convert to field type: " + e.ToString()); } field.SetValue(c, value); } reply = new Reply(ErrorCodes.OK); } catch (Exception e) { reply = new ErrorReply(ErrorCodes.RUNTIME_ERROR, e.ToString()); } }); if (isExists) { return(reply); } else { throw new ErrorReplyException(ErrorCodes.NOT_FOUND, "no such field or property: " + args["name"]); } }