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


C# SvnClient.Dispose方法代码示例

本文整理汇总了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();
            }
        }
开发者ID:trentcioran,项目名称:SvnMSBuildTasks,代码行数:41,代码来源:SvnTaskBase.cs

示例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");
                }
            }
        }
开发者ID:spraints,项目名称:svn2tfs,代码行数:101,代码来源:ConsoleApplication.cs


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