新增C# CONSOLE测试DLL功能.

This commit is contained in:
TAO Cheng
2014-05-15 15:40:00 +08:00
parent 58b492b6fb
commit e59a15b060
12 changed files with 318 additions and 5 deletions
@@ -0,0 +1,101 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{5E3B7ED1-B324-4966-8527-D29873AC3815}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ConsoleTestDll</RootNamespace>
<AssemblyName>ConsoleTestDll</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>Mv_Util.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="MachineInterfaceDll.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="Mv_Util.ico" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.0,Profile=Client">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4 Client Profile %28x86 and x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
<Visible>False</Visible>
<ProductName>Windows Installer 3.1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PublishUrlHistory>publish\</PublishUrlHistory>
<InstallUrlHistory />
<SupportUrlHistory />
<UpdateUrlHistory />
<BootstrapperUrlHistory />
<ErrorReportUrlHistory />
<FallbackCulture>en-US</FallbackCulture>
<VerifyUploadedFiles>false</VerifyUploadedFiles>
</PropertyGroup>
</Project>
@@ -0,0 +1,62 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace Sys
{
public partial class MACHINEINTERFACEDLL
{
public enum EMACHINE_AXIS
{
MACHINE_AXIS_NONE = 0,
MACHINE_AXIS_X,
MACHINE_AXIS_Y,
MACHINE_AXIS_Z,
MACHINE_AXIS_ZOOM,
MACHINE_AXIS_R,
MACHINE_AXIS_ALL = 5
};
public enum EHOME_MACHINE_MODE
{
HOME_NONE,
HOME_XYZ = 1,
HOME_X = 10,
HOME_Y,
HOME_Z,
HOME_XY = 20,
HOME_XZ,
HOME_YZ,
HOME_R = 30,
HOME_TOATAL = 255
};
public enum EIO_PORT
{
INPORT_J2 = 0,//Effective bit:0-5
OUTPORT_J1,//Effective bit:0-2
OUTPORT_J3,//Effective bit:0-5
LIMIT_SWITCH_J4//Effective bit:0-5
};
public enum SSI_STATUS_MOTION
{
SSI_STATUS_MOTION_NORMAL = 0,
SSI_STATUS_MOTION_DATALINK_ERROR,
SSI_STATUS_MOTION_LIMIT_REACHED,
SSI_STATUS_MOTION_INVALID_PARAMETERS,
SSI_STATUS_MOTION_TIMEOUT,
SSI_STATUS_SO7_CONFIG_FILE_NOT_FOUND,
SSI_STATUS_MOTOR_DAT_FILE_NOT_FOUND,
SSI_STATUS_MACHINE_UNINITIALIZED,
SSI_STATUS_UNKNOWN_ERROR
};
[DllImport("MachineInterfaceDll.dll")]
public static extern SSI_STATUS_MOTION Machine_Startup(bool bOfflineOnly, EHOME_MACHINE_MODE cHomeMachineMode);
[DllImport("MachineInterfaceDll.dll")]
public static extern SSI_STATUS_MOTION Machine_Shutdown();
[DllImport("MachineInterfaceDll.dll")]
public static extern SSI_STATUS_MOTION Machine_GetDIO(EIO_PORT Channel, ref Byte bDISts);
[DllImport("MachineInterfaceDll.dll")]
public static extern SSI_STATUS_MOTION Machine_SetDO(EIO_PORT Channel, Byte bDOSts);
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 643 KiB

@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Sys;
namespace ConsoleTestDll
{
class Program
{
static void Main(string[] args)
{
MACHINEINTERFACEDLL.SSI_STATUS_MOTION rStatus;
Console.WriteLine("Machine_Startup.");
rStatus = MACHINEINTERFACEDLL.Machine_Startup(false, MACHINEINTERFACEDLL.EHOME_MACHINE_MODE.HOME_XYZ);
Console.WriteLine("RStatus:{0}\n",rStatus);
Console.WriteLine("Machine_Shutdown");
rStatus = MACHINEINTERFACEDLL.Machine_Shutdown();
Console.WriteLine("RStatus:{0}\n", rStatus, ".\n");
Console.WriteLine("Press enter key to exit...");
Console.ReadLine();
}
}
}
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("ConsoleTestDll")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ConsoleTestDll")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("a4e6873b-9a5b-4087-b745-9334d88a5ea7")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]