-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfrmMain.vb
1945 lines (1707 loc) · 94 KB
/
frmMain.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
Imports System.ComponentModel
Imports System.Text.RegularExpressions
Public Class FrmMain
Public Manufacturers(16) As String
Public DiskArray(16, 16) As String
''' <summary>
''' Sets the title of the Form with the form name plus exe version number
''' </summary>
Private Sub FrmMain_Load(sender As Object, e As EventArgs) Handles Me.Load
Dim GW As New GreaseWeazle
Me.Text = "Run GreaseWeazle v" + My.Application.Info.Version.ToString + " (GWHelper: " + GW.Version + ")"
'Load or create and load the .xml file with the manufacturers / disk types
Dim fl As String = System.IO.Path.ChangeExtension(Application.ExecutablePath, ".Disks.xml")
If System.IO.File.Exists(fl) Then
ReadDefaultDiskXML(fl)
Else
WriteDefaultDiskTypesXML(fl)
ReadDefaultDiskXML(fl)
End If
Try
If Manufacturers.Length > 0 Then
Dim x As Integer
cmbManufacturer.Items.Clear()
For x = 0 To Manufacturers.Length - 1
cmbManufacturer.Items.Add(Manufacturers(x))
Next
End If
Catch ex As Exception
End Try
SetUpScreen()
End Sub
Public Sub DoLOG()
If chkLOG.Checked Then
If rtbOutput.Text.Trim <> "" Then
Dim l As New LogFileClass
l.WriteToLog(rtbOutput.Lines)
End If
End If
End Sub
Public Function FillComPorts(ByVal cmb As ComboBox) As Boolean
cmb.Items.Clear()
For Each sp As String In My.Computer.Ports.SerialPortNames 'Add detected serial ports to combo box drop down
cmb.Items.Add(sp)
Next
Return True
End Function
''' <summary>
''' Loads settings from VB My.Settings (local) and sets the variables onscreen. Also sets up tooltips.
''' </summary>
Public Function SetUpScreen() As Boolean
FillComPorts(cmbSerialPorts)
If My.Settings.UpdateSettings = True Then 'Copy user settings from previous application version if necessary
My.Settings.Upgrade()
My.Settings.UpdateSettings = False
My.Settings.Save()
End If
txtSaveLocation.Text = My.Settings.SaveLoc
txtGWLocation.Text = My.Settings.GWExe
chkF7.Checked = My.Settings.F7
cmbDriveSelect.Text = My.Settings.Drive
cmbDriveSelect.Enabled = chkF7.Checked
cmbEndTrack.Enabled = chkEndTrack.Checked
cmbStartTrack.Enabled = ChkStartTrack.Checked
cmbRevolutions.Enabled = chkRevolutions.Checked
cmbRPM.Enabled = chkRPM.Checked
cmbRate.Enabled = chkRate.Checked
cmbDisk.Text = My.Settings.Disk
cmbDiskOf.Text = My.Settings.DiskOf
chkExecuteScriptAfterRead.Checked = My.Settings.ExecuteScript
chkLoop.Checked = My.Settings.LoopDump
cmbDump.Text = My.Settings.LoopDumpCount
cmbSystem.Text = My.Settings.System
txtTitle.Text = My.Settings.Title
txtPublisher.Text = My.Settings.Company
txtExecuteScript.Text = My.Settings.Script
cmbSides.Text = My.Settings.Sides
cmbStepping.Text = CStr(My.Settings.Stepping)
ChkStartTrack.Checked = My.Settings.StartTrack
cmbStartTrack.Text = CStr(My.Settings.StartTrackNo)
chkEndTrack.Checked = My.Settings.EndTrack
cmbEndTrack.Text = CStr(My.Settings.EndTrackNo)
cmbSeekA.Text = CStr(My.Settings.SeekA)
cmbSeekB.Text = CStr(My.Settings.SeekB)
'chkAdjustSpeed.Checked = My.Settings.AdjustWriteSpeed
chkRate.Checked = My.Settings.IncludeDataRate
chkRPM.Checked = My.Settings.IncludeRPM
cmbRPM.Text = My.Settings.RPM
cmbRate.Text = My.Settings.DataRate
chkLOG.Checked = My.Settings.RunningLog
chkEraseEmpty.Checked = My.Settings.EraseEmpty
chkSeparateFolders.Checked = My.Settings.SeparateFolders
txtPythonLocation.Text = My.Settings.PythonExe
chkUsePython.Checked = My.Settings.UsePython
chkWritePreCompensate.Checked = My.Settings.UseWritePreCompensate
cmbWPCTrackRange.Text = My.Settings.WPCTrackRange
cmbWPCTracks.Text = My.Settings.WPCTracks
cmbWPCType.Text = My.Settings.WPCType
txtWPCWidth.Text = My.Settings.WPCTrackWidth
chkOffsetHead.Checked = My.Settings.HeadOffsetEnable
cmbOffsetHeadBy.Text = CStr(My.Settings.HeadOffsetTrackCount)
cmbHeadOffsetHead.Text = CStr(My.Settings.HeadOffsetHead)
chkSetManDiskType.Checked = My.Settings.SetManDisktype
cmbManufacturer.SelectedIndex = My.Settings.Manufacturer
cmbDiskTypes.SelectedIndex = My.Settings.DiskType
cmbManufacturer.Enabled = chkSetManDiskType.Checked
cmbDiskTypes.Enabled = chkSetManDiskType.Checked
chkExtremeSeek.Checked = My.Settings.ExtremeSeek
chkMotorOn.Checked = My.Settings.SeekWithMotorOn
chkDisableVerify.Checked = My.Settings.DisableWriteVerify
EnableProgramLOGToolStripMenuItem.CheckOnClick = True
EnableProgramLOGToolStripMenuItem.Checked = chkLOG.Checked
WriteLOGWithEachReadWriteToolStripMenuItem.CheckOnClick = True
WriteLOGWithEachReadWriteToolStripMenuItem.Checked = chkSaveLog.Checked
cmbOffsetHeadBy.Enabled = chkOffsetHead.Checked
cmbHeadOffsetHead.Enabled = chkOffsetHead.Checked
cmbRetries.Text = CStr(My.Settings.Retries)
chkRetries.Checked = My.Settings.EnableRetries
cmbRetries.Enabled = chkRetries.Checked
cmbCleanMS.Text = CStr(My.Settings.CleanTimeMS)
chkLingerCleaning.Checked = My.Settings.EnableCleanTimeMS
cmbCleanMS.Enabled = chkLingerCleaning.Checked
cmbCleanPasses.Text = CStr(My.Settings.CleanPasses)
chkCleanPasses.Checked = My.Settings.EnableCleanPasses
cmbCleanPasses.Enabled = chkCleanPasses.Checked
chkTime.Checked = My.Settings.ShowTime
If My.Settings.DarkTheme = True Then
EnableDarkTheme(True)
End If
If My.Settings.WideForm = True Then
rtbOutput.Visible = True
Me.Size = New Size(924, Me.Size.Height)
btnResize.Text = "<"
End If
If My.Settings.UsePython = True Then
txtPythonLocation.Enabled = True
btnPython_EXE.Enabled = True
txtPythonLocation.Visible = True
lblPythonLocation.Visible = True
btnPython_EXE.Visible = True
Else
txtPythonLocation.Enabled = False
btnPython_EXE.Enabled = False
txtPythonLocation.Visible = False
lblPythonLocation.Visible = False
btnPython_EXE.Visible = False
End If
If chkWritePreCompensate.Checked = True Then
cmbWPCType.Enabled = True
cmbWPCTrackRange.Enabled = True
cmbWPCTracks.Enabled = True
txtWPCWidth.Enabled = True
Else
cmbWPCType.Enabled = False
cmbWPCTrackRange.Enabled = False
cmbWPCTracks.Enabled = False
txtWPCWidth.Enabled = False
End If
If chkLOG.Checked Then
rtbOutput.AppendText("Started on: " + DateTime.Today.ToString("yyyy-MM-dd") + " at " + DateTime.Now.ToString("HH:mm:ss") + vbCrLf)
End If
CheckVisible()
rtbOutput.Visible = False
Me.Size = New Size(534, Me.Size.Height)
btnResize.Text = ">"
ToolTipMainForm.SetToolTip(btnRead, "Begin GreaseWeazle read process. Creates a flux level copy of a floppy disk to a file.")
ToolTipMainForm.SetToolTip(btnWrite, "Begin GreaseWeazle write process. Writes a supported file format to a physical floppy disk.")
ToolTipMainForm.SetToolTip(btnExecuteScript, "Select the program or batch file to run. Path to disk image is passed as first argument.")
ToolTipMainForm.SetToolTip(btnGW_EXE, "Select the location of the gw.exe (or gw.py for Python).")
ToolTipMainForm.SetToolTip(btnSaveLocation, "Select the location to save Disk images to.")
ToolTipMainForm.SetToolTip(btnResize, "Show/hide log. Not very useful though!")
ToolTipMainForm.SetToolTip(chkExecuteScriptAfterRead, "Executes script after each read attempt. Check twice to execute script minimized.")
ToolTipMainForm.SetToolTip(chkExecuteScriptAfterWrite, "Executes script after each write attempt.")
ToolTipMainForm.SetToolTip(chkSaveLog, "Writes the log to a file after each read/write attempt. Log file matches image name.")
ToolTipMainForm.SetToolTip(txtExecuteScript, "Location of program or batch file to execute")
ToolTipMainForm.SetToolTip(txtGWLocation, "Location of the Greaseweazle program (gw.exe). (If using Python, this is the gw script, instead")
ToolTipMainForm.SetToolTip(txtSaveLocation, "Location to save disk images to.")
ToolTipMainForm.SetToolTip(txtTitle, "Title of floppy disk image. This should not be blank.")
ToolTipMainForm.SetToolTip(txtPublisher, "Publisher of disk image. Seperated from title by underscore. May be blank if desired.")
ToolTipMainForm.SetToolTip(cmbSystem, "Computer system that the disk images belong to. eg PC, Amiga, ST etc.")
ToolTipMainForm.SetToolTip(cmbDisk, "Used to set the disk number in a set.")
ToolTipMainForm.SetToolTip(cmbDiskOf, "The total number of disks in a set. May be blank, if unknown. Useful to leave as 1 for single disks, to avoid confusion.")
ToolTipMainForm.SetToolTip(cmbDiskRevision, "Adds a revision string to a disk image. Usually blank.")
ToolTipMainForm.SetToolTip(cmbDump, "Disk read/write attempt number. Useful for read attempts. Many disks may need 2-5 attempts if there is dirt on the surface. (Or may need cleaning)")
ToolTipMainForm.SetToolTip(chkLoop, "Check this, and set the dump number dropdown list to automatically make this number of read attempts.")
ToolTipMainForm.SetToolTip(cmbSerialPorts, "Serial port GreaseWeazle is connected to. Should show all currently connected COM ports. Try removing old hidden ports if yours is not shown. Can type directly into this field. eg COM2. As of v0.11, auto is supported.")
ToolTipMainForm.SetToolTip(LinkLabelProjectName, "Opens main GreaseWeazle Github page")
ToolTipMainForm.SetToolTip(LinkLabelGWWiki, "Start here! Opens GreaseWeazle Wiki page. Setup and other usage documentation.")
ToolTipMainForm.SetToolTip(LinkLabelOpenLocation, "Opens Explorer in the Save folder on the HDD.")
ToolTipMainForm.SetToolTip(LinkLabelDLGW, "Opens the GreaseWeazle Github download page")
ToolTipMainForm.SetToolTip(LinkLabelDownloadPython, "Opens main Python download page")
ToolTipMainForm.SetToolTip(LinkLabelLaunchNow, "Executes exe/script from location below, with current disk image name.")
ToolTipMainForm.SetToolTip(chkF7, "Check this if you are writing to a STM32F7 device (rather than the 'Bluepill' STM32 F1 device.")
ToolTipMainForm.SetToolTip(cmbDriveSelect, "If using an F7 device, select the drive you want to read to/write from. Multiple drives may be connected at once. (F7 device only!!).")
ToolTipMainForm.SetToolTip(LinkLabelDriveSelect, "Opens the 'Drive Select' page of the Wiki.")
ToolTipMainForm.SetToolTip(ChkStartTrack, "Check to select a default start track other than track 0.")
ToolTipMainForm.SetToolTip(chkEndTrack, "Check to select a default end track. Number of tracks that a drive can read/write depends on the drive itself. Consult disk drive manual if unsure.")
ToolTipMainForm.SetToolTip(cmbSides, "Select disk sides to read / write / erase. Side 0 is the bottom of a double sided disk drive disk, side 1 is the top of a double sided drive disk. Single sided drives should use side 0 only")
ToolTipMainForm.SetToolTip(lblDiskSides, "Select disk sides to read / write / erase. Side 0 is the bottom of a double sided disk drive disk, side 1 is the top of a double sided drive disk. Single sided drives should use side 0 only")
'ToolTipMainForm.SetToolTip(chkAdjustSpeed, "Removed in v0.13 of Greaseweazle. Maps to --adjust-speed argument. Adjust write-flux times for drive speed.")
ToolTipMainForm.SetToolTip(cmbStartTrack, "Track to start read/write process on. Tracks are zero indexed. Actual number of tracks a drive supports varies. Consult disk drive manual if unsure.")
ToolTipMainForm.SetToolTip(cmbEndTrack, "Track to end read/write process on. Tracks are zero indexed. Actual number of tracks a drive supports varies. Consult disk drive manual if unsure.")
ToolTipMainForm.SetToolTip(chkRevolutions, "Check this to change the revolutions per read from the default 3. (Note, 5 revolutions is the norm for archival purposes).")
ToolTipMainForm.SetToolTip(cmbRevolutions, "Set the revolutions per read here. 5 is recommended.")
ToolTipMainForm.SetToolTip(btnUpdateFirmware, "Begin GreaseWeazle firmware upgrade process. Bridge the two pins: DCLK + DCIO and select update file.")
ToolTipMainForm.SetToolTip(LinkLabelLaunchGW, "The Github repository for this program. Get the latest versions here.")
ToolTipMainForm.SetToolTip(btnResetDevice, "Resets the Greaseweazle device to power-on settings: Motors off, drives deselected, power-on pin levels and delay values. GW 0.12+ required.")
ToolTipMainForm.SetToolTip(cmbStepping, "Makes the Greaseweazle move the head x tracks at a time. Used to read (GW 0.12+) or write (GW 0.20+) 40 track disks on an 80 track device. EG C64 (SD) disk in an IBM PC (DD) drive. Default is 1 (GW 0.23)")
ToolTipMainForm.SetToolTip(lblHeadStep, "Makes the Greaseweazle move the head x tracks at a time. Used to read (GW 0.12+) or write (GW 0.20+) 40 track disks on an 80 track device. EG C64 (SD) disk in an IBM PC (DD) drive. Default is 1 (GW 0.23)")
ToolTipMainForm.SetToolTip(btnSetPin, "Set the pin in the dropdown list to either Low (0v) or Hight (5v). GW v0.12+ required.")
ToolTipMainForm.SetToolTip(cmbPIN, "The floppy drive pin whos value will be set either high or low. (Cannot be blank) GW 0.12+ required.")
ToolTipMainForm.SetToolTip(cmbLowHigh, "Force a Low or High value on a given pin. (Cannot be blank) GW 0.12+ required.")
ToolTipMainForm.SetToolTip(cmbReadFormat, "GreaseWeazle read format. Supercard Pro (.scp), KryoFlux (.raw), HxC (.hfe) or Extended Disk image format (.dsk). Alternatively specify your own extension including period. GW 0.14+ required. (0.23+ for Kryoflux, 0.25+ for EDSK)")
ToolTipMainForm.SetToolTip(btnEraseDisk, "**WARNING** Erases the contents of a physical floppy disk. Write protect tab must be off/closed.")
ToolTipMainForm.SetToolTip(btnInfo, "Displays Greaseweazle device information. Also displays the device bootloader info, on an F7 device.")
ToolTipMainForm.SetToolTip(btnGWBandwidth, "Display bandwidth between Greasweazle and PC")
ToolTipMainForm.SetToolTip(btnGWDelays, "Displays Greaseweazle device delays information.")
ToolTipMainForm.SetToolTip(chkRate, "Enable drive read rate. 250 for DD disks, 500 for HD disks and HD drives.")
ToolTipMainForm.SetToolTip(cmbRPM, "Set the disk RPM to this rate. This setting is set before all others.")
ToolTipMainForm.SetToolTip(chkRPM, "Enable changing the drive RPM setting. Changing this will take precedence over other settings. Default for DD drives is 300 RPM. Default for Amiga HD drives, is 150 RPM.")
ToolTipMainForm.SetToolTip(cmbRate, "Set read rate. 250 for DD disks, 500 for HD disks.")
ToolTipMainForm.SetToolTip(chkLOG, "Save an audit log of actions to a programname.log file")
ToolTipMainForm.SetToolTip(chkEraseEmpty, "Erases empty tracks on write. Off by default.")
ToolTipMainForm.SetToolTip(btnSeekA, "Move the disk drive head to this track")
ToolTipMainForm.SetToolTip(btnSeekB, "Move the disk drive head to this track")
ToolTipMainForm.SetToolTip(chkTrackGroup, "Tick to use a group of tracks. Must be a valid set of tracks. eg 0-83 or 0-5,10-15 to read tracks 0 to 5 and then also 10-15.")
ToolTipMainForm.SetToolTip(txtTrackGroup, "Create a group of tracks to read/write/erase. Tracks are in the format <startTrack>-<endtrack>. To add more ranges of tracks to the group, separate them with a comma")
ToolTipMainForm.SetToolTip(chkSeparateFolders, "Check to create disk images inside their own folder. Useful for KryoFlux dumps, where each track is it's own file.")
ToolTipMainForm.SetToolTip(lblAddTrackList, "Add the start and end track to the group below.")
ToolTipMainForm.SetToolTip(lblClearTrackList, "Clear track group.")
ToolTipMainForm.SetToolTip(btnPython_EXE, "Click to pick the location of the python.exe")
ToolTipMainForm.SetToolTip(txtPythonLocation, "The location of the Python.exe, if using greaseweazle python scripts.")
ToolTipMainForm.SetToolTip(chkUsePython, "Check this to use the python version of Greaseweazle. Python must be installed with required libraries (bitarray crcmod pyserial")
ToolTipMainForm.SetToolTip(lblComPort, "Click to refresh the COM port list in the drop down box")
ToolTipMainForm.SetToolTip(cmbSerialPorts, "Serial port the Greaseweazle is connected to. Leave blank to auto detect. Select the correct COM port, if multiple GWs are connected at the same time")
ToolTipMainForm.SetToolTip(chkWritePreCompensate, "Check this to enable Write Precompensation. Click the WritePreComepensate link to read the Wiki entry.")
ToolTipMainForm.SetToolTip(llabelPreCompensate, "Launches the browser to read the WPC Wiki entry")
ToolTipMainForm.SetToolTip(cmbWPCType, "The format of the disk to be written: Modified Frequency Modulation, Frequency Modulation, or Group Coded Recording.")
ToolTipMainForm.SetToolTip(cmbWPCTracks, "Apply WPC to all subsequent tracks, starting with this track:")
ToolTipMainForm.SetToolTip(txtWPCWidth, "The width in nanoseconds, to shift the tracks by.")
ToolTipMainForm.SetToolTip(txtTitle, "Title of the disk to read. May not be blank.")
ToolTipMainForm.SetToolTip(lblSystem, "Click to enable my (awful) attempt at a dark theme :)")
ToolTipMainForm.SetToolTip(chkFilenameRreplaceSpaceWithUnderscore, "For the title of the image, replace spaces with an underscore character. Helpful to avoid problems with spaces in paths, etc.")
ToolTipMainForm.SetToolTip(chkOffsetHead, "Offset the head movement by -9 to 9 tracks. Only for 5.25"" drives and C64 flippy disks!!")
ToolTipMainForm.SetToolTip(cmbOffsetHeadBy, "Track count to offset the head by. (Only for 5.25"" drives and C64 flippy disks)")
ToolTipMainForm.SetToolTip(chkCleanPasses, "Check to change the number of passes the heads will move over the cleaning disk. Default is 3.")
ToolTipMainForm.SetToolTip(cmbCleanPasses, "The number of times the drive heads will be cleaned, on each track.")
ToolTipMainForm.SetToolTip(chkLingerCleaning, "Check to enable changin the length of time the heads spend cleaning each track. Default is 100ms.")
ToolTipMainForm.SetToolTip(cmbCleanMS, "The number of milliseconds a the drive head will stay on each track")
ToolTipMainForm.SetToolTip(chkRetries, "If an error occurs during read/write, retry the action a number of times.")
ToolTipMainForm.SetToolTip(cmbRetries, "This is the number of times to retry read/write, in the case of an error occuring.")
ToolTipMainForm.SetToolTip(chkTime, "Show the time taken to complete GW actions.")
ToolTipMainForm.SetToolTip(btnClean, "Clean drive heads using a floppy cleaning disk. (Usually a sponge or cloth like material, with IPA or similar liquid drops.")
ToolTipMainForm.SetToolTip(chkSetManDiskType, "Set the Supercard Pro (.scp) file disk type. Has no effect on other disk formats.")
ToolTipMainForm.SetToolTip(cmbManufacturer, "The Supercard Pro (.scp) file manufacturer. Has no effect on other disk formats")
ToolTipMainForm.SetToolTip(cmbDiskTypes, "The Supercard Pro (.scp) file disk type. Each manufacturer can have multiple disk types. Has no effect on other disk formats")
ToolTipMainForm.SetToolTip(chkMotorOn, "Switches the drive motor on, when using the seek command. Required by some drives.")
ToolTipMainForm.SetToolTip(chkExtremeSeek, "Allows the drive head to move to extreme tracks, with no prompt")
ToolTipMainForm.SetToolTip(chkDisableVerify, "Disable write verifying, for disk image formats that support verifying.")
ToolTipMainForm.SetToolTip(lblSCP_Format, "The SCP file format specs.")
ToolTipMainForm.SetToolTip(cmbHeadOffsetHead, "Disk head (side) to offset the head by. (Only for 5.25"" drives and C64 flippy disks)")
Return True
End Function
''' <summary>
''' Simple attempt to create an easier to use night mode.
''' </summary>
''' <param name="EnableDark">If true, set the program to dark, if not set to default</param>
Public Function EnableDarkTheme(ByVal EnableDark As Boolean) As Boolean
Dim w1 As Color = Color.FromArgb(244, 244, 244)
Dim w2 As Color = Color.FromArgb(232, 232, 232)
Dim w3 As Color = Color.FromArgb(220, 220, 220)
Dim b1 As Color = Color.FromArgb(12, 12, 12)
Dim b2 As Color = Color.FromArgb(24, 24, 24)
Dim b3 As Color = Color.FromArgb(36, 36, 36)
Dim hl As Color = Color.FromArgb(140, 140, 254)
Dim hll As Color = Color.FromArgb(24, 232, 24)
If EnableDark = True Then
Me.ForeColor = w1
Me.BackColor = b1
rtbOutput.ForeColor = w3
rtbOutput.BackColor = b2
'lblComPort.ForeColor = w2
'lblTitle.ForeColor = w2
cmbSerialPorts.ForeColor = w2
cmbSerialPorts.BackColor = b2
LinkLabelProjectName.ForeColor = w2
LinkLabelProjectName.LinkColor = hl
LinkLabelProjectName.VisitedLinkColor = hll
btnWrite.ForeColor = w2
btnWrite.BackColor = b2
Else
Me.ForeColor = System.Drawing.SystemColors.ControlText
Me.BackColor = System.Drawing.SystemColors.Control
rtbOutput.ForeColor = System.Drawing.SystemColors.WindowText
rtbOutput.BackColor = System.Drawing.SystemColors.Window
'lblComPort.ForeColor = System.Drawing.SystemColors.ControlText
'lblTitle.ForeColor = System.Drawing.SystemColors.ControlText
cmbSerialPorts.ForeColor = System.Drawing.SystemColors.WindowText
cmbSerialPorts.BackColor = System.Drawing.SystemColors.Window
LinkLabelProjectName.ForeColor = System.Drawing.SystemColors.ControlText
LinkLabelProjectName.LinkColor = hl
LinkLabelProjectName.VisitedLinkColor = hll
btnWrite.ForeColor = System.Drawing.SystemColors.ControlText
btnWrite.BackColor = System.Drawing.SystemColors.Control
End If
GroupBoxGWOptions.ForeColor = rtbOutput.ForeColor
GroupBoxGWOptions.BackColor = rtbOutput.BackColor
gbProgramOptions.ForeColor = rtbOutput.ForeColor
gbProgramOptions.BackColor = rtbOutput.BackColor
txtTitle.ForeColor = rtbOutput.ForeColor
txtTitle.BackColor = rtbOutput.BackColor
txtPublisher.ForeColor = rtbOutput.ForeColor
txtPublisher.BackColor = rtbOutput.BackColor
txtSaveLocation.ForeColor = rtbOutput.ForeColor
txtSaveLocation.BackColor = rtbOutput.BackColor
txtGWLocation.ForeColor = rtbOutput.ForeColor
txtGWLocation.BackColor = rtbOutput.BackColor
txtExecuteScript.ForeColor = rtbOutput.ForeColor
txtExecuteScript.BackColor = rtbOutput.BackColor
txtPythonLocation.ForeColor = rtbOutput.ForeColor
txtPythonLocation.BackColor = rtbOutput.BackColor
txtWPCWidth.ForeColor = rtbOutput.ForeColor
txtWPCWidth.BackColor = rtbOutput.BackColor
txtTrackGroup.ForeColor = rtbOutput.ForeColor
txtTrackGroup.BackColor = rtbOutput.BackColor
cmbRate.ForeColor = cmbSerialPorts.ForeColor
cmbRate.BackColor = cmbSerialPorts.BackColor
cmbSeekA.ForeColor = cmbSerialPorts.ForeColor
cmbSeekA.BackColor = cmbSerialPorts.BackColor
cmbSeekB.ForeColor = cmbSerialPorts.ForeColor
cmbSeekB.BackColor = cmbSerialPorts.BackColor
cmbRPM.ForeColor = cmbSerialPorts.ForeColor
cmbRPM.BackColor = cmbSerialPorts.BackColor
cmbReadFormat.ForeColor = cmbSerialPorts.ForeColor
cmbReadFormat.BackColor = cmbSerialPorts.BackColor
cmbDisk.ForeColor = cmbSerialPorts.ForeColor
cmbDisk.BackColor = cmbSerialPorts.BackColor
cmbDiskOf.ForeColor = cmbSerialPorts.ForeColor
cmbDiskOf.BackColor = cmbSerialPorts.BackColor
cmbDiskRevision.ForeColor = cmbSerialPorts.ForeColor
cmbDiskRevision.BackColor = cmbSerialPorts.BackColor
cmbDiskRevision.ForeColor = cmbSerialPorts.ForeColor
cmbDiskRevision.BackColor = cmbSerialPorts.BackColor
cmbDump.ForeColor = cmbSerialPorts.ForeColor
cmbDump.BackColor = cmbSerialPorts.BackColor
cmbSystem.ForeColor = cmbSerialPorts.ForeColor
cmbSystem.BackColor = cmbSerialPorts.BackColor
cmbPIN.ForeColor = cmbSerialPorts.ForeColor
cmbPIN.BackColor = cmbSerialPorts.BackColor
cmbDriveSelect.ForeColor = cmbSerialPorts.ForeColor
cmbDriveSelect.BackColor = cmbSerialPorts.BackColor
cmbRevolutions.ForeColor = cmbSerialPorts.ForeColor
cmbRevolutions.BackColor = cmbSerialPorts.BackColor
cmbStartTrack.ForeColor = cmbSerialPorts.ForeColor
cmbStartTrack.BackColor = cmbSerialPorts.BackColor
cmbEndTrack.ForeColor = cmbSerialPorts.ForeColor
cmbEndTrack.BackColor = cmbSerialPorts.BackColor
cmbWPCType.ForeColor = cmbSerialPorts.ForeColor
cmbWPCType.BackColor = cmbSerialPorts.BackColor
cmbWPCTrackRange.ForeColor = cmbSerialPorts.ForeColor
cmbWPCTrackRange.BackColor = cmbSerialPorts.BackColor
cmbWPCTracks.ForeColor = cmbSerialPorts.ForeColor
cmbWPCTracks.BackColor = cmbSerialPorts.BackColor
cmbSides.ForeColor = cmbSerialPorts.ForeColor
cmbSides.BackColor = cmbSerialPorts.BackColor
cmbStepping.ForeColor = cmbSerialPorts.ForeColor
cmbStepping.BackColor = cmbSerialPorts.BackColor
cmbOffsetHeadBy.ForeColor = cmbSerialPorts.ForeColor
cmbOffsetHeadBy.BackColor = cmbSerialPorts.BackColor
cmbHeadOffsetHead.ForeColor = cmbSerialPorts.ForeColor
cmbHeadOffsetHead.BackColor = cmbSerialPorts.BackColor
cmbRetries.ForeColor = cmbSerialPorts.ForeColor
cmbRetries.BackColor = cmbSerialPorts.BackColor
cmbCleanMS.ForeColor = cmbSerialPorts.ForeColor
cmbCleanMS.BackColor = cmbSerialPorts.BackColor
cmbCleanPasses.ForeColor = cmbSerialPorts.ForeColor
cmbCleanPasses.BackColor = cmbSerialPorts.BackColor
cmbManufacturer.BackColor = cmbSerialPorts.BackColor
cmbManufacturer.ForeColor = cmbSerialPorts.ForeColor
cmbDiskTypes.BackColor = cmbSerialPorts.BackColor
cmbDiskTypes.ForeColor = cmbSerialPorts.ForeColor
LinkLabelGWWiki.ForeColor = LinkLabelProjectName.ForeColor
LinkLabelGWWiki.LinkColor = LinkLabelProjectName.LinkColor
LinkLabelGWWiki.VisitedLinkColor = LinkLabelProjectName.VisitedLinkColor
LinkLabelLaunchGW.ForeColor = LinkLabelProjectName.ForeColor
LinkLabelLaunchGW.LinkColor = LinkLabelProjectName.LinkColor
LinkLabelLaunchGW.VisitedLinkColor = LinkLabelProjectName.VisitedLinkColor
LinkLabelDriveSelect.ForeColor = LinkLabelProjectName.ForeColor
LinkLabelDriveSelect.LinkColor = LinkLabelProjectName.LinkColor
LinkLabelDriveSelect.VisitedLinkColor = LinkLabelProjectName.VisitedLinkColor
llabelPreCompensate.ForeColor = LinkLabelProjectName.ForeColor
llabelPreCompensate.LinkColor = LinkLabelProjectName.LinkColor
llabelPreCompensate.VisitedLinkColor = LinkLabelProjectName.VisitedLinkColor
LinkLabelOpenLocation.ForeColor = LinkLabelProjectName.ForeColor
LinkLabelOpenLocation.LinkColor = LinkLabelProjectName.LinkColor
LinkLabelOpenLocation.VisitedLinkColor = LinkLabelProjectName.VisitedLinkColor
LinkLabelDLGW.ForeColor = LinkLabelProjectName.ForeColor
LinkLabelDLGW.LinkColor = LinkLabelProjectName.LinkColor
LinkLabelDLGW.VisitedLinkColor = LinkLabelProjectName.VisitedLinkColor
LinkLabelDownloadPython.ForeColor = LinkLabelProjectName.ForeColor
LinkLabelDownloadPython.LinkColor = LinkLabelProjectName.LinkColor
LinkLabelDownloadPython.VisitedLinkColor = LinkLabelProjectName.VisitedLinkColor
LinkLabelLaunchNow.ForeColor = LinkLabelProjectName.ForeColor
LinkLabelLaunchNow.LinkColor = LinkLabelProjectName.LinkColor
LinkLabelLaunchNow.VisitedLinkColor = LinkLabelProjectName.VisitedLinkColor
btnInfo.ForeColor = btnWrite.ForeColor
btnInfo.BackColor = btnWrite.BackColor
btnEraseDisk.ForeColor = btnWrite.ForeColor
btnEraseDisk.BackColor = btnWrite.BackColor
btnGWBandwidth.ForeColor = btnWrite.ForeColor
btnGWBandwidth.BackColor = btnWrite.BackColor
btnGWDelays.ForeColor = btnWrite.ForeColor
btnGWDelays.BackColor = btnWrite.BackColor
btnRead.ForeColor = btnWrite.ForeColor
btnRead.BackColor = btnWrite.BackColor
btnResetDevice.ForeColor = btnWrite.ForeColor
btnResetDevice.BackColor = btnWrite.BackColor
btnUpdateFirmware.ForeColor = btnWrite.ForeColor
btnUpdateFirmware.BackColor = btnWrite.BackColor
btnSetPin.ForeColor = btnWrite.ForeColor
btnSetPin.BackColor = btnWrite.BackColor
btnExecuteScript.ForeColor = btnWrite.ForeColor
btnExecuteScript.BackColor = btnWrite.BackColor
btnGW_EXE.ForeColor = btnWrite.ForeColor
btnGW_EXE.BackColor = btnWrite.BackColor
btnSaveLocation.ForeColor = btnWrite.ForeColor
btnSaveLocation.BackColor = btnWrite.BackColor
btnResize.ForeColor = btnWrite.ForeColor
btnResize.BackColor = btnWrite.BackColor
btnSeekA.ForeColor = btnWrite.ForeColor
btnSeekA.BackColor = btnWrite.BackColor
btnSeekB.ForeColor = btnWrite.ForeColor
btnSeekB.BackColor = btnWrite.BackColor
btnPython_EXE.ForeColor = btnWrite.ForeColor
btnPython_EXE.BackColor = btnWrite.BackColor
btnClean.ForeColor = btnWrite.ForeColor
btnClean.BackColor = btnWrite.BackColor
btnHidePaths.ForeColor = btnWrite.ForeColor
btnHidePaths.BackColor = btnWrite.BackColor
ContextMenuStripMainCommands.BackColor = Me.BackColor
ContextMenuStripMainCommands.ForeColor = Me.ForeColor
Return True
End Function
''' <summary>
''' Write Settings out to VB.NET My.Settings section (All settings are per user)
''' </summary>
Public Sub SaveSettings()
My.Settings.SaveLoc = txtSaveLocation.Text.Trim
My.Settings.GWExe = txtGWLocation.Text.Trim
My.Settings.F7 = chkF7.Checked
My.Settings.Drive = cmbDriveSelect.Text.Trim
My.Settings.COM = cmbSerialPorts.Text.Trim
My.Settings.Title = txtTitle.Text.Trim
My.Settings.Company = txtPublisher.Text.Trim
My.Settings.System = cmbSystem.Text.Trim
My.Settings.Script = txtExecuteScript.Text.Trim
My.Settings.Disk = cmbDisk.Text
My.Settings.DiskOf = cmbDiskOf.Text
My.Settings.ExecuteScript = chkExecuteScriptAfterRead.Checked
My.Settings.LoopDump = chkLoop.Checked
My.Settings.LoopDumpCount = cmbDump.Text
My.Settings.Stepping = CInt(cmbStepping.Text)
My.Settings.StartTrack = ChkStartTrack.Checked
My.Settings.RunningLog = chkLOG.Checked
My.Settings.EraseEmpty = chkEraseEmpty.Checked
My.Settings.UsePython = chkUsePython.Checked
My.Settings.PythonExe = txtPythonLocation.Text
My.Settings.UseWritePreCompensate = chkWritePreCompensate.Checked
My.Settings.WPCTrackRange = cmbWPCTrackRange.Text
My.Settings.WPCTracks = cmbWPCTracks.Text
My.Settings.WPCType = cmbWPCType.Text
My.Settings.WPCTrackWidth = txtWPCWidth.Text
My.Settings.HeadOffsetEnable = chkOffsetHead.Checked
My.Settings.HeadOffsetTrackCount = CInt(cmbOffsetHeadBy.Text)
My.Settings.HeadOffsetHead = CInt(cmbHeadOffsetHead.Text)
My.Settings.SetManDisktype = chkSetManDiskType.Checked
My.Settings.Manufacturer = cmbManufacturer.SelectedIndex
My.Settings.DiskType = cmbDiskTypes.SelectedIndex
My.Settings.ExtremeSeek = chkExtremeSeek.Checked
My.Settings.SeekWithMotorOn = chkMotorOn.Checked
My.Settings.DisableWriteVerify = chkDisableVerify.Checked
If IsNumeric(cmbRetries.Text) Then
My.Settings.Retries = CInt(cmbRetries.Text)
End If
My.Settings.EnableRetries = chkRetries.Checked
If IsNumeric(cmbCleanMS.Text) Then
My.Settings.CleanTimeMS = CInt(cmbCleanMS.Text)
End If
My.Settings.EnableCleanTimeMS = chkLingerCleaning.Checked
If IsNumeric(cmbCleanPasses.Text) Then
My.Settings.CleanPasses = CInt(cmbCleanPasses.Text)
End If
My.Settings.EnableCleanPasses = chkCleanPasses.Checked
My.Settings.ShowTime = chkTime.Checked
If Me.BackColor = System.Drawing.SystemColors.Control Then
My.Settings.DarkTheme = False
Else
My.Settings.DarkTheme = True
End If
If IsNumeric(cmbSeekA.Text) Then
My.Settings.SeekA = CInt(cmbSeekA.Text)
Else
My.Settings.SeekA = 0
End If
If IsNumeric(cmbSeekB.Text) Then
My.Settings.SeekB = CInt(cmbSeekB.Text)
Else
My.Settings.SeekB = 83
End If
If IsNumeric(cmbStartTrack.Text) Then
My.Settings.StartTrackNo = CInt(cmbStartTrack.Text)
Else
My.Settings.StartTrackNo = 0
End If
My.Settings.EndTrack = chkEndTrack.Checked
If IsNumeric(cmbEndTrack.Text) Then
My.Settings.EndTrackNo = CInt(cmbEndTrack.Text)
Else
My.Settings.EndTrackNo = 83
End If
My.Settings.Sides = cmbSides.Text
'My.Settings.AdjustWriteSpeed = chkAdjustSpeed.Checked
My.Settings.IncludeDataRate = chkRate.Checked
My.Settings.IncludeRPM = chkRPM.Checked
My.Settings.RPM = cmbRPM.Text
My.Settings.DataRate = cmbRate.Text
If btnResize.Text = "<" Then My.Settings.WideForm = True Else My.Settings.WideForm = False
My.Settings.SeparateFolders = chkSeparateFolders.Checked
My.Settings.Save()
End Sub
''' <summary>
''' Creates an XML file with the v2.2 SCP file format list of manufacturers and disk types. (Used in the onscreen combo boxes (ie just give the combo box index a name)
''' </summary>
''' <param name="XMLFile">Full Path to the XML file to create</param>
''' <returns></returns>
Private Function WriteDefaultDiskTypesXML(ByVal XMLFile As String) As Boolean
Try
Dim writer As New System.Xml.XmlTextWriter(XMLFile, System.Text.Encoding.UTF8)
writer.WriteStartDocument(True)
writer.Formatting = System.Xml.Formatting.Indented
writer.Indentation = 4
writer.WriteStartElement("Disks")
writer.WriteStartElement("Manufacturer") 'Manufacturer
writer.WriteStartElement("Name") 'Name
writer.WriteString("Commodore")
writer.WriteEndElement() '/Name
writer.WriteStartElement("DiskTypes") 'DiskTypes
writer.WriteStartElement("Name")
writer.WriteString("C64")
writer.WriteEndElement()
writer.WriteStartElement("Name")
writer.WriteString("Unused")
writer.WriteEndElement()
writer.WriteStartElement("Name")
writer.WriteString("Unused")
writer.WriteEndElement()
writer.WriteStartElement("Name")
writer.WriteString("Unused")
writer.WriteEndElement()
writer.WriteStartElement("Name")
writer.WriteString("Amiga")
writer.WriteEndElement()
writer.WriteEndElement() '/DiskTypes
writer.WriteEndElement() '/Manufacturer
writer.WriteStartElement("Manufacturer")
writer.WriteStartElement("Name")
writer.WriteString("Atari")
writer.WriteEndElement()
writer.WriteStartElement("DiskTypes")
writer.WriteStartElement("Name")
writer.WriteString("Atari 8-bit (FM) Single Density")
writer.WriteEndElement()
writer.WriteStartElement("Name")
writer.WriteString("Atari 8-bit (FM) Double Density")
writer.WriteEndElement()
writer.WriteStartElement("Name")
writer.WriteString("Atari 8-bit (FM) Enhanced Density")
writer.WriteEndElement()
writer.WriteStartElement("Name")
writer.WriteString("Unused")
writer.WriteEndElement()
writer.WriteStartElement("Name")
writer.WriteString("Atari ST (Single Sided) (Double Density)")
writer.WriteEndElement()
writer.WriteStartElement("Name")
writer.WriteString("Atari ST (Double Sided) (Double Density)")
writer.WriteEndElement()
writer.WriteEndElement() '/DiskTypes
writer.WriteEndElement() '/Manufacturer
writer.WriteStartElement("Manufacturer")
writer.WriteStartElement("Name")
writer.WriteString("Apple")
writer.WriteEndElement()
writer.WriteStartElement("DiskTypes")
writer.WriteStartElement("Name")
writer.WriteString("Apple II")
writer.WriteEndElement()
writer.WriteStartElement("Name")
writer.WriteString("Apple II Pro")
writer.WriteEndElement()
writer.WriteStartElement("Name")
writer.WriteString("Unused")
writer.WriteEndElement()
writer.WriteStartElement("Name")
writer.WriteString("Unused")
writer.WriteEndElement()
writer.WriteStartElement("Name")
writer.WriteString("Apple 400Kb (Double Density) (Single Sided)")
writer.WriteEndElement()
writer.WriteStartElement("Name")
writer.WriteString("Apple 800Kb (Double Density) (Double Sided)")
writer.WriteEndElement()
writer.WriteStartElement("Name")
writer.WriteString("Apple 1.44Mb (High Density) (Double Sided)")
writer.WriteEndElement()
writer.WriteEndElement() '/DiskTypes
writer.WriteEndElement() '/Manufacturer
writer.WriteStartElement("Manufacturer")
writer.WriteStartElement("Name")
writer.WriteString("IBM PC")
writer.WriteEndElement()
writer.WriteStartElement("DiskTypes")
writer.WriteStartElement("Name")
writer.WriteString("360Kb (5.25"") (Double Density) (Double Sided) [40 Track]")
writer.WriteEndElement()
writer.WriteStartElement("Name")
writer.WriteString("720Kb (3.5"") (Double Density) (Double Sided)")
writer.WriteEndElement()
writer.WriteStartElement("Name")
writer.WriteString("1.2Mb (5.25"") (High Density) (Double Sided)")
writer.WriteEndElement()
writer.WriteStartElement("Name")
writer.WriteString("1.44Mb (3.5"") (High Density) (Double Sided)")
writer.WriteEndElement()
writer.WriteEndElement() '/DiskTypes
writer.WriteEndElement() '/Manufacturer
writer.WriteStartElement("Manufacturer")
writer.WriteStartElement("Name")
writer.WriteString("Tandy")
writer.WriteEndElement()
writer.WriteStartElement("DiskTypes")
writer.WriteStartElement("Name")
writer.WriteString("TRS80 (Single Density) (Single Sided)")
writer.WriteEndElement()
writer.WriteStartElement("Name")
writer.WriteString("TRS80 (Double Density) (Single Sided)")
writer.WriteEndElement()
writer.WriteStartElement("Name")
writer.WriteString("TRS80 (Single Density) (Double Sided)")
writer.WriteEndElement()
writer.WriteStartElement("Name")
writer.WriteString("TRS80 (Double Density) (Double Sided)")
writer.WriteEndElement()
writer.WriteEndElement() '/DiskTypes
writer.WriteEndElement() '/Manufacturer
writer.WriteStartElement("Manufacturer")
writer.WriteStartElement("Name")
writer.WriteString("Texas Instruments")
writer.WriteEndElement()
writer.WriteStartElement("DiskTypes")
writer.WriteStartElement("Name")
writer.WriteString("TI-99/4A")
writer.WriteEndElement()
writer.WriteEndElement() '/DiskTypes
writer.WriteEndElement() '/Manufacturer
writer.WriteStartElement("Manufacturer")
writer.WriteStartElement("Name")
writer.WriteString("Roland")
writer.WriteEndElement()
writer.WriteStartElement("DiskTypes")
writer.WriteStartElement("Name")
writer.WriteString("D20")
writer.WriteEndElement()
writer.WriteEndElement() '/DiskTypes
writer.WriteEndElement() '/Manufacturer
writer.WriteStartElement("Manufacturer")
writer.WriteStartElement("Name")
writer.WriteString("Amstrad")
writer.WriteEndElement()
writer.WriteStartElement("DiskTypes")
writer.WriteStartElement("Name")
writer.WriteString("CPC")
writer.WriteEndElement()
writer.WriteEndElement() '/DiskTypes
writer.WriteEndElement() '/Manufacturer
writer.WriteStartElement("Manufacturer")
writer.WriteStartElement("Name")
writer.WriteString("Other")
writer.WriteEndElement()
writer.WriteStartElement("DiskTypes")
writer.WriteStartElement("Name")
writer.WriteString("360Kb (5.25"") (Double Density) (Double Sided) [40 Track]")
writer.WriteEndElement()
writer.WriteStartElement("Name")
writer.WriteString("1.2Mb (5.25"") (High Density) (Double Sided)")
writer.WriteEndElement()
writer.WriteStartElement("Name")
writer.WriteString("Reserved (1)")
writer.WriteEndElement()
writer.WriteStartElement("Name")
writer.WriteString("Reserved (2)")
writer.WriteEndElement()
writer.WriteStartElement("Name")
writer.WriteString("720Kb (3.5"") (Double Density) (Double Sided)")
writer.WriteEndElement()
writer.WriteStartElement("Name")
writer.WriteString("1.44Mb (3.5"") (High Density) (Double Sided)")
writer.WriteEndElement()
writer.WriteEndElement() '/DiskTypes
writer.WriteEndElement() '/Manufacturer
writer.WriteStartElement("Manufacturer")
writer.WriteStartElement("Name")
writer.WriteString("Unused")
writer.WriteEndElement()
writer.WriteStartElement("DiskTypes")
writer.WriteEndElement() '/DiskTypes
writer.WriteEndElement() '/Manufacturer
writer.WriteStartElement("Manufacturer")
writer.WriteStartElement("Name")
writer.WriteString("Unused")
writer.WriteEndElement()
writer.WriteStartElement("DiskTypes")
writer.WriteEndElement() '/DiskTypes
writer.WriteEndElement() '/Manufacturer
writer.WriteStartElement("Manufacturer")
writer.WriteStartElement("Name")
writer.WriteString("Unused")
writer.WriteEndElement()
writer.WriteStartElement("DiskTypes")
writer.WriteEndElement() '/DiskTypes
writer.WriteEndElement() '/Manufacturer
writer.WriteStartElement("Manufacturer")
writer.WriteStartElement("Name")
writer.WriteString("Unused")
writer.WriteEndElement()
writer.WriteStartElement("DiskTypes")
writer.WriteEndElement() '/DiskTypes
writer.WriteEndElement() '/Manufacturer
writer.WriteStartElement("Manufacturer")
writer.WriteStartElement("Name")
writer.WriteString("Unused")
writer.WriteEndElement()
writer.WriteStartElement("DiskTypes")
writer.WriteEndElement() '/DiskTypes
writer.WriteEndElement() '/Manufacturer
writer.WriteStartElement("Manufacturer")
writer.WriteStartElement("Name")
writer.WriteString("Tape Drive")
writer.WriteEndElement()
writer.WriteStartElement("DiskTypes")
writer.WriteStartElement("Name")
writer.WriteString("GCR (1)")
writer.WriteEndElement()
writer.WriteStartElement("Name")
writer.WriteString("GCR (2)")
writer.WriteEndElement()
writer.WriteStartElement("Name")
writer.WriteString("MFM")
writer.WriteEndElement()
writer.WriteEndElement() '/DiskTypes
writer.WriteEndElement() '/Manufacturer
writer.WriteStartElement("Manufacturer")
writer.WriteStartElement("Name")
writer.WriteString("Hard Drive")
writer.WriteEndElement()
writer.WriteStartElement("DiskTypes")
writer.WriteStartElement("Name")
writer.WriteString("MFM")
writer.WriteEndElement()
writer.WriteStartElement("Name")
writer.WriteString("RLL")
writer.WriteEndElement()
writer.WriteEndElement() '/DiskTypes
writer.WriteEndElement() '/Manufacturer
writer.WriteEndDocument()
writer.Close()
Return True
Catch ex As Exception
Return False
End Try
End Function
''' <summary>
'''
''' </summary>
''' <param name="XMLFile"></param>
''' <returns></returns>
Private Function ReadDefaultDiskXML(ByVal XMLFile As String) As Boolean
Dim xd As New Xml.XmlDocument 'Create new XML Document. for the disks xml
Dim xn As Xml.XmlNodeList 'Create a new XML Node, for reading disks xml nodes
Dim xn2 As Xml.XmlNodeList 'Create a new XML Node, for reading disks xml nodes
xd.Load(XMLFile) 'Load disks xml into xml document
Dim i As Integer 'Count of number of manufacturer elements in the .xml file
Dim x As Integer
xn = xd.GetElementsByTagName("Manufacturer")
For i = 0 To xn.Count - 1
ReDim Preserve Manufacturers(xn.Count - 1)
Try
Manufacturers(i) = xn(i).FirstChild.InnerText.Trim
xn2 = xn(i).ChildNodes.Item(1).ChildNodes
If Not xn2 Is Nothing Then
'ReDim Preserve DiskArray(i, xn2.Count - 1)
For x = 0 To xn2.Count - 1
DiskArray(i, x) = xn2(x).InnerText.Trim 'Attributes.GetNamedItem("Name").InnerText.Trim
Next
End If
Catch ex As Exception
Return False
End Try
Next
Return True
End Function
''' <summary>
''' Create a filename from the attributes onscreen. (Including checking if file exists, if necessary)
''' </summary>
''' <param name="CheckExists">Check to see if the file exists on the disk. If so, append an integer to prevent GreaseSeazle from overwriting.</param>
''' <returns>Filename as a string.</returns>
Function CreateFileName(ByVal CheckExists As Boolean, ByVal UseFolders As Boolean) As String
Dim regWhitespace As New Regex("\s")
Dim filen As String
filen = txtTitle.Text 'Set initial name to Title
If txtPublisher.Text.Trim <> "" Then
filen += "_" + txtPublisher.Text 'Add publisher if txt field not blank
End If
If cmbDiskOf.Text.Trim <> "" Then 'If "DiskOf" field not blank,
cmbDisk.Text = cmbDisk.Text.Trim.PadLeft(cmbDiskOf.Text.Length, CChar("0")) 'Pad "Disk" number to length of "DiskOf" field with preceding zeros
End If
If ((cmbDisk.Text.Trim <> "") Or (cmbDiskOf.Text.Trim <> "")) Then 'If Disk or disk of fields are not blank, include _
filen += "_"
End If
If cmbDisk.Text.Trim <> "" Then
filen += "Disk" + cmbDisk.Text.Trim 'Add "disk" if txt field not blank
End If
If cmbDiskOf.Text.Trim <> "" Then
filen += "Of" + cmbDiskOf.Text.Trim 'Add "disk of" if txt field not blank
End If
If cmbDiskRevision.Text.Trim <> "" Then
filen += "_" + cmbDiskRevision.Text.Trim 'Add revision, if txt field not blank
End If
If cmbSystem.Text.Trim <> "" Then
filen += "_" + cmbSystem.Text.Trim 'Add system, if txt field not blank
End If
If UseFolders = True Then
filen += "\"
Else
filen += "_"
End If
If cmbDump.Text.Trim <> "" Then
filen += "Dump" + cmbDump.Text.Trim 'Add 'Dump+DumpNumber' field, if dump field not blank
End If
Dim extst As String = ".scp" 'Set file extension (defaulting to SuperCard Pro)
Select Case cmbReadFormat.Text
Case "Supercard Pro" 'Set file extension for SuperCard Pro "SCP"
extst = ".scp"
Case "HxC Floppy Disk Emulator" 'Set file extension for HxC Floppy format "HFE"
extst = ".hfe"
Case "EDSK (Extended Disk Image)" 'Set file extension for Extended Disk Image format (Spectrum +3, Amstrad CPC, Sam Coupe, PC)
extst = ".dsk"
Case "KryoFlux" 'Set file extension for KryoFlux heavy dump format "RAW"
If UseFolders = True Then
extst = "\Track_.raw"
Else
extst = ".raw"
End If
Case Else 'If a different unknown extension is typed in, use that!
extst = cmbReadFormat.Text
End Select
If chkFilenameRreplaceSpaceWithUnderscore.Checked Then
filen = regWhitespace.Replace(filen, "_") 'Replace all spaces with underscores, if check "replace with underscores" checked.
End If
If CheckExists = True Then 'Check to see if file exists already. If so, get next available filename by appending "_X" where x is an ascending integer.
Dim l As Integer = 0
If My.Computer.FileSystem.FileExists(txtSaveLocation.Text.Trim + filen + extst) Then
l = 1
While My.Computer.FileSystem.FileExists(txtSaveLocation.Text.Trim + filen + "_" + CStr(l) + extst) = True
l += 1
End While
End If
If l > 0 Then filen += "_" + CStr(l)
End If
filen += extst 'Finally, add the extension to the filename
Return filen
End Function
''' <summary>
'''
''' </summary>
''' <returns></returns>
Function CheckForErrors() As Boolean
If chkFilenameRreplaceSpaceWithUnderscore.Checked Then
Cleanfields()
End If
If txtGWLocation.Text.Trim <> "" And txtSaveLocation.Text.Trim <> "" Then 'And cmbSerialPorts.Text.Trim <> ""
Return False
Else
Dim errstr As String = ""
DoLOG()
rtbOutput.Clear()
If cmbSerialPorts.Text.Trim = "" Then
errstr = "No COM port selected!" + Environment.NewLine
End If
If txtSaveLocation.Text.Trim = "" Then
errstr &= "Save directory cannot be blank!" + Environment.NewLine
Else
If Not IO.Directory.Exists(txtSaveLocation.Text.Trim) Then
errstr &= "Save directory does Not exist!" + Environment.NewLine
End If
End If
If chkUsePython.Checked Then
If Not IO.File.Exists(txtPythonLocation.Text.Trim) Then
errstr &= "Python.exe Not found!" + Environment.NewLine
End If
If Not IO.File.Exists(txtGWLocation.Text.Trim) Then
errstr &= "GW script Not found!" + Environment.NewLine
End If
Else
If Not IO.File.Exists(txtGWLocation.Text.Trim) Then
errstr &= "gw.exe Not found!" + Environment.NewLine
End If
End If
rtbOutput.Text &= errstr
Return True
End If
End Function