Exemplo n.º 1
0
		public static IObservable<StatusCollection> GetListStatuses(
			this TwitterAccount account,
			ListId listId,
			StatusId? sinceId = null,
			StatusId? maxId = null,
			int? count = null,
			bool? includeEntities = null,
			bool? includeRts = true)
		{
			const string endpoint = "lists/statuses";
			var client = account.ToOAuthClient(endpoint);

			client.Parameters.Add("list_id", listId);
			client.Parameters.Add("owner_id", account.UserId);
			if (sinceId.HasValue) client.Parameters.Add("since_id", sinceId.Value);
			if (maxId.HasValue) client.Parameters.Add("max_id", maxId.Value);
			if (count.HasValue) client.Parameters.Add("count", count.Value);
			if (includeEntities.HasValue) client.Parameters.Add("include_entities", includeEntities.Value);
			if (includeRts.HasValue) client.Parameters.Add("include_rts", includeRts.Value);

			return Observable
				.Defer(() => client.GetResponseText())
				.Select(json => StatusCollection.Parse(json))
				.OnErrorRetry(3)
				.WriteLine(endpoint);
		}
Exemplo n.º 2
0
		/// <summary>
		/// メディア付きのツイートを投稿します。
		/// </summary>
		public static async Task<Status> UpdateStatus(
			this TwitterToken token, string status, string[] mediaPaths, StatusId? inReplyToStatusId = null)
		{
			// media が空だったら通常の投稿に切り替える
			if (!mediaPaths.HasValue()) return await token.UpdateStatus(status, inReplyToStatusId);

			var endpoint = token.Endpoints["statuses/update_with_media"];

			using (var client = token.GetClient())
			using (var content = new MultipartFormDataContent { { new StringContent(status), "\"status\"" } })
			{
				if (inReplyToStatusId.HasValue)
				{
					content.Add(new StringContent(inReplyToStatusId.ToString()), "\"in_reply_to_status_id\"");
				}
				foreach (var path in mediaPaths)
				{
					var media = File.ReadAllBytes(path);
					var filename = Path.GetFileName(path);
					content.Add(new ByteArrayContent(media), "media[]", "\"" + filename + "\"");
				}

				return await client.PostAsyncEx(
					endpoint.Definition.Url,
					content,
					res => endpoint.RateLimit.Set(res.Headers),
					json => Status.Parse(json, StatusSource.Update),
					() => token.FallbackToken.UpdateStatus(status, mediaPaths, inReplyToStatusId));
			}
		}
Exemplo n.º 3
0
 public DebtDetailResponse ToDebtDetail(DynamicsGatewayOptions options)
 {
     return(new DebtDetailResponse
     {
         Id = Id,
         Amount = decimal.Parse(Amount),
         Reference = CreditorExternalReference,
         DebtTypeName = Type,
         NINO = NationalInsuranceNumber,
         CreatedOn = CreatedOn.ToDateTimeOffset(),
         ModifiedOn = ModifiedOn.ToDateTimeOffset(),
         Status = options.DebtStatus[StatusId.ToString()],
         SoldToCreditorName = ProposedCreditor?.Name,
         SoldToCreditorId = ProposedCreditor?.Id,
         PreviouslySold = PreviouslySold,
         CreditorName = Creditor.Name,
         CreditorId = Creditor.Id,
         StartsOn = CommencementDate?.ToDateTimeOffset(),
         EndsOn = ExpiryDate?.ToDateTimeOffset(),
         RemovedOn = RemovalDate?.ToDateTimeOffset(),
         DebtTypeId = TypeId,
         DebtEligibilityReview = DebtEligibilityReview != null
             ? DebtEligibilityReview.ToDebtEligibilityReview(options)
             : null,
         DebtRemovalReason = DebtRemovalReasonId.HasValue ?
                             options.DebtRemovalReason.First(r => r.Value == DebtRemovalReasonId.ToString()).Key :
                             (DebtRemovalReason?)null
     });
 }
Exemplo n.º 4
0
		public static IObservable<StatusCollection> GetUserTimeline(
			this TwitterAccount account,
			UserId? userId = null,
			int? count = null,
			StatusId? sinceId = null,
			StatusId? maxId = null,
			bool? trimUser = null,
			bool? excludeReplies = null,
			bool? contributorDetails = null,
			bool? includeRts = null,
			bool isStartup = false)
		{
			const string endpoint = "statuses/user_timeline";
			var source = isStartup
				? StatusSource.RestApi | StatusSource.Startup
				: StatusSource.RestApi;
			var client = account.ToOAuthClient(endpoint);

			if (userId.HasValue) client.Parameters.Add("user_id", userId.Value);
			if (count.HasValue) client.Parameters.Add("count", count.Value);
			if (sinceId.HasValue) client.Parameters.Add("since_id", sinceId.Value);
			if (maxId.HasValue) client.Parameters.Add("max_id", maxId.Value);
			if (trimUser.HasValue) client.Parameters.Add("trim_user", trimUser.Value);
			if (excludeReplies.HasValue) client.Parameters.Add("exclude_replies", excludeReplies.Value);
			if (contributorDetails.HasValue) client.Parameters.Add("contributor_details", contributorDetails.Value);
			if (includeRts.HasValue) client.Parameters.Add("include_rts", includeRts.Value);

			return Observable
				.Defer(client.GetResponseText)
				.Select(json => StatusCollection.Parse(json, source))
				.OnErrorRetry(3)
				.WriteLine(endpoint);
		}
Exemplo n.º 5
0
 /// <inheritdoc />
 public override string ToString()
 {
     if (null == StatusMeta)
     {
         return(Name ?? StatusId.ToString());
     }
     return($"{Name ?? StatusId.ToString()}: {StatusMeta}");
 }
Exemplo n.º 6
0
 public Book(double cost, LibraryBranch location, StatusId status, string title, int year,
             string imageUrl, int numberOfCopies, string isbn, string author, string deweyIndex)
     : base(cost, location, status, title, year, imageUrl, numberOfCopies)
 {
     ISBN       = isbn.Replace("-", "");
     Author     = author;
     DeweyIndex = deweyIndex;
 }
Exemplo n.º 7
0
        /// <summary>
        /// Creates new entry to version tracking table after all versions were successfully executed.
        /// </summary>
        /// <param name="connection">Connection to target database. Connection will be open automatically.</param>
        /// <param name="transaction">An active transaction.</param>
        /// <param name="version">Migration version.</param>
        /// <param name="schemaName">Schema name for schema versions table. When empty, uses the default schema in the target data platform. </param>
        /// <param name="tableName">Table name for schema versions table. When empty, uses __yuniqldbversion.</param>
        /// <param name="commandTimeout">Command timeout in seconds.</param>
        /// <param name="appliedByTool">The source that initiates the migration. This can be yuniql-cli, yuniql-aspnetcore or yuniql-azdevops.</param>
        /// <param name="appliedByToolVersion">The version of the source that initiates the migration.</param>
        /// <param name="failedScriptPath">The failed script path.</param>
        /// <param name="failedScriptError">The failed script error.</param>
        public void InsertVersion(
            IDbConnection connection,
            IDbTransaction transaction,
            string version,
            string schemaName           = null,
            string tableName            = null,
            int?commandTimeout          = null,
            string appliedByTool        = null,
            string appliedByToolVersion = null,
            string failedScriptPath     = null,
            string failedScriptError    = null
            )
        {
            var      toolName    = string.IsNullOrEmpty(appliedByTool) ? "yuniql-nuget" : appliedByTool;
            var      toolVersion = string.IsNullOrEmpty(appliedByToolVersion) ? this.GetType().Assembly.GetName().Version.ToString() : appliedByToolVersion;
            StatusId statusId    = string.IsNullOrEmpty(failedScriptPath) ? StatusId.Succeeded : StatusId.Failed;

            IDbParameters dbParameters = null;
            string        sqlStatement;

            //in case database supports non transactional flow
            if (_dataService is INonTransactionalFlow nonTransactionalDataService)
            {
                sqlStatement = string.Format(nonTransactionalDataService.GetSqlForUpsertVersion(), version, toolName, $"v{toolVersion}", (int)statusId);

                //Using of db parameters is important and a good practice, otherwise the errors containing SQL specific characters like "'" would need to be escaped in more complicated manner
                dbParameters = _dataService.CreateDbParameters();
                dbParameters.AddParameter("failedScriptPath", failedScriptPath);
                dbParameters.AddParameter("failedScriptError", failedScriptError);
            }
            else
            {
                if (statusId == StatusId.Failed)
                {
                    throw new NotSupportedException(@$ "The non-transactional flow is not supported by this platform.");
                }

                sqlStatement = string.Format(_dataService.GetSqlForInsertVersion(), version, toolName, $"v{toolVersion}");
            }

            if (null != _traceService)
            {
                _traceService.Debug($"Executing statement: {Environment.NewLine}{sqlStatement}");
            }

            var command = connection
                          .KeepOpen()
                          .CreateCommand(
                commandText: sqlStatement,
                commandTimeout: commandTimeout,
                transaction: transaction
                );

            dbParameters?.CopyToDataParameterCollection(command.Parameters);

            command.ExecuteNonQuery();
        }
