当前位置: 首页>>代码示例>>C#>>正文


C# NGit.ProgressMonitor类代码示例

本文整理汇总了C#中NGit.ProgressMonitor的典型用法代码示例。如果您正苦于以下问题:C# ProgressMonitor类的具体用法?C# ProgressMonitor怎么用?C# ProgressMonitor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ProgressMonitor类属于NGit命名空间,在下文中一共展示了ProgressMonitor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ProgressReportingFilter

			public ProgressReportingFilter(ProgressMonitor monitor, int total)
			{
				this.monitor = monitor;
				this.total = total;
				stepSize = total / 100;
				if (stepSize == 0)
				{
					stepSize = 1000;
				}
			}
开发者ID:raufbutt,项目名称:monodevelop-old,代码行数:10,代码来源:IndexDiff.cs

示例2: ProgressReportingFilter

			public ProgressReportingFilter(IndexDiff _enclosing, ProgressMonitor monitor, int
				 total)
			{
				this._enclosing = _enclosing;
				this.monitor = monitor;
				this.total = total;
				this.stepSize = total / 100;
				if (this.stepSize == 0)
				{
					this.stepSize = 1000;
				}
			}
开发者ID:stewartwhaley,项目名称:monodevelop,代码行数:12,代码来源:IndexDiff.cs

