Skip to content

Commit

Permalink
Merge branch 'OverlayPlugin:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
wbonbon authored Feb 26, 2024
2 parents 8be728d + d63b939 commit 1059b5f
Show file tree
Hide file tree
Showing 59 changed files with 1,542 additions and 159 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-artifact.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
path: |
./Thirdparty
./OverlayPlugin.Core/Thirdparty
key: ${{ runner.os }}-overlayplugin-${{ hashFiles('./tools/fetch_deps.ps1', './DEPS.json') }}
key: ${{ runner.os }}-overlayplugin-${{ hashFiles('./tools/fetch_deps.ps1', './DEPS.json', './tools/StripFFXIVClientStructs/StripFFXIVClientStructs/StripFFXIVClientStructs.cs') }}
restore-keys: |
${{ runner.os }}-overlayplugin-
# Fetch dependencies only if cache-hit is false
Expand Down
16 changes: 12 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ jobs:
runs-on: windows-latest
outputs:
version: ${{ steps.determine_version.outputs.version }}
do_release: ${{ steps.check_tag.outputs.do_release }}
steps:
- uses: actions/checkout@v2
with:
Expand All @@ -24,19 +25,26 @@ jobs:
[xml]$csprojcontents = Get-Content -Path "Directory.Build.props";
$version = $csprojcontents.Project.PropertyGroup.AssemblyVersion;
$version = ($version | Out-String).Trim()
echo "::set-output name=version::$version"
echo "version=$version" >> $env:GITHUB_OUTPUT
- name: Check Tag Exists
id: check_tag
shell: bash
run: |
if [ $(git tag -l "v${{ steps.determine_version.outputs.version }}") ]; then
echo "Error: Existing git tag found. Exiting..."
exit 1
echo "Existing git tag found. Exiting..."
echo "do_release=false" >> $GITHUB_OUTPUT
else
echo "Version bump detected - ${{ steps.determine_version.outputs.version }}"
echo "do_release=true" >> $GITHUB_OUTPUT
fi
create_release:
needs: [validate_tag]
runs-on: windows-latest
if: |
github.repository == 'OverlayPlugin/OverlayPlugin' &&
needs.validate_tag.outputs.do_release == 'true'
steps:
- uses: actions/checkout@v2

Expand All @@ -47,7 +55,7 @@ jobs:
path: |
./Thirdparty
./OverlayPlugin.Core/Thirdparty
key: ${{ runner.os }}-overlayplugin-${{ hashFiles('./tools/fetch_deps.ps1', './DEPS.json') }}
key: ${{ runner.os }}-overlayplugin-${{ hashFiles('./tools/fetch_deps.ps1', './DEPS.json', './tools/StripFFXIVClientStructs/StripFFXIVClientStructs/StripFFXIVClientStructs.cs') }}
restore-keys: |
${{ runner.os }}-overlayplugin-
# Fetch dependencies only if cache-hit is false
Expand Down
1 change: 0 additions & 1 deletion AddonExample/AddonExample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
<AssemblyTitle>AddonExample</AssemblyTitle>
<Product>AddonExample</Product>
<Copyright>Copyright © 2015</Copyright>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<OutputPath>..\out\$(Configuration)\addons\</OutputPath>
</PropertyGroup>
<ItemGroup>
Expand Down
9 changes: 7 additions & 2 deletions AddonExample/AddonExampleEventSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,14 @@ protected override void Update()
}));
}

public override void Dispose()
protected override void Dispose(bool disposing)
{
base.Dispose();
if (disposing && originalTimer != null)
{
originalTimer.Dispose();
originalTimer = null;
}
base.Dispose(disposing);
}

