Skip to content

Instantly share code, notes, and snippets.

View DDzia's full-sized avatar
:octocat:

Dziarkach Dzianis DDzia

:octocat:
  • Social Discovery Ventures
  • Belarus, Minsk
View GitHub Profile
#pragma once
#define DLLEXPORT extern "C" __declspec(dllexport)
<PlatformTarget>x64</PlatformTarget>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
static class PInvoke
{
private const string ModuleLocation = "Unmanaged/PInvokeInterop.dll";
[DllImport(ModuleLocation, SetLastError = true)]
public static extern void PrintToDo();
}
#include <iostream>
#include "global.h"
DLLEXPORT void PrintToDo()
{
std::cout << "TODO!" << std::endl;
}
/**
* Get all keys from enumeration.
*/
public static keys(enumType: object) {
const members = Object.keys(enumType);<br /> let keys: string[];
if (!EnumHelpers.isNumeral(enumType)) {
keys = members;
} else {
keys = [];
members.forEach(x => {
var Size;
(function (Size) {
Size[Size["One"] = 1] = "One";
Size["All"] = "all";
})(Size || (Size = {}));
enum Size {
One = 1,
All = "all"
}
/**
* Check to numeral enumeration.
*/
private static isNumeral(enumType: object) {
const members = Object.keys(enumType);
if (!members.some((x) =&gt; true)) {
throw new TypeError("Invalid enumeration type.");
}
let parsedCount = 0;
var Names;
(function (Names) {
Names["Alex"] = "a";
Names["Denis"] = "d";
})(Names || (Names = {}));
enum Names {
Alex = "a",
Denis = "d"
}