string IEditServiceProxy.GetTextForTopic(LocalTopic topic) { AbsoluteTopicName atn = new AbsoluteTopicName(); atn.Namespace = topic.Namespace.Name; atn.Name = topic.Name; return base.GetTextForTopic(atn); }
public static void AppendToTopic(LocalTopic topic, string content) { FileStream fs = new FileStream(topic.Path, FileMode.Append, FileAccess.Write); StreamWriter sw = new StreamWriter(fs, System.Text.Encoding.ASCII); sw.WriteLine(); sw.WriteLine(content); sw.Close(); }
public ProgressEventArgs(EventType eventType, LocalNamespace ns, LocalTopic topic, Status oldStatus, Status newStatus) { this.eventType = eventType; this.ns = ns; this.topic = topic; this.oldStatus = oldStatus; this.newStatus = newStatus; }
public string ResolveConflict(LocalTopic topic, string remoteContents) { string result = null; if (resolveWith.Length > 0) { result = NormalMerge(topic, remoteContents, resolveWith); } else if (fwsMerge.Length > 0) { result = NormalMerge(topic, remoteContents, fwsMerge); } else { result = DefaultResolve(topic, remoteContents); } return result; }
public override void Insert(int pos, LocalTopic x) { rwLock.AcquireWriterLock(timeout); try { collection.Insert(pos,x); } finally { rwLock.ReleaseWriterLock(); } }
public override int AddRange(LocalTopic[] x) { throw new NotSupportedException("This is a Read Only Collection and can not be modified"); }
public override int IndexOf(LocalTopic x) { int result = 0; rwLock.AcquireReaderLock(timeout); try { result = collection.IndexOf(x); } finally { rwLock.ReleaseReaderLock(); } return result; }
public override bool Contains(LocalTopic x) { return m_collection.Contains(x); }
public ProgressEventArgs(EventType eventType, LocalTopic topic) : this(eventType, topic.Namespace, topic, Status.NoLocalFile, Status.NoLocalFile) { }
public override void CopyTo(LocalTopic[] array) { m_collection.CopyTo(array); }
public string GetTextForTopic(LocalTopic topic) { Hashtable t = GetTopic(topic.Namespace.Name, topic.Name); if (t != null) { return t[topic.RepositoryVersion] as string; } return null; }
/// <summary> /// Returns the zero-based index of the first occurrence of a <see cref="LocalTopic"/> /// in the <c>LocalTopicListBase</c>. /// </summary> /// <param name="item">The <see cref="LocalTopic"/> to locate in the <c>LocalTopicListBase</c>.</param> /// <returns> /// The zero-based index of the first occurrence of <paramref name="item"/> /// in the entire <c>LocalTopicListBase</c>, if found; otherwise, -1. /// </returns> public virtual int IndexOf(LocalTopic item) { for (int i=0; i != m_count; ++i) if (m_array[i].Equals(item)) return i; return -1; }
/// <summary> /// Inserts an element into the <c>LocalTopicListBase</c> at the specified index. /// </summary> /// <param name="index">The zero-based index at which <paramref name="item"/> should be inserted.</param> /// <param name="item">The <see cref="LocalTopic"/> to insert.</param> /// <exception cref="ArgumentOutOfRangeException"> /// <para><paramref name="index"/> is less than zero</para> /// <para>-or-</para> /// <para><paramref name="index"/> is equal to or greater than <see cref="LocalTopicListBase.Count"/>.</para> /// </exception> public virtual void Insert(int index, LocalTopic item) { ValidateIndex(index, true); // throws if (m_count == m_array.Length) EnsureCapacity(m_count + 1); if (index < m_count) { Array.Copy(m_array, index, m_array, index + 1, m_count - index); } m_array[index] = item; m_count++; m_version++; }
/// <summary> /// Adds a <see cref="LocalTopic"/> to the end of the <c>LocalTopicListBase</c>. /// </summary> /// <param name="item">The <see cref="LocalTopic"/> to be added to the end of the <c>LocalTopicListBase</c>.</param> /// <returns>The index at which the value has been added.</returns> public virtual int Add(LocalTopic item) { if (m_count == m_array.Length) EnsureCapacity(m_count + 1); m_array[m_count] = item; m_version++; return m_count++; }
/// <summary> /// Determines whether a given <see cref="LocalTopic"/> is in the <c>LocalTopicListBase</c>. /// </summary> /// <param name="item">The <see cref="LocalTopic"/> to check for.</param> /// <returns><c>true</c> if <paramref name="item"/> is found in the <c>LocalTopicListBase</c>; otherwise, <c>false</c>.</returns> public virtual bool Contains(LocalTopic item) { for (int i=0; i != m_count; ++i) if (m_array[i].Equals(item)) return true; return false; }
/// <summary> /// Copies the entire <c>LocalTopicListBase</c> to a one-dimensional /// <see cref="LocalTopic"/> array, starting at the specified index of the target array. /// </summary> /// <param name="array">The one-dimensional <see cref="LocalTopic"/> array to copy to.</param> /// <param name="start">The zero-based index in <paramref name="array"/> at which copying begins.</param> public virtual void CopyTo(LocalTopic[] array, int start) { if (m_count > array.GetUpperBound(0) + 1 - start) throw new System.ArgumentException("Destination array was not long enough."); Array.Copy(m_array, 0, array, start, m_count); }
/// <summary> /// Copies the entire <c>LocalTopicListBase</c> to a one-dimensional /// <see cref="LocalTopic"/> array. /// </summary> /// <param name="array">The one-dimensional <see cref="LocalTopic"/> array to copy to.</param> public virtual void CopyTo(LocalTopic[] array) { this.CopyTo(array, 0); }
/// <summary> /// Initializes a new instance of the <c>LocalTopicListBase</c> class /// that contains elements copied from the specified <see cref="LocalTopic"/> array. /// </summary> /// <param name="a">The <see cref="LocalTopic"/> array whose elements are copied to the new list.</param> public LocalTopicListBase(LocalTopic[] a) { m_array = new LocalTopic[a.Length]; AddRange(a); }
public override void Remove(LocalTopic x) { rwLock.AcquireWriterLock(timeout); try { collection.Remove(x); } finally { rwLock.ReleaseWriterLock(); } }
/// <summary> /// Removes the first occurrence of a specific <see cref="LocalTopic"/> from the <c>LocalTopicListBase</c>. /// </summary> /// <param name="item">The <see cref="LocalTopic"/> to remove from the <c>LocalTopicListBase</c>.</param> /// <exception cref="ArgumentException"> /// The specified <see cref="LocalTopic"/> was not found in the <c>LocalTopicListBase</c>. /// </exception> public virtual void Remove(LocalTopic item) { int i = IndexOf(item); if (i < 0) throw new System.ArgumentException("Cannot remove the specified item because it was not found in the specified Collection."); ++m_version; RemoveAt(i); }
public override int AddRange(LocalTopic[] x) { int result = 0; rwLock.AcquireWriterLock(timeout); try { result = collection.AddRange(x); } finally { rwLock.ReleaseWriterLock(); } return result; }
/// <summary> /// Removes the element at the specified index of the <c>LocalTopicListBase</c>. /// </summary> /// <param name="index">The zero-based index of the element to remove.</param> /// <exception cref="ArgumentOutOfRangeException"> /// <para><paramref name="index"/> is less than zero</para> /// <para>-or-</para> /// <para><paramref name="index"/> is equal to or greater than <see cref="LocalTopicListBase.Count"/>.</para> /// </exception> public virtual void RemoveAt(int index) { ValidateIndex(index); // throws m_count--; if (index < m_count) { Array.Copy(m_array, index + 1, m_array, index, m_count - index); } // We can't set the deleted entry equal to null, because it might be a value type. // Instead, we'll create an empty single-element array of the right type and copy it // over the entry we want to erase. LocalTopic[] temp = new LocalTopic[1]; Array.Copy(temp, 0, m_array, m_count, 1); m_version++; }
public override void CopyTo(LocalTopic[] array, int start) { m_collection.CopyTo(array,start); }
public LocalTopic AddTopic(string name, string version, string basedOnVersion) { LocalTopic lt = new LocalTopic(this, name, version, basedOnVersion); topics.Add(lt); return lt; }
public override int IndexOf(LocalTopic x) { return m_collection.IndexOf(x); }
public override void CopyTo(LocalTopic[] array, int start) { rwLock.AcquireReaderLock(timeout); try { collection.CopyTo(array, start); } finally { rwLock.ReleaseReaderLock(); } }
private void AssertCommittedTopic(LocalTopic topic) { Assert.IsNotNull(topic.RepositoryVersion, "Checking that there is a repository version now"); Assert.IsNotNull(topic.BasedOnRepositoryVersion, "Checking that there is a based-on version now"); Assert.AreEqual(topic.BasedOnRepositoryVersion, topic.RepositoryVersion, "Checking that repository version equals based on version"); Assert.AreEqual(topic.BasedOnChecksum, topic.Checksum, "Checking that local checksum equals based on checksum"); }
public override bool Contains(LocalTopic x) { bool result = false; rwLock.AcquireReaderLock(timeout); try { result = collection.Contains(x); } finally { rwLock.ReleaseReaderLock(); } return result; }
/// <summary> /// Adds the elements of a <see cref="LocalTopic"/> array to the current <c>LocalTopicListBase</c>. /// </summary> /// <param name="x">The <see cref="LocalTopic"/> array whose elements should be added to the end of the <c>LocalTopicListBase</c>.</param> /// <returns>The new <see cref="LocalTopicListBase.Count"/> of the <c>LocalTopicListBase</c>.</returns> public virtual int AddRange(LocalTopic[] x) { if (m_count + x.Length >= m_array.Length) EnsureCapacity(m_count + x.Length); Array.Copy(x, 0, m_array, m_count, x.Length); m_count += x.Length; m_version++; return m_count; }
public override void Remove(LocalTopic x) { throw new NotSupportedException("This is a Read Only Collection and can not be modified"); }