-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from mbdavid/dev
Dev
- Loading branch information
Showing
191 changed files
with
7,414 additions
and
7,325 deletions.
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
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<?xml version="1.0"?> | ||
<configuration> | ||
<startup> | ||
<supportedRuntime version="v2.0.50727"/> | ||
</startup> | ||
|
||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup> | ||
</configuration> |
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
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
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,38 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.ComponentModel; | ||
using System.Diagnostics; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Text; | ||
|
||
namespace LiteDB.Shell.Commands | ||
{ | ||
internal class Ed : ConsoleCommand | ||
{ | ||
public override bool IsCommand(StringScanner s) | ||
{ | ||
return s.Match(@"ed$"); | ||
} | ||
|
||
public override void Execute(LiteShell shell, StringScanner s, Display display, InputCommand input) | ||
{ | ||
var temp = Path.GetTempPath() + "LiteDB.Shell.txt"; | ||
|
||
// remove "ed" command from history | ||
input.History.RemoveAt(input.History.Count - 1); | ||
|
||
var last = input.History.Count > 0 ? input.History[input.History.Count - 1] : ""; | ||
|
||
File.WriteAllText(temp, last.Replace("\n", Environment.NewLine)); | ||
|
||
Process.Start("notepad.exe", temp).WaitForExit(); | ||
|
||
var text = File.ReadAllText(temp); | ||
|
||
if (text == last) return; | ||
|
||
input.Queue.Enqueue(text); | ||
} | ||
} | ||
} |
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
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,28 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.ComponentModel; | ||
using System.Linq; | ||
using System.Text; | ||
|
||
namespace LiteDB.Shell.Commands | ||
{ | ||
internal class Open : ConsoleCommand | ||
{ | ||
public override bool IsCommand(StringScanner s) | ||
{ | ||
return s.Scan(@"open\s+").Length > 0; | ||
} | ||
|
||
public override void Execute(LiteShell shell, StringScanner s, Display display, InputCommand input) | ||
{ | ||
var filename = s.Scan(@".+"); | ||
|
||
if (shell.Database != null) | ||
{ | ||
shell.Database.Dispose(); | ||
} | ||
|
||
shell.Database = new LiteDatabase(filename); | ||
} | ||
} | ||
} |
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
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
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,28 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.ComponentModel; | ||
using System.Diagnostics; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Text; | ||
|
||
namespace LiteDB.Shell.Commands | ||
{ | ||
internal class Run : ConsoleCommand | ||
{ | ||
public override bool IsCommand(StringScanner s) | ||
{ | ||
return s.Scan(@"run\s+").Length > 0; | ||
} | ||
|
||
public override void Execute(LiteShell shell, StringScanner s, Display display, InputCommand input) | ||
{ | ||
var filename = s.Scan(@".+").Trim(); | ||
|
||
foreach (var line in File.ReadAllLines(filename)) | ||
{ | ||
input.Queue.Enqueue(line); | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.