-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cf41849
commit 4e29c74
Showing
3 changed files
with
66 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using System.IO; | ||
using System.Net; | ||
using ILeoConsole; | ||
using ILeoConsole.Plugin; | ||
using ILeoConsole.Core; | ||
|
||
namespace LeoConsole_ExamplePlugin { | ||
public class Hostname : ICommand { | ||
public string Name { get { return "hostname"; } } | ||
public string Description { get { return "print computer's hostname"; } } | ||
public Action CommandFunktion { get { return () => Command(); } } | ||
private string[] _InputProperties; | ||
public string[] InputProperties { get { return _InputProperties; } set { _InputProperties = value; } } | ||
|
||
public void Command() { | ||
Console.WriteLine(Dns.GetHostName()); | ||
} | ||
} | ||
} | ||
|
||
// vim: tabstop=2 softtabstop=2 shiftwidth=2 expandtab |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
using System.IO; | ||
using ILeoConsole; | ||
using ILeoConsole.Plugin; | ||
using ILeoConsole.Core; | ||
|
||
namespace LeoConsole_ExamplePlugin { | ||
public class Ls : ICommand { | ||
public string Name { get { return "ls"; } } | ||
public string Description { get { return "list contents of a folder"; } } | ||
public Action CommandFunktion { get { return () => Command(); } } | ||
private string[] _InputProperties; | ||
public string[] InputProperties { get { return _InputProperties; } set { _InputProperties = value; } } | ||
public IData data = new ConsoleData(); | ||
|
||
public void Command() { | ||
if (_InputProperties.Length < 2) { | ||
ls(data.SavePath); | ||
return; | ||
} | ||
for (int i = 1; i < _InputProperties.Length; i++) { | ||
ls(_InputProperties[i]); | ||
Console.Write("\n"); | ||
} | ||
} | ||
|
||
private void ls(string directory) { | ||
Console.WriteLine(directory + ":"); | ||
try { | ||
foreach (string filename in Directory.GetDirectories(directory)) { | ||
Console.WriteLine(Path.GetFileName(filename) + "/"); | ||
} | ||
foreach (string filename in Directory.GetFiles(directory)) { | ||
Console.WriteLine(Path.GetFileName(filename)); | ||
} | ||
} catch (Exception e) { | ||
Console.WriteLine("error: " + e.Message); | ||
} | ||
} | ||
} | ||
} | ||
|
||
// vim: tabstop=2 softtabstop=2 shiftwidth=2 expandtab |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters