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

Commit

Permalink
fix: add some rotations desc.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Aug 12, 2023
1 parent 35d9f30 commit 99f6651
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 13 deletions.
10 changes: 9 additions & 1 deletion Resources/HostileCastingArea.json
Original file line number Diff line number Diff line change
Expand Up @@ -361,5 +361,13 @@
24021,
10132,
10162,
10168
10168,
23667,
24615,
11635,
12619,
12615,
27754,
27481,
26206
]
24 changes: 24 additions & 0 deletions RotationSolver.Basic/Attributes/AssemblyGithubAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace RotationSolver.Basic.Attributes;

/// <summary>
/// An attribute to record your github link.
/// </summary>
[AttributeUsage(AttributeTargets.Assembly)]
public class AssemblyGithubAttribute : Attribute
{
/// <summary>
/// A link for your user name in github.
/// </summary>
public string UserName { get; set; }

/// <summary>
/// A link for the repo in your github.
/// </summary>
public string Repository { get; set; }
}
2 changes: 2 additions & 0 deletions RotationSolver.Basic/Configuration/Configs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ [Serializable] public class GlobalConfig
public List<ActionEventInfo> Events { get; private set; } = new ();

public string[] OtherLibs = Array.Empty<string>();

public string[] GithubLibs = Array.Empty<string>();
public List<TargetingType> TargetingTypes { get; set; } = new List<TargetingType>();

public MacroInfo DutyStart { get; set; } = new MacroInfo();
Expand Down
6 changes: 5 additions & 1 deletion RotationSolver/Data/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,9 @@ internal record AssemblyInfo(
string Name,
string Author,
string FilePath,
string DonateLink);
string DonateLink,
string ChangeLogLink,
string GithubUserName,
string GithubRepository,
DateTime LoadTime);
}
13 changes: 8 additions & 5 deletions RotationSolver/Helpers/RotationHelper.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
using Dalamud.Interface.Colors;
using Dalamud.Logging;
using RotationSolver.Data;
using RotationSolver.Localization;
using System.Diagnostics;

namespace RotationSolver.Helpers;
Expand All @@ -23,7 +21,7 @@ public static AssemblyInfo GetInfo(this Assembly assembly)
var location = assembly.Location;
var company = assembly.GetCustomAttribute<AssemblyCompanyAttribute>()?.Company;

var assemblyInfo = new AssemblyInfo(name, company, location, string.Empty);
var assemblyInfo = new AssemblyInfo(name, company, location, string.Empty, string.Empty, company, name, DateTime.Now);

_assemblyInfos[assembly] = assemblyInfo;

Expand Down Expand Up @@ -60,12 +58,17 @@ public static Assembly LoadCustomRotationAssembly(string filePath)
var assemblyName = assembly.GetName().Name;
var author = GetAuthor(filePath, assemblyName);

var attr = assembly.GetCustomAttribute<AssemblyLinkAttribute>();
var link = assembly.GetCustomAttribute<AssemblyLinkAttribute>();
var github = assembly.GetCustomAttribute<AssemblyGithubAttribute>();
var assemblyInfo = new AssemblyInfo(
assemblyName,
author,
filePath,
attr?.Donate);
link?.Donate,
link?.ChangeLog,
github?.UserName,
github?.Repository,
DateTime.Now);

var existingAssembly = GetAssemblyFromPath(filePath);
if (existingAssembly != null)
Expand Down
2 changes: 2 additions & 0 deletions RotationSolver/UI/RotationConfigWindowNew.cs
Original file line number Diff line number Diff line change
Expand Up @@ -908,6 +908,7 @@ private static void DrawActions()
};
#endregion

#region Rotations
private static readonly CollapsingHeaderGroup _rotationsHeader = new(new()
{

Expand All @@ -917,6 +918,7 @@ private static void DrawRotations()
ImGui.Text("Rotations");
_rotationsHeader?.Draw();
}
#endregion

#region Ids
private static uint _territoryId = 0;
Expand Down
24 changes: 18 additions & 6 deletions RotationSolver/Updaters/RotationUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,11 @@ public static async Task GetAllCustomRotationsAsync(DownloadOption option)
}
}

// This method loads custom rotation groups from local directories and assemblies, creates a sorted list of
// author hashes, and creates a sorted list of custom rotations grouped by job role.
/// <summary>
/// This method loads custom rotation groups from local directories and assemblies, creates a sorted list of
/// author hashes, and creates a sorted list of custom rotations grouped by job role.
/// </summary>
/// <param name="relayFolder"></param>
private static void LoadRotationsFromLocal(string relayFolder)
{
var directories = Service.Config.OtherLibs
Expand Down Expand Up @@ -175,16 +178,25 @@ private static CustomRotationGroup[] LoadCustomRotationGroup(List<Assembly> asse
return result.ToArray();
}

// Downloads rotation files from a remote server and saves them to a local folder.
// The download list is obtained from a JSON file on the remote server.
// If mustDownload is set to true, it will always download the files, otherwise it will only download if the file doesn't exist locally.

/// <summary>
/// Downloads rotation files from a remote server and saves them to a local folder.
/// The download list is obtained from a JSON file on the remote server.
/// If mustDownload is set to true, it will always download the files, otherwise it will only download if the file doesn't exist locally.
/// </summary>
/// <param name="relayFolder"></param>
/// <param name="mustDownload"></param>
/// <returns></returns>
private static async Task DownloadRotationsAsync(string relayFolder, bool mustDownload)
{
// Code to download rotations from remote server
bool hasDownload = false;

var githubLinks = Service.ConfigNew.GlobalConfig.GithubLibs.Union(DownloadHelper.LinkLibraries ?? Array.Empty<string>());

using (var client = new HttpClient())
{
foreach (var url in Service.Config.OtherLibs.Union(DownloadHelper.LinkLibraries ?? Array.Empty<string>()))
foreach (var url in Service.ConfigNew.GlobalConfig.OtherLibs)
{
hasDownload |= await DownloadOneUrlAsync(url, relayFolder, client, mustDownload);
var pdbUrl = Path.ChangeExtension(url, ".pdb");
Expand Down

0 comments on commit 99f6651

Please sign in to comment.