private void OnRevisionSelectionChangedEvent(RevisionEventArgs args)
 {
     // The reason this is handled on the view, rather than the model, is that the model and the view are not accessable to clients of HistoryPage,
     // so some klunkyness is required to get the newly selected Revision out to the client.
     // Autofac uses some factory methods and other 'magic' to put this subsytem together, and the preferred class that seems to be the right place for this,
     // isn't available for adding new subscribers.
     if (RevisionSelectionChanged != null)
     {
         RevisionSelectionChanged(this, args);
     }
 }
Пример #2
0
        /// <summary>
        /// Event raised when one revision has been read
        /// </summary>
        private static void RevisionComplete(object sender, RevisionEventArgs e)
        {
            if (currPage == null)
            {
                throw new InvalidOperationException("Unexpected revision outside of page");
            }

            Revision revision = e.Revision;
            UserData user     = FindUser(revision.Contributor);

            if (user == null)
            {
                throw new InvalidOperationException();
            }

            // ignore null edits
            if (previousUser != user || previousVersionText != revision.Text)
            {
                bool isRecentEdit = monthAgo.CompareTo(revision.Timestamp) <= 0;
                bool isNewPage    = previousUser == null;
                int  nsIndex;
                if (!namespaceMap.TryGetValue(currPage.Namespace, out nsIndex))
                {
                    Console.Error.WriteLine("\nERROR: Unknown namespace {0} in page '{1}' (ID = {2})", currPage.Namespace, currPage, currPage.Id);
                    return;
                }

                if (previousUser == null || !RepeatedEdit(user, previousUser, revision.Timestamp, lastTimestamp))
                {
                    // not a repeated edit by the same user
                    if (previousUser != null)
                    {
                        previousUser.EndOfEdit();
                    }

                    previousUser = user;
                }

                user.AddRevision(revision.Timestamp, currPage.Namespace, namespaceMap[currPage.Namespace], revision.Text.Length - previousVersionText.Length, revision.Comment.Length, revision.Minor, isRecentEdit, isNewPage);
            }

            previousVersionText = revision.Text;
            lastTimestamp       = revision.Timestamp;

            ++revisionCount;
            UpdateProgress(currPageTitle);
        }
Пример #3
0
		private void HistoryPageRevisionSelectionChanged(object sender, RevisionEventArgs e)
		{
			_currentRevision = e.Revision;
		}
Пример #4
0
 private void HandleRevisionSelectionChanged(object sender, RevisionEventArgs e)
 {
     if (RevisionSelectionChanged != null)
         RevisionSelectionChanged(this, e);
 }
Пример #5
0
 private void OnCommitCreated(object sender, RevisionEventArgs e)
 {
     RefreshContent();
 }
 private void HistoryPageRevisionSelectionChanged(object sender, RevisionEventArgs e)
 {
     _currentRevision = e.Revision;
 }
 private void OnRevisionSelectionChangedEvent(RevisionEventArgs args)
 {
     // The reason this is handled on the view, rather than the model, is that the model and the view are not accessable to clients of HistoryPage,
     // so some klunkyness is required to get the newly selected Revision out to the client.
     // Autofac uses some factory methods and other 'magic' to put this subsytem together, and the preferred class that seems to be the right place for this,
     // isn't available for adding new subscribers.
     if (RevisionSelectionChanged != null)
         RevisionSelectionChanged(this, args);
 }
Пример #8
0
 private void OnCommitCreated(object sender, RevisionEventArgs e)
 {
     RefreshContent();
 }
Пример #9
0
        /// <summary>
        /// Event raised when one revision has been read
        /// </summary>
        private void RevisionComplete(object sender, RevisionEventArgs e)
        {
            if (pageInfo == null)
            {
                throw new InvalidOperationException("Unexpected revision outside of page");
            }

            Revision revision = e.Revision;

            if (revision.Timestamp >= fromDate && revision.Timestamp <= toDate)
            {
                RevisionData thisRevision;
                if (revisions.Count == 0)
                {
                    // create the first revision
                    var lineInfo = new List <LineInfo>();
                    thisRevision = new RevisionData(1, revision.Text, revision.Contributor, revision.Id, revision.Timestamp, revision.Comment, revision.Minor, lineInfo);
                    foreach (string line in thisRevision.Lines)
                    {
                        lineInfo.Add(new LineInfo(line, thisRevision));
                    }
                }
                else
                {
                    // check if this is not a revert to a prior revision
                    RevisionData revertedToRev = FindRevisionData(revision.Text);

                    if (revertedToRev == null)
                    {
                        // not a revert
                        RevisionData previousRevision = revisions[revisions.Count - 1];

                        var lineInfo = new List <LineInfo>(previousRevision.LineInfo);
                        thisRevision = new RevisionData(revisions.Count + 1, revision.Text, revision.Contributor, revision.Id, revision.Timestamp, revision.Comment, revision.Minor, lineInfo);
                        revisionByText.Add(revision.Text, thisRevision);

                        ProcessDiff(previousRevision, thisRevision, lineInfo, previousRevision.IntData, thisRevision.IntData);

                        /*
                         * Diff.Item[] script = Diff.DiffInt(previousRevision.IntData, thisRevision.IntData);
                         *
                         * foreach (Edit edit in script)
                         * {
                         *  switch (edit.Type)
                         *  {
                         *      case EditType.Delete:
                         *          lineInfo.RemoveRange(edit.StartB, edit.Length);
                         *          break;
                         *      case EditType.Insert:
                         *          for (int i = 0; i < edit.Length; ++i)
                         *              lineInfo.Insert(edit.StartB + i, new LineInfo(thisRevision.Lines[edit.StartB + i], thisRevision));
                         *          break;
                         *      case EditType.Change:
                         *          for (int i = 0; i < edit.Length; ++i)
                         *              lineInfo[edit.StartB + i] = new LineInfo(thisRevision.Lines[edit.StartB + i], thisRevision);
                         *          break;
                         *  }
                         * }
                         */
                    }
                    else
                    {
                        // just a revert
                        thisRevision = revertedToRev;
                    }
                }

                // add this revision
                revisions.Add(thisRevision);

                ++revisionCount;
            }

            UpdateProgress(revision.Timestamp + "  ");
        }