-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from NecatiMeral/nm/comfort-online
Nm/comfort online
- Loading branch information
Showing
45 changed files
with
2,669 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -351,3 +351,4 @@ MigrationBackup/ | |
|
||
build/dev/ | ||
!build/dev/.gitkeep | ||
dist/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[CmdletBinding()] | ||
param ( | ||
[Parameter(Mandatory = $True)] | ||
[string] | ||
$Cert, | ||
[Parameter(Mandatory = $True)] | ||
[string] | ||
$Pass | ||
) | ||
|
||
$flag = [System.Security.Cryptography.X509Certificates.X509KeyStorageFlags]::Exportable | ||
$collection = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2Collection | ||
$collection.Import($Cert, $Pass, $flag) | ||
$pkcs12ContentType = [System.Security.Cryptography.X509Certificates.X509ContentType]::Pkcs12 | ||
$clearBytes = $collection.Export($pkcs12ContentType) | ||
$fileContentEncoded = [System.Convert]::ToBase64String($clearBytes) | ||
$secret = ConvertTo-SecureString -String $fileContentEncoded -AsPlainText –Force | ||
|
||
Write-Host $fileContentEncoded |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
[CmdletBinding()] | ||
param ( | ||
[Parameter(Mandatory = $True)] | ||
[string] | ||
$Project | ||
) | ||
|
||
Write-Host "Packing logic-node project at ``${Project}``" -ForegroundColor Blue | ||
$RepositoryRoot = Resolve-Path (Join-Path $PSScriptRoot '../') | ||
$SdkDir = Join-path $PSScriptRoot 'tools/gira' | ||
$DistDir = Resolve-Path (Join-Path $PSScriptRoot '../dist') | ||
|
||
Write-Host "Repository: ``${RepositoryRoot}``" | ||
Write-Host "SDK-Tools: ``${SdkDir}``" | ||
Write-Host "Output: ``${DistDir}``" | ||
|
||
$NodeToolPath = Join-Path -Path $SdkDir -ChildPath 'LogicNodeTool.exe' | ||
|
||
$CreateNodeArgs = @( | ||
'create' | ||
"${Project}" | ||
"${DistDir}" | ||
) | ||
|
||
Write-Host "${NodeToolPath} ${CreateNodeArgs}" -ForegroundColor Magenta | ||
. $NodeToolPath $CreateNodeArgs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
[CmdletBinding()] | ||
param ( | ||
[Parameter(Mandatory = $True)] | ||
[string] | ||
$ZipFile, | ||
[Parameter(Mandatory = $True)] | ||
[string] | ||
$Cert, | ||
[Parameter(Mandatory = $True)] | ||
[string] | ||
$Pass | ||
) | ||
|
||
$Location = Get-Location | ||
Write-Host "Signing logic-node project at ``${ZipFile}``" -ForegroundColor Blue | ||
$RepositoryRoot = Resolve-Path (Join-Path $PSScriptRoot '../') | ||
$ZipFile = Resolve-Path $ZipFile | ||
$Cert = Resolve-Path $Cert | ||
$SdkDir = Join-path $PSScriptRoot 'tools/gira' | ||
$DistDir = Resolve-Path (Join-Path $PSScriptRoot '../dist') | ||
|
||
Write-Host "Repository: ``${RepositoryRoot}``" | ||
Write-Host "SDK-Tools: ``${SdkDir}``" | ||
Write-Host "Output: ``${DistDir}``" | ||
|
||
$SignToolPath = Join-Path -Path $SdkDir -ChildPath 'SignLogicNodes.exe' | ||
|
||
Set-Location $SdkDir | ||
|
||
try { | ||
$SignNodeArgs = @( | ||
"${Cert}" | ||
"${Pass}" | ||
"${ZipFile}" | ||
) | ||
|
||
Write-Host "${SignToolPath} ${SignNodeArgs}" -ForegroundColor Magenta | ||
. $SignToolPath $SignNodeArgs | ||
} | ||
finally { | ||
Set-Location $Location | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<Project> | ||
|
||
<!--<ItemGroup> | ||
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies.net45" Version="$(MicrosoftNetFramework45PackageVersion)"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
</PackageReference> | ||
</ItemGroup>--> | ||
|
||
<ItemGroup> | ||
<Using Remove="System.Net.Http"/> | ||
</ItemGroup> | ||
|
||
</Project> |
15 changes: 15 additions & 0 deletions
15
dotnet/src/NecatiMeral.Logic.ComfortOnline/ComfortOnlineConsts.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
namespace Necati_Meral_Yahoo_De.Logic.ComfortOnline; | ||
public static class ComfortOnlineConsts | ||
{ | ||
public const string ComfortOnlineBaseAddress = "https://www.comfort-online.com/"; | ||
|
||
public static class ErrorCodes | ||
{ | ||
public const string Ok = "Ok"; | ||
public const string InitialRequestFailed = "InitialRequestFailed"; | ||
public const string MissingRequestVerificationToken = "MissingRequestVerificationToken"; | ||
public const string InvalidCredentials = "InvalidCredentials"; | ||
public const string LoginFailed = "LoginFailed"; | ||
public const string UnexpectedError = "UnexpectedError: "; | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
dotnet/src/NecatiMeral.Logic.ComfortOnline/ComfortOnlinePageParser.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
using System.Text.RegularExpressions; | ||
|
||
namespace Necati_Meral_Yahoo_De.Logic.ComfortOnline; | ||
public class ComfortOnlinePageParser | ||
{ | ||
readonly Regex _spanRegex = new Regex("<span.*?(?:id=\\\"val_([\\d_]*)\\\")>(.*)<\\/span>", RegexOptions.Compiled | RegexOptions.IgnoreCase); | ||
readonly Regex _inputRegex = new Regex("<input.*?(?:id=\\\"slider_([\\d_]*)\\\".*?value=\\\"([^\\\"]+)|value=\\\"([^\\\"]+).*?id=\\\"slider_([\\d_]*)\\\")[^>]*>", RegexOptions.Compiled | RegexOptions.IgnoreCase); | ||
|
||
public ComfortOnlinePlantSectionInfo Parse(string body) | ||
{ | ||
var info = new ComfortOnlinePlantSectionInfo(); | ||
|
||
var spanMatches = _spanRegex.Matches(body); | ||
foreach (Match match in spanMatches) | ||
{ | ||
if(match.Groups.Count == 3) | ||
{ | ||
info[match.Groups[1].Value] = match.Groups[2].Value; | ||
} | ||
} | ||
|
||
var inputMatches = _inputRegex.Matches(body); | ||
foreach (Match match in inputMatches) | ||
{ | ||
if (match.Groups.Count == 5) | ||
{ | ||
if (string.IsNullOrEmpty(match.Groups[1].Value)) | ||
{ | ||
info[match.Groups[3].Value] = match.Groups[4].Value; | ||
} | ||
else | ||
{ | ||
info[match.Groups[1].Value] = match.Groups[2].Value; | ||
} | ||
} | ||
} | ||
|
||
return info; | ||
} | ||
|
||
public class ComfortOnlinePlantSectionInfo | ||
{ | ||
Dictionary<string, string> _dict; | ||
|
||
public IReadOnlyDictionary<string, string> Values => _dict; | ||
|
||
public string this[string key] | ||
{ | ||
get => _dict[key]; | ||
set => _dict[key] = value; | ||
} | ||
|
||
public ComfortOnlinePlantSectionInfo() | ||
{ | ||
_dict = new Dictionary<string, string>(); | ||
} | ||
} | ||
} |
Oops, something went wrong.