StrokesPlus.net
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
Swagboy69  
#1 Posted : Tuesday, August 1, 2023 10:43:36 PM(UTC)
Swagboy69

Rank: Member

Reputation:

Groups: Approved
Joined: 8/31/2021(UTC)
Posts: 13
United States

Thanks: 1 times
Hi all,

I've had this occur twice now over the past few days - upon startup, I'll get a dialogue-box stating there's a problem with JSON and it will offer to re-create default settings. I'm sorry I wasn't able to screenshot it to get the exact message; I believe it said something about a "native" problem with JSON. I'm hoping perhaps this is a known issue, if not then I'll make sure to screenshot the message if/when it happens again. In the meantime, do you have any advice other than making sure I have backup copies of my settings file?

I've been using this app for a couple of years now, flawlessly. Thanks so much for your hard work.
Rob  
#2 Posted : Thursday, October 19, 2023 2:48:26 PM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 1,359
United States
Location: Tampa, FL

Thanks: 28 times
Was thanked: 419 time(s) in 356 post(s)
I have not heard of, nor seen that error before. Yes, if it happens again, try to grab a screenshot and check the Event Viewer as well, to see if anything shows in there.
jbt  
#3 Posted : Sunday, February 18, 2024 2:30:24 AM(UTC)
jbt

Rank: Newbie

Reputation:

Groups: Approved
Joined: 10/17/2022(UTC)
Posts: 1
United States

I have had that happen several times. I will post the error message next time it happens.
Rob  
#4 Posted : Sunday, February 18, 2024 1:22:30 PM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 1,359
United States
Location: Tampa, FL

Thanks: 28 times
Was thanked: 419 time(s) in 356 post(s)
I don't understand how it could happen, lol. I mean, I believe you folks, just that the code saves to a separate file, verifies the contents, then does a replace.

So I just don't know where the chance for data loss would even be.

I definitely recommend using something like this to make separate backups every time you close S+ - it's handy even if you accidentally need to go back to a previous copy of settings, it saves the last 3 months worth.

It makes a Backup folder alongside the StrokesPlus.net.json config file.
Code:
var source = System.IO.Path.Combine(System.Environment.GetFolderPath(clr.System.Environment.SpecialFolder.ApplicationData), "StrokesPlus.net", "StrokesPlus.net.json");
var destdir = System.IO.Path.Combine(System.Environment.GetFolderPath(clr.System.Environment.SpecialFolder.ApplicationData), "StrokesPlus.net", "Backup");
if (!System.IO.Directory.Exists(destdir)) System.IO.Directory.CreateDirectory(destdir);
var dest = System.IO.Path.Combine(destdir,"StrokesPlus.net_" + DateTime.Now.ToString("yyyy-MM-dd_HHmmss") + ".json");
//Copy the config file to the Backup folder
File.Copy(source, dest, true);

var files = System.IO.Directory.GetFiles(destdir);
for (i=0;i<files.Length;i++)
{
    var fi = new FileInfo(files[i]);
    //create new javascript based dates for proper comparison
    var lastAccessed = new Date(fi.LastAccessTime.Year, fi.LastAccessTime.Month, fi.LastAccessTime.Day, fi.LastAccessTime.Hour, fi.LastAccessTime.Minute, fi.LastAccessTime.Second);
    var currentDate = new Date(DateTime.Now.AddMonths(-3).Year, DateTime.Now.AddMonths(-3).Month, DateTime.Now.AddMonths(-3).Day, DateTime.Now.AddMonths(-3).Hour, DateTime.Now.AddMonths(-3).Minute, DateTime.Now.AddMonths(-3).Second);
    if (lastAccessed < currentDate){
        //Delete backups older than 3 months
        fi.Delete();
    }
}
Swagboy69  
#5 Posted : Sunday, March 10, 2024 6:31:44 PM(UTC)
Swagboy69

Rank: Member

Reputation:

Groups: Approved
Joined: 8/31/2021(UTC)
Posts: 13
United States

Thanks: 1 times
@Rob,

Here's some more information that might prove useful. So, the "corrupted JSON" message box error and then subsequent re-setting of all my custom settings/options happened to me twice. I'll try to walk you through it.

First time: My system had been infected with a trojan virus from a bad internet download. No big deal, it happens. I went through the usual process of removing the virus using Windows Security as well as precisely removing the infected files. Used Windows Security to reboot and cleanup any leftovers. When Windows subsequently "started-up", *that's* when the dialogue box with the StrokesPlus error message popped up (I have SP set to run on start-up).

Okay, so I go into the SP application folder, and notice several files starting with "StrokesPlus.net.json." followed by a lengthy string. Apparently, they are old copies of my settings file. I copy and paste the contents into the new JSON, save it, launch SP to check if SP will recognize it – it did. At this point, I've accepted that I'm just going to have to re-do all my missing gestures/text expansions/etc.

Second time: This occurred a day or two later. My PC had a power interruption/bad shutdown; upon re-starting, the same thing happened again (JSON error dialogue, settings loss.)

And then it stopped happening. No problems with re-starting my system normally, nor when re-starting after power loss or crash. I've since added the program's folder to my periodic backup software, so no big deal, but the JSON error was odd. It's more about my curiosity at this point.

I'll try your script above as well, never hurts to have more backups.
thepromises  
#6 Posted : Thursday, March 14, 2024 3:57:01 AM(UTC)
thepromises

Rank: Member

Reputation:

Groups: Approved
Joined: 6/14/2019(UTC)
Posts: 14
China

Thanks: 8 times
me too,Encountered the same problem~
Users browsing this topic
Guest (2)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.