-
Notifications
You must be signed in to change notification settings - Fork 1
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 #40 from thygesteffensen/fix/valuecontainerconvert
Fix/valuecontainerconvert
- Loading branch information
Showing
34 changed files
with
1,103 additions
and
442 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,7 +46,7 @@ jobs: | |
GIT_AUTHOR_NAME: thygesteffensen | ||
GIT_AUTHOR_EMAIL: [email protected] | ||
run: | | ||
echo "RELEASE_VERSION=$((npx semantic-release --dry-run).Where({ $_ -like '*Release note*' }) | Out-String | Select-String '[0-9]+\.[0-9]+\.[0-9]+([-][a-zA-z]+[.][0-9]*)' | % { $_.Matches } | % { $_.Value })" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | ||
echo "RELEASE_VERSION=$((npx semantic-release --dry-run).Where({ $_ -like '*Release note*' }) | Out-String | Select-String '[0-9]+\.[0-9]+\.[0-9]+([-][a-zA-z]+[.][0-9]*)?' | % { $_.Matches } | % { $_.Value })" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | ||
- name: Print release verison | ||
run: echo ${env:RELEASE_VERSION} | ||
|
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
23 changes: 23 additions & 0 deletions
23
...kUp/ExpressionParser/Functions/Implementations/ConversionFunctions/CreateArrayFunction.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,23 @@ | ||
using System.Linq; | ||
using Parser.ExpressionParser.Functions.Base; | ||
using Parser.ExpressionParser.Functions.CustomException; | ||
|
||
namespace Parser.ExpressionParser.Functions.Implementations.ConversionFunctions | ||
{ | ||
public class CreateArrayFunction : Function | ||
{ | ||
public CreateArrayFunction() : base("createArray") | ||
{ | ||
} | ||
|
||
public override ValueContainer ExecuteFunction(params ValueContainer[] parameters) | ||
{ | ||
if (parameters.Length == 0) | ||
{ | ||
throw InvalidTemplateException.BuildInvalidLanguageFunction("SomeActon", "createArray"); | ||
} | ||
|
||
return new ValueContainer(parameters.ToList()); | ||
} | ||
} | ||
} |
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
32 changes: 32 additions & 0 deletions
32
...ExpressionParser/Functions/Implementations/ConversionFunctions/DataUriToBinaryFunction.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,32 @@ | ||
using System; | ||
using System.Linq; | ||
using System.Text; | ||
using Parser.ExpressionParser.Functions.Base; | ||
using Parser.ExpressionParser.Functions.CustomException; | ||
|
||
namespace Parser.ExpressionParser.Functions.Implementations.ConversionFunctions | ||
{ | ||
public class DataUriToBinaryFunction : Function | ||
{ | ||
public DataUriToBinaryFunction() : base("dataUriToBinary") | ||
{ | ||
} | ||
|
||
public override ValueContainer ExecuteFunction(params ValueContainer[] parameters) | ||
{ | ||
if (parameters.Length == 0) | ||
{ | ||
throw InvalidTemplateException.BuildInvalidLanguageFunction("SomeActon", "dataUriToBinary"); | ||
} | ||
|
||
return parameters[0].Type() switch | ||
{ | ||
ValueContainer.ValueType.String => | ||
new ValueContainer(Encoding.UTF8.GetBytes(parameters[0].GetValue<string>()) | ||
.Aggregate("", (s, b) => s + Convert.ToString(b, 2).PadLeft(8, '0'))), | ||
_ => throw new PowerAutomateMockUpException( | ||
$"Array function can only operate on strings, not {parameters[0].Type()}.") | ||
}; | ||
} | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
PowerAutomateMockUp/ExpressionParser/Functions/Math/AddFunction.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,25 @@ | ||
using Parser.ExpressionParser.Functions.Base; | ||
using Parser.ExpressionParser.Functions.CustomException; | ||
|
||
namespace Parser.ExpressionParser.Functions.Math | ||
{ | ||
public class AddFunction : Function | ||
{ | ||
public AddFunction() : base("add") | ||
{ | ||
} | ||
|
||
public override ValueContainer ExecuteFunction(params ValueContainer[] parameters) | ||
{ | ||
if (parameters.Length != 2) | ||
{ | ||
throw new InvalidTemplateException("Paramters count does not match expected"); | ||
} | ||
|
||
var first = parameters[0].GetValue<float>(); | ||
var second = parameters[1].GetValue<float>(); | ||
|
||
return new ValueContainer(first + second); | ||
} | ||
} | ||
} |
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
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
Oops, something went wrong.