Skip to content

Commit

Permalink
Merge pull request #4 from MohawkMEDIC/develop
Browse files Browse the repository at this point in the history
0.9.7.4 Release Merge
  • Loading branch information
Justin authored Aug 8, 2017
2 parents 490ab2d + 11cbf9d commit a40299b
Show file tree
Hide file tree
Showing 142 changed files with 12,738 additions and 10,296 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,6 @@ Thumbs.db
*.mdb
/DisconnectedClient/dist/setup-openiz-disconnected-client.exe
*.exe
*.tar
*.bz2
*.zip
3 changes: 3 additions & 0 deletions AppletCompiler/AppletCompiler.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
<Reference Include="OpenIZ.Core.Model">
<HintPath>..\Solution Items\OpenIZ.Core.Model.dll</HintPath>
</Reference>
<Reference Include="SharpCompress">
<HintPath>..\Solution Items\SharpCompress.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
Expand Down
7 changes: 7 additions & 0 deletions AppletCompiler/ConsoleParameters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,5 +129,12 @@ public class ConsoleParameters
[Parameter("embedCert")]
[Description("Embeds the certificate used to sign the package in the applet (recommended for wide-publishing)")]
public bool EmbedCertificate { get; set; }

/// <summary>
/// Set the compression algorithm
/// </summary>
[Parameter("compression")]
[Description("Sets the compression algorithm [lzma, bzip2, gzip, deflate, default = deflate]")]
public String Compression { get; set; }
}
}
4 changes: 2 additions & 2 deletions AppletCompiler/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ static int Compile(ConsoleParameters parameters)
{
Console.WriteLine("WARNING:>>> THIS PACKAGE IS NOT SIGNED - MOST OPEN IZ TOOLS WILL NOT LOAD IT");
mfst.Info.PublicKeyToken = null;
pkg = mfst.CreatePackage();
pkg = mfst.CreatePackage(parameters.Compression);
//pkg.Meta.PublicKeyToken = null;
}
pkg.Meta.Hash = SHA256.Create().ComputeHash(pkg.Manifest);
Expand Down Expand Up @@ -251,7 +251,7 @@ private static AppletPackage CreateSignedPackage(AppletManifest mfst, ConsolePar
X509Certificate2 signCert = new X509Certificate2(parameters.SignKey, parameters.SignPassword);

mfst.Info.PublicKeyToken = signCert.Thumbprint;
var retVal = mfst.CreatePackage();
var retVal = mfst.CreatePackage(parameters.Compression);
retVal.Meta.Hash = SHA256.Create().ComputeHash(retVal.Manifest);
retVal.Meta.PublicKeyToken = signCert.Thumbprint;

Expand Down
2 changes: 1 addition & 1 deletion AppletCompiler/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@
// by using the '*' as shown below:
// [assembly: AssemblyVersion("0.9.4.*")][assembly: AssemblyInformationalVersion("Chippewa")]
[assembly: AssemblyVersion("0.9.7.*")][assembly: AssemblyInformationalVersion("Edmonton CTP2")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("0.9.7.4")]
6 changes: 4 additions & 2 deletions BrainBug/BrainBug.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@
<Reference Include="MohawkCollege.Util.Console.Parameters">
<HintPath>..\Solution Items\MohawkCollege.Util.Console.Parameters.dll</HintPath>
</Reference>
<Reference Include="SharpCompress">
<Reference Include="SharpCompress, Version=0.18.0.0, Culture=neutral, PublicKeyToken=afb0a02973931d96, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Solution Items\SharpCompress.dll</HintPath>
</Reference>
<Reference Include="System" />
Expand All @@ -67,7 +68,8 @@
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="zlibnet">
<Reference Include="zlibnet, Version=1.3.2.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Solution Items\zlibnet.dll</HintPath>
</Reference>
</ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions BrainBug/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* Date: 2016-7-15
*/
using MohawkCollege.Util.Console.Parameters;
using SharpCompress.Reader.Tar;
using SharpCompress.Readers.Tar;
using System;
using System.Collections.Generic;
using System.Diagnostics;
Expand Down Expand Up @@ -128,10 +128,10 @@ static void Main(string[] args)
while (tar.MoveToNextEntry())
{

string outName = Path.Combine(parameters.ExtractDir, tar.Entry.FilePath);
string outName = Path.Combine(parameters.ExtractDir, tar.Entry.Key);
if (!Directory.Exists(Path.GetDirectoryName(outName)))
Directory.CreateDirectory(Path.GetDirectoryName(outName));
Console.WriteLine("{0} > {1}", tar.Entry.FilePath, outName);
Console.WriteLine("{0} > {1}", tar.Entry.Key, outName);

if (!tar.Entry.IsDirectory)
using (var ofs = File.Create(outName))
Expand Down
2 changes: 1 addition & 1 deletion BrainBug/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.9.7.*")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("0.9.7.4")]
39 changes: 39 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# How to contribute
First of all, thank you for taking the time to contribute to this project. We've tried to make a stable project and try to fix bugs and add new features continuously. You can help us do more.

## Getting started

### Check out the roadmap

We have some functionalities in mind and we have issued them and there is a *milestone* label available on the issue. If there is a bug or a feature that is not listed in the **issues** page or there is no one assigned to the issue, feel free to fix/add it! Although it's better to discuss it in the issue or create a new issue for it so there is no confilcting code, and we maintain a cohesive architecture.

### Writing some code!

Contributing to a project on Github is pretty straight forward. If this is you're first time, these are the steps you should take.

- Fork this repo.

And that's it! Read the code available and change the part you don't like! You're change should not break the existing code and should pass the tests.

If you're adding a new functionality, start from the branch **develop**. It would be a better practice to create a new branch and work in there.

When you're done, submit a pull request and for one of the maintainers to check it out. We would let you know if there is any problem or any changes that should be considered.

### Tests

In order for your contribution to be accepted, we prefer that you provide either unit tests, test scripts, or a document describing how the expected functionality works. This ensures that the person merging your pull request
has sufficient information to diagnose whether your code should be merged.

### Documentation

Every chunk of code that may be hard to understand has some comments above it. If you write some new code or change some part of the existing code in a way that it would not be functional without changing it's usages, it needs to be documented.

An example of how you might do this while attributing yourself is:

```
// Justin Fyfe - Fixed the order that these functions are called because they were causing a key violation
...
// End - Justin Fyfe
```

But we understand coding standards are sometimes hard to maintain, especially across multiple developers and platforms.
35 changes: 32 additions & 3 deletions DisconnectedClient/DcApplicationContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
using System.Xml.Serialization;
using System.Security.Cryptography;
using OpenIZ.Core.Applets.Services;
using DisconnectedClient.Properties;

namespace DisconnectedClient
{
Expand Down Expand Up @@ -209,7 +210,21 @@ public static bool StartContext()
{ // load configuration
try
{
retVal.ConfigurationManager.Load();
try
{
retVal.ConfigurationManager.Load();
retVal.ConfigurationManager.Backup();
}
catch
{
if (retVal.ConfigurationManager.HasBackup() && retVal.Confirm(Resources.err_configuration_invalid_restore_prompt))
{
retVal.ConfigurationManager.Restore();
retVal.ConfigurationManager.Load();
}
else
throw;
}

// Set master application context
ApplicationContext.Current = retVal;
Expand Down Expand Up @@ -241,10 +256,20 @@ public static bool StartContext()
appletService.LoadApplet(manifest);
}
}
catch (AppDomainUnloadedException) { throw; }
catch (Exception e)
{
retVal.m_tracer.TraceError("Loading applet {0} failed: {1}", appletInfo, e.ToString());
throw;
if (retVal.Confirm(String.Format(Resources.err_applet_corrupt_reinstall, appletInfo.Id)))
{
String appletPath = Path.Combine(retVal.Configuration.GetSection<AppletConfigurationSection>().AppletDirectory, appletInfo.Id);
if (File.Exists(appletPath))
File.Delete(appletPath);
}
else
{
retVal.m_tracer.TraceError("Loading applet {0} failed: {1}", appletInfo, e.ToString());
throw;
}
}


Expand Down Expand Up @@ -470,10 +495,14 @@ public override void PerformanceLog(string className, string methodName, string
/// </summary>
public override byte[] GetCurrentContextSecurityKey()
{
#if NOCRYPT
return null;
#else
var sid = WindowsIdentity.GetCurrent().User;
byte[] retVal = new byte[sid.BinaryLength];
WindowsIdentity.GetCurrent().User.GetBinaryForm(retVal, 0);
return retVal;
#endif
}
}
}
29 changes: 29 additions & 0 deletions DisconnectedClient/DcConfigurationManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
using OpenIZ.Mobile.Reporting;
using OpenIZ.Mobile.Core.Data.Warehouse;
using OpenIZ.Mobile.Core.Tickler;
using SharpCompress.Compressors.LZMA;
using SharpCompress.Compressors.BZip2;

namespace DisconnectedClient

Expand Down Expand Up @@ -330,5 +332,32 @@ public OpenIZConfiguration Configuration
}


/// <summary>
/// Backup the configuration
/// </summary>
public void Backup()
{
using (var lzs = new BZip2Stream(File.Create(Path.ChangeExtension(this.m_configPath, "bak.bz2")), SharpCompress.Compressors.CompressionMode.Compress))
this.m_configuration.Save(lzs);
}

/// <summary>
/// True if the configuration has a backup
/// </summary>
public bool HasBackup()
{
return File.Exists(Path.ChangeExtension(this.m_configPath, "bak.bz2"));
}

/// <summary>
/// Restore the configuration
/// </summary>
public void Restore()
{
using (var lzs = new BZip2Stream(File.OpenRead(Path.ChangeExtension(this.m_configPath, "bak.bz2")), SharpCompress.Compressors.CompressionMode.Decompress))
this.m_configuration = OpenIZConfiguration.Load(lzs);
this.Save();
}

}
}
4 changes: 4 additions & 0 deletions DisconnectedClient/DisconnectedClient.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,10 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Solution Items\OpenIZ.Protocol.Xml.dll</HintPath>
</Reference>
<Reference Include="SharpCompress, Version=0.18.0.0, Culture=neutral, PublicKeyToken=afb0a02973931d96, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Solution Items\SharpCompress.dll</HintPath>
</Reference>
<Reference Include="SQLite.Net, Version=3.1.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Solution Items\SQLite.Net.dll</HintPath>
Expand Down
1 change: 1 addition & 0 deletions DisconnectedClient/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ static void Main(string[] args)
#else
var settings = new CefSettings() { UserAgent = "OpenIZEmbedded" };
Cef.Initialize(settings, performDependencyCheck: true, browserProcessHandler: null);
Cef.EnableHighDPISupport();
#endif

