Answered by:
Forgot to save Small Basic program - How do I recover it?

Question
-
So recently I made quite a long small basic program, but like an idiot, I forgot to save it. Instead of the improved program, I've got an older version of it which I had saved earlier. However, I ran the program before closing it so now I have a .exe file with the newer version.
Is there any way I could turn this .exe back into a sb file? Or is there some temp folder where I could find the program? I want to work on this program more, as I hadn't finished it and I was wondering if there was any way to recover it.
Wednesday, May 30, 2018 12:59 PM
Answers
-
Not really I don't think so.
You can get something from the exe using ILSpy (google for it if you want to try this) but not the original code (it will be in C# or VB equivalent), it might look like this from which you could with a bit of work try to get some back, perhaps enough to remind you waht you did.
// _SmallBasicProgram static void _Main() { SmallBasicApplication.BeginProgram(); _SmallBasicProgram.i = 1.0; while (Primitive.ConvertToBoolean(_SmallBasicProgram.i <= 10.0)) { _SmallBasicProgram.list1 = Primitive.SetArrayValue(Microsoft.SmallBasic.Library.Math.GetRandomNumber(10.0), _SmallBasicProgram.list1, _SmallBasicProgram.i); _SmallBasicProgram.i += 1.0; } while (true) { _SmallBasicProgram.testmatch(); TextWindow.ForegroundColor = "Red"; TextWindow.WriteLine("There are " + _SmallBasicProgram.count + " matches."); TextWindow.ForegroundColor = "White"; _SmallBasicProgram.i = 1.0; while (Primitive.ConvertToBoolean(_SmallBasicProgram.i <= 10.0)) { TextWindow.WriteLine("List1= " + Primitive.GetArrayValue(_SmallBasicProgram.list1, _SmallBasicProgram.i) + " : List2= " + Primitive.GetArrayValue(_SmallBasicProgram.list2, _SmallBasicProgram.i)); _SmallBasicProgram.i += 1.0; } Program.Delay(100.0); } }
// _SmallBasicProgram
static void testmatch() { _SmallBasicProgram.count = 0.0; _SmallBasicProgram.i = 1.0; while (Primitive.ConvertToBoolean(_SmallBasicProgram.i <= 10.0)) { _SmallBasicProgram.list2 = Primitive.SetArrayValue(Microsoft.SmallBasic.Library.Math.GetRandomNumber(10.0), _SmallBasicProgram.list2, _SmallBasicProgram.i); if (Primitive.ConvertToBoolean(Primitive.GetArrayValue(_SmallBasicProgram.list1, _SmallBasicProgram.i) == Primitive.GetArrayValue(_SmallBasicProgram.list2, _SmallBasicProgram.i))) { _SmallBasicProgram.count += 1.0; } _SmallBasicProgram.i += 1.0; } }
- Proposed as answer by Nonki Takahashi Saturday, June 9, 2018 3:29 AM
- Marked as answer by WhTurner33Editor Sunday, June 17, 2018 11:18 AM
Wednesday, May 30, 2018 7:30 PM
All replies
-
Not really I don't think so.
You can get something from the exe using ILSpy (google for it if you want to try this) but not the original code (it will be in C# or VB equivalent), it might look like this from which you could with a bit of work try to get some back, perhaps enough to remind you waht you did.
// _SmallBasicProgram static void _Main() { SmallBasicApplication.BeginProgram(); _SmallBasicProgram.i = 1.0; while (Primitive.ConvertToBoolean(_SmallBasicProgram.i <= 10.0)) { _SmallBasicProgram.list1 = Primitive.SetArrayValue(Microsoft.SmallBasic.Library.Math.GetRandomNumber(10.0), _SmallBasicProgram.list1, _SmallBasicProgram.i); _SmallBasicProgram.i += 1.0; } while (true) { _SmallBasicProgram.testmatch(); TextWindow.ForegroundColor = "Red"; TextWindow.WriteLine("There are " + _SmallBasicProgram.count + " matches."); TextWindow.ForegroundColor = "White"; _SmallBasicProgram.i = 1.0; while (Primitive.ConvertToBoolean(_SmallBasicProgram.i <= 10.0)) { TextWindow.WriteLine("List1= " + Primitive.GetArrayValue(_SmallBasicProgram.list1, _SmallBasicProgram.i) + " : List2= " + Primitive.GetArrayValue(_SmallBasicProgram.list2, _SmallBasicProgram.i)); _SmallBasicProgram.i += 1.0; } Program.Delay(100.0); } }
// _SmallBasicProgram
static void testmatch() { _SmallBasicProgram.count = 0.0; _SmallBasicProgram.i = 1.0; while (Primitive.ConvertToBoolean(_SmallBasicProgram.i <= 10.0)) { _SmallBasicProgram.list2 = Primitive.SetArrayValue(Microsoft.SmallBasic.Library.Math.GetRandomNumber(10.0), _SmallBasicProgram.list2, _SmallBasicProgram.i); if (Primitive.ConvertToBoolean(Primitive.GetArrayValue(_SmallBasicProgram.list1, _SmallBasicProgram.i) == Primitive.GetArrayValue(_SmallBasicProgram.list2, _SmallBasicProgram.i))) { _SmallBasicProgram.count += 1.0; } _SmallBasicProgram.i += 1.0; } }
- Proposed as answer by Nonki Takahashi Saturday, June 9, 2018 3:29 AM
- Marked as answer by WhTurner33Editor Sunday, June 17, 2018 11:18 AM
Wednesday, May 30, 2018 7:30 PM -
Take this as a lesson to save frequently. I got a good lesson like that in 1994. About 4 days after a strong earthquake I finally got back to programming and a strong aftershock hit that knocked my computer around (literally) and I lost about 5 hours of work. I even had a battery backup but that was no help. So from now on you will remember to save frequently.
Sam Hobbs
SimpleSamples.InfoWednesday, May 30, 2018 10:35 PM -
Thanks! I managed to get it back in VB and I'll work with that.
Thursday, May 31, 2018 12:07 PM