CD extra & settings support
Written on book
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
Imports System.IO
|
||||
|
||||
Imports System
|
||||
Imports System.Text
|
||||
Imports System.Runtime.Remoting.Metadata.W3cXsd2001
|
||||
Imports System
|
||||
Imports System.ComponentModel
|
||||
Imports System.IO
|
||||
Imports System.Net.Mime.MediaTypeNames
|
||||
Imports System.Runtime.Remoting.Metadata.W3cXsd2001
|
||||
Imports System.Text
|
||||
Imports MadMilkman.Ini
|
||||
|
||||
Public Class Form1
|
||||
|
||||
@@ -14,7 +15,7 @@ Public Class Form1
|
||||
Public CurrentImgMode As Byte
|
||||
Dim drawSurface As Bitmap
|
||||
Public chars As List(Of Char)
|
||||
|
||||
Public iniFile = "..\..\..\settings.ini"
|
||||
|
||||
|
||||
Public DialogCounter As Integer
|
||||
@@ -28,6 +29,13 @@ Public Class Form1
|
||||
|
||||
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
||||
'WorkDir.Text &= "export\"
|
||||
|
||||
If Not System.IO.File.Exists(iniFile) Then
|
||||
InitializateIni()
|
||||
End If
|
||||
|
||||
LoadIni()
|
||||
|
||||
SaveFileDialog1.InitialDirectory = WorkDir.Text & "export\"
|
||||
OpenFileDialog1.InitialDirectory = WorkDir.Text
|
||||
|
||||
@@ -41,6 +49,58 @@ Public Class Form1
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub InitializateIni()
|
||||
MsgBox(iniFile & " is not found! Please make and save your CD images paths!")
|
||||
Dim file As New IniFile()
|
||||
Dim s As IniSection = file.Sections.Add("Images Settings")
|
||||
s.TrailingComment.Text = "CD Images Paths"
|
||||
s.Keys.Add("USER_BIN", "")
|
||||
s.Keys.Add("JAP_BIN", "")
|
||||
s.Keys.Add("USA_BIN", "")
|
||||
s.Keys.Add("KUDOS_BIN", "")
|
||||
s.Keys.Add("EXTRA_CD_BIN", "")
|
||||
s.Keys.Add("WORK_DIR", "")
|
||||
file.Save(iniFile)
|
||||
End Sub
|
||||
|
||||
Private Sub SavePaths_Click(sender As Object, e As EventArgs) Handles SavePaths.Click
|
||||
Dim file As New IniFile()
|
||||
Dim s As IniSection = file.Sections.Add("Images Settings")
|
||||
s.TrailingComment.Text = "CD Images Paths"
|
||||
s.Keys.Add("USER_BIN", UserPath.Text)
|
||||
s.Keys.Add("JAP_BIN", JapISOPath.Text)
|
||||
s.Keys.Add("USA_BIN", EngISOPath.Text)
|
||||
s.Keys.Add("KUDOS_BIN", KUDOSpath.Text)
|
||||
s.Keys.Add("EXTRA_CD_BIN", CDEXTRApath.Text)
|
||||
s.Keys.Add("WORK_DIR", WorkDir.Text)
|
||||
file.Save(iniFile)
|
||||
MsgBox("Path settings saved!", vbInformation)
|
||||
End Sub
|
||||
|
||||
Private Sub LoadIni()
|
||||
Dim file As New IniFile()
|
||||
file.Load(iniFile)
|
||||
For Each Section In file.Sections
|
||||
If Section.Name = "Images Settings" Then
|
||||
For Each key In Section.Keys
|
||||
Select Case key.Name
|
||||
Case "USER_BIN"
|
||||
UserPath.Text = key.Value
|
||||
Case "JAP_BIN"
|
||||
JapISOPath.Text = key.Value
|
||||
Case "USA_BIN"
|
||||
EngISOPath.Text = key.Value
|
||||
Case "KUDOS_BIN"
|
||||
KUDOSpath.Text = key.Value
|
||||
Case "EXTRA_CD_BIN"
|
||||
CDEXTRApath.Text = key.Value
|
||||
Case "WORK_DIR"
|
||||
WorkDir.Text = key.Value
|
||||
End Select
|
||||
Next
|
||||
End If
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Private Sub unRLEfileOpen_Click(sender As Object, e As EventArgs) Handles unRLEfileOpen.Click
|
||||
|
||||
@@ -445,7 +505,6 @@ Public Class Form1
|
||||
If SelBinFiles.SelectedIndex = -1 Then Exit Sub
|
||||
Dim filename As String
|
||||
Dim unrl As List(Of Byte)
|
||||
|
||||
Dim r As rleFile = binFile(SelBinFiles.SelectedIndex)
|
||||
|
||||
If ExportRLEDec.Checked Then
|
||||
@@ -469,11 +528,10 @@ Public Class Form1
|
||||
unrl = r.Bytes.ToList
|
||||
End If
|
||||
|
||||
|
||||
If CDFileList.Items.Count > 0 Then
|
||||
|
||||
If CreateBinDirCheck.Checked And CDFileList.SelectedIndex > -1 Then
|
||||
Dim cat = WorkDir.Text & Strings.Left(FilnamLabel.Text, 4) & "_" & files1(CDFileList.SelectedIndex).Descript
|
||||
Dim cat = WorkDir.Text & Strings.Left(FilnamLabel.Text, 4) & "_" & Replace(files1(CDFileList.SelectedIndex).Descript, ".", "") & If(CDExtraBtn.Checked, "_CDEXTRA", "")
|
||||
|
||||
If Not Directory.Exists(cat) Then
|
||||
Directory.CreateDirectory(cat)
|
||||
|
||||
@@ -488,6 +546,7 @@ Public Class Form1
|
||||
If japRadio.Checked Then filename &= "_J"
|
||||
If EngRadio.Checked Or KudosBtn.Checked Then filename &= "_E"
|
||||
If UserRadio.Checked Then filename &= "_U"
|
||||
If CDExtraBtn.Checked Then filename &= "_CDEXTRA"
|
||||
End If
|
||||
|
||||
If Not ExportRLEDec.Checked Then filename &= "_RAW"
|
||||
@@ -509,6 +568,12 @@ Public Class Form1
|
||||
|
||||
'Reading Files Descriptions
|
||||
|
||||
|
||||
If CDExtraBtn.Checked Then
|
||||
ExpMainExe.Text = "Export SLPS_028.26"
|
||||
Else
|
||||
ExpMainExe.Text = "Export SLPS_028.25"
|
||||
End If
|
||||
Dim descipts = Split(My.Computer.FileSystem.ReadAllText("FileDesc.txt", Encoding.GetEncoding(1251)), vbCrLf)
|
||||
|
||||
|
||||
@@ -593,6 +658,8 @@ Public Class Form1
|
||||
filnam = UserPath.Text
|
||||
ElseIf KUDOSbtn.Checked Then
|
||||
filnam = KUDOSpath.Text
|
||||
ElseIf CDExtraBtn.Checked Then
|
||||
filnam = CDEXTRApath.Text
|
||||
End If
|
||||
Return filnam
|
||||
End Function
|
||||
@@ -911,13 +978,13 @@ newtest:
|
||||
Dim searchRes = New List(Of String)
|
||||
|
||||
'all files to video
|
||||
For a = 0 To 864
|
||||
For a = 0 To CDFileList.Items.Count - 1
|
||||
Dim curFile = cd.getCDfile(getFilnam, files1(a).Sector, files1(a).Sizw)
|
||||
'If curFile(0) = 1 Or curFile(0) = 2 Then Continue For 'IF ARCHIVE
|
||||
'If curFile(1) = 1 Or curFile(1) = 2 Then Continue For
|
||||
Debug.WriteLine("Searching... " & a)
|
||||
Res = ByteSearch(curFile.ToArray, searchBytes)
|
||||
If res > -1 Then searchRes.Add("#" & a & "Offset: " & res)
|
||||
res = ByteSearch(curFile.ToArray, searchBytes)
|
||||
If res > -1 Then searchRes.Add("#" & a & " Offset: " & res)
|
||||
Next
|
||||
|
||||
If searchRes.Count Then
|
||||
@@ -943,7 +1010,7 @@ newtest:
|
||||
Private Sub importToBin_Click(sender As Object, e As EventArgs) Handles importToBin.Click
|
||||
|
||||
|
||||
If Not UserRadio.Checked Then MsgBox("YOU CAN IMPORT ONLY IN USER ISO!!!") : Exit Sub
|
||||
If Not UserRadio.Checked And Not CDExtraBtn.Checked Then MsgBox("YOU CAN IMPORT ONLY IN USER OR CDEXTRA ISO!!!") : Exit Sub
|
||||
|
||||
'OpensFile
|
||||
|
||||
@@ -1147,11 +1214,10 @@ rleEnd:
|
||||
|
||||
|
||||
|
||||
'Dim savFile = OpenFileDialog1.FileName & ".bin" '//////////////////////////////////DEBUG SAVE
|
||||
|
||||
Dim f = getFilnam()
|
||||
|
||||
'My.Computer.FileSystem.WriteAllBytes(savFile, finalPack.ToArray, False)
|
||||
cd.saveCDfile(UserPath.Text, importSector.Text, finalPack.Count, finalPack.ToArray)
|
||||
cd.saveCDfile(f, importSector.Text, finalPack.Count, finalPack.ToArray)
|
||||
|
||||
|
||||
|
||||
@@ -1161,7 +1227,7 @@ rleEnd:
|
||||
files1(CDFileList.SelectedIndex).Sector = importSector.Text
|
||||
|
||||
'Update FileTable In ISO
|
||||
cd.UpdateFileListTable(UserPath.Text, files1)
|
||||
cd.UpdateFileListTable(f, files1)
|
||||
|
||||
|
||||
|
||||
@@ -1398,14 +1464,12 @@ rleEnd:
|
||||
Private Sub importRAWtoSel_Click(sender As Object, e As EventArgs) Handles importRAWtoSel.Click
|
||||
If OpenFileDialog1.ShowDialog <> DialogResult.OK Then Exit Sub
|
||||
|
||||
If Not UserRadio.Checked Then MsgBox("YOU CAN IMPORT ONLY IN USER ISO!!!") : Exit Sub
|
||||
If Not UserRadio.Checked And Not CDExtraBtn.Checked Then MsgBox("YOU CAN IMPORT ONLY IN USER OR CDEXTRA ISO!!!") : Exit Sub
|
||||
|
||||
|
||||
Dim fil = My.Computer.FileSystem.ReadAllBytes(OpenFileDialog1.FileName).ToList
|
||||
|
||||
If Not Mode2352.Checked Then
|
||||
|
||||
|
||||
If fil.Count Mod 2048 > 0 Then
|
||||
For g = 1 To (2048 - (fil.Count Mod 2048))
|
||||
fil.Add(0)
|
||||
@@ -1418,18 +1482,15 @@ rleEnd:
|
||||
End If
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Dim f = getFilnam()
|
||||
|
||||
Dim cd = New ISOTools
|
||||
cd.saveCDfile(UserPath.Text, importSector.Text, fil.Count, fil.ToArray)
|
||||
cd.saveCDfile(f, importSector.Text, fil.Count, fil.ToArray)
|
||||
|
||||
If UpdateSizeTable.Checked Then
|
||||
files1(CDFileList.SelectedIndex).Sizw = fil.Count
|
||||
files1(CDFileList.SelectedIndex).Sector = importSector.Text
|
||||
cd.UpdateFileListTable(UserPath.Text, files1)
|
||||
|
||||
cd.UpdateFileListTable(f, files1)
|
||||
End If
|
||||
|
||||
|
||||
@@ -2034,7 +2095,6 @@ Endd:
|
||||
s.ParseScript(OpenFileDialog1.FileName)
|
||||
End Sub
|
||||
|
||||
|
||||
End Class
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user