Dev:FSharp
From WCell
F# (spoken: F Sharp) is a .NET-based programming language with functional language elements, currently being developed by Microsoft.
Just like any other .NET language, F# code is compiled into .NET Assemblies and thus can be used to write WCell Addons.
Contents |
[edit] Resources
- Wikipedia Article
- Official Manual (at Microsoft)
- Getting Started (at Microsoft)
- Getting Set Up (at Wikibooks)
- Official F# Wiki
- Language Specification
[edit] Getting Started (using VS)
- Follow the steps of one of the Setup guides above to install F#
- F# automatically integrates with Visual Studio
- If you don't have Visual Studio, see above for alternative solutions
- You can now either load WCell's existing F# Addon or create a new Addon
- Creating a new Addon:
- Go to: File -> New -> Project -> Other Project types -> F# Projects
- Place the Project in WCell's Addon Folder
- Go to the new Project's Projects Properties:
- Change the Output Type to DLL
- Import the needed WCell libraries (use relative File paths), such as: WCell.Core, WCell.Constants and other Projects that you want to use (eg. WCell.RealmServer or WCell.AuthServer)
- Implement the IWCellAddon - interface in your class
- Set the Output path to ../../Run/RealmServer/Lib/ and/or ../../Run/AuthServer/Lib/ correspondingly (if your project is in a subfolder of WCell's Addon Folder)
- Add the Addon to the configuration of the RealmServer and/or AuthServer
- Done!
- Creating a new Addon:
[edit] A sample Addon
The following is an example of how to write the very most basic WCell-Addon possible. The name is FSharpAddon and its located in the namespace WCell.Addons:
namespace WCell.Addons
open System;
open System.Globalization;
open WCell.Core.Addons;
type public FSharpAddon =
class
// F# has no default ctor
new() = { }
interface IWCellAddon
with
member public x.get_Name() = "First FSharp Addon"
member public x.get_Author() = "The WCell Team"
member public x.get_Website() = "http://WCell.org"
member public x.GetLocalizedName (culture) = "First FSharp Addon"
member public x.Init() =
Console.WriteLine("FSharp test!");
end
end;;
[edit] F# Addons in WCell
You can find a default F# Addon written by the WCell team with the project file in the Addons/ folder.
Feel free to use that or create your own Addon to try your first steps or write fully blown features in F#.
[edit] Related
- Development Overview
- Read on how to use C# to write Addons