Exemplo n.º 8
0
 public LibraryAsset(double cost, LibraryBranch location, StatusId status, string title, int year, string imageUrl, int numberOfCopies)
 {
     Cost           = Convert.ToDecimal(cost);
     Location       = location;
     Status         = new Status(status);
     Title          = title;
     Year           = (short)year;
     NumberOfCopies = numberOfCopies;
     ImageUrl       = ImageChecker(imageUrl);
 }
Exemplo n.º 9
0
 public bool Equals(Detail other)
 {
     if (other == null)
     {
         return(false);
     }
     return(Property.Equals(other.Property) &&
            StatusId.Equals(other.StatusId) &&
            OldValue.Equals(other.OldValue) &&
            NewValue.Equals(other.NewValue));
 }
Exemplo n.º 10
0
 public bool Equals(Detail other)
 {
     if (other == null)
     {
         return(false);
     }
     return((Property != null ? Property.Equals(other.Property) : other.Property == null) &&
            (StatusId != null ? StatusId.Equals(other.StatusId) : other.StatusId == null) &&
            (OldValue != null ? OldValue.Equals(other.OldValue) : other.OldValue == null) &&
            (NewValue != null ? NewValue.Equals(other.NewValue) : other.NewValue == null));
 }
Exemplo n.º 11
0
 public override bool Equals(Object obj)
 {
     if (obj is Problem ob)
     {
         return(Id.Equals(ob.Id) && CategoryId.Equals(ob.CategoryId) && ThemeId.Equals(ob.ThemeId) && Adress.Equals(ob.Adress) &&
                SourceId.Equals(ob.SourceId) && CreateDate.Equals(ob.CreateDate) && AnswerDate.Equals(ob.AnswerDate) &&
                ProblemText.Equals(ob.ProblemText) && ProblemPhotos.Equals(ob.ProblemPhotos) && AnswerText.Equals(ob.AnswerText) &&
                AnswerPhotos.Equals(ob.AnswerPhotos) && StatusId.Equals(ob.StatusId) && DistrictId.Equals(ob.DistrictId) && ChildID.Equals(ob.ChildID) &&
                ParentID.Equals(ob.ParentID) && IspolnitelName.Equals(ob.IspolnitelName) && IspolnitelId.Equals(ob.IspolnitelId));
     }
     return(false);
 }
 public DebtEligibilityReviewResponse ToDebtEligibilityReview(DynamicsGatewayOptions options)
 {
     return(new DebtEligibilityReviewResponse
     {
         CreditorNotes = CreditorNotes,
         Reason = (DebtEligibilityReviewReasons)int.Parse(options.DebtEligibilityReviewReasons
                                                          .First(r => r.Value == ReasonId.ToString()).Key),
         Status = options.DebtEligibilityReviewStatus[StatusId.ToString()],
         MoneyAdviserNotes = MoneyAdviserNotes,
         CreatedOn = CreatedOn.ToDateTimeOffset(),
         ModifiedOn = ModifiedOn.ToDateTimeOffset(),
     });
 }
Exemplo n.º 13
0
    protected void Page_Load(object sender, EventArgs e)
    {
        phong           = (new PMPhong(this)).GetOne(ID);
        tenphong.Value  = Ten;
        loaiphong.Value = IdLoaiPhong.ToString();
        status.Value    = StatusId.ToString();

        if (StatusId == 3)
        {
            tgbatdau.Text = TGStart.ToString("dd/MM/yyyy HH:mm:ss");
            tenkh.Value   = TenKH;
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "chi", "btnbatdauclick();", true);
        }
        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "loadjs", "ctphong_ready();", true);
    }
Exemplo n.º 14
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Id;
         hashCode = (hashCode * 397) ^ (PurchaseOrderNumber != null ? PurchaseOrderNumber.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ DateCreated.GetHashCode();
         hashCode = (hashCode * 397) ^ CreatedBy;
         hashCode = (hashCode * 397) ^ (StatusId != null ? StatusId.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ WorkCycleId.GetHashCode();
         hashCode = (hashCode * 397) ^ Active.GetHashCode();
         hashCode = (hashCode * 397) ^ (Lines != null ? Lines.GetHashCode() : 0);
         return(hashCode);
     }
 }
