示例#1
0
文件: DDDParser.cs 项目: ruslan81/FIS
        /// <summary>
        /// Разбирает обьект, вызывается методами ParseFile
        /// </summary>
        /// <returns>результат действия</returns>
        private string ParseIt()
        {
            try
            {
                switch (srcType)
                {
                case 0:     // SRC_TYPE_CARD
                {
                    C_DriversParser c_driversParser = new C_DriversParser();
                    cardUnitClass          = c_driversParser.CardUnitData_Parse(bytes);
                    cardUnitClass.cardType = srcType;
                }
                break;

                case 1:    // SRC_TYPE_VU
                {
                    M_VehicleUnitParser m_vehicleUnitParser = new M_VehicleUnitParser();
                    vehicleUnitClass          = m_vehicleUnitParser.VehicleUnitData_Parse(bytes);
                    vehicleUnitClass.cardType = srcType;
                }
                break;

                case 2:    // SRC_TYPE_PLF
                {
                    plfUnitClass          = PLF_Parser.PLFUnitData_Parse(bytes);
                    plfUnitClass.cardType = srcType;
                } break;

                case 3:    //wrong SRC
                {
                    return("Error! Wrong file Format!\r\n");
                }

                default:    //default
                {
                    return("Error! Wrong file Format!-default\r\n");
                }
                }

                return("successfully!\r\n\r\n");
            }
            catch (Exception ex)
            {
                throw ex;
                return("unsuccessfully \r\n\r\n" + ex);
            }
        }
示例#2
0
        /// <summary>
        /// Разбирает обьект, вызывается методами ParseFile
        /// </summary>
        /// <returns>результат действия</returns>
        private string ParseIt()
        {
            try
            {
                switch (srcType)
                {
                    case 0: // SRC_TYPE_CARD
                        {
                            C_DriversParser c_driversParser = new C_DriversParser();
                            cardUnitClass = c_driversParser.CardUnitData_Parse(bytes);
                            cardUnitClass.cardType = srcType;
                        }
                        break;
                    case 1:// SRC_TYPE_VU
                        {
                            M_VehicleUnitParser m_vehicleUnitParser = new M_VehicleUnitParser();
                            vehicleUnitClass = m_vehicleUnitParser.VehicleUnitData_Parse(bytes);
                            vehicleUnitClass.cardType = srcType;
                        }
                        break;
                    case 2:// SRC_TYPE_PLF
                        {
                            plfUnitClass = PLF_Parser.PLFUnitData_Parse(bytes);
                            plfUnitClass.cardType = srcType;
                        } break;
                    case 3://wrong SRC
                        {
                            return "Error! Wrong file Format!\r\n";
                        }
                    default://default
                        {
                            return "Error! Wrong file Format!-default\r\n";
                        }
                }

                return "successfully!\r\n\r\n";
            }
            catch (Exception ex)
            {
                throw ex;
                return "unsuccessfully \r\n\r\n" + ex;
            }
        }