forked from icemile/CodeProject
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Mogoson
committed
Aug 8, 2019
1 parent
748b2f7
commit 1b91943
Showing
4 changed files
with
176 additions
and
0 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System.Reflection; | ||
using System.Runtime.CompilerServices; | ||
using System.Runtime.InteropServices; | ||
|
||
// 有关程序集的一般信息由以下 | ||
// 控制。更改这些特性值可修改 | ||
// 与程序集关联的信息。 | ||
[assembly: AssemblyTitle("MGS.WinLibrary")] | ||
[assembly: AssemblyDescription("")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("")] | ||
[assembly: AssemblyProduct("MGS.WinLibrary")] | ||
[assembly: AssemblyCopyright("Copyright © 2019 Mogoson")] | ||
[assembly: AssemblyTrademark("")] | ||
[assembly: AssemblyCulture("")] | ||
|
||
// 将 ComVisible 设置为 false 会使此程序集中的类型 | ||
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 | ||
//请将此类型的 ComVisible 特性设置为 true。 | ||
[assembly: ComVisible(false)] | ||
|
||
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID | ||
[assembly: Guid("c2c66f9c-7def-46aa-88d0-c3dcb71cfb5e")] | ||
|
||
// 程序集的版本信息由下列四个值组成: | ||
// | ||
// 主版本 | ||
// 次版本 | ||
// 生成号 | ||
// 修订号 | ||
// | ||
// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号 | ||
//通过使用 "*",如下所示: | ||
// [assembly: AssemblyVersion("1.0.*")] | ||
[assembly: AssemblyVersion("1.0.0.0")] | ||
[assembly: AssemblyFileVersion("1.0.0.0")] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/************************************************************************* | ||
* Copyright © 2019 Mogoson. All rights reserved. | ||
*------------------------------------------------------------------------ | ||
* File : Wininet.cs | ||
* Description : API of wininet dll. | ||
*------------------------------------------------------------------------ | ||
* Author : Mogoson | ||
* Version : 0.1.0 | ||
* Date : 8/8/2019 | ||
* Description : Initial development version. | ||
*************************************************************************/ | ||
|
||
using System.Runtime.InteropServices; | ||
|
||
namespace MGS.WinLibrary | ||
{ | ||
/// <summary> | ||
/// API of wininet dll. | ||
/// </summary> | ||
public static class Wininet | ||
{ | ||
#region Field | ||
/// <summary> | ||
/// Local system has a valid connection to the Internet, but it might or might not be currently connected. | ||
/// </summary> | ||
public const int INTERNET_CONNECTION_CONFIGURED = 0x40; | ||
|
||
/// <summary> | ||
/// Local system uses a local area network to connect to the Internet. | ||
/// </summary> | ||
public const int INTERNET_CONNECTION_LAN = 0x02; | ||
|
||
/// <summary> | ||
/// Local system uses a modem to connect to the Internet. | ||
/// </summary> | ||
public const int INTERNET_CONNECTION_MODEM = 0x01; | ||
|
||
/// <summary> | ||
/// No longer used. | ||
/// </summary> | ||
public const int INTERNET_CONNECTION_MODEM_BUSY = 0x08; | ||
|
||
/// <summary> | ||
/// Local system is in offline mode. | ||
/// </summary> | ||
public const int INTERNET_CONNECTION_OFFLINE = 0x20; | ||
|
||
/// <summary> | ||
/// Local system uses a proxy server to connect to the Internet. | ||
/// </summary> | ||
public const int INTERNET_CONNECTION_PROXY = 0x04; | ||
|
||
/// <summary> | ||
/// Local system has RAS installed. | ||
/// </summary> | ||
public const int INTERNET_RAS_INSTALLED = 0x10; | ||
#endregion | ||
|
||
#region Method | ||
/// <summary> | ||
/// Retrieves the connected state of the local system. | ||
/// </summary> | ||
/// <param name="lpdwFlags">Pointer to a variable that receives the connection description.</param> | ||
/// <param name="dwReserved">This parameter is reserved and must be 0.</param> | ||
/// <returns>Returns TRUE if there is an active modem or a LAN Internet connection, | ||
/// or FALSE if there is no Internet connection, | ||
/// or if all possible Internet connections are not currently active. </returns> | ||
[DllImport("wininet.dll")] | ||
public static extern bool InternetGetConnectedState(out int lpdwFlags, int dwReserved); | ||
#endregion | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProjectGuid>{C2C66F9C-7DEF-46AA-88D0-C3DCB71CFB5E}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>MGS.WinLibrary</RootNamespace> | ||
<AssemblyName>MGS.WinLibrary</AssemblyName> | ||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
<TargetFrameworkProfile /> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
<DocumentationFile>bin\Debug\MGS.WinLibrary.xml</DocumentationFile> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
<DocumentationFile>bin\Release\MGS.WinLibrary.xml</DocumentationFile> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Xml.Linq" /> | ||
<Reference Include="System.Data.DataSetExtensions" /> | ||
<Reference Include="System.Data" /> | ||
<Reference Include="System.Xml" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
<Compile Include="Wininet.cs" /> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
<PropertyGroup> | ||
<PostBuildEvent>set targetDir="$(SolutionDir)..\UnityProject\Assets\Plugins\MGS" | ||
if exist %25targetDir%25\$(TargetFileName) ( | ||
if $(ConfigurationName)==Debug ( | ||
copy "$(TargetName).pdb" %25targetDir%25 | ||
) else ( | ||
if exist "%25targetDir%25\$(TargetName).pdb" ( | ||
del "%25targetDir%25\$(TargetName).pdb" | ||
) | ||
) | ||
copy "$(TargetFileName)" %25TargetDir%25 | ||
copy "$(TargetName).xml" %25TargetDir%25 | ||
)</PostBuildEvent> | ||
</PropertyGroup> | ||
</Project> |