Exemplo n.º 15
0
                public static Status GetStatus(StatusId statusId)
                {
                    switch (statusId)
                    {
                    case StatusId.Unsubmitted:
                        return(_unsubmitted);

                    case StatusId.Approved:
                        return(_approved);

                    case StatusId.Withdrawn:
                        return(_withdrawn);

                    default:
                        throw new InvalidOperationException();
                    }
                }
 public DebtorEligibilityReviewResponse ToDebtorEligibilityReview(DynamicsGatewayOptions options)
 {
     return(new DebtorEligibilityReviewResponse
     {
         CreditorId = CreditorId,
         CreditorNotes = CreditorNotes,
         MoneyAdviserNotes = MoneyAdviserNotes,
         CreditorName = Creditor,
         Status = options.DebtorEligibilityReviewStatus[StatusId.ToString()],
         CreatedOn = CreatedOn.ToDateTimeOffset(),
         EndReason = options.GetEligibilityReviewParentReasonById(ReasonId),
         ModifiedOn = ModifiedOn.ToDateTimeOffset(),
         NoLongerEligibleReason = SubreasonId != Guid.Empty
             ? options.GetEligibilityReviewChildReasonById(SubreasonId)
             : null
     });
 }
        public override int GetHashCode()
        {
            int hash = 1;

            if (StatusId != 0)
            {
                hash ^= StatusId.GetHashCode();
            }
            if (ApplicationStatus.Length != 0)
            {
                hash ^= ApplicationStatus.GetHashCode();
            }
            if (CurrentNotes.Length != 0)
            {
                hash ^= CurrentNotes.GetHashCode();
            }
            return(hash);
        }
Exemplo n.º 18
0
		/// <summary>
		/// ツイートを投稿します。
		/// </summary>
		public static async Task<Status> UpdateStatus(
			this TwitterToken token, string status, StatusId? inReplyToStatusId = null)
		{
			var endpoint = token.Endpoints["statuses/update"];

			var param = new Dictionary<string, string> { { "status", status } };
			if (inReplyToStatusId.HasValue) param.Add("in_reply_to_status_id", inReplyToStatusId.Value.ToString());

			using (var client = token.GetClient())
			using (var content = new FormUrlEncodedContent(param))
			{
				return await client.PostAsyncEx(
					endpoint.Definition.Url,
					content,
					res => endpoint.RateLimit.Set(res.Headers),
					json => Status.Parse(json, StatusSource.Update),
					() => token.FallbackToken.UpdateStatus(status, inReplyToStatusId));
			}
		}
Exemplo n.º 19
0
        public void Update()
        {
            if (Repository == null)
            {
                throw new ArgumentNullException("Incident domain repository not referenced.");
            }

            if (String.IsNullOrEmpty(Response))
            {
                throw new Exception("Incident response should not be empty.");
            }

            if (StatusId.Equals(false))
            {
                throw new Exception("Status invalid");
            }

            Repository.Update(this);
        }
Exemplo n.º 20
0
        public string ConvertToSearch()
        {
            var cc = DbUtil.Db.ScratchPadCondition();

            cc.Reset();
            var c = cc.AddNewClause(QueryType.OrgSearchMember, CompareType.Equal, "1,True");

            if (Name.HasValue())
            {
                c.OrgName = Name;
            }
            if (ProgramId != 0)
            {
                c.Program = ProgramId.ToString();
            }
            if (DivisionId != 0)
            {
                c.Division = DivisionId.ToString();
            }
            if (StatusId != 0)
            {
                c.OrgStatus = StatusId.ToString();
            }
            if (TypeId != 0)
            {
                c.OrgType2 = TypeId ?? 0;
            }
            if (CampusId != 0)
            {
                c.Campus = CampusId.ToString();
            }
            if (ScheduleId != 0)
            {
                c.Schedule = ScheduleId.ToString();
            }
            if (OnlineReg != 0)
            {
                c.OnlineReg = OnlineReg.ToString();
            }

            cc.Save(DbUtil.Db);
            return("/Query/" + cc.Id);
        }
		/// <summary>
		/// 現在のアカウントが受信したダイレクト メッセージを取得します。
		/// </summary>
		public static IObservable<DirectMessageCollection> GetDirectMessagesBy(
			this TwitterAccount account,
			int? count = null,
			StatusId? sinceId = null,
			StatusId? maxId = null)
		{
			const string endpoint = "direct_messages";
			var client = account.ToOAuthClient(endpoint);

			if (count.HasValue) client.Parameters.Add("count", count.Value);
			if (sinceId.HasValue) client.Parameters.Add("since_id", sinceId.Value);
			if (maxId.HasValue) client.Parameters.Add("max_id", maxId.Value);

			return Observable
				.Defer(() => client.GetResponseText())
				.Select(json => DirectMessageCollection.Parse(json))
				.OnErrorRetry(3)
				.WriteLine(endpoint);
		}
