本文整理汇总了C#中Modification类的典型用法代码示例。如果您正苦于以下问题:C# Modification类的具体用法?C# Modification怎么用?C# Modification使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Modification类属于命名空间,在下文中一共展示了Modification类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetModifications
/// <summary>
/// Gets the modifications from the source control provider
/// </summary>
/// <param name="from"></param>
/// <param name="to"></param>
/// <returns></returns>
public Modification[] GetModifications(IIntegrationResult from, IIntegrationResult to)
{
if (FailGetModifications)
{
throw new System.Exception("Failing GetModifications");
}
else if (AlwaysModified)
{
Modification[] mods = new Modification[1];
Modification mod = new Modification();
mod.FileName = "AlwaysModified";
mod.FolderName = "NullSourceControl";
mod.ModifiedTime = DateTime.Now;
mod.UserName = "JohnWayne";
mod.ChangeNumber = Guid.NewGuid().ToString("N");
mod.Comment = "Making a change";
mod.Type = "modified";
mods[0] = mod;
return mods;
}
else
{
return new Modification[0];
}
}
示例2: SetupModification
public void SetupModification(Modification[] modifications)
{
foreach (Modification mod in modifications)
{
mod.Url = String.Format(_url, mod.FolderName.Length == 0 ? mod.FileName : mod.FolderName + "/" + mod.FileName);
}
}
示例3: Parse
/// <summary>
/// Construct and return an array of Modifications describing the changes in
/// the AccuRev workspace, based on the output of the "accurev hist" command.
/// </summary>
/// <param name="history">the stream of <code><modifications></code> input</param>
/// <param name="from">the starting date and time for the range of modifications we want.</param>
/// <param name="to">the ending date and time for the range of modifications we want.</param>
/// <returns>the changes in the specified time range.</returns>
public Modification[] Parse(TextReader history, DateTime from, DateTime to)
{
XmlSerializer serializer = new XmlSerializer(typeof (Modification[]));
Modification[] mods = new Modification[0];
try
{
// return 0 modifications if "history" is empty.
if (history.Peek() == -1)
return mods;
mods = (Modification[]) serializer.Deserialize(history);
}
catch (InvalidOperationException e)
{
Log.Error(e);
if (e.InnerException is XmlException)
return mods;
throw;
}
var results = new List<Modification>();
foreach (Modification mod in mods)
{
if ((mod.ModifiedTime >= from) & (mod.ModifiedTime <= to))
results.Add(mod);
}
return results.ToArray();
}
示例4: SetupModification
public void SetupModification(Modification[] modifications)
{
foreach( Modification mod in modifications )
{
mod.Url = String.Format( _url, mod.FolderName + "/" + mod.FileName, mod.ChangeNumber );
}
}
示例5: Parse
/// <summary>
/// Parses the specified input.
/// </summary>
/// <param name="input">The input.</param>
/// <param name="from">From.</param>
/// <param name="to">To.</param>
/// <returns></returns>
/// <remarks></remarks>
public Modification[] Parse(TextReader input, DateTime from, DateTime to)
{
var mods = new List<Modification>();
var filemods = new List<string>();
string line;
while( (line = input.ReadLine()) != null )
{
if( !line.StartsWith(PlasticSCM.DELIMITER.ToString(CultureInfo.CurrentCulture)))
continue;
// path date user changeset
string[] data = line.Split(PlasticSCM.DELIMITER);
Modification mod = new Modification();
string path = data[1];
mod.FileName = Path.GetFileName(path);
mod.FolderName = Path.GetDirectoryName(path);
mod.UserName = data[2];
mod.ModifiedTime = DateTime.ParseExact (data[3], PlasticSCM.DATEFORMAT, CultureInfo.InvariantCulture);
mod.ChangeNumber = data[4];
if (!filemods.Contains(path))
{
filemods.Add(path);
mods.Add(mod);
}
}
return mods.ToArray();
}
示例6: ParseAddedFile
// To match this
// New File 2008/02/06 09:16:49 E:\copytest\src\file2.txt
Modification ParseAddedFile(
string logLine)
{
Match match = ParseAddedFileRegex.Match(logLine);
if (match.Success)
{
if (match.Groups.Count == 3)
{
string date = match.Groups["Date"].Captures[0].ToString();
string path = match.Groups["Path"].Captures[0].ToString();
Modification mod = new Modification();
mod.Type = "added";
mod.FileName = Path.GetFileName(path);
mod.FolderName = Path.GetDirectoryName(path);
mod.ModifiedTime = CreateDate(date);
return mod;
}
}
throw new Exception("Failed to match regex");
}
示例7: SetupModification
/// <summary>
/// Setups the modification.
/// </summary>
/// <param name="modifications">The modifications.</param>
/// <remarks></remarks>
public void SetupModification(Modification[] modifications)
{
foreach (Modification modification in modifications)
{
modification.Url = Url + "rev/" + modification.Version;
}
}
示例8: SetupModification
/// <summary>
/// Setups the modification.
/// </summary>
/// <param name="modifications">The modifications.</param>
/// <remarks></remarks>
public void SetupModification(Modification[] modifications)
{
foreach (IModificationUrlBuilder modificationUrlBuilder in _issueTrackers)
{
modificationUrlBuilder.SetupModification(modifications);
}
}
示例9: GetCommitModifications
/// <summary>
/// Parse a commit for modifications and returns a list with every modification in the date/time limits.
/// </summary>
/// <param name="commitMatch"></param>
/// <param name="from"></param>
/// <param name="to"></param>
/// <returns></returns>
private static IList<Modification> GetCommitModifications(Match commitMatch, DateTime from, DateTime to)
{
IList<Modification> result = new List<Modification>();
string hash = commitMatch.Groups["Hash"].Value;
DateTime modifiedTime = DateTime.Parse(commitMatch.Groups["Time"].Value);
string username = commitMatch.Groups["Author"].Value;
string emailAddress = commitMatch.Groups["Mail"].Value;
string comment = commitMatch.Groups["Message"].Value.TrimEnd('\r', '\n');
string changes = commitMatch.Groups["Changes"].Value;
if (modifiedTime < from || modifiedTime > to)
{
Log.Debug(string.Concat("[Git] Ignore commit '", hash, "' from '", modifiedTime.ToUniversalTime(),
"' because it is older then '",
from.ToUniversalTime(), "' or newer then '", to.ToUniversalTime(), "'."));
return result;
}
MatchCollection file_matches = changeList.Matches(changes);
if (file_matches.Count != 0)
{
foreach (Match change in file_matches)
{
Modification mod = new Modification();
mod.ChangeNumber = hash;
mod.Comment = comment;
mod.EmailAddress = emailAddress;
mod.ModifiedTime = modifiedTime;
mod.UserName = username;
mod.Type = GetModificationType(change.Groups["Type"].Value);
string fullFilePath = change.Groups["FileName"].Value.TrimEnd('\r', '\n');
mod.FileName = GetFileFromPath(fullFilePath);
mod.FolderName = GetFolderFromPath(fullFilePath);
result.Add(mod);
}
}
else
{
Modification mod = new Modification();
mod.ChangeNumber = hash;
mod.Comment = comment;
mod.EmailAddress = emailAddress;
mod.ModifiedTime = modifiedTime;
mod.UserName = username;
mod.Type = GetModificationType("m");
mod.FileName = "Specific commit. No file changes.";
mod.FolderName = "";
result.Add(mod);
}
return result;
}
示例10: firstModifiedTime
private DateTime firstModifiedTime(Modification[] modifications)
{
DateTime subResult = modifications[0].ModifiedTime;
foreach (Modification modification in modifications)
if (modification.ModifiedTime < subResult)
subResult = modification.ModifiedTime;
return subResult;
}
示例11: Accept
public bool Accept(Modification modification)
{
if (modification.FolderName == null || modification.FileName == null)
{
return false;
}
string path = Path.Combine(modification.FolderName, modification.FileName);
return PathUtils.MatchPath(Pattern, path, caseSensitive);
}
示例12: AnalyzeModifications
/// <summary>
/// Build the Modification list of what files will be built
/// with this Release
/// </summary>
/// <param name="mods"></param>
/// <returns></returns>
public static Modification[] AnalyzeModifications(IList mods)
{
// Hashtables are used so we can compare on the keys in search of duplicates
Hashtable allFiles = new Hashtable();
foreach (Modification mod in mods)
{
string key = mod.FolderName + mod.FileName;
if (!allFiles.ContainsKey(key))
allFiles.Add(key, mod);
else
{
// If the revision number on the original is larger, then
// do the comparision against the original modification
// in search to see which revision is higher
// example: 1.64.1 < 1.65 but you need to compare against the
// larger string of 1.64.1 because we are splitting the numbers individually
// so 1 is compared to 1 and 64 is compared to 65.
Modification compareMod = allFiles[key] as Modification;
string[] originalVersion = compareMod.Version.Split(char.Parse("."));
string[] currentVersion = mod.Version.Split(char.Parse("."));
int len1 = originalVersion.Length;
int len2 = currentVersion.Length;
int usingLen = -1;
int otherLen = -1;
if (len1 >= len2)
{
usingLen = len1;
otherLen = len2;
}
else
{
usingLen = len2;
otherLen = len1;
}
for (int i = 0; i < usingLen; i++)
{
if (i > otherLen)
continue;
if (Convert.ToInt32(currentVersion[i]) > Convert.ToInt32(originalVersion[i]))
{
allFiles[compareMod.FolderName + compareMod.FileName] = mod;
break;
}
}
}
}
// Convert the Hashtables to Modification arrays
Modification[] validMods = new Modification[allFiles.Count];
int count = 0;
foreach (string key in allFiles.Keys)
{
validMods[count++] = allFiles[key] as Modification;
}
return validMods;
}
示例13: LastModificationDate
public void LastModificationDate()
{
Modification earlierModification = new Modification();
earlierModification.ModifiedTime = new DateTime(0);
Modification laterModification = new Modification();
laterModification.ModifiedTime = new DateTime(1);
result.Modifications = new Modification[] { earlierModification, laterModification };
Assert.AreEqual(laterModification.ModifiedTime, result.LastModificationDate);
}
示例14: SendMessageToModifiersWhoCheckedInTheFiles
public void SendMessageToModifiersWhoCheckedInTheFiles(Modification[] modifications, String Message)
{
foreach (Modification modification in modifications)
{
YahooUser yuser = GetYahooUser(modification.UserName);
if (yuser!=null)
{
YahooWrap.SendYahooMessage(yuser.ID, Message);
}
}
}
示例15: AssignModificationTime
public void AssignModificationTime( Modification modification, string time )
{
try
{
modification.ModifiedTime = DateTime.Parse( time );
}
catch ( FormatException )
{
modification.ModifiedTime = DateTime.MinValue;
}
}