void ProcessCodeReviewChangedEvent(string message) { CodeReviewChangeEvent e = ParseEvent.Parse <CodeReviewChangeEvent>(message); if (!ShouldBeProcessed( e.Repository, e.BranchFullName, mTrunkBotConfig.Repository, mTrunkBotConfig.BranchPrefix)) { return; } Review review = new Review( e.Repository, e.CodeReviewId, e.BranchId, e.CodeReviewStatus, e.CodeReviewTitle); if (review.IsDeleted()) { ReviewsStorage.DeleteReview(review, mCodeReviewsTrackedFilePath); if (!mTrunkBotConfig.Plastic.IsBranchAttrFilterEnabled) { List <Review> remainingBranchReviews = ReviewsStorage.GetBranchReviews( e.Repository, e.BranchId, mCodeReviewsTrackedFilePath); if (remainingBranchReviews != null && remainingBranchReviews.Count > 0) { return; } lock (mSyncLock) { BranchesQueueStorage.RemoveBranch( e.Repository, e.BranchId, mBranchesQueueFilePath); } } return; } ReviewsStorage.WriteReview(review, mCodeReviewsTrackedFilePath); if (mTrunkBotConfig.Plastic.IsBranchAttrFilterEnabled) { return; } lock (mSyncLock) { EnqueueBranch( mBranchesQueueFilePath, e.Repository, e.BranchId, e.BranchFullName, e.BranchOwner, e.BranchComment); Monitor.Pulse(mSyncLock); } }
public void Configure(ETWMonitorOptions options, ParseEvent parseEventMethod = null) { _sessionName = options.SessionName; _providerGuid = options.ProviderGuid; _providerName = options.ProviderName; _flags = options.Flags; _level = options.Level; _writer = options.Writer; _parseEventMethod = (parseEventMethod == null) ? ParseEvent : parseEventMethod; _fConfigured = true; }
void ProcessBranchAttributeChangedEvent(string message) { BranchAttributeChangeEvent e = ParseEvent.Parse <BranchAttributeChangeEvent>(message); if (!ShouldBeProcessed( e.Repository, e.BranchFullName, mTrunkBotConfig.Repository, mTrunkBotConfig.BranchPrefix)) { return; } if (!IsRelevantAttribute( e.AttributeName, mTrunkBotConfig.Plastic.StatusAttribute)) { return; } lock (mSyncLock) { if (!IsAttributeValueResolved( e.AttributeValue, mTrunkBotConfig.Plastic.StatusAttribute)) { BranchesQueueStorage.RemoveBranch( e.Repository, e.BranchId, mBranchesQueueFilePath); return; } EnqueueBranch( mBranchesQueueFilePath, e.Repository, e.BranchId, e.BranchFullName, e.BranchOwner, e.BranchComment); Monitor.Pulse(mSyncLock); } }
/// <summary> /// Конвертация токенов в класс для работы /// </summary> /// <param name="tokens"></param> /// <returns></returns> static void TokensToLuaValue(List <LuaToken> tokens) { LuaValue current = new LuaValue(); void AddRoot() { var parent = current; current = new LuaValue(); parent.AddChildren(current); } void BackRoot() { current = current.parent; if (current.parent == null) { var last = current.AllChildren.Last(); last.GetMyFunctions(functions); ParseEvent?.Invoke(last); } } LuaTokenType pastTokenType = LuaTokenType.None; bool isComplexValue = false; foreach (var token in tokens) { switch (token.type) { case LuaTokenType.start: switch (pastTokenType) { case LuaTokenType.start: case LuaTokenType.endValue: isComplexValue = false; AddRoot(); break; case LuaTokenType.assign: isComplexValue = true; break; } break; case LuaTokenType.end: switch (pastTokenType) { case LuaTokenType.end: BackRoot(); break; } isComplexValue = false; break; case LuaTokenType.endValue: if (!isComplexValue) { BackRoot(); } break; case LuaTokenType.key: isComplexValue = false; AddRoot(); current.key = token.value; break; case LuaTokenType.assign: break; case LuaTokenType.value: current.AddValue(token.value); break; default: break; } pastTokenType = token.type; } CompliteEvent?.Invoke(); }