Skip to content

Commit

Permalink
-Added starting in the middle of the room option
Browse files Browse the repository at this point in the history
-Added update checking functionality
  • Loading branch information
G4B33 committed Mar 9, 2023
1 parent 9877add commit 98a61a1
Show file tree
Hide file tree
Showing 8 changed files with 154 additions and 30 deletions.
30 changes: 30 additions & 0 deletions facade_editor/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,41 @@

<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" /></startup>
<runtime>

<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">

<dependentAssembly>

<assemblyIdentity name="Microsoft.Win32.Registry" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />

<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />

</dependentAssembly>

<dependentAssembly>

<assemblyIdentity name="NAudio.Core" publicKeyToken="e279aa5131008a41" culture="neutral" />

<bindingRedirect oldVersion="0.0.0.0-2.1.0.0" newVersion="2.1.0.0" />

</dependentAssembly>

<dependentAssembly>

<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />

<bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2" />

</dependentAssembly>

<dependentAssembly>

<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />

<bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />

</dependentAssembly>

</assemblyBinding>
</runtime>
</configuration>
14 changes: 14 additions & 0 deletions facade_editor/Form1.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

77 changes: 70 additions & 7 deletions facade_editor/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@
using System.Diagnostics;
using System.Security.Policy;
using System.Reflection;
using System.Net;
using System.Text.Json.Nodes;

namespace facade_editor
{
public partial class Form1 : Form
{
SynchronizationContext synchronizationContext; //this is needed for updating the UI while doing tasks on another thread
string version = "1.0.3";
string version = "1.0.4";
public Form1()
{
InitializeComponent();
Expand All @@ -31,12 +33,12 @@ public Form1()
Text = "Façade editor (Admin rights) " + version;
else
Text = "Façade editor " + version;

checkNewVersion();
}
string[] names = new string[100000]; //used for storing path for the files to randomize, yes I will change it to list or something else later
string path = @""; //path to game
string path = ""; //path to game
int i = 0; //used for a lot of things, sorry will fix this sometime

string newVersionNumber = ""; //used if there's a new version
async void initializeAndReadSettings()
{
if (File.Exists("settings.cfg"))
Expand All @@ -57,6 +59,30 @@ async void initializeAndReadSettings()

}

async Task checkNewVersion()
{
try
{
await Task.Run(() =>
{
WebClient client = new WebClient();
client.Headers.Add("user-agent", "G4B33 facade_editor");
string reply = client.DownloadString("https://api.github.com/repos/G4B33/facade_editor/releases/latest");
var gitHubApi = JsonNode.Parse(reply);
if((string)gitHubApi["name"].ToString().Substring(1) != version)
{
newVersionNumber += " - New version available: "+ (string)gitHubApi["name"].ToString().Substring(1);
UpdateUI("", "New version ("+ (string)gitHubApi["name"].ToString().Substring(1) + ") is available with the next changes:");
UpdateUI("", (string)gitHubApi["body"]);
UpdateUI("", "Go to the About tab to download the update");
linkLabel2.Text += " - Click here to get "+ (string)gitHubApi["name"];
}
});
}
catch { UpdateUI("","Couldn't check for new version"); }
Text += newVersionNumber;
}

async Task removeReadOnly() //I have to remove the read-only attributes, otherwise the program sometimes can't access them
{
try
Expand Down Expand Up @@ -1091,7 +1117,6 @@ await Task.Run(() =>
UpdateUIReplaceTab(customSoundNames[j] + " " + (j + 1) + "/" + customSoundCount, "");
}

UpdateUI("", "Replacing Sounds..");
if (graceCheckBox.Checked)
foreach (string file in Directory.EnumerateFiles(path + @"Sounds\grace", "*.wav", SearchOption.AllDirectories))
{
Expand Down Expand Up @@ -1289,6 +1314,17 @@ void checkSettings() //checking what setting has been enabled before
skipIntroCheckBox.Checked = false;
}

fileCompare = File.ReadAllText(path.Replace("sources", "classes") + @"primact\SetPlayerPosition.class");
fileCompare2 = File.ReadAllText(@"files\SetPlayerPosition.class");
if (fileCompare == fileCompare2)
{
spawnInTheRoomCheckBox.Checked = true;
spawnInTheRoomCheckBox.Enabled = true;
}
else
{
spawnInTheRoomCheckBox.Checked = false;
}

}

Expand Down Expand Up @@ -1707,15 +1743,42 @@ private void skipIntroCheckBox_Click(object sender, EventArgs e)
}
}

private void spawnInTheRoomCheckBox_Click(object sender, EventArgs e)
{
try
{
if (path.Contains(@"sources"))
if (spawnInTheRoomCheckBox.Checked)
File.Copy(@"files\SetPlayerPosition.class", path.Replace("sources", "classes") + @"primact\SetPlayerPosition.class", true);
else
File.Copy(@"files\SetPlayerPosition_orig.class", path.Replace("sources", "classes") + @"primact\SetPlayerPosition.class", true);
else
{
MessageBox.Show("Not the right path");
spawnInTheRoomCheckBox.Checked = false;
}
}
catch (Exception ex)
{
MessageBox.Show("Error:" + ex.Message, "Oh no");
spawnInTheRoomCheckBox.Checked = !spawnInTheRoomCheckBox.Checked;
}
}

private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
MessageBox.Show("I used JD-GUI for decompiling, that gave me the best results. Unfortunately I haven't found any way to recompile them, so that's for reading only. I used bytecode editing on the compiled files instad, I used a program called Recaf for that. To decompile all the class files, open up Facade\\util\\classes\\facade\\Main.class with JD-GUI.", "Info");
}

private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
if (MessageBox.Show(@"Open up this program's GitHub repository?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
Process.Start(@"https://github.com/G4B33/facade_editor");
if (newVersionNumber == "")
if (MessageBox.Show(@"Open up this program's GitHub repository?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
Process.Start(@"https://github.com/G4B33/facade_editor");
else;
else
if (MessageBox.Show(@"Open up the new version's download page?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
Process.Start(@"https://github.com/G4B33/facade_editor/releases");
}


Expand Down
4 changes: 2 additions & 2 deletions facade_editor/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.3.0")]
[assembly: AssemblyFileVersion("1.0.3.0")]
[assembly: AssemblyVersion("1.0.4.0")]
[assembly: AssemblyFileVersion("1.0.4.0")]
45 changes: 31 additions & 14 deletions facade_editor/facade_editor.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,9 @@
<SignManifests>true</SignManifests>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.Win32.Registry, Version=4.1.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Win32.Registry.4.7.0\lib\net461\Microsoft.Win32.Registry.dll</HintPath>
<Reference Include="Microsoft.Win32.Registry, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Win32.Registry.6.0.0-preview.5.21301.5\lib\net461\Microsoft.Win32.Registry.dll</HintPath>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="NAudio.Asio, Version=2.1.0.0, Culture=neutral, PublicKeyToken=e279aa5131008a41, processorArchitecture=MSIL">
<HintPath>..\packages\NAudio.Asio.2.1.0\lib\netstandard2.0\NAudio.Asio.dll</HintPath>
Expand Down Expand Up @@ -114,28 +115,38 @@
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Buffers.4.4.0\lib\netstandard2.0\System.Buffers.dll</HintPath>
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="System.Core" />
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.5.3\lib\netstandard2.0\System.Memory.dll</HintPath>
<Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll</HintPath>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors, Version=4.1.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Numerics.Vectors.4.4.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.5.2\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.7.0.0-preview.2.22152.2\lib\net462\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="System.Security.AccessControl, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.AccessControl.6.0.2-mauipre.1.22102.15\lib\net461\System.Security.AccessControl.dll</HintPath>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="System.Security.AccessControl, Version=4.1.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.AccessControl.4.7.0\lib\net461\System.Security.AccessControl.dll</HintPath>
<Reference Include="System.Security.Principal.Windows, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Principal.Windows.6.0.0-preview.5.21301.5\lib\net461\System.Security.Principal.Windows.dll</HintPath>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="System.Security.Principal.Windows, Version=4.1.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Principal.Windows.4.7.0\lib\net461\System.Security.Principal.Windows.dll</HintPath>
<Reference Include="System.Text.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll</HintPath>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
Expand Down Expand Up @@ -228,6 +239,12 @@
<None Include="files\ReactionDecider_orig.class">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="files\SetPlayerPosition.class">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="files\SetPlayerPosition_orig.class">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="files\StringUtil.class">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
Expand Down
Binary file added facade_editor/files/SetPlayerPosition.class
Binary file not shown.
Binary file added facade_editor/files/SetPlayerPosition_orig.class
Binary file not shown.
14 changes: 7 additions & 7 deletions facade_editor/packages.config
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Win32.Registry" version="4.7.0" targetFramework="net472" />
<package id="Microsoft.Win32.Registry" version="6.0.0-preview.5.21301.5" targetFramework="net472" />
<package id="NAudio.Asio" version="2.1.0" targetFramework="net472" />
<package id="NAudio.Core" version="2.1.0" targetFramework="net472" />
<package id="NAudio.Midi" version="2.1.0" targetFramework="net472" />
<package id="NAudio.Wasapi" version="2.1.0" targetFramework="net472" />
<package id="NAudio.WinForms" version="2.1.0" targetFramework="net472" />
<package id="NAudio.WinMM" version="2.1.0" targetFramework="net472" />
<package id="NVorbis" version="0.10.5" targetFramework="net472" />
<package id="System.Buffers" version="4.4.0" targetFramework="net472" />
<package id="System.Memory" version="4.5.3" targetFramework="net472" />
<package id="System.Numerics.Vectors" version="4.4.0" targetFramework="net472" />
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.2" targetFramework="net472" />
<package id="System.Security.AccessControl" version="4.7.0" targetFramework="net472" />
<package id="System.Security.Principal.Windows" version="4.7.0" targetFramework="net472" />
<package id="System.Buffers" version="4.5.1" targetFramework="net472" />
<package id="System.Memory" version="4.5.5" targetFramework="net472" />
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net472" />
<package id="System.Runtime.CompilerServices.Unsafe" version="7.0.0-preview.2.22152.2" targetFramework="net472" />
<package id="System.Security.AccessControl" version="6.0.2-mauipre.1.22102.15" targetFramework="net472" />
<package id="System.Security.Principal.Windows" version="6.0.0-preview.5.21301.5" targetFramework="net472" />
<package id="System.ValueTuple" version="4.5.0" targetFramework="net472" />
</packages>

0 comments on commit 98a61a1

Please sign in to comment.