2022-11-15 21:09:14 +01:00
|
|
|
|
using RTSSSharedMemoryNET;
|
|
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
|
|
namespace CommonHelpers
|
|
|
|
|
|
{
|
|
|
|
|
|
public static class OSDHelpers
|
|
|
|
|
|
{
|
|
|
|
|
|
public static uint OSDIndex(this OSD? osd)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (osd is null)
|
|
|
|
|
|
return uint.MaxValue;
|
|
|
|
|
|
|
|
|
|
|
|
var osdSlot = typeof(OSD).GetField("m_osdSlot",
|
2022-11-16 01:10:44 +01:00
|
|
|
|
System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
|
2022-11-15 21:09:14 +01:00
|
|
|
|
var value = osdSlot.GetValue(osd);
|
|
|
|
|
|
if (value is null)
|
|
|
|
|
|
return uint.MaxValue;
|
|
|
|
|
|
|
|
|
|
|
|
return (uint)value;
|
|
|
|
|
|
}
|
2022-11-16 01:10:44 +01:00
|
|
|
|
|
|
|
|
|
|
public static uint OSDIndex(String name)
|
|
|
|
|
|
{
|
|
|
|
|
|
var entries = OSD.GetOSDEntries().ToList();
|
|
|
|
|
|
for (int i = 0; i < entries.Count(); i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (entries[i].Owner == name)
|
|
|
|
|
|
return (uint)i;
|
|
|
|
|
|
}
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
2022-11-15 21:09:14 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|