using System;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Geometry;
using Autodesk.AutoCAD.EditorInput;
using System.Runtime.InteropServices;
[assembly: CommandClass(typeof(Rivilis.TestAbort))]
namespace Rivilis
{
public class TestAbort
{
// For AutoCAD 2007 & 2008 & 2009
[DllImport("acdb17.dll", CallingConvention = CallingConvention.Cdecl,
CharSet = CharSet.Unicode, EntryPoint = "acrx_abort")]
extern static private void acrx_abort17(string fmt, __arglist);
// For AutoCAD 2010 & 2011 & 2012
[DllImport("acdb18.dll", CallingConvention = CallingConvention.Cdecl,
CharSet = CharSet.Unicode, EntryPoint = "acrx_abort")]
extern static private void acrx_abort18(string fmt, __arglist);
// For AutoCAD 2013 & 2014
[DllImport("ac1st19.dll", CallingConvention = CallingConvention.Cdecl,
CharSet = CharSet.Unicode, EntryPoint = "acrx_abort")]
extern static private void acrx_abort19(string fmt, __arglist);
// For AutoCAD 2015 & 2016
[DllImport("ac1st20.dll", CallingConvention = CallingConvention.Cdecl,
CharSet = CharSet.Unicode, EntryPoint = "acrx_abort")]
extern static private void acrx_abort20(string fmt, __arglist);
// For AutoCAD 2017
[DllImport("ac1st21.dll", CallingConvention = CallingConvention.Cdecl,
CharSet = CharSet.Unicode, EntryPoint = "acrx_abort")]
extern static private void acrx_abort21(string fmt, __arglist);
[CommandMethod("Abort")]
public void Abort()
{
int ver = Application.Version.Major;
switch (ver)
{
case 17: acrx_abort17("Rivilis Error in AutoCAD 2007...2009: R%d",
__arglist(ver)); break;
case 18: acrx_abort18("Rivilis Error in AutoCAD 2010...2012: R%d",
__arglist(ver)); break;
case 19: acrx_abort19("Rivilis Error in AutoCAD 2013...2014: R%d",
__arglist(ver)); break;
case 20: acrx_abort20("Rivilis Error in AutoCAD 2015...2016: R%d",
__arglist(ver)); break;
case 21: acrx_abort21("Rivilis Error in AutoCAD 2017...201X: R%d",
__arglist(ver)); break;
}
}
}
}