// Sends an event called |event_name| to javascript, with an event.detail that contains
Expand Down
3 changes: 2 additions & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
<PropertyGroup>
<TargetFramework>net48</TargetFramework>
<Copyright>Copyright © RainbowMage 2015, Kuriyama hibiya 2016, ngld 2019, OverlayPlugin Team 2022</Copyright>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<RunCodeAnalysis>false</RunCodeAnalysis>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<AssemblyVersion>0.19.26</AssemblyVersion>
<FileVersion>0.19.26</FileVersion>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
Expand Down
2 changes: 1 addition & 1 deletion HtmlRenderer/NativeMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ uint uFlags // ウィンドウ位置のオプション
[DllImport("user32.dll")]
public static extern IntPtr GetForegroundWindow();

[DllImport("kernel32.dll", SetLastError = true)]
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
public static extern int GetModuleFileName(IntPtr hModule, StringBuilder lpFilename, int nSize);

[DllImport("user32.dll")]
Expand Down
14 changes: 7 additions & 7 deletions HtmlRenderer/OverlayControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,14 @@ public void Reload()
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (this.Renderer != null)
if (disposing)
{
this.Renderer.Dispose();
}

if (disposing && (components != null))
{
components.Dispose();
Renderer?.Dispose();
Renderer = null;
components?.Dispose();
components = null;
surfaceBuffer?.Dispose();
surfaceBuffer = null;
}
base.Dispose(disposing);
}
Expand Down
18 changes: 15 additions & 3 deletions HtmlRenderer/Renderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -400,12 +400,24 @@ public Bitmap Screenshot()
return null;
}

private bool _disposed = false;

public void Dispose()
{
if (this._browser != null)
Dispose(true);
GC.SuppressFinalize(this);
}

protected virtual void Dispose(bool disposing)
{
if (!_disposed)
{
this._browser.Dispose();
this._browser = null;
if (disposing)
{
this._browser?.Dispose();
this._browser = null;
}
_disposed = true;
}
}