Application.EnableVisualStyles();
Expand Down
4 changes: 2 additions & 2 deletions DisconnectedClient/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,5 @@
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.9.7.*")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("Edmonton CTP2")]
[assembly: AssemblyFileVersion("0.9.7.4")]
[assembly: AssemblyInformationalVersion("Edmonton CTP4")]
18 changes: 18 additions & 0 deletions DisconnectedClient/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions DisconnectedClient/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,12 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="err_applet_corrupt_reinstall" xml:space="preserve">
<value>The applet {0} appears to be corrupt. Would you like to try downloading it again?</value>
</data>
<data name="err_configuration_invalid_restore_prompt" xml:space="preserve">
<value>Your configuration file could not be read, there is a backup. Would you like to restore the backup?</value>
</data>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="logo_lg" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\logo_lg.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
Expand Down
4 changes: 2 additions & 2 deletions DisconnectedClient/app.manifest
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->

<!-- Windows 7 -->
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />-->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />

<!-- Windows 8 -->
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />-->
Expand All @@ -50,7 +50,7 @@
DPIs. Windows Presentation Foundation (WPF) applications are automatically DPI-aware and do not need
to opt in. Windows Forms applications targeting .NET Framework 4.6 that opt into this setting, should
also set the 'EnableWindowsFormsHighDpiAutoResizing' setting to 'true' in their app.config. -->

