Finished some codes.

This commit is contained in:
Pascal
2017-02-01 17:15:28 +01:00
parent 912c087e5a
commit 57eaa97ef3
7 changed files with 112 additions and 94 deletions

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8"?>
<configuration> <configuration>
<startup> <startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" /> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
</startup> </startup>
</configuration> </configuration>

View File

@@ -311,8 +311,6 @@ Partial Class Form1
Me.SwitchButton_Liquids.Size = New System.Drawing.Size(57, 23) Me.SwitchButton_Liquids.Size = New System.Drawing.Size(57, 23)
Me.SwitchButton_Liquids.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled Me.SwitchButton_Liquids.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled
Me.SwitchButton_Liquids.TabIndex = 49 Me.SwitchButton_Liquids.TabIndex = 49
Me.SwitchButton_Liquids.Value = True
Me.SwitchButton_Liquids.ValueObject = "Y"
' '
'LabelX8 'LabelX8
' '
@@ -468,8 +466,6 @@ Partial Class Form1
Me.SwitchButton_BlocksEtc.Size = New System.Drawing.Size(57, 23) Me.SwitchButton_BlocksEtc.Size = New System.Drawing.Size(57, 23)
Me.SwitchButton_BlocksEtc.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled Me.SwitchButton_BlocksEtc.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled
Me.SwitchButton_BlocksEtc.TabIndex = 34 Me.SwitchButton_BlocksEtc.TabIndex = 34
Me.SwitchButton_BlocksEtc.Value = True
Me.SwitchButton_BlocksEtc.ValueObject = "Y"
' '
'LabelX9 'LabelX9
' '

View File