示例3: BaseSearch

		internal BaseSearch(ProgressMonitor countingMonitor, ICollection<RevTree> bases, 
			ObjectIdOwnerMap<ObjectToPack> objects, IList<ObjectToPack> edges, ObjectReader 
			or)
		{
			progress = countingMonitor;
			reader = or;
			baseTrees = Sharpen.Collections.ToArray(bases, new ObjectId[bases.Count]);
			objectsMap = objects;
			edgeObjects = edges;
			alreadyProcessed = new IntSet();
			treeCache = new ObjectIdOwnerMap<BaseSearch.TreeWithData>();
			parser = new CanonicalTreeParser();
			idBuf = new MutableObjectId();
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:14,代码来源:BaseSearch.cs

示例4: WriteFile

		/// <summary>Open a remote file for writing.</summary>
		/// <remarks>
		/// Open a remote file for writing.
		/// <p>
		/// Path may start with <code>../</code> to request writing of a file that
		/// resides in the repository itself.
		/// <p>
		/// The requested path may or may not exist. If the path already exists as a
		/// file the file should be truncated and completely replaced.
		/// <p>
		/// This method creates any missing parent directories, if necessary.
		/// </remarks>
		/// <param name="path">
		/// name of the file to write, relative to the current object
		/// database.
		/// </param>
		/// <returns>
		/// stream to write into this file. Caller must close the stream to
		/// complete the write request. The stream is not buffered and each
		/// write may cause a network request/response so callers should
		/// buffer to smooth out small writes.
		/// </returns>
		/// <param name="monitor">
		/// (optional) progress monitor to post write completion to during
		/// the stream's close method.
		/// </param>
		/// <param name="monitorTask">(optional) task name to display during the close method.
		/// 	</param>
		/// <exception cref="System.IO.IOException">
		/// writing is not supported, or attempting to write the file
		/// failed, possibly due to permissions or remote disk full, etc.
		/// </exception>
		internal virtual OutputStream WriteFile(string path, ProgressMonitor monitor, string
			 monitorTask)
		{
			throw new IOException(MessageFormat.Format(JGitText.Get().writingNotSupported, path
				));
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:38,代码来源:WalkRemoteObjectDatabase.cs

示例5: Search

        /// <exception cref="System.IO.IOException"></exception>
        internal virtual void Search(ProgressMonitor monitor, ObjectToPack[] toSearch, int
			 off, int cnt)
        {
            try
            {
                for (int end = off + cnt; off < end; off++)
                {
                    res = window[resSlot];
                    if (0 < maxMemory)
                    {
                        Clear(res);
                        int tail = Next(resSlot);
                        long need = EstimateSize(toSearch[off]);
                        while (maxMemory < loaded + need && tail != resSlot)
                        {
                            Clear(window[tail]);
                            tail = Next(tail);
                        }
                    }
                    res.Set(toSearch[off]);
                    if ([email protected]())
                    {
                        // We don't actually want to make a delta for
                        // them, just need to push them into the window
                        // so they can be read by other objects.
                        //
                        KeepInWindow();
                    }
                    else
                    {
                        // Search for a delta for the current window slot.
                        //
                        monitor.Update(1);
                        Search();
                    }
                }
            }
            finally
            {
                if (deflater != null)
                {
                    deflater.Finish();
                }
            }
        }
开发者ID:sharwell,项目名称:ngit,代码行数:46,代码来源:DeltaWindow.cs

示例6: ResolveDeltas

		/// <exception cref="System.IO.IOException"></exception>
		private void ResolveDeltas(PackParser.DeltaVisit visit, int type, PackParser.ObjectTypeAndSize
			 info, ProgressMonitor progress)
		{
			do
			{
				progress.Update(1);
				info = OpenDatabase(visit.delta, info);
				switch (info.type)
				{
					case Constants.OBJ_OFS_DELTA:
					case Constants.OBJ_REF_DELTA:
					{
						break;
					}

					default:
					{
						throw new IOException(MessageFormat.Format(JGitText.Get().unknownObjectType, Sharpen.Extensions.ValueOf
							(info.type)));
					}
				}
				byte[] delta = InflateAndReturn(PackParser.Source.DATABASE, info.size);
				CheckIfTooLarge(type, BinaryDelta.GetResultSize(delta));
				visit.data = BinaryDelta.Apply(visit.parent.data, delta);
				delta = null;
				if (!CheckCRC(visit.delta.crc))
				{
					throw new IOException(MessageFormat.Format(JGitText.Get().corruptionDetectedReReadingAt
						, Sharpen.Extensions.ValueOf(visit.delta.position)));
				}
				objectDigest.Update(Constants.EncodedTypeString(type));
				objectDigest.Update(unchecked((byte)' '));
				objectDigest.Update(Constants.EncodeASCII(visit.data.Length));
				objectDigest.Update(unchecked((byte)0));
				objectDigest.Update(visit.data);
				tempObjectId.FromRaw(objectDigest.Digest(), 0);
				VerifySafeObject(tempObjectId, type, visit.data);
				PackedObjectInfo oe;
				oe = NewInfo(tempObjectId, visit.delta, visit.parent.id);
				oe.SetOffset(visit.delta.position);
				OnInflatedObjectData(oe, type, visit.data);
				AddObjectAndTrack(oe);
				visit.id = oe;
				visit.nextChild = FirstChildOf(oe);
				visit = visit.Next();
			}
			while (visit != null);
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:49,代码来源:PackParser.cs

示例7: Parse

		/// <summary>Parse the pack stream.</summary>
		/// <remarks>Parse the pack stream.</remarks>
		/// <param name="progress">
		/// callback to provide progress feedback during parsing. If null,
		/// <see cref="NGit.NullProgressMonitor">NGit.NullProgressMonitor</see>
		/// will be used.
		/// </param>
		/// <returns>
		/// the pack lock, if one was requested by setting
		/// <see cref="SetLockMessage(string)">SetLockMessage(string)</see>
		/// .
		/// </returns>
		/// <exception cref="System.IO.IOException">the stream is malformed, or contains corrupt objects.
		/// 	</exception>
		public PackLock Parse(ProgressMonitor progress)
		{
			return Parse(progress, progress);
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:18,代码来源:PackParser.cs

示例8: Fetch

        /// <summary>Fetch objects and refs from the remote repository to the local one.</summary>
        /// <remarks>
        /// Fetch objects and refs from the remote repository to the local one.
        /// <p>
        /// This is a utility function providing standard fetch behavior. Local
        /// tracking refs associated with the remote repository are automatically
        /// updated if this transport was created from a
        /// <see cref="RemoteConfig">RemoteConfig</see>
        /// with
        /// fetch RefSpecs defined.
        /// </remarks>
        /// <param name="monitor">
        /// progress monitor to inform the user about our processing
        /// activity. Must not be null. Use
        /// <see cref="NGit.NullProgressMonitor">NGit.NullProgressMonitor</see>
        /// if
        /// progress updates are not interesting or necessary.
        /// </param>
        /// <param name="toFetch">
        /// specification of refs to fetch locally. May be null or the
        /// empty collection to use the specifications from the
        /// RemoteConfig. Source for each RefSpec can't be null.
        /// </param>
        /// <returns>information describing the tracking refs updated.</returns>
        /// <exception cref="System.NotSupportedException">
        /// this transport implementation does not support fetching
        /// objects.
        /// </exception>
        /// <exception cref="NGit.Errors.TransportException">
        /// the remote connection could not be established or object
        /// copying (if necessary) failed or update specification was
        /// incorrect.
        /// </exception>
        public virtual FetchResult Fetch(ProgressMonitor monitor, ICollection<RefSpec> toFetch
			)
        {
            if (toFetch == null || toFetch.IsEmpty())
            {
                // If the caller did not ask for anything use the defaults.
                //
                if (fetch.IsEmpty())
                {
                    throw new TransportException(JGitText.Get().nothingToFetch);
                }
                toFetch = fetch;
            }
            else
            {
                if (!fetch.IsEmpty())
                {
                    // If the caller asked for something specific without giving
                    // us the local tracking branch see if we can update any of
                    // the local tracking branches without incurring additional
                    // object transfer overheads.
                    //
                    ICollection<RefSpec> tmp = new AList<RefSpec>(toFetch);
                    foreach (RefSpec requested in toFetch)
                    {
                        string reqSrc = requested.GetSource();
                        foreach (RefSpec configured in fetch)
                        {
                            string cfgSrc = configured.GetSource();
                            string cfgDst = configured.GetDestination();
                            if (cfgSrc.Equals(reqSrc) && cfgDst != null)
                            {
                                tmp.AddItem(configured);
                                break;
                            }
                        }
                    }
                    toFetch = tmp;
                }
            }
            FetchResult result = new FetchResult();
            new FetchProcess(this, toFetch).Execute(monitor, result);
            return result;
        }
开发者ID:kenji-tan,项目名称:ngit,代码行数:77,代码来源:Transport.cs

示例9: DoFetch

		/// <exception cref="NGit.Errors.TransportException"></exception>
		protected internal override void DoFetch(ProgressMonitor monitor, ICollection<Ref
			> want, ICollection<ObjectId> have)
		{
			MarkLocalRefsComplete(have);
			QueueWants(want);
			while (!monitor.IsCancelled() && !workQueue.IsEmpty())
			{
				ObjectId id = workQueue.RemoveFirst();
				if (!(id is RevObject) || !((RevObject)id).Has(COMPLETE))
				{
					DownloadObject(monitor, id);
				}
				Process(id);
			}
		}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:16,代码来源:WalkFetchConnection.cs

示例10: DownloadPack

			/// <exception cref="System.IO.IOException"></exception>
			internal virtual void DownloadPack(ProgressMonitor monitor)
			{
				string name = "pack/" + this.packName;
				WalkRemoteObjectDatabase.FileStream s = this.connection.Open(name);
				PackParser parser = this._enclosing.inserter.NewPackParser([email protected]);
				parser.SetAllowThin(false);
				parser.SetObjectChecker(this._enclosing.objCheck);
				parser.SetLockMessage(this._enclosing.lockMessage);
				PackLock Lock = parser.Parse(monitor);
				if (Lock != null)
				{
					this._enclosing.packLocks.AddItem(Lock);
				}
				this._enclosing.inserter.Flush();
			}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:16,代码来源:WalkFetchConnection.cs

示例11: OpenIndex

			/// <exception cref="System.IO.IOException"></exception>
			internal virtual void OpenIndex(ProgressMonitor pm)
			{
				if (this.index != null)
				{
					return;
				}
				if (this.tmpIdx == null)
				{
					this.tmpIdx = FilePath.CreateTempFile("jgit-walk-", ".idx");
				}
				else
				{
					if (this.tmpIdx.IsFile())
					{
						try
						{
							this.index = PackIndex.Open(this.tmpIdx);
							return;
						}
						catch (FileNotFoundException)
						{
						}
					}
				}
				// Fall through and get the file.
				WalkRemoteObjectDatabase.FileStream s;
				s = this.connection.Open("pack/" + this.idxName);
				pm.BeginTask("Get " + Sharpen.Runtime.Substring(this.idxName, 0, 12) + "..idx", s
					.length < 0 ? ProgressMonitor.UNKNOWN : (int)(s.length / 1024));
				try
				{
					FileOutputStream fos = new FileOutputStream(this.tmpIdx);
					try
					{
						byte[] buf = new byte[2048];
						int cnt;
						while (!pm.IsCancelled() && (cnt = [email protected](buf)) >= 0)
						{
							fos.Write(buf, 0, cnt);
							pm.Update(cnt / 1024);
						}
					}
					finally
					{
						fos.Close();
					}
				}
				catch (IOException err)
				{
					FileUtils.Delete(this.tmpIdx);
					throw;
				}
				finally
				{
					[email protected]();
				}
				pm.EndTask();
				if (pm.IsCancelled())
				{
					FileUtils.Delete(this.tmpIdx);
					return;
				}
				try
				{
					this.index = PackIndex.Open(this.tmpIdx);
				}
				catch (IOException e)
				{
					FileUtils.Delete(this.tmpIdx);
					throw;
				}
			}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:73,代码来源:WalkFetchConnection.cs

示例12: WriteFile

			/// <exception cref="System.IO.IOException"></exception>
			internal override OutputStream WriteFile(string path, ProgressMonitor monitor, string
				 monitorTask)
			{
				return this._enclosing.s3.BeginPut(this._enclosing.bucket, this.ResolveKey(path), 
					monitor, monitorTask);
			}
开发者ID:nickname100,项目名称:monodevelop,代码行数:7,代码来源:TransportAmazonS3.cs

示例13: ResolveDeltas

		// By default there is no locking.
		/// <exception cref="System.IO.IOException"></exception>
		private void ResolveDeltas(ProgressMonitor progress)
		{
			progress.BeginTask(JGitText.Get().resolvingDeltas, deltaCount);
			int last = entryCount;
			for (int i = 0; i < last; i++)
			{
				int before = entryCount;
				ResolveDeltas(entries[i]);
				progress.Update(entryCount - before);
				if (progress.IsCancelled())
				{
					throw new IOException(JGitText.Get().downloadCancelledDuringIndexing);
				}
			}
			progress.EndTask();
		}
开发者ID:raufbutt,项目名称:monodevelop-old,代码行数:18,代码来源:PackParser.cs

示例14: SideBandInputStream

		internal SideBandInputStream(InputStream @in, ProgressMonitor progress, TextWriter
			 messageStream)
		{
			rawIn = @in;
			pckIn = new PacketLineIn(rawIn);
			monitor = progress;
			messages = messageStream;
			currentTask = string.Empty;
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:9,代码来源:SideBandInputStream.cs

示例15: Push

			// nothing here
			/// <exception cref="NGit.Errors.TransportException"></exception>
			public virtual void Push(ProgressMonitor monitor, IDictionary<string, RemoteRefUpdate
				> refsToUpdate)
			{
				foreach (RemoteRefUpdate rru in refsToUpdate.Values)
				{
					NUnit.Framework.Assert.AreEqual(RemoteRefUpdate.Status.NOT_ATTEMPTED, rru.GetStatus
						());
					rru.SetStatus(this._enclosing.connectionUpdateStatus);
				}
			}
开发者ID:shoff,项目名称:ngit,代码行数:12,代码来源:PushProcessTest.cs


注:本文中的NGit.ProgressMonitor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。