本文整理汇总了C#中SvnClient.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# SvnClient.Dispose方法的具体用法?C# SvnClient.Dispose怎么用?C# SvnClient.Dispose使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SvnClient
的用法示例。
在下文中一共展示了SvnClient.Dispose方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Execute
/// <summary>
/// Sets credentials for credentials, path and passes the control to the
/// implementing task.
/// </summary>
/// <returns></returns>
public override bool Execute()
{
SvnClient client = new SvnClient();
client.Authentication.Clear();
if (string.IsNullOrEmpty(Password))
{
client.Authentication.UserNameHandlers +=
delegate(object o, SvnUserNameEventArgs eventArgs)
{
eventArgs.UserName = Username;
};
}
else
{
client.Authentication.UserNamePasswordHandlers +=
delegate(object o, SvnUserNamePasswordEventArgs eventArgs)
{
eventArgs.UserName = Username;
eventArgs.Password = Password;
};
}
client.Authentication.AddSubversionFileHandlers();
client.Authentication.SslServerTrustHandlers += SslServerTrustHandlers;
client.Authentication.SslClientCertificateHandlers += SslClientCertificateHandlers;
try
{
return ExecuteCommand(client);
}
finally
{
client.Dispose();
}
}
示例2: GetLogs
//.........这里部分代码省略.........
datatable.Columns.Add("ChangedPaths", typeof(string));
datatable.Columns.Add("LogMessage", typeof(string));
try
{
System.Collections.ObjectModel.Collection<SvnLogEventArgs> logitems = new System.Collections.ObjectModel.Collection<SvnLogEventArgs>();
SvnLogArgs logargs = new SvnLogArgs(new SvnRevisionRange(current_revision, last_revision + 1));
client.GetLog(new Uri(repository_location), logargs, out logitems);
datatable.BeginLoadData();
foreach (SvnLogEventArgs logitem in logitems)
{
StringBuilder ChangedPaths = new StringBuilder();
if (logitem.ChangedPaths != null)
{
foreach (SvnChangeItem path in logitem.ChangedPaths)
{
ChangedPaths.AppendFormat("{1} {2}{0}", Environment.NewLine, path.Action, path.Path);
if (path.CopyFromRevision != -1)
{
ChangedPaths.AppendFormat("{1} -> {2}{0}", Environment.NewLine, path.CopyFromPath, path.CopyFromRevision);
}
}
}
DataRow datarow = datatable.NewRow();
datarow["Revision"] = logitem.Revision;
datarow["Author"] = logitem.Author;
datarow["Time"] = logitem.Time.ToLocalTime();
datarow["ChangedPaths"] = ChangedPaths.ToString();
datarow["LogMessage"] = logitem.LogMessage;
datatable.Rows.Add(datarow);
}
datatable.EndLoadData();
datatable.AcceptChanges();
switch (output_type)
{
case Output_Type.Console:
OutputToConsole(console_mode, application_path, datatable);
break;
case Output_Type.Txt:
OutputToTxt(console_mode, application_path, datatable);
break;
case Output_Type.XML:
OutputToXML(console_mode, application_path, datatable);
break;
case Output_Type.XMLTransform:
OutputToXMLTransform(console_mode, application_path, datatable);
break;
case Output_Type.RSS:
OutputToRSS(console_mode, application_path, datatable);
break;
default:
break;
}
last_revision = Convert.ToInt32(datatable.Compute("max(Revision)", string.Empty));
System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
config.AppSettings.Settings.Remove("last_revision");
config.AppSettings.Settings.Add("last_revision", last_revision.ToString());
config.Save();
}
catch (Exception ex)
{
Debug.WriteLine(ex.Message);
if (console_mode == true)
{
Console.WriteLine(ex.Message);
}
}
}
client.Dispose();
}
else
{
Debug.WriteLine("Unable to connect to repository");
if (console_mode == true)
{
Console.WriteLine("Unable to connect to repository");
}
}
}