<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
Expand Down
1 change: 1 addition & 0 deletions DisconnectedClient/frmMain.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 15 additions & 11 deletions DisconnectedClient/frmMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,22 +59,26 @@ public frmDisconnectedClient(String url)

Action<ApplicationProgressEventArgs> updateUi = (e) =>
{
if (String.IsNullOrEmpty(e.ProgressText))
return;
else
try
{
lblStatus.Text = String.Format("{0} ({1:#0}%)", e.ProgressText, e.Progress * 100);
if (e.Progress >= 0 && e.Progress <= 1)
{
pgMain.Style = ProgressBarStyle.Continuous;
pgMain.Value = (int)(e.Progress * 100);
}
if (String.IsNullOrEmpty(e.ProgressText))
return;
else
{
pgMain.Style = ProgressBarStyle.Marquee;

lblStatus.Text = String.Format("{0} ({1:#0}%)", e.ProgressText, e.Progress * 100);
if (e.Progress >= 0 && e.Progress <= 1)
{
pgMain.Style = ProgressBarStyle.Continuous;
pgMain.Value = (int)(e.Progress * 100);
}
else
{
pgMain.Style = ProgressBarStyle.Marquee;

}
}
}
catch { }
Application.DoEvents();
};

Expand Down
Loading

0 comments on commit a40299b

Please sign in to comment.