home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
MediaPortal 1
MediaPortal 1 Plugins
Popular Plugins
My Emulators
(Old) My Emulators
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="gerikes" data-source="post: 264829" data-attributes="member: 74507"><p><strong>CANTOPEN change</strong></p><p></p><p>Hi all.</p><p></p><p>Thanks for all the work Chreekar, been using your plugin for a few months now, runs well.</p><p></p><p>I switched over to RC1 and I'm getting that same CANTOPEN problem. Here's what I did to fix it...</p><p></p><p>[code]Index: myEmulators/DB.cs</p><p>===================================================================</p><p>--- myEmulators/DB.cs (revision 1775)</p><p>+++ myEmulators/DB.cs (working copy)</p><p>@@ -40,7 +40,7 @@</p><p> </p><p> public static void launch()</p><p> {</p><p>- String path = Options.getMainFolder() + @"\database\" + dbName; </p><p>+ String path = Config.GetFile(Config.Dir.Database, dbName);</p><p> sqlDB = new SQLiteClient(path);</p><p> createDBs();</p><p> try</p><p>[/code]</p><p></p><p>Of course, the problem is that if someone is using an old database and switches to the new version, the path is changed and so their new database will not be found. Not sure how you want to go about this, maybe checking the old path for an existing database and copying it if found?</p><p></p><p></p><p><strong>Update</strong></p><p></p><p>Maybe even something like this?</p><p></p><p>[CODE]Index: myEmulators/DB.cs</p><p>===================================================================</p><p>--- myEmulators/DB.cs (revision 1775)</p><p>+++ myEmulators/DB.cs (working copy)</p><p>@@ -21,7 +21,10 @@</p><p> private static String tableOptionsName = "myEmulatorsOptions";</p><p> private static SQLiteClient sqlDB;</p><p> </p><p>- public enum SaveInfo</p><p>+ private static String oldDatabaseFilename = Options.getMainFolder() + @"\database\" + dbName;</p><p>+ private static String newDatabaseFilename = Config.GetFile(Config.Dir.Database, dbName);</p><p>+</p><p>+ public enum SaveInfo</p><p> {</p><p> ALL,</p><p> ONLY_VERSION_INFO,</p><p>@@ -40,8 +43,9 @@</p><p> </p><p> public static void launch()</p><p> {</p><p>- String path = Options.getMainFolder() + @"\database\" + dbName; </p><p>- sqlDB = new SQLiteClient(path);</p><p>+ CopyOldDatabaseIfFound();</p><p>+</p><p>+ sqlDB = new SQLiteClient(newDatabaseFilename);</p><p> createDBs();</p><p> try</p><p> {</p><p>@@ -146,6 +150,16 @@</p><p> }</p><p> }</p><p> </p><p>+ // Copy a users database from the old place where databases were found.</p><p>+ private static void CopyOldDatabaseIfFound()</p><p>+ {</p><p>+ if (File.Exists(oldDatabaseFilename) &&</p><p>+ File.Exists(newDatabaseFilename) == false)</p><p>+ {</p><p>+ File.Copy(oldDatabaseFilename, newDatabaseFilename);</p><p>+ }</p><p>+ }</p><p>+</p><p> private static void createDBs()</p><p> {</p><p> //DatabaseUtility.SetPragmas(sqlDB);</p><p>[/CODE]</p></blockquote><p></p>
[QUOTE="gerikes, post: 264829, member: 74507"] [b]CANTOPEN change[/b] Hi all. Thanks for all the work Chreekar, been using your plugin for a few months now, runs well. I switched over to RC1 and I'm getting that same CANTOPEN problem. Here's what I did to fix it... [code]Index: myEmulators/DB.cs =================================================================== --- myEmulators/DB.cs (revision 1775) +++ myEmulators/DB.cs (working copy) @@ -40,7 +40,7 @@ public static void launch() { - String path = Options.getMainFolder() + @"\database\" + dbName; + String path = Config.GetFile(Config.Dir.Database, dbName); sqlDB = new SQLiteClient(path); createDBs(); try [/code] Of course, the problem is that if someone is using an old database and switches to the new version, the path is changed and so their new database will not be found. Not sure how you want to go about this, maybe checking the old path for an existing database and copying it if found? [b]Update[/b] Maybe even something like this? [CODE]Index: myEmulators/DB.cs =================================================================== --- myEmulators/DB.cs (revision 1775) +++ myEmulators/DB.cs (working copy) @@ -21,7 +21,10 @@ private static String tableOptionsName = "myEmulatorsOptions"; private static SQLiteClient sqlDB; - public enum SaveInfo + private static String oldDatabaseFilename = Options.getMainFolder() + @"\database\" + dbName; + private static String newDatabaseFilename = Config.GetFile(Config.Dir.Database, dbName); + + public enum SaveInfo { ALL, ONLY_VERSION_INFO, @@ -40,8 +43,9 @@ public static void launch() { - String path = Options.getMainFolder() + @"\database\" + dbName; - sqlDB = new SQLiteClient(path); + CopyOldDatabaseIfFound(); + + sqlDB = new SQLiteClient(newDatabaseFilename); createDBs(); try { @@ -146,6 +150,16 @@ } } + // Copy a users database from the old place where databases were found. + private static void CopyOldDatabaseIfFound() + { + if (File.Exists(oldDatabaseFilename) && + File.Exists(newDatabaseFilename) == false) + { + File.Copy(oldDatabaseFilename, newDatabaseFilename); + } + } + private static void createDBs() { //DatabaseUtility.SetPragmas(sqlDB); [/CODE] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 1
MediaPortal 1 Plugins
Popular Plugins
My Emulators
(Old) My Emulators
Contact us
RSS
Top
Bottom