Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
BlythMeister committed Jun 13, 2016
2 parents 1df796a + 5a375b8 commit 687dadc
Show file tree
Hide file tree
Showing 82 changed files with 2,016 additions and 1,101 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*.bak
*.orig
.paket/paket.exe
/Output

## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
Expand Down
23 changes: 0 additions & 23 deletions Build.bat

This file was deleted.

102 changes: 102 additions & 0 deletions Build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
Param(
[Parameter(Position=0)]
[alias("nv")]
[ValidateSet('Y','N')]
[System.String]$NewVersionUpdate
)

Add-Type -A 'System.IO.Compression.FileSystem'
$OldVersion = Get-Content src\CurrentVersion.info

Write-Host "Current Version Number Is: $OldVersion"

if($NewVersionUpdate.toLower() -eq "y")
{
$NewVersion = Read-Host "Enter New Version Number"
if($NewVersion -eq "")
{
$NewVersion = $OldVersion
}
try
{
New-Item src\CurrentVersion.info -type file -force -value $NewVersion
Get-ChildItem -Path "src" -Include AssemblyInfo.cs -Recurse | Foreach-Object {
$newFile = Get-Content $_ -encoding "UTF8" | Foreach-Object {
if ($_.StartsWith("[assembly: AssemblyVersion")) {
'[assembly: AssemblyVersion("' + $NewVersion + '")]'
} else {
if ($_.StartsWith("[assembly: AssemblyFileVersion")) {
'[assembly: AssemblyFileVersion("' + $NewVersion + '")]'
} else {
$_
}
}
}

$newFile | set-Content $_ -encoding "UTF8"
}

Get-ChildItem -Path "src" -Include "*.csproj" -Recurse | Foreach-Object {
$newFile = Get-Content $_ -encoding "UTF8" | Foreach-Object {
if ($_.StartsWith(" <MinimumRequiredVersion>")) {
" <MinimumRequiredVersion>$NewVersion</MinimumRequiredVersion>"
} else {
if ($_.StartsWith(" <ApplicationVersion>")) {
" <ApplicationVersion>$NewVersion</ApplicationVersion>"
} else {
$_
}
}
}

$newFile | set-Content $_ -encoding "UTF8"
}

$newFile = Get-Content F:\GIT\Gallifrey\src\Gallifrey.UI.Modern\ChangeLog.xml -encoding "UTF8" | Foreach-Object {
if ($_.Contains(' Name="Pre-Release"')) {
' <Version Number="' + $NewVersion + '" Name="Pre-Release">'
} else {
$_
}
}

$newFile | set-Content F:\GIT\Gallifrey\src\Gallifrey.UI.Modern\ChangeLog.xml -encoding "UTF8"
}
Catch
{
Write-Host "Error Updating Versions, Will Not Build"
Break
}
}

Write-Host "Restoring Packages"
if(Test-Path "Output")
{
Remove-Item "Output\*" -recurse
}
.paket\paket.bootstrapper.exe
.paket\paket.exe restore
if(-Not ($ENV:PATH -like "*MSBuild*"))
{
if(Test-Path "${Env:ProgramFiles(x86)}\MSBuild\14.0\bin")
{
$ENV:Path = $ENV:Path + ";${Env:ProgramFiles(x86)}\MSBuild\14.0\bin"
}
if(Test-Path "${Env:ProgramFiles(x86)}\MSBuild\14.0\bin")
{
$ENV:Path = $ENV:Path + ";${Env:ProgramFiles(x86)}\MSBuild\14.0\bin"
}
}

Write-Host "Doing Build"
msbuild.exe src\Gallifrey.sln /target:Clean,Rebuild,publish /property:Configuration=Release

Write-Host "Copy Published Items"
Copy-Item src\Gallifrey.UI.Modern.Alpha\bin\Release\app.publish\ Output\alpha -recurse
Copy-Item src\Gallifrey.UI.Modern.Beta\bin\Release\app.publish\ Output\beta -recurse
Copy-Item src\Gallifrey.UI.Modern.Stable\bin\Release\app.publish\ Output\stable -recurse

