using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Runtime.InteropServices;

namespace BIXOLON_Sample_program
{
    class BXLLIB_x86
    {
        //////////////////////////////////////////////////////////////////////
        //  Function List
        [DllImport("bxllib.dll")]
        public static extern bool ConnectPrinter([MarshalAs(UnmanagedType.LPStr)]string szPrinterName);

        [DllImport("bxllib.dll")]
        public static extern bool DisconnectPrinter();

        [DllImport("bxllib.dll")]
        public static extern int GetBIXOLON_PrinterList(StringBuilder strBxlPrtList);
        
        [DllImport("bxllib.dll")]
        public static extern bool GetDllVersion(StringBuilder strDllVersion);

        [DllImport("bxllib.dll")]
        public static extern int GetPrinterResolution();

        [DllImport("bxllib.dll")]
        public static extern bool Print1DBarcode(int nHorizontalPos,
                                                 int nVerticalPos,
                                                 int nBarcodeType,
                                                 int nNarrowBarWidth,
                                                 int nWideBarWidth,
                                                 int nBarcodeHeight,
                                                 int nRotation,
                                                 int nHRI,
                                                 [MarshalAs(UnmanagedType.LPStr)]string pData);

        [DllImport("bxllib.dll")]
        public static extern bool PrintDeviceFont(int nHorizontalPos,
                                                  int nVerticalPos,
                                                  int nFontName,
                                                  int nHorizontalMulti,
                                                  int nVerticalMulti,
                                                  int nRotation,
                                                  bool bBold,
                                                  [MarshalAs(UnmanagedType.LPStr)]string szText);

        [DllImport("bxllib.dll")]
        public static extern bool PrintDeviceFontW(int nHorizontalPos,
                                                  int nVerticalPos,
                                                  int nFontName,
                                                  int nHorizontalMulti,
                                                  int nVerticalMulti,
                                                  int nRotation,
                                                  bool bBold,
                                                  [MarshalAs(UnmanagedType.LPWStr)]string szText, int nCodePage);

        [DllImport("bxllib.dll")]
        public static extern bool SetConfigOfPrinter(int nSpeed,
                                                     int nDensity,
                                                     int nOrientation,
                                                     bool bAutoCut,
                                                     int nCuttingPeriod,
                                                     bool bBackFeeding);

        [DllImport("bxllib.dll")]
        public static extern bool Prints(int nLabelSet,
                                         int nCopiesOfEachLabel);

        [DllImport("bxllib.dll")]
        public static extern bool SetPaper(int nHorizontalMagin,
                                           int nVerticalMargin,
                                           int nPaperWidth,
                                           int nPaperLength,
                                           int nMediaType,
                                           int nOffSet,
                                           int nGapLengthORThicknessOfBlackLine);

        [DllImport("bxllib.dll")]
        public static extern bool ClearBuffer();

        [DllImport("bxllib.dll")]
        public static extern bool PrintBlock(int nHorizontalStartPos,
                                             int nVerticalStartPos,
                                             int nHorizontalEndPos,
                                             int nVerticalEndPos,
                                             int nOption,
                                             int nThickness);

        ///******************************************************************************/
        // Circle draw 
        // int nHorizontalStartPos	: X position
        // int nVerticalStartPos	: Y position
        // int nDiameter			: 원 Size(반지름) 1~6
        // int nMulti				: 확대(1~4)
        /******************************************************************************/
        [DllImport("bxllib.dll")]
        public static extern bool PrintCircle(int nHorizontalStartPos,
                                             int nVerticalStartPos,
                                             int nDiameter,
                                             int nMulti);

        [DllImport("bxllib.dll")]
        public static extern bool PrintDirect([MarshalAs(UnmanagedType.LPStr)]string pDirectData, bool bAddCrLf);

        [DllImport("bxllib.dll")]
        public static extern bool WriteBuffer([MarshalAs(UnmanagedType.LPStr)]string pDirectData, int nDataLength);

        
        [DllImport("bxllib.dll")]
        public static extern bool StartLabel();

        [DllImport("bxllib.dll")]
        public static extern void EndLabel();

        [DllImport("bxllib.dll")]
        public static extern bool PrintTrueFont(int nXPos,
                                        int nYPos,
                                        [MarshalAs(UnmanagedType.LPStr)]string strFontName,
                                        int nFontSize,
                                        int nRotaion,
                                        bool bItalic,
                                        bool bBold,
                                        bool bUnderline,
                                        [MarshalAs(UnmanagedType.LPStr)]string strText,
                                        bool bDataCompression);

        [DllImport("bxllib.dll")]
        public static extern bool PrintTrueFontW(int nXPos,
                                        int nYPos,
                                        [MarshalAs(UnmanagedType.LPWStr)]string strFontName,
                                        int nFontSize,
                                        int nRotaion,
                                        bool bItalic,
                                        bool bBold,
                                        bool bUnderline,
                                        [MarshalAs(UnmanagedType.LPWStr)]string strText,
                                        bool bDataCompression);

