My favorites | Sign in
Project Home Downloads Wiki Issues Source
Project Information
Members
Featured
Downloads
Links

Introduction

FarNet provides the .NET API for Far Manager and the runtime infrastructure for its modules. The API is exposed in comfortable object oriented way and most of tedious programming is done internally. Modules normally contain only tiny pieces of boilerplate framework code.

One of the most useful modules is PowerShellFar. It combines full power of Windows PowerShell with the rich console based user interface of Far Manager and its numerous features.

A few slides about PowerShellFar (PDF)


Main Project Modules


Module Code Examples

"Hello" in C# (exposed as the "Hello" item in all Far Manager plug-in menus)

using System;
using FarNet;

[System.Runtime.InteropServices.Guid("8f7ba3b1-7fe9-4912-9f30-b2f43ef47310")]
[ModuleTool(Name = "Hello", Options = ModuleToolOptions.AllMenus)]
public class Hello : ModuleTool
{
	public override void Invoke(object sender, ModuleToolEventArgs e)
	{
		Far.Net.Message("Hello world");
	}
}

The same in F#

module Module1
open FarNet

[<System.Runtime.InteropServices.Guid("c70150d8-42ea-402a-be06-6ff85555fa33")>]
[<ModuleTool(Name = "Hello.F#", Options = ModuleToolOptions.AllAreas)>]
type public FSharpTool() =
    inherit ModuleTool()
    override this.Invoke(sender, e) =
        Far.Net.Message("Hello from F#")

More Modules (mostly tutorial but yet useful)

The source code is included into the distributed FarNet archive.

Backslash

  • Escapes and unescapes \ and " in editor selection with \

EditorKit

  • Trims line ends on saving a file
  • Sets tabs expansion mode to 'All' for some files

FarNet.Demo

  • Host class (not pre-loaded)
  • Menu tool class (all areas)
  • Command class (prefix Demo:)
  • Explorer class (.resources panel)
  • Settings classes (various settings)
  • Module help files (.hlf, English and Russian)
  • Localized module resources (English and Russian)


PowerShell Code Examples

Minimal "Hello"

'Hello world'

"Hello" in a message box

$Far.Message('Hello world')

"Hello" in the editor

$editor = $Far.CreateEditor()
$editor.FileName = 'Test.txt'
$editor.Open()
$editor.Add('Hello world')
$editor.Redraw()

Powered by Google Project Hosting