Expand Down
36 changes: 21 additions & 15 deletions OverlayPlugin.Core/Controls/ControlPanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ public partial class ControlPanel : UserControl
{
TinyIoCContainer _container;
ILogger _logger;
[System.Diagnostics.CodeAnalysis.SuppressMessage(
"Usage",
"CA2213:Disposable fields should be disposed",
Justification = "_pluginMain is disposed of by TinyIoCContainer")]
PluginMain _pluginMain;
IPluginConfig _config;
Registry _registry;
Expand Down Expand Up @@ -94,7 +98,9 @@ protected override void Dispose(bool disposing)
{
if (disposing)
{
if (components != null) components.Dispose();
components?.Dispose();
_generalTab?.Dispose();
_eventTab?.Dispose();
_registry.EventSourceRegistered -= AddEventSourceTab;
_logger.ClearListener();
}
Expand All @@ -104,22 +110,22 @@ protected override void Dispose(bool disposing)

private void AddLogEntry(LogEntry entry)
{
var msg = $"[{entry.Time}] {entry.Level}: {entry.Message}" + Environment.NewLine;

if (!logConnected)
{
// Remove the error message about the log not being connected since it is now.
logConnected = true;
logBox.Text = "";
}
else if (logBox.TextLength > 200 * 1024)
{
logBox.Text = "============ LOG TRUNCATED ==============\nThe log was truncated to reduce memory usage.\n=========================================\n" + msg;
return;
}

Action appendText = () =>
{
var msg = $"[{entry.Time}] {entry.Level}: {entry.Message}" + Environment.NewLine;
if (!logConnected)
{
// Remove the error message about the log not being connected since it is now.
logConnected = true;
logBox.Text = "";
}
else if (logBox.TextLength > 200 * 1024)
{
logBox.Text = "============ LOG TRUNCATED ==============\nThe log was truncated to reduce memory usage.\n=========================================\n" + msg;
return;
}
if (checkBoxFollowLog.Checked)
{
logBox.AppendText(msg);
Expand Down
4 changes: 4 additions & 0 deletions OverlayPlugin.Core/Controls/NewOverlayDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ public partial class NewOverlayDialog : Form
public ValidateNameDelegate NameValidator { get; set; }
public IOverlay SelectedOverlay { get; private set; }

[System.Diagnostics.CodeAnalysis.SuppressMessage(
"Usage",
"CA2213:Disposable fields should be disposed",
Justification = "pluginMain is disposed of by TinyIoCContainer")]
private PluginMain pluginMain;
private Registry registry;
private ILogger logger;
Expand Down
14 changes: 13 additions & 1 deletion OverlayPlugin.Core/Controls/WSConfigPanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,15 @@ public partial class WSConfigPanel : UserControl
const string NGROK_CHOCO_SCRIPT = "https://raw.githubusercontent.com/ngrok/choco-ngrok/main/tools/chocolateyinstall.ps1";

IPluginConfig _config;
[System.Diagnostics.CodeAnalysis.SuppressMessage(
"Usage",
"CA2213:Disposable fields should be disposed",
Justification = "_server is disposed of by TinyIoCContainer")]
WSServer _server;
[System.Diagnostics.CodeAnalysis.SuppressMessage(
"Usage",
"CA2213:Disposable fields should be disposed",
Justification = "_plugin is disposed of by TinyIoCContainer")]
PluginMain _plugin;
Registry _registry;
Process _ngrok;
Expand Down Expand Up @@ -352,10 +360,14 @@ private void cbOverlay_SelectedIndexChanged(object sender, EventArgs e)
hostUrl += "ws://";
}

if (_config.WSServerIP == "0.0.0.0")
if (_config.WSServerIP == "0.0.0.0" || _config.WSServerIP == "*")
{
hostUrl += "127.0.0.1";
}
else if (_config.WSServerIP == "[::]")
{
hostUrl += "[::1]";
}
else
{
hostUrl += _config.WSServerIP;
Expand Down
3 changes: 3 additions & 0 deletions OverlayPlugin.Core/Controls/WSConfigPanel.fr-FR.resx
Original file line number Diff line number Diff line change
Expand Up @@ -191,4 +191,7 @@ Overlay Partagé : Si vous démarrez WSServer via cet onglet, vous pouvez utilis
<data name="simpStopBtn.Text" xml:space="preserve">
<value>Stop</value>
</data>
<data name="tokenLabel.Text" xml:space="preserve">
<value>Jeton :</value>
</data>
</root>
14 changes: 12 additions & 2 deletions OverlayPlugin.Core/EventSourceBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,19 @@ protected void Log(LogLevel level, string message, params object[] args)
logger.Log(level, message, args);
}

public virtual void Dispose()
public void Dispose()
{
timer?.Dispose();
Dispose(true);
GC.SuppressFinalize(this);
}

protected virtual void Dispose(bool disposing)
{
if (disposing && timer != null)
{
timer.Dispose();
timer = null;
}
}

public virtual void Start()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,15 +133,18 @@
<data name="label1.Text" xml:space="preserve">
<value>Trier par</value>
</data> <data name="label6.Text" xml:space="preserve">
<value>Arrêt du log après un wipe</value>
<value>Fin du combat après un wipe</value>
</data>
<data name="experimentalWarning.Text" xml:space="preserve">
<value>AVERTISSEMENT : Options expérimentales ci-dessous - Si vous y touchez, vous confirmez que vous pouvez résoudre vous-même les problèmes que vous rencontrez et que vous ne demanderez pas d'aide.</value>
</data>
<data name="label7.Text" xml:space="preserve">
<value>Arrêt du log si hors combat</value>
<value>Arrêter le log si hors combat</value>
</data>
<data name="lblCutsceneDetectionLog.Text" xml:space="preserve">
<value>Écrire les lignes de détection des cinématiques</value>
</data>
<data name="lblLogLines.Text" xml:space="preserve">
<value>Écrire des lignes de log additionnelles</value>
</data>
</root>
Loading

0 comments on commit 1059b5f

Please sign in to comment.