This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#nowarn "9" | |
open System.Runtime.InteropServices | |
[<Struct; StructLayout(LayoutKind.Explicit)>] | |
type s = | |
[<DefaultValue; FieldOffset 0>] | |
val mutable y : uint32 | |
[<DefaultValue; FieldOffset 0>] | |
val mutable x1 : byte |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Runtime.InteropServices; | |
using System.Windows.Forms; | |
namespace Sayuri.Windows.Forms { | |
class TextBox2 : TextBox { | |
[DllImport("Imm32.dll")] | |
static extern IntPtr ImmGetContext(IntPtr hWnd); | |
[DllImport("Imm32.dll")] | |
static extern bool ImmGetOpenStatus(IntPtr hIMC); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Runtime.InteropServices; | |
using IMAPI2FS; // COM reference: Microsoft IMAPI2 File System Image Creator | |
using IStream = System.Runtime.InteropServices.ComTypes.IStream; | |
class IsoImage { | |
[DllImport("shlwapi.dll", CharSet = CharSet.Unicode, PreserveSig = true)] | |
static extern void SHCreateStreamOnFile(string pszFile, uint grfMode, out IStream ppstm); | |
static void Main(string[] args) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.ComponentModel; | |
using System.Windows; | |
using System.Windows.Controls; | |
using System.Windows.Data; | |
using System.Windows.Documents; | |
using System.Windows.Media; | |
namespace Sayuri.Windows { | |
public static class GridViewSort { | |
class SortIcon : Adorner { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open System.Text.RegularExpressions | |
let parse1 line = | |
// TODO: 先頭から解析できる範囲だけであり終端チェックはされていない | |
let matches = Regex.Matches(line, @"(?:^|\G,)(?<key>[^=,]+)=(?<val>[^=,]+)") | |
Array.init matches.Count (fun i -> matches.[i].Groups.["key"].Value, matches.[i].Groups.["val"].Value) | |
let parse2 line = | |
// TODO: 要素数0が認められない | |
let m = Regex.Match(line, "^(?<key1>[^=,]+)=(?<val1>[^=,]+)(?:,(?<key>[^=,]+)=(?<val>[^=,]+))*$") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <type_traits> | |
template<typename Interface> | |
struct vtable{ | |
typedef typename std::remove_pointer_t<decltype(Interface::lpVtbl)> type; | |
}; | |
template<typename Interface> | |
using vtable_t = typename Vtable<Interface>::type; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Sayuri.Net.SocketExtensions | |
open System | |
open System.Net | |
open System.Net.Sockets | |
#if NET4 | |
type private ConcurrentBag<'T> = System.Collections.Concurrent.ConcurrentBag<'T> | |
#else | |
type private ConcurrentBag<'T>() = | |
let bag = System.Collections.Generic.Stack<'T>() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string_view> | |
#include <wrl/client.h> | |
#include <mfapi.h> | |
#include <mftransform.h> | |
#include <wincodec.h> | |
#pragma comment(lib, "mfplat.lib") | |
#pragma comment(lib, "mfuuid.lib") | |
#pragma comment(lib, "Windowscodecs.lib") | |
using namespace std::literals; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Diagnostics; | |
using System.IO; | |
using System.Linq; | |
using System.Runtime.InteropServices; | |
using System.Runtime.InteropServices.ComTypes; | |
using System.Windows.Forms; | |
using Sayuri.IO; | |
using FILETIME = System.Runtime.InteropServices.ComTypes.FILETIME; | |
using IDataObject = System.Runtime.InteropServices.ComTypes.IDataObject; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cmath> | |
#include <thread> | |
#include <Windows.h> | |
#include <MMSystem.h> | |
#pragma comment(lib, "winmm") | |
struct MultiMediaTimer { | |
static const wchar_t* name; | |
static LARGE_INTEGER elapsed[10000]; | |
static int idx; |