Changes from Bites to Bytes.
This commit is contained in:
@@ -1,5 +1,4 @@
|
|||||||
using Dalamud.Game.ClientState.Objects.SubKinds;
|
using Dalamud.Game.ClientState.Objects.SubKinds;
|
||||||
using Dalamud.Game.ClientState.Objects.Types;
|
|
||||||
using Dalamud.Game.Gui.ContextMenu;
|
using Dalamud.Game.Gui.ContextMenu;
|
||||||
using Dalamud.Plugin;
|
using Dalamud.Plugin;
|
||||||
using Dalamud.Plugin.Services;
|
using Dalamud.Plugin.Services;
|
||||||
@@ -81,7 +80,7 @@ internal class ContextMenu : IHostedService
|
|||||||
if (!_pluginInterface.UiBuilder.ShouldModifyUi)
|
if (!_pluginInterface.UiBuilder.ShouldModifyUi)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!ValidAddons.Contains(args.AddonName))
|
if (!ValidAddons.Contains(args.AddonName, StringComparer.Ordinal))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (args.Target is not MenuTargetDefault target)
|
if (args.Target is not MenuTargetDefault target)
|
||||||
@@ -127,7 +126,7 @@ internal class ContextMenu : IHostedService
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var senderCid = (await _dalamudUtil.GetCIDAsync()).ToString().GetHash256();
|
var senderCid = (await _dalamudUtil.GetCIDAsync().ConfigureAwait(false)).ToString().GetHash256();
|
||||||
var receiverCid = DalamudUtilService.GetHashedCIDFromPlayerPointer(targetData.Address);
|
var receiverCid = DalamudUtilService.GetHashedCIDFromPlayerPointer(targetData.Address);
|
||||||
|
|
||||||
_logger.LogInformation("Sending pair request: sender {SenderCid}, receiver {ReceiverCid}", senderCid, receiverCid);
|
_logger.LogInformation("Sending pair request: sender {SenderCid}, receiver {ReceiverCid}", senderCid, receiverCid);
|
||||||
|
|||||||
@@ -173,12 +173,14 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase
|
|||||||
|
|
||||||
public static string ByteToString(long bytes, bool addSuffix = true)
|
public static string ByteToString(long bytes, bool addSuffix = true)
|
||||||
{
|
{
|
||||||
string[] suffix = ["B", "KiB", "MiB", "GiB", "TiB"];
|
string[] suffix = { "B", "KB", "MB", "GB", "TB" };
|
||||||
int i;
|
int i = 0;
|
||||||
double dblSByte = bytes;
|
double dblSByte = bytes;
|
||||||
for (i = 0; i < suffix.Length && bytes >= 1024; i++, bytes /= 1024)
|
|
||||||
|
while (dblSByte >= 1000 && i < suffix.Length - 1)
|
||||||
{
|
{
|
||||||
dblSByte = bytes / 1024.0;
|
dblSByte /= 1000.0;
|
||||||
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return addSuffix ? $"{dblSByte:0.00} {suffix[i]}" : $"{dblSByte:0.00}";
|
return addSuffix ? $"{dblSByte:0.00} {suffix[i]}" : $"{dblSByte:0.00}";
|
||||||
|
|||||||
Reference in New Issue
Block a user