public void testExit(WorkbooksApi workbooks, int exitcode)
 {
     try {
     Dictionary<string, object> logout = workbooks.logout();
     if (!logout.ContainsKey("success") ) {
       workbooks.log("Logout failed", new Object[] {logout}, "error");
       System.Environment.Exit(0);
     }
     workbooks.log("Logout Complete", new Object[] {this.GetType()}, "info");
       } catch(Exception e) {
     workbooks.log("Errors while logging out: ", new Object[] {e}, "error");
       }
       if (exitcode == 0) {
     workbooks.log("Script exited", new Object[] {"OK"}, "info");
       } else {
     workbooks.log("Script exited with error", new Object[] {exitcode}, "error");
       }
       System.Environment.Exit(exitcode);
 }
 public void testExit(WorkbooksApi workbooks, int exitcode)
 {
     try {
         Dictionary <string, object> logout = workbooks.logout();
         if (!logout.ContainsKey("success"))
         {
             workbooks.log("Logout failed", new Object[] { logout }, "error");
             System.Environment.Exit(0);
         }
         workbooks.log("Logout Complete", new Object[] { this.GetType() }, "info");
     } catch (Exception e) {
         workbooks.log("Errors while logging out: ", new Object[] { e }, "error");
     }
     if (exitcode == 0)
     {
         workbooks.log("Script exited", new Object[] { "OK" }, "info");
     }
     else
     {
         workbooks.log("Script exited with error", new Object[] { exitcode }, "error");
     }
     System.Environment.Exit(exitcode);
 }