Skip to content

Scripts

Robert Peters edited this page Oct 23, 2013 · 2 revisions

GAPP supports scripts. These are C# coded files with .cs extension. The big adventage of scripts are that you don't need a developement environment like Visual C# Express or SharpDevelop.

Scripts run within the application domain and has therefore access to everything normal plugins (pre-compiled C# code) has access to.

A script should not be within a namespace, name of the class needs to be Script and a method:

          public static bool Run(Plugin plugin, ICore core)

The HelloWorld script would look like this:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GlobalcachingApplication.Framework.Interfaces;
using GlobalcachingApplication.Utils;
using GlobalcachingApplication.Utils.BasePlugin;

class Script
{
    public static bool Run(Plugin plugin, ICore core)
    {
        System.Windows.Forms.MessageBox.Show(core.ActiveGeocache == null ? LanguageSupport.Instance.GetTranslation("No active geocache") : core.ActiveGeocache.Code);
        return true;
    }
}

Scripts should be placed into the Scripts folder within the Core.PluginDataPath.

Clone this wiki locally