/// <summary> /// Dispose(bool disposing) executes in two distinct scenarios. /// If disposing equals true, the method has been called directly /// or indirectly by a user's code. Managed and unmanaged resources /// can be disposed. /// If disposing equals false, the method has been called by the /// runtime from inside the finalizer and you should not reference /// other objects. Only unmanaged resources can be disposed. /// </summary> private void Dispose(bool disposing) { // Check to see if Dispose has already been called. if (!this.disposed) { // If disposing equals true, dispose all managed // and unmanaged resources. if (disposing) { // Dispose managed resources. // Component.Dispose(); } // Call the appropriate methods to clean up // unmanaged resources here. // If disposing is false, // only the following code is executed // We basically call it quits and set the JObject to nothing if (jObject != null) { jObject.Quit(); jObject = null; } // Force garbage collection GC.Collect(); } disposed = true; }
/// <summary> /// Actual method that initializes the session /// </summary> private void initialize() { string jScript = ""; // Create a new copy of the J Object and make sure were in the Z locale jObject = new JEXEServerClass(); jObject.Quit(); jObject.Log(1); jObject.Show(1); this.Eval("18!:4 <'z'"); //// Now get the base J Script //jScript = UnicodeEncoding.ASCII.GetString(Resources.script); //// If were debugging, show the J Session Window //if (this.debug) //{ // // Display the session and load the profile // jScript += "\nshowJ ''"; // jScript += "\nloadprofile ''"; //} //// load this script to the current session //this.Variable("baseScript", jScript); //// We execute the script using the code stored in the resource file //jScript = Resources.ScriptLoader; //// Load the new script to the current session //this.Variable("loadScript", jScript); //// Now we execute the values in the loadScript variable //this.Eval("0!:100 loadScript"); if (this.debug) { // Just display a fun message string script = "NB. Have fun! - bathala <*****@*****.**>"; this.Eval(script); } }