Write-Host "Create App Zips"
[IO.Compression.ZipFile]::CreateFromDirectory('Output\alpha', 'Output\alpha.zip')
[IO.Compression.ZipFile]::CreateFromDirectory('Output\beta', 'Output\beta.zip')
[IO.Compression.ZipFile]::CreateFromDirectory('Output\stable', 'Output\stable.zip')
17 changes: 17 additions & 0 deletions CopyOutputToReleasesRepo.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Param(
[Parameter(Position=0)]
[alias("t")]
[ValidateSet('alpha','beta','stable')]
[System.String]$ReleaseType
)

if($ReleaseType -eq "")
{
Write-Host "No Release Type Entered"
}
else
{
Write-Host "Publishing $ReleaseType To Releases Repo"
Copy-Item Output\$ReleaseType\ ..\Gallifrey.Releases\download\modern\ -recurse -force
Write-Host "Published $ReleaseType"
}
152 changes: 152 additions & 0 deletions LINQPad/Gallifrey Instance ID Encryption.linq
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
<Query Kind="Program">
<Reference>&lt;RuntimeDirectory&gt;\System.Security.dll</Reference>
<Namespace>System.Security.Cryptography</Namespace>
</Query>

string path = @"F:\GIT\Gallifrey.Releases\download\PremiumInstanceIds";

void Main()
{
var running = true;
while(running)
{
Console.WriteLine("Enter Command (Show/Add/Remove/Done)");
var command = Console.ReadLine();
Util.ClearResults();
switch (command.ToLower())
{
case "show":
ShowFileContent();
break;
case "add":
DoAdd();
break;
case "remove":
DoRemove();
break;
case "done":
running = false;
break;
default:
Console.WriteLine("Unknown Function {0}", command);
break;
}
Console.WriteLine("");
Console.WriteLine("");
}

}

private void ShowFileContent()
{
DecryptFile();
var data = File.ReadAllText(path);
EncryptFile();
Console.WriteLine(data);
}

private void DoAdd()
{
Console.WriteLine("Enter InstanceId To Add");
var instanceId = Console.ReadLine();
Console.WriteLine("Enter Details (Name/Reason)");
var detail = Console.ReadLine();
var infoToAdd = string.Format("{0} - {1}",instanceId,detail);
DecryptFile();
var lines = File.ReadAllLines(path).ToList();
lines.Add(infoToAdd);
File.WriteAllLines(path, lines);
EncryptFile();
Console.WriteLine("Added: {0}", infoToAdd);
}

private void DoRemove()
{
Console.WriteLine("Enter InstanceId To Remove");
var instanceId = Console.ReadLine();
DecryptFile();
var lines = new List<string>();
var removed = false;
foreach (string line in File.ReadAllLines(path))
{
if(!line.StartsWith(instanceId))
{
lines.Add(line);
}
else
{
removed = true;
}
}
File.WriteAllLines(path, lines);
EncryptFile();
if(removed)
{
Console.WriteLine("Removed: {0}", instanceId);
}
else
{
Console.WriteLine("Unable to locate: {0}", instanceId);
}
}

private void DecryptFile()
{
File.WriteAllText(path, DataEncryption.Decrypt(File.ReadAllText(path)));
}

private void EncryptFile()
{
File.WriteAllText(path, DataEncryption.Encrypt(File.ReadAllText(path)));
}

