Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using SharpSvn;
- using Flurl;
- static readonly string reposRootString = @"https://my.svn.repos/Testing/";
- static readonly string vendor = "Vendor";
- static readonly string driver = "Driver+";
- static readonly string version = "1.0.0.1";
- static void Main(string[] args)
- {
- DoDontEscape();
- DoEscape();
- }
- private static void DoDontEscape()
- {
- string combined = Url.Combine(reposRootString, vendor, driver, version);
- TryCreateURI(combined);
- }
- private static void DoEscape()
- {
- var vEscaped = Uri.EscapeDataString(vendor);
- var dEscaped = Uri.EscapeDataString(driver);
- var dvEscaped = Uri.EscapeDataString(version);
- string combined = Url.Combine(reposRootString, vEscaped, dEscaped, dvEscaped);
- TryCreateURI(combined);
- }
- private static void TryCreateURI(string combined)
- {
- Uri uri;
- if (Uri.TryCreate(combined, UriKind.Absolute, out uri))
- {
- CreateSvnDir(uri);
- }
- else
- {
- throw new Exception(string.Format("{0} is an invalid URI!", combined));
- }
- }
- private static void CreateSvnDir(Uri uri)
- {
- using (SvnClient client = new SvnClient())
- client.RemoteCreateDirectory(uri, new SvnCreateDirectoryArgs() { CreateParents = true, LogMessage = "create dir" });
- }
Add Comment
Please, Sign In to add comment