-
Notifications
You must be signed in to change notification settings - Fork 190
/
PublishingProfileImpl.cs
77 lines (69 loc) · 2.79 KB
/
PublishingProfileImpl.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
using System.Text.RegularExpressions;
namespace Microsoft.Azure.Management.AppService.Fluent
{
/// <summary>
/// A credential for publishing to a web app.
/// </summary>
///GENTHASH:Y29tLm1pY3Jvc29mdC5henVyZS5tYW5hZ2VtZW50LmFwcHNlcnZpY2UuaW1wbGVtZW50YXRpb24uUHVibGlzaGluZ1Byb2ZpbGVJbXBs
internal partial class PublishingProfileImpl : IPublishingProfile
{
private string ftpUrl;
private string gitUrl;
private string ftpUsername;
private string gitUsername;
private string ftpPassword;
private string gitPassword;
private static readonly Regex gitRegex = new Regex("publishMethod=\"MSDeploy\" publishUrl=\"([^\"]+)\".+userName=\"(\\$[^\"]+)\".+userPWD=\"([^\"]+)\"");
private static readonly Regex ftpRegex = new Regex("publishMethod=\"FTP\" publishUrl=\"ftps?://([^\"]+).+userName=\"([^\"]+\\\\\\$[^\"]+)\".+userPWD=\"([^\"]+)\"");
///GENMHASH:EED906EE02A83607395DD16B6C952CB5:F903566E74A7E102149C01EBDACBA16F
public string GitPassword()
{
return gitPassword;
}
///GENMHASH:4732BF2508B12B93253015B845FD658D:4A55BB7792435BEEA23D85DC0CB5B024
public string FtpUrl()
{
return ftpUrl;
}
///GENMHASH:97E0F94E6C921885654538A045D70AE4:4BAC96658A3BD30F30DB6325C980B34A
public string FtpPassword()
{
return ftpPassword;
}
///GENMHASH:B45CFC79F53C364F2AEFC729C0B13791:9A0D9C09A1A3DECF7680944A69354DF1
internal PublishingProfileImpl(string publishingProfileXml)
{
var matcher = gitRegex.Match(publishingProfileXml);
if (matcher.Success)
{
gitUrl = matcher.Groups[1].Value;
gitUsername = matcher.Groups[2].Value;
gitPassword = matcher.Groups[3].Value;
}
matcher = ftpRegex.Match(publishingProfileXml);
if (matcher.Success)
{
ftpUrl = matcher.Groups[1].Value;
ftpUsername = matcher.Groups[2].Value;
ftpPassword = matcher.Groups[3].Value;
}
}
///GENMHASH:3A00102CDB3883930D22D211E33DF023:2DC7A289AC2E4496BE37262AB0C17B6A
public string FtpUsername()
{
return ftpUsername;
}
///GENMHASH:7F7FC8DC06968B3889A780DE3BDCD874:3D4DF5C05B9DB567C2A58850D325D1EA
public string GitUrl()
{
return gitUrl;
}
///GENMHASH:7E8ABAE0E0571805FF880C3B2A8721E3:B9DDA023577C3DCB5BF9204C69200181
public string GitUsername()
{
return gitUsername;
}
}
}