Skip to content

Instantly share code, notes, and snippets.

@abc126
abc126 / Setup.iss
Created November 12, 2018 03:36 — forked from canton7/Setup.iss
Installing .NET Framework 4.6.1 with Inno Setup
#define DotNetRuntimeExe "NDP461-KB3102436-x86-x64-AllOS-ENU.exe"
[CustomMessages]
InstallingDotNetFramework=Installing .NET Framework. This might take a few minutes...
DotNetFrameworkFailedToLaunch=Failed to launch .NET Framework Installer with error "%1". Please fix the error then run this installer again.
DotNetFrameworkFailed1602=.NET Framework installation was cancelled. This installation can continue, but be aware that this application may not run unless the .NET Framework installation is completed successfully.
DotNetFrameworkFailed1603=A fatal error occurred while installing the .NET Framework. Please fix the error, then run the installer again.
DotNetFrameworkFailed5100=Your computer does not meet the requirements of the .NET Framework. Please consult the documentation.
DotNetFrameworkFailedOther=The .NET Framework installer exited with an unexpected status code "%1". Please review any other messages shown by the installer to determine whether the installation completed successfully, and abort this
@abc126
abc126 / EnumLabel.cs
Created October 8, 2018 05:10 — forked from gabehesse/EnumLabel.cs
C# attribute that allows string representation of enum members & an extension method to get that string representation from an enum member.
public class EnumLabelAttribute : Attribute
{
public string Label { get; private set; }
public EnumLabelAttribute(string label) { Label = label; }
}
public static class EnumLabelExtension
{
public static string GetLabel(this Enum @enum)
{
@abc126
abc126 / PresenterBindingAttribute
Created October 8, 2018 01:44
PresenterBindingAttribute
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MVP
{
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
public sealed class PresenterBindingAttribute : Attribute
{
@abc126
abc126 / PeekingStreamReader
Created May 23, 2018 15:03
PeekingStreamReader
public class PeekingStreamReader : StreamReader
{
private Queue<string> _peeks;
public PeekingStreamReader(Stream stream) : base(stream)
{
_peeks = new Queue<string>();
}
public PeekingStreamReader(string path) : base(path)
{
_peeks = new Queue<string>();

C#编码规范

概述

规范制定原则

  • 方便代码的交流和维护。
  • 不影响编码的效率,不与大众习惯冲突。
  • 使代码更美观、阅读更方便。
  • 使代码的逻辑更清晰、更易于理解。
@abc126
abc126 / ACM学习计划
Created March 30, 2018 15:54 — forked from dodola/ACM学习计划
ACM学习计划
ACM大量习题题库
ACM大量习题题库
现在网上有许多题库,大多是可以在线评测,所以叫做Online Judge。除了USACO是为IOI准备外,其余几乎全部是大学的ACM竞赛题库。
USACO
http://ace.delos.com/usacogate
美国著名在线题库,专门为信息学竞赛选手准备
@abc126
abc126 / SystemPlatform.cs
Created March 12, 2018 15:09
Get System platform at .net 3.5
public static class Wow
{
public static bool Is64BitProcess
{
get { return IntPtr.Size == 8; }
}
public static bool Is64BitOperatingSystem
{
get
@abc126
abc126 / SystemPlatform.cs
Created March 12, 2018 15:08
Get System Platform at .net 3.5
[DllImport("kernel32", SetLastError = true, CallingConvention = CallingConvention.Winapi)]
public extern static IntPtr LoadLibrary(string libraryName);
[DllImport("kernel32", SetLastError = true, CallingConvention = CallingConvention.Winapi)]
public extern static IntPtr GetProcAddress(IntPtr hwnd, string procedureName);
private delegate bool IsWow64ProcessDelegate([In] IntPtr handle, [Out] out bool isWow64Process);
public static bool IsOS64Bit()
{
@abc126
abc126 / GetCurrentDllPath.cs
Created March 9, 2018 04:26
GetCurrentDllPath
private string GetDllPath()
{
string strDLLPath = System.Reflection.Assembly.GetExecutingAssembly().CodeBase;
strDLLPath = strDLLPath.Substring(8);
return strDLLPath.Substring(0, strDLLPath.LastIndexOf("/") + 1);
}
@abc126
abc126 / SendACommandToAutoCAD.cs
Created March 9, 2018 04:14
SendACommandToAutoCAD
public static void SendACommandToAutoCAD(string command)
{
if (MgdApplication.DocumentManager.Count == 0)
{
MessageBox.Show("无活动文档,请新建文档后再执行命令", "新建文档", MessageBoxButtons.OK, MessageBoxIcon.Stop);
return;
}
// 根据是否有命令运行决定esc的数量
string esc = "";
string cmds = (string)MgdApplication.GetSystemVariable("CMDNAMES");