diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..94420dc
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,236 @@
+## Ignore Visual Studio temporary files, build results, and
+## files generated by popular Visual Studio add-ons.
+
+# User-specific files
+*.suo
+*.user
+*.userosscache
+*.sln.docstates
+
+# User-specific files (MonoDevelop/Xamarin Studio)
+*.userprefs
+
+# Build results
+[Dd]ebug/
+[Dd]ebugPublic/
+[Rr]elease/
+[Rr]eleases/
+x64/
+x86/
+bld/
+[Bb]in/
+[Oo]bj/
+
+# Visual Studio 2015 cache/options directory
+.vs/
+# Uncomment if you have tasks that create the project's static files in wwwroot
+#wwwroot/
+
+# MSTest test Results
+[Tt]est[Rr]esult*/
+[Bb]uild[Ll]og.*
+
+# NUNIT
+*.VisualState.xml
+TestResult.xml
+
+# Build Results of an ATL Project
+[Dd]ebugPS/
+[Rr]eleasePS/
+dlldata.c
+
+# DNX
+project.lock.json
+artifacts/
+
+*_i.c
+*_p.c
+*_i.h
+*.ilk
+*.meta
+*.obj
+*.pch
+*.pdb
+*.pgc
+*.pgd
+*.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.tmp
+*.tmp_proj
+*.log
+*.vspscc
+*.vssscc
+.builds
+*.pidb
+*.svclog
+*.scc
+
+# Chutzpah Test files
+_Chutzpah*
+
+# Visual C++ cache files
+ipch/
+*.aps
+*.ncb
+*.opendb
+*.opensdf
+*.sdf
+*.cachefile
+
+# Visual Studio profiler
+*.psess
+*.vsp
+*.vspx
+*.sap
+
+# TFS 2012 Local Workspace
+$tf/
+
+# Guidance Automation Toolkit
+*.gpState
+
+# ReSharper is a .NET coding add-in
+_ReSharper*/
+*.[Rr]e[Ss]harper
+*.DotSettings.user
+
+# JustCode is a .NET coding add-in
+.JustCode
+
+# TeamCity is a build add-in
+_TeamCity*
+
+# DotCover is a Code Coverage Tool
+*.dotCover
+
+# NCrunch
+_NCrunch_*
+.*crunch*.local.xml
+nCrunchTemp_*
+
+# MightyMoose
+*.mm.*
+AutoTest.Net/
+
+# Web workbench (sass)
+.sass-cache/
+
+# Installshield output folder
+[Ee]xpress/
+
+# DocProject is a documentation generator add-in
+DocProject/buildhelp/
+DocProject/Help/*.HxT
+DocProject/Help/*.HxC
+DocProject/Help/*.hhc
+DocProject/Help/*.hhk
+DocProject/Help/*.hhp
+DocProject/Help/Html2
+DocProject/Help/html
+
+# Click-Once directory
+publish/
+
+# Publish Web Output
+*.[Pp]ublish.xml
+*.azurePubxml
+# TODO: Comment the next line if you want to checkin your web deploy settings
+# but database connection strings (with potential passwords) will be unencrypted
+*.pubxml
+*.publishproj
+
+# NuGet Packages
+*.nupkg
+# The packages folder can be ignored because of Package Restore
+**/packages/*
+# except build/, which is used as an MSBuild target.
+!**/packages/build/
+# Uncomment if necessary however generally it will be regenerated when needed
+#!**/packages/repositories.config
+# NuGet v3's project.json files produces more ignoreable files
+*.nuget.props
+*.nuget.targets
+
+# Microsoft Azure Build Output
+csx/
+*.build.csdef
+
+# Microsoft Azure Emulator
+ecf/
+rcf/
+
+# Microsoft Azure ApplicationInsights config file
+ApplicationInsights.config
+
+# Windows Store app package directory
+AppPackages/
+BundleArtifacts/
+
+# Visual Studio cache files
+# files ending in .cache can be ignored
+*.[Cc]ache
+# but keep track of directories ending in .cache
+!*.[Cc]ache/
+
+# Others
+ClientBin/
+~$*
+*~
+*.dbmdl
+*.dbproj.schemaview
+*.pfx
+*.publishsettings
+node_modules/
+orleans.codegen.cs
+
+# RIA/Silverlight projects
+Generated_Code/
+
+# Backup & report files from converting an old project file
+# to a newer Visual Studio version. Backup files are not needed,
+# because we have git ;-)
+_UpgradeReport_Files/
+Backup*/
+UpgradeLog*.XML
+UpgradeLog*.htm
+
+# SQL Server files
+*.mdf
+*.ldf
+
+# Business Intelligence projects
+*.rdl.data
+*.bim.layout
+*.bim_*.settings
+
+# Microsoft Fakes
+FakesAssemblies/
+
+# GhostDoc plugin setting file
+*.GhostDoc.xml
+
+# Node.js Tools for Visual Studio
+.ntvs_analysis.dat
+
+# Visual Studio 6 build log
+*.plg
+
+# Visual Studio 6 workspace options file
+*.opt
+
+# Visual Studio LightSwitch build output
+**/*.HTMLClient/GeneratedArtifacts
+**/*.DesktopClient/GeneratedArtifacts
+**/*.DesktopClient/ModelManifest.xml
+**/*.Server/GeneratedArtifacts
+**/*.Server/ModelManifest.xml
+_Pvt_Extensions
+
+# Paket dependency manager
+.paket/paket.exe
+
+# FAKE - F# Make
+.fake/
diff --git a/PIA_manager.sln b/PIA_manager.sln
new file mode 100644
index 0000000..eea7749
--- /dev/null
+++ b/PIA_manager.sln
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 2012
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PIA_manager", "PIA_manager\PIA_manager.csproj", "{DC5F0E17-BE8B-4A80-B4B7-C56373B27691}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {DC5F0E17-BE8B-4A80-B4B7-C56373B27691}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {DC5F0E17-BE8B-4A80-B4B7-C56373B27691}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {DC5F0E17-BE8B-4A80-B4B7-C56373B27691}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {DC5F0E17-BE8B-4A80-B4B7-C56373B27691}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/PIA_manager/App.config b/PIA_manager/App.config
new file mode 100644
index 0000000..d3d2996
--- /dev/null
+++ b/PIA_manager/App.config
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/PIA_manager/PIA_manager.csproj b/PIA_manager/PIA_manager.csproj
new file mode 100644
index 0000000..7f7f6d3
--- /dev/null
+++ b/PIA_manager/PIA_manager.csproj
@@ -0,0 +1,65 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {DC5F0E17-BE8B-4A80-B4B7-C56373B27691}
+ Exe
+ Properties
+ PIA_manager
+ pia_manager
+ v2.0
+ 512
+
+
+
+ AnyCPU
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+ true
+
+
+ AnyCPU
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+ true
+
+
+ pia_manager.manifest
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/PIA_manager/Program.cs b/PIA_manager/Program.cs
new file mode 100644
index 0000000..d34b9a0
--- /dev/null
+++ b/PIA_manager/Program.cs
@@ -0,0 +1,119 @@
+using System;
+using System.IO;
+using System.Reflection;
+using System.Runtime.InteropServices;
+
+namespace PIA
+{
+ // Author Shukhrat Nekbaev
+ // Structs and some code snippets were taken from http://www.pinvoke.net/
+ class PIA_Runner
+ {
+ [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
+ struct STARTUPINFO
+ {
+ public Int32 cb;
+ public string lpReserved;
+ public string lpDesktop;
+ public string lpTitle;
+ public Int32 dwX;
+ public Int32 dwY;
+ public Int32 dwXSize;
+ public Int32 dwYSize;
+ public Int32 dwXCountChars;
+ public Int32 dwYCountChars;
+ public Int32 dwFillAttribute;
+ public Int32 dwFlags;
+ public Int16 wShowWindow;
+ public Int16 cbReserved2;
+ public IntPtr lpReserved2;
+ public IntPtr hStdInput;
+ public IntPtr hStdOutput;
+ public IntPtr hStdError;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct PROCESS_INFORMATION
+ {
+ public IntPtr hProcess;
+ public IntPtr hThread;
+ public int dwProcessId;
+ public int dwThreadId;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ public struct SECURITY_ATTRIBUTES
+ {
+ public int nLength;
+ public unsafe byte* lpSecurityDescriptor;
+ public int bInheritHandle;
+ }
+
+ [DllImport("kernel32.dll", EntryPoint = "SetEnvironmentVariableA", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int SetEnvironmentVariable(string lpName, string lpValue);
+
+ [DllImport("kernel32.dll", SetLastError = true)]
+ static extern bool CreateProcess(string lpApplicationName,
+ string lpCommandLine, ref SECURITY_ATTRIBUTES lpProcessAttributes,
+ ref SECURITY_ATTRIBUTES lpThreadAttributes, bool bInheritHandles,
+ uint dwCreationFlags, IntPtr lpEnvironment, string lpCurrentDirectory,
+ [In] ref STARTUPINFO lpStartupInfo,
+ out PROCESS_INFORMATION lpProcessInformation);
+
+
+ static void Main(string[] args)
+ {
+ if (args.Length > 1)
+ {
+ Console.WriteLine("Multiple arguments, expected 1, exiting...");
+ return;
+ }
+ // default to --run
+ var argToPass = args.Length > 0 ? args[0] : "--run";// string.Empty;
+
+ Console.WriteLine("Starting...");
+
+ var baseDir = AppDomain.CurrentDomain.BaseDirectory;
+ var exeFullPath = Assembly.GetExecutingAssembly().Location;
+ var pathToExtractedFiles = Path.Combine(baseDir, "gemhome");
+
+ Console.WriteLine(string.Format("Current directory is: {0}, ", baseDir));
+ Console.WriteLine("Setting up environment variables...");
+
+ SetEnvironmentVariable("OCRA_EXECUTABLE", exeFullPath);
+ SetEnvironmentVariable("RUBYOPT", null);
+ SetEnvironmentVariable("RUBYLIB", null);
+ SetEnvironmentVariable("GEM_PATH", pathToExtractedFiles);
+
+ const uint NORMAL_PRIORITY_CLASS = 0x0020;
+
+ bool retValue;
+ string application = Path.Combine(baseDir, @"bin\rubyw.exe");
+
+ var tmpCmdLine = Path.Combine(baseDir, @"src\pia_manager.rb");
+ string commandLine = string.Format(@"rubyw.exe ""{0}"" {1}", tmpCmdLine, argToPass);
+
+ PROCESS_INFORMATION pInfo = new PROCESS_INFORMATION();
+ STARTUPINFO sInfo = new STARTUPINFO();
+ SECURITY_ATTRIBUTES pSec = new SECURITY_ATTRIBUTES();
+ SECURITY_ATTRIBUTES tSec = new SECURITY_ATTRIBUTES();
+ pSec.nLength = Marshal.SizeOf(pSec);
+ tSec.nLength = Marshal.SizeOf(tSec);
+
+ //Run
+ Console.WriteLine("Executing the application...");
+ retValue = CreateProcess(application, commandLine, ref pSec, ref tSec, false, NORMAL_PRIORITY_CLASS, IntPtr.Zero, null, ref sInfo, out pInfo);
+
+ if (retValue)
+ {
+ Console.WriteLine("Success...");
+ Console.WriteLine("Process ID (PID): " + pInfo.dwProcessId);
+ Console.WriteLine("Process Handle : " + pInfo.hProcess);
+ }
+ else
+ {
+ Console.WriteLine("Failed...");
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/PIA_manager/Properties/AssemblyInfo.cs b/PIA_manager/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..1f08d45
--- /dev/null
+++ b/PIA_manager/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("PIA_manager")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("PIA_manager")]
+[assembly: AssemblyCopyright("Copyright © 2014")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("88dc80df-14bc-4491-8ca3-e20e6a639834")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/PIA_manager/pia_manager.manifest b/PIA_manager/pia_manager.manifest
new file mode 100644
index 0000000..b537bf4
--- /dev/null
+++ b/PIA_manager/pia_manager.manifest
@@ -0,0 +1,55 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+