internal static class DataEncryption
{
//TODO: Maybe these shouldn't be stored in plain code?
//TODO: Though, this is to make hacking the app settings a pain, rather than pure security.
private const string PassPhrase = "WOq2kKSbvHTcKp9e";
private const string InitVector = "pId6i1bN1aCVTaHN";
private const int Keysize = 256;

internal static string Encrypt(string plainText)
{
var initVectorBytes = Encoding.UTF8.GetBytes(InitVector);
var plainTextBytes = Encoding.UTF8.GetBytes(plainText);
var password = new PasswordDeriveBytes(PassPhrase, null);
var keyBytes = password.GetBytes(Keysize / 8);
var symmetricKey = new RijndaelManaged { Mode = CipherMode.CBC };
var encryptor = symmetricKey.CreateEncryptor(keyBytes, initVectorBytes);

using (var memoryStream = new MemoryStream())
{
using (var cryptoStream = new CryptoStream(memoryStream, encryptor, CryptoStreamMode.Write))
{
cryptoStream.Write(plainTextBytes, 0, plainTextBytes.Length);
cryptoStream.FlushFinalBlock();
var cipherTextBytes = memoryStream.ToArray();
return Convert.ToBase64String(cipherTextBytes);
}
}
}

internal static string Decrypt(string cipherText)
{
var initVectorBytes = Encoding.ASCII.GetBytes(InitVector);
var cipherTextBytes = Convert.FromBase64String(cipherText);
var password = new PasswordDeriveBytes(PassPhrase, null);
var keyBytes = password.GetBytes(Keysize / 8);
var symmetricKey = new RijndaelManaged { Mode = CipherMode.CBC };
var decryptor = symmetricKey.CreateDecryptor(keyBytes, initVectorBytes);

using (var memoryStream = new MemoryStream(cipherTextBytes))
{
using (var cryptoStream = new CryptoStream(memoryStream, decryptor, CryptoStreamMode.Read))
{
var plainTextBytes = new byte[cipherTextBytes.Length];
var decryptedByteCount = cryptoStream.Read(plainTextBytes, 0, plainTextBytes.Length);

return Encoding.UTF8.GetString(plainTextBytes, 0, decryptedByteCount);
}
}
}
}
2 changes: 1 addition & 1 deletion paket.dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ nuget Atlassian.SDK @= 2.5.0
nuget Exceptionless.Portable
nuget Exceptionless.Windows
nuget Exceptionless.Wpf
nuget MahApps.Metro
nuget MahApps.Metro prerelease
nuget Newtonsoft.Json
nuget RestSharp
12 changes: 6 additions & 6 deletions paket.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ NUGET
remote: https://www.nuget.org/api/v2
specs:
Atlassian.SDK (2.5)
Exceptionless.Portable (3.3.1590)
Exceptionless.Windows (3.3.1590)
Exceptionless.Portable (3.3.1590)
Exceptionless.Wpf (3.3.1590)
Exceptionless.Portable (3.3.1590)
MahApps.Metro (1.2.4)
Exceptionless.Portable (3.5.1738)
Exceptionless.Windows (3.5.1738)
Exceptionless.Portable (3.5.1738)
Exceptionless.Wpf (3.5.1738)
Exceptionless.Portable (3.5.1738)
MahApps.Metro (1.3.0-ALPHA158)
Newtonsoft.Json (8.0.3)
RestSharp (105.2.3)
1 change: 1 addition & 0 deletions src/CurrentVersion.info
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.2.0.0
7 changes: 4 additions & 3 deletions src/Gallifrey.Jira/Gallifrey.Jira.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
<ItemGroup>
<Compile Include="Enum\WorkLogStrategy.cs" />
<Compile Include="IJiraClient.cs" />
<Compile Include="JiraClientFactory.cs" />
<Compile Include="JiraRestClient.cs" />
<Compile Include="JiraSoapClient.cs" />
<Compile Include="Model\Error.cs" />
Expand Down Expand Up @@ -106,7 +107,7 @@
</Reference>
</ItemGroup>
</When>
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.5' Or $(TargetFrameworkVersion) == 'v4.5.1' Or $(TargetFrameworkVersion) == 'v4.5.2' Or $(TargetFrameworkVersion) == 'v4.5.3' Or $(TargetFrameworkVersion) == 'v4.6' Or $(TargetFrameworkVersion) == 'v4.6.1')">
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.5' Or $(TargetFrameworkVersion) == 'v4.5.1' Or $(TargetFrameworkVersion) == 'v4.5.2' Or $(TargetFrameworkVersion) == 'v4.5.3' Or $(TargetFrameworkVersion) == 'v4.6' Or $(TargetFrameworkVersion) == 'v4.6.1' Or $(TargetFrameworkVersion) == 'v4.6.2')">
<ItemGroup>
<Reference Include="Newtonsoft.Json">
<HintPath>..\..\packages\Newtonsoft.Json\lib\net45\Newtonsoft.Json.dll</HintPath>
Expand Down Expand Up @@ -180,7 +181,7 @@
</Reference>
</ItemGroup>
</When>
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.6' Or $(TargetFrameworkVersion) == 'v4.6.1')">
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.6' Or $(TargetFrameworkVersion) == 'v4.6.1' Or $(TargetFrameworkVersion) == 'v4.6.2')">
<ItemGroup>
<Reference Include="RestSharp">
<HintPath>..\..\packages\RestSharp\lib\net46\RestSharp.dll</HintPath>
Expand Down Expand Up @@ -244,4 +245,4 @@
</ItemGroup>
</When>
</Choose>
</Project>
</Project>
Loading

0 comments on commit 687dadc

Please sign in to comment.