support for .NET framework 3.5
Still have bugs
This commit is contained in:
1 parent
5878039e21
commit
7d6b491f25
704 files changed
+48273
-33
No files matched your search
@@ -0,0 +1,36 @@
|
||||
namespace Standard
|
||||
{
|
||||
using Microsoft.Win32.SafeHandles;
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.ConstrainedExecution;
|
||||
|
||||
internal sealed class SafeGdiplusStartupToken : SafeHandleZeroOrMinusOneIsInvalid
|
||||
{
|
||||
private SafeGdiplusStartupToken() : base(true)
|
||||
{
|
||||
}
|
||||
|
||||
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
|
||||
protected override bool ReleaseHandle()
|
||||
{
|
||||
return (Standard.NativeMethods.GdiplusShutdown(base.handle) == Standard.Status.Ok);
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope"), SuppressMessage("Microsoft.Usage", "CA2201:DoNotRaiseReservedExceptionTypes")]
|
||||
public static Standard.SafeGdiplusStartupToken Startup()
|
||||
{
|
||||
IntPtr ptr;
|
||||
Standard.StartupOutput output;
|
||||
Standard.SafeGdiplusStartupToken token = new Standard.SafeGdiplusStartupToken();
|
||||
if (Standard.NativeMethods.GdiplusStartup(out ptr, new Standard.StartupInput(), out output) == Standard.Status.Ok)
|
||||
{
|
||||
token.handle = ptr;
|
||||
return token;
|
||||
}
|
||||
token.Dispose();
|
||||
throw new Exception("Unable to initialize GDI+");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user