Skip to content

Commit

Permalink
Trying to implement assembly resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
cathoderaydude committed Aug 9, 2020
1 parent e041e8d commit 01393c9
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 1 deletion.
12 changes: 12 additions & 0 deletions Babel/Babel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Babel.Google;
using System.Windows.Input;
using System.Configuration;
//using System.Runtime.Extensions;

namespace Babel
{
Expand Down Expand Up @@ -81,12 +82,23 @@ public frmBabel()
InitializeComponent();
}

/*private static Assembly MyResolveEventHandler(object sender, ResolveEventArgs args)
{
Console.WriteLine("Resolving...");
return typeof(MyType).Assembly;
}*/

private void Viewfinder_Load(object sender, EventArgs e)
{
DebugLog.Log("==============================================");
DebugLog.Log("Babel starting");
LoadSettings();

//AppDomain currentDomain = AppDomain.CurrentDomain;

//currentDomain.AssemblyResolve += new ResolveEventHandler(MyResolveEventHandler);


if (Properties.Settings.Default.WaiverSigned != true)
{
Disclaimer dc = new Disclaimer();
Expand Down
4 changes: 3 additions & 1 deletion Babel/BabelMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ private string GetText(AsyncOCR OCRResult)
.Select(boxenum => boxenum
.Select(box => box.text)
.Aggregate((l, r) => l + " " + r));
return myTexts.Aggregate((l, r) => l + Environment.NewLine + r);
// Temporarily disabling newlines until we figure out what's going on with them
//return myTexts.Aggregate((l, r) => l + Environment.NewLine + r);
return myTexts.Aggregate((l, r) => l + " " + r);
}
else
{
Expand Down
1 change: 1 addition & 0 deletions Babel/Disclaimer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public Disclaimer()

private void button1_Click(object sender, EventArgs e)
{
DebugLog.Log("User declined waiver. Exiting.");
Application.Exit();
}

Expand Down
6 changes: 6 additions & 0 deletions Babel/Google/GoogleAsync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ private async Task DoOCR()
string Identifer = Utility.RandomHex();
DebugLog.Log("Making OCR request [" + Identifer + "]");

if (!File.Exists(Properties.Settings.Default.apiKeyPath))
throw new FileNotFoundException("Keyfile not present at " + Properties.Settings.Default.apiKeyPath);

// Wait for rate limiter before starting the clock
GoogleAsyncStatic.rate.Check();
Stopwatch sw = new Stopwatch();
Expand Down Expand Up @@ -268,6 +271,9 @@ private async Task DoTranslation()
string Identifer = Utility.RandomHex();
DebugLog.Log("Making translation request ["+Identifer+"]: " + this.rawText);

if (!File.Exists(Properties.Settings.Default.apiKeyPath))
throw new FileNotFoundException("Keyfile not present at " + Properties.Settings.Default.apiKeyPath);

// Wait for rate limiter before starting the clock
GoogleAsyncStatic.rate.Check();
Stopwatch sw = new Stopwatch();
Expand Down
1 change: 1 addition & 0 deletions Babel/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<package id="System.Memory" version="4.5.4" targetFramework="net461" />
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net461" />
<package id="System.Runtime.CompilerServices.Unsafe" version="4.7.1" targetFramework="net461" />
<package id="System.Runtime.Extensions" version="4.3.1" targetFramework="net461" />
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net461" />
<package id="WindowsBase" version="4.6.1055.0" targetFramework="net461" />
</packages>

0 comments on commit 01393c9

Please sign in to comment.