Tag «programming»

ILMerge (merge .net framework .dll library files into .exe)

Sometimes, we just want to release a single .exe file without a mass of .dll library files. This makes users easier to copy the file, and does not unveil the information of libraries used in the program. ilmerge.exe /out:c:\\test.exe d:\project\DNSSwitcher.exe d:\project\Newtonsoft.Json.dll /target:winexe /targetplatform:v4,c:\Windows\Microsoft.NET\Framework64\v4.0.30319 Note: If you use /target:exe , there will be a command line …

C# stack trace

using System.Diagnostics; [STAThread] public static void Main() { StackTrace stackTrace = new StackTrace(); // get call stack StackFrame[] stackFrames = stackTrace.GetFrames(); // get method calls (frames) // write call stack method names foreach (StackFrame stackFrame in stackFrames) { Console.WriteLine(stackFrame.GetMethod().Name); // write method name } } Ref: http://www.csharp-examples.net/reflection-callstack/

3ds Max Script socket receving data via .net api

做個紀錄 socket = dotNetObject "System.Net.Sockets.Socket" (dotnetclass "System.Net.Sockets.AddressFamily").InterNetwork (dotnetclass "System.Net.Sockets.SocketType").Stream (dotnetclass "System.Net.Sockets.ProtocolType").Tcp socket.connect ip_address port buf = DotNetObject "System.Byte[]" 1000 fn doFaceShiftSocket = ( try ( while socket.Connected == true do ( socket.Receive buf ) ) catch ( — do nothing ) ) thread = dotNetObject "system.componentModel.backgroundWorker" dotnet.addEventHandler thread "DoWork" doFaceShiftSocket thread.WorkerSupportsCancellation = true thread.runWorkerAsync() for …