Exemplo n.º 1
0
		string IEditServiceProxy.GetTextForTopic(LocalTopic topic)
		{
			AbsoluteTopicName atn = new AbsoluteTopicName(); 
			atn.Namespace = topic.Namespace.Name; 
			atn.Name = topic.Name; 
			return base.GetTextForTopic(atn); 
		}
Exemplo n.º 2
0
		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(); 

		}
Exemplo n.º 3
0
 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; 
 }
Exemplo n.º 4
0
 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; 
 }
Exemplo n.º 5
0
			public override void Insert(int pos, LocalTopic x)
			{
				rwLock.AcquireWriterLock(timeout);

				try
				{
					collection.Insert(pos,x);
				}
				finally
				{
					rwLock.ReleaseWriterLock();
				}
			}
Exemplo n.º 6
0
			public override int AddRange(LocalTopic[] x)
			{
				throw new NotSupportedException("This is a Read Only Collection and can not be modified");
			}
Exemplo n.º 7
0
			public override int IndexOf(LocalTopic x)
			{
				int result = 0;
				rwLock.AcquireReaderLock(timeout);

				try
				{
					result = collection.IndexOf(x);
				}
				finally
				{
					rwLock.ReleaseReaderLock();
				}

				return result;
			}
Exemplo n.º 8
0
			public override bool Contains(LocalTopic x)
			{
				return m_collection.Contains(x);
			}
Exemplo n.º 9
0
 public ProgressEventArgs(EventType eventType, LocalTopic topic) :
   this(eventType, topic.Namespace, topic, Status.NoLocalFile, Status.NoLocalFile)
 {
 }
Exemplo n.º 10
0
			public override void CopyTo(LocalTopic[] array)
			{
				m_collection.CopyTo(array);
			}
Exemplo n.º 11
0
		public string GetTextForTopic(LocalTopic topic)
		{
      Hashtable t  = GetTopic(topic.Namespace.Name, topic.Name); 

			if (t != null)
			{
				return t[topic.RepositoryVersion] as string;
			}
			
			return null; 
		}
Exemplo n.º 12
0
		/// <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;
		}
Exemplo n.º 13
0
		/// <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++;
		}
Exemplo n.º 14
0
		/// <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++;
		}
Exemplo n.º 15
0
		/// <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;
		}
Exemplo n.º 16
0
		/// <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); 
		}
Exemplo n.º 17
0
		/// <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);
		}
Exemplo n.º 18
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);
		}
Exemplo n.º 19
0
			public override void Remove(LocalTopic x)
			{           
				rwLock.AcquireWriterLock(timeout);

				try
				{
					collection.Remove(x);
				}
				finally
				{
					rwLock.ReleaseWriterLock();
				}
			}
Exemplo n.º 20
0
		/// <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);
		}
Exemplo n.º 21
0
			public override int AddRange(LocalTopic[] x)
			{
				int result = 0;
				rwLock.AcquireWriterLock(timeout);

				try
				{
					result = collection.AddRange(x);
				}
				finally
				{
					rwLock.ReleaseWriterLock();
				}

				return result;
			}
Exemplo n.º 22
0
		/// <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++;
		}
Exemplo n.º 23
0
			public override void CopyTo(LocalTopic[] array, int start)
			{
				m_collection.CopyTo(array,start);
			}
Exemplo n.º 24
0
		public LocalTopic AddTopic(string name, string version, string basedOnVersion)
		{
			LocalTopic lt = new LocalTopic(this, name, version, basedOnVersion);
			topics.Add(lt); 
			return lt; 
		}
Exemplo n.º 25
0
			public override int IndexOf(LocalTopic x)
			{
				return m_collection.IndexOf(x);
			}
Exemplo n.º 26
0
			public override void CopyTo(LocalTopic[] array, int start)
			{
				rwLock.AcquireReaderLock(timeout);

				try
				{
					collection.CopyTo(array, start);
				}
				finally
				{
					rwLock.ReleaseReaderLock();
				}
			}
Exemplo n.º 27
0
		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"); 

		}
Exemplo n.º 28
0
			public override bool Contains(LocalTopic x)
			{
				bool result = false;
				rwLock.AcquireReaderLock(timeout);

				try
				{
					result = collection.Contains(x);
				}
				finally
				{
					rwLock.ReleaseReaderLock();
				}

				return result;
			}
Exemplo n.º 29
0
		/// <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;
		}
Exemplo n.º 30
0
			public override void Remove(LocalTopic x)
			{           
				throw new NotSupportedException("This is a Read Only Collection and can not be modified");
			}