@@ -74,7 +74,8 @@ Public Class Form1
SwitchButton_Liquids.Value) SwitchButton_Liquids.Value)
Case 1 : MessageBoxEx.Show("Done", "Patch succesfully created!", MessageBoxButtons.OK, MessageBoxIcon.Information) Case 1 : MessageBoxEx.Show("Done", "Patch succesfully created!", MessageBoxButtons.OK, MessageBoxIcon.Information)
Case Else : MessageBoxEx.Show("Done", "Patch succesfully created!", MessageBoxButtons.OK, MessageBoxIcon.Information) Case 2 : MessageBoxEx.Show("Done", "There is an error at packing!", MessageBoxButtons.OK, MessageBoxIcon.Error)
Case Else : MessageBoxEx.Show("Done", "There is an unknown error!", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Select End Select
Button_CreatePatch.Enabled = True Button_CreatePatch.Enabled = True
@@ -83,7 +84,20 @@ Public Class Form1
End Sub End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button_ApplyPatch.Click Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button_ApplyPatch.Click
SMBXPFX.ApplyPatch(TextBoxX_OriginalLevelApply.Text, TextBoxX_PatchFileApply.Text) CircularProgress_Apply.IsRunning = True
LabelX14.Enabled = True
Button_ApplyPatch.Enabled = True
Select Case SMBXPFX.ApplyPatch(TextBoxX_OriginalLevelApply.Text, TextBoxX_PatchFileApply.Text)
Case 1 : MessageBoxEx.Show("Done", "Patch applied succesfully!", MessageBoxButtons.OK, MessageBoxIcon.Information)
Case 2 : MessageBoxEx.Show("Done", "There is an error at extracting files! Or maybe this isn't a valid patch file.", MessageBoxButtons.OK, MessageBoxIcon.Error)
Case 3 : MessageBoxEx.Show("Done", "This isn't a valid patch file.", MessageBoxButtons.OK, MessageBoxIcon.Error)
Case Else : MessageBoxEx.Show("Done", "There is an unknown error!", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Select
LabelX14.Enabled = False
CircularProgress_Apply.IsRunning = False
Button_ApplyPatch.Enabled = False
End Sub End Sub
Private Sub CheckBoxX2_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBoxX2.CheckedChanged Private Sub CheckBoxX2_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBoxX2.CheckedChanged
@@ -190,16 +204,17 @@ SkipCheck: End If
Return 2 'Error at packing Return 2 'Error at packing
End If End If
Directory.Delete(TempLeveldir, True)
Return 1 Return 1
End Function End Function
Shared Function ApplyPatch(OriginalLevel As String, PatchFile As String) As Integer Shared Function ApplyPatch(OriginalLevel As String, PatchFile As String) As Integer
Dim PatchTyp As Integer = 0 '0 = plx | 1 = slp Dim PatchTyp As Integer = 0 '0 = plx | 1 = slp
Dim PLevel As List(Of String) = File.ReadAllLines(OriginalLevel).ToList Dim PLevel As List(Of String) = File.ReadAllLines(OriginalLevel).ToList
Dim TempLeveldir As String = Form1.TempDir & "\TempLevel" Dim TempLeveldir As String = Form1.TempDir & "\TempLevel" : Dim TempLevelfiledir As String = TempLeveldir & "\data"
Dim TempLevelfiledir As String = TempLeveldir & "\data" Dim oLeveldir As String = Path.GetDirectoryName(OriginalLevel) : Dim oLevelfiledir As String = oLeveldir & "\" & Path.GetFileNameWithoutExtension(OriginalLevel)
If Directory.Exists(TempLeveldir) Then Directory.Delete(TempLeveldir, True) If Directory.Exists(TempLeveldir) Then Directory.Delete(TempLeveldir, True) : Application.DoEvents()
Directory.CreateDirectory(TempLeveldir) Directory.CreateDirectory(TempLeveldir) : Application.DoEvents()
'Check Patchtyp: 'Check Patchtyp:
Select Case Path.GetExtension(PatchFile) Select Case Path.GetExtension(PatchFile)
@@ -220,7 +235,6 @@ SkipCheck: End If
sevenzip.StartInfo.UseShellExecute = False sevenzip.StartInfo.UseShellExecute = False
sevenzip.StartInfo.CreateNoWindow = True sevenzip.StartInfo.CreateNoWindow = True
sevenzip.Start() sevenzip.Start()
Do Until sevenzip.HasExited = True : Application.DoEvents() : Loop Do Until sevenzip.HasExited = True : Application.DoEvents() : Loop
If sevenzip.ExitCode <> 0 Then If sevenzip.ExitCode <> 0 Then
Return 2 'Error at packing Return 2 'Error at packing
@@ -228,7 +242,7 @@ SkipCheck: End If
End If End If
'Load patchlevel: 'Load patchlevel:
Dim PFile() As String = {""} Dim PFile() As String = {}
Select Case PatchTyp Select Case PatchTyp
Case 0 : PFile = File.ReadAllLines(TempLeveldir & "\data.dat") Case 0 : PFile = File.ReadAllLines(TempLeveldir & "\data.dat")
Case 1 : PFile = File.ReadAllLines(PatchFile) Case 1 : PFile = File.ReadAllLines(PatchFile)
@@ -236,15 +250,21 @@ SkipCheck: End If
'Apply lines in patch to the level: 'Apply lines in patch to the level:
For Each l As String In PFile For Each l As String In PFile
If Not PLevel.Contains(l) Then If Not PLevel.Contains(l) Then PLevel.Add(l)
PLevel.Add(l)
End If
Next Next
'Copy and replace files 'Copy and replace files
If PatchTyp = 0 Then If PatchTyp = 0 Then
Dim ListFilesInLeveldir() As String = Directory.GetFileSystemEntries(TempLeveldir) Dim pListFilesInLeveldir() As String = Directory.GetFiles(TempLeveldir) : Dim pListFilesInLevelfiledir() As String = {} : If Directory.Exists(TempLevelfiledir) Then pListFilesInLevelfiledir = Directory.GetFiles(TempLevelfiledir)
Dim oListFilesInLeveldir() As String = Directory.GetFiles(oLeveldir) : Dim oListFilesInLevelfiledir() As String = {} : If Directory.Exists(oLevelfiledir) Then oListFilesInLevelfiledir = Directory.GetFiles(oLevelfiledir)
If Not Directory.Exists(oLevelfiledir) And oListFilesInLevelfiledir.Count > 0 Then Directory.CreateDirectory(oLevelfiledir)
For i As Integer = 0 To pListFilesInLeveldir.Count - 1
If Not pListFilesInLeveldir(i) = TempLeveldir & "\data.dat" Then
File.Copy(pListFilesInLeveldir(i), oLeveldir & "\" & Path.GetFileName(pListFilesInLeveldir(i)), True) : MsgBox("") : End If
Application.DoEvents() : Next
For i As Integer = 0 To pListFilesInLevelfiledir.Count - 1
File.Copy(pListFilesInLevelfiledir(i), oLevelfiledir & "\" & Path.GetFileName(pListFilesInLevelfiledir(i)), True)
Application.DoEvents() : Next
End If End If
'Wirte new level file 'Wirte new level file

View File

@@ -1,10 +1,10 @@
'------------------------------------------------------------------------------ '------------------------------------------------------------------------------
' <auto-generated> ' <auto-generated>
' This code was generated by a tool. ' Dieser Code wurde von einem Tool generiert.
' Runtime Version:4.0.30319.42000 ' Laufzeitversion:4.0.30319.42000
' '
' Changes to this file may cause incorrect behavior and will be lost if ' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
' the code is regenerated. ' der Code erneut generiert wird.
' </auto-generated> ' </auto-generated>
'------------------------------------------------------------------------------ '------------------------------------------------------------------------------
@@ -14,10 +14,10 @@ Option Explicit On
Namespace My Namespace My
'NOTE: This file is auto-generated; do not modify it directly. To make changes, 'HINWEIS: Diese Datei wird automatisch generiert und darf nicht direkt bearbeitet werden. Wenn Sie Änderungen vornehmen möchten,
' or if you encounter build errors in this file, go to the Project Designer ' oder bei in dieser Datei auftretenden Buildfehlern wechseln Sie zum Projekt-Designer.
' (go to Project Properties or double-click the My Project node in ' (Wechseln Sie dazu zu den Projekteigenschaften, oder doppelklicken Sie auf den Knoten "Mein Projekt" im
' Solution Explorer), and make changes on the Application tab. ' Projektmappen-Explorer). Nehmen Sie auf der Registerkarte "Anwendung" entsprechende Änderungen vor.
' '
Partial Friend Class MyApplication Partial Friend Class MyApplication

View File

@@ -1,25 +1,26 @@
'------------------------------------------------------------------------------ '------------------------------------------------------------------------------
' <auto-generated> ' <auto-generated>
' This code was generated by a tool. ' Dieser Code wurde von einem Tool generiert.
' Runtime Version:4.0.30319.42000 ' Laufzeitversion:4.0.30319.42000
' '
' Changes to this file may cause incorrect behavior and will be lost if ' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
' the code is regenerated. ' der Code erneut generiert wird.
' </auto-generated> ' </auto-generated>
'------------------------------------------------------------------------------ '------------------------------------------------------------------------------
Option Strict On Option Strict On
Option Explicit On Option Explicit On
Imports System
Namespace My.Resources Namespace My.Resources
'This class was auto-generated by the StronglyTypedResourceBuilder 'Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert
'class via a tool like ResGen or Visual Studio. '-Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert.
'To add or remove a member, edit your .ResX file then rerun ResGen 'Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
'with the /str option, or rebuild your VS project. 'mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu.
'''<summary> '''<summary>
''' A strongly-typed resource class, for looking up localized strings, etc. ''' Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
'''</summary> '''</summary>
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0"), _ <Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0"), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _ Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
@@ -32,7 +33,7 @@ Namespace My.Resources
Private resourceCulture As Global.System.Globalization.CultureInfo Private resourceCulture As Global.System.Globalization.CultureInfo
'''<summary> '''<summary>
''' Returns the cached ResourceManager instance used by this class. ''' Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
'''</summary> '''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _ <Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
@@ -46,15 +47,15 @@ Namespace My.Resources
End Property End Property
'''<summary> '''<summary>
''' Overrides the current thread's CurrentUICulture property for all ''' Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
''' resource lookups using this strongly typed resource class. ''' Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden.
'''</summary> '''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _ <Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Friend Property Culture() As Global.System.Globalization.CultureInfo Friend Property Culture() As Global.System.Globalization.CultureInfo
Get Get
Return resourceCulture Return resourceCulture
End Get End Get
Set(ByVal value As Global.System.Globalization.CultureInfo) Set
resourceCulture = value resourceCulture = value
End Set End Set
End Property End Property

View File

@@ -1,10 +1,10 @@
'------------------------------------------------------------------------------ '------------------------------------------------------------------------------
' <auto-generated> ' <auto-generated>
' This code was generated by a tool. ' Dieser Code wurde von einem Tool generiert.
' Runtime Version:4.0.30319.42000 ' Laufzeitversion:4.0.30319.42000
' '
' Changes to this file may cause incorrect behavior and will be lost if ' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
' the code is regenerated. ' der Code erneut generiert wird.
' </auto-generated> ' </auto-generated>
'------------------------------------------------------------------------------ '------------------------------------------------------------------------------
@@ -15,14 +15,14 @@ Option Explicit On
Namespace My Namespace My
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _ <Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0"), _ Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0"), _
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _ Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Partial Friend NotInheritable Class MySettings Partial Friend NotInheritable Class MySettings
Inherits Global.System.Configuration.ApplicationSettingsBase Inherits Global.System.Configuration.ApplicationSettingsBase
Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings) Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings)
#Region "My.Settings Auto-Save Functionality" #Region "Funktion zum automatischen Speichern von My.Settings"
#If _MyType = "WindowsForms" Then #If _MyType = "WindowsForms" Then
Private Shared addedHandler As Boolean Private Shared addedHandler As Boolean

View File

@@ -11,8 +11,9 @@
<AssemblyName>SMBX Magic Patcher</AssemblyName> <AssemblyName>SMBX Magic Patcher</AssemblyName>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<MyType>WindowsForms</MyType> <MyType>WindowsForms</MyType>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion> <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<TargetFrameworkProfile />
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>