        [DllImport("bxllib.dll")]
        public static extern bool PrintTrueFontLib(int nXPos,
                                        int nYPos,
                                        [MarshalAs(UnmanagedType.LPStr)]string strFontName,
                                        int nFontSize,
                                        int nRotaion,
                                        bool bItalic,
                                        bool bBold,
                                        bool bUnderline,
                                        [MarshalAs(UnmanagedType.LPStr)]string strText,
                                        bool bDataCompression);

        [DllImport("bxllib.dll")]
        public static extern bool PrintTrueFontLibW(int nXPos,
                                        int nYPos,
                                        [MarshalAs(UnmanagedType.LPWStr)]string strFontName,
                                        int nFontSize,
                                        int nRotaion,
                                        bool bItalic,
                                        bool bBold,
                                        bool bUnderline,
                                        [MarshalAs(UnmanagedType.LPWStr)]string strText,
                                        bool bDataCompression);

        [DllImport("bxllib.dll")]
        public static extern bool PrintTrueFontLibWithAlign(int nXPos,
                                        int nYPos,
                                        [MarshalAs(UnmanagedType.LPStr)]string strFontName,
                                        int nFontSize,
                                        int nRotaion,
                                        bool bItalic,
                                        bool bBold,
                                        bool bUnderline,
                                        [MarshalAs(UnmanagedType.LPStr)]string strText,
                                        int nPrintWidth,
                                        int nAlignment,
                                        bool bDataCompression);

        [DllImport("bxllib.dll")]
        public static extern bool PrintTrueFontLibWithAlignW(int nXPos,
                                        int nYPos,
                                        [MarshalAs(UnmanagedType.LPWStr)]string strFontName,
                                        int nFontSize,
                                        int nRotaion,
                                        bool bItalic,
                                        bool bBold,
                                        bool bUnderline,
                                        [MarshalAs(UnmanagedType.LPWStr)]string strText,
                                        int nPrintWidth,
                                        int nAlignment,
                                        bool bDataCompression);

        [DllImport("bxllib.dll")]
        public static extern bool PrintVectorFont(
                                                int nXPos,
                                                int nYPos,
                                                string FontSelection,
                                                int FontWidth,
                                                int FontHeight,
                                                [MarshalAs(UnmanagedType.LPStr)]string RightSideCharSpacing,
                                                bool bBold,
                                                bool ReversePrinting,
                                                bool TextStyle,
                                                int Rotation,
                                                [MarshalAs(UnmanagedType.LPStr)]string TextAlignment,
                                                int TextDirection,
                                                [MarshalAs(UnmanagedType.LPStr)]string pData);

        [DllImport("bxllib.dll")]
        public static extern bool PrintVectorFontW(
                                                int nXPos,
                                                int nYPos,
                                                [MarshalAs(UnmanagedType.LPStr)]string FontSelection,
                                                int FontWidth,
                                                int FontHeight,
                                                [MarshalAs(UnmanagedType.LPStr)]string RightSideCharSpacing,
                                                bool bBold,
                                                bool ReversePrinting,
                                                bool TextStyle,
                                                int Rotation,
                                                [MarshalAs(UnmanagedType.LPStr)]string TextAlignment,
                                                int TextDirection,
                                                [MarshalAs(UnmanagedType.LPWStr)]string pData,
                                                int nCodePage);

        [DllImport("bxllib.dll")]
        public static extern bool PrintQRCode(int nXPos,
                           int nYPos,
                           int nModel,
                           int nECCLevel,
                           int nSize,
                           int nRotation,
                           [MarshalAs(UnmanagedType.LPStr)]string pData);

        [DllImport("bxllib.dll")]
        public static extern bool SetShowMsgBox(bool bShow);


        [DllImport("bxllib.dll")]
        public static extern bool PrintImageLib(int nHorizontalStartPos,
                            int nVerticalStartPos,
                            [MarshalAs(UnmanagedType.LPStr)]string pBitmapFilename,
                            int nDither,
                            bool bDataCompression);

        [DllImport("bxllib.dll")]
        public static extern bool PrintImageLibW(int nHorizontalStartPos,
                            int nVerticalStartPos,
                            [MarshalAs(UnmanagedType.LPWStr)]string pBitmapFilename,
                            int nDither,
                            bool bDataCompression);

        [DllImport("bxllib.dll")]
        public static extern bool PrintImageLibWithSize(int nHorizontalStartPos,
                            int nVerticalStartPos,
                            int nNewWidth, int nNewHeight,
                            [MarshalAs(UnmanagedType.LPStr)]string pBitmapFilename,
                            int nDither,
                            bool bDataCompression);

        [DllImport("bxllib.dll")]
        public static extern void DEBUGLOG_ON();

        [DllImport("bxllib.dll")]
        public static extern void DEBUGLOG_OFF();
    }
}
