Example #1
1
 internal static extern UINT GetRegisteredRawInputDevices(
     [Out] RawInput[] RawInputDevices,
     [In, Out] ref UINT NumDevices,
     UINT cbSize
 );
Example #2
0
        public override ScalarValue Decode(System.IO.Stream in_Renamed)
        {
            int intValue = ((IntegerValue)UINT.Decode(in_Renamed)).value_Renamed;

            System.DateTime tempAux = Util.ToTimestamp(intValue);
            return(new DateValue(ref tempAux));
        }
Example #3
0
 bool Check_overflow(UINT value)
 {
     if (rebuff.rp <= rebuff.wp)//说明写指针未回溯
     {
         if (rebuff.rp + value <= rebuff.wp)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     else
     {
         if (rebuff.rp + value <= (rebuff.wp + RE_BUFFER_SIZE))
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
 }
Example #4
0
 public static extern int DrawTextW(
     HDC hdc,
     [MarshalAs(UnmanagedType.LPWStr)] string lpchText,
     int cchText,
     [In] ref RECT lprc,
     UINT format
     );
Example #5
0
        /// <summary>
        /// コールバック関数。バッファの再生終了を検出するために使用。
        /// </summary>
        /// <param name="hwo"></param>
        /// <param name="uMsg"></param>
        /// <param name="dwInstance"></param>
        /// <param name="dwParam1"></param>
        /// <param name="dwParam2"></param>
        public static void SoundCallback(
            IntPtr hwo,
            UINT uMsg,
            DWORD dwInstance,
            DWORD dwParam1,
            DWORD dwParam2)
        {
            if (uMsg != win32.MM_WOM_DONE)
            {
                return;
            }

            for (int i = 0; i < NUM_BUF; i++)
            {
                fixed(WAVEHDR *p = &wave_header[i])
                {
                    if (p != (WAVEHDR *)dwParam1)
                    {
                        continue;
                    }
                }

                wave_done[i] = true;
                break;
            }
        }
Example #6
0
        void Extract_TXXX(UCHR[] buf, UINT i)
        {
            txxx.xxlb     = buf[((i + 10) & RE_BUFFER_SIZE)];
            txxx.fxfdz[0] = buf[((i + 11) & RE_BUFFER_SIZE)];
            txxx.fxfdz[1] = buf[((i + 12) & RE_BUFFER_SIZE)];
            txxx.fxfdz[2] = buf[((i + 13) & RE_BUFFER_SIZE)];
            txxx.fxsj_h   = buf[((i + 14) & RE_BUFFER_SIZE)];
            txxx.fxsj_m   = buf[((i + 15) & RE_BUFFER_SIZE)];
            txxx.dwcd     = UCHRtoUINT(buf[((i + 16) & RE_BUFFER_SIZE)], buf[((i + 17) & RE_BUFFER_SIZE)]);
            txxx.dwnr     = new UCHR[txxx.dwcd / 8];
            for (UINT ii = 0; ii * 8 < txxx.dwcd; ++ii)
            {
                txxx.dwnr[ii] = buf[((i + 18 + ii) & RE_BUFFER_SIZE)];
            }
            UINT temp = txxx.dwcd / 8;

            Analysis_data(ref txxx.fxfdz, ref txxx.fxsj_h, ref txxx.fxsj_m, ref txxx.dwnr, ref temp);
            //注意有长度无内容的情况 TODO
            //注意长度不是字节整数
            if (txxx.dwcd % 8 == 0)
            {
                txxx.crc = buf[((i + 18 + txxx.dwcd / 8) & RE_BUFFER_SIZE)];
            }
            else
            {
                txxx.crc = buf[((i + 18 + txxx.dwcd / 8 + 1) & RE_BUFFER_SIZE)];
            }
            //print_txxx();
            print_flag |= PRINT_TXXX;
        }
Example #7
0
 void Extract_GNPX(UCHR[] buf, UINT i)
 {
     gnpx.jdfw = buf[((i + 10) & RE_BUFFER_SIZE)];
     gnpx.jd   = buf[((i + 11) & RE_BUFFER_SIZE)];
     gnpx.jf   = buf[((i + 12) & RE_BUFFER_SIZE)];
     gnpx.jm   = buf[((i + 13) & RE_BUFFER_SIZE)];
     gnpx.jxm  = buf[((i + 14) & RE_BUFFER_SIZE)];
     gnpx.wdfw = buf[((i + 15) & RE_BUFFER_SIZE)];
     gnpx.wd   = buf[((i + 16) & RE_BUFFER_SIZE)];
     gnpx.wf   = buf[((i + 17) & RE_BUFFER_SIZE)];
     gnpx.wm   = buf[((i + 18) & RE_BUFFER_SIZE)];
     gnpx.wxm  = buf[((i + 19) & RE_BUFFER_SIZE)];
     gnpx.gd   = UCHRtoINT(buf[((i + 20) & RE_BUFFER_SIZE)], buf[((i + 21) & RE_BUFFER_SIZE)]);
     gnpx.sd   = UCHRtoUINT(buf[((i + 22) & RE_BUFFER_SIZE)], buf[((i + 23) & RE_BUFFER_SIZE)]);
     gnpx.fx   = UCHRtoUINT(buf[((i + 24) & RE_BUFFER_SIZE)], buf[((i + 25) & RE_BUFFER_SIZE)]);
     gnpx.wxs  = buf[((i + 26) & RE_BUFFER_SIZE)];
     gnpx.zt   = buf[((i + 27) & RE_BUFFER_SIZE)];
     gnpx.jdxs = buf[((i + 28) & RE_BUFFER_SIZE)];
     gnpx.gjwc = UCHRtoUINT(buf[((i + 29) & RE_BUFFER_SIZE)], buf[((i + 30) & RE_BUFFER_SIZE)]);
     // print_gnpx();
     Handle_GNPX();
     print_flag |= PRINT_GNPX;
     if ((status & ~(STATUS_BIT_ANSWER | STATUS_BIT_CONFIRM)) == STEP_GNPS)
     {
         status |= Convert.ToByte(STATUS_BIT_ANSWER | STATUS_BIT_CONFIRM);
     }
 }
Example #8
0
        public override byte[] EncodeValue(ScalarValue value_Renamed)
        {
            System.DateTime date     = ((DateValue)value_Renamed).value_Renamed;
            int             intValue = Util.TimeToInt(ref date);

            return(UINT.Encode(new IntegerValue(intValue)));
        }
Example #9
0
 void Handle_GNPX()
 {
     if (First_Run_POS == true && gnpx.zt == 1)
     {
         if (count_time == 0)
         {
             if (BaiduAPI.Geocoding_API(Convert.ToString((((gnpx.wxm / 60.0) + gnpx.wm) / 60.0 + gnpx.wf) / 60.0 + gnpx.wd),
                                        Convert.ToString((((gnpx.jxm / 60.0) + gnpx.jm) / 60.0 + gnpx.jf) / 60.0 + gnpx.jd), ref address) == true)
             {
                 First_Run_POS = false;
             }
             else
             {
                 count_time += BD_PRINT_GNPX_SEQ;
             }
             print_flag |= PRINT_FIRST_ADDRESS;
         }
         else
         {
             count_time += BD_PRINT_GNPX_SEQ;
             if (count_time >= 60)//如果调用API失败,控制在60秒内不再调用
             {
                 count_time = 0;
             }
         }
     }
 }
Example #10
0
        void Analysis_data(ref UCHR[] fxfdz, ref UCHR h, ref UCHR m, ref UCHR[] buffer, ref UINT package_length)
        {
            UINT crc = 0, crc1 = 0;
            UINT length, length1;

            if (buffer[package_length - 1] != 0x16)
            {
                return;
            }
            else if (buffer[0] == 0x11)
            {
                length1 = length = ((UINT)buffer[1] << 8) + (UINT)buffer[2];
                crc     = Convert.ToUInt32(((((UINT)buffer[length + 1]) << 8) & 0xff00) + (buffer[length + 2] & 0x00ff));
                if (length1 < package_length)
                {
                    for (; length1 > 0; length1--)
                    {
                        crc1 += buffer[length1];
                    }
                    if (crc == crc1)
                    {
                        UINT   _LENGTH = length - 2;
                        UCHR[] exdata  = new UCHR[_LENGTH];
                        System.Buffer.BlockCopy(buffer, 3, exdata, 0, Convert.ToInt32(_LENGTH));
                        DATA_Handler(ref fxfdz, ref h, ref m, ref exdata, ref _LENGTH);
                    }
                }
            }
        }
Example #11
0
        void TXSQ_send(UCHR[] buffer, UINT len, UCHR[] dis)
        {
            UINT lenth = BD_TXSQ.lenth + len, i = 0;;

            // UCHR[] sendbuffer = Encoding.Default.GetBytes("$TXSQ0?00000?");//最多只能发送210字节,这张卡是628bit
            UCHR[] sendbuffer = new UCHR[lenth];
            sendbuffer[0]  = (byte)'$';
            sendbuffer[1]  = (byte)'T';
            sendbuffer[2]  = (byte)'X';
            sendbuffer[3]  = (byte)'S';
            sendbuffer[4]  = (byte)'Q';
            sendbuffer[5]  = Convert.ToByte(lenth >> 8);
            sendbuffer[6]  = Convert.ToByte(lenth & 0xff);
            sendbuffer[7]  = icxx.yhdz[0];
            sendbuffer[8]  = icxx.yhdz[1];
            sendbuffer[9]  = icxx.yhdz[2];
            sendbuffer[10] = 0B01000110;
            sendbuffer[11] = dis[0];
            sendbuffer[12] = dis[1];
            sendbuffer[13] = dis[2];
            sendbuffer[14] = Convert.ToByte((len * 8) >> 8);
            sendbuffer[15] = Convert.ToByte((len * 8) & 0xff);
            sendbuffer[16] = 0;
            for (; i < len; ++i)
            {
                sendbuffer[17 + i] = buffer[i];
            }
            sendbuffer[lenth - 1] = Xor_checksum(ref sendbuffer, lenth - 1);
            mycom.Send(sendbuffer);
        }
Example #12
0
 public DRAWTEXTPARAMS(int tabLength)
 {
     cbSize        = (uint)Marshal.SizeOf <DRAWTEXTPARAMS>();
     iTabLength    = tabLength;
     iLeftMargin   = 0;
     iRightMargin  = 0;
     uiLengthDrawn = 0;
 }
Example #13
0
 public static extern int DrawTextExW(
     HDC hdc,
     [MarshalAs(UnmanagedType.LPWStr)] string lpchText,
     int cchText,
     ref RECT lprc,
     UINT format,
     ref DRAWTEXTPARAMS lpdtp
     );
Example #14
0
        void LeftButtonDblClk(UINT nFlags, CPoint point)
        {
            CShowBatterDlg	dlg;

            dlg.m_pBatter = m_pSlot->m_pBatter;

            dlg.DoModal();
        }
Example #15
0
 private static extern HBITMAP CreateDIBSection(
     HDC hdc,
     ref BITMAPINFO pbmi,
     UINT usage,
     out IntPtr ppvBits,
     HANDLE hSection,
     DWORD offset
     );
 public override void init()
 {
     base.init();
     mState      = null;
     mParam      = null;
     mOutStateID = null;
     mStateTime  = -1.0f;
     mStateID    = 0;
 }
Example #17
0
        public override byte[] EncodeValue(ScalarValue v)
        {
            if (v.Null)
            {
                return(NULL_VALUE_ENCODING);
            }

            return(UINT.EncodeValue(((NumericValue)v).Increment()));
        }
Example #18
0
 public static extern HICON CreateIconFromResourceEx(
     PBYTE presbits,
     DWORD dwResSize,
     int fIcon,
     DWORD dwVer,
     int cxDesired,
     int cyDesired,
     UINT Flags
     );
Example #19
0
 public override void resetProperty()
 {
     base.resetProperty();
     mStateType  = null;
     mParam      = null;
     mOutStateID = null;
     mStateTime  = -1.0f;
     mStateID    = 0;
 }
Example #20
0
        public override ScalarValue Decode(System.IO.Stream in_Renamed)
        {
            long longValue = UINT.Decode(in_Renamed).ToLong();
            var  year      = (int)(longValue / 10000);
            var  month     = (int)((longValue - (year * 10000)) / 100);
            var  day       = (int)(longValue % 100);

            System.DateTime tempAux = Util.Date(year, month, day);
            return(new DateValue(ref tempAux));
        }
Example #21
0
 void Extract_FKXX(UCHR[] buf, UINT i)
 {
     fkxx.flbz    = buf[((i + 10) & RE_BUFFER_SIZE)];
     fkxx.fjxx[0] = buf[((i + 11) & RE_BUFFER_SIZE)];
     fkxx.fjxx[1] = buf[((i + 12) & RE_BUFFER_SIZE)];
     fkxx.fjxx[2] = buf[((i + 13) & RE_BUFFER_SIZE)];
     fkxx.fjxx[3] = buf[((i + 14) & RE_BUFFER_SIZE)];
     Handle_FXXX();
     print_flag |= PRINT_FKXX;
     // print_fkxx();
 }
Example #22
0
        public override ScalarValue Decode(System.IO.Stream in_Renamed)
        {
            var value_Renamed = (NumericValue)UINT.Decode(in_Renamed);

            if (value_Renamed.Equals(0))
            {
                return(null);
            }

            return(value_Renamed.Decrement());
        }
Example #23
0
        public override byte[] Encode(ScalarValue value_Renamed)
        {
            byte[] bytes      = value_Renamed.Bytes;
            int    lengthSize = IntegerCodec.GetUnsignedIntegerSize(bytes.Length);
            var    encoding   = new byte[bytes.Length + lengthSize];

            byte[] length = UINT.Encode(new IntegerValue(bytes.Length));
            Array.Copy(length, 0, encoding, 0, lengthSize);
            Array.Copy(bytes, 0, encoding, lengthSize, bytes.Length);
            return(encoding);
        }
Example #24
0
 public void BD_send(ref UCHR[] buffer, UINT len, UCHR[] dis)
 {
     if (len > 0)//BSGL != 0 && error_flag == 0 &&SEND_BLOCKTIME == 0 &&
     {
         UCHR[] send_buffer;
         send_buffer = new UCHR[len + DATA_FIRM_LENTH];
         TXSQ_send(Data_encapsulation(send_buffer, ref buffer, ref len), len + DATA_FIRM_LENTH, dis);
     }
     else
     {
     }
 }
Example #25
0
        /*
         * 发送用
         * 异或校验和算法
         */
        UCHR Xor_checksum(ref UCHR[] buf, UINT len)
        {
            UINT i;
            UCHR checksum = 0;

            for (i = 0; i < len; ++i)
            {
                checksum ^= buf[i];
            }

            return(checksum);
        }
Example #26
0
        /*
         * 接收用
         * 异或校验和算法
         */
        UCHR Xor_checksum(ref UCHR[] buf, UINT location, UINT len)
        {
            UINT i, ii;
            UCHR checksum = 0;

            for (i = 0; i < len; ++i)
            {
                ii        = (location + i) & RE_BUFFER_SIZE;
                checksum ^= buf[ii];
            }

            return(checksum);
        }
Example #27
0
 void Thread_Check()
 {
     while (true)
     {
         Check_status();
         if (SEND_BLOCKTIME != 0)
         {
             --SEND_BLOCKTIME;
             print_flag |= PRINT_BLOCK;
         }
         Thread.Sleep(1000);
     }
 }
Example #28
0
        protected static Int32 __WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
        {
            DuiHostFormBase hostForm = null;

            if (msg == WindowMessages.WM_NCCREATE)
            {
                var    lpcs      = (LPCREATESTRUCT)Marshal.PtrToStructure((IntPtr)lParam, typeof(LPCREATESTRUCT));
                IntPtr pHostForm = new IntPtr(lpcs.lpCreateParams);
                var    gch       = GCHandle.FromIntPtr(pHostForm);
                hostForm = gch.Target as DuiHostFormBase;
                if (hostForm != null)
                {
                    hostForm.m_hWnd = hWnd;
                    NativeMethods.SetWindowLong(hWnd, (int)SetWindowLongOffsets.GWL_USERDATA, pHostForm);
                }
            }
            else
            {
                IntPtr pHostForm = NativeMethods.GetWindowLong(hWnd, SetWindowLongOffsets.GWL_USERDATA);
                try
                {
                    var gch = GCHandle.FromIntPtr(pHostForm);
                    hostForm = gch.Target as DuiHostFormBase;
                }
                catch { }

                if (msg == WindowMessages.WM_NCDESTROY && hostForm != null)
                {
                    LRESULT lRes = NativeMethods.CallWindowProc(hostForm.m_defWindowProc, hWnd, (int)msg, (IntPtr)wParam, (IntPtr)lParam).ToInt32();
                    NativeMethods.SetWindowLong(hWnd, (int)SetWindowLongOffsets.GWL_USERDATA, IntPtr.Zero);
                    if (hostForm.m_bSubclassed)
                    {
                        hostForm.Unsubclass();
                    }
                    hostForm.m_hWnd = IntPtr.Zero;
                    hostForm.OnFinalMessage(hWnd);
                    return(lRes);
                }
            }

            if (hostForm != null)
            {
                return(hostForm.HandleMessage(msg, wParam, lParam));
            }
            else
            {
                return(NativeMethods.DefWindowProc(hWnd, (int)msg, new IntPtr(wParam), new IntPtr(lParam)).ToInt32());
            }
        }
Example #29
0
 void Extract_SJXX(UCHR[] buf, UINT i)
 {
     sjxx.year   = UCHRtoUINT(buf[((i + 10) & RE_BUFFER_SIZE)], buf[((i + 11) & RE_BUFFER_SIZE)]);
     sjxx.month  = buf[((i + 12) & RE_BUFFER_SIZE)];
     sjxx.day    = buf[((i + 13) & RE_BUFFER_SIZE)];
     sjxx.hour   = buf[((i + 14) & RE_BUFFER_SIZE)];
     sjxx.minute = buf[((i + 15) & RE_BUFFER_SIZE)];
     sjxx.second = buf[((i + 16) & RE_BUFFER_SIZE)];
     // print_sjxx();
     print_flag |= PRINT_SJXX;
     if ((status & ~(STATUS_BIT_ANSWER | STATUS_BIT_CONFIRM)) == STEP_SJSC)
     {
         status |= Convert.ToByte(STATUS_BIT_ANSWER | STATUS_BIT_CONFIRM);
     }
 }
Example #30
0
 void Extract_GNTX(UCHR[] buf, UINT i)
 {
     gntx.sqlx   = Convert.ToSByte(buf[((i + 10) & RE_BUFFER_SIZE)]);
     gntx.year   = Convert.ToUInt32(buf[((i + 11) & RE_BUFFER_SIZE)]) + 2000;
     gntx.month  = buf[((i + 12) & RE_BUFFER_SIZE)];
     gntx.day    = buf[((i + 13) & RE_BUFFER_SIZE)];
     gntx.hour   = buf[((i + 14) & RE_BUFFER_SIZE)];
     gntx.minute = buf[((i + 15) & RE_BUFFER_SIZE)];
     gntx.second = buf[((i + 16) & RE_BUFFER_SIZE)];
     // print_gntx();
     print_flag |= PRINT_GNTX;
     if ((status & ~(STATUS_BIT_ANSWER | STATUS_BIT_CONFIRM)) == STEP_GNTS)
     {
         status |= Convert.ToByte(STATUS_BIT_ANSWER | STATUS_BIT_CONFIRM);
     }
 }
Example #31
0
        public override ScalarValue Decode(System.IO.Stream in_Renamed)
        {
            int intValue = ((IntegerValue)UINT.Decode(in_Renamed)).value_Renamed;
            int hour     = intValue / 10000000;

            intValue -= hour * 10000000;
            int minute = intValue / 100000;

            intValue -= minute * 100000;
            int second = intValue / 1000;

            intValue -= second * 1000;
            int millisecond = intValue % 1000;
            var tempAux     = new DateTime(hour * 3600000 + minute * 60000 + second * 1000 + millisecond);

            return(new DateValue(ref tempAux));
        }
Example #32
0
        public override ScalarValue Decode(System.IO.Stream in_Renamed)
        {
            int length   = ((IntegerValue)UINT.Decode(in_Renamed)).value_Renamed;
            var encoding = new byte[length];

            for (int i = 0; i < length; i++)
            {
                try
                {
                    encoding[i] = (byte)in_Renamed.ReadByte();
                }
                catch (System.IO.IOException e)
                {
                    throw new RuntimeException(e);
                }
            }
            return(new ByteVectorValue(encoding));
        }
Example #33
0
 public static extern DWORD_PTR SHGetFileInfo(LPCTSTR pszPath, DWORD dwFileAttributes, ref SHFILEINFO psfi, UINT cbFileInfo, ShGetFileIconFlags uFlags);
Example #34
0
 public static extern UINT_PTR SetTimer(HWND hWnd, UINT_PTR nIDEvent, UINT uElapse, TIMERPROC lpTimerFunc);
Example #35
0
 internal static extern UINT GetRawInputDeviceList(
     [In, Out] IntPtr RawInputDeviceList,
     [In, Out] ref UINT NumDevices,
     UINT Size
 );
Example #36
0
 internal static extern BOOL RegisterRawInputDevices(
     RawInputDevice[] RawInputDevices,
     UINT NumDevices,
     UINT Size
 );
Example #37
0
 unsafe internal static extern LRESULT DefRawInputProc(IntPtr RawInput, INT Input, UINT SizeHeader);
Example #38
0
 internal static extern UINT GetRawInputData(
     HRAWINPUT RawInput,
     GetRawInputDataEnum Command,
     /*[MarshalAs(UnmanagedType.LPStruct)]*/ [Out] out RawInput Data,
     [In, Out] ref UINT Size,
     UINT SizeHeader
 );
Example #39
0
		public static extern BOOL TerminateProcess(HANDLE hProcess, UINT uExitCode);
Example #40
0
 public static extern bool mciGetErrorStringA( uint mcierr, [MarshalAs( UnmanagedType.LPStr )] string pszText, UINT cchText );
Example #41
0
 public static extern uint waveOutUnprepareHeader( IntPtr hwo, ref WAVEHDR pwh, UINT cbwh );
Example #42
0
 public static extern uint waveOutGetPosition( IntPtr hwo, ref MMTIME pmmt, UINT cbmmt );
Example #43
0
 internal static extern UINT MapVirtualKey(UINT uCode, MapVirtualKeyType uMapType);
Example #44
0
 internal static extern LRESULT DefRawInputProc(RawInput[] RawInput, INT Input, UINT SizeHeader);
Example #45
0
 internal static extern UINT GetRawInputData(
     HRAWINPUT RawInput,
     GetRawInputDataEnum Command,
     [Out] LPVOID Data,
     [In, Out] ref UINT Size,
     UINT SizeHeader
 );
Example #46
0
 internal static extern LRESULT CallWindowProc(
     WNDPROC lpPrevWndFunc,
     HWND hWnd,
     UINT Msg,
     WPARAM wParam,
     LPARAM lParam
 );