diff --git a/LiteDB b/LiteDB
deleted file mode 160000
index d9c24b1..0000000
--- a/LiteDB
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit d9c24b108cfae7f58d6859fd64985f42a106b0aa
diff --git a/LiteDBViewer.Setup/LiteDBViewer.Setup.isl b/LiteDBViewer.Setup/LiteDBViewer.Setup.isl
index 7598917..aa4dcf1 100644
--- a/LiteDBViewer.Setup/LiteDBViewer.Setup.isl
+++ b/LiteDBViewer.Setup/LiteDBViewer.Setup.isl
@@ -1148,7 +1148,7 @@
FavoritesFolder | TARGETDIR | .:FAVORI~1|Favorites | | 0 | |
FontsFolder | TARGETDIR | .:Fonts | | 0 | |
GlobalAssemblyCache | TARGETDIR | .:Global~1|GlobalAssemblyCache | | 0 | |
- INSTALLDIR | LITEDB_VIEWER_3 | . | | 0 | |
+ INSTALLDIR | LITEDB_VIEWER_4 | . | | 0 | |
ISCommonFilesFolder | CommonFilesFolder | Instal~1|InstallShield | | 0 | |
ISMyCompanyDir | ProgramFilesFolder | MYCOMP~1|My Company Name | | 0 | |
ISMyProductDir | ISMyCompanyDir | MYPROD~1|My Product Name | | 0 | |
@@ -1156,6 +1156,7 @@
LITEDB_VIEWER | ProgramFilesFolder | LITEDB~1|LiteDB Viewer | | 0 | |
LITEDB_VIEWER_2 | ProgramFilesFolder | LITEDB~1|LiteDB Viewer 2 | | 0 | |
LITEDB_VIEWER_3 | ProgramFilesFolder | LITEDB~1|LiteDB Viewer 3 | | 0 | |
+ LITEDB_VIEWER_4 | ProgramFilesFolder | LITEDB~1|LiteDB Viewer 4 | | 0 | |
LocalAppDataFolder | TARGETDIR | .:LocalA~1|LocalAppData | | 0 | |
MY_PRODUCT_NAME | FALAHATI.NET | MYPROD~1|My Product Name | | 0 | |
MyPicturesFolder | TARGETDIR | .:MyPict~1|MyPictures | | 0 | |
@@ -1853,7 +1854,7 @@
NewExtension2 | LiteDBViewer.Primary_output | | | AlwaysInstall |
NewExtension3 | LiteDBViewer.Primary_output | | | AlwaysInstall |
db | LiteDBViewerVersionSelector.Primary_output | litedbviewerversionselector.databasefile | | AlwaysInstall |
- db3 | LiteDBViewer.Primary_output | litedbviewer3.databasefile | | AlwaysInstall |
+ db4 | LiteDBViewer.Primary_output | litedbviewer4.databasefile | | AlwaysInstall |
@@ -3730,18 +3731,19 @@
IDS__TargetReq_DESC_RESOLUTION | 1033 | The screen resolution is not adequate for running [ProductName]. | 0 | | -2086347445 |
ID_STRING1 | 1033 | http://www.falahati.net | 0 | | -2086371957 |
ID_STRING2 | 1033 | Falahati.net | 0 | | -2086386293 |
- ID_STRING3 | 1033 | LiteDB Viewer 3 | 0 | | -920300433 |
- ID_STRING4 | 1033 | LiteDB Viewer 3 | 0 | | -920300433 |
- ID_STRING5 | 1033 | LiteDB Viewer 3 Installer | 0 | | -920296337 |
+ ID_STRING3 | 1033 | LiteDB Viewer 4 | 0 | | 1294272180 |
+ ID_STRING4 | 1033 | LiteDB Viewer 4 | 0 | | 1294276276 |
+ ID_STRING5 | 1033 | LiteDB Viewer 4 Installer | 0 | | 1294280372 |
ID_STRING6 | 1033 | Project's Github Page | 0 | | -2086363765 |
ID_STRING7 | 1033 | https://github.com/falahati/LiteDBViewer/issues | 0 | | -2086343285 |
- ID_STRING8 | 1033 | LITEDB~1|LiteDB Viewer 3 | 0 | | -920285647 |
+ ID_STRING8 | 1033 | LITEDB~1|LiteDB Viewer 4 | 0 | | 1294306996 |
IIDS_UITEXT_FeatureUninstalled | 1033 | This feature will remain uninstalled. | 0 | | -2086347445 |
NEW_STRING1 | 1033 | db | 0 | | -2086381524 |
NEW_STRING2 | 1033 | db3 | 0 | | -920264079 |
NEW_STRING3 | 1033 | db2 | 0 | | -920309103 |
NEW_STRING4 | 1033 | db3 | 0 | | -920305007 |
NEW_STRING5 | 1033 | db | 0 | | -920300911 |
+ NEW_STRING6 | 1033 | db4 | 0 | | 1294321332 |
@@ -3859,6 +3861,7 @@
_219C5000_4998_4C15_B805_57028684DB4C | | <VSSolutionFolder>\LiteDBViewer\logo.ico | 0 |
_447D0E92_67F0_4A84_B481_9D23D148B67A | | <VSSolutionFolder>\LiteDBViewer\logo.ico | 0 |
_5D5C1D88239E4E93AD3A586210514E6B.exe | | E:\Personal\Open-Source Projects\LiteDBViewer\LiteDBViewer\bin\Release\LiteDBViewer.exe | 0 |
+ _AB6DA949_CB70_4AD7_ABE9_A180C48741D7 | | <VSSolutionFolder>\LiteDBViewer\logo.ico | 0 |
_B998458B9BAB4CCCB4E32310C9CE2506.exe | | E:\Personal\Open-Source Projects\LiteDBViewer\LiteDBViewer\bin\Release\LiteDBViewer.exe | 0 |
_F094E218_E425_4B70_AC66_093EC1A36A9E | | <VSSolutionFolder>\LiteDBViewer\logo.ico | 0 |
_FD7293EB_5A56_41B8_A546_E4F5D75E382D | | [INSTALLDIR]LiteDBViewer.exe | 0 |
@@ -4295,7 +4298,7 @@ UwBpAG4AZwBsAGUASQBtAGEAZwBlAAEARQB4AHAAcgBlAHMAcwA=
Icon_
IconIndex
ISAttributes
- litedbviewer3.databasefile | | | LiteDB 3 Database | _219C5000_4998_4C15_B805_57028684DB4C | 0 | |
+ litedbviewer4.databasefile | | | LiteDB 4 Database | _AB6DA949_CB70_4AD7_ABE9_A180C48741D7 | 0 | |
litedbviewerversionselector.databasefile | | | LiteDB Database | _447D0E92_67F0_4A84_B481_9D23D148B67A | 0 | |
@@ -4376,9 +4379,9 @@ UwBpAG4AZwBsAGUASQBtAGEAZwBlAAEARQB4AHAAcgBlAHMAcwA=
PROGMSG_IIS_ROLLBACKVROOTS | ##IDS_PROGMSG_IIS_ROLLBACKVROOTS## | |
PROGMSG_IIS_ROLLBACKWEBSERVICEEXTENSIONS | ##IDS_PROGMSG_IIS_ROLLBACKWEBSERVICEEXTENSIONS## | |
PROGRAMFILETOLAUNCHATEND | [INSTALLDIR]LiteDBViewer.Primary output | |
- ProductCode | {6EFB147B-92A8-4F04-BE51-6D2A8EFB40F7} | |
- ProductName | LiteDB Viewer 3 | |
- ProductVersion | 3.0.1.0 | |
+ ProductCode | {6EFB147B-92A8-4F04-BE51-6D2A8EFB40F8} | |
+ ProductName | LiteDB Viewer 4 | |
+ ProductVersion | 4.0.0.0 | |
ProgressType0 | install | |
ProgressType1 | Installing | |
ProgressType2 | installed | |
@@ -4394,7 +4397,7 @@ UwBpAG4AZwBsAGUASQBtAGEAZwBlAAEARQB4AHAAcgBlAHMAcwA=
SecureCustomProperties | ISFOUNDNEWERPRODUCTVERSION;USERNAME;COMPANYNAME;ISX_SERIALNUM;SUPPORTDIR;DOTNETVERSION45FULL;ISACTIONPROP1 | |
SelectedSetupType | ##IDS__DisplayName_Typical## | |
SetupType | Typical | |
- UpgradeCode | {F00B78B2-02D6-4298-8D9B-D75F4CDFCAE0} | |
+ UpgradeCode | {F00B78B2-02D6-4298-8D9B-D75F4CDFCAE1} | |
_IsMaintenance | Change | |
_IsSetupTypeMin | Typical | |
@@ -4663,7 +4666,7 @@ UwBpAG4AZwBsAGUASQBtAGEAZwBlAAEARQB4AHAAcgBlAHMAcwA=
ActionProperty
ISDisplayName
{00000000-0000-0000-0000-000000000000} | ***ALL_VERSIONS*** | | | 2 | | ISFOUNDNEWERPRODUCTVERSION | ISPreventDowngrade |
- {F00B78B2-02D6-4298-8D9B-D75F4CDFCAE0} | 3.0.1.0 | 3.0.1.0 | 1033 | 256 | | ISACTIONPROP1 | UpgradeEntry |
+ {F00B78B2-02D6-4298-8D9B-D75F4CDFCAE1} | 4.0.0.0 | 4.0.0.0 | 1033 | 256 | | ISACTIONPROP1 | UpgradeEntry |
@@ -4673,7 +4676,7 @@ UwBpAG4AZwBsAGUASQBtAGEAZwBlAAEARQB4AHAAcgBlAHMAcwA=
Command
Argument
db | open | | View with LiteDB Viewer | "%1" |
- db3 | open | | View with LiteDB Viewer 3 | "%1" |
+ db4 | open | | View with LiteDB Viewer 4 | "%1" |
diff --git a/LiteDBViewer/LiteDB.Shell/Shell/Display.cs b/LiteDBViewer/LiteDB.Shell/Shell/Display.cs
deleted file mode 100644
index 3aa77c5..0000000
--- a/LiteDBViewer/LiteDB.Shell/Shell/Display.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-namespace LiteDB.Shell
-{
- public class Display
- {
- public BsonValue LastResult { get; private set; }
-
- public void WriteResult(BsonValue result)
- {
- LastResult = result;
- }
- }
-}
\ No newline at end of file
diff --git a/LiteDBViewer/LiteDB.Shell/Shell/Env.cs b/LiteDBViewer/LiteDB.Shell/Shell/Env.cs
deleted file mode 100644
index e926bda..0000000
--- a/LiteDBViewer/LiteDB.Shell/Shell/Env.cs
+++ /dev/null
@@ -1,7 +0,0 @@
-namespace LiteDB.Shell
-{
- public class Env
- {
-
- }
-}
\ No newline at end of file
diff --git a/LiteDBViewer/LiteDB.Shell/Shell/InputCommand.cs b/LiteDBViewer/LiteDB.Shell/Shell/InputCommand.cs
deleted file mode 100644
index 5425e8d..0000000
--- a/LiteDBViewer/LiteDB.Shell/Shell/InputCommand.cs
+++ /dev/null
@@ -1,7 +0,0 @@
-namespace LiteDB.Shell
-{
- public class InputCommand
- {
-
- }
-}
\ No newline at end of file
diff --git a/LiteDBViewer/LiteDBViewer.csproj b/LiteDBViewer/LiteDBViewer.csproj
index 2448ade..a3e5165 100644
--- a/LiteDBViewer/LiteDBViewer.csproj
+++ b/LiteDBViewer/LiteDBViewer.csproj
@@ -42,8 +42,8 @@
..\packages\JsonPrettyPrinter.1.0.1.1\lib\net35\JsonPrettyPrinterPlus.dll
True
-
- ..\packages\LiteDB.3.0.1\lib\net35\LiteDB.dll
+
+ ..\packages\LiteDB.4.0.0-beta2\lib\net40\LiteDB.dll
True
@@ -56,72 +56,6 @@
-
- LiteDB.Shell\Commands\Collections\BaseCollection.cs
-
-
- LiteDB.Shell\Commands\Collections\Bulk.cs
-
-
- LiteDB.Shell\Commands\Collections\Count.cs
-
-
- LiteDB.Shell\Commands\Collections\Delete.cs
-
-
- LiteDB.Shell\Commands\Collections\Drop.cs
-
-
- LiteDB.Shell\Commands\Collections\DropIndex.cs
-
-
- LiteDB.Shell\Commands\Collections\EnsureIndex.cs
-
-
- LiteDB.Shell\Commands\Collections\Find.cs
-
-
- LiteDB.Shell\Commands\Collections\Indexes.cs
-
-
- LiteDB.Shell\Commands\Collections\Insert.cs
-
-
- LiteDB.Shell\Commands\Collections\Max.cs
-
-
- LiteDB.Shell\Commands\Collections\Min.cs
-
-
- LiteDB.Shell\Commands\Collections\Rename.cs
-
-
- LiteDB.Shell\Commands\Collections\Update.cs
-
-
- LiteDB.Shell\Commands\ICommand.cs
-
-
- LiteDB.Shell\Commands\Storage\BaseStorage.cs
-
-
- LiteDB.Shell\Commands\Storage\Delete.cs
-
-
- LiteDB.Shell\Commands\Storage\Download.cs
-
-
- LiteDB.Shell\Commands\Storage\Find.cs
-
-
- LiteDB.Shell\Commands\Storage\Update.cs
-
-
- LiteDB.Shell\Commands\Storage\Upload.cs
-
-
- LiteDB.Shell\Utils\StringExtensions.cs
-
Form
@@ -140,9 +74,6 @@
DocumentViewForm.cs
-
-
-
Form
diff --git a/LiteDBViewer/MainForm.cs b/LiteDBViewer/MainForm.cs
index 5db7acd..ffabd3b 100644
--- a/LiteDBViewer/MainForm.cs
+++ b/LiteDBViewer/MainForm.cs
@@ -7,7 +7,6 @@
using System.Reflection;
using System.Windows.Forms;
using LiteDB;
-using LiteDB.Shell;
namespace LiteDBViewer
{
@@ -21,22 +20,7 @@ internal partial class MainForm : Form
new Dictionary();
private LiteDatabase _db;
-
- private static readonly List Commands = new List();
-
- static MainForm()
- {
- var type = typeof(ICommand);
- var types = typeof(ICommand).Assembly
- .GetTypes()
- .Where(p => type.IsAssignableFrom(p) && p.IsClass);
-
- foreach (var cmd in types)
- {
- Commands.Add(Activator.CreateInstance(cmd) as ICommand);
- }
- }
-
+
public MainForm(string fileName, string password = null, bool upgrade = false)
{
_encrypted = !string.IsNullOrWhiteSpace(password);
@@ -61,6 +45,12 @@ public MainForm(string fileName, string password = null, bool upgrade = false)
InitializeComponent();
txt_filename.Text = _fileName + (_encrypted ? " [ENCRYPTED]" : string.Empty);
+ RefreshCollections();
+ }
+
+ private void RefreshCollections()
+ {
+ lb_Collections.Items.Clear();
foreach (var collection in _db.GetCollectionNames())
{
if (!collection.Equals("_chunks") && !collection.Equals("_files"))
@@ -272,35 +262,15 @@ private void RunQuery(string query)
try
{
txt_query.Text = query;
- var resultHolder = new Display();
- var scanner = new StringScanner(query);
- var found = false;
-
- foreach (var command in Commands)
- {
- if (!command.IsCommand(scanner)) continue;
- command.Execute(_db.Engine, scanner, resultHolder, null, null);
- found = true;
- break;
- }
- if (!found) throw new Exception("Command not found.");
-
FillDataGridView(null);
- var rows = new List();
- if (resultHolder.LastResult.IsArray)
- {
- rows.AddRange(
- resultHolder.LastResult.AsArray.Select(
- item =>
- item.IsDocument
- ? item.AsDocument
- : new BsonDocument {{"RESULT", resultHolder.LastResult}}));
- }
- else
- {
- rows.Add(new BsonDocument { { "RESULT", resultHolder.LastResult } });
- }
- FillDataGridView(rows);
+ var results = _db.Engine.Run(query);
+ RefreshCollections();
+ FillDataGridView(
+ results.Select(
+ item =>
+ item.IsDocument
+ ? item.AsDocument
+ : new BsonDocument(new Dictionary {{"[Result]", item}})));
}
catch (Exception ex)
{
diff --git a/LiteDBViewer/Properties/AssemblyInfo.cs b/LiteDBViewer/Properties/AssemblyInfo.cs
index 23dc3cf..95f2994 100644
--- a/LiteDBViewer/Properties/AssemblyInfo.cs
+++ b/LiteDBViewer/Properties/AssemblyInfo.cs
@@ -5,11 +5,11 @@
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
-[assembly: AssemblyTitle("LiteDB Viewer 3")]
-[assembly: AssemblyDescription("LiteDB Viewer 3")]
+[assembly: AssemblyTitle("LiteDB Viewer 4")]
+[assembly: AssemblyDescription("LiteDB Viewer 4")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Soroush Falahati")]
-[assembly: AssemblyProduct("LiteDB Viewer 3")]
+[assembly: AssemblyProduct("LiteDB Viewer 4")]
[assembly: AssemblyCopyright("Copyright © Soroush Falahati 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@@ -35,5 +35,5 @@
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("3.0.1.0")]
-[assembly: AssemblyFileVersion("3.0.1.0")]
\ No newline at end of file
+[assembly: AssemblyVersion("4.0.0.0")]
+[assembly: AssemblyFileVersion("4.0.0.0")]
\ No newline at end of file
diff --git a/LiteDBViewer/packages.config b/LiteDBViewer/packages.config
index 85b4e6d..9079b3a 100644
--- a/LiteDBViewer/packages.config
+++ b/LiteDBViewer/packages.config
@@ -1,5 +1,5 @@
-
+
\ No newline at end of file
diff --git a/LiteDBViewerVersionSelector/LiteDBVersion.cs b/LiteDBViewerVersionSelector/LiteDBVersion.cs
index 149f592..353ceff 100644
--- a/LiteDBViewerVersionSelector/LiteDBVersion.cs
+++ b/LiteDBViewerVersionSelector/LiteDBVersion.cs
@@ -7,6 +7,7 @@ public enum LiteDBVersion
LiteDB_1_0,
LiteDB_2_0RC,
LiteDB_2_0,
- LiteDB_3_0
+ LiteDB_3_0,
+ LiteDB_4_0
}
}
\ No newline at end of file
diff --git a/LiteDBViewerVersionSelector/LiteDBViewerExecutionException.cs b/LiteDBViewerVersionSelector/LiteDBViewerExecutionException.cs
index 81d5709..3855102 100644
--- a/LiteDBViewerVersionSelector/LiteDBViewerExecutionException.cs
+++ b/LiteDBViewerVersionSelector/LiteDBViewerExecutionException.cs
@@ -31,6 +31,9 @@ private static string VersionToString(LiteDBVersion version)
case LiteDBVersion.LiteDB_3_0:
versionString = "LiteDBViewer v3.0";
break;
+ case LiteDBVersion.LiteDB_4_0:
+ versionString = "LiteDBViewer v4.0";
+ break;
}
return $"Can not find or execute the {versionString}. Please make sure that you have it installed.";
}
diff --git a/LiteDBViewerVersionSelector/Properties/AssemblyInfo.cs b/LiteDBViewerVersionSelector/Properties/AssemblyInfo.cs
index e98f256..a36c4f6 100644
--- a/LiteDBViewerVersionSelector/Properties/AssemblyInfo.cs
+++ b/LiteDBViewerVersionSelector/Properties/AssemblyInfo.cs
@@ -9,7 +9,7 @@
[assembly: AssemblyDescription("LiteDB Viewer Version Selector")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Soroush Falahati")]
-[assembly: AssemblyProduct("LiteDB Viewer 3")]
+[assembly: AssemblyProduct("LiteDB Viewer 4")]
[assembly: AssemblyCopyright("Copyright © Soroush Falahati 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
+[assembly: AssemblyVersion("1.1.0.0")]
+[assembly: AssemblyFileVersion("1.1.0.0")]
diff --git a/LiteDBViewerVersionSelector/VersionSelector.cs b/LiteDBViewerVersionSelector/VersionSelector.cs
index b0eb995..2b57cdc 100644
--- a/LiteDBViewerVersionSelector/VersionSelector.cs
+++ b/LiteDBViewerVersionSelector/VersionSelector.cs
@@ -30,6 +30,10 @@ public static LiteDBVersion GetFileVersion(string fileName)
{
return LiteDBVersion.LiteDB_3_0;
}
+ if (DetectIs40(fileName))
+ {
+ return LiteDBVersion.LiteDB_4_0;
+ }
return LiteDBVersion.Unknown;
}
@@ -49,6 +53,9 @@ public static void OpenLiteDBViewer(string[] fileNames, LiteDBVersion version)
case LiteDBVersion.LiteDB_3_0:
classId = "litedbviewer3.databasefile";
break;
+ case LiteDBVersion.LiteDB_4_0:
+ classId = "litedbviewer4.databasefile";
+ break;
default:
throw new LiteDBViewerExecutionException(version);
}
@@ -137,5 +144,19 @@ private static bool DetectIs30(string fileName)
}
return false;
}
+
+ private static bool DetectIs40(string fileName)
+ {
+ using (var s = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.Read))
+ {
+ var header = new byte[4096];
+ if (s.Length >= header.Length)
+ {
+ s.Read(header, 0, header.Length);
+ return header[52] == 7; // FILE_VERSION
+ }
+ }
+ return false;
+ }
}
}
\ No newline at end of file