public ErrorCodeMessage(ERROR_CODES code, Dictionary <ERROR_LANGUAGE, string> Msg_LNG_TO_ERRORCODE)
 {
     if (Msg_LNG_TO_ERRORCODE.ContainsKey(ERROR_LANGUAGE.eng) == false)
     {
         throw new Exception("ErrorCodeItem-기본 언어:eng 값이 없음.");
     }
     dic_ErrorCode = Msg_LNG_TO_ERRORCODE;
 }
Exemple #2
0
 public ProviderEventArgs(ProviderAction action, ERROR_CODES error,
                          string response, WebServer listener, ref HttpListenerContext context)
 {
     Action    = action;
     ErrorCode = error;
     Response  = response;
     Socket    = listener;
     Context   = context;
 }
 public Result(ERROR_CODES code,
               T response,
               bool log = false,
               ERROR_LANGUAGE language = ERROR_LANGUAGE.kor)
 {
     Code     = (int)code;
     Message  = ErrorCode.Message(code, language);
     Log      = log;
     Response = response;
 }
 public ProviderEventArgs(ProviderAction action, ERROR_CODES error, T userid,
                          Dictionary <string, string> parameters, string response, WebServer listener, ref HttpListenerContext context)
 {
     Action     = action;
     ErrorCode  = error;
     Response   = response;
     Parameters = parameters;
     Socket     = listener;
     Context    = context;
     UserId     = userid;
 }
Exemple #5
0
        private String ErrorCodeToString(ERROR_CODES code)
        {
            switch (code)
            {
            case ERROR_CODES.SUCCESS:
                return("Success");

            case ERROR_CODES.NO_DEVICES_FOUND:
                return("No devices attached to system");

            case ERROR_CODES.FAILED_TO_OPEN:
                return("Open failed");

            case ERROR_CODES.FAILED_TO_READ_ALL_DATA:
                return("Failed to read all the data");

            case ERROR_CODES.DATA_INTEGRITY:
                return("Data read does not match data written!!!");

            default:
                return("General error");
            }
        }
        private void MultipayValider_Click(object sender, RoutedEventArgs e)
        {
            ERROR_CODES codes = refreshEntriesAndReturnError();

            switch (codes)
            {
            case ERROR_CODES.CB_ERROR:
                MessageBox.Show("Le montant CB est mal formaté !");
                break;

            case ERROR_CODES.CHEQUE_ERROR:
                MessageBox.Show("Le montant CHEQUE est mal formaté !");
                break;

            case ERROR_CODES.ESP_ERROR:
                MessageBox.Show("Le montant ESP est mal formaté !");
                break;

            case ERROR_CODES.NONE:
                this.Close();
                break;
            }
        }
 public static string Message(ERROR_CODES code, ERROR_LANGUAGE language = ERROR_LANGUAGE.eng)
 {
     return(ErrorCodes[code].Message(language));
 }
Exemple #8
0
        public PACKET_TYPES GetPacketType(byte[] packet, ref int payLoadLength, ref ERROR_CODES error, out PACKET_HEADER managedHeader)
        {
            managedHeader = new PACKET_HEADER();

            try
            {
                if (packet.Length < HeaderLessSOPLength)
                {
                    return(PACKET_TYPES.INVALID_PACKET);
                }

                PACKET_HEADER_LESS_SOP_STRUCT pktHdr = new PACKET_HEADER_LESS_SOP_STRUCT();

                int    size       = Marshal.SizeOf(typeof(PACKET_HEADER_LESS_SOP_STRUCT));
                byte[] headerPart = new byte[size];
                headerPart = (byte[])Slice(packet, 0, size);
                GCHandle handle = GCHandle.Alloc(headerPart, GCHandleType.Pinned);
                pktHdr = (PACKET_HEADER_LESS_SOP_STRUCT)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(PACKET_HEADER_LESS_SOP_STRUCT));
                handle.Free();

                payLoadLength = (int)pktHdr.PACKET_LEN;

                PACKET_TYPES pktTpye = (PACKET_TYPES)pktHdr.PACKET_TYPE;

                error = ERROR_CODES.NO_ERROR;

                if (!CheckAllPacketTypes(pktTpye))
                {
                    error = ERROR_CODES.BAD_PACKET;
                    return(PACKET_TYPES.INVALID_PACKET);
                }

                switch ((PACKET_TYPES)pktTpye)
                {
                case PACKET_TYPES.REQUEST_HOST_NAME:
                    m_Log.Log("GetPacketType, received REQUEST_HOST_NAME ", ErrorLog.LOG_TYPE.INFORMATIONAL);

                    if (!DoesGetHostPWMatch(pktHdr.PasswordHash))
                    {
                        m_Log.Log("GetPacketType, ERROR_CODES.INVALID_PASSWORD", ErrorLog.LOG_TYPE.INFORMATIONAL);

                        error = ERROR_CODES.INVALID_PASSWORD;
                    }

                    break;



                default:

                    managedHeader.Type           = (PACKET_TYPES)pktHdr.PACKET_TYPE;
                    managedHeader.PasswordHash   = pktHdr.PasswordHash;
                    managedHeader.SequenceNumber = (int)pktHdr.SEQUENCE_NUMBER;
                    managedHeader.Length         = (int)pktHdr.PACKET_LEN;
                    break;
                }



                return((PACKET_TYPES)pktHdr.PACKET_TYPE);
            }
            catch (Exception ex)
            {
                m_Log.Log("GetPacketTypeex: " + ex.Message, ErrorLog.LOG_TYPE.INFORMATIONAL);
                return((PACKET_TYPES)PACKET_TYPES.INVALID_PACKET);
            }
        }