Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
fix: fixed the author showcase.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Apr 8, 2023
1 parent 94b4969 commit d780cac
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 7 deletions.
7 changes: 4 additions & 3 deletions RotationSolver/RotationHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,10 @@ public static string GetAuthor(this Assembly assembly)
{
try
{
return FileVersionInfo.GetVersionInfo(assembly.Location)?.CompanyName
?? assembly.GetName().Name
?? "Unknown";
var name = assembly.GetName().Name;
return RotationLoadContext.AssemblyPaths.TryGetValue(name, out var path)
? FileVersionInfo.GetVersionInfo(path)?.CompanyName : name
?? name ?? "Unknown";
}
catch
{
Expand Down
7 changes: 6 additions & 1 deletion RotationSolver/RotationLoadContext.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Dalamud.Plugin;
using FFXIVClientStructs.Interop;
using Lumina.Excel;
using System.Reflection;
using System.Runtime.Loader;

namespace RotationSolver;
Expand All @@ -9,6 +10,8 @@ public class RotationLoadContext : AssemblyLoadContext
{
DirectoryInfo _directory;

public static Dictionary<string, string> AssemblyPaths = new Dictionary<string, string>();

static Dictionary<string, Assembly> _handledAssemblies;
public RotationLoadContext(DirectoryInfo directoryInfo) : base(true)
{
Expand Down Expand Up @@ -57,7 +60,9 @@ private Assembly LoadFromFile(string filePath)
var pdbPath = Path.ChangeExtension(filePath, ".pdb");
if (!File.Exists(pdbPath)) return LoadFromStream(file);
using var pdbFile = File.Open(pdbPath, FileMode.Open, FileAccess.Read, FileShare.Read);
return LoadFromStream(file, pdbFile);
var assembly = LoadFromStream(file, pdbFile);
AssemblyPaths[assembly.GetName().Name] = filePath;
return assembly;
}

public static Assembly LoadFrom(string filePath)
Expand Down
17 changes: 14 additions & 3 deletions RotationSolver/UI/ImGuiHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -492,8 +492,13 @@ public unsafe static void Display(this ICustomRotation rotation, ICustomRotation

if (IconButton(FontAwesomeIcon.Globe, "Code" + rotation.GetHashCode().ToString()))
{
var url = link.Url;
Util.OpenLink(url);
try
{
Util.OpenLink(link.Url);
}
catch
{
}
}
}

Expand All @@ -518,7 +523,13 @@ public unsafe static void Display(this ICustomRotation rotation, ICustomRotation
if (IconButton(hasTexture ? FontAwesomeIcon.Image : FontAwesomeIcon.QuestionCircle,
"Button" + rotation.GetHashCode().ToString() + texture.GetHashCode().ToString()))
{
Util.OpenLink(texture.Path);
try
{
Util.OpenLink(texture.Path);
}
catch
{
}
}
if (ImGui.IsItemHovered() && (hasTexture || !string.IsNullOrEmpty( texture.Description)))
{
Expand Down
7 changes: 7 additions & 0 deletions RotationSolver/Updaters/RotationUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ public static async void GetAllCustomRotations()
var valid = Uri.TryCreate(url, UriKind.RelativeOrAbsolute, out var uriResult)
&& (uriResult.Scheme == Uri.UriSchemeHttp || uriResult.Scheme == Uri.UriSchemeHttps);
if (!valid) continue;
}
catch
{
continue;
}
try
{

var fileName = url.Split('/').LastOrDefault();
if (string.IsNullOrEmpty(fileName)) continue;
Expand Down

0 comments on commit d780cac

Please sign in to comment.