Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version
Go to top

A JavaScript Shell

, 18 Nov 2010
Bases to create your own JavaScript shell for your application
binaries.zip
binaries
Documentation.chm
Scaredfinger.JSShell.dll
samples.zip
samples
LocalShell
Properties
SampleShell
Properties
Scaredfinger.JSShell
Properties
ShellServer
Properties
source.zip
source
Scaredfinger.JSShell
Properties
using System;
using System.Collections.Generic;
using Scaredfinger.JSShell;
using System.Reflection;
using System.IO;

namespace SampleShell
{
  class Program
  {
    static void Main(string[] args)
    {
      ShellFactory<SampleShell>.Default.AddImport("System.Reflection");
      ShellFactory<SampleShell>.Default.AddImport("System.IO");
      Assembly.GetExecutingAssembly();
      Directory.GetLogicalDrives();

      using (var shell = ShellFactory<SampleShell>.Default.CreateShell())
      {
        shell.OpenShell();
        shell.AddGlobalObject("tokens", new List<string>());
        shell.AddGlobalObject("globals", new Dictionary<string, object>());

        do
        {
          Console.Write(" > ");
          try
          {
            var result = shell.Eval(Console.ReadLine());
          }
          catch (Exception ex)
          {
            Console.WriteLine(ex);
          }
        } while (shell.Running);
      }
    }
  }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Erich Ledesma
Software Developer SunHotels
Spain Spain
I Received a Bachelor's Degree in Computer Science at the Mathematics and Computer Science Faculty, University of Havana, Cuba.
 
I mainly work in web applications using C# and some Javascript. Some very few times do some Java.

| Advertise | Privacy | Mobile
Web03 | 2.8.140905.1 | Last Updated 18 Nov 2010
Article Copyright 2010 by Erich Ledesma
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid