Skip to content

Commit

Permalink
- Fixed visual message box bug on C64
Browse files Browse the repository at this point in the history
- Fixed string table formatting bug on Language Editor
- Some code cleanup, more clarification and reorganization
- Minor interface and language string cleanup also
- Fixed a few visual and stability anomalies in GUI
- Made it so that the program now cleans temp directory on opening
  • Loading branch information
CatmanFan committed Feb 12, 2025
1 parent 859a2c2 commit d621afa
Show file tree
Hide file tree
Showing 30 changed files with 256 additions and 213 deletions.
10 changes: 5 additions & 5 deletions FriishProduce/FriishProduce.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -298,11 +298,11 @@
<Compile Include="Subforms\Controllers\Controller_SNES.Designer.cs">
<DependentUpon>Controller_SNES.cs</DependentUpon>
</Compile>
<Compile Include="Subforms\HTMLForm.cs">
<Compile Include="Subforms\MessageBoxHTML.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Subforms\HTMLForm.Designer.cs">
<DependentUpon>HTMLForm.cs</DependentUpon>
<Compile Include="Subforms\MessageBoxHTML.Designer.cs">
<DependentUpon>MessageBoxHTML.cs</DependentUpon>
</Compile>
<Compile Include="Subforms\LanguageEditor.cs">
<SubType>Form</SubType>
Expand Down Expand Up @@ -503,8 +503,8 @@
<DependentUpon>Options_VC_SEGA.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Subforms\HTMLForm.resx">
<DependentUpon>HTMLForm.cs</DependentUpon>
<EmbeddedResource Include="Subforms\MessageBoxHTML.resx">
<DependentUpon>MessageBoxHTML.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Subforms\LanguageEditor.resx">
<DependentUpon>LanguageEditor.cs</DependentUpon>
Expand Down
3 changes: 1 addition & 2 deletions FriishProduce/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@ public void UpdateConfig()
public MainForm(string[] files = null)
{
InitializeComponent();
Program.Handle = Handle;
this.files = files;
}

Expand Down Expand Up @@ -973,7 +972,7 @@ private void ExtractWAD_Click(object sender, EventArgs e)
else
{
if (Program.DebugMode)
throw (error);
throw error;
else
MessageBox.Error(error.Message);
}
Expand Down
47 changes: 19 additions & 28 deletions FriishProduce/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ static class Program
public static Settings Config { get; set; }
public static MainForm MainForm { get; private set; }
public static Language Lang { get; set; }
public static IntPtr Handle { get; set; }

public static bool DebugMode { get => Config?.application?.debug_mode ?? false; }
public static bool GUI { get => MainForm != null; }

/// <summary>
/// The main entry point for the application.
Expand All @@ -42,14 +43,12 @@ static void Main(string[] args)
}
}

try
{
}
catch { }
// **********************************************************************************

Config = new(Paths.Config);
Logger.Log("Opening FriishProduce.");
Lang = new Language();
CleanTemp();

System.Threading.Thread.CurrentThread.CurrentUICulture = System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(Lang.Current);

Expand All @@ -74,33 +73,25 @@ static void Main(string[] args)
public static void CleanTemp()
{
if (!Directory.Exists(Paths.WorkingFolder)) Directory.CreateDirectory(Paths.WorkingFolder);

foreach (var item in Directory.GetFiles(Paths.WorkingFolder, "*.*", SearchOption.AllDirectories))
if (!Path.GetFileName(item).ToLower().Contains("readme.md"))
try { File.Delete(item); } catch { }

foreach (var item in Directory.GetDirectories(Paths.WorkingFolder))
try { Directory.Delete(item, true); } catch { }

if (File.Exists(@"C:\1541 ROM") || File.Exists(@"C:\Basic ROM") || File.Exists(@"C:\Char ROM") || File.Exists(@"C:\Kernal ROM"))
else
{
ProcessStartInfo info = new ProcessStartInfo()
{
FileName = Paths.Tools + "frodosrc\\delete.bat",
Verb = "runas",
WindowStyle = ProcessWindowStyle.Minimized,
CreateNoWindow = true,
UseShellExecute = true,
RedirectStandardInput = false
};

using (Process p = new())
string[] files = Directory.GetFiles(Paths.WorkingFolder, "*.*", SearchOption.AllDirectories);
string[] folders = Directory.GetDirectories(Paths.WorkingFolder);

if (files?.Length > 0 || folders?.Length > 0)
{
p.StartInfo = info;
p.Start();
p.WaitForExit();
Logger.Log("Cleaning temporary files.");

foreach (var item in files)
if (!Path.GetFileName(item).ToLower().Contains("readme.md"))
try { File.Delete(item); } catch { }

foreach (var item in folders)
try { Directory.Delete(item, true); } catch { }
}
}

Injectors.C64.Clean();
}
}

Expand Down
4 changes: 2 additions & 2 deletions FriishProduce/ProjectForm.Designer.cs

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

Loading

0 comments on commit d621afa

Please sign in to comment.