當前位置: 首頁>>代碼示例>>C#>>正文


C# Modification.ToString方法代碼示例

本文整理匯總了C#中ThoughtWorks.CruiseControl.Core.Modification.ToString方法的典型用法代碼示例。如果您正苦於以下問題:C# Modification.ToString方法的具體用法?C# Modification.ToString怎麽用?C# Modification.ToString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ThoughtWorks.CruiseControl.Core.Modification的用法示例。


在下文中一共展示了Modification.ToString方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: toModifcations

        /// <summary>
        ///   Convert the passed changeset to an array of modifcations.
        /// </summary>
        private Modification[] toModifcations(Changeset changeset)
        {
            List<Modification> modifications = new List<Modification>();

            string userName = changeset.Committer;
            string comment = changeset.Comment;
            int changeNumber = changeset.ChangesetId;
            // In VSTS, the version of the file is the same as the changeset number it was checked in with.
            string version = Convert.ToString(changeNumber);

            DateTime modifedTime = this.TFS.TimeZone.ToLocalTime(changeset.CreationDate);

            foreach (Change change in changeset.Changes)
            {
                Modification modification = new Modification();
                modification.UserName = userName;
                modification.Comment = comment;
                modification.ChangeNumber = changeNumber;
                modification.ModifiedTime = modifedTime;
                modification.Version = version;
                modification.Type = PendingChange.GetLocalizedStringForChangeType(change.ChangeType);

                // Populate fields from change item
                Item item = change.Item;
                if (item.ItemType == ItemType.File)
                {
                    // split into foldername and filename
                    int lastSlash = item.ServerItem.LastIndexOf('/');
                    modification.FileName = item.ServerItem.Substring(lastSlash + 1);
                    // patch to the following line submitted by Ralf Kretzschmar.
                    modification.FolderName = item.ServerItem.Substring(0, lastSlash);
                }
                else
                {
                    // TODO - what should filename be if dir??  Empty string or null?
                    modification.FileName = string.Empty;
                    modification.FolderName = item.ServerItem;
                }
                Log.Debug(modification.ToString());
                modifications.Add(modification);
            }

            return modifications.ToArray();
        }
開發者ID:vardars,項目名稱:ci-factory,代碼行數:47,代碼來源:VSTSByChangeSetSourceControl.cs


注:本文中的ThoughtWorks.CruiseControl.Core.Modification.ToString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。