Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using ASSET_API;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Asset
- {
- class Program
- {
- static void Main(string[] args)
- {
- try
- {
- Console.WriteLine("Hello");
- Console.WriteLine("Before startup");
- aamapi93 a = new aamapi93();
- var v1 = a.amStartup();
- Console.WriteLine("After startup " + v1);
- Console.WriteLine("username");
- var username = Console.ReadLine();
- Console.WriteLine("password");
- var password = Console.ReadLine();
- var v2 = a.amOpenConnection("TEST ACCEPT", username, password);
- Console.WriteLine("After amOpenConnection " + v2);
- var v3 = a.amIsConnected(v2);
- Console.WriteLine("After amIsConnected " + v3);
- }
- catch (Exception ex)
- {
- Console.WriteLine("ERREUR : " + ex.Message);
- }
- Console.Read();
- }
- }
- }
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Runtime.InteropServices;
- namespace ASSET_API
- {
- public sealed class aamapi93
- {
- [DllImport(@"C:AssetManagerbinaamapi93.dll", EntryPoint = "AmStartup", CallingConvention = CallingConvention.StdCall)]
- private static extern IntPtr _AmStartupW();
- public IntPtr amStartup()
- {
- return _AmStartupW();
- }
- [DllImport(@"C:AssetManagerbinaamapi93.dll", EntryPoint = "AmOpenConnectionW", CallingConvention = CallingConvention.StdCall)]
- private static extern IntPtr _AmOpenConnectionW([InAttribute()] [MarshalAsAttribute(UnmanagedType.LPWStr)] string pszDataSource,
- [InAttribute()] [MarshalAsAttribute(UnmanagedType.LPWStr)] string pszUser,
- [InAttribute()] [MarshalAsAttribute(UnmanagedType.LPWStr)] string pszPwd);
- public IntPtr amOpenConnection(string datasource, string username, string password)
- {
- IntPtr i = IntPtr.Zero;
- i = _AmOpenConnectionW(datasource, username, password);
- //yourlog.debug(string.Format("amOpenConnection executed. Cnx {0} opened.", i.ToString()));
- return i;
- }
- [DllImport(@"C:AssetManagerbinaamapi93.dll", EntryPoint = "AmIsConnectedW", CallingConvention = CallingConvention.StdCall)]
- private static extern IntPtr _AmIsConnectedW(IntPtr hApiCnxBase);
- public IntPtr amIsConnected(IntPtr CnxBase)
- {
- IntPtr i = IntPtr.Zero;
- i = _AmIsConnectedW(CnxBase);
- //yourlog.debug(string.Format("amOpenConnection executed. Cnx {0} opened.", i.ToString()));
- return i;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement