This file contains hidden or 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
use std::process::Command; | |
use std::env; | |
use std::path::Path; | |
fn main() { | |
let out_dir = env::var("OUT_DIR").ok().expect("can't find out_dir"); | |
Command::new("C:\\Program Files (x86)\\Windows Kits\\8.1\\bin\\x64\\rc.exe") | |
.args(&["/v", "/fo", "hello_rc.lib"]) // HACK HACK HACK | |
.args(&["..\\..\\..\\..\\..\\src\\hello.rc"]) |
This file contains hidden or 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
override this.OnLoad(e:EventArgs) = | |
this.Visible <- false // Hide form window. | |
this.ShowInTaskbar <- false; // Remove from taskbar. | |
(this :> INetworkListManagerEvents).ConnectivityChanged(nlm.GetConnectivity()) | |
let nlmGuid = typeof<INetworkListManagerEvents>.GUID | |
let icpc = (nlm :> obj) :?> IConnectionPointContainer | |
icp <- icpc.FindConnectionPoint(ref nlmGuid); | |
cookie <- icp.Advise(this); | |
base.OnLoad(e) |
This file contains hidden or 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 | |
open System.Drawing | |
open System.Reflection | |
open System.Resources | |
open System.Runtime.InteropServices.ComTypes | |
open System.Windows.Forms | |
open NETWORKLIST | |
let OnExit (sender : obj) (e : EventArgs) = Application.Exit() | |
let FindIcon name = new Icon(Assembly.GetExecutingAssembly().GetManifestResourceStream(name)) |
This file contains hidden or 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
internal static class $Program | |
{ | |
[DebuggerBrowsable(DebuggerBrowsableState.Never)] | |
internal static FSharpFunc<int, int> add2@11; | |
[DebuggerBrowsable(DebuggerBrowsableState.Never), DebuggerNonUserCode, CompilerGenerated] | |
internal static int init@; | |
public static void main@() | |
{ | |
int n = 2; | |
$Program.add2@11 = new Program.add2@11(n); |
This file contains hidden or 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 | |
open System.IO | |
open System.Runtime.Serialization.Formatters.Soap | |
open System.Text | |
let mhead(m : list<Object>) : list<Object> = [m.Head] | |
let addN n = | |
(fun x -> x + n) | |
This file contains hidden or 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
internal static readonly Program.Card _unique_King = new Program.Card(0); |
This file contains hidden or 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
let GetUnionTypes (t:Type) = | |
seq { yield t | |
if FSharpType.IsUnion t | |
then yield! FSharpType.GetUnionCases t | |
// implementation detail leaks here -- nested type name | |
|> Seq.map (fun x -> Type.GetType ((string t) + "+" + x.Name)) | |
// except when the case has no data, so there's no such class | |
|> Seq.filter (fun x -> x <> null) } |
This file contains hidden or 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
type Card = King | Queen| Jack | Spot of int;; | |
GetUnionTypes typeof<Card> |> Seq.iter (fun x -> printfn "%s" x.FullName);; |
This file contains hidden or 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.IO | |
open System.Runtime.Serialization.Json | |
open System.Text | |
let exprTypes = GetUnionTypes baseType | |
let ToJson<'t> (myObj:'t) = | |
use ms = new MemoryStream() | |
DataContractJsonSerializer(typeof<'t>, exprTypes).WriteObject(ms, myObj) | |
Encoding.Default.GetString(ms.ToArray()) | |
This file contains hidden or 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 | |
open Microsoft.FSharp.Reflection | |
let GetUnionTypes (t:Type) = | |
seq { yield t | |
if FSharpType.IsUnion t | |
then yield! FSharpType.GetUnionCases t | |
// implementation detail leaks here -- nested type name | |
|> Seq.map (fun x -> (string t) + "+" + x.Name) | |
|> Seq.map Type.GetType } |