why use for loops when you can just import system.io also fixed some paths, stopped for the skinning problem

This commit is contained in:
pfg github 2015-03-16 08:43:36 -07:00
parent 3fbfbbdb0e
commit 91604723d5
4 changed files with 105 additions and 91 deletions

View file

@ -589,16 +589,28 @@ Public Class File_Skimmer
infobox.textinfo = "Unable to move into a higher directory due to error reading the requested folder on the drive." & Environment.NewLine & Environment.NewLine & "You can only enter directories formatted in the ShiftOS file system (ShiftFS)" infobox.textinfo = "Unable to move into a higher directory due to error reading the requested folder on the drive." & Environment.NewLine & Environment.NewLine & "You can only enter directories formatted in the ShiftOS file system (ShiftFS)"
infobox.Show() infobox.Show()
Else Else
Dim endloop As Boolean = False Dim directoryInfo As System.IO.DirectoryInfo
lbllocation.Text = lbllocation.Text.Substring(0, lbllocation.Text.Length - 1) directoryInfo = System.IO.Directory.GetParent(lbllocation.Text)
If (directoryInfo.FullName = "C:\") Then Dim errerror As String = "an error" Else lbllocation.Text = directoryInfo.FullName
'Dim endloop As Boolean = False
'lbllocation.Text = lbllocation.Text.Substring(0, lbllocation.Text.Length - 1)
'While endloop = False
' Try
' If lbllocation.Text.Substring(lbllocation.Text.Length - 1) = "/" Then
' endloop = True
' Else
' lbllocation.Text = lbllocation.Text.Substring(0, lbllocation.Text.Length - 1)
' End If
' Catch
' infobox.title = "File Skimmer - Error!"
' infobox.textinfo = "Unable to move into a higher directory due to error reading the requested folder on the drive." & Environment.NewLine & Environment.NewLine & "An error occured going up"
' infobox.Show()
' End Try
'End While
While endloop = False
If lbllocation.Text.Substring(lbllocation.Text.Length - 1) = "/" Then
endloop = True
Else
lbllocation.Text = lbllocation.Text.Substring(0, lbllocation.Text.Length - 1)
End If
End While
showcontents() showcontents()
End If End If
Else Else

View file

@ -11,8 +11,9 @@
' Download Manager Data - Paths.dnldata - Not sure what this does ' Download Manager Data - Paths.dnldata - Not sure what this does
' Save Data - Paths.savedata - The game has it's save file in here ' Save Data - Paths.savedata - The game has it's save file in here
' Skin Directory - Paths.skindir - Self explanatory. ' Skin Directory - Paths.skindir - Self explanatory.
' Loaded Skin Directory - Paths.loadedSkin - Where the contents of .skn files are extracted to. ' Loaded Skin Directory - Paths.loadedskin - Where the contents of .skn files are extracted to.
' Sound Directory - Paths.sounddir - Where sound files (such as Infobox chime) are stored, coming soon. ' Sound Directory - Paths.sounddir - Where sound files (such as Infobox chime) are stored, coming soon.
' Current Skin Directory - Paths.currentskin - ??????????
' Home Directory - Paths.home - This is the folder that contains all the user's files ' 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 ' 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 ' Documents - Paths.documents - The documents folder is where the user puts their documents
@ -39,6 +40,7 @@
Public skindir As String = savedata & "Skins\" Public skindir As String = savedata & "Skins\"
Public loadedskin As String = skindir & "Loaded\" Public loadedskin As String = skindir & "Loaded\"
Public currentskin As String = skindir & "Current\"
Public sounddir As String = loadedskin & "Sound Files\" Public sounddir As String = loadedskin & "Sound Files\"

View file

@ -1588,9 +1588,9 @@
boughtadvapplauncher = False boughtadvapplauncher = False
End Try End Try
Viruses.startactiveviruses() Viruses.startactiveviruses()
If IO.File.Exists(ShiftOSPath + "Shiftum42\Skins\Current\skindata.dat") Then loadcurrentskin() If IO.File.Exists(Paths.loadedskin & "skindata.dat") Then loadcurrentskin() ' FIXME (ShiftOSPath + "Shiftum42\Skins\Current\skindata.dat")
If My.Computer.FileSystem.DirectoryExists(ShiftOSPath + "Shiftum42\Icons") Then setupicons() If My.Computer.FileSystem.DirectoryExists(Paths.savedata & "Icons") Then setupicons()
If IO.File.Exists(ShiftOSPath & "SoftwareData\DownloadManager\Downloadhistory.lst") Then downloadmanagerhistory = IO.File.ReadAllText(ShiftOSPath & "SoftwareData\DownloadManager\Downloadhistory.lst") If IO.File.Exists(Paths.dnldata & "Downloadhistory.lst") Then downloadmanagerhistory = IO.File.ReadAllText(ShiftOSPath & "\SoftwareData\DownloadManager\Downloadhistory.lst")
End Sub End Sub
Private Sub ShiftOSDesktop_Load(sender As Object, e As EventArgs) Handles MyBase.Load Private Sub ShiftOSDesktop_Load(sender As Object, e As EventArgs) Handles MyBase.Load
@ -1599,7 +1599,7 @@
savegame() savegame()
Else Else
loadgame() loadgame()
Terminal.runterminalfile(ShiftOSPath + "Shiftum42\autorun.trm") Terminal.runterminalfile(ShiftOSPath + "\Shiftum42\autorun.trm")
End If End If
If Not My.Computer.FileSystem.DirectoryExists(ShiftOSPath + "\SoftwareData\AdvStart\Recent") Then If Not My.Computer.FileSystem.DirectoryExists(ShiftOSPath + "\SoftwareData\AdvStart\Recent") Then
@ -1617,7 +1617,7 @@
End Sub End Sub
Public Sub loadcurrentskin() Public Sub loadcurrentskin()
skinlines = IO.File.ReadAllLines(ShiftOSPath + "Shiftum42\Skins\Current\skindata.dat") skinlines = IO.File.ReadAllLines(Paths.loadedskin & "skindata.dat")
titlebarcolour = Color.FromArgb(skinlines(0)) titlebarcolour = Color.FromArgb(skinlines(0))
windowbordercolour = Color.FromArgb(skinlines(1)) windowbordercolour = Color.FromArgb(skinlines(1))
windowbordersize = skinlines(2) windowbordersize = skinlines(2)
@ -1811,8 +1811,8 @@
If Labyrinth.Visible Then Labyrinth.setupall() If Labyrinth.Visible Then Labyrinth.setupall()
If VirusScanner.Visible Then VirusScanner.setupall() If VirusScanner.Visible Then VirusScanner.setupall()
If terminalfullscreen = False Then Terminal.setupall() If terminalfullscreen = False Then Terminal.setupall()
If Not My.Computer.FileSystem.DirectoryExists(ShiftOSPath & "/Home/Desktop") Then If Not My.Computer.FileSystem.DirectoryExists(ShiftOSPath & "\Home\Desktop") Then
IO.Directory.CreateDirectory(ShiftOSPath & "/Home/Desktop") IO.Directory.CreateDirectory(ShiftOSPath & "\Home\Desktop")
End If End If
'Desktop Icons 'Desktop Icons
If unitymode = False Then If unitymode = False Then
@ -4098,14 +4098,14 @@
'End Sub 'End Sub
Public Sub setupiconprocess(ByVal location As String, ByRef imagetochange As Image) Public Sub setupiconprocess(ByVal location As String, ByRef imagetochange As Image)
If IO.File.Exists(ShiftOSPath + "Shiftum42\Icons\" & location & ".pic") Then If IO.File.Exists(ShiftOSPath + "\Shiftum42\Icons\" & location & ".pic") Then
imagetochange = GetImage(ShiftOSPath + "Shiftum42\Icons\" & location & ".pic") imagetochange = GetImage(ShiftOSPath + "\Shiftum42\Icons\" & location & ".pic")
End If End If
End Sub End Sub
Public Sub setupicons() Public Sub setupicons()
iconmanagericondatalines = IO.File.ReadAllLines(ShiftOSPath + "Shiftum42\Icons\icondata.dat") iconmanagericondatalines = IO.File.ReadAllLines(ShiftOSPath + "\Shiftum42\Icons\icondata.dat")
titlebariconsize = iconmanagericondatalines(0) titlebariconsize = iconmanagericondatalines(0)
panelbuttoniconsize = iconmanagericondatalines(1) panelbuttoniconsize = iconmanagericondatalines(1)
launchericonsize = iconmanagericondatalines(2) launchericonsize = iconmanagericondatalines(2)
@ -4725,7 +4725,7 @@
desktopicons.LargeImageList = File_Skimmer.ImageList1 desktopicons.LargeImageList = File_Skimmer.ImageList1
desktopicons.SmallImageList = File_Skimmer.ImageList1 desktopicons.SmallImageList = File_Skimmer.ImageList1
Dim dir As New IO.DirectoryInfo("C:\ShiftOS\Home\Desktop") Dim dir As New IO.DirectoryInfo(Paths.desktop)
Dim files As IO.FileInfo() = dir.GetFiles() Dim files As IO.FileInfo() = dir.GetFiles()
Dim file As IO.FileInfo Dim file As IO.FileInfo
Dim folders As IO.DirectoryInfo() = dir.GetDirectories() Dim folders As IO.DirectoryInfo() = dir.GetDirectories()
@ -4770,7 +4770,7 @@
lvadvplaces.SmallImageList = File_Skimmer.ImageList1 lvadvplaces.SmallImageList = File_Skimmer.ImageList1
lvadvplaces.LargeImageList = File_Skimmer.ImageList1 lvadvplaces.LargeImageList = File_Skimmer.ImageList1
For Each folder In My.Computer.FileSystem.GetDirectories("C:\ShiftOS\Home") For Each folder In My.Computer.FileSystem.GetDirectories(Paths.home)
Dim placeinfo As New IO.DirectoryInfo(folder) Dim placeinfo As New IO.DirectoryInfo(folder)
Dim place As New ListViewItem Dim place As New ListViewItem
place.Text = placeinfo.Name place.Text = placeinfo.Name
@ -4781,7 +4781,7 @@
lvadvfiles.Items.Clear() lvadvfiles.Items.Clear()
lvadvfiles.LargeImageList = File_Skimmer.ImageList1 lvadvfiles.LargeImageList = File_Skimmer.ImageList1
lvadvfiles.SmallImageList = File_Skimmer.ImageList1 lvadvfiles.SmallImageList = File_Skimmer.ImageList1
For Each File In My.Computer.FileSystem.GetFiles("C:\ShiftOS\SoftwareData\AdvStart\Recent") For Each File In My.Computer.FileSystem.GetFiles(Paths.advdata & "Recent")
Dim fileinfo As New IO.FileInfo(File) Dim fileinfo As New IO.FileInfo(File)
Dim item As New ListViewItem Dim item As New ListViewItem
item.Text = fileinfo.Name item.Text = fileinfo.Name

View file

@ -184,119 +184,119 @@ Module Skins
' LOAD SKIN FROM SKN FILE ' LOAD SKIN FROM SKN FILE
Public Sub loadsknfile(ByVal filepath As String) Public Sub loadsknfile(ByVal filepath As String)
If Directory.Exists(savepath + "Shiftum42\Skins\Loaded\") Then My.Computer.FileSystem.DeleteDirectory(savepath + "Shiftum42\Skins\Loaded", FileIO.DeleteDirectoryOption.DeleteAllContents) If Directory.Exists(savepath + "\Shiftum42\Skins\Loaded\") Then My.Computer.FileSystem.DeleteDirectory(savepath + "\Shiftum42\Skins\Loaded", FileIO.DeleteDirectoryOption.DeleteAllContents)
Directory.CreateDirectory(savepath + "Shiftum42\Skins\Loaded") Directory.CreateDirectory(savepath + "\Shiftum42\Skins\Loaded")
System.IO.Compression.ZipFile.ExtractToDirectory(filepath, savepath + "Shiftum42\Skins\Loaded") System.IO.Compression.ZipFile.ExtractToDirectory(filepath, savepath + "\Shiftum42\Skins\Loaded")
loadimages() loadimages()
End Sub End Sub
' LOAD SKIN FROM SAVE FOLDER ' LOAD SKIN FROM SAVE FOLDER
Public Sub loadimages() Public Sub loadimages()
If File.Exists(savepath + "Shiftum42\Skins\Loaded\userbar") Then If File.Exists(savepath + "\Shiftum42\Skins\Loaded\userbar") Then
userNamePanelBackground = GetImage(savepath + "Shiftum42\Skins\Loaded\userbar") userNamePanelBackground = GetImage(savepath + "\Shiftum42\Skins\Loaded\userbar")
End If End If
If File.Exists(savepath + "Shiftum42\Skins\Loaded\powerbar") Then If File.Exists(savepath + "\Shiftum42\Skins\Loaded\powerbar") Then
powerPanelBackgroundImage = GetImage(savepath + "Shiftum42\Skins\Loaded\powerbar") powerPanelBackgroundImage = GetImage(savepath + "\Shiftum42\Skins\Loaded\powerbar")
End If End If
If File.Exists(savepath + "Shiftum42\Skins\Loaded\titlebar") Then If File.Exists(savepath + "\Shiftum42\Skins\Loaded\titlebar") Then
titlebar = GetImage(savepath + "Shiftum42\Skins\Loaded\titlebar") titlebar = GetImage(savepath + "\Shiftum42\Skins\Loaded\titlebar")
Else : titlebar = Nothing Else : titlebar = Nothing
End If End If
If File.Exists(savepath + "Shiftum42\Skins\Loaded\borderleft") Then If File.Exists(savepath + "\Shiftum42\Skins\Loaded\borderleft") Then
borderleft = GetImage(savepath + "Shiftum42\Skins\Loaded\borderleft") borderleft = GetImage(savepath + "\Shiftum42\Skins\Loaded\borderleft")
Else : borderleft = Nothing Else : borderleft = Nothing
End If End If
If File.Exists(savepath + "Shiftum42\Skins\Loaded\borderright") Then If File.Exists(savepath + "\Shiftum42\Skins\Loaded\borderright") Then
borderright = GetImage(savepath + "Shiftum42\Skins\Loaded\borderright".Clone) borderright = GetImage(savepath + "\Shiftum42\Skins\Loaded\borderright".Clone)
Else : borderright = Nothing Else : borderright = Nothing
End If End If
If File.Exists(savepath + "Shiftum42\Skins\Loaded\borderbottom") Then If File.Exists(savepath + "\Shiftum42\Skins\Loaded\borderbottom") Then
borderbottom = GetImage(savepath + "Shiftum42\Skins\Loaded\borderbottom".Clone) borderbottom = GetImage(savepath + "\Shiftum42\Skins\Loaded\borderbottom".Clone)
Else : borderbottom = Nothing Else : borderbottom = Nothing
End If End If
If File.Exists(savepath + "Shiftum42\Skins\Loaded\closebtn") Then If File.Exists(savepath + "\Shiftum42\Skins\Loaded\closebtn") Then
closebtn = GetImage(savepath + "Shiftum42\Skins\Loaded\closebtn".Clone) closebtn = GetImage(savepath + "\Shiftum42\Skins\Loaded\closebtn".Clone)
Else : closebtn = Nothing Else : closebtn = Nothing
End If End If
If File.Exists(savepath + "Shiftum42\Skins\Loaded\closebtnhover") Then If File.Exists(savepath + "\Shiftum42\Skins\Loaded\closebtnhover") Then
closebtnhover = GetImage(savepath + "Shiftum42\Skins\Loaded\closebtnhover".Clone) closebtnhover = GetImage(savepath + "\Shiftum42\Skins\Loaded\closebtnhover".Clone)
Else : closebtnhover = Nothing Else : closebtnhover = Nothing
End If End If
If File.Exists(savepath + "Shiftum42\Skins\Loaded\closebtnclick") Then If File.Exists(savepath + "\Shiftum42\Skins\Loaded\closebtnclick") Then
closebtnclick = GetImage(savepath + "Shiftum42\Skins\Loaded\closebtnclick".Clone) closebtnclick = GetImage(savepath + "\Shiftum42\Skins\Loaded\closebtnclick".Clone)
Else : closebtnclick = Nothing Else : closebtnclick = Nothing
End If End If
If File.Exists(savepath + "Shiftum42\Skins\Loaded\rollbtn") Then If File.Exists(savepath + "\Shiftum42\Skins\Loaded\rollbtn") Then
rollbtn = GetImage(savepath + "Shiftum42\Skins\Loaded\rollbtn".Clone) rollbtn = GetImage(savepath + "\Shiftum42\Skins\Loaded\rollbtn".Clone)
Else : rollbtn = Nothing Else : rollbtn = Nothing
End If End If
If File.Exists(savepath + "Shiftum42\Skins\Loaded\rollbtnhover") Then If File.Exists(savepath + "\Shiftum42\Skins\Loaded\rollbtnhover") Then
rollbtnhover = GetImage(savepath + "Shiftum42\Skins\Loaded\rollbtnhover".Clone) rollbtnhover = GetImage(savepath + "\Shiftum42\Skins\Loaded\rollbtnhover".Clone)
Else : rollbtnhover = Nothing Else : rollbtnhover = Nothing
End If End If
If File.Exists(savepath + "Shiftum42\Skins\Loaded\rollbtnclick") Then If File.Exists(savepath + "\Shiftum42\Skins\Loaded\rollbtnclick") Then
rollbtnclick = GetImage(savepath + "Shiftum42\Skins\Loaded\rollbtnclick".Clone) rollbtnclick = GetImage(savepath + "\Shiftum42\Skins\Loaded\rollbtnclick".Clone)
Else : rollbtnclick = Nothing Else : rollbtnclick = Nothing
End If End If
If File.Exists(savepath + "Shiftum42\Skins\Loaded\minbtn") Then If File.Exists(savepath + "\Shiftum42\Skins\Loaded\minbtn") Then
minbtn = GetImage(savepath + "Shiftum42\Skins\Loaded\minbtn".Clone) minbtn = GetImage(savepath + "\Shiftum42\Skins\Loaded\minbtn".Clone)
Else : minbtn = Nothing Else : minbtn = Nothing
End If End If
If File.Exists(savepath + "Shiftum42\Skins\Loaded\minbtnhover") Then If File.Exists(savepath + "\Shiftum42\Skins\Loaded\minbtnhover") Then
minbtnhover = GetImage(savepath + "Shiftum42\Skins\Loaded\minbtnhover".Clone) minbtnhover = GetImage(savepath + "\Shiftum42\Skins\Loaded\minbtnhover".Clone)
Else : minbtnhover = Nothing Else : minbtnhover = Nothing
End If End If
If File.Exists(savepath + "Shiftum42\Skins\Loaded\minbtnclick") Then If File.Exists(savepath + "\Shiftum42\Skins\Loaded\minbtnclick") Then
minbtnclick = GetImage(savepath + "Shiftum42\Skins\Loaded\minbtnclick".Clone) minbtnclick = GetImage(savepath + "\Shiftum42\Skins\Loaded\minbtnclick".Clone)
Else : minbtnclick = Nothing Else : minbtnclick = Nothing
End If End If
If File.Exists(savepath + "Shiftum42\Skins\Loaded\rightcorner") Then If File.Exists(savepath + "\Shiftum42\Skins\Loaded\rightcorner") Then
rightcorner = GetImage(savepath + "Shiftum42\Skins\Loaded\rightcorner".Clone) rightcorner = GetImage(savepath + "\Shiftum42\Skins\Loaded\rightcorner".Clone)
Else : rightcorner = Nothing Else : rightcorner = Nothing
End If End If
If File.Exists(savepath + "Shiftum42\Skins\Loaded\leftcorner") Then If File.Exists(savepath + "\Shiftum42\Skins\Loaded\leftcorner") Then
leftcorner = GetImage(savepath + "Shiftum42\Skins\Loaded\leftcorner".Clone) leftcorner = GetImage(savepath + "\Shiftum42\Skins\Loaded\leftcorner".Clone)
Else : leftcorner = Nothing Else : leftcorner = Nothing
End If End If
If File.Exists(savepath + "Shiftum42\Skins\Loaded\desktoppanel") Then If File.Exists(savepath + "\Shiftum42\Skins\Loaded\desktoppanel") Then
desktoppanel = GetImage(savepath + "Shiftum42\Skins\Loaded\desktoppanel".Clone) desktoppanel = GetImage(savepath + "\Shiftum42\Skins\Loaded\desktoppanel".Clone)
Else : desktoppanel = Nothing Else : desktoppanel = Nothing
End If End If
If File.Exists(savepath + "Shiftum42\Skins\Loaded\desktopbackground") Then If File.Exists(savepath + "\Shiftum42\Skins\Loaded\desktopbackground") Then
desktopbackground = GetImage(savepath + "Shiftum42\Skins\Loaded\desktopbackground".Clone) desktopbackground = GetImage(savepath + "\Shiftum42\Skins\Loaded\desktopbackground".Clone)
Else : desktopbackground = Nothing Else : desktopbackground = Nothing
End If End If
If File.Exists(savepath + "Shiftum42\Skins\Loaded\panelbutton") Then If File.Exists(savepath + "\Shiftum42\Skins\Loaded\panelbutton") Then
panelbutton = GetImage(savepath + "Shiftum42\Skins\Loaded\panelbutton".Clone) panelbutton = GetImage(savepath + "\Shiftum42\Skins\Loaded\panelbutton".Clone)
Else : panelbutton = Nothing Else : panelbutton = Nothing
End If End If
If File.Exists(savepath + "Shiftum42\Skins\Loaded\applaunchermouseover") Then If File.Exists(savepath + "\Shiftum42\Skins\Loaded\applaunchermouseover") Then
applaunchermouseover = GetImage(savepath + "Shiftum42\Skins\Loaded\applaunchermouseover".Clone) applaunchermouseover = GetImage(savepath + "\Shiftum42\Skins\Loaded\applaunchermouseover".Clone)
Else : applaunchermouseover = Nothing Else : applaunchermouseover = Nothing
End If End If
If File.Exists(savepath + "Shiftum42\Skins\Loaded\applauncher") Then If File.Exists(savepath + "\Shiftum42\Skins\Loaded\applauncher") Then
applauncher = GetImage(savepath + "Shiftum42\Skins\Loaded\applauncher".Clone) applauncher = GetImage(savepath + "\Shiftum42\Skins\Loaded\applauncher".Clone)
Else : applauncher = Nothing Else : applauncher = Nothing
End If End If
If File.Exists(savepath + "Shiftum42\Skins\Loaded\applauncherclick") Then If File.Exists(savepath + "\Shiftum42\Skins\Loaded\applauncherclick") Then
applauncherclick = GetImage(savepath + "Shiftum42\Skins\Loaded\applauncherclick".Clone) applauncherclick = GetImage(savepath + "\Shiftum42\Skins\Loaded\applauncherclick".Clone)
Else : applauncherclick = Nothing Else : applauncherclick = Nothing
End If End If
If File.Exists(savepath + "Shiftum42\Skins\Loaded\panelclock") Then If File.Exists(savepath + "\Shiftum42\Skins\Loaded\panelclock") Then
panelclock = GetImage(savepath + "Shiftum42\Skins\Loaded\panelclock".Clone) panelclock = GetImage(savepath + "\Shiftum42\Skins\Loaded\panelclock".Clone)
Else : panelclock = Nothing Else : panelclock = Nothing
End If End If
If File.Exists(savepath + "Shiftum42\Skins\Loaded\bottomleftcorner") Then If File.Exists(savepath + "\Shiftum42\Skins\Loaded\bottomleftcorner") Then
bottomleftcorner = GetImage(savepath + "Shiftum42\Skins\Loaded\bottomleftcorner".Clone) bottomleftcorner = GetImage(savepath + "\Shiftum42\Skins\Loaded\bottomleftcorner".Clone)
Else : bottomleftcorner = Nothing Else : bottomleftcorner = Nothing
End If End If
If File.Exists(savepath + "Shiftum42\Skins\Loaded\bottomrightcorner") Then If File.Exists(savepath + "\Shiftum42\Skins\Loaded\bottomrightcorner") Then
bottomrightcorner = GetImage(savepath + "Shiftum42\Skins\Loaded\bottomrightcorner".Clone) bottomrightcorner = GetImage(savepath + "\Shiftum42\Skins\Loaded\bottomrightcorner".Clone)
Else : bottomrightcorner = Nothing Else : bottomrightcorner = Nothing
End If End If
'load settings 'load settings
Dim loaddata(200) As String Dim loaddata(200) As String
If File.Exists(savepath + "Shiftum42\Skins\Loaded\data.dat") Then If File.Exists(savepath + "\Shiftum42\Skins\Loaded\data.dat") Then
Dim sr As StreamReader = New StreamReader(savepath + "Shiftum42\Skins\Loaded\data.dat") Dim sr As StreamReader = New StreamReader(savepath + "\Shiftum42\Skins\Loaded\data.dat")
For i As Integer = 0 To 200 Step 1 For i As Integer = 0 To 200 Step 1
loaddata(i) = sr.ReadLine loaddata(i) = sr.ReadLine
@ -466,24 +466,24 @@ Module Skins
' SAVE TO SKN FILE ' SAVE TO SKN FILE
Public Sub saveskin(ByVal path As String) Public Sub saveskin(ByVal path As String)
If Not File.Exists(path) Then If Not File.Exists(path) Then
Dim sw As StreamWriter = New StreamWriter(savepath + "Shiftum42\Skins\Loaded\SKN-version") 'tells skin loader which system to use when openning the file Dim sw As StreamWriter = New StreamWriter(savepath + "\Shiftum42\Skins\Loaded\SKN-version") 'tells skin loader which system to use when openning the file
sw.WriteLine("Name of skinning system used to create this skn file:") sw.WriteLine("Name of skinning system used to create this skn file:")
sw.WriteLine("2.0 disposal-free skinning") sw.WriteLine("2.0 disposal-free skinning")
sw.WriteLine("Skinning system created by william.1008 on December 2014, based on 1.0 system by DevX") sw.WriteLine("Skinning system created by william.1008 on December 2014, based on 1.0 system by DevX")
sw.Close() sw.Close()
saveskinfiles(False) saveskinfiles(False)
Compression.ZipFile.CreateFromDirectory(savepath + "Shiftum42\Skins\Loaded", path) Compression.ZipFile.CreateFromDirectory(savepath + "\Shiftum42\Skins\Loaded", path)
File.Delete(savepath + "Shiftum42\Skins\Loaded\SKN-version") File.Delete(savepath + "\Shiftum42\Skins\Loaded\SKN-version")
Else Else
infobox.showinfo("File Exists", "That file location is already taken, please choose another.") infobox.showinfo("File Exists", "That file location is already taken, please choose another.")
End If End If
End Sub End Sub
' SAVE TO SAVE FOLDER ' SAVE TO SAVE FOLDER
Public Sub saveskinfiles(ByVal apply As Boolean) Public Sub saveskinfiles(ByVal apply As Boolean)
If File.Exists(savepath + "Shiftum42\Skins\Loaded\") Then If File.Exists(savepath + "\Shiftum42\Skins\Loaded\") Then
Directory.Delete(savepath + "Shiftum42\Skins\Loaded\") Directory.Delete(savepath + "\Shiftum42\Skins\Loaded\")
End If End If
Directory.CreateDirectory(savepath + "Shiftum42\Skins\Loaded\") Directory.CreateDirectory(savepath + "\Shiftum42\Skins\Loaded\")
saveimage(titlebar, "titlebar") saveimage(titlebar, "titlebar")
saveimage(borderleft, "borderleft") saveimage(borderleft, "borderleft")
saveimage(borderright, "borderright") saveimage(borderright, "borderright")
@ -645,7 +645,7 @@ Module Skins
' End of skin data text was at line 110, if adding future items, check for "End of skin data" on line 110 ' End of skin data text was at line 110, if adding future items, check for "End of skin data" on line 110
savedata(200) = "End of skin data" savedata(200) = "End of skin data"
File.WriteAllLines(savepath + "Shiftum42\Skins\Loaded\data.dat", savedata) File.WriteAllLines(savepath + "\Shiftum42\Skins\Loaded\data.dat", savedata)
If apply = True Then If apply = True Then
applyskin() applyskin()
End If End If
@ -776,14 +776,14 @@ Module Skins
End Sub End Sub
Private Sub saveimage(ByVal img As Image, ByVal name As String) Private Sub saveimage(ByVal img As Image, ByVal name As String)
If Not IsNothing(img) Then If Not IsNothing(img) Then
If File.Exists(savepath + "Shiftum42\Skins\Loaded\" & name) Then File.Delete(savepath + "Shiftum42\Skins\Loaded\" & name) If File.Exists(savepath + "\Shiftum42\Skins\Loaded\" & name) Then File.Delete(savepath + "\Shiftum42\Skins\Loaded\" & name)
Try Try
img.Save(savepath + "Shiftum42\Skins\Loaded\" & name, System.Drawing.Imaging.ImageFormat.Png) img.Save(savepath + "\Shiftum42\Skins\Loaded\" & name, System.Drawing.Imaging.ImageFormat.Png)
Catch ex As Exception Catch ex As Exception
infobox.showinfo("Saving Error", "Opps, an error occured when saving the file " & savepath + "Shiftum42\Skins\Loaded\" & name & ". Please contact DevX to report the problem.") infobox.showinfo("Saving Error", "Opps, an error occured when saving the file " & savepath + "\Shiftum42\Skins\Loaded\" & name & ". Please contact DevX to report the problem.")
End Try End Try
Else Else
If File.Exists(savepath + "Shiftum42\Skins\Loaded\" & name) Then File.Delete(savepath + "Shiftum42\Skins\Loaded\" & name) If File.Exists(savepath + "\Shiftum42\Skins\Loaded\" & name) Then File.Delete(savepath + "\Shiftum42\Skins\Loaded\" & name)
End If End If
End Sub End Sub
End Module End Module