Exemplo n.º 22
0
        public void Save()
        {
            if (Repository == null)
            {
                throw new ArgumentNullException("Incident domain repository not referenced.");
            }

            if (String.IsNullOrEmpty(Title))
            {
                throw new Exception("Incident title should not be empty.");
            }

            if (Title.Length > 20)
            {
                throw new Exception("The title of the incident should be longer than 20 characters.");
            }

            if (String.IsNullOrEmpty(Description))
            {
                throw new Exception("Incident description should not be empty.");
            }

            if (Description.Length > 500)
            {
                throw new Exception("The description of the incident should be longer than 500 characters.");
            }

            if (CategoryId.Equals(null))
            {
                throw new Exception("Category invalid.");
            }

            if (StatusId.Equals(null))
            {
                throw new Exception("Status invalid.");
            }

            Repository.Add(this);
        }
Exemplo n.º 23
0
		public static async Task<StatusCollection> GetHomeTimeline(
			this TwitterToken token,
			int? count = null,
			StatusId? sinceId = null,
			StatusId? maxId = null,
			bool notify = true,
			bool isStartup = false)
		{
			var endpoint = token.Endpoints["statuses/home_timeline"];
			var source = isStartup
				? StatusSource.RestApi | StatusSource.Startup
				: StatusSource.RestApi;

			var param = new Dictionary<string, string>();
			if (count.HasValue) param.Add("count", count.Value.ToString(CultureInfo.InvariantCulture));
			if (sinceId.HasValue) param.Add("since_id", sinceId.Value.ToString());
			if (maxId.HasValue) param.Add("max_id", maxId.Value.ToString());

			return await endpoint.GetAsync(
				token, param, null, json => StatusCollection.Parse(json, source),
				t => t.GetHomeTimeline(count, sinceId, maxId));
		}
Exemplo n.º 24
0
		public static IObservable<StatusCollection> GetHomeTimeline(
			this TwitterAccount account,
			int? count = null,
			StatusId? sinceId = null,
			StatusId? maxId = null,
			bool isStartup = false)
		{
			const string endpoint = "statuses/home_timeline";
			var source = isStartup
				? StatusSource.RestApi | StatusSource.Startup
				: StatusSource.RestApi;
			var client = account.ToOAuthClient(endpoint);

			if (count.HasValue) client.Parameters.Add("count", count.Value);
			if (sinceId.HasValue) client.Parameters.Add("since_id", sinceId.Value);
			if (maxId.HasValue) client.Parameters.Add("max_id", maxId.Value);

			return Observable
				.Defer(client.GetResponseText)
				.Select(json => StatusCollection.Parse(json, source))
				.OnErrorRetry(3)
				.WriteLine(endpoint);
		}
Exemplo n.º 25
0
		/// <summary>
		/// json データを解析し Status オブジェクトを生成するコア メソッド。
		/// このメソッドの呼び出す前に、スレッドを書き込みモードでロックしてください。
		/// </summary>
		/// <remarks>
		/// このメソッド内での一切のロック操作 (またはロック操作を行うメソッドの呼び出し) を禁止します。
		/// </remarks>
		/// <returns></returns>
		private Status ParseCore(StatusId id, dynamic djson, StatusSource source, ICollection<Action> after)
		{
			#region DEBUG build only

#if DEBUG
			after.Add(() => JsonMonitor.Statuses.Data.Add(djson.ToString()));
#endif

			#endregion

			var result = new Status
			{
				Id = id,
				Text = (string)djson.text,
				Truncated = djson.truncated,
				CreatedAt = Helper.ToDateTime(djson.created_at),
				User = client.Users.Parse(djson.user),
			};

			#region source

			try
			{
				result.Source = Source.Parse(djson.source);
			}
			catch (JsonParseException ex)
			{
				after.Add(() => this.client.ReportException("ツイートの投稿に使用された source 情報を解析できませんでした。", ex));
				result.Source = Source.Default;
			}

			#endregion

			#region entities

			if (djson.IsDefined("entities"))
			{
				try
				{
					result.Entities = Entities.ParseCore(djson.entities);
				}
				catch (JsonParseException ex)
				{
					after.Add(() => this.client.ReportException("ツイートに含まれる entities を解析できませんでした。", ex));
					result.Entities = Entities.Default;
				}
			}
			else
			{
				result.Entities = Entities.Default;
			}

			#endregion

			#region retweeted_status

			if (djson.IsDefined("retweeted_status"))
			{
				var rtid = (StatusId)ParseId(djson.retweeted_status);
				var rtstatus = this.statuses.ContainsKey(rtid)
					? this.statuses[rtid]
					: (Status)this.ParseCore(rtid, djson.retweeted_status, source, after);

				rtstatus.RetweetUsers.Add(result.User);
				result.RetweetedStatus = rtstatus;
			}

			#endregion

			#region reply

			result.InReplyToStatusId = null;

			if (djson.IsDefined("in_reply_to_status_id_str") &&
				djson.in_reply_to_status_id_str != null)
			{
				var repId = StatusId.Parse(djson.in_reply_to_status_id_str);
				if (repId != 0)
				{
					result.InReplyToStatusId = repId;
					if (this.statuses.ContainsKey(repId))
					{
						this.statuses[repId].ReplyFrom.Add(result);
					}
				}
			}

			#endregion

			this.statuses.Add(result.Id, result);
			this.Count++;

			after.Add(() => this.statusSeq.OnNext(new StatusStoreItem { Status = result, Source = source }));

			return result;
		}
Exemplo n.º 26
0
 public Video(double cost, LibraryBranch location, StatusId status, string title, short year, string imageUrl, int numberOfCopies, string director)
     : base(cost, location, status, title, year, imageUrl, numberOfCopies)
 {
     this.Director = director;
 }
Exemplo n.º 27
0
 private Status(StatusId id)
 {
     Id   = id;
     Name = id.ToString();
 }
Exemplo n.º 28
0
 public Status(StatusId id, Descricao descricao, bool statusValido)
 {
     Id           = id;
     Descricao    = descricao;
     StatusValido = statusValido;
 }
Exemplo n.º 29
0
 public Status(StatusId id)
 {
     this.Id = (int)id;
 }
Exemplo n.º 30
0
		public Status this[StatusId id]
		{
			get { return this.DoReadLockAction(() => statuses.ContainsKey(id) ? statuses[id] : null); }
		}
Exemplo n.º 31
0
 public int CompareTo(OrderStatus other)
 {
     return(StatusId.CompareTo(other.StatusId));
 }
Exemplo n.º 32
0
		public static async Task<Status> ShowStatus(this TwitterToken token, StatusId statusId, bool? trimUser = true)
		{
			var endpoint = token.Endpoints["statuses/show/:id"];
			var param = new Dictionary<string, string>();
			var urlParam = new Dictionary<string, string> { { ":id", statusId.ToString() }, };
			if (trimUser.HasValue) param.Add("trim_user", trimUser.Value.ToString());

			return await endpoint.GetAsync(token, param, urlParam, Status.Parse, t => t.ShowStatus(statusId, trimUser));
		}
Exemplo n.º 33
0
		private DirectMessage ParseCore(StatusId id, dynamic djson, List<Action> after)
		{
			#region DEBUG build only
#if DEBUG
			after.Add(() => JsonMonitor.DirectMessages.Data.Add(djson.ToString()));
#endif
			#endregion

			// ============================================================================================
			// || このメソッド内での一切のロック操作 (またはロック操作を行うメソッドの呼び出し) を禁止します。 ||
			// ============================================================================================

			var result = new DirectMessage
			{
				Id = id,
				Text = djson.text,
				CreatedAt = Helper.ToDateTime(djson.created_at),
			};

			// ユーザー情報なし版の json に対応する? めんどうだから後だ!!
			result.Recipient = TwitterClient.Current.Users.Parse(djson.recipient);
			result.Sender = TwitterClient.Current.Users.Parse(djson.sender);

			if (djson.IsDefined("entities"))
			{
				result.Entities = Entities.ParseCore(djson.entities);
			}

			this.statuses.Add(result.Id, result);

			after.Add(() => this.RaiseAdded(result));

			return result;
		}
Exemplo n.º 34
0
		public bool Contains(StatusId id)
		{
			return this.DoReadLockAction(() => this.statuses.ContainsKey(id));
		}
Exemplo n.º 35
0
 public int CompareTo(DamageStatus other)
 {
     return(StatusId.CompareTo(other.StatusId));
 }