daily update on 20240226 by nitload youmu
This commit is contained in:
@@ -1,12 +1,15 @@
|
||||
using StgSharp.Geometries;
|
||||
using StgSharp.Graphics;
|
||||
using System.Threading;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using Windows.Win32;
|
||||
using Windows.Win32.Foundation;
|
||||
|
||||
#if Windows
|
||||
|
||||
#endif
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
@@ -19,21 +22,6 @@ namespace StgSharp
|
||||
InfoWarning,
|
||||
}
|
||||
|
||||
internal class LibHandle : SafeHandle
|
||||
{
|
||||
|
||||
public LibHandle(IntPtr invalidHandleValue, bool ownsHandle) : base(invalidHandleValue, ownsHandle)
|
||||
{
|
||||
}
|
||||
|
||||
public override bool IsInvalid => throw new NotImplementedException();
|
||||
|
||||
protected override bool ReleaseHandle()
|
||||
{
|
||||
return PInvoke.FreeLibrary(new HMODULE(handle));
|
||||
}
|
||||
}
|
||||
|
||||
internal static unsafe partial class InternalIO
|
||||
{
|
||||
internal static Dictionary<TypeCode, uint> GLtype =
|
||||
@@ -47,6 +35,9 @@ namespace StgSharp
|
||||
internal const string SSC_libname =
|
||||
"StgSharpC";
|
||||
|
||||
internal static readonly GCHandle ssc_logHandle =
|
||||
GCHandle.Alloc(new byte[512], GCHandleType.Pinned);
|
||||
|
||||
static InternalIO()
|
||||
{
|
||||
GLtype.Add(TypeCode.Single, GLconst.FLOAT);
|
||||
@@ -58,18 +49,18 @@ namespace StgSharp
|
||||
GLtype.Add(TypeCode.Byte, GLconst.UNSIGNED_BYTE);
|
||||
}
|
||||
|
||||
internal static T InternalLoadProc<T>(LibHandle lib, string name) where T : Delegate
|
||||
[Obsolete("Not completed", true)]
|
||||
internal static IntPtr InternalLoadProc<T>(IntPtr lib, string name) where T : Delegate
|
||||
{
|
||||
try
|
||||
{
|
||||
IntPtr procPtr =
|
||||
#if Windows
|
||||
PInvoke.GetProcAddress(lib, name);
|
||||
IntPtr.Zero;
|
||||
#elif Linux
|
||||
|
||||
#endif
|
||||
T ret = Marshal.GetDelegateForFunctionPointer<T>(procPtr);
|
||||
return ret;
|
||||
return procPtr;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
@@ -91,9 +82,11 @@ namespace StgSharp
|
||||
}
|
||||
}
|
||||
|
||||
internal static SemaphoreSlim logSyncSemaphore = new SemaphoreSlim(1, 1);
|
||||
|
||||
internal static void InternalWriteLog(string beforeTime, string logLine, LogType logType)
|
||||
{
|
||||
logSyncSemaphore.Wait();
|
||||
if (!File.Exists(InternalIO.SS_errorlog))
|
||||
{
|
||||
FileStream stream = File.Create(InternalIO.SS_errorlog);
|
||||
@@ -106,6 +99,7 @@ namespace StgSharp
|
||||
logStream.WriteLine($"{logType}\t@\t{DateTime.Now.ToString("o")}");
|
||||
logStream.WriteLine(logLine);
|
||||
}
|
||||
logSyncSemaphore.Release(1);
|
||||
}
|
||||
|
||||
internal static void InternalWriteLog(string logLine, LogType logType)
|
||||
@@ -123,4 +117,4 @@ namespace StgSharp
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user