Permalink
Browse files

Check for Mono in startup

  • Loading branch information...
1 parent 13840f3 commit 0f45a4bc471c5330c1e9b0478a10a4c07384bcad @abdullin abdullin committed Mar 10, 2013
Showing with 26 additions and 12 deletions.
  1. +26 −12 Source/Gtd.Console/Program.cs
@@ -71,6 +71,8 @@ static void Main(string[] args)
public sealed class ConsoleEnvironment
{
+
+
public IEventStore Store { get; private set; }
public ITrustedSystemApplicationService TrustedSystem { get; private set; }
public IDictionary<string, IConsoleCommand> Commands { get; private set; }
@@ -83,6 +85,11 @@ public sealed class ConsoleEnvironment
public DateTime CurrentDate { get { return DateTime.Now; } }
+ public static bool IsMono ()
+ {
+ return typeof (object).Assembly.GetType ("Mono.Runtime") != null;
+ }
+
public static ConsoleEnvironment Build()
{
var handler = new SynchronousEventHandler();
@@ -97,21 +104,28 @@ public static ConsoleEnvironment Build()
messageStore.LoadDataContractsFromAssemblyOf(typeof(ActionDefined));
var currentVersion = ((IAppendOnlyStore) file).GetCurrentVersion();
- // setup Window size values for Console Window that is 60% of Max Possible Size
- int winWidth = (Console.LargestWindowWidth * 6 / 10);
- int winHeight = (Console.LargestWindowHeight * 6 / 10);
+ if (!IsMono ()) {
+
+
+
+ // setup Window size values for Console Window that is 60% of Max Possible Size
+ int winWidth = (Console.LargestWindowWidth * 6 / 10);
+ int winHeight = (Console.LargestWindowHeight * 6 / 10);
+
+ // hack - for now, hard code "bigger" buffer than Window sizes above
+ // keep horizontal buffer equal to width - to avoid horizontal scrolling
+ int winBuffWidth = winWidth;
+ int winBuffHeight = winHeight + 300;
+
- // hack - for now, hard code "bigger" buffer than Window sizes above
- // keep horizontal buffer equal to width - to avoid horizontal scrolling
- int winBuffWidth = winWidth;
- int winBuffHeight = winHeight + 300;
- Console.SetBufferSize(winBuffWidth, winBuffHeight);
+ Console.SetBufferSize (winBuffWidth, winBuffHeight);
- // Buffer is bigger than Window so set the Window Size
- Console.SetWindowSize(winWidth, winHeight);
+ // Buffer is bigger than Window so set the Window Size
+ Console.SetWindowSize (winWidth, winHeight);
- // note that various tricks to center Console Window on launch
- // and to change to Font size were ugly (PInvoke, etc.) so left them out for now
+ // note that various tricks to center Console Window on launch
+ // and to change to Font size were ugly (PInvoke, etc.) so left them out for now
+ }
Console.Title = "GTD Interactive Shell - Using Trusted System Id#: 1";

0 comments on commit 0f45a4b

Please sign in to comment.