From 6975f7385040d49543751b5184dbbcb4d91c2603 Mon Sep 17 00:00:00 2001 From: pfg github Date: Sun, 15 Mar 2015 09:52:07 -0700 Subject: [PATCH 1/5] Added Paths module --- ShiftOS/Colour Picker.vb | 11 +++++++---- ShiftOS/NewAPI.vb | 1 + ShiftOS/Paths.vb | 19 +++++++++++++++++++ ShiftOS/ShiftOSDesktop.vb | 13 +++++++------ ShiftOS/skins.vb | 16 ++++++++++++---- 5 files changed, 46 insertions(+), 14 deletions(-) create mode 100644 ShiftOS/Paths.vb diff --git a/ShiftOS/Colour Picker.vb b/ShiftOS/Colour Picker.vb index ee4676c..3f49fe3 100644 --- a/ShiftOS/Colour Picker.vb +++ b/ShiftOS/Colour Picker.vb @@ -382,9 +382,12 @@ End Sub Private Sub Clock_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing - ShiftOSDesktop.programsopen = ShiftOSDesktop.programsopen - 1 - Me.Hide() - ShiftOSDesktop.setuppanelbuttons() + Try + ShiftOSDesktop.programsopen = ShiftOSDesktop.programsopen - 1 + Me.Hide() + ShiftOSDesktop.setuppanelbuttons() + Catch + End Try End Sub 'end of general setup @@ -2046,7 +2049,7 @@ ShiftOSDesktop.lastcolourpick = pnlnewcolour.BackColor Shifter.setuppreshifterstuff() End If - + Me.Close() End Sub diff --git a/ShiftOS/NewAPI.vb b/ShiftOS/NewAPI.vb index 0ff7e43..2a5b7fb 100644 --- a/ShiftOS/NewAPI.vb +++ b/ShiftOS/NewAPI.vb @@ -2,6 +2,7 @@ Private Command As String Private NewModForm As New ModForm + Public Sub UseCode(ByVal Path As String) Dim sr As System.IO.StreamReader diff --git a/ShiftOS/Paths.vb b/ShiftOS/Paths.vb new file mode 100644 index 0000000..efba3dd --- /dev/null +++ b/ShiftOS/Paths.vb @@ -0,0 +1,19 @@ +Module Paths + Public root As String = "C:\ShiftOS\" + + Public progdata As String = "C:\ShiftOS\SoftwareData\" + + Public advdata As String = "C:\ShiftOS\SoftwareData\AdvStart\" + Public kidata As String = "C:\ShiftOS\SoftwareData\KnowledgeInput\" + Public shiftnetdata As String = "C:\ShiftOS\SoftwareData\Shiftnet\" + Public dnldata As String = "C:\ShiftOS\SoftwareData\DownloadManager\" + + Public savedata As String = "C:\ShiftOS\Shiftum42\" + + Public home As String = "C:\ShiftOS\Home\" + Public desktop As String = "C:\ShiftOS\Home\Desktop\" + Public documents As String = "C:\ShiftOS\Home\Documents\" + Public music As String = "C:\ShiftOS\Home\Music\" + Public pictures As String = "C:\ShiftOS\Home\Pictures\" + Public skins As String = "C:\ShiftOS\Home\Skins\" +End Module diff --git a/ShiftOS/ShiftOSDesktop.vb b/ShiftOS/ShiftOSDesktop.vb index 063cd03..6905ca0 100644 --- a/ShiftOS/ShiftOSDesktop.vb +++ b/ShiftOS/ShiftOSDesktop.vb @@ -15,7 +15,7 @@ Public newgame As Boolean = False Public lastcolourpick As Color = Color.Gray Public programsopen As Integer = 0 - Public ShiftOSPath As String = "C:\ShiftOS\" + Public ShiftOSPath As String = "C:\ShiftOS" Private actualshiftversion As String = "0.0.8" Public ingameversion As String = "0.0.1.0" @@ -1063,15 +1063,15 @@ If boughtdesktopicons = True Then savelines(614) = 11 Else savelines(614) = 10 If boughtadvapplauncher = True Then savelines(615) = 11 Else savelines(615) = 10 IO.File.WriteAllLines(ShiftOSPath + "Shiftum42\Drivers\HDD.dri", savelines) - File_Crypt.EncryptFile(ShiftOSPath + "Shiftum42\Drivers\HDD.dri", "C:/ShiftOS/Shiftum42/SKernal.sft", sSecretKey) + File_Crypt.EncryptFile(ShiftOSPath + "Shiftum42\Drivers\HDD.dri", "C:\ShiftOS\Shiftum42\SKernal.sft", sSecretKey) Try - Dim sw As New IO.StreamWriter(ShiftOSPath & "SoftwareData\DownloadManager\Downloadhistory.lst") + Dim sw As New IO.StreamWriter(Paths.dnldata & "Downloadhistory.lst") sw.Write(downloadmanagerhistory) sw.Close() Catch ex As Exception End Try - Dim objWriter As New System.IO.StreamWriter("C:/ShiftOS/Shiftum42/HDAccess.sft", False) + Dim objWriter As New System.IO.StreamWriter(Paths.savedata & "HDAccess.sft", False) objWriter.Write(actualshiftversion) objWriter.Close() @@ -1090,8 +1090,8 @@ End Sub Private Sub loadgame() - File_Crypt.DecryptFile("C:/ShiftOS/Shiftum42/SKernal.sft", ShiftOSPath + "Shiftum42\Drivers\HDD.dri", sSecretKey) - loadlines = IO.File.ReadAllLines(ShiftOSPath + "Shiftum42\Drivers\HDD.dri") + File_Crypt.DecryptFile(Paths.savedata & "SKernal.sft", Paths.savedata & "Drivers\HDD.dri", sSecretKey) + loadlines = IO.File.ReadAllLines(Paths.savedata & "Drivers\HDD.dri") If loadlines(0) = 11 Then boughttitlebar = True Else boughttitlebar = False If loadlines(1) = 11 Then boughtgray = True Else boughtgray = False @@ -5077,6 +5077,7 @@ hideStart() Else infobox.showinfo("Error", "Could not find app 'Pong'.") + End If End Sub Private Sub KnowledgeInputToolStripMenuItem1_Click(sender As Object, e As EventArgs) Handles KnowledgeInputToolStripMenuItem1.Click diff --git a/ShiftOS/skins.vb b/ShiftOS/skins.vb index ef2f9f1..4988ac4 100644 --- a/ShiftOS/skins.vb +++ b/ShiftOS/skins.vb @@ -409,6 +409,7 @@ Module Skins If Not loaddata(109) = "" Then enablebordercorners = loaddata(109) 'for adding extra features, check: + If loaddata(110) = "" Or loaddata(110) = "End of skin data" Then loaddata(110) = enabledraggableicons Else enabledraggableicons = loaddata(110) If loaddata(111) = "" Or loaddata(111) = "End of skin data" Then loaddata(111) = icontextcolor.ToArgb Else icontextcolor = Color.FromArgb(loaddata(111)) If loaddata(112) = "" Or loaddata(112) = "End of skin data" Then loaddata(112) = showicons Else showicons = loaddata(112) @@ -420,10 +421,17 @@ Module Skins If loaddata(118) = "" Then startWidth = 320 Else startWidth = loaddata(118) If loaddata(119) = "" Then shutdownstring = "Shut Down ShiftOS" Else shutdownstring = loaddata(119) If loaddata(120) = "" Then userNamePosition = "Middle, Right" Else userNamePosition = loaddata(200) - If loaddata(121) = "" Then recentIconsHorizontal = False Else recentIconsHorizontal = loaddata(201) - If loaddata(122) = "" Then usernametextcolor = Color.White Else usernametextcolor = Color.FromArgb(loaddata(202)) - If loaddata(123) = "" Then usernamefont = "Trebuchet MS" Else usernamefont = loaddata(203) - If loaddata(124) = "" Then usernamefontsize = 12 Else usernamefontsize = loaddata(204) + Try + If loaddata(121) = "" Then recentIconsHorizontal = False Else recentIconsHorizontal = loaddata(201) + If loaddata(122) = "" Then usernametextcolor = Color.White Else usernametextcolor = Color.FromArgb(loaddata(202)) + If loaddata(123) = "" Then usernamefont = "Trebuchet MS" Else usernamefont = loaddata(203) + If loaddata(124) = "" Then usernamefontsize = 12 Else usernamefontsize = loaddata(204) + Catch + usernametextcolor = Color.White + usernamefont = "Trebuchet MS" + recentIconsHorizontal = False + usernamefontsize = 12 + End Try If loaddata(125) = "" Then usernamefontstyle = FontStyle.Bold Else usernamefontstyle = loaddata(125) If loaddata(126) = "" Then userNamePanelBackgroundColor = Color.Gray Else userNamePanelBackgroundColor = Color.FromArgb(loaddata(126)) If loaddata(127) = "" Then powerPanelBackgroundColor = Color.Gray Else powerPanelBackgroundColor = Color.FromArgb(loaddata(127)) From 93d9d339a28f537c4c05d5a6339c60f6429293e8 Mon Sep 17 00:00:00 2001 From: pfg github Date: Sun, 15 Mar 2015 10:12:29 -0700 Subject: [PATCH 2/5] Added some comments --- ShiftOS/Paths.vb | 51 ++++++++++++++++++++++++++++++++++++------------ 1 file changed, 38 insertions(+), 13 deletions(-) diff --git a/ShiftOS/Paths.vb b/ShiftOS/Paths.vb index efba3dd..57bb689 100644 --- a/ShiftOS/Paths.vb +++ b/ShiftOS/Paths.vb @@ -1,19 +1,44 @@ Module Paths - Public root As String = "C:\ShiftOS\" - Public progdata As String = "C:\ShiftOS\SoftwareData\" - Public advdata As String = "C:\ShiftOS\SoftwareData\AdvStart\" - Public kidata As String = "C:\ShiftOS\SoftwareData\KnowledgeInput\" - Public shiftnetdata As String = "C:\ShiftOS\SoftwareData\Shiftnet\" - Public dnldata As String = "C:\ShiftOS\SoftwareData\DownloadManager\" - Public savedata As String = "C:\ShiftOS\Shiftum42\" + ' Paths: + ' Root path - Paths.root - DO NOT USE UNLESS NECISARY (Opening files from the file skimmer, blocking the user from going above C:\ShiftOS, ect) + ' Software Data - Paths.progdata - This is the base path for all program data. If you are adding a folder to this path, add a variable in here + ' AdvStart - Paths.advdata - I'm not fully sure what this does + ' Knowledge Input Data - Paths.kidata - Knowledge Input uses this to save your lists of words you've found + ' Shiftnet Data - Paths.shiftnetdata - This is where the shiftnet currently saves it's history + ' Download Manager Data - Paths.dnldata - Not sure what this does + ' Save Data - Paths.savedata - The game has it's save file in here + ' Home Directory - Paths.home - This is the folder that contains all the user's files + ' Desktop - Paths.desktop - All the files that appear on your desktop should be stored here + ' Documents - Paths.documents - The documents folder is where the user puts their documents + ' Downloads - Paths.downloads - The downloads folder is where the downloader downloads downloads from the Shiftnet + ' Music - Paths.music - The music folder is where the user puts their music + ' Pictures - Paths.pictures - The pictures folder is where the user puts their pictures + ' Skins - Paths.skins - The skins folder is where the user puts their skins - Public home As String = "C:\ShiftOS\Home\" - Public desktop As String = "C:\ShiftOS\Home\Desktop\" - Public documents As String = "C:\ShiftOS\Home\Documents\" - Public music As String = "C:\ShiftOS\Home\Music\" - Public pictures As String = "C:\ShiftOS\Home\Pictures\" - Public skins As String = "C:\ShiftOS\Home\Skins\" + + + + + Public root As String = "C:\ShiftOS\" 'Do NOT use this unless it is for files that must go DIRECTLY in C:\ShiftOS\ + + Public progdata As String = root & "SoftwareData\" + + Public advdata As String = progdata & "AdvStart\" + Public kidata As String = progdata & "KnowledgeInput\" + Public shiftnetdata As String = progdata & "Shiftnet\" + Public dnldata As String = progdata & "DownloadManager\" + + Public savedata As String = root & "Shiftum42\" + + Public home As String = root & "Home\" + + Public desktop As String = home & "Desktop\" + Public documents As String = home & "Documents\" + Public downloads As String = home & "Documents\" + Public music As String = home & "Music\" + Public pictures As String = home & "Pictures\" + Public skins As String = home & "Skins\" End Module From 077550eb5e3da9876ebf49748787c68e9ed356a3 Mon Sep 17 00:00:00 2001 From: pfg github Date: Sun, 15 Mar 2015 10:18:36 -0700 Subject: [PATCH 3/5] Include Paths.vb --- ShiftOS/ShiftOS.vbproj | 1 + 1 file changed, 1 insertion(+) diff --git a/ShiftOS/ShiftOS.vbproj b/ShiftOS/ShiftOS.vbproj index feb32d7..4b87850 100644 --- a/ShiftOS/ShiftOS.vbproj +++ b/ShiftOS/ShiftOS.vbproj @@ -244,6 +244,7 @@ Form + ProgressBarEX.vb From b107f2e8fdd56a3131a6f0c19d4d7cb1e4ddaca0 Mon Sep 17 00:00:00 2001 From: rhobar Date: Sun, 15 Mar 2015 17:49:43 +0000 Subject: [PATCH 4/5] Game-saving issue fixed. --- ShiftOS/ShiftOSDesktop.vb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ShiftOS/ShiftOSDesktop.vb b/ShiftOS/ShiftOSDesktop.vb index 6905ca0..cc6cdeb 100644 --- a/ShiftOS/ShiftOSDesktop.vb +++ b/ShiftOS/ShiftOSDesktop.vb @@ -1062,8 +1062,8 @@ SortOutBooleans(WebBrowserCorrupted, 613, False) If boughtdesktopicons = True Then savelines(614) = 11 Else savelines(614) = 10 If boughtadvapplauncher = True Then savelines(615) = 11 Else savelines(615) = 10 - IO.File.WriteAllLines(ShiftOSPath + "Shiftum42\Drivers\HDD.dri", savelines) - File_Crypt.EncryptFile(ShiftOSPath + "Shiftum42\Drivers\HDD.dri", "C:\ShiftOS\Shiftum42\SKernal.sft", sSecretKey) + IO.File.WriteAllLines(ShiftOSPath + "\Shiftum42\Drivers\HDD.dri", savelines) + File_Crypt.EncryptFile(ShiftOSPath + "\Shiftum42\Drivers\HDD.dri", "C:\ShiftOS\Shiftum42\SKernal.sft", sSecretKey) Try Dim sw As New IO.StreamWriter(Paths.dnldata & "Downloadhistory.lst") sw.Write(downloadmanagerhistory) From dda2964b748eafb3ff1105966f8a349069834cc0 Mon Sep 17 00:00:00 2001 From: rhobar Date: Sun, 15 Mar 2015 17:56:53 +0000 Subject: [PATCH 5/5] Game-saving issue fixed #2. --- ShiftOS/ShiftOSDesktop.vb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ShiftOS/ShiftOSDesktop.vb b/ShiftOS/ShiftOSDesktop.vb index cc6cdeb..429055f 100644 --- a/ShiftOS/ShiftOSDesktop.vb +++ b/ShiftOS/ShiftOSDesktop.vb @@ -1062,8 +1062,8 @@ SortOutBooleans(WebBrowserCorrupted, 613, False) If boughtdesktopicons = True Then savelines(614) = 11 Else savelines(614) = 10 If boughtadvapplauncher = True Then savelines(615) = 11 Else savelines(615) = 10 - IO.File.WriteAllLines(ShiftOSPath + "\Shiftum42\Drivers\HDD.dri", savelines) - File_Crypt.EncryptFile(ShiftOSPath + "\Shiftum42\Drivers\HDD.dri", "C:\ShiftOS\Shiftum42\SKernal.sft", sSecretKey) + IO.File.WriteAllLines(Paths.savedata & "Drivers\HDD.dri", savelines) + File_Crypt.EncryptFile(Paths.savedata & "Drivers\HDD.dri", Paths.savedata & "SKernal.sft", sSecretKey) Try Dim sw As New IO.StreamWriter(Paths.dnldata & "Downloadhistory.lst") sw.Write(downloadmanagerhistory)