From c1a112a4d793b7134ff634c64a295407ad2937b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E5=BB=BA=E8=B6=85?= Date: Sat, 11 Nov 2023 19:24:15 +0800 Subject: [PATCH] feat: InitializeComponent --- .gitignore | 244 ++++++++++++++++++ WindowsFormsApp1.sln | 31 +++ WindowsFormsApp1/App.config | 6 + WindowsFormsApp1/Form1.Designer.cs | 59 +++++ WindowsFormsApp1/Form1.cs | 43 +++ WindowsFormsApp1/Form1.resx | 120 +++++++++ WindowsFormsApp1/Program.cs | 22 ++ WindowsFormsApp1/Properties/AssemblyInfo.cs | 36 +++ .../Properties/Resources.Designer.cs | 63 +++++ WindowsFormsApp1/Properties/Resources.resx | 117 +++++++++ .../Properties/Settings.Designer.cs | 26 ++ WindowsFormsApp1/Properties/Settings.settings | 7 + WindowsFormsApp1/Verifier.cs | 59 +++++ WindowsFormsApp1/WindowsFormsApp1.csproj | 105 ++++++++ 14 files changed, 938 insertions(+) create mode 100644 .gitignore create mode 100644 WindowsFormsApp1.sln create mode 100644 WindowsFormsApp1/App.config create mode 100644 WindowsFormsApp1/Form1.Designer.cs create mode 100644 WindowsFormsApp1/Form1.cs create mode 100644 WindowsFormsApp1/Form1.resx create mode 100644 WindowsFormsApp1/Program.cs create mode 100644 WindowsFormsApp1/Properties/AssemblyInfo.cs create mode 100644 WindowsFormsApp1/Properties/Resources.Designer.cs create mode 100644 WindowsFormsApp1/Properties/Resources.resx create mode 100644 WindowsFormsApp1/Properties/Settings.Designer.cs create mode 100644 WindowsFormsApp1/Properties/Settings.settings create mode 100644 WindowsFormsApp1/Verifier.cs create mode 100644 WindowsFormsApp1/WindowsFormsApp1.csproj diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..dd290a0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,244 @@ +# Visual Studio + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +[Xx]64/ +[Xx]86/ +[Bb]uild/ +bld/ +[Bb]in/ +[Oo]bj/ + +# Visual Studio 2015 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# DNX +project.lock.json +artifacts/ + +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +*.publishproj +*.pubxml +PublishProfiles/ +PublishScripts/ + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/packages/* +# except build/, which is used as an MSBuild target. +!**/packages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/packages/repositories.config +# NuGet v3's project.json files produces more ignoreable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directory +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ + +# Others +ClientBin/ +[Ss]tyle[Cc]op.* +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.pfx +*.publishsettings +orleans.codegen.cs + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +*.mdf +*.ldf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# LightSwitch generated files +GeneratedArtifacts/ +ModelManifest.xml + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +.DS_Store \ No newline at end of file diff --git a/WindowsFormsApp1.sln b/WindowsFormsApp1.sln new file mode 100644 index 0000000..4d5f992 --- /dev/null +++ b/WindowsFormsApp1.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.33919.361 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindowsFormsApp1", "WindowsFormsApp1\WindowsFormsApp1.csproj", "{487762A9-1157-43DB-8A8E-CE5297994575}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {487762A9-1157-43DB-8A8E-CE5297994575}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {487762A9-1157-43DB-8A8E-CE5297994575}.Debug|Any CPU.Build.0 = Debug|Any CPU + {487762A9-1157-43DB-8A8E-CE5297994575}.Debug|x64.ActiveCfg = Debug|x64 + {487762A9-1157-43DB-8A8E-CE5297994575}.Debug|x64.Build.0 = Debug|x64 + {487762A9-1157-43DB-8A8E-CE5297994575}.Release|Any CPU.ActiveCfg = Release|Any CPU + {487762A9-1157-43DB-8A8E-CE5297994575}.Release|Any CPU.Build.0 = Release|Any CPU + {487762A9-1157-43DB-8A8E-CE5297994575}.Release|x64.ActiveCfg = Release|x64 + {487762A9-1157-43DB-8A8E-CE5297994575}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {A84BAE6A-86E6-460F-AAB2-B7BD7C4C3305} + EndGlobalSection +EndGlobal diff --git a/WindowsFormsApp1/App.config b/WindowsFormsApp1/App.config new file mode 100644 index 0000000..731f6de --- /dev/null +++ b/WindowsFormsApp1/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/WindowsFormsApp1/Form1.Designer.cs b/WindowsFormsApp1/Form1.Designer.cs new file mode 100644 index 0000000..93e8cd2 --- /dev/null +++ b/WindowsFormsApp1/Form1.Designer.cs @@ -0,0 +1,59 @@ +namespace WindowsFormsApp1 +{ + partial class Form1 + { + /// + /// 必需的设计器变量。 + /// + private System.ComponentModel.IContainer components = null; + + /// + /// 清理所有正在使用的资源。 + /// + /// 如果应释放托管资源,为 true;否则为 false。 + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows 窗体设计器生成的代码 + + /// + /// 设计器支持所需的方法 - 不要修改 + /// 使用代码编辑器修改此方法的内容。 + /// + private void InitializeComponent() + { + this.textBox1 = new System.Windows.Forms.ListBox(); + this.SuspendLayout(); + // + // textBox1 + // + this.textBox1.Dock = System.Windows.Forms.DockStyle.Fill; + this.textBox1.Location = new System.Drawing.Point(0, 0); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(800, 450); + this.textBox1.TabIndex = 0; + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(800, 450); + this.Controls.Add(this.textBox1); + this.Name = "Form1"; + this.Text = "KEP算法依赖库校验"; + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.ListBox textBox1; + } +} + diff --git a/WindowsFormsApp1/Form1.cs b/WindowsFormsApp1/Form1.cs new file mode 100644 index 0000000..880fb78 --- /dev/null +++ b/WindowsFormsApp1/Form1.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace WindowsFormsApp1 +{ + public partial class Form1 : Form + { + public Form1() + { + InitializeComponent(); + + Check(); + } + + public void Check() + { + var librarys = new List() { + "FaultageProcessLib.dll", + "FaultAmplitudeLib.dll", + "SurfaceGrid.dll", + "ModelCreateIDW.dll", + "MicroStructurePP.dll", + "WellCalibrate.dll" + }; + + textBox1.Items.Clear(); + + var results = Verifier.Check(librarys); + foreach (var result in results) + { + var ok = result.Ok ? "Ok" : "Error"; + textBox1.Items.Add($"{result.Name}\t{ok}"); + } + } + } +} diff --git a/WindowsFormsApp1/Form1.resx b/WindowsFormsApp1/Form1.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/WindowsFormsApp1/Form1.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/WindowsFormsApp1/Program.cs b/WindowsFormsApp1/Program.cs new file mode 100644 index 0000000..4ef037c --- /dev/null +++ b/WindowsFormsApp1/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace WindowsFormsApp1 +{ + static class Program + { + /// + /// 应用程序的主入口点。 + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/WindowsFormsApp1/Properties/AssemblyInfo.cs b/WindowsFormsApp1/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..a624556 --- /dev/null +++ b/WindowsFormsApp1/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 有关程序集的一般信息由以下 +// 控制。更改这些特性值可修改 +// 与程序集关联的信息。 +[assembly: AssemblyTitle("WindowsFormsApp1")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("WindowsFormsApp1")] +[assembly: AssemblyCopyright("Copyright © 2023")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// 将 ComVisible 设置为 false 会使此程序集中的类型 +//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 +//请将此类型的 ComVisible 特性设置为 true。 +[assembly: ComVisible(false)] + +// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID +[assembly: Guid("487762a9-1157-43db-8a8e-ce5297994575")] + +// 程序集的版本信息由下列四个值组成: +// +// 主版本 +// 次版本 +// 生成号 +// 修订号 +// +// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号 +// 方法是按如下所示使用“*”: : +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/WindowsFormsApp1/Properties/Resources.Designer.cs b/WindowsFormsApp1/Properties/Resources.Designer.cs new file mode 100644 index 0000000..7dc0715 --- /dev/null +++ b/WindowsFormsApp1/Properties/Resources.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// 此代码由工具生成。 +// 运行时版本:4.0.30319.42000 +// +// 对此文件的更改可能会导致不正确的行为,并且如果 +// 重新生成代码,这些更改将会丢失。 +// +//------------------------------------------------------------------------------ + +namespace WindowsFormsApp1.Properties { + using System; + + + /// + /// 一个强类型的资源类,用于查找本地化的字符串等。 + /// + // 此类是由 StronglyTypedResourceBuilder + // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 + // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen + // (以 /str 作为命令选项),或重新生成 VS 项目。 + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// 返回此类使用的缓存的 ResourceManager 实例。 + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WindowsFormsApp1.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// 重写当前线程的 CurrentUICulture 属性 + /// 重写当前线程的 CurrentUICulture 属性。 + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/WindowsFormsApp1/Properties/Resources.resx b/WindowsFormsApp1/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/WindowsFormsApp1/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/WindowsFormsApp1/Properties/Settings.Designer.cs b/WindowsFormsApp1/Properties/Settings.Designer.cs new file mode 100644 index 0000000..fecbeb5 --- /dev/null +++ b/WindowsFormsApp1/Properties/Settings.Designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// +// 此代码由工具生成。 +// 运行时版本:4.0.30319.42000 +// +// 对此文件的更改可能会导致不正确的行为,并且如果 +// 重新生成代码,这些更改将会丢失。 +// +//------------------------------------------------------------------------------ + +namespace WindowsFormsApp1.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + } +} diff --git a/WindowsFormsApp1/Properties/Settings.settings b/WindowsFormsApp1/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/WindowsFormsApp1/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/WindowsFormsApp1/Verifier.cs b/WindowsFormsApp1/Verifier.cs new file mode 100644 index 0000000..bdfb07c --- /dev/null +++ b/WindowsFormsApp1/Verifier.cs @@ -0,0 +1,59 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.InteropServices; + +namespace WindowsFormsApp1 +{ + public struct Result + { + public string Name; + public bool Ok; + } + + public static class Verifier + { + // 声明 LoadLibrary 函数 + [DllImport("kernel32.dll", CharSet = CharSet.Unicode)] + public static extern IntPtr LoadLibrary(string lpFileName); + + // 声明 FreeLibrary 函数 + [DllImport("kernel32.dll")] + public static extern bool FreeLibrary(IntPtr hModule); + + public static List Check(List libraries) + { + return libraries.Select(library => + { + return new Result + { + Name = library, + Ok = LoadLibraryTest(library), + }; + }).ToList(); + } + + public static bool LoadLibraryTest(string library) + { + IntPtr dllHandle = IntPtr.Zero; + + try + { + dllHandle = LoadLibrary(library); + if (dllHandle == IntPtr.Zero) + { + return false; + } + + return true; + } + finally + { + if (dllHandle != IntPtr.Zero) + { + FreeLibrary(dllHandle); + } + } + } + } +} diff --git a/WindowsFormsApp1/WindowsFormsApp1.csproj b/WindowsFormsApp1/WindowsFormsApp1.csproj new file mode 100644 index 0000000..05469a1 --- /dev/null +++ b/WindowsFormsApp1/WindowsFormsApp1.csproj @@ -0,0 +1,105 @@ + + + + + Debug + AnyCPU + {487762A9-1157-43DB-8A8E-CE5297994575} + WinExe + WindowsFormsApp1 + KepAlgorithmLibraryVerifier + v4.6.1 + 512 + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + true + bin\x64\Debug\ + DEBUG;TRACE + full + x64 + prompt + MinimumRecommendedRules.ruleset + true + + + bin\x64\Release\ + TRACE + true + pdbonly + x64 + prompt + MinimumRecommendedRules.ruleset + true + + + + + + + + + + + + + + + + + Form + + + Form1.cs + + + + + + Form1.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + True + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + \ No newline at end of file