public object ExecuteWithChanges(DbCommand cmd, ChangeInfo changeInfo) { object result; using (var conn = DB.OpenConnection()) using (var tx = conn.BeginTransaction()) { try { cmd.Connection = conn; cmd.Transaction = tx; result = cmd.ExecuteScalar(); if (AdminInitialise.IsChangesEnabled) { var changeCmd = CreateChangeCommand(changeInfo, result.ToString()); changeCmd.Connection = conn; changeCmd.Transaction = tx; changeCmd.ExecuteNonQuery(); } tx.Commit(); } catch (Exception ex) { result = null; _notificator.Error(ex.Message); tx.Rollback(); } } return result; }
public ChangeInfo(ImmutableArray<TextChangeRange> changeRanges, WeakReference<SourceText> weakOldText, ChangeInfo previous) { this.ChangeRanges = changeRanges; this.WeakOldText = weakOldText; this.Previous = previous; Clean(); }
private ChangeInfo GetChangeInfoForEntry(DbEntityEntry entry) { var changeInfo = new ChangeInfo { EntityName = ObjectContext.GetObjectType(entry.Entity.GetType()).Name, ProperyChangeInfo = new Dictionary <string, ChangePair>(), TargetId = ((IAuditEntity)entry.Entity).Id }; List <string> propertyNames = new List <string>(); if (entry.State == EntityState.Deleted) { propertyNames.AddRange(entry.OriginalValues.PropertyNames); } else { propertyNames.AddRange(entry.CurrentValues.PropertyNames); } foreach (var pn in propertyNames) { if (!IsAuditRequired(entry, pn)) { continue; } var changePair = new ChangePair(); switch (entry.State) { case EntityState.Added: changePair.NewValue = entry.CurrentValues[pn].ToString(); break; case EntityState.Modified: changePair.OldValue = entry.OriginalValues[pn].ToString(); changePair.NewValue = entry.CurrentValues[pn].ToString(); if (changePair.OldValue == changePair.NewValue) { continue; } break; case EntityState.Deleted: changePair.OldValue = entry.OriginalValues[pn].ToString(); break; default: throw new ApplicationException("Invalid internal model state."); } changeInfo.ProperyChangeInfo.Add(pn, changePair); } return(changeInfo); }
internal ChangeInfo GetMetaChange(ChangeInfo change) { if (change == null) { return(null); } return(mPendingChangesTree.GetMetaChange(change)); }
public void RecordChange(ChangeInfo entry) { if (_lastRecords.Count >= 100) { ChangeInfo temp; _lastRecords.TryDequeue(out temp); } _lastRecords.Enqueue(entry); }
static bool IsApplicableDiffWorkspaceContent( PendingChangesTreeView treeView) { ChangeInfo selectedRow = GetSelectedChange(treeView); if (selectedRow == null) return false; return DiffOperation.IsApplicableDiffWorkspaceContent(selectedRow); }
private void endChangeAnimationIfNecessary(ChangeInfo changeInfo) { if (changeInfo.oldHolder != null) { endChangeAnimationIfNecessary(changeInfo, changeInfo.oldHolder); } if (changeInfo.newHolder != null) { endChangeAnimationIfNecessary(changeInfo, changeInfo.newHolder); } }
internal static UnityEngine.Object FromChangeInfo(ChangeInfo changeInfo) { string changeFullPath = changeInfo.GetFullPath(); if (MetaPath.IsMetaPath(changeFullPath)) { changeFullPath = MetaPath.GetPathFromMetaPath(changeFullPath); } return(FromFullPath(changeFullPath)); }
internal ChangeInfo GetExistingMeta(ChangeInfo change) { ChangeInfo result; if (!mCache.TryGetValue(BuildKey.ForMetaChange(change), out result)) { return(null); } return(result); }
public ChangedText(SourceText oldText, SourceText newText, ImmutableArray <TextChangeRange> changeRanges) : base(checksumAlgorithm: oldText.ChecksumAlgorithm) { Debug.Assert(newText != null); Debug.Assert(newText is CompositeText || newText is SubText || newText is StringText || newText is LargeText); Debug.Assert(oldText != null); Debug.Assert(oldText != newText); Debug.Assert(!changeRanges.IsDefault); _newText = newText; _info = new ChangeInfo(changeRanges, new WeakReference <SourceText>(oldText), (oldText as ChangedText)?._info); }
internal bool SelectionHasMeta() { ChangeInfo selectedChangeInfo = GetSelectedRow(); if (selectedChangeInfo == null) { return(false); } return(mPendingChangesTree.HasMeta(selectedChangeInfo)); }
void IPendingChangesMenuOperations.History() { ChangeInfo selectedChange = PendingChangesSelection. GetSelectedChange(mPendingChangesTreeView); mHistoryViewLauncher.ShowHistoryView( selectedChange.RepositorySpec, selectedChange.RevInfo.ItemId, selectedChange.Path, selectedChange.IsDirectory); }
public ChangedText(SourceText oldText, SourceText newText, ImmutableArray<TextChangeRange> changeRanges) : base(checksumAlgorithm: oldText.ChecksumAlgorithm) { Debug.Assert(newText != null); Debug.Assert(newText is CompositeText || newText is SubText || newText is StringText || newText is LargeText); Debug.Assert(oldText != null); Debug.Assert(oldText != newText); Debug.Assert(!changeRanges.IsDefault); _newText = newText; _info = new ChangeInfo(changeRanges, new WeakReference<SourceText>(oldText), (oldText as ChangedText)?._info); }
private bool IsChangedFrom(SourceText oldText) { for (ChangeInfo info = _info; info != null; info = info.Previous) { if (info.WeakOldText.TryGetTarget(out SourceText text) && text == oldText) { return(true); } } return(false); }
void IPendingChangesMenuOperations.Diff() { ChangeInfo selectedChange = PendingChangesSelection .GetSelectedChange(mPendingChangesTreeView); DiffOperation.DiffWorkspaceContent( mWkInfo, selectedChange, mPendingChanges.GetChangedForMoved(selectedChange), mProgressControls, null, null); }
public ActionResult ApplyChanges(ChangeInfo[] changes) { //Update changes ComparisonWidget.UpdateChanges(changes); //Create update changes response UpdateChangesResponse response = new UpdateChangesResponse(); //Serialize response var serializer = new JavaScriptSerializer(); var serializedData = serializer.Serialize(response); return Content(serializedData); }
public void TestChangeInfo() { var user = new User { UserName = "******", Email = "email address" }; string changeInfo = new ChangeInfo() .AddChange(() => user.UserName) .AddChange(() => user.Email) .AddChange(() => user.AreaId) .ToJson(); Assert.AreEqual(@"{""UserName"":""asdf"",""Email"":""email address"",""AreaId"":0}", changeInfo); }
public GherkinFileEditorParser(ITextBuffer buffer, IClassificationTypeRegistryService registry, SpecFlowProject specFlowProject) { this.buffer = buffer; this.specFlowProject = specFlowProject; this.buffer.Changed += BufferChanged; this.classifications = new GherkinFileEditorClassifications(registry); // initial parsing ChangeInfo changeInfo = new ChangeInfo(buffer); parsingTask = parsingTaskFactory.StartNew(() => ParseAndTriggerChanges(GherkinFileEditorInfo, changeInfo)); }
void PendingChangesViewMenu.IMetaMenuOperations.HistoryMeta() { ChangeInfo selectedChange = PendingChangesSelection .GetSelectedChange(mPendingChangesTreeView); ChangeInfo selectedChangeMeta = mPendingChangesTreeView.GetMetaChange( selectedChange); mHistoryViewLauncher.ShowHistoryView( selectedChangeMeta.RepositorySpec, selectedChangeMeta.RevInfo.ItemId, selectedChangeMeta.Path, selectedChangeMeta.IsDirectory); }
private static void UpdateRegionDelegate(Guid uuid, ChangeInfo changeData) { var change = changeData.Changes?.Contains(ChangeCategory.TerrainTexture); if (change ?? false) { _regionUUID = uuid.ToString(); } else { _regionUUID = "failed to get change."; } }
public void Route53ChangeResourceRecordSets() { #region to-create-failover-resource-record-sets-1484604541740 var client = new AmazonRoute53Client(); var response = client.ChangeResourceRecordSets(new ChangeResourceRecordSetsRequest { ChangeBatch = new ChangeBatch { Changes = new List <Change> { new Change { Action = "CREATE", ResourceRecordSet = new ResourceRecordSet { Failover = "PRIMARY", HealthCheckId = "abcdef11-2222-3333-4444-555555fedcba", Name = "example.com", ResourceRecords = new List <ResourceRecord> { new ResourceRecord { Value = "192.0.2.44" } }, SetIdentifier = "Ohio region", TTL = 60, Type = "A" } }, new Change { Action = "CREATE", ResourceRecordSet = new ResourceRecordSet { Failover = "SECONDARY", HealthCheckId = "abcdef66-7777-8888-9999-000000fedcba", Name = "example.com", ResourceRecords = new List <ResourceRecord> { new ResourceRecord { Value = "192.0.2.45" } }, SetIdentifier = "Oregon region", TTL = 60, Type = "A" } } }, Comment = "Failover configuration for example.com" }, HostedZoneId = "Z3M3LMPEXAMPLE" }); ChangeInfo changeInfo = response.ChangeInfo; #endregion }
public void Route53ChangeResourceRecordSets() { #region to-create-weighted-resource-record-sets-1484348208522 var client = new AmazonRoute53Client(); var response = client.ChangeResourceRecordSets(new ChangeResourceRecordSetsRequest { ChangeBatch = new ChangeBatch { Changes = new List <Change> { new Change { Action = "CREATE", ResourceRecordSet = new ResourceRecordSet { HealthCheckId = "abcdef11-2222-3333-4444-555555fedcba", Name = "example.com", ResourceRecords = new List <ResourceRecord> { new ResourceRecord { Value = "192.0.2.44" } }, SetIdentifier = "Seattle data center", TTL = 60, Type = "A", Weight = 100 } }, new Change { Action = "CREATE", ResourceRecordSet = new ResourceRecordSet { HealthCheckId = "abcdef66-7777-8888-9999-000000fedcba", Name = "example.com", ResourceRecords = new List <ResourceRecord> { new ResourceRecord { Value = "192.0.2.45" } }, SetIdentifier = "Portland data center", TTL = 60, Type = "A", Weight = 200 } } }, Comment = "Web servers for example.com" }, HostedZoneId = "Z3M3LMPEXAMPLE" }); ChangeInfo changeInfo = response.ChangeInfo; #endregion }
internal bool GetSelectedPathsToDelete( out List <string> privateDirectories, out List <string> privateFiles) { privateDirectories = new List <string>(); privateFiles = new List <string>(); List <ChangeInfo> dirChanges = new List <ChangeInfo>(); List <ChangeInfo> fileChanges = new List <ChangeInfo>(); IList <int> selectedIds = GetSelection(); if (selectedIds.Count == 0) { return(false); } foreach (KeyValuePair <PendingChangeInfo, int> item in mTreeViewItemIds.GetInfoItems()) { if (!selectedIds.Contains(item.Value)) { continue; } ChangeInfo changeInfo = item.Key.ChangeInfo; if (ChangeInfoType.IsControlled(changeInfo)) { continue; } if (changeInfo.IsDirectory) { dirChanges.Add(changeInfo); continue; } fileChanges.Add(changeInfo); } mPendingChangesTree.FillWithMeta(fileChanges); mPendingChangesTree.FillWithMeta(dirChanges); privateDirectories = dirChanges.Select( d => d.GetFullPath()).ToList(); privateFiles = fileChanges.Select( f => f.GetFullPath()).ToList(); return(true); }
public void Route53ChangeResourceRecordSets() { #region to-create-latency-resource-record-sets-1484350219917 var client = new AmazonRoute53Client(); var response = client.ChangeResourceRecordSets(new ChangeResourceRecordSetsRequest { ChangeBatch = new ChangeBatch { Changes = new List <Change> { new Change { Action = "CREATE", ResourceRecordSet = new ResourceRecordSet { HealthCheckId = "abcdef11-2222-3333-4444-555555fedcba", Name = "example.com", Region = "us-east-2", ResourceRecords = new List <ResourceRecord> { new ResourceRecord { Value = "192.0.2.44" } }, SetIdentifier = "Ohio region", TTL = 60, Type = "A" } }, new Change { Action = "CREATE", ResourceRecordSet = new ResourceRecordSet { HealthCheckId = "abcdef66-7777-8888-9999-000000fedcba", Name = "example.com", Region = "us-west-2", ResourceRecords = new List <ResourceRecord> { new ResourceRecord { Value = "192.0.2.45" } }, SetIdentifier = "Oregon region", TTL = 60, Type = "A" } } }, Comment = "EC2 instances for example.com" }, HostedZoneId = "Z3M3LMPEXAMPLE" }); ChangeInfo changeInfo = response.ChangeInfo; #endregion }
private void AuditUserUpdate(User updated) { string changeInfo = new ChangeInfo() .AddChange(() => updated.Phone) .AddChange(() => updated.Email) .AddChange(() => updated.AreaId) .ToJson(); auditLogRepository.Add( AuditLogBuilder.Builder() .User(HttpContext.User.Identity.Name) .Updated(typeof(User), updated.UserName) .With(changeInfo).Build()); }
protected internal virtual void endChangeAnimation(IList <ChangeInfo> infoList, RecyclerView.ViewHolder item) { for (int i = infoList.Count - 1; i >= 0; i--) { ChangeInfo changeInfo = infoList[i]; if (endChangeAnimationIfNecessary(changeInfo, item)) { if (changeInfo.oldHolder == null && changeInfo.newHolder == null) { infoList.Remove(changeInfo); } } } }
ChangeInfo GetExistingAddedItem( PendingChangeCategory addedCategory, int addedItemIndex) { ChangeInfo currentChangeInfo = ((PendingChangeInfo)addedCategory. GetChild(addedItemIndex)).ChangeInfo; if (Directory.Exists(currentChangeInfo.Path) || File.Exists(currentChangeInfo.Path)) { return(currentChangeInfo); } return(null); }
private void AuditAreaChange(Area existing) { string changeInfo = new ChangeInfo() .AddChange(() => existing.Name) .AddChange(() => existing.Description) .AddChange(() => existing.ParentId) .ToJson(); auditLogRepository.Add( AuditLogBuilder.Builder() .User(HttpContext.User.Identity.Name) .Updated(typeof(Area), existing.Name) .With(changeInfo) .Build()); }
public GherkinFileEditorParser(ITextBuffer buffer, IClassificationTypeRegistryService registry, IVisualStudioTracer visualStudioTracer, SpecFlowProject specFlowProject) { this.buffer = buffer; this.visualStudioTracer = visualStudioTracer; this.specFlowProject = specFlowProject; this.buffer.Changed += BufferChanged; this.classifications = new GherkinFileEditorClassifications(registry); // initial parsing visualStudioTracer.Trace("Initial parsing scheduled", ParserTraceCategory); ChangeInfo changeInfo = new ChangeInfo(buffer); parsingTask = parsingTaskFactory.StartNew(() => ParseAndTriggerChanges(GherkinFileEditorInfo, changeInfo)); }
ChangeInfo GetPreviousExistingAddedItem( PendingChangeCategory addedCategory, int targetAddedItemIndex) { for (int i = targetAddedItemIndex - 1; i >= 0; i--) { ChangeInfo currentChangeInfo = GetExistingAddedItem(addedCategory, i); if (currentChangeInfo != null) { return(currentChangeInfo); } } return(null); }
// Asserts that the specified ChangeInfo is valid. private void assertValidChangeInfo(ChangeInfo change) { Assert.IsNotNull(change.Id); Assert.IsNotNull(change.Status); Assert.IsNotNull(change.SubmittedAt); ChangeInfo retrievedChange = Client.GetChange(new GetChangeRequest { Id = change.Id }).ChangeInfo; Assert.IsNotNull(retrievedChange); Assert.IsNotNull(retrievedChange.Id); Assert.IsNotNull(retrievedChange.Status); Assert.IsNotNull(retrievedChange.SubmittedAt); }
private async Task WaitChangesPropagation(ChangeInfo changeInfo) { if (changeInfo.Status == ChangeStatus.INSYNC) { return; } _log.Information("Waiting for DNS changes propagation"); var changeRequest = new GetChangeRequest(changeInfo.Id); while ((await _route53Client.GetChangeAsync(changeRequest)).ChangeInfo.Status == ChangeStatus.PENDING) { await Task.Delay(2000); } }
private void WaitChangesPropagation(ChangeInfo changeInfo) { if (changeInfo.Status == ChangeStatus.INSYNC) { return; } _log.Information("Waiting for DNS changes propagation"); var changeRequest = new GetChangeRequest(changeInfo.Id); while (_route53Client.GetChange(changeRequest).ChangeInfo.Status == ChangeStatus.PENDING) { Thread.Sleep(TimeSpan.FromSeconds(5d)); } }
public void Route53ChangeResourceRecordSets() { #region to-create-failover-alias-resource-record-sets-1484607497724 var client = new AmazonRoute53Client(); var response = client.ChangeResourceRecordSets(new ChangeResourceRecordSetsRequest { ChangeBatch = new ChangeBatch { Changes = new List <Change> { new Change { Action = "CREATE", ResourceRecordSet = new ResourceRecordSet { AliasTarget = new AliasTarget { DNSName = "example-com-123456789.us-east-2.elb.amazonaws.com ", EvaluateTargetHealth = true, HostedZoneId = "Z3AADJGX6KTTL2" }, Failover = "PRIMARY", Name = "example.com", SetIdentifier = "Ohio region", Type = "A" } }, new Change { Action = "CREATE", ResourceRecordSet = new ResourceRecordSet { AliasTarget = new AliasTarget { DNSName = "example-com-987654321.us-west-2.elb.amazonaws.com ", EvaluateTargetHealth = true, HostedZoneId = "Z1H1FL5HABSF5" }, Failover = "SECONDARY", Name = "example.com", SetIdentifier = "Oregon region", Type = "A" } } }, Comment = "Failover alias configuration for example.com" }, HostedZoneId = "Z3M3LMPEXAMPLE" // Depends on the type of resource that you want to route traffic to }); ChangeInfo changeInfo = response.ChangeInfo; #endregion }
ChangeInfo GetNextExistingAddedItem( PendingChangeCategory addedCategory, int targetAddedItemIndex) { int addedItemsCount = addedCategory.GetChildrenCount(); for (int i = targetAddedItemIndex + 1; i < addedItemsCount; i++) { ChangeInfo currentChangeInfo = GetExistingAddedItem(addedCategory, i); if (currentChangeInfo != null) { return(currentChangeInfo); } } return(null); }
public void Route53ChangeResourceRecordSets() { #region to-create-weighted-alias-resource-record-sets-1484349467416 var response = client.ChangeResourceRecordSets(new ChangeResourceRecordSetsRequest { ChangeBatch = new ChangeBatch { Changes = new List <Change> { new Change { Action = "CREATE", ResourceRecordSet = new ResourceRecordSet { AliasTarget = new AliasTarget { DNSName = "example-com-123456789.us-east-2.elb.amazonaws.com ", EvaluateTargetHealth = true, HostedZoneId = "Z3AADJGX6KTTL2" }, Name = "example.com", SetIdentifier = "Ohio region", Type = "A", Weight = 100 } }, new Change { Action = "CREATE", ResourceRecordSet = new ResourceRecordSet { AliasTarget = new AliasTarget { DNSName = "example-com-987654321.us-west-2.elb.amazonaws.com ", EvaluateTargetHealth = true, HostedZoneId = "Z1H1FL5HABSF5" }, Name = "example.com", SetIdentifier = "Oregon region", Type = "A", Weight = 200 } } }, Comment = "ELB load balancers for example.com" }, HostedZoneId = "Z3M3LMPEXAMPLE" // Depends on the type of resource that you want to route traffic to }); ChangeInfo changeInfo = response.ChangeInfo; #endregion }
private DbCommand CreateChangeCommand(ChangeInfo changeInfo, string keyValue) { var cmd = DB.CreateCommand(); var sql = @"INSERT INTO {0} ([EntityName], [EntityKey], [ChangeType], [Description], [ChangedOn], [ChangedBy]) VALUES (@0,@1,@2,@3,@4,@5);".Fill(AdminInitialise.ChangeEntity.TableName); cmd.AddParam(changeInfo.EntityName); cmd.AddParam(keyValue); cmd.AddParam(changeInfo.Type); cmd.AddParam(changeInfo.Description); cmd.AddParam(DateTime.UtcNow); cmd.AddParam(HttpContext.Current.User.Identity.Name); cmd.CommandText = sql; return cmd; }
private void ParseAndTriggerChanges(GherkinFileEditorInfo gherkinFileEditorInfo, ChangeInfo changeInfo) { if (gherkinFileEditorInfo == null) { // initial parsing FullParse(changeInfo); return; } // incremental parsing var firstAffectedScenario = gherkinFileEditorInfo.ScenarioEditorInfos.LastOrDefault( s => s.StartLine <= changeInfo.ChangeFirstLine); if (firstAffectedScenario == null) { FullParse(changeInfo); return; } PartialParse(gherkinFileEditorInfo, changeInfo, firstAffectedScenario); }
private void PartialParse(GherkinFileEditorInfo gherkinFileEditorInfo, ChangeInfo changeInfo, ScenarioEditorInfo firstAffectedScenario) { int parseStartPosition = changeInfo.TextSnapshot.GetLineFromLineNumber(firstAffectedScenario.StartLine).Start; string fileContent = changeInfo.TextSnapshot.GetText(parseStartPosition, changeInfo.TextSnapshot.Length - parseStartPosition); string fileHeader = changeInfo.TextSnapshot.GetText(0, parseStartPosition); I18n languageService = GetLanguageService(fileHeader); ScenarioEditorInfo firstUnchangedScenario; var partialResult = DoParsePartial(fileContent, languageService, firstAffectedScenario.StartLine, out firstUnchangedScenario, changeInfo.TextSnapshot, gherkinFileEditorInfo, changeInfo.ChangeLastLine, changeInfo.LineCountDelta); if (partialResult.HeaderClassificationSpans.Any()) { //TODO: merge to the prev scenario? partialResult.HeaderClassificationSpans.Clear(); } partialResult.HeaderClassificationSpans.AddRange( gherkinFileEditorInfo.HeaderClassificationSpans .Select(cs => cs.Shift(changeInfo.TextSnapshot, 0))); // inserting the non-affected scenarios partialResult.ScenarioEditorInfos.InsertRange(0, gherkinFileEditorInfo.ScenarioEditorInfos.TakeUntilItemExclusive(firstAffectedScenario) .Select(senario => senario.Shift(changeInfo.TextSnapshot, 0, 0))); if (firstUnchangedScenario != null) { // inserting the non-effected scenarios at the end partialResult.ScenarioEditorInfos.AddRange( gherkinFileEditorInfo.ScenarioEditorInfos.SkipFromItemInclusive(firstUnchangedScenario) .Select( scenario => scenario.Shift(changeInfo.TextSnapshot, changeInfo.LineCountDelta, changeInfo.PositionDelta))); } TriggerChanges(partialResult, changeInfo, firstAffectedScenario, firstUnchangedScenario); }
private ChangeInfo ConsumePendingChangeInfo() { // the pendingChangeInfo is a shared resource, we need to protect any read/write ChangeInfo changeInfo; lock (pendingChangeInfoSynchRoot) { changeInfo = pendingChangeInfo; pendingChangeInfo = null; } return changeInfo; }
private void FullParse(ChangeInfo changeInfo) { string fileContent = changeInfo.TextSnapshot.GetText(); I18n languageService = GetLanguageService(fileContent); var result = DoParse(fileContent, languageService, changeInfo.TextSnapshot); TriggerChanges(result, changeInfo); }
/// <summary> /// @brief /// </summary> /// <param name="changeInfo"> </param> /// <param name="holder"> </param> /// <param name="newHolder"> </param> //JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET: //ORIGINAL LINE: private void animateChangeOrdinalApp(final ChangeInfo changeInfo, final OrdinalAppViewHolder holder, final OrdinalAppViewHolder newHolder) private void animateChangeOrdinalApp(ChangeInfo changeInfo, OrdinalAppViewHolder holder, OrdinalAppViewHolder newHolder) { if (FcConstants.OPT_DETAILED_LOGS) { Log.d(TAG, "animateChangeOrdinalApp(position=" + newHolder.AdapterPosition + ", " + changeInfo + ")"); Log.d(TAG, " duration = " + ChangeDuration); } //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final android.view.View newView = newHolder.itemView; View newView = newHolder.itemView; // Default animation whenever one of the two views is not present if (newView == null) { animateChangeDefault(changeInfo, holder, newHolder); return; } //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final int oldWidth = (null == holder) ? 0 : holder.mDeviceRootLayout.getWidth(); int oldWidth = (null == holder) ? 0 : holder.mDeviceRootLayout.Width; //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final int newWidth = newHolder.mDeviceRootLayout.getWidth(); int newWidth = newHolder.mDeviceRootLayout.Width; if (FcConstants.OPT_DETAILED_LOGS) { Log.d(TAG, "oldWidth = " + oldWidth + ", newWidth = " + newWidth); } if (oldWidth == 0 && newWidth > 0) { animateOrdinalAppExpanding(changeInfo, holder, newHolder); } else if (oldWidth > 0 && newWidth == 0) { animateOrdinalAppCollapsing(changeInfo, holder, newHolder); } else { animateOrdinalAppUpdate(changeInfo, holder, newHolder); } }
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET: //ORIGINAL LINE: protected void animateChangeImpl(final ChangeInfo changeInfo) protected internal virtual void animateChangeImpl(ChangeInfo changeInfo) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final android.support.v7.widget.RecyclerView.ViewHolder holder = changeInfo.oldHolder; RecyclerView.ViewHolder holder = changeInfo.oldHolder; //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final android.view.View view = holder == null ? null : holder.itemView; View view = holder == null ? null : holder.itemView; //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final android.support.v7.widget.RecyclerView.ViewHolder newHolder = changeInfo.newHolder; RecyclerView.ViewHolder newHolder = changeInfo.newHolder; //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final android.view.View newView = newHolder != null ? newHolder.itemView : null; View newView = newHolder != null ? newHolder.itemView : null; if (view != null) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final android.support.v4.view.ViewPropertyAnimatorCompat oldViewAnim = android.support.v4.view.ViewCompat.animate(view).setDuration(getChangeDuration()); ViewPropertyAnimatorCompat oldViewAnim = ViewCompat.animate(view).setDuration(ChangeDuration); mChangeAnimations.Add(changeInfo.oldHolder); oldViewAnim.translationX(changeInfo.toX - changeInfo.fromX); oldViewAnim.translationY(changeInfo.toY - changeInfo.fromY); oldViewAnim.alpha(0).setListener(new VpaListenerAdapterAnonymousInnerClassHelper4(this, changeInfo, view, oldViewAnim)) .start(); } if (newView != null) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final android.support.v4.view.ViewPropertyAnimatorCompat newViewAnimation = android.support.v4.view.ViewCompat.animate(newView); ViewPropertyAnimatorCompat newViewAnimation = ViewCompat.animate(newView); mChangeAnimations.Add(changeInfo.newHolder); newViewAnimation.translationX(0).translationY(0).setDuration(ChangeDuration).alpha(1).setListener(new VpaListenerAdapterAnonymousInnerClassHelper5(this, changeInfo, view, newView, newViewAnimation)) .start(); } }
public void UpdateChanges(ChangeInfo[] changes) { //Update changes _service.UpdateChanges(changes); }
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET: //ORIGINAL LINE: private void animateOrdinalAppUpdate(final ChangeInfo changeInfo, final OrdinalAppViewHolder holder, final OrdinalAppViewHolder newHolder) private void animateOrdinalAppUpdate(ChangeInfo changeInfo, OrdinalAppViewHolder holder, OrdinalAppViewHolder newHolder) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final android.view.View oldView = (null == holder) ? null : holder.itemView; View oldView = (null == holder) ? null : holder.itemView; //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final android.view.View newView = (null == newHolder) ? null : newHolder.itemView; View newView = (null == newHolder) ? null : newHolder.itemView; //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final boolean hasNoTranslations = changeInfo.hasNoTranslation(); bool hasNoTranslations = changeInfo.hasNoTranslation(); if (FcConstants.OPT_DETAILED_LOGS) { Log.d(TAG, "animateOrdinalAppUpdate(" + holder + ")"); Log.d(TAG, " change info: " + changeInfo); Log.d(TAG, " no translations: " + changeInfo.hasNoTranslation()); } if (oldView != null) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final android.animation.AnimatorSet animator = new android.animation.AnimatorSet(); AnimatorSet animator = new AnimatorSet(); animator.playTogether(ObjectAnimator.ofFloat(oldView, View.TRANSLATION_X, changeInfo.toX - changeInfo.fromX), ObjectAnimator.ofFloat(oldView, View.TRANSLATION_Y, changeInfo.toY - changeInfo.fromY)); if (hasNoTranslations) { if (FcConstants.OPT_DETAILED_LOGS) { Log.v(TAG, "animateOrdinalAppUpdate -> oldHolder -> no translations, setting duration to 0"); } animator.Duration = 0; } else { animator.Duration = ChangeDuration; } // acquireUserScrolling(); animator.addListener(new FcAnimatorListenerAnonymousInnerClassHelper6(this, holder, oldView, newView, animator)); mRunningAnimators[holder] = animator; animator.start(); } if (newView != null) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final android.animation.AnimatorSet animator = new android.animation.AnimatorSet(); AnimatorSet animator = new AnimatorSet(); animator.playTogether(ObjectAnimator.ofFloat(newView, View.TRANSLATION_X, 0), ObjectAnimator.ofFloat(newView, View.TRANSLATION_Y, 0)); if (hasNoTranslations) { if (FcConstants.OPT_DETAILED_LOGS) { Log.v(TAG, "animateOrdinalAppUpdate -> oldHolder -> no translations, setting duration to 0"); } animator.Duration = 0; } else { animator.Duration = ChangeDuration; } acquireUserScrolling(); animator.addListener(new FcAnimatorListenerAnonymousInnerClassHelper7(this, newHolder, oldView, newView, animator)); mRunningAnimators[newHolder] = animator; animator.start(); } }
public ChangeEventArgs(ChangeInfo info, ChangeSource source, ChangeType type) { this.Info = info; this.Source = source; this.Type = type; }
/// <summary> /// This method will be called when app root layout is to be expanded from 0 to some width /// /// Old holder will contain a root layout with with = 0, new holder will contain a root layout /// with some width greater than 0. /// </summary> /// <param name="changeInfo"> </param> /// <param name="oldHolder"> </param> /// <param name="newHolder"> </param> //JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET: //ORIGINAL LINE: private void animateOrdinalAppExpanding(final ChangeInfo changeInfo, final OrdinalAppViewHolder oldHolder, final OrdinalAppViewHolder newHolder) private void animateOrdinalAppExpanding(ChangeInfo changeInfo, OrdinalAppViewHolder oldHolder, OrdinalAppViewHolder newHolder) { if (FcConstants.OPT_DETAILED_LOGS) { Log.d(TAG, "animateOrdinalAppExpanding"); Log.d(TAG, " change info: " + changeInfo); Log.d(TAG, " old holder : " + oldHolder); if (null != oldHolder) { Log.d(TAG, " old view: " + oldHolder.itemView); Log.d(TAG, " needs scroll focus: " + oldHolder.needsScrollFocus()); } if (null != newHolder) { Log.d(TAG, " new view: " + newHolder.itemView); Log.d(TAG, " needs scroll focus: " + newHolder.needsScrollFocus()); } } //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final android.view.View oldView = (null == oldHolder) ? null : oldHolder.itemView; View oldView = (null == oldHolder) ? null : oldHolder.itemView; //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final android.view.View newView = (null == newHolder) ? null : newHolder.itemView; View newView = (null == newHolder) ? null : newHolder.itemView; if (null != oldView) { IList<Animator> oldAnimatorList = new List<Animator>(); addOrdinalAppButtonClickedAnimation(oldAnimatorList, oldHolder); addTranslateOldAnimator(oldAnimatorList, changeInfo, oldHolder); acquireUserScrolling(); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final android.animation.Animator expandAnimator = mFactory.createExpandActionsAnimator(oldHolder.mDeviceRootLayout, getChangeDuration()); Animator expandAnimator = mFactory.createExpandActionsAnimator(oldHolder.mDeviceRootLayout, ChangeDuration); expandAnimator.Duration = ChangeDuration; expandAnimator.addListener(new FcAnimatorListenerAnonymousInnerClassHelper10(this, oldHolder, oldView, newView, expandAnimator)); oldAnimatorList.Add(expandAnimator); AnimatorSet mainAnimator = new AnimatorSet(); mainAnimator.Duration = ChangeDuration; mainAnimator.playTogether(oldAnimatorList); mRunningAnimators[oldHolder] = mainAnimator; mainAnimator.start(); } if (null != newView) { acquireUserScrolling(); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final android.animation.AnimatorSet translationAnimators = new android.animation.AnimatorSet(); AnimatorSet translationAnimators = new AnimatorSet(); if (RtlDirection) { if (FcConstants.OPT_DETAILED_LOGS) { Log.v(TAG, "RTL direction: setting animation duration to 0"); } translationAnimators.Duration = 0; } else { translationAnimators.Duration = ChangeDuration; } translationAnimators.playTogether(ObjectAnimator.ofFloat(newHolder.itemView, View.TRANSLATION_X, 0), ObjectAnimator.ofFloat(newHolder.itemView, View.TRANSLATION_Y, 0)); translationAnimators.addListener(new FcAnimatorListenerAnonymousInnerClassHelper11(this, newHolder, oldView, newView, translationAnimators)); mRunningAnimators[newHolder] = translationAnimators; translationAnimators.start(); } }
private void FullParse(ChangeInfo changeInfo) { visualStudioTracer.Trace("Start full parsing", ParserTraceCategory); Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); partialParseCount = 0; string fileContent = changeInfo.TextSnapshot.GetText(); I18n languageService = GetLanguageService(fileContent); var result = DoParse(fileContent, languageService, changeInfo.TextSnapshot); TriggerChanges(result, changeInfo); stopwatch.Stop(); TraceFinishParse(stopwatch, "full"); }
private void TriggerChanges(GherkinFileEditorInfo gherkinFileEditorInfo, ChangeInfo changeInfo, ScenarioEditorInfo firstAffectedScenario = null, ScenarioEditorInfo firstUnchangedScenario = null) { this.GherkinFileEditorInfo = gherkinFileEditorInfo; var textSnapshot = changeInfo.TextSnapshot; int startPosition = 0; if (firstAffectedScenario != null) startPosition = textSnapshot.GetLineFromLineNumber(firstAffectedScenario.StartLine).Start; int endPosition = textSnapshot.Length; if (firstUnchangedScenario != null) endPosition = textSnapshot.GetLineFromLineNumber(firstUnchangedScenario.StartLine).Start; // safety criteria to avoid argument execption in case of a wrong parser result if (startPosition >= endPosition) return; var snapshotSpan = new SnapshotSpan(textSnapshot, startPosition, endPosition - startPosition); if (ClassificationChanged != null) { ClassificationChanged(this, new ClassificationChangedEventArgs(snapshotSpan)); } if (TagsChanged != null) { TagsChanged(this, new SnapshotSpanEventArgs(snapshotSpan)); } }
private void PartialParse(GherkinFileEditorInfo gherkinFileEditorInfo, ChangeInfo changeInfo, ScenarioEditorInfo firstAffectedScenario) { visualStudioTracer.Trace("Start incremental parsing", ParserTraceCategory); Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); partialParseCount++; int parseStartPosition = changeInfo.TextSnapshot.GetLineFromLineNumber(firstAffectedScenario.StartLine).Start; string fileContent = changeInfo.TextSnapshot.GetText(parseStartPosition, changeInfo.TextSnapshot.Length - parseStartPosition); string fileHeader = changeInfo.TextSnapshot.GetText(0, parseStartPosition); I18n languageService = GetLanguageService(fileHeader); ScenarioEditorInfo firstUnchangedScenario; var partialResult = DoParsePartial(fileContent, languageService, firstAffectedScenario.StartLine, out firstUnchangedScenario, changeInfo.TextSnapshot, gherkinFileEditorInfo, changeInfo.ChangeLastLine, changeInfo.LineCountDelta); if (partialResult.HeaderClassificationSpans.Any()) { //TODO: merge to the prev scenario? partialResult.HeaderClassificationSpans.Clear(); } partialResult.HeaderClassificationSpans.AddRange( gherkinFileEditorInfo.HeaderClassificationSpans .Select(cs => cs.Shift(changeInfo.TextSnapshot, 0))); // inserting the non-affected scenarios partialResult.ScenarioEditorInfos.InsertRange(0, gherkinFileEditorInfo.ScenarioEditorInfos.TakeUntilItemExclusive(firstAffectedScenario) .Select(senario => senario.Shift(changeInfo.TextSnapshot, 0, 0))); ScenarioEditorInfo firstUnchangedScenarioShifted = null; if (firstUnchangedScenario != null) { // inserting the non-effected scenarios at the end int firstNewScenarioIndex = partialResult.ScenarioEditorInfos.Count; partialResult.ScenarioEditorInfos.AddRange( gherkinFileEditorInfo.ScenarioEditorInfos.SkipFromItemInclusive(firstUnchangedScenario) .Select( scenario => scenario.Shift(changeInfo.TextSnapshot, changeInfo.LineCountDelta, changeInfo.PositionDelta))); firstUnchangedScenarioShifted = partialResult.ScenarioEditorInfos.Count > firstNewScenarioIndex ? partialResult.ScenarioEditorInfos[firstNewScenarioIndex] : null; } TriggerChanges(partialResult, changeInfo, firstAffectedScenario, firstUnchangedScenarioShifted); stopwatch.Stop(); TraceFinishParse(stopwatch, "incremental"); }
private void TriggerChanges(GherkinFileEditorInfo gherkinFileEditorInfo, ChangeInfo changeInfo, ScenarioEditorInfo firstAffectedScenario = null, ScenarioEditorInfo firstUnchangedScenario = null) { this.GherkinFileEditorInfo = gherkinFileEditorInfo; var textSnapshot = changeInfo.TextSnapshot; int startPosition = 0; if (firstAffectedScenario != null) startPosition = textSnapshot.GetLineFromLineNumber(firstAffectedScenario.StartLine).Start; int endPosition = textSnapshot.Length; if (firstUnchangedScenario != null) endPosition = textSnapshot.GetLineFromLineNumber(firstUnchangedScenario.StartLine).Start; var snapshotSpan = new SnapshotSpan(textSnapshot, startPosition, endPosition - startPosition); if (ClassificationChanged != null) { ClassificationChanged(this, new ClassificationChangedEventArgs(snapshotSpan)); } if (TagsChanged != null) { TagsChanged(this, new SnapshotSpanEventArgs(snapshotSpan)); } }
/// <summary> /// Updates changes /// </summary> /// <param name="changesToUpdate"></param> public void UpdateChanges(ChangeInfo[] changesToUpdate) { //Combine result file name resultFileName = name + Guid.NewGuid() + "." + _target.Extention; var resultFile = Path.Combine(_settings.RootStoragePath, resultFileName); //Updete changes comparison.UpdateChanges(changesToUpdate, resultFile); }
private void ParseAndTriggerChanges(GherkinFileEditorInfo gherkinFileEditorInfo, ChangeInfo changeInfo) { if (gherkinFileEditorInfo == null) { // initial parsing FullParse(changeInfo); return; } if (partialParseCount >= PartialParseCountLimit) { visualStudioTracer.Trace("Forced full parse after " + partialParseCount + " incremental parse", ParserTraceCategory); FullParse(changeInfo); return; } // incremental parsing var firstAffectedScenario = gherkinFileEditorInfo.ScenarioEditorInfos.LastOrDefault( s => s.StartLine <= changeInfo.ChangeFirstLine); if (firstAffectedScenario == null) { // We would not need to do a full parse when the header chenges, but it would // be too complicated to bring this case through the logic now. // So the side-effect is that we do a full parse when the header changes instead of an incremental. FullParse(changeInfo); return; } PartialParse(gherkinFileEditorInfo, changeInfo, firstAffectedScenario); }
private bool endChangeAnimationIfNecessary(ChangeInfo changeInfo, RecyclerView.ViewHolder item) { bool oldItem = false; if (changeInfo.newHolder == item) { changeInfo.newHolder = null; } else if (changeInfo.oldHolder == item) { changeInfo.oldHolder = null; oldItem = true; } else { return false; } ViewCompat.setAlpha(item.itemView, 1); ViewCompat.setTranslationX(item.itemView, 0); ViewCompat.setTranslationY(item.itemView, 0); dispatchChangeFinished(item, oldItem); return true; }
private void BufferChanged(object sender, TextContentChangedEventArgs e) { bool isIdleTime = idleHandler.IsIdleTime(); idleHandler.SetIdleTime(); if (parsingTask == null || (parsingTask.IsCompleted && isIdleTime)) { // no parsing in progress -> we start parsing ChangeInfo changeInfo = new ChangeInfo(e); parsingTask = parsingTaskFactory.StartNew(() => ParseAndTriggerChanges(GherkinFileEditorInfo, changeInfo)); return; } // the pendingChangeInfo is a shared resource, we need to protect any read/write lock (pendingChangeInfoSynchRoot) { if (pendingChangeInfo == null) { // parsing in progress, no pending request -> we queue up a pending request pendingChangeInfo = new ChangeInfo(e); parsingTask = parsingTask .ContinueWith(prevTask => { idleHandler.WaitForIdle(); ParseAndTriggerChanges(GherkinFileEditorInfo, ConsumePendingChangeInfo()); }); } else { // there is already a pending request -> we merge our new request into it pendingChangeInfo = pendingChangeInfo.Merge(e); } } }
public static void UpdateChanges(ChangeInfo[] changes) { //Update changes helper.UpdateChanges(changes); }
private void FullParse(ChangeInfo changeInfo) { visualStudioTracer.Trace("Start full parsing", ParserTraceCategory); Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); partialParseCount = 0; var result = DoFullParse(changeInfo.TextSnapshot); TriggerChanges(result, changeInfo); stopwatch.Stop(); TraceFinishParse(stopwatch, "full"); }
/// <summary> /// Pull the workitem numbers out of the change comments. /// </summary> /// <param name="change">The CCNet change record.</param> /// <returns>A collection of affected PrimaryWorkitems.</returns> private IEnumerable<PrimaryWorkitem> DetermineWorkitems(ChangeInfo change) { List<PrimaryWorkitem> result = new List<PrimaryWorkitem>(); if(!string.IsNullOrEmpty(ReferenceExpression) && !string.IsNullOrEmpty(ReferenceField)) { Regex expression = new Regex(ReferenceExpression); foreach(Match match in expression.Matches(change.Comment)) result.AddRange(ResolveReference(match.Value)); } else { Trace("Either referenceexpression ({0}) or referencefield ({1}) not set in config file.", ReferenceExpression, ReferenceField); } return result; }
/// <summary> /// @brief /// </summary> /// <param name="changeInfo"> </param> /// <param name="holder"> </param> /// <param name="newHolder"> </param> //JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET: //ORIGINAL LINE: private void animateChangeDefault(final ChangeInfo changeInfo, final android.support.v7.widget.RecyclerView.ViewHolder holder, final android.support.v7.widget.RecyclerView.ViewHolder newHolder) private void animateChangeDefault(ChangeInfo changeInfo, RecyclerView.ViewHolder holder, RecyclerView.ViewHolder newHolder) { if (FcConstants.OPT_DETAILED_LOGS) { Log.d(TAG, "animateChangeDefault"); Log.d(TAG, " duration = " + ChangeDuration); Log.d(TAG, " changeInfo: " + changeInfo); Log.d(TAG, " old = " + holder); Log.d(TAG, " new = " + newHolder); } //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final android.view.View oldView = holder == null ? null : holder.itemView; View oldView = holder == null ? null : holder.itemView; //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final android.view.View newView = newHolder != null ? newHolder.itemView : null; View newView = newHolder != null ? newHolder.itemView : null; //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final boolean hasNoTranslations = changeInfo.hasNoTranslation(); bool hasNoTranslations = changeInfo.hasNoTranslation(); if (FcConstants.OPT_DETAILED_LOGS) { Log.d(TAG, " old view = " + oldView); Log.d(TAG, " new view = " + newView); Log.d(TAG, " has no translations = " + hasNoTranslations); } if (oldView != null) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final android.animation.AnimatorSet animator = new android.animation.AnimatorSet(); AnimatorSet animator = new AnimatorSet(); if (hasNoTranslations) { animator.Duration = 0; } else { animator.Duration = ChangeDuration; } // acquireUserScrolling(); animator.playSequentially(ObjectAnimator.ofFloat(oldView, View.TRANSLATION_X, changeInfo.toX - changeInfo.fromX), ObjectAnimator.ofFloat(oldView, View.TRANSLATION_Y, changeInfo.toY - changeInfo.fromY)); animator.addListener(new FcAnimatorListenerAnonymousInnerClassHelper4(this, holder, oldView, newView, animator)); mRunningAnimators[holder] = animator; animator.start(); } if (newView != null) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final android.animation.AnimatorSet animator = new android.animation.AnimatorSet(); AnimatorSet animator = new AnimatorSet(); if (hasNoTranslations) { animator.Duration = 0; } else { animator.Duration = ChangeDuration; } acquireUserScrolling(); animator.playTogether(ObjectAnimator.ofFloat(newView, View.TRANSLATION_X, 0), ObjectAnimator.ofFloat(newView, View.TRANSLATION_Y, 0)); animator.addListener(new FcAnimatorListenerAnonymousInnerClassHelper5(this, newHolder, oldView, newView, animator)); mRunningAnimators[newHolder] = animator; animator.start(); } }