using System;
using System.Linq;
using System.Collections.ObjectModel;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using InModbus;

namespace ITC81DB_2
{
    #region CommunicationCommand
    public class CommunicationCommand
    {
        // 불량알람
        public static readonly string AlarmNg = "Caa00";
        // 불량알람 해지
        public static readonly string AlarmNgClear = "CAA00";
        // 불량알람(펄스)
        public static readonly string AlarmPulse = "Cac00";
        // 부저ON(부저ON시간과 연동)
        public static readonly string BuzzerOn = "Cad00";
        // 부저ON(연속)
        public static readonly string BuzzerOnContinuousEnable = "Cae00";
        // 외부출력ON(연속)
        public static readonly string ExternalOutputContinuousEnable = "Cai00";
        // 부저해지
        public static readonly string BuzzerOnContinuousDisable = "CAE00";

        // 업다운 - 다운
        public static readonly string MotorDown = "Cmd00";
        // 업다운 - 업
        public static readonly string MotorUp = "Cmu00";

        // 중량조정모드
        public static readonly string ModeCalibration = "Csc00";
        // 노멀모드
        public static readonly string ModeNormal = "Csn00";
        // 메뉴 모드
        public static readonly string ModeMenu = "Csm00";
        // 판정설정모드
        public static readonly string ModeJudgment = "Csg00";
        // IO 테스트모드
        public static readonly string ModeIOTest = "Cst00";
        // 바이패스
        public static readonly string ModeBypass = "Csb00";
        // 장비 테스트모드
        public static readonly string ModeEquipmentTest = "Csy00";
        // 선별기 테스트모드
        public static readonly string ModeRejectorTest = "Csr00";

        // 중량조정 - 분동
        public static readonly string CalibrationBalance = "Ccb00";
        // 중량조정 - 시작
        public static readonly string CalibrationStart = "Ccs00";
        // 중량조정 - 취소
        public static readonly string CalibrationCancel = "Ccx00";
        // 중량보정 - 한자리올림
        public static readonly string CalibrationUp = "Ccu00";
        // 중량보정 - 한자리내림
        public static readonly string CalibrationDown = "Ccd00";

        // 파라미터 쓰기
        public static readonly string Write = "Pw000";
        // 파라미터 읽기
        public static readonly string Read = "Pr000";
        // Bypass To Motor
        public static readonly string BypassToMotor = "Pb000";
        // IO테스트 - OUT
        public static readonly string IOTest = "Pt000";

        // 임펠러 모터 - 정회전
        public static readonly string ImpellerMotorForward = "Cmc00";
        // 임펠러 모터 - 역회전
        public static readonly string ImpellerMotorReverse = "Cmr00";
        // 모터 - 원점초기화
        public static readonly string MotorOrigin = "Cmo00";
        // 모터 - Step
        public static readonly string MotorStep = "Cms00";

        // Cut 신호
        public static readonly string CutInpupt = "Cbc00";
        // 공장초기화
        public static readonly string Initialization = "Cbi00";
        // 운전
        public static readonly string Start = "Cbs00";
        // 정지
        public static readonly string Stop = "Cbt00";
        // 영점
        public static readonly string Zero = "Cbz00";

        // ACK
        public static readonly string ACK = "ACK";
        // NAK
        public static readonly string NAK = "NAK";
        // 운전중 중량
        public static readonly string RunWeightData = "Sr";

        // 알람 해지 - 통신에러
        public static readonly string AlarmClearCommunicationError = "Cra00";

        // 판정 - bypass 1회
        public static readonly string BypassOnce = "Cjb00";
        // 판정 - byNG 1회
        public static readonly string ByNGOnce = "Cjc00";
        // 판정 - bypass 연속 OFF
        public static readonly string BypassOFF = "Cjd00";
        // 판정 - bypass 연속 ON
        public static readonly string BypassON = "Cjd01";
        // 판정 - byNG 연속 OFF
        public static readonly string ByNGOFF = "Cje00";
        // 판정 - byNG 연속 ON
        public static readonly string ByNGON = "Cje01";
    }
    public class CommunicationID
    {
        public static readonly string MainBoard = "0";
        public static readonly string SubBoard1 = "A";
        public static readonly string SubBoard2 = "B";
        public static readonly string SubBoard3 = "C";
        public static readonly string SubBoard4 = "D";
        public static readonly string SubBoard5 = "E";
        public static readonly string SubBoard6 = "F";
        public static readonly string SubBoard7 = "G";
        public static readonly string SubBoard8 = "H";
        public static readonly string SubBoard9 = "I";
        public static readonly string SubBoard10 = "J";
        public static readonly string SubBoard11 = "K";
        public static readonly string SubBoard12 = "L";
        public static readonly string SubBoardAll = "Z";
    }
    public class CommunicationAddress
    {
        // Address None
        public static readonly string None = "0000";

        // 장비타입
        public static readonly string _1002_EquipmentType = "1002";

        // 정지계량 사용 여부
        public static readonly string _1401_IsStopWeighing = "1401";
        // OPT(옵션보드) 사용
        public static readonly string _1402_OptionBoard = "1402";
        // 외부운전 사용 여부
        public static readonly string _1403_IsExternalOperation = "1403";
        // 초기구동 사용 여부
        public static readonly string _1404_IsInitialDrive = "1404";
        // 공기압감지 사용 여부
        public static readonly string _1405_IsPressureSensing = "1405";
        // 적체센서 사용 여부
        public static readonly string _1406_IsStackSensing = "1406";
        // 선별부 동작감지 사용 여부
        public static readonly string _1407_IsSorterDetecting = "1407";
        // 메인보드1 버전 읽기
        public static readonly string _1501_ProgramVersion = "1501";

        // 품목설정 - 품번
        public static readonly string _2001_ProductNumber = "2001";
        // 품목설정 - 하한 설정값
        public static readonly string _2002_UnderRange = "2002";
        // 품목설정 - 기준 설정값
        public static readonly string _2003_PassRange = "2003";
        // 품목설정 - 상한 설정값
        public static readonly string _2004_OverRange = "2004";
        // 품목설정 - 용기 설정값
        public static readonly string _2005_TareRange = "2005";
        // 품목설정 - 하한 설정값
        public static readonly string _2006_UnderRange = "2006";
        // 품목설정 - 기준 설정값
        public static readonly string _2007_PassRange = "2007";
        // 품목설정 - 상한 설정값
        public static readonly string _2008_OverRange = "2008";
        // 품목설정 - 용기 설정값
        public static readonly string _2009_TareRange = "2009";

        // 중량조정 - 최대중량 설정값
        public static readonly string _3001_MaxWeight = "3001";
        // 중량조정 - 분동중량 설정값
        public static readonly string _3002_BalanceWeight = "3002";
        // 중량조정 - 한눈의 값
        public static readonly string _3003_Digit = "3003";
        // 중량조정 - 상수값 읽기
        public static readonly string _3601_ConstantRead = "3601";
        // 중량조정 - 파라미터 읽기
        public static readonly string _3901_ParameterRead = "3901";

        // 자동영점 - #1 모드1 시간
        public static readonly string _4001_Zero1Time = "4001";
        // 자동영점 - #1 모드1 범위
        public static readonly string _4002_Zero1Range = "4002";
        // 자동영점 - #1 모드1 변량
        public static readonly string _4003_Zero1Variate = "4003";
        // 자동영점 - #1 모드1 모드
        public static readonly string _4004_Zero1Mode = "4004";
        // 자동영점 - #1 모드2 모드
        public static readonly string _4005_Zero2Mode = "4005";
        // 자동영점 - #1 모드2 시간
        public static readonly string _4006_Zero2Time = "4006";
        // 자동영점 - #1 모드2 범위
        public static readonly string _4007_Zero2Range = "4007";
        // 자동영점 - #1 모드2 변량
        public static readonly string _4008_Zero2Variate = "4008";
        // 자동영점 - #2 모드1 시간
        public static readonly string _4021_Zero1Time = "4021";
        // 자동영점 - #2 모드1 범위
        public static readonly string _4022_Zero1Range = "4022";
        // 자동영점 - #2 모드1 변량
        public static readonly string _4023_Zero1Variate = "4023";
        // 자동영점 - #2 모드1 모드
        public static readonly string _4024_Zero1Mode = "4024";
        // 자동영점 - #2 모드2 모드
        public static readonly string _4025_Zero2Mode = "4025";
        // 자동영점 - #2 모드2 시간
        public static readonly string _4026_Zero2Time = "4026";
        // 자동영점 - #2 모드2 범위
        public static readonly string _4027_Zero2Range = "4027";
        // 자동영점 - #2 모드2 변량
        public static readonly string _4028_Zero2Variate = "4028";

        // 자동영점 - 파라미터 읽기1
        public static readonly string _4901_ParameterRead1 = "4901";
        // 자동영점 - 파라미터 읽기2
        public static readonly string _4902_ParameterRead2 = "4902";
        // 자동영점 - 파라미터 읽기3
        public static readonly string _4903_ParameterRead3 = "4903";
        // 자동영점 - 파라미터 읽기4
        public static readonly string _4904_ParameterRead4 = "4904";
        // 자동영점 - 파라미터 읽기5
        public static readonly string _4905_ParameterRead5 = "4905";
        // 자동영점 - 파라미터 읽기6
        public static readonly string _4906_ParameterRead6 = "4906";

        // 판정설정 - #1 필터
        public static readonly string _5001_Filter = "5001";
        // 판정설정 - #1 판정지연
        public static readonly string _5002_JudgmentDelayTime = "5002";
        // 판정설정 - #1 이중지연
        public static readonly string _5003_DoubleDelayTime = "5003";
        // 판정설정 - #1 판정개수
        public static readonly string _5004_JudgmentCount = "5004";
        // 판정설정 - #1 이송속도
        public static readonly string _5005_FeedSpeed = "5005";
        // 판정설정 - #1 동보정
        public static readonly string _5006_DynamicCorrection = "5006";
        // 판정설정 - #1 Feeding 컨베어 지연시간
        public static readonly string _5007_FeedingConveyorDelayTime = "5007";
        // 판정설정 - #1 Feeding 컨베어 동작시간
        public static readonly string _5008_FeedingConveyorRunTime = "5008";
        // 판정설정 - #1 배출 컨베어 지연시간
        public static readonly string _5009_DischargeConveyorDelayTime = "5009";
        // 판정설정 - #1 배출 컨베어 동작시간
        public static readonly string _5010_DischargeConveyorRunTime = "5010";
        // 판정설정 - #1 상승 지연시간
        public static readonly string _5011_UpDelayTime1 = "5011";
        // 판정설정 - #1 하강 지연시간
        public static readonly string _5012_DownDelayTime1 = "5012";
        // 판정설정 - #2 필터
        public static readonly string _5021_Filter = "5021";
        // 판정설정 - #2 판정지연
        public static readonly string _5022_JudgmentDelayTime = "5022";
        // 판정설정 - #2 이중지연
        public static readonly string _5023_DoubleDelayTime = "5023";
        // 판정설정 - #2 판정개수
        public static readonly string _5024_JudgmentCount = "5024";
        // 판정설정 - #2 이송속도
        public static readonly string _5025_FeedSpeed = "5025";
        // 판정설정 - #2 동보정
        public static readonly string _5026_DynamicCorrection = "5026";
        // 판정설정 - #2 상승 지연시간
        public static readonly string _5028_UpDelayTime2 = "5028";
        // 판정설정 - #2 하강 지연시간
        public static readonly string _5029_DownDelayTime2 = "5029";
        // 판정설정 - 선별기 테스트
        public static readonly string _5100_SorterTest = "5100";
        // 판정설정 - 선별기1 모드
        public static readonly string _5101_Sorter1Mode = "5101";
        // 판정설정 - 선별기1 지연시간
        public static readonly string _5102_Sorter1DelayTime = "5102";
        // 판정설정 - 선별기1 동작시간
        public static readonly string _5103_Sorter1RunTime = "5103";
        // 판정설정 - 선별기2 모드
        public static readonly string _5104_Sorter2Mode = "5104";
        // 판정설정 - 선별기2 지연시간
        public static readonly string _5105_Sorter2DelayTime = "5105";
        // 판정설정 - 선별기2 동작시간
        public static readonly string _5106_Sorter2RunTime = "5106";
        // 판정설정 - 외부출력1 모드
        public static readonly string _5201_ExternalOut1Mode = "5201";
        // 판정설정 - 외부출력1 지연시간
        public static readonly string _5202_ExternalOut1DelayTime = "5202";
        // 판정설정 - 외부출력1 동작시간
        public static readonly string _5203_ExternalOut1RunTime = "5203";
        // 판정설정 - 외부출력2 모드
        public static readonly string _5204_ExternalOut2Mode = "5204";
        // 판정설정 - 외부출력2 지연시간
        public static readonly string _5205_ExternalOut2DelayTime = "5205";
        // 판정설정 - 외부출력2 동작시간
        public static readonly string _5206_ExternalOut2RunTime = "5206";
        // 판정설정 - 외부출력3 모드
        public static readonly string _5207_ExternalOut3Mode = "5207";
        // 판정설정 - 외부출력3 지연시간
        public static readonly string _5208_ExternalOut3DelayTime = "5208";
        // 판정설정 - 외부출력3 동작시간
        public static readonly string _5209_ExternalOut3RunTime = "5209";
        // 판정설정 - 외부출력4 모드
        public static readonly string _5210_ExternalOut4Mode = "5210";
        // 판정설정 - 외부출력4 지연시간
        public static readonly string _5211_ExternalOut4DelayTime = "5211";
        // 판정설정 - 외부출력4 동작시간
        public static readonly string _5212_ExternalOut4RunTime = "5212";
        // 판정설정 - 외부출력9 모드
        public static readonly string _5225_ExternalOut9Mode = "5225";
        // 판정설정 - 외부출력9 지연시간
        public static readonly string _5226_ExternalOut9DelayTime = "5226";
        // 판정설정 - 외부출력9 동작시간
        public static readonly string _5227_ExternalOut9RunTime = "5227";
        // 판정설정 - 외부출력10 모드
        public static readonly string _5228_ExternalOut10Mode = "5228";
        // 판정설정 - 외부출력10 지연시간
        public static readonly string _5229_ExternalOut10DelayTime = "5229";
        // 판정설정 - 외부출력10 동작시간
        public static readonly string _5230_ExternalOut10RunTime = "5230";
        // 판정설정 - 파라미터 읽기
        public static readonly string _5901_ParameterRead = "5901";
        // 판정설정 - 스타휠 회전주기
        public static readonly string _5301_WheelCycleTime = "5301";
        // 판정설정 - 스타휠 슬롯개수
        public static readonly string _5302_WheelSlotCount = "5302";
        // 판정설정 - 스타휠 슬롯배출지연개수
        public static readonly string _5303_WheelSlotOutCount = "5303";
        // 판정설정 - 진입센서 지연시간
        public static readonly string _5304_EntrySensorDelayTime = "5304";
        // 판정설정 - 사용자정의1(선별기1모드,지연,동작,선별기2모드,지연,동작)
        public static readonly string _5901_UserDefined1 = "5901";

        // 옵션 - 부저 ON시간
        public static readonly string _6001_BuzzerOnTime = "6001";
        // 옵션 - 릴레이 동작시간
        public static readonly string _6002_RelayRunTime = "6002";
        // 옵션 - 이중진입사용여부
        public static readonly string _6005_DoubleEnter = "6005";
        // 옵션 - 채터링감지 설정
        public static readonly string _6006_SensorChattering = "6006";
        // 옵션 - 외부 NG 입력 사용
        public static readonly string _6007_ExternalInput = "6007";
        // 옵션 - 제품진입 미감지
        public static readonly string _6010_EntryNotDetectedWeight = "6010";
        // 옵션 - 센서에러 감지시간
        public static readonly string _6011_SensorErrorDetectingTime = "6011";
        // 옵션 - 스위치채터링 설정
        public static readonly string _6012_SwitchChattering = "6012";
        // 옵션 - OPT1_샘플링개수
        public static readonly string _6201_OPT1SamplingCount = "6201";
        // 옵션 - OPT1_지연개수
        public static readonly string _6202_OPT1DelayCount = "6202";
        // 옵션 - OPT1_펄스폭
        public static readonly string _6203_OPT1PulseWidth = "6203";
        // 옵션 - OPT1_범위설정사용여부
        public static readonly string _6204_OPT1RangeSetting = "6204";
        // 옵션 - OPT1_1열_상한범위
        public static readonly string _6205_OPT1OverRange1 = "6205";
        // 옵션 - OPT1_1열_하한범위
        public static readonly string _6206_OPT1UnderRange1 = "6206";
        // 옵션 - OPT1_포트
        public static readonly string _6207_OPT1Port = "6207";
        // 옵션 - OPT1_2열_상한범위
        public static readonly string _6216_OPT1OverRange2 = "6216";
        // 옵션 - OPT1_2열_하한범위
        public static readonly string _6217_OPT1UnderRange2 = "6217";
        // 옵션 - OPT2_포트
        public static readonly string _6231_OPT2Port = "6231";
        // 옵션 - OPT2_지연시간1
        public static readonly string _6232_OPT2DelayTime1 = "6232";
        // 옵션 - OPT2_지연시간2
        public static readonly string _6233_OPT2DelayTime2 = "6233";
        // 옵션 - 파라미터 읽기
        public static readonly string _6901_ParameterRead = "6901";

        // RS232 통신1 속도
        public static readonly string _7001_Serial1_BaudRate = "7001";
        // RS232 통신1 모드
        public static readonly string _7002_Serial1_Mode = "7002";
        // RS232 통신 1 속도, 모드
        public static readonly string _7003_Serial1 = "7003";

        // 통신,IO설정 - INPUT ALL
        public static readonly string _7500_InputAll = "7500";
        // 통신,IO설정 = OUTPUT1
        public static readonly string _7701_Output1 = "7701";
        // 통신,IO설정 = OUTPUT2
        public static readonly string _7702_Output2 = "7702";
        // 통신,IO설정 = OUTPUT3
        public static readonly string _7703_Output3 = "7703";
        // 통신,IO설정 = OUTPUT4
        public static readonly string _7704_Output4 = "7704";
        // 통신,IO설정 = OUTPUT5
        public static readonly string _7705_Output5 = "7705";
        // 통신,IO설정 = OUTPUT6
        public static readonly string _7706_Output6 = "7706";
        // 통신,IO설정 = OUTPUT7
        public static readonly string _7707_Output7 = "7707";
        // 통신,IO설정 = OUTPUT8
        public static readonly string _7708_Output8 = "7708";
        // 통신,IO설정 = OUTPUT9
        public static readonly string _7709_Output9 = "7709";
        // 통신,IO설정 = OUTPUT10
        public static readonly string _7710_Output10 = "7710";
        // 통신,IO설정 = OUTPUT11
        public static readonly string _7711_Output11 = "7711";
        // 통신,IO설정 = OUTPUT12
        public static readonly string _7712_Output12 = "7712";
        // 통신,IO설정 = OUTPUT13
        public static readonly string _7713_Output13 = "7713";
        // 통신,IO설정 = OUTPUT14
        public static readonly string _7714_Output14 = "7714";
        // 통신,IO설정 = OUTPUT15
        public static readonly string _7715_Output15 = "7715";
        // 통신,IO설정 = OUTPUT16
        public static readonly string _7716_Output16 = "7716";

        // 중량설정값 쓰기 #1
        public static readonly string _9003_ParameterWeightSetting = "9003";
        // 중량설정값 쓰기 #2
        public static readonly string _9012_ParameterWeightSetting = "9012";
        // 전체파라미터 쓰기 #1
        public static readonly string _9045_SystemParameterWrite = "9045";
        // 전체파라미터 쓰기 #2
        public static readonly string _9046_SystemParameterWrite = "9046";
        // 중량설정값 쓰기 A : 1열, B : 2열
        public static readonly string _9024_ParameterWeightSetting = "9024";
        // 시스템파라미터 읽기 - 9507
        public static readonly string _9507_SystemParameterRead = "9507";
        // 시스템파라미터 읽기 - 9508
        public static readonly string _9508_SystemParameterRead = "9508";
        // 시스템파라미터 읽기 - 9509
        public static readonly string _9509_SystemParameterRead = "9509";
        // 시스템파라미터 읽기 - 9510
        public static readonly string _9510_SystemParameterRead = "9510";
        // 시스템파라미터 읽기 - 9511
        public static readonly string _9511_SystemParameterRead = "9511";
    }
    #endregion

    #region CommunicationServo
    public class ServoMotorParameterAddress
    {
        // Alarm Reset - 0x0049
        public static readonly int AlarmReset = 73;

        // CCW TRQ LMT - 0x00C8
        public static readonly int CCWTorqueLimit = 200;
        // CW TRQ LMT - 0x00C9
        public static readonly int CWTorqueLimit = 201;

        // Grop Speed 0 - 0x0131
        public static readonly int GropSpeed0 = 305;

        // Position CMD 0 - 0x01F4
        public static readonly int PositionCMD0 = 500;
        // Position CMD 1 - 0x01F5
        public static readonly int PositionCMD1 = 501;
        // Position CMD 2 - 0x01F6
        public static readonly int PositionCMD2 = 502;
        // Position CMD 3 - 0x01F7
        public static readonly int PositionCMD3 = 503;

        // ORG Speed 0 - 0x0258
        public static readonly int ORGSpeed0 = 600;
        // ORG Speed 1 - 0x0259
        public static readonly int ORGSpeed1 = 601;
        // Origin Offset - 0x025B
        public static readonly int OriginOffset = 603;
        // Jog Speed 0 - 0x025D
        public static readonly int JogSpeed0 = 605;

        // Angle Division - 0x02C2
        public static readonly int AngleDivision = 706;
    } 
    #endregion

    #region SystemConfigurationItem
    public class SystemConfigurationItem
    {
        #region Field
        // SystemConfig
        private bool m_IsDataBackup;
        private bool m_IsLogin;
        
        private int m_EquipmentID;
        private int m_DecimalPlaces;
        private int m_ProductNumber;
        private int m_UsbID;
        private int m_SerialCOM1BaudRate;
        private int m_SerialCOM1Mode;
        private int m_SerialCOM3BaudRate;
        private int m_SerialCOM3Mode;
        private int m_SerialCOM4BaudRate;
        private int m_SerialCOM4Mode;
        private int m_EquipmentType;
        private int m_SensorErrorDetectingTime;
        private int m_EntryNotDetectedIgnoreTime;
        private int m_SelectLaneCOM1;
        private int m_SelectLaneCOM3;
        private int m_SelectLaneCOM4;
        private int m_SelectLaneEthernet;
        
        private string m_SerialNumber;
        private string m_MainBoardVersion;
        private string m_Unit;

        private bool m_IsBypassDirectionPass1;
        private bool m_IsBypassOnce1;
        private bool m_IsBypassDirectionPass2;
        private bool m_IsBypassOnce2;

        private Define.E_LanguageID m_Language;

        private bool m_IsModbus;
        private bool m_IsPart11;
        private bool m_IsEthernetPingTimer;
        private bool m_IsCharToFillZeroEthernet;
        private bool m_IsTransmitWhenPassEthernet;
        private bool m_IsCharToFillZeroCOM1;
        private bool m_IsTransmitWhenPassCOM1;
        private bool m_IsCharToFillZeroCOM3;
        private bool m_IsTransmitWhenPassCOM3;
        private bool m_IsCharToFillZeroCOM4;
        private bool m_IsTransmitWhenPassCOM4;
        private bool m_IsModbusRTUUsingConverterCOM1;
        private bool m_IsModbusRTUUsingConverterCOM3;
        private bool m_IsModbusRTUUsingConverterCOM4;
        private bool m_IsPrintPerProductEnable;

        private int m_TransmissionDelayTimeCOM1;
        private int m_TransmissionDelayTimeCOM3;
        private int m_TransmissionDelayTimeCOM4;
        private int m_TransmissionDelayTimeEthernet;
        private int m_ModbusRTUSelectFunction;
        private int m_ModbusRTUSlaveIDCOM1;
        private int m_ModbusRTUSlaveIDCOM3;
        private int m_ModbusRTUSlaveIDCOM4;
        private int m_ModbusTCPSelectFunction;
        private int m_EthernetLocalPort;
        private int m_EthernetHostPort;
        private int m_EthernetCommMode;
        private int m_EthernetOperationMode;
        private int m_StoragePeriod;
        private int m_NumberOfLoginFailures;
        private int m_ModbusTCPStartAddress;
        private int m_ModbusRTUStartAddressCOM1;
        private int m_ModbusRTUStartAddressCOM3;
        private int m_ModbusRTUStartAddressCOM4;
        private int m_CommunicationControlCharacter;

        private string m_UserGroupLevel1Name;
        private string m_UserGroupLevel2Name;
        private string m_UserGroupLevel3Name;
        private string m_EthernetAddress;
        #endregion

        #region Constructor
        public SystemConfigurationItem()
        {
            this.Initialization();
        }
        #endregion

        #region Property
        // SystemConfig
        public bool IsDataBackup
        {
            get { return this.m_IsDataBackup; }
            set { this.m_IsDataBackup = value; }
        }
        public bool IsLogin
        {
            get { return this.m_IsLogin; }
            set { this.m_IsLogin = value; }
        }
        public bool IsPrintPerProductEnable
        {
            get { return this.m_IsPrintPerProductEnable; }
            set { this.m_IsPrintPerProductEnable = value; }
        }

        public int EquipmentID
        {
            get { return this.m_EquipmentID; }
            set { this.m_EquipmentID = value; }
        } 
        public int DecimalPlaces
        {
            get { return this.m_DecimalPlaces; }
            set { this.m_DecimalPlaces = value; }
        }
        public int ProductNumber
        {
            get { return this.m_ProductNumber; }
            set { this.m_ProductNumber = value; }
        }
        public int UsbID
        {
            get { return this.m_UsbID; }
            set { this.m_UsbID = value; }
        }
        public int SerialCOM1BaudRate
        {
            get { return this.m_SerialCOM1BaudRate; }
            set { this.m_SerialCOM1BaudRate = value; }
        }
        public int SerialCOM1Mode
        {
            get { return this.m_SerialCOM1Mode; }
            set { this.m_SerialCOM1Mode = value; }
        }
        public int SerialCOM3BaudRate
        {
            get { return this.m_SerialCOM3BaudRate; }
            set { this.m_SerialCOM3BaudRate = value; }
        }
        public int SerialCOM3Mode
        {
            get { return this.m_SerialCOM3Mode; }
            set { this.m_SerialCOM3Mode = value; }
        }
        public int SerialCOM4BaudRate
        {
            get { return this.m_SerialCOM4BaudRate; }
            set { this.m_SerialCOM4BaudRate = value; }
        }
        public int SerialCOM4Mode
        {
            get { return this.m_SerialCOM4Mode; }
            set { this.m_SerialCOM4Mode = value; }
        }
        public int EquipmentType
        {
            get { return this.m_EquipmentType; }
            set { this.m_EquipmentType = value; }
        }
        public int SensorErrorDetectingTime
        {
            get { return this.m_SensorErrorDetectingTime; }
            set { this.m_SensorErrorDetectingTime = value; }
        }
        public int EntryNotDetectedIgnoreTime
        {
            get { return this.m_EntryNotDetectedIgnoreTime; }
            set { this.m_EntryNotDetectedIgnoreTime = value; }
        }
        public int SelectLaneCOM1
        {
            get { return this.m_SelectLaneCOM1; }
            set { this.m_SelectLaneCOM1 = value; }
        }
        public int SelectLaneCOM3
        {
            get { return this.m_SelectLaneCOM3; }
            set { this.m_SelectLaneCOM3 = value; }
        }
        public int SelectLaneCOM4
        {
            get { return this.m_SelectLaneCOM4; }
            set { this.m_SelectLaneCOM4 = value; }
        }
        public int SelectLaneEthernet
        {
            get { return this.m_SelectLaneEthernet; }
            set { this.m_SelectLaneEthernet = value; }
        }

        public string SerialNumber
        {
            get { return this.m_SerialNumber; }
            set { this.m_SerialNumber = value; }
        }
        public string MainBoardVersion
        {
            get { return this.m_MainBoardVersion; }
            set { this.m_MainBoardVersion = value; }
        }
        public string Unit
        {
            get { return this.m_Unit; }
            set { this.m_Unit = value; }
        }

        public bool IsBypassDirectionPass1
        {
            get { return this.m_IsBypassDirectionPass1; }
            set { this.m_IsBypassDirectionPass1 = value; }
        }
        public bool IsBypassOnce1
        {
            get { return this.m_IsBypassOnce1; }
            set { this.m_IsBypassOnce1 = value; }
        }
        public bool IsBypassDirectionPass2
        {
            get { return this.m_IsBypassDirectionPass2; }
            set { this.m_IsBypassDirectionPass2 = value; }
        }
        public bool IsBypassOnce2
        {
            get { return this.m_IsBypassOnce2; }
            set { this.m_IsBypassOnce2 = value; }
        }

        public Define.E_LanguageID Language
        {
            get { return this.m_Language; }
            set { this.m_Language = value; }
        }


        // SystemConfig
        public bool IsModbus
        {
            get { return this.m_IsModbus; }
            set { this.m_IsModbus = value; }
        }
        public bool IsPart11
        {
            get { return this.m_IsPart11; }
            set { this.m_IsPart11 = value; }
        }
        public bool IsEthernetPingTimer
        {
            get { return this.m_IsEthernetPingTimer; }
            set { this.m_IsEthernetPingTimer = value; }
        }
        public bool IsCharToFillZeroEthernet
        {
            get { return this.m_IsCharToFillZeroEthernet; }
            set { this.m_IsCharToFillZeroEthernet = value; }
        }
        public bool IsTransmitWhenPassEthernet
        {
            get { return this.m_IsTransmitWhenPassEthernet; }
            set { this.m_IsTransmitWhenPassEthernet = value; }
        }
        public bool IsCharToFillZeroCOM1
        {
            get { return this.m_IsCharToFillZeroCOM1; }
            set { this.m_IsCharToFillZeroCOM1 = value; }
        }
        public bool IsTransmitWhenPassCOM1
        {
            get { return this.m_IsTransmitWhenPassCOM1; }
            set { this.m_IsTransmitWhenPassCOM1 = value; }
        }
        public bool IsCharToFillZeroCOM3
        {
            get { return this.m_IsCharToFillZeroCOM3; }
            set { this.m_IsCharToFillZeroCOM3 = value; }
        }
        public bool IsTransmitWhenPassCOM3
        {
            get { return this.m_IsTransmitWhenPassCOM3; }
            set { this.m_IsTransmitWhenPassCOM3 = value; }
        }
        public bool IsCharToFillZeroCOM4
        {
            get { return this.m_IsCharToFillZeroCOM4; }
            set { this.m_IsCharToFillZeroCOM4 = value; }
        }
        public bool IsTransmitWhenPassCOM4
        {
            get { return this.m_IsTransmitWhenPassCOM4; }
            set { this.m_IsTransmitWhenPassCOM4 = value; }
        }
        public bool IsModbusRTUUsingConverterCOM1
        {
            get { return this.m_IsModbusRTUUsingConverterCOM1; }
            set { this.m_IsModbusRTUUsingConverterCOM1 = value; }
        }
        public bool IsModbusRTUUsingConverterCOM3
        {
            get { return this.m_IsModbusRTUUsingConverterCOM3; }
            set { this.m_IsModbusRTUUsingConverterCOM3 = value; }
        }
        public bool IsModbusRTUUsingConverterCOM4
        {
            get { return this.m_IsModbusRTUUsingConverterCOM4; }
            set { this.m_IsModbusRTUUsingConverterCOM4 = value; }
        }

        public int TransmissionDelayTimeCOM1
        {
            get { return this.m_TransmissionDelayTimeCOM1; }
            set { this.m_TransmissionDelayTimeCOM1 = value; }
        }
        public int TransmissionDelayTimeCOM3
        {
            get { return this.m_TransmissionDelayTimeCOM3; }
            set { this.m_TransmissionDelayTimeCOM3 = value; }
        }
        public int TransmissionDelayTimeCOM4
        {
            get { return this.m_TransmissionDelayTimeCOM4; }
            set { this.m_TransmissionDelayTimeCOM4 = value; }
        }
        public int TransmissionDelayTimeEthernet
        {
            get { return this.m_TransmissionDelayTimeEthernet; }
            set { this.m_TransmissionDelayTimeEthernet = value; }
        }
        public int ModbusRTUSelectFunction
        {
            get { return this.m_ModbusRTUSelectFunction; }
            set { this.m_ModbusRTUSelectFunction = value; }
        }
        public int ModbusRTUSlaveIDCOM1
        {
            get { return this.m_ModbusRTUStartAddressCOM1; }
            set { this.m_ModbusRTUStartAddressCOM1 = value; }
        }
        public int ModbusRTUSlaveIDCOM3
        {
            get { return this.m_ModbusRTUStartAddressCOM3; }
            set { this.m_ModbusRTUStartAddressCOM3 = value; }
        }
        public int ModbusRTUSlaveIDCOM4
        {
            get { return this.m_ModbusRTUStartAddressCOM4; }
            set { this.m_ModbusRTUStartAddressCOM4 = value; }
        }
        public int ModbusTCPSelectFunction
        {
            get { return this.m_ModbusTCPSelectFunction; }
            set { this.m_ModbusTCPSelectFunction = value; }
        }
        public int EthernetLocalPort
        {
            get { return this.m_EthernetLocalPort; }
            set { this.m_EthernetLocalPort = value; }
        }
        public int EthernetHostPort
        {
            get { return this.m_EthernetHostPort; }
            set { this.m_EthernetHostPort = value; }
        }
        public int EthernetCommMode
        {
            get { return this.m_EthernetCommMode; }
            set { this.m_EthernetCommMode = value; }
        }
        public int EthernetOperationMode
        {
            get { return this.m_EthernetOperationMode; }
            set { this.m_EthernetOperationMode = value; }
        }
        public int StoragePeriod
        {
            get { return this.m_StoragePeriod; }
            set { this.m_StoragePeriod = value; }
        }
        public int NumberOfLoginFailures
        {
            get { return this.m_NumberOfLoginFailures; }
            set { this.m_NumberOfLoginFailures = value; }
        }
        public int ModbusTCPStartAddress
        {
            get { return this.m_ModbusTCPStartAddress; }
            set { this.m_ModbusTCPStartAddress = value; }
        }
        public int ModbusRTUStartAddressCOM1
        {
            get { return this.m_ModbusRTUStartAddressCOM1; }
            set { this.m_ModbusRTUStartAddressCOM1 = value; }
        }
        public int ModbusRTUStartAddressCOM3
        {
            get { return this.m_ModbusRTUStartAddressCOM3; }
            set { this.m_ModbusRTUStartAddressCOM3 = value; }
        }
        public int ModbusRTUStartAddressCOM4
        {
            get { return this.m_ModbusRTUStartAddressCOM4; }
            set { this.m_ModbusRTUStartAddressCOM4 = value; }
        }
        public int CommunicationControlCharacter
        {
            get { return this.m_CommunicationControlCharacter; }
            set { this.m_CommunicationControlCharacter = value; }
        }

        public string UserGroupLevel1Name
        {
            get { return this.m_UserGroupLevel1Name; }
            set { this.m_UserGroupLevel1Name = value; }
        }
        public string UserGroupLevel2Name
        {
            get { return this.m_UserGroupLevel2Name; }
            set { this.m_UserGroupLevel2Name = value; }
        }
        public string UserGroupLevel3Name
        {
            get { return this.m_UserGroupLevel3Name; }
            set { this.m_UserGroupLevel3Name = value; }
        }
        public string EthernetAddress
        {
            get { return this.m_EthernetAddress; }
            set { this.m_EthernetAddress = value; }
        }

        public bool IsEthernetEnable
        {
            get
            {
                if (this.EthernetOperationMode != 0)
                    return true;
                else
                    return false;
            }
        }
        #endregion

        #region Method
        public void Initialization()
        {
            // SystemConfig1
            this.IsDataBackup = false;
            this.IsLogin = false;
            this.IsPrintPerProductEnable = false;

            this.EquipmentID = 1;
            this.DecimalPlaces = 1;
            this.ProductNumber = 1;
            this.UsbID = 1;
            this.SerialCOM1BaudRate = 0;
            this.SerialCOM1Mode = 0;
            this.SerialCOM3BaudRate = 0;
            this.SerialCOM3Mode = 0;
            this.SerialCOM4BaudRate = 0;
            this.SerialCOM4Mode = 0;
            this.EquipmentType = 0;
            this.IsBypassDirectionPass1 = true;
            this.IsBypassDirectionPass2 = true;
            this.IsBypassOnce1 = true;
            this.IsBypassOnce2 = true;
            this.SensorErrorDetectingTime = 0;
            this.EntryNotDetectedIgnoreTime = 0;
            this.SelectLaneCOM1 = 0;
            this.SelectLaneCOM3 = 0;
            this.SelectLaneCOM4 = 0;
            this.SelectLaneEthernet = 0;
            
            this.SerialNumber = "24L000";
            this.MainBoardVersion = "000";
            this.Unit = "g";

            this.Language = Define.E_LanguageID.Korean;

            // SystemConfig2
            this.IsModbus = false;
            this.IsPart11 = false;
            this.IsEthernetPingTimer = false;
            this.IsCharToFillZeroEthernet = false;
            this.IsTransmitWhenPassEthernet = false;
            this.IsCharToFillZeroCOM1 = false;
            this.IsTransmitWhenPassCOM1 = false;
            this.IsCharToFillZeroCOM3 = false;
            this.IsTransmitWhenPassCOM3 = false;
            this.IsCharToFillZeroCOM4 = false;
            this.IsTransmitWhenPassCOM4 = false;
            this.IsModbusRTUUsingConverterCOM1 = false;
            this.IsModbusRTUUsingConverterCOM3 = false;
            this.IsModbusRTUUsingConverterCOM4 = false;

            this.TransmissionDelayTimeCOM1 = 0;
            this.TransmissionDelayTimeCOM3 = 0;
            this.TransmissionDelayTimeCOM4 = 0;
            this.TransmissionDelayTimeEthernet = 0;
            this.ModbusRTUSelectFunction = (int)Define.E_ModbusFunction._04_ReadInputRegister;
            this.ModbusRTUSlaveIDCOM1 = 1;
            this.ModbusRTUSlaveIDCOM3 = 1;
            this.ModbusRTUSlaveIDCOM4 = 1;
            this.ModbusTCPSelectFunction = (int)Define.E_ModbusFunction._04_ReadInputRegister;
            this.EthernetLocalPort = 0;
            this.EthernetHostPort = 0;
            this.EthernetCommMode = 0;
            this.EthernetOperationMode = 0;
            this.StoragePeriod = 12;
            this.NumberOfLoginFailures = 5;
            this.ModbusTCPStartAddress = 10;
            this.ModbusRTUStartAddressCOM1 = 10;
            this.ModbusRTUStartAddressCOM3 = 10;
            this.ModbusRTUStartAddressCOM4 = 10;
            this.CommunicationControlCharacter = 0;

            this.UserGroupLevel1Name = "Level1";
            this.UserGroupLevel2Name = "Level2";
            this.UserGroupLevel3Name = "Level3";
            this.EthernetAddress = "0.0.0.0";
        }
        #endregion
    }
    #endregion
    #region StructSystemConfigurationItem1
    [StructLayout(LayoutKind.Sequential)]
    public struct StructSystemConfigurationItem1
    {
        public bool IsDataBackup;
        public bool IsLogin;

        public int EquipmentID;
        public int DecimalPlaces;
        public int ProductNumber;
        public int UsbID;
        public int SerialCOM1BaudRate;
        public int SerialCOM1Mode;
        public int SerialCOM3BaudRate;
        public int SerialCOM3Mode;
        public int SerialCOM4BaudRate;
        public int SerialCOM4Mode;

        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 15)]
        public string SerialNumber;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 4)]
        public string Unit;

        public Define.E_LanguageID Language;

        public bool DummyBool1;
        public bool DummyBool2;
        public bool DummyBool3;
        public bool DummyBool4;
        public bool IsPrintPerProductEnable;

        public int DummyInt1;
        public int DummyInt2;
        public int EntryNotDetectedIgnoreTime;
        public int SensorErrorDetectingTime;
        public int EquipmentType;

        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
        public string DummyString1;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
        public string DummyString2;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
        public string DummyString3;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
        public string DummyString4;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 100)]
        public string DummyString5;
    }
    #endregion
    #region StructSystemConfigurationItem2
    [StructLayout(LayoutKind.Sequential)]
    public struct StructSystemConfigurationItem2
    {
        public bool DummyBool1;
        public bool DummyBool2;
        public bool DummyBool3;
        public bool DummyBool4;
        public bool DummyBool5;
        public bool DummyBool6;
        public bool DummyBool7;
        public bool DummyBool8;
        public bool DummyBool9;
        public bool DummyBool10;
        public bool DummyBool11;
        public bool DummyBool12;
        public bool DummyBool13;
        public bool DummyBool14;
        public bool DummyBool15;
        public bool DummyBool16;
        public bool DummyBool17;
        public bool DummyBool18;
        public bool DummyBool19;
        public bool IsModbus;
        public bool IsPart11;
        public bool IsEthernetPingTimer;
        public bool IsCharToFillZeroEthernet;
        public bool IsTransmitWhenPassEthernet;
        public bool IsCharToFillZeroCOM1;
        public bool IsTransmitWhenPassCOM1;
        public bool IsCharToFillZeroCOM3;
        public bool IsTransmitWhenPassCOM3;
        public bool IsCharToFillZeroCOM4;
        public bool IsTransmitWhenPassCOM4;
        public bool IsModbusRTUUsingConverterCOM1;
        public bool IsModbusRTUUsingConverterCOM3;
        public bool IsModbusRTUUsingConverterCOM4;

        public int DummyInt1;
        public int DummyInt2;
        public int DummyInt3;
        public int DummyInt4;
        public int DummyInt5;
        public int DummyInt6;
        public int DummyInt7;
        public int DummyInt8;
        public int DummyInt9;
        public int DummyInt10;
        public int DummyInt11;
        public int TransmissionDelayTimeEthernet;
        public int SelectLaneCOM1;
        public int SelectLaneCOM3;
        public int SelectLaneCOM4;
        public int SelectLaneEthernet;
        public int TransmissionDelayTimeCOM1;
        public int TransmissionDelayTimeCOM3;
        public int TransmissionDelayTimeCOM4;
        public int ModbusRTUSelectFunction;
        public int ModbusRTUSlaveIDCOM1;
        public int ModbusRTUSlaveIDCOM3;
        public int ModbusRTUSlaveIDCOM4;
        public int ModbusTCPSelectFunction;
        public int EthernetLocalPort;
        public int EthernetHostPort;
        public int EthernetCommMode;
        public int EthernetOperationMode;
        public int StoragePeriod;
        public int NumberOfLoginFailures;
        public int ModbusTCPStartAddress;
        public int ModbusRTUStartAddressCOM1;
        public int ModbusRTUStartAddressCOM3;
        public int ModbusRTUStartAddressCOM4;
        public int CommunicationControlCharacter;

        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
        public string DummyString1;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
        public string DummyString2;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
        public string DummyString3;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
        public string DummyString4;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
        public string DummyString5;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
        public string DummyString6;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
        public string DummyString7;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
        public string DummyString8;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
        public string DummyString9;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
        public string DummyString10;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
        public string UserGroupLevel1Name;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
        public string UserGroupLevel2Name;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
        public string UserGroupLevel3Name;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
        public string EthernetAddress;
    }
    #endregion

    #region SystemParameter3
    public class SystemParameter3
    {
        #region Field
        private string m_ExternalOut1Mode;
        private string m_ExternalOut1DelayTime;
        private string m_ExternalOut1RunTime;

        private string m_ExternalOut2Mode;
        private string m_ExternalOut2DelayTime;
        private string m_ExternalOut2RunTime;

        private string m_ExternalOut3Mode;
        private string m_ExternalOut3DelayTime;
        private string m_ExternalOut3RunTime;

        private string m_ExternalOut4Mode;
        private string m_ExternalOut4DelayTime;
        private string m_ExternalOut4RunTime;

        private string m_ExternalOut9Mode;
        private string m_ExternalOut9DelayTime;
        private string m_ExternalOut9RunTime;

        private string m_ExternalOut10Mode;
        private string m_ExternalOut10DelayTime;
        private string m_ExternalOut10RunTime;

        private string m_Dummy1;
        private string m_Dummy2;
        #endregion

        #region Constructor
        public SystemParameter3()
        {
            this.Initialization();
        }
        #endregion

        #region Property
        public string ExternalOut1Mode
        {
            get { return this.m_ExternalOut1Mode; }
            set { this.m_ExternalOut1Mode = value; }
        }
        public string ExternalOut1DelayTime
        {
            get { return this.m_ExternalOut1DelayTime; }
            set { this.m_ExternalOut1DelayTime = value; }
        }
        public string ExternalOut1RunTime
        {
            get { return this.m_ExternalOut1RunTime; }
            set { this.m_ExternalOut1RunTime = value; }
        }

        public string ExternalOut2Mode
        {
            get { return this.m_ExternalOut2Mode; }
            set { this.m_ExternalOut2Mode = value; }
        }
        public string ExternalOut2DelayTime
        {
            get { return this.m_ExternalOut2DelayTime; }
            set { this.m_ExternalOut2DelayTime = value; }
        }
        public string ExternalOut2RunTime
        {
            get { return this.m_ExternalOut2RunTime; }
            set { this.m_ExternalOut2RunTime = value; }
        }

        public string ExternalOut3Mode
        {
            get { return this.m_ExternalOut3Mode; }
            set { this.m_ExternalOut3Mode = value; }
        }
        public string ExternalOut3DelayTime
        {
            get { return this.m_ExternalOut3DelayTime; }
            set { this.m_ExternalOut3DelayTime = value; }
        }
        public string ExternalOut3RunTime
        {
            get { return this.m_ExternalOut3RunTime; }
            set { this.m_ExternalOut3RunTime = value; }
        }

        public string ExternalOut4Mode
        {
            get { return this.m_ExternalOut4Mode; }
            set { this.m_ExternalOut4Mode = value; }
        }
        public string ExternalOut4DelayTime
        {
            get { return this.m_ExternalOut4DelayTime; }
            set { this.m_ExternalOut4DelayTime = value; }
        }
        public string ExternalOut4RunTime
        {
            get { return this.m_ExternalOut4RunTime; }
            set { this.m_ExternalOut4RunTime = value; }
        }

        public string ExternalOut9Mode
        {
            get { return this.m_ExternalOut9Mode; }
            set { this.m_ExternalOut9Mode = value; }
        }
        public string ExternalOut9DelayTime
        {
            get { return this.m_ExternalOut9DelayTime; }
            set { this.m_ExternalOut9DelayTime = value; }
        }
        public string ExternalOut9RunTime
        {
            get { return this.m_ExternalOut9RunTime; }
            set { this.m_ExternalOut9RunTime = value; }
        }

        public string ExternalOut10Mode
        {
            get { return this.m_ExternalOut10Mode; }
            set { this.m_ExternalOut10Mode = value; }
        }
        public string ExternalOut10DelayTime
        {
            get { return this.m_ExternalOut10DelayTime; }
            set { this.m_ExternalOut10DelayTime = value; }
        }
        public string ExternalOut10RunTime
        {
            get { return this.m_ExternalOut10RunTime; }
            set { this.m_ExternalOut10RunTime = value; }
        }

        public string Dummy1
        {
            get { return this.m_Dummy1; }
            set { this.m_Dummy1 = value; }
        }
        public string Dummy2
        {
            get { return this.m_Dummy2; }
            set { this.m_Dummy2 = value; }
        }
        #endregion

        #region Method
        public void Initialization()
        {
            this.ExternalOut1Mode = "0";
            this.ExternalOut1DelayTime = "500";
            this.ExternalOut1RunTime = "1000";

            this.ExternalOut2Mode = "0";
            this.ExternalOut2DelayTime = "500";
            this.ExternalOut2RunTime = "1000";

            this.ExternalOut3Mode = "0";
            this.ExternalOut3DelayTime = "500";
            this.ExternalOut3RunTime = "1000";

            this.ExternalOut4Mode = "0";
            this.ExternalOut4DelayTime = "500";
            this.ExternalOut4RunTime = "1000";

            this.ExternalOut9Mode = "0";
            this.ExternalOut9DelayTime = "500";
            this.ExternalOut9RunTime = "1000";

            this.ExternalOut10Mode = "0";
            this.ExternalOut10DelayTime = "500";
            this.ExternalOut10RunTime = "1000";

            this.Dummy1 = "0";
            this.Dummy2 = "0";
        }
        #endregion
    }
    #endregion
    #region StructSystemParameter3
    [StructLayout(LayoutKind.Sequential)]
    public struct StructSystemParameter3
    {
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string ExternalOut1Mode;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string ExternalOut1DelayTime;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string ExternalOut1RunTime;

        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string ExternalOut2Mode;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string ExternalOut2DelayTime;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string ExternalOut2RunTime;

        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string ExternalOut3Mode;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string ExternalOut3DelayTime;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string ExternalOut3RunTime;

        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string ExternalOut4Mode;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string ExternalOut4DelayTime;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string ExternalOut4RunTime;

        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string ExternalOut9Mode;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string ExternalOut9DelayTime;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string ExternalOut9RunTime;

        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string ExternalOut10Mode;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string ExternalOut10DelayTime;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string ExternalOut10RunTime;

        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string Dummy1;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string Dummy2;
    }
    #endregion

    #region Modbus
    public class _30000_ModbusAddress
    {
        public const int _01_IsUpdate_High = 10;
        public const int _02_IsUpdate_Low = 11;
        public const int _03_EquipmentID_High = 12;
        public const int _04_EquipmentID_Low = 13;
        public const int _05_ProductNo_High = 14;
        public const int _06_ProductNo_Low = 15;
        public const int _07_UnderValue_High = 16;
        public const int _08_UnderValue_Low = 17;
        public const int _09_PassValue_High = 18;
        public const int _10_PassValue_Low = 19;
        public const int _11_OverValue_High = 20;
        public const int _12_OverValue_Low = 21;
        public const int _13_TareValue_High = 22;
        public const int _14_TareValue_Low = 23;
        public const int _15_UnderCount_High = 24;
        public const int _16_UnderCount_Low = 25;
        public const int _17_PassCount_High = 26;
        public const int _18_PassCount_Low = 27;
        public const int _19_OverCount_High = 28;
        public const int _20_OverCount_Low = 29;
        public const int _21_NGCount_High = 30;
        public const int _22_NGCount_Low = 31;
        public const int _23_ExNGCount_High = 32;
        public const int _24_ExNGCount_Low = 33;
        public const int _25_TotalCount_High = 34;
        public const int _26_TotalCount_Low = 35;
        public const int _27_Grade_High = 36;
        public const int _28_Grade_Low = 37;
        public const int _29_Weight_High = 38;
        public const int _30_Weight_Low = 39;
        public const int _31_OperationStatus_High = 40;
        public const int _32_OperationStatus_Low = 41;
        public const int _33_AlarmStatus_High = 42;
        public const int _34_AlarmStatus_Low = 43;
        public const int _35_Speed_High = 44;
        public const int _36_Speed_Low = 45;
        public const int _37_MetalDetectionCount_High = 46;
        public const int _38_MetalDetectionCount_Low = 47;
        public const int _39_DoubleEntryCount_High = 48;
        public const int _40_DoubleEntryCount_Low = 49;
        public const int _41_ProductName = 50; // 41~50

        public const int _2001_IsUpdate_High = 2010;
        public const int _2002_IsUpdate_Low = 2011;
        public const int _2003_EquipmentID_High = 2012;
        public const int _2004_EquipmentID_Low = 2013;
        public const int _2005_ProductNo_High = 2014;
        public const int _2006_ProductNo_Low = 2015;
        public const int _2007_UnderValue_High = 2016;
        public const int _2008_UnderValue_Low = 2017;
        public const int _2009_PassValue_High = 2018;
        public const int _2010_PassValue_Low = 2019;
        public const int _2011_OverValue_High = 2020;
        public const int _2012_OverValue_Low = 2021;
        public const int _2013_TareValue_High = 2022;
        public const int _2014_TareValue_Low = 2023;
        public const int _2015_UnderCount_High = 2024;
        public const int _2016_UnderCount_Low = 2025;
        public const int _2017_PassCount_High = 2026;
        public const int _2018_PassCount_Low = 2027;
        public const int _2019_OverCount_High = 2028;
        public const int _2020_OverCount_Low = 2029;
        public const int _2021_NGCount_High = 2030;
        public const int _2022_NGCount_Low = 2031;
        public const int _2023_ExNGCount_High = 2032;
        public const int _2024_ExNGCount_Low = 2033;
        public const int _2025_TotalCount_High = 2034;
        public const int _2026_TotalCount_Low = 2035;
        public const int _2027_Grade_High = 2036;
        public const int _2028_Grade_Low = 2037;
        public const int _2029_Weight_High = 2038;
        public const int _2030_Weight_Low = 2039;
        public const int _2031_OperationStatus_High = 2040;
        public const int _2032_OperationStatus_Low = 2041;
        public const int _2033_AlarmStatus_High = 2042;
        public const int _2034_AlarmStatus_Low = 2043;
        public const int _2035_Speed_High = 2044;
        public const int _2036_Speed_Low = 2045;
        public const int _2037_MetalDetectionCount_High = 2046;
        public const int _2038_MetalDetectionCount_Low = 2047;
        public const int _2039_DoubleEntryCount_High = 2048;
        public const int _2040_DoubleEntryCount_Low = 2049;
        public const int _2041_ProductName = 2050; // 41~50
        

        public const short _1001_Alarm1 = 1000;
        public const short _1002_Alarm2 = 1001;
        public const short _1003_Alarm3 = 1002;
        public const short _1004_Alarm4 = 1003;
        public const short _1005_Alarm5 = 1004;
        public const short _1006_Alarm6 = 1005;

        #region V7
        //public const int _01_EquipmentID = 10;
        //public const int _02_ProductNo = 11;
        //public const int _03_UnderValue_High = 12;
        //public const int _04_UnderValue_Low = 13;
        //public const int _05_PassValue_High = 14;
        //public const int _06_PassValue_Low = 15;
        //public const int _07_OverValue_High = 16;
        //public const int _08_OverValue_Low = 17;
        //public const int _09_UnderCount_High = 18;
        //public const int _10_UnderCount_Low = 19;
        //public const int _11_PassCount_High = 20;
        //public const int _12_PassCount_Low = 21;
        //public const int _13_OverCount_High = 22;
        //public const int _14_OverCount_Low = 23;
        //public const int _15_NGCount_High = 24;
        //public const int _16_NGCount_Low = 25;
        //public const int _17_ExNGCount_High = 26;
        //public const int _18_ExNGCount_Low = 27;
        //public const int _19_TotalCount_High = 28;
        //public const int _20_TotalCount_Low = 29;
        //public const int _21_Grade = 30;
        //public const int _22_Weight_High = 31;
        //public const int _23_Weight_Low = 32;
        //public const int _24_OperationStatus = 33;
        #endregion
    }
    public class _30000_ModbusData
    {
        #region Field
        private int m_IsUpdate;
        private int m_EquipmentID;
        private int m_ProductNo;
        private double m_UnderValue;
        private double m_PassValue;
        private double m_OverValue;
        private double m_TareValue;
        private UInt32 m_UnderCount;
        private UInt32 m_PassCount;
        private UInt32 m_OverCount;
        private UInt32 m_NGCount;
        private UInt32 m_ExNGCount;
        private UInt32 m_TotalCount;
        private int m_Grade;
        private double m_Weight;
        private int m_OperationStatus;
        private int m_AlarmStatus;
        private int m_Speed;
        private UInt32 m_MetalDetectionCount;
        private UInt32 m_DoubleEntryCount;
        private byte[] m_ProductName;

        private short[] m_Alarm;
        #endregion

        #region Constructor
        public _30000_ModbusData()
        {
            this.Initialization();
        }
        #endregion

        #region Property
        public int IsUpdate
        {
            get { return this.m_IsUpdate; }
            set { this.m_IsUpdate = value; }
        }
        public int EquipmentID
        {
            get { return this.m_EquipmentID; }
            set { this.m_EquipmentID = value; }
        }
        public int ProductNo
        {
            get { return this.m_ProductNo; }
            set { this.m_ProductNo = value; }
        }

        public double UnderValue
        {
            get { return this.m_UnderValue; }
            set { this.m_UnderValue = value; }
        }
        public double PassValue
        {
            get { return this.m_PassValue; }
            set { this.m_PassValue = value; }
        }
        public double OverValue
        {
            get { return this.m_OverValue; }
            set { this.m_OverValue = value; }
        }
        public double TareValue
        {
            get { return this.m_TareValue; }
            set { this.m_TareValue = value; }
        }

        public UInt32 UnderCount
        {
            get { return this.m_UnderCount; }
            set { this.m_UnderCount = value; }
        }
        public UInt32 PassCount
        {
            get { return this.m_PassCount; }
            set { this.m_PassCount = value; }
        }
        public UInt32 OverCount
        {
            get { return this.m_OverCount; }
            set { this.m_OverCount = value; }
        }
        public UInt32 NGCount
        {
            get { return this.m_NGCount; }
            set { this.m_NGCount = value; }
        }
        public UInt32 ExNGCount
        {
            get { return this.m_ExNGCount; }
            set { this.m_ExNGCount = value; }
        }
        public UInt32 TotalCount
        {
            get { return this.m_TotalCount; }
            set { this.m_TotalCount = value; }
        }

        public int Grade
        {
            get { return this.m_Grade; }
            set { this.m_Grade = value; }
        }
        public double Weight
        {
            get { return this.m_Weight; }
            set { this.m_Weight = value; }
        }
        public int OperationStatus
        {
            get { return this.m_OperationStatus; }
            set { this.m_OperationStatus = value; }
        }
        public int AlarmStatus
        {
            get { return this.m_AlarmStatus; }
            set { this.m_AlarmStatus = value; }
        }
        public int Speed
        {
            get { return this.m_Speed; }
            set { this.m_Speed = value; }
        }
        public UInt32 MetalDetectionCount
        {
            get { return this.m_MetalDetectionCount; }
            set { this.m_MetalDetectionCount = value; }
        }
        public UInt32 DoubleEntryCount
        {
            get { return this.m_DoubleEntryCount; }
            set { this.m_DoubleEntryCount = value; }
        }
        public byte[] ProductName
        {
            get { return this.m_ProductName; }
            set { this.m_ProductName = value; }
        }

        public short[] Alarm
        {
            get { return this.m_Alarm; }
            set { this.m_Alarm = value; }
        }

        public string HexStringIsUpdate
        {
            get
            {
                string hexString = this.IsUpdate.ToString("X8");
                return hexString;
            }
        }
        public string HexStringEquipmentID
        {
            get
            {
                string hexString = this.EquipmentID.ToString("X8");
                return hexString;
            }
        }
        public string HexStringProductNo
        {
            get
            {
                string hexString = this.ProductNo.ToString("X8");
                return hexString;
            }
        }
        public string HexStringUnderValue
        {
            get
            {
                byte[] bytes = BitConverter.GetBytes((float)this.UnderValue);
                Array.Reverse(bytes);
                string hexString = BitConverter.ToString(bytes);
                hexString = hexString.Replace("-", "");

                return hexString;
            }
        }
        public string HexStringPassValue
        {
            get
            {
                byte[] bytes = BitConverter.GetBytes((float)this.PassValue);
                Array.Reverse(bytes);
                string hexString = BitConverter.ToString(bytes);
                hexString = hexString.Replace("-", "");

                return hexString;
            }
        }
        public string HexStringOverValue
        {
            get
            {
                byte[] bytes = BitConverter.GetBytes((float)this.OverValue);
                Array.Reverse(bytes);
                string hexString = BitConverter.ToString(bytes);
                hexString = hexString.Replace("-", "");

                return hexString;
            }
        }
        public string HexStringTareValue
        {
            get
            {
                byte[] bytes = BitConverter.GetBytes((float)this.TareValue);
                Array.Reverse(bytes);
                string hexString = BitConverter.ToString(bytes);
                hexString = hexString.Replace("-", "");

                return hexString;
            }
        }
        public string HexStringUnderCount
        {
            get
            {
                string hexString = this.UnderCount.ToString("X8");
                return hexString;
            }
        }
        public string HexStringPassCount
        {
            get
            {
                string hexString = this.PassCount.ToString("X8");
                return hexString;
            }
        }
        public string HexStringOverCount
        {
            get
            {
                string hexString = this.OverCount.ToString("X8");
                return hexString;
            }
        }
        public string HexStringNGCount
        {
            get
            {
                string hexString = this.NGCount.ToString("X8");
                return hexString;
            }
        }
        public string HexStringExNGCount
        {
            get
            {
                string hexString = this.ExNGCount.ToString("X8");
                return hexString;
            }
        }
        public string HexStringTotalCount
        {
            get
            {
                string hexString = this.TotalCount.ToString("X8");
                return hexString;
            }
        }
        public string HexStringGrade
        {
            get
            {
                string hexString = this.Grade.ToString("X8");
                return hexString;
            }
        }
        public string HexStringWeight
        {
            get
            {
                byte[] bytes = BitConverter.GetBytes((float)this.Weight);
                byte[] reverseBytes = new byte[bytes.Length];
                for (int i = 0; i < bytes.Length; i++)
                    reverseBytes[bytes.Length - 1 - i] = bytes[i];
                string hexString = BitConverter.ToString(reverseBytes);

                hexString = hexString.Replace("-", "");

                return hexString;
            }
        }
        public string HexStringOperationStatus
        {
            get
            {
                string hexString = this.OperationStatus.ToString("X8");
                return hexString;
            }
        }
        public string HexStringAlarmStatus
        {
            get
            {
                string hexString = this.AlarmStatus.ToString("X8");
                return hexString;
            }
        }
        public string HexStringSpeed
        {
            get
            {
                string hexString = this.Speed.ToString("X8");
                return hexString;
            }
        }
        public string HexStringMetalDetectionCount
        {
            get
            {
                string hexString = this.MetalDetectionCount.ToString("X8");
                return hexString;
            }
        }
        public string HexStringDoubleEntryCount
        {
            get
            {
                string hexString = this.DoubleEntryCount.ToString("X8");
                return hexString;
            }
        }
        public string[] HexStringAlarm
        {
            get
            {
                string[] hexString = new string[this.Alarm.Count()];

                for (int i = 0; i < this.Alarm.Count(); i++)
                    hexString[i] = this.Alarm[i].ToString("X8");

                return hexString;
            }
        }

        public byte[] _01_IsUpdate_High
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes(this.IsUpdate);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[3 - i];

                return madeData;
            }
        }
        public byte[] _02_IsUpdate_Low
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes(this.IsUpdate);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[1 - i];

                return madeData;
            }
        }
        public byte[] _03_EquipmentID_High
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes(this.EquipmentID);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[3 - i];

                return madeData;
            }
        }
        public byte[] _04_EquipmentID_Low
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes(this.EquipmentID);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[1 - i];

                return madeData;
            }
        }
        public byte[] _05_ProductNo_High
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes(this.ProductNo);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[3 - i];

                return madeData;
            }
        }
        public byte[] _06_ProductNo_Low
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes(this.ProductNo);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[1 - i];

                return madeData;
            }
        }
        public byte[] _07_UnderValue_High
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes((Single)this.UnderValue);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[3 - i];

                return madeData;
            }
        }
        public byte[] _08_UnderValue_Low
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes((Single)this.UnderValue);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[1 - i];

                return madeData;
            }
        }
        public byte[] _09_PassValue_High
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes((Single)this.PassValue);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[3 - i];

                return madeData;
            }
        }
        public byte[] _10_PassValue_Low
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes((Single)this.PassValue);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[1 - i];

                return madeData;
            }
        }
        public byte[] _11_OverValue_High
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes((Single)this.OverValue);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[3 - i];

                return madeData;
            }
        }
        public byte[] _12_OverValue_Low
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes((Single)this.OverValue);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[1 - i];

                return madeData;
            }
        }
        public byte[] _13_TareValue_High
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes((Single)this.TareValue);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[3 - i];

                return madeData;
            }
        }
        public byte[] _14_TareValue_Low
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes((Single)this.TareValue);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[1 - i];

                return madeData;
            }
        }
        public byte[] _15_UnderCount_High
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes(this.UnderCount);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[3 - i];

                return madeData;
            }
        }
        public byte[] _16_UnderCount_Low
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes(this.UnderCount);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[1 - i];

                return madeData;
            }
        }
        public byte[] _17_PassCount_High
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes(this.PassCount);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[3 - i];

                return madeData;
            }
        }
        public byte[] _18_PassCount_Low
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes(this.PassCount);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[1 - i];

                return madeData;
            }
        }
        public byte[] _19_OverCount_High
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes(this.OverCount);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[3 - i];

                return madeData;
            }
        }
        public byte[] _20_OverCount_Low
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes(this.OverCount);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[1 - i];

                return madeData;
            }
        }
        public byte[] _21_NGCount_High
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes(this.NGCount);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[3 - i];

                return madeData;
            }
        }
        public byte[] _22_NGCount_Low
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes(this.NGCount);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[1 - i];

                return madeData;
            }
        }
        public byte[] _23_ETCExNGCount_High
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes(this.ExNGCount);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[3 - i];

                return madeData;
            }
        }
        public byte[] _24_ETCExNGCount_Low
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes(this.ExNGCount);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[1 - i];

                return madeData;
            }
        }
        public byte[] _25_TotalCount_High
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes(this.TotalCount);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[3 - i];

                return madeData;
            }
        }
        public byte[] _26_TotalCount_Low
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes(this.TotalCount);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[1 - i];

                return madeData;
            }
        }
        public byte[] _27_Grade_High
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes(this.Grade);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[3 - i];

                return madeData;
            }
        }
        public byte[] _28_Grade_Low
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes(this.Grade);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[1 - i];

                return madeData;
            }
        }
        public byte[] _29_Weight_High
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes((Single)this.Weight);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[3 - i];

                return madeData;
            }
        }
        public byte[] _30_Weight_Low
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes((Single)this.Weight);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[1 - i];

                return madeData;
            }
        }
        public byte[] _31_OperationStatus_High
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes(this.OperationStatus);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[3 - i];

                return madeData;
            }
        }
        public byte[] _32_OperationStatus_Low
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes(this.OperationStatus);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[1 - i];

                return madeData;
            }
        }
        public byte[] _33_AlarmStatus_High
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes(this.AlarmStatus);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[3 - i];

                return madeData;
            }
        }
        public byte[] _34_AlarmStatus_Low
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes(this.AlarmStatus);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[1 - i];

                return madeData;
            }
        }
        public byte[] _35_Speed_High
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes(this.Speed);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[3 - i];

                return madeData;
            }
        }
        public byte[] _36_Speed_Low
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes(this.Speed);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[1 - i];

                return madeData;
            }
        }
        public byte[] _37_MetalDetectionCount_High
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes(this.MetalDetectionCount);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[3 - i];

                return madeData;
            }
        }
        public byte[] _38_MetalDetectionCount_Low
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes(this.MetalDetectionCount);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[1 - i];

                return madeData;
            }
        }
        public byte[] _39_DoubleEntryCount_High
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes(this.DoubleEntryCount);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[3 - i];

                return madeData;
            }
        }
        public byte[] _40_DoubleEntryCount_Low
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes(this.DoubleEntryCount);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[1 - i];

                return madeData;
            }
        }
        #endregion

        #region Method
        public void Initialization()
        {
            this.IsUpdate = 0;
            this.EquipmentID = 1;
            this.ProductNo = 1;
            this.UnderValue = 100.0;
            this.PassValue = 200.0;
            this.OverValue = 300.0;
            this.TareValue = 0.0;
            this.UnderCount = 0;
            this.PassCount = 0;
            this.OverCount = 0;
            this.NGCount = 0;
            this.ExNGCount = 0;
            this.TotalCount = 0;
            this.Grade = 5;
            this.Weight = 0.0;
            this.OperationStatus = 0;
            this.AlarmStatus = 0;
            this.Speed = 0;
            this.MetalDetectionCount = 0;
            this.DoubleEntryCount = 0;
            this.ProductName = new byte[20];
            this.Alarm = new short[6];
        }
        #endregion
    }

    public class _40000_ModbusAddress
    {
        public const int _01_Clear = 10;
        public const int _02_ClearResult = 11;
        public const int _03_Operation = 12;
        public const int _04_OperationResult = 13;
        public const int _05_ProductChange_High = 14;
        public const int _06_ProductChange_Low = 15;
        public const int _07_ProductChangeResult = 16;

        public const int _08_UnderRange1_High = 17;
        public const int _09_UnderRange1_Low = 18;
        public const int _10_UnderRangeResult1 = 19;
        public const int _11_PassRange1_High = 20;
        public const int _12_PassRange1_Low = 21;
        public const int _13_PassRangeResult1 = 22;
        public const int _14_OverRange1_High = 23;
        public const int _15_OverRange1_Low = 24;
        public const int _16_OverRangeResult1 = 25;
        public const int _17_TareWeight1_High = 26;
        public const int _18_TareWeight1_Low = 27;
        public const int _19_TareWeightResult1 = 28;

        public const int _20_UnderRange2_High = 2017;
        public const int _21_UnderRange2_Low = 2018;
        public const int _22_UnderRangeResult2 = 2019;
        public const int _23_PassRange2_High = 2020;
        public const int _24_PassRange2_Low = 2021;
        public const int _25_PassRangeResult2 = 2022;
        public const int _26_OverRange2_High = 2023;
        public const int _27_OverRange2_Low = 2024;
        public const int _28_OverRangeResult2 = 2025;
        public const int _29_TareWeight2_High = 2026;
        public const int _30_TareWeight2_Low = 2027;
        public const int _31_TareWeightResult2 = 2028;
    }
    public class _40000_ModbusData
    {
        #region Field
        private int m_40011_Clear;
        private int m_40012_ClearResult;
        private int m_40013_Operation;
        private int m_40014_OperationResult;
        private int m_40015_ProductChange;
        private int m_40017_ProductChangeResult;

        private int m_40018_UnderRange;
        private int m_40020_UnderRangeResult;
        private int m_40021_PassRange;
        private int m_40023_PassRangeResult;
        private int m_40024_OverRange;
        private int m_40026_OverRangeResult;
        private int m_40027_TareWeight;
        private int m_40029_TareWeightResult;

        private int m_42018_UnderRange;
        private int m_42020_UnderRangeResult;
        private int m_42021_PassRange;
        private int m_42023_PassRangeResult;
        private int m_42024_OverRange;
        private int m_42026_OverRangeResult;
        private int m_42027_TareWeight;
        private int m_42029_TareWeightResult;
        #endregion

        #region Constructor
        public _40000_ModbusData()
        {
            this.Initialization();
        }
        #endregion

        #region Property
        public int _40011_Clear
        {
            get { return this.m_40011_Clear; }
            set { this.m_40011_Clear = value; }
        }
        public int _40012_ClearResult
        {
            get { return this.m_40012_ClearResult; }
            set { this.m_40012_ClearResult = value; }
        }
        public int _40013_Operation
        {
            get { return this.m_40013_Operation; }
            set { this.m_40013_Operation = value; }
        }
        public int _40014_OperationResult
        {
            get { return this.m_40014_OperationResult; }
            set { this.m_40014_OperationResult = value; }
        }
        public int _40015_ProductChange
        {
            get { return this.m_40015_ProductChange; }
            set { this.m_40015_ProductChange = value; }
        }
        public int _40017_ProductChangeResult
        {
            get { return this.m_40017_ProductChangeResult; }
            set { this.m_40017_ProductChangeResult = value; }
        }

        public int _40018_UnderRange
        {
            get { return this.m_40018_UnderRange; }
            set { this.m_40018_UnderRange = value; }
        }
        public int _40020_UnderRangeResult
        {
            get { return this.m_40020_UnderRangeResult; }
            set { this.m_40020_UnderRangeResult = value; }
        }
        public int _40021_PassRange
        {
            get { return this.m_40021_PassRange; }
            set { this.m_40021_PassRange = value; }
        }
        public int _40023_PassRangeResult
        {
            get { return this.m_40023_PassRangeResult; }
            set { this.m_40023_PassRangeResult = value; }
        }
        public int _40024_OverRange
        {
            get { return this.m_40024_OverRange; }
            set { this.m_40024_OverRange = value; }
        }
        public int _40026_OverRangeResult
        {
            get { return this.m_40026_OverRangeResult; }
            set { this.m_40026_OverRangeResult = value; }
        }
        public int _40027_TareWeight
        {
            get { return this.m_40027_TareWeight; }
            set { this.m_40027_TareWeight = value; }
        }
        public int _40029_TareWeightResult
        {
            get { return this.m_40029_TareWeightResult; }
            set { this.m_40029_TareWeightResult = value; }
        }

        public int _42018_UnderRange
        {
            get { return this.m_42018_UnderRange; }
            set { this.m_42018_UnderRange = value; }
        }
        public int _42020_UnderRangeResult
        {
            get { return this.m_42020_UnderRangeResult; }
            set { this.m_42020_UnderRangeResult = value; }
        }
        public int _42021_PassRange
        {
            get { return this.m_42021_PassRange; }
            set { this.m_42021_PassRange = value; }
        }
        public int _42023_PassRangeResult
        {
            get { return this.m_42023_PassRangeResult; }
            set { this.m_42023_PassRangeResult = value; }
        }
        public int _42024_OverRange
        {
            get { return this.m_42024_OverRange; }
            set { this.m_42024_OverRange = value; }
        }
        public int _42026_OverRangeResult
        {
            get { return this.m_42026_OverRangeResult; }
            set { this.m_42026_OverRangeResult = value; }
        }
        public int _42027_TareWeight
        {
            get { return this.m_42027_TareWeight; }
            set { this.m_42027_TareWeight = value; }
        }
        public int _42029_TareWeightResult
        {
            get { return this.m_42029_TareWeightResult; }
            set { this.m_42029_TareWeightResult = value; }
        }
        #endregion

        #region Method
        public void Initialization()
        {
            this._40011_Clear = 0;
            this._40012_ClearResult = 0;
            this._40013_Operation = 0;
            this._40014_OperationResult = 0;
            this._40015_ProductChange = 0;
            this._40017_ProductChangeResult = 0;

            this._40018_UnderRange = 0;
            this._40020_UnderRangeResult = 0;
            this._40021_PassRange = 0;
            this._40023_PassRangeResult = 0;
            this._40024_OverRange = 0;
            this._40026_OverRangeResult = 0;
            this._40027_TareWeight = 0;
            this._40029_TareWeightResult = 0;

            this._42018_UnderRange = 0;
            this._42020_UnderRangeResult = 0;
            this._42021_PassRange = 0;
            this._42023_PassRangeResult = 0;
            this._42024_OverRange = 0;
            this._42026_OverRangeResult = 0;
            this._42027_TareWeight = 0;
            this._42029_TareWeightResult = 0;
        }
        #endregion
    }
    #endregion

    #region ProductItem
    public class ProductItem
    {
        #region Field
        private int m_Number;

        private string m_Name;
        private string m_LotNo;
        private string m_UnderRange;
        private string m_PassRange;
        private string m_OverRange;
        private string m_TareRange;

        private int m_OverRangeDeviation;
        private int m_UnderRangeDeviation;        

        private int m_ProgressBarMaximum;
        private int m_ProgressBarMinimum;

        private Collection<int> m_CollectionNormalDistributionRange;
        private Collection<int> m_CollectionNormalDistributionViewRange;
        #endregion

        #region Constructor
        public ProductItem()
        {
            this.Initialization();
        }
        #endregion

        #region Property
        public int Number
        {
            get { return this.m_Number; }
            set { this.m_Number = value; }
        }

        public string Name
        {
            get { return this.m_Name; }
            set { this.m_Name = value; }
        }
        public string LotNo
        {
            get { return this.m_LotNo; }
            set { this.m_LotNo = value; }
        }
        public string UnderRange
        {
            get { return this.m_UnderRange; }
            set
            {
                this.m_UnderRange = value;
                this.m_UnderRangeDeviation = this.UnderRangeInt - this.PassRangeInt;

                this.ProgressBarLevelRescale();
                this.NormalDistributionRangeCalculation();
            }
        }
        public string PassRange
        {
            get { return this.m_PassRange; }
            set
            {
                this.m_PassRange = value;
             
                this.NormalDistributionRangeCalculation();
            }
        }
        public string OverRange
        {
            get { return this.m_OverRange; }
            set
            {
                this.m_OverRange = value;
                this.m_OverRangeDeviation = this.OverRangeInt - this.PassRangeInt;

                this.ProgressBarLevelRescale();
                this.NormalDistributionRangeCalculation();
            }
        }
        public string TareRange
        {
            get { return this.m_TareRange; }
            set { this.m_TareRange = value; }
        }

        public int OverRangeDeviation
        {
            get { return this.m_OverRangeDeviation; }
            //set
            //{
            //    int iValue = 0;
                
            //    iValue = this.OverRangeInt - Math.Abs(value);
                
            //    this.m_OverRange = iValue.ToString();
            //    this.m_OverRangeDeviation = value;
            //}
        }
        public int UnderRangeDeviation
        {
            get { return this.m_UnderRangeDeviation; }
            //set
            //{
            //    int iValue = 0;

            //    iValue = this.UnderRangeInt - Math.Abs(value);

            //    this.m_UnderRange = iValue.ToString();
            //    this.m_UnderRangeDeviation = value; 
            //}
        } 

        public int UnderRangeInt
        {
            get
            {
                if (this.UnderRange == null)
                    return -1;
                else
                    return int.Parse(this.UnderRange);
            }
        }
        public int PassRangeInt
        {
            get
            {
                if (this.PassRange == null)
                    return -1;
                else
                    return int.Parse(this.PassRange);
            }
        }
        public int OverRangeInt
        {
            get
            {
                if (this.OverRange == null)
                    return -1;
                else
                    return int.Parse(this.OverRange);
            }
        }
        public int TareRangeInt
        {
            get { return int.Parse(this.TareRange); }
        }

        public int ProgressBarMaximum
        {
            get { return this.m_ProgressBarMaximum; }
            private set { this.m_ProgressBarMaximum = value; }
        }
        public int ProgressBarMinimum
        {
            get { return this.m_ProgressBarMinimum; }
            private set { this.m_ProgressBarMinimum = value; }
        }

        public Collection<int> CollectionNormalDistributionRange
        {
            get { return this.m_CollectionNormalDistributionRange; }
            private set { this.m_CollectionNormalDistributionRange = value; }
        }
        public Collection<int> CollectionNormalDistributionViewRange
        {
            get { return this.m_CollectionNormalDistributionViewRange; }
            private set { this.m_CollectionNormalDistributionViewRange = value; }
        } 
        #endregion

        #region Method
        public void Initialization()
        {
            this.CollectionNormalDistributionRange = new Collection<int>();
            this.CollectionNormalDistributionRange.Clear();
            for (int i = 0; i < 8; i++)
                this.CollectionNormalDistributionRange.Add(0);

            this.CollectionNormalDistributionViewRange = new Collection<int>();
            this.CollectionNormalDistributionViewRange.Clear();
            for (int i = 0; i < 9; i++)
                this.CollectionNormalDistributionViewRange.Add(0);

            this.Number = 1;
            this.Name = "ProductName 1";
            this.LotNo = "Lot 1";
            this.PassRange = "2000";
            this.UnderRange = "1000";
            this.OverRange = "3000";
            this.TareRange = "0";

            this.ProgressBarMinimum = 0;
            this.ProgressBarMaximum = 5000;
        }

        private void ProgressBarLevelRescale()
        {
            int minBar, maxBar, gap;
            int OverRange, UnderRange;

            if (this.OverRange == null || this.UnderRange == null)
                return;

            OverRange = int.Parse(this.OverRange);
            UnderRange = int.Parse(this.UnderRange);

            gap = OverRange - UnderRange;

            minBar = UnderRange - gap;
            maxBar = OverRange + gap;

            this.ProgressBarMaximum = maxBar;
            this.ProgressBarMinimum = minBar;
        }

        private void NormalDistributionRangeCalculation()
        {
            int overGap = 0, underGap = 0, gap = 0, gap1 = 0;

            if (this.OverRangeInt == -1 || this.PassRangeInt == -1 || this.UnderRangeInt == -1)
                return;

            overGap = this.OverRangeInt - this.PassRangeInt;
            underGap = this.PassRangeInt - this.UnderRangeInt;

            if (overGap > underGap)
                gap = overGap;
            else
                gap = underGap;

            gap1 = gap / 5;

            if (gap1 == 0)
                gap1 = gap;

            this.CollectionNormalDistributionViewRange[0] = gap1 * 12;
            this.CollectionNormalDistributionViewRange[1] = gap1 * 9;
            this.CollectionNormalDistributionViewRange[2] = gap1 * 6;
            this.CollectionNormalDistributionViewRange[3] = gap1 * 3;
            this.CollectionNormalDistributionViewRange[4] = 0;
            this.CollectionNormalDistributionViewRange[5] = gap1 * 3;
            this.CollectionNormalDistributionViewRange[6] = gap1 * 6;
            this.CollectionNormalDistributionViewRange[7] = gap1 * 9;
            this.CollectionNormalDistributionViewRange[8] = gap1 * 12;

            this.CollectionNormalDistributionRange[0] = this.PassRangeInt + (gap1 * 9) + 1;
            this.CollectionNormalDistributionRange[1] = this.PassRangeInt + (gap1 * 6) + 1;
            this.CollectionNormalDistributionRange[2] = this.PassRangeInt + (gap1 * 3) + 1;
            this.CollectionNormalDistributionRange[3] = this.PassRangeInt + gap1 + 1;
            this.CollectionNormalDistributionRange[4] = this.PassRangeInt - gap1 + 1;
            this.CollectionNormalDistributionRange[5] = this.PassRangeInt - (gap1 * 3) + 1;
            this.CollectionNormalDistributionRange[6] = this.PassRangeInt - (gap1 * 6) + 1;
            this.CollectionNormalDistributionRange[7] = this.PassRangeInt - (gap1 * 9) + 1;
        }
        #endregion
    }
    #endregion
    #region StructProductItem
    [StructLayout(LayoutKind.Sequential)]
    public struct StructProductItem
    {
        public int Number;

        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
        public string Name;

        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
        public string LotNo;

        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 14)]
        public string OverRange;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 14)]
        public string UnderRange;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 14)]
        public string PassRange;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 14)]
        public string TareRange;

        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 14)]
        public string DummyString1;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 14)]
        public string DummyString2;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
        public string DummyString3;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
        public string DummyString4;
    }
    #endregion
    
    #region WeightData
    public class WeightData
    {
        #region Field
        private bool m_IsLoadCellError;
        private bool m_IsEntrySensorError;
        private bool m_IsInverterError;
        private bool m_IsPressureSensingError;
        private bool m_IsEmergencyStop;
        private bool m_IsDoorInterlock;
        private bool m_IsEntryNotDetected;
        private bool m_IsEntryStucked;

        private DateTime m_StartTime;
        private DateTime m_StopTime;

        private int m_UnderCount;
        private double m_UnderSumWeight;
        
        private int m_PassCount;
        private double m_PassSumWeight;
        
        private int m_OverCount;
        private double m_OverSumWeight;

        private int m_MetalDetectionCount;
        private double m_MetalDetectionSumWeight;

        private int m_DoubleEntryCount;
        private double m_DoubleEntrySumWeight;
        
        private int m_ETCExNGCount;
        private double m_ETCExNGSumWeight;

        private double m_Weight;
        private Define.E_JudgmentStatus m_JudgmentStatus;
        private Define.E_WeightStatus m_Status;

        private string m_ADCValue;
        private int m_ProductionSpeed;

        private int PreviousTimeTickCount;
        private bool m_IsStart;

        private string m_WeightString;

        private Collection<int> m_CollectionNormalDistributionCount;
        #endregion

        #region Constructor
        public WeightData()
        {
            this.Initialization();
        }
        #endregion

        #region Property
        public bool IsLoadCellError
        {
            get { return this.m_IsLoadCellError; }
            set { this.m_IsLoadCellError = value; }
        }
        public bool IsEntrySensorError
        {
            get { return this.m_IsEntrySensorError; }
            set { this.m_IsEntrySensorError = value; }
        }
        public bool IsInverterError
        {
            get { return this.m_IsInverterError; }
            set { this.m_IsInverterError = value; }
        }
        public bool IsPressureSensingError
        {
            get { return this.m_IsPressureSensingError; }
            set { this.m_IsPressureSensingError = value; }
        }
        public bool IsEmergencyStop
        {
            get { return this.m_IsEmergencyStop; }
            set { this.m_IsEmergencyStop = value; }
        }
        public bool IsDoorInterlock
        {
            get { return this.m_IsDoorInterlock; }
            set { this.m_IsDoorInterlock = value; }
        }
        public bool IsEntryNotDetected
        {
            get { return this.m_IsEntryNotDetected; }
            set { this.m_IsEntryNotDetected = value; }
        }
        public bool IsEntryStucked
        {
            get { return this.m_IsEntryStucked; }
            set { this.m_IsEntryStucked = value; }
        }

        public DateTime StartTime
        {
            get { return this.m_StartTime; }
            set { this.m_StartTime = value; }
        }
        public DateTime StopTime
        {
            get { return this.m_StopTime; }
            set { this.m_StopTime = value; }
        } 

        public int UnderCount
        {
            get { return this.m_UnderCount; }
            set { this.m_UnderCount = value; }
        }
        public double UnderSumWeight
        {
            get { return this.m_UnderSumWeight; }
            set { this.m_UnderSumWeight = value; }
        } 
        public string UnderRatio
        {
            get
            {
                string ret = "";

                if (this.UnderCount == 0 || this.TotalCount == 0)
                    ret = "0.00";
                else
                    ret = string.Format("{0:##0.00}", (float.Parse(this.UnderCount.ToString()) * 100.0F) / this.TotalCount);

                return ret;
            }
        }
        public double UnderAverage
        {
            get
            {
                double ret = 0.0;

                if (this.UnderCount == 0 || this.UnderSumWeight == 0.0)
                    ret = 0.0;
                else
                    ret = this.UnderSumWeight / this.UnderCount;

                return ret;
            }
        }
        public string UnderSumWeightKG
        {
            get 
            {
                string temp = "", ret = "";

                temp = string.Format("{0:f0}", this.UnderSumWeight);
                ret = string.Format("{0:0.00}", int.Parse(temp) / 1000);

                return ret;
            }
        }

        public int PassCount
        {
            get { return this.m_PassCount; }
            set { this.m_PassCount = value; }
        }
        public double PassSumWeight
        {
            get { return this.m_PassSumWeight; }
            set { this.m_PassSumWeight = value; }
        } 
        public string PassRatio
        {
            get
            {
                string ret = "";

                if (this.PassCount == 0 || this.TotalCount == 0)
                    ret = "0.00";
                else
                    ret = string.Format("{0:##0.00}", (float.Parse(this.PassCount.ToString()) * 100.0F) / this.TotalCount);

                return ret;
            }
        }
        public double PassAverage
        {
            get 
            {
                double ret = 0.0;

                if (this.PassCount == 0 || this.PassSumWeight == 0.0)
                    ret = 0.0;
                else
                    ret = this.PassSumWeight / this.PassCount;

                return ret;
            }
        }
        public string PassSumWeightKG
        {
            get
            {
                string temp = "", ret = "";

                temp = string.Format("{0:f0}", this.PassSumWeight);
                ret = string.Format("{0:0.00}", int.Parse(temp) / 1000);

                return ret;
            }
        }

        public int OverCount
        {
            get { return this.m_OverCount; }
            set { this.m_OverCount = value; }
        }
        public double OverSumWeight
        {
            get { return this.m_OverSumWeight; }
            set { this.m_OverSumWeight = value; }
        } 
        public string OverRatio
        {
            get
            {
                string ret = "";

                if (this.OverCount == 0 || this.TotalCount == 0)
                    ret = "0.00";
                else
                    ret = string.Format("{0:##0.00}", (float.Parse(this.OverCount.ToString()) * 100.0F) / this.TotalCount);

                return ret;
            }
        }
        public double OverAverage
        {
            get 
            {
                double ret = 0.0;

                if (this.OverCount == 0 || this.OverSumWeight == 0.0)
                    ret = 0.0;
                else
                    ret = this.OverSumWeight / this.OverCount;

                return ret;
            }
        }
        public string OverSumWeightKG
        {
            get
            {
                string temp = "", ret = "";

                temp = string.Format("{0:f0}", this.OverSumWeight);
                ret = string.Format("{0:0.00}", int.Parse(temp) / 1000);

                return ret;
            }
        }

        // Under + Over
        public double NGAverage
        {
            get
            {
                double ret = 0.0;

                if (this.OverCount + this.UnderCount == 0)
                    ret = 0.0;
                else
                    ret = (this.OverSumWeight + this.UnderSumWeight) / (this.OverCount + this.UnderCount);

                return ret;
            }
        }

        public int MetalDetectionCount
        {
            get { return this.m_MetalDetectionCount; }
            set { this.m_MetalDetectionCount = value; }
        }
        public double MetalDetectionSumWeight
        {
            get { return this.m_MetalDetectionSumWeight; }
            set { this.m_MetalDetectionSumWeight = value; }
        }
        public string MetalDetectionRatio
        {
            get
            {
                string ret = "";

                if (this.MetalDetectionCount == 0 || this.TotalCount == 0)
                    ret = "0.00";
                else
                    ret = string.Format("{0:##0.00}", (float.Parse(this.MetalDetectionCount.ToString()) * 100.0F) / this.TotalCount);

                return ret;
            }
        }
        public double MetalDetectionAverage
        {
            get
            {
                double ret = 0.0;

                if (this.MetalDetectionCount == 0 || this.MetalDetectionSumWeight == 0.0)
                    ret = 0.0;
                else
                    ret = this.MetalDetectionSumWeight / this.MetalDetectionCount;

                return ret;
            }
        }
        public string MetalDetectionSumWeightKG
        {
            get
            {
                string temp = "", ret = "";

                temp = string.Format("{0:f0}", this.MetalDetectionSumWeight);
                ret = string.Format("{0:0.00}", double.Parse(temp) / 1000);

                return ret;
            }
        }

        public int DoubleEntryCount
        {
            get { return this.m_DoubleEntryCount; }
            set { this.m_DoubleEntryCount = value; }
        }
        public double DoubleEntrySumWeight
        {
            get { return this.m_DoubleEntrySumWeight; }
            set { this.m_DoubleEntrySumWeight = value; }
        }
        public string DoubleEntryRatio
        {
            get
            {
                string ret = "";

                if (this.DoubleEntryCount == 0 || this.TotalCount == 0)
                    ret = "0.00";
                else
                    ret = string.Format("{0:##0.00}", (float.Parse(this.DoubleEntryCount.ToString()) * 100.0F) / this.TotalCount);

                return ret;
            }
        }
        public double DoubleEntryAverage
        {
            get
            {
                double ret = 0.0;

                if (this.DoubleEntryCount == 0 || this.DoubleEntrySumWeight == 0.0)
                    ret = 0.0;
                else
                    ret = this.DoubleEntrySumWeight / this.DoubleEntryCount;

                return ret;
            }
        }
        public string DoubleEntrySumWeightKG
        {
            get
            {
                string temp = "", ret = "";

                temp = string.Format("{0:f0}", this.DoubleEntrySumWeight);
                ret = string.Format("{0:0.00}", double.Parse(temp) / 1000);

                return ret;
            }
        }

        public int ETCExNGCount
        {
            get { return this.m_ETCExNGCount; }
            set { this.m_ETCExNGCount = value; }
        }
        public double ETCExNGSumWeight
        {
            get { return this.m_ETCExNGSumWeight; }
            set { this.m_ETCExNGSumWeight = value; }
        }

        public int ExNGCount
        {
            get { return this.MetalDetectionCount + this.DoubleEntryCount + this.ETCExNGCount; }
        }
        public string ExNGRatio
        {
            get
            {
                string ret = "";

                if (this.ExNGCount == 0 || this.TotalCount == 0)
                    ret = "0.00";
                else
                    ret = string.Format("{0:##0.00}", (float.Parse(this.ExNGCount.ToString()) * 100.0F) / this.TotalCount);

                return ret;
            }
        }
        public double ExNGSumWeight
        {
            get { return this.MetalDetectionSumWeight + this.DoubleEntrySumWeight + this.ETCExNGSumWeight; }
        }
        public string ExNGSumWeightKG
        {
            get
            {
                string temp = "", ret = "";

                temp = string.Format("{0:f0}", this.ExNGSumWeight);
                ret = string.Format("{0:0.00}", double.Parse(temp) / 1000);

                return ret;
            }
        }

        public int TotalUnderOverCount
        {
            get { return this.UnderCount + this.OverCount; }
        }
        public int TotalNGCount
        {
            get { return this.UnderCount + this.OverCount + this.ETCExNGCount; }
        }
        public string TotalSumWeightKG
        {
            get
            {
                string temp = "", ret = "";

                temp = string.Format("{0:f0}", this.OverSumWeight + this.PassSumWeight + this.UnderSumWeight + this.ExNGSumWeight);
                ret = string.Format("{0:0.00}", double.Parse(temp) / 1000);

                return ret;
            }
        }

        /// <summary>
        /// Under+Pass+Over+ExNG
        /// </summary>
        public int TotalCount
        {
            get { return this.UnderCount + this.PassCount + this.OverCount + this.ETCExNGCount; }
        }
        /// <summary>
        /// Under+Pass+Over
        /// </summary>
        //public int TotalCount2
        //{
        //    get { return this.UnderCount + this.PassCount + this.OverCount; }
        //}

        public double Weight
        {
            get { return this.m_Weight; }
            set { this.m_Weight = value; }
        }

        public string ADCValue
        {
            get { return this.m_ADCValue; }
            set { this.m_ADCValue = value; }
        }

        public Define.E_JudgmentStatus JudgmentStatus
        {
            get { return this.m_JudgmentStatus; }
            set
            {
                this.m_JudgmentStatus = value;

                if (value == Define.E_JudgmentStatus.Under)
                {
                    if (this.UnderCount < 10000000)
                        this.UnderCount++;
                    else
                        this.UnderCount = 0;
                }
                else if (value == Define.E_JudgmentStatus.Pass)
                {
                    if (this.PassCount < 10000000)
                        this.PassCount++;
                    else
                        this.PassCount = 0;
                }
                else if (value == Define.E_JudgmentStatus.Over)
                {
                    if (this.OverCount < 10000000)
                        this.OverCount++;
                    else
                        this.OverCount = 0;
                }
                else if (value == Define.E_JudgmentStatus.Double || value == Define.E_JudgmentStatus.Metal
                    || value == Define.E_JudgmentStatus.ExNg)
                {
                    if (this.ETCExNGCount < 10000000)
                        this.ETCExNGCount++;
                    else
                        this.ETCExNGCount = 0;
                }
            }
        }

        public Define.E_WeightStatus Status
        {
            get { return this.m_Status; }
            set { this.m_Status = value; }
        }

        public int ProductionSpeed
        {
            get { return this.m_ProductionSpeed; }
            set { this.m_ProductionSpeed = value; }
        }
        public bool IsStart
        {
            get { return this.m_IsStart; }
            set { this.m_IsStart = value; }
        }

        public string WeightString
        {
            get { return this.m_WeightString; }
            set { this.m_WeightString = value; }
        }

        public Collection<int> CollectionNormalDistributionCount
        {
            get { return this.m_CollectionNormalDistributionCount; }
            set { this.m_CollectionNormalDistributionCount = value; }
        } 
        #endregion

        #region Mehtod
        public void ClearCount()
        {
            this.UnderCount = 0;
            this.UnderSumWeight = 0.0;
            this.PassCount = 0;
            this.PassSumWeight = 0.0;
            this.OverCount = 0;
            this.OverSumWeight = 0.0;
            this.ETCExNGCount = 0;

            this.StartTime = new DateTime(1111, 11, 11, 11, 11, 11);
            this.StopTime = new DateTime(1111, 11, 11, 11, 11, 11);

            for (int i = 0; i < this.CollectionNormalDistributionCount.Count; i++)
                this.CollectionNormalDistributionCount[i] = 0;
        }

        private void Initialization()
        {
            this.IsLoadCellError = false;
            this.IsEntrySensorError = false;
            this.IsInverterError = false;
            this.IsPressureSensingError = false;
            this.IsDoorInterlock = false;
            this.IsEntryNotDetected = false;
            this.IsEntryStucked = false;

            this.StartTime = new DateTime(1111, 11, 11, 11, 11, 11);
            this.StopTime = new DateTime(1111, 11, 11, 11, 11, 11);
            this.UnderCount = 0;
            this.UnderSumWeight = 0.0;
            this.PassCount = 0;
            this.PassSumWeight = 0.0;
            this.OverCount = 0;
            this.OverSumWeight = 0.0;
            this.ETCExNGCount = 0;
            this.Weight = 0.0;
            this.ADCValue = "12345";
            this.JudgmentStatus = Define.E_JudgmentStatus.Empty;
            this.Status = Define.E_WeightStatus.Empty;
            this.ProductionSpeed = 0;
            this.WeightString = "0";

            this.CollectionNormalDistributionCount = new Collection<int>();
            this.CollectionNormalDistributionCount.Clear();
            for (int i = 0; i < 10; i++)
                this.CollectionNormalDistributionCount.Add(0);
        }

        private void ProductionSpeedCalculation()
        {
            int currentTimeTickCount = 0, gap = 0;
            double millisecond = 0.0, speed = 0.0;

            if (this.IsStart == false)
            {
                this.PreviousTimeTickCount = Environment.TickCount & Int32.MaxValue;
                this.IsStart = true;
            }
            else
            {
                currentTimeTickCount = Environment.TickCount & Int32.MaxValue;
                gap = Math.Abs(currentTimeTickCount - this.PreviousTimeTickCount);
                millisecond = gap / 1000.0;
                speed = 60 / millisecond;
                this.ProductionSpeed = int.Parse(string.Format("{0:f0}", speed));

                this.PreviousTimeTickCount = Environment.TickCount;
            }
        }

        public void WeightSum(Define.E_JudgmentStatus status)
        {
            if (status == Define.E_JudgmentStatus.Over)
                this.OverSumWeight += this.Weight;
            else if (status == Define.E_JudgmentStatus.Pass)
                this.PassSumWeight += this.Weight;
            else if (status == Define.E_JudgmentStatus.Under)
                this.UnderSumWeight += this.Weight;
        }

        public void SetNormalDistribution(Collection<int> collectionRange, string weight)
        {
            int value = 0;

            value = int.Parse(weight);

            for (int i = 0; i < this.CollectionNormalDistributionCount.Count; i++)
            {
                if (i == collectionRange.Count)
                {
                    this.CollectionNormalDistributionCount[i]++;
                    break;
                }

                if (collectionRange[i] < value)
                {
                    this.CollectionNormalDistributionCount[i]++;
                    break;
                }
            }
        }
        #endregion
    }
    #endregion
    #region StructCounter
    [StructLayout(LayoutKind.Sequential)]
    public struct StructCounterItem
    {
        public int OverCount;
        public int PassCount;
        public int UnderCount;
        public int ExNGCount;

        public int NormalDistribution1;
        public int NormalDistribution2;
        public int NormalDistribution3;
        public int NormalDistribution4;
        public int NormalDistribution5;
        public int NormalDistribution6;
        public int NormalDistribution7;
        public int NormalDistribution8;
        public int NormalDistribution9;
        public int NormalDistribution10;

        public double OverSumWeight;
        public double PassSumWeight;
        public double UnderSumWeight;

        public DateTime StartTime;
        public DateTime StopTime;

        public int DummyInt1;
        public int DummyInt2;
        public int DummyInt3;
        public int DummyInt4;
        public int DummyInt5;
    }
    #endregion

    #region JudgmentSetItem
    public class JudgmentSetItem
    {
        #region Field
        private int m_Filter;
        private int m_JudgmentDelayTime;
        private int m_DoubleDelayTime;
        private int m_JudgmentCount;
        private int m_FeedSpeed1;
        private int m_FeedSpeed2;
        private int m_FeedSpeed3;
        private double m_DynamicCorrection;

        private int m_Sorter1Mode;
        private int m_Sorter1DelayTime;
        private int m_Sorter1RunTime;
        private int m_Sorter2Mode;
        private int m_Sorter2DelayTime;
        private int m_Sorter2RunTime;

        private int m_AutoJudgmentLength;
        private int m_AutoJudgment1;
        private int m_AutoJudgment2;
        private int m_AutoJudgment3;

        private int m_DescendDelayTime;
        private int m_AscendDelayTime;
        #endregion

        #region Constructor
        public JudgmentSetItem()
        {
            this.Initialization();
        }
        #endregion

        #region Property
        public int Filter
        {
            get { return this.m_Filter; }
            set { this.m_Filter = value; }
        }
        public int JudgmentDelayTime
        {
            get { return this.m_JudgmentDelayTime; }
            set { this.m_JudgmentDelayTime = value; }
        }
        public int DoubleDelayTime
        {
            get { return this.m_DoubleDelayTime; }
            set { this.m_DoubleDelayTime = value; }
        }
        public int JudgmentCount
        {
            get { return this.m_JudgmentCount; }
            set { this.m_JudgmentCount = value; }
        }
        public int FeedSpeed1
        {
            get { return this.m_FeedSpeed1; }
            set { this.m_FeedSpeed1 = value; }
        }
        public int FeedSpeed2
        {
            get { return this.m_FeedSpeed2; }
            set { this.m_FeedSpeed2 = value; }
        }
        public int FeedSpeed3
        {
            get { return this.m_FeedSpeed3; }
            set { this.m_FeedSpeed3 = value; }
        } 
        public double DynamicCorrection
        {
            get { return this.m_DynamicCorrection; }
            set { this.m_DynamicCorrection = value; }
        }

        public int Sorter1Mode
        {
            get { return this.m_Sorter1Mode; }
            set { this.m_Sorter1Mode = value; }
        }
        public int Sorter1DelayTime
        {
            get { return this.m_Sorter1DelayTime; }
            set { this.m_Sorter1DelayTime = value; }
        }
        public int Sorter1RunTime
        {
            get { return this.m_Sorter1RunTime; }
            set { this.m_Sorter1RunTime = value; }
        }
        public int Sorter2Mode
        {
            get { return this.m_Sorter2Mode; }
            set { this.m_Sorter2Mode = value; }
        }
        public int Sorter2DelayTime
        {
            get { return this.m_Sorter2DelayTime; }
            set { this.m_Sorter2DelayTime = value; }
        }
        public int Sorter2RunTime
        {
            get { return this.m_Sorter2RunTime; }
            set { this.m_Sorter2RunTime = value; }
        }

        public int AutoJudgmentLength
        {
            get { return this.m_AutoJudgmentLength; }
            set { this.m_AutoJudgmentLength = value; }
        }
        public int AutoJudgment1
        {
            get { return this.m_AutoJudgment1; }
            set { this.m_AutoJudgment1 = value; }
        }
        public int AutoJudgment2
        {
            get { return this.m_AutoJudgment2; }
            set { this.m_AutoJudgment2 = value; }
        }
        public int AutoJudgment3
        {
            get { return this.m_AutoJudgment3; }
            set { this.m_AutoJudgment3 = value; }
        }

        public int DescendDelayTime
        {
            get { return this.m_DescendDelayTime; }
            set { this.m_DescendDelayTime = value; }
        }
        public int AscendDelayTime
        {
            get { return this.m_AscendDelayTime; }
            set { this.m_AscendDelayTime = value; }
        } 
        #endregion

        #region Method
        public void Initialization()
        {
            this.Filter = 8;
            this.JudgmentDelayTime = 1000;
            this.DoubleDelayTime = 900;
            this.JudgmentCount = 10;
            this.FeedSpeed1 = 60;
            this.FeedSpeed2 = 60;
            this.FeedSpeed3 = 60;
            this.DynamicCorrection = 1.000000;

            this.Sorter1Mode = 0;
            this.Sorter1DelayTime = 1;
            this.Sorter1RunTime = 1000;
            this.Sorter2Mode = 0;
            this.Sorter2DelayTime = 1;
            this.Sorter2RunTime = 1000;

            this.AutoJudgmentLength = 100;
            this.AutoJudgment1 = 100;
            this.AutoJudgment2 = 100;
            this.AutoJudgment3 = 100;

            this.DescendDelayTime = 400;
            this.AscendDelayTime = 200;
        }
        #endregion
    }
    #endregion
    #region Struct JudgmentSetItem
    [StructLayout(LayoutKind.Sequential)]
    public struct StructJudgmentSetItem
    {
        public int Filter;
        public int JudgmentDelayTime;
        public int DoubleDelayTime;
        public int JudgmentCount;
        public int FeedSpeed1;
        public int FeedSpeed2;
        public int FeedSpeed3;
        public double DynamicCorrection;

        public int Sorter1Mode;
        public int Sorter1DelayTime;
        public int Sorter1RunTime;
        public int Sorter2Mode;
        public int Sorter2DelayTime;
        public int Sorter2RunTime;

        public int AutoJudgmentLength;
        public int AutoJudgment1;
        public int AutoJudgment2;
        public int AutoJudgment3;

        public int DescendDelayTime;
        public int AscendDelayTime;
        public int DummyInt1;
        public int DummyInt2;
        public int DummyInt3;

        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
        public string DummyString1;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
        public string DummyString2;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
        public string DummyString3;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
        public string DummyString4;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
        public string DummyString5;
    }
    #endregion

    #region CalibrationItem
    public class CalibrationItem
    {
        #region Field
        private string m_BalanceWeight;
        private string m_MaxWeight;
        private string m_Digit;
        private string m_Constant1;
        private string m_Constant2;
        #endregion

        #region Constructor
        public CalibrationItem()
        {
            this.BalanceWeight = "5000";
            this.MaxWeight = "9999";
            this.Digit = "1";
            this.Constant1 = "1.000000";
            this.Constant2 = "1.000000";
        }
        #endregion

        #region Property
        public string BalanceWeight
        {
            get { return this.m_BalanceWeight; }
            set { this.m_BalanceWeight = value; }
        }
        public string MaxWeight
        {
            get { return this.m_MaxWeight; }
            set { this.m_MaxWeight = value; }
        }
        public string Digit
        {
            get { return this.m_Digit; }
            set { this.m_Digit = value; }
        }
        public string Constant1
        {
            get { return this.m_Constant1; }
            set { this.m_Constant1 = value; }
        }
        public string Constant2
        {
            get { return this.m_Constant2; }
            set { this.m_Constant2 = value; }
        } 
        #endregion
    }
    #endregion

    #region FeedbackItem
    public class FeedbackItem
    {
        #region Field
        private string m_SampleCount;
        private string m_DelayCount;
        private string m_Sign;
        private string m_FeedbackWeight;

        private string m_UnderRangeDeviation;
        private string m_OverRangeDeviation;
        #endregion

        #region Constructor
        public FeedbackItem()
        {
            this.SampleCount = "0";
            this.DelayCount = "0";
            this.Sign = "+";
            this.FeedbackWeight = "0";

            this.UnderRangeDeviation = "0";
            this.OverRangeDeviation = "0";
        }
        #endregion

        #region Property
        public string SampleCount
        {
            get { return this.m_SampleCount; }
            set { this.m_SampleCount = value; }
        }
        public string DelayCount
        {
            get { return this.m_DelayCount; }
            set { this.m_DelayCount = value; }
        }
        public string Sign
        {
            get { return this.m_Sign; }
            set { this.m_Sign = value; }
        }
        public string FeedbackWeight
        {
            get { return this.m_FeedbackWeight; }
            set { this.m_FeedbackWeight = value; }
        }

        public string UnderRangeDeviation
        {
            get { return this.m_UnderRangeDeviation; }
            set { this.m_UnderRangeDeviation = value; }
        }
        public string OverRangeDeviation
        {
            get { return this.m_OverRangeDeviation; }
            set { this.m_OverRangeDeviation = value; }
        }
        public int OverRangeDeviationInt
        {
            get
            {
                if (this.OverRangeDeviation == null)
                    return -1;
                else
                    return int.Parse(this.OverRangeDeviation);
            }
        }
        public int UnderRangeDeviationInt
        {
            get
            {
                if (this.UnderRangeDeviation == null)
                    return -1;
                else
                    return int.Parse(this.UnderRangeDeviation);
            }
        }
        #endregion

        #region Method
        #endregion
    }
    #endregion

    #region SystemParameter9507
    public class SystemParameter9507
    {
        #region Field
        private string m_BuzzerOnTime;
        private string m_RelayOnTime;
        private string m_SensorChattering;
        private string m_SorterDoubleEntry;
        private string m_EntryNotDetectedWeight;
        private string m_OptionBoard;        
        private string m_SwitchChattering;

        private string m_Dummy2;
        private string m_Dummy3;
        private string m_Dummy4;
        private string m_Dummy5;
        private string m_Dummy6;
        private string m_Dummy7;
        private string m_Dummy8;
        private string m_Dummy9;
        private string m_Dummy10;
        private string m_Dummy11;
        #endregion

        #region Constructor
        public SystemParameter9507()
        {
            this.Initialization();
        }
        #endregion

        #region Property
        public string BuzzerOnTime
        {
            get { return this.m_BuzzerOnTime; }
            set { this.m_BuzzerOnTime = value; }
        }
        public string RelayOnTime
        {
            get { return this.m_RelayOnTime; }
            set { this.m_RelayOnTime = value; }
        }
        public string SensorChattering
        {
            get { return this.m_SensorChattering; }
            set { this.m_SensorChattering = value; }
        }
        public string SorterDoubleEntry
        {
            get { return this.m_SorterDoubleEntry; }
            set { this.m_SorterDoubleEntry = value; }
        }
        public string EntryNotDetectedWeight
        {
            get { return this.m_EntryNotDetectedWeight; }
            set { this.m_EntryNotDetectedWeight = value; }
        }
        public string OptionBoard
        {
            get { return this.m_OptionBoard; }
            set { this.m_OptionBoard = value; }
        }
        public string SwitchChattering
        {
            get { return this.m_SwitchChattering; }
            set { this.m_SwitchChattering = value; }
        }

        public string Dummy2
        {
            get { return this.m_Dummy2; }
            set { this.m_Dummy2 = value; }
        }
        public string Dummy3
        {
            get { return this.m_Dummy3; }
            set { this.m_Dummy3 = value; }
        }
        public string Dummy4
        {
            get { return this.m_Dummy4; }
            set { this.m_Dummy4 = value; }
        }
        public string Dummy5
        {
            get { return this.m_Dummy5; }
            set { this.m_Dummy5 = value; }
        }
        public string Dummy6
        {
            get { return this.m_Dummy6; }
            set { this.m_Dummy6 = value; }
        }
        public string Dummy7
        {
            get { return this.m_Dummy7; }
            set { this.m_Dummy7 = value; }
        }
        public string Dummy8
        {
            get { return this.m_Dummy8; }
            set { this.m_Dummy8 = value; }
        }
        public string Dummy9
        {
            get { return this.m_Dummy9; }
            set { this.m_Dummy9 = value; }
        }
        public string Dummy10
        {
            get { return this.m_Dummy10; }
            set { this.m_Dummy10 = value; }
        }
        public string Dummy11
        {
            get { return this.m_Dummy11; }
            set { this.m_Dummy11 = value; }
        }
        #endregion

        #region Method
        private void Initialization()
        {
            this.BuzzerOnTime = "1000";
            this.RelayOnTime = "500";
            this.SensorChattering = "0";
            this.SorterDoubleEntry = "0";
            this.EntryNotDetectedWeight = "0";
            this.OptionBoard = "0";            
            this.SwitchChattering = "200";

            this.Dummy2 = "0";
            this.Dummy3 = "0";
            this.Dummy4 = "0";
            this.Dummy5 = "0";
            this.Dummy6 = "0";
            this.Dummy7 = "0";
            this.Dummy8 = "0";
            this.Dummy9 = "0";
            this.Dummy10 = "0";
            this.Dummy11 = "0";
        }
        #endregion
    } 
    #endregion
    #region StructSystemParameter9507
    [StructLayout(LayoutKind.Sequential)]
    public struct StructSystemParameter9507
    {
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string Serial1Mode;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string Serial1BaudRate;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string BuzzerOnTime;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string RelayOnTime;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string SensorChattering;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string SorterDoubleEntry;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string SorterExternalNgInput;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string StopWeighting;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string ExternalOperation;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string InitialDrive;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string PressureSensing;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string StackSensing;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string SorterDetecting;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string OptionBoard;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string EntryNotDetectedWeight;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string SwitchChattering;

        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string Dummy2;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string Dummy3;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string Dummy4;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string Dummy5;
    }
    #endregion
    #region SystemParameter9508
    public class SystemParameter9508
    {
        #region Field
        private string m_OPT1SamplingCount;
        private string m_OPT1DelayCount;
        private string m_OPT1PulseWidth;
        private string m_OPT1IsWeightSetting;
        private string m_OPT1OverRange1;
        private string m_OPT1UnderRange1;
        private string m_OPT1Port;

        private string m_OPT2Port;
        private string m_OPT2DelayTime1;
        private string m_OPT2DelayTime2;

        private string m_OPT1OverRange2;
        private string m_OPT1UnderRange2;

        private string m_Dummy1;
        private string m_Dummy2;
        private string m_Dummy3;
        private string m_Dummy4; 
        private string m_Dummy5;
        #endregion

        #region Constructor
        public SystemParameter9508()
        {
            this.Initialization();
        }
        #endregion

        #region Property
        public string OPT1SamplingCount
        {
            get { return this.m_OPT1SamplingCount; }
            set { this.m_OPT1SamplingCount = value; }
        }
        public string OPT1DelayCount
        {
            get { return this.m_OPT1DelayCount; }
            set { this.m_OPT1DelayCount = value; }
        }
        public string OPT1PulseWidth
        {
            get { return this.m_OPT1PulseWidth; }
            set { this.m_OPT1PulseWidth = value; }
        }
        public string OPT1IsWeightSetting
        {
            get { return this.m_OPT1IsWeightSetting; }
            set { this.m_OPT1IsWeightSetting = value; }
        }
        public string OPT1OverRange1
        {
            get { return this.m_OPT1OverRange1; }
            set { this.m_OPT1OverRange1 = value; }
        }
        public string OPT1UnderRange1
        {
            get { return this.m_OPT1UnderRange1; }
            set { this.m_OPT1UnderRange1 = value; }
        } 
        public string OPT1Port
        {
            get { return this.m_OPT1Port; }
            set { this.m_OPT1Port = value; }
        }

        public int OPT1OverRange1Int
        {
            get
            {
                if (this.OPT1OverRange1 == null)
                    return -1;
                else
                    return int.Parse(this.OPT1OverRange1);
            }
        }
        public int OPT1UnderRange1Int
        {
            get
            {
                if (this.OPT1UnderRange1 == null)
                    return -1;
                else
                    return int.Parse(this.OPT1UnderRange1);
            }
        }

        public string OPT2Port
        {
            get { return this.m_OPT2Port; }
            set { this.m_OPT2Port = value; }
        }
        public string OPT2DelayTime1
        {
            get { return this.m_OPT2DelayTime1; }
            set { this.m_OPT2DelayTime1 = value; }
        }
        public string OPT2DelayTime2
        {
            get { return this.m_OPT2DelayTime2; }
            set { this.m_OPT2DelayTime2 = value; }
        }

        public string OPT1OverRange2
        {
            get { return this.m_OPT1OverRange2; }
            set { this.m_OPT1OverRange2 = value; }
        }
        public string OPT1UnderRange2
        {
            get { return this.m_OPT1UnderRange2; }
            set { this.m_OPT1UnderRange2 = value; }
        }

        public int OPT1OverRange2Int
        {
            get
            {
                if (this.OPT1OverRange2 == null)
                    return -1;
                else
                    return int.Parse(this.OPT1OverRange2);
            }
        }
        public int OPT1UnderRange2Int
        {
            get
            {
                if (this.OPT1UnderRange2 == null)
                    return -1;
                else
                    return int.Parse(this.OPT1UnderRange2);
            }
        }

        public string Dummy1
        {
            get { return this.m_Dummy1; }
            set { this.m_Dummy1 = value; }
        }
        public string Dummy2
        {
            get { return this.m_Dummy2; }
            set { this.m_Dummy2 = value; }
        }
        public string Dummy3
        {
            get { return this.m_Dummy3; }
            set { this.m_Dummy3 = value; }
        }
        public string Dummy4
        {
            get { return this.m_Dummy4; }
            set { this.m_Dummy4 = value; }
        }
        public string Dummy5
        {
            get { return this.m_Dummy5; }
            set { this.m_Dummy5 = value; }
        }
        #endregion

        #region Method
        public void Initialization()
        {
            this.OPT1SamplingCount = "0";
            this.OPT1DelayCount = "0";
            this.OPT1PulseWidth = "0";
            this.OPT1IsWeightSetting = "0";
            this.OPT1OverRange1 = "0";
            this.OPT1UnderRange1 = "0";
            this.OPT1Port = "0";

            this.OPT2Port = "0";
            this.OPT2DelayTime1 = "200";
            this.OPT2DelayTime2 = "200";

            this.OPT1OverRange2 = "0";
            this.OPT1UnderRange2 = "0";

            this.Dummy1 = "0";
            this.Dummy2 = "0";
            this.Dummy3 = "0";
            this.Dummy4 = "0";
            this.Dummy5 = "0";
        }
        #endregion
    } 
    #endregion
    #region StructSystemParameter9508
    [StructLayout(LayoutKind.Sequential)]
    public struct StructSystemParameter9508
    {
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string OPT1SamplingCount;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string OPT1DelayCount;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string OPT1PulseWidth;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string OPT1IsWeightSetting;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string OPT1OverRange1;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string OPT1UnderRange1;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string OPT1Port;

        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string OPT2Port;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string OPT2DelayTime1;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string OPT2DelayTime2;

        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string OPT1OverRange2;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string OPT1UnderRange2;

        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string Dummy1;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string Dummy2;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string Dummy3;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string Dummy4;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string Dummy5;
    }
    #endregion
    #region SystemParameter9509
    public class SystemParameter9509
    {
        #region Field
        private string m_ExternalOut1Mode;
        private string m_ExternalOut1DelayTime;
        private string m_ExternalOut1RunTime;

        private string m_ExternalOut2Mode;
        private string m_ExternalOut2DelayTime;
        private string m_ExternalOut2RunTime;

        private string m_ExternalOut3Mode;
        private string m_ExternalOut3DelayTime;
        private string m_ExternalOut3RunTime;

        private string m_ExternalOut4Mode;
        private string m_ExternalOut4DelayTime;
        private string m_ExternalOut4RunTime;

        private string m_ExternalOut9Mode;
        private string m_ExternalOut9DelayTime;
        private string m_ExternalOut9RunTime;

        private string m_ExternalOut10Mode;
        private string m_ExternalOut10DelayTime;
        private string m_ExternalOut10RunTime;

        private string m_Dummy1;
        private string m_Dummy2;
        #endregion

        #region Constructor
        public SystemParameter9509()
        {
            this.Initialization();
        }
        #endregion

        #region Property
        public string ExternalOut1Mode
        {
            get { return this.m_ExternalOut1Mode; }
            set { this.m_ExternalOut1Mode = value; }
        }
        public string ExternalOut1DelayTime
        {
            get { return this.m_ExternalOut1DelayTime; }
            set { this.m_ExternalOut1DelayTime = value; }
        }
        public string ExternalOut1RunTime
        {
            get { return this.m_ExternalOut1RunTime; }
            set { this.m_ExternalOut1RunTime = value; }
        }

        public string ExternalOut2Mode
        {
            get { return this.m_ExternalOut2Mode; }
            set { this.m_ExternalOut2Mode = value; }
        }
        public string ExternalOut2DelayTime
        {
            get { return this.m_ExternalOut2DelayTime; }
            set { this.m_ExternalOut2DelayTime = value; }
        }
        public string ExternalOut2RunTime
        {
            get { return this.m_ExternalOut2RunTime; }
            set { this.m_ExternalOut2RunTime = value; }
        }

        public string ExternalOut3Mode
        {
            get { return this.m_ExternalOut3Mode; }
            set { this.m_ExternalOut3Mode = value; }
        }
        public string ExternalOut3DelayTime
        {
            get { return this.m_ExternalOut3DelayTime; }
            set { this.m_ExternalOut3DelayTime = value; }
        }
        public string ExternalOut3RunTime
        {
            get { return this.m_ExternalOut3RunTime; }
            set { this.m_ExternalOut3RunTime = value; }
        }

        public string ExternalOut4Mode
        {
            get { return this.m_ExternalOut4Mode; }
            set { this.m_ExternalOut4Mode = value; }
        }
        public string ExternalOut4DelayTime
        {
            get { return this.m_ExternalOut4DelayTime; }
            set { this.m_ExternalOut4DelayTime = value; }
        }
        public string ExternalOut4RunTime
        {
            get { return this.m_ExternalOut4RunTime; }
            set { this.m_ExternalOut4RunTime = value; }
        }

        public string ExternalOut9Mode
        {
            get { return this.m_ExternalOut9Mode; }
            set { this.m_ExternalOut9Mode = value; }
        }
        public string ExternalOut9DelayTime
        {
            get { return this.m_ExternalOut9DelayTime; }
            set { this.m_ExternalOut9DelayTime = value; }
        }
        public string ExternalOut9RunTime
        {
            get { return this.m_ExternalOut9RunTime; }
            set { this.m_ExternalOut9RunTime = value; }
        }

        public string ExternalOut10Mode
        {
            get { return this.m_ExternalOut10Mode; }
            set { this.m_ExternalOut10Mode = value; }
        }
        public string ExternalOut10DelayTime
        {
            get { return this.m_ExternalOut10DelayTime; }
            set { this.m_ExternalOut10DelayTime = value; }
        }
        public string ExternalOut10RunTime
        {
            get { return this.m_ExternalOut10RunTime; }
            set { this.m_ExternalOut10RunTime = value; }
        }

        public string Dummy1
        {
            get { return this.m_Dummy1; }
            set { this.m_Dummy1 = value; }
        }
        public string Dummy2
        {
            get { return this.m_Dummy2; }
            set { this.m_Dummy2 = value; }
        }
        #endregion

        #region Method
        private void Initialization()
        {
            this.ExternalOut1Mode = "0";
            this.ExternalOut1DelayTime = "0";
            this.ExternalOut1RunTime = "0";

            this.ExternalOut2Mode = "0";
            this.ExternalOut2DelayTime = "0";
            this.ExternalOut2RunTime = "0";

            this.ExternalOut3Mode = "0";
            this.ExternalOut3DelayTime = "0";
            this.ExternalOut3RunTime = "0";

            this.ExternalOut4Mode = "0";
            this.ExternalOut4DelayTime = "0";
            this.ExternalOut4RunTime = "0";

            this.ExternalOut9Mode = "0";
            this.ExternalOut9DelayTime = "0";
            this.ExternalOut9RunTime = "0";

            this.ExternalOut10Mode = "0";
            this.ExternalOut10DelayTime = "0";
            this.ExternalOut10RunTime = "0";

            this.Dummy1 = "0";
            this.Dummy2 = "0";
        }
        #endregion
    } 
    #endregion
    #region StructSystemParameter9509
    [StructLayout(LayoutKind.Sequential)]
    public struct StructSystemParameter9509
    {
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string ExternalOut1Mode;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string ExternalOut1DelayTime;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string ExternalOut1RunTime;

        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string ExternalOut2Mode;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string ExternalOut2DelayTime;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string ExternalOut2RunTime;

        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string ExternalOut3Mode;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string ExternalOut3DelayTime;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string ExternalOut3RunTime;

        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string ExternalOut4Mode;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string ExternalOut4DelayTime;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string ExternalOut4RunTime;

        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string ExternalOut9Mode;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string ExternalOut9DelayTime;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string ExternalOut9RunTime;

        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string ExternalOut10Mode;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string ExternalOut10DelayTime;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string ExternalOut10RunTime;

        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string Dummy1;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string Dummy2;
    }
    #endregion
    #region SystemParameter9510
    /// <summary>
    /// 자동영점 1열 데이터
    /// </summary>
    public class SystemParameter9510
    {
        #region Field
        private string m_AutoZero1Range;
        private string m_AutoZero1Time;
        private string m_AutoZero1Variate;
        private string m_AutoZero1Mode;

        private string m_AutoZero2Mode;
        private string m_AutoZero2Range;
        private string m_AutoZero2Time;
        private string m_AutoZero2Variate;

        private string m_Dummy1;
        private string m_Dummy2;
        private string m_Dummy3;
        private string m_Dummy4;
        private string m_Dummy5;
        private string m_Dummy6;
        #endregion

        #region Constructor
        public SystemParameter9510()
        {
            this.Initialization();
        }
        #endregion

        #region Property
        public string AutoZero1Range
        {
            get { return this.m_AutoZero1Range; }
            set { this.m_AutoZero1Range = value; }
        }
        public string AutoZero1Time
        {
            get { return this.m_AutoZero1Time; }
            set { this.m_AutoZero1Time = value; }
        }
        public string AutoZero1Variate
        {
            get { return this.m_AutoZero1Variate; }
            set { this.m_AutoZero1Variate = value; }
        }
        public string AutoZero1Mode
        {
            get { return this.m_AutoZero1Mode; }
            set { this.m_AutoZero1Mode = value; }
        } 

        public string AutoZero2Mode
        {
            get { return this.m_AutoZero2Mode; }
            set { this.m_AutoZero2Mode = value; }
        }
        public string AutoZero2Range
        {
            get { return this.m_AutoZero2Range; }
            set { this.m_AutoZero2Range = value; }
        }
        public string AutoZero2Time
        {
            get { return this.m_AutoZero2Time; }
            set { this.m_AutoZero2Time = value; }
        }
        public string AutoZero2Variate
        {
            get { return this.m_AutoZero2Variate; }
            set { this.m_AutoZero2Variate = value; }
        }

        public string Dummy1
        {
            get { return this.m_Dummy1; }
            set { this.m_Dummy1 = value; }
        }
        public string Dummy2
        {
            get { return this.m_Dummy2; }
            set { this.m_Dummy2 = value; }
        }
        public string Dummy3
        {
            get { return this.m_Dummy3; }
            set { this.m_Dummy3 = value; }
        }
        public string Dummy4
        {
            get { return this.m_Dummy4; }
            set { this.m_Dummy4 = value; }
        }
        public string Dummy5
        {
            get { return this.m_Dummy5; }
            set { this.m_Dummy5 = value; }
        }
        public string Dummy6
        {
            get { return this.m_Dummy6; }
            set { this.m_Dummy6 = value; }
        }
        #endregion

        #region Method
        private void Initialization()
        {
            this.AutoZero1Range = "0";
            this.AutoZero1Time = "0";
            this.AutoZero1Variate = "0";
            this.AutoZero1Mode = "0";

            this.AutoZero2Mode = "0";
            this.AutoZero2Range = "0";
            this.AutoZero2Time = "0";
            this.AutoZero2Variate = "0";

            this.Dummy1 = "0";
            this.Dummy2 = "0";
            this.Dummy3 = "0";
            this.Dummy4 = "0";
            this.Dummy5 = "0";
            this.Dummy6 = "0";
        }
        #endregion
    } 
    #endregion
    #region StructSystemParameter9510
    [StructLayout(LayoutKind.Sequential)]
    public struct StructSystemParameter9510
    {
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string AutoZero1Range;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string AutoZero1Time;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string AutoZero1Variate;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string AutoZero1Mode;

        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string AutoZero2Range;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string AutoZero2Time;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string AutoZero2Variate;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string AutoZero2Mode;

        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string Dummy1;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string Dummy2;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string Dummy3;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string Dummy4;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string Dummy5;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string Dummy6;
    }
    #endregion
    #region SystemParameter9511
    /// <summary>
    /// 자동영점 2열 데이터
    /// </summary>
    public class SystemParameter9511
    {
        #region Field
        private string m_AutoZero1Range;
        private string m_AutoZero1Time;
        private string m_AutoZero1Variate;
        private string m_AutoZero1Mode;

        private string m_AutoZero2Mode;
        private string m_AutoZero2Range;
        private string m_AutoZero2Time;
        private string m_AutoZero2Variate;

        private string m_Dummy1;
        private string m_Dummy2;
        private string m_Dummy3;
        private string m_Dummy4;
        private string m_Dummy5;
        private string m_Dummy6;
        #endregion

        #region Constructor
        public SystemParameter9511()
        {
            this.Initialization();
        }
        #endregion

        #region Property
        public string AutoZero1Range
        {
            get { return this.m_AutoZero1Range; }
            set { this.m_AutoZero1Range = value; }
        }
        public string AutoZero1Time
        {
            get { return this.m_AutoZero1Time; }
            set { this.m_AutoZero1Time = value; }
        }
        public string AutoZero1Variate
        {
            get { return this.m_AutoZero1Variate; }
            set { this.m_AutoZero1Variate = value; }
        }
        public string AutoZero1Mode
        {
            get { return this.m_AutoZero1Mode; }
            set { this.m_AutoZero1Mode = value; }
        }

        public string AutoZero2Mode
        {
            get { return this.m_AutoZero2Mode; }
            set { this.m_AutoZero2Mode = value; }
        }
        public string AutoZero2Range
        {
            get { return this.m_AutoZero2Range; }
            set { this.m_AutoZero2Range = value; }
        }
        public string AutoZero2Time
        {
            get { return this.m_AutoZero2Time; }
            set { this.m_AutoZero2Time = value; }
        }
        public string AutoZero2Variate
        {
            get { return this.m_AutoZero2Variate; }
            set { this.m_AutoZero2Variate = value; }
        }

        public string Dummy1
        {
            get { return this.m_Dummy1; }
            set { this.m_Dummy1 = value; }
        }
        public string Dummy2
        {
            get { return this.m_Dummy2; }
            set { this.m_Dummy2 = value; }
        }
        public string Dummy3
        {
            get { return this.m_Dummy3; }
            set { this.m_Dummy3 = value; }
        }
        public string Dummy4
        {
            get { return this.m_Dummy4; }
            set { this.m_Dummy4 = value; }
        }
        public string Dummy5
        {
            get { return this.m_Dummy5; }
            set { this.m_Dummy5 = value; }
        }
        public string Dummy6
        {
            get { return this.m_Dummy6; }
            set { this.m_Dummy6 = value; }
        }
        #endregion

        #region Method
        private void Initialization()
        {
            this.AutoZero1Range = "0";
            this.AutoZero1Time = "0";
            this.AutoZero1Variate = "0";
            this.AutoZero1Mode = "0";

            this.AutoZero2Mode = "0";
            this.AutoZero2Range = "0";
            this.AutoZero2Time = "0";
            this.AutoZero2Variate = "0";

            this.Dummy1 = "0";
            this.Dummy2 = "0";
            this.Dummy3 = "0";
            this.Dummy4 = "0";
            this.Dummy5 = "0";
            this.Dummy6 = "0";
        }
        #endregion
    }
    #endregion
    #region StructSystemParameter9511
    [StructLayout(LayoutKind.Sequential)]
    public struct StructSystemParameter9511
    {
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string AutoZero1Range;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string AutoZero1Time;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string AutoZero1Variate;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string AutoZero1Mode;

        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string AutoZero2Range;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string AutoZero2Time;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string AutoZero2Variate;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string AutoZero2Mode;

        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string Dummy1;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string Dummy2;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string Dummy3;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string Dummy4;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string Dummy5;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string Dummy6;
    }
    #endregion

    #region SystemStatus
    public class SystemStatus
    {
        #region Field
        private Define.E_EquipmentStatus m_Equipment;
        private Define.E_DisplayStore m_CurrentDisplay;
        private Define.E_DisplayMode m_CurrentMode;
        private Define.E_WeightInputMode m_CurrentWeightInputMode;

        private UserPasswordType m_CurrentUserPasswordType;
        private UserItem m_CurrentUser;
        #endregion

        #region Constructor
        public SystemStatus()
        {
            this.Initialization();
        }
        #endregion

        #region Property
        public Define.E_EquipmentStatus Equipment
        {
            get { return this.m_Equipment; }
            set { this.m_Equipment = value; }
        }
        public Define.E_DisplayStore CurrentDisplay
        {
            get { return this.m_CurrentDisplay; }
            set { this.m_CurrentDisplay = value; }
        }
        public Define.E_DisplayMode CurrentMode
        {
            get { return this.m_CurrentMode; }
            set { this.m_CurrentMode = value; }
        }
        public Define.E_WeightInputMode CurrentWeightInputMode
        {
            get { return this.m_CurrentWeightInputMode; }
            set { this.m_CurrentWeightInputMode = value; }
        }
       
        public UserPasswordType CurrentUserPasswordType
        {
            get { return this.m_CurrentUserPasswordType; }
            set { this.m_CurrentUserPasswordType = value; }
        }
        public UserItem CurrentUser
        {
            get { return this.m_CurrentUser; }
            set { this.m_CurrentUser = value; }
        } 
        #endregion

        #region Method
        public void Initialization()
        {
            this.Equipment = Define.E_EquipmentStatus.Stop;
            this.CurrentDisplay = Define.E_DisplayStore.MainDisplay;
            this.CurrentMode = Define.E_DisplayMode.Normal;
            this.CurrentWeightInputMode = Define.E_WeightInputMode.Weight;
            this.CurrentUserPasswordType = new UserPasswordType();
            
            this.CurrentUser = new UserItem();
            this.CurrentUser.ID = "";
            this.CurrentUser.Password = "";
            this.CurrentUser.Group = Define.E_UserGroup.LogOut;
        }
        #endregion
    }
    #endregion

    #region UserPasswordType
    public class UserPasswordType
    {
        #region Field
        private string m_Level1Password;
        private string m_Level2Password;
        private string m_Level3Password;
        private string m_Level4Password;

        private Define.E_UserGroup m_Group;
        #endregion

        #region Constructor
        public UserPasswordType()
        {
            this.Initialization();
        }
        #endregion

        #region Property
        public string Level1Password
        {
            get { return this.m_Level1Password; }
            set { this.m_Level1Password = value; }
        }
        public string Level2Password
        {
            get { return this.m_Level2Password; }
            set { this.m_Level2Password = value; }
        }
        public string Level3Password
        {
            get { return this.m_Level3Password; }
            set { this.m_Level3Password = value; }
        }
        public string Level4Password
        {
            get { return this.m_Level4Password; }
            set { this.m_Level4Password = value; }
        }

        public Define.E_UserGroup Group
        {
            get { return this.m_Group; }
            set { this.m_Group = value; }
        }
        #endregion

        #region Method
        public void Initialization()
        {
            this.Level1Password = "1000";
            this.Level2Password = "2000";
            this.Level3Password = "3000";
            this.Level4Password = "0714";

            this.Group = Define.E_UserGroup.None;
        }
        #endregion
    }
    #endregion

    #region User
    public class User
    {
        #region Field
        private Collection<UserItem> m_Level1Users;
        private Collection<UserItem> m_Level2Users;
        private Collection<UserItem> m_Level3Users;

        private UserItem m_DeveloperUser;
        #endregion

        #region Constructor
        public User()
        {
            this.Initialize();
        }
        #endregion

        #region Property
        public Collection<UserItem> Level1Users
        {
            get { return this.m_Level1Users; }
            set { this.m_Level1Users = value; }
        }
        public Collection<UserItem> Level2Users
        {
            get { return this.m_Level2Users; }
            set { this.m_Level2Users = value; }
        }
        public Collection<UserItem> Level3Users
        {
            get { return this.m_Level3Users; }
            set { this.m_Level3Users = value; }
        }

        public UserItem DeveloperUser
        {
            get { return this.m_DeveloperUser; }
            private set { this.m_DeveloperUser = value; }
        } 
        #endregion

        #region Method
        private void Initialize()
        {
            this.Level1Users = new Collection<UserItem>();
            this.Level2Users = new Collection<UserItem>();
            this.Level3Users = new Collection<UserItem>();

            this.Level1Users.Clear();
            this.Level2Users.Clear();
            this.Level3Users.Clear();

            for (int i = 0; i < 5; i++)
            {
                this.Level1Users.Add(new UserItem());
                this.Level2Users.Add(new UserItem());
                this.Level3Users.Add(new UserItem());
            }

            this.DeveloperUser = new UserItem();
            this.DeveloperUser.ID = "Intech";
            this.DeveloperUser.Password = "20090810";
            this.DeveloperUser.Group = Define.E_UserGroup.Developer;
        }
        
        public UserItem FindUser(string id)
        {
            UserItem user = null;

            // 개발자 유저 검색
            if (id == this.DeveloperUser.ID)
            {
                user = new UserItem();
                user.ID = this.DeveloperUser.ID;
                user.Password = this.DeveloperUser.Password;
                user.Group = this.DeveloperUser.Group;
                return user;
            }
            
            // 일반 유저 검색
            for (int i = 0; i < this.Level1Users.Count; i++)
            {
                if (this.Level1Users[i].Group != Define.E_UserGroup.None)
                {
                    if (this.Level1Users[i].ID.Trim() == id.Trim())
                    {
                        user = new UserItem();
                        user.ID = this.Level1Users[i].ID.Trim();
                        user.Password = this.Level1Users[i].Password;
                        user.Group = this.Level1Users[i].Group;
                        return user;
                    }
                }

                if (this.Level2Users[i].Group != Define.E_UserGroup.None)
                {
                    if (this.Level2Users[i].ID.Trim() == id.Trim())
                    {
                        user = new UserItem();
                        user.ID = this.Level2Users[i].ID.Trim();
                        user.Password = this.Level2Users[i].Password;
                        user.Group = this.Level2Users[i].Group;
                        return user;
                    }
                }

                if (this.Level3Users[i].Group != Define.E_UserGroup.None)
                {
                    if (this.Level3Users[i].ID.Trim() == id.Trim())
                    {
                        user = new UserItem();
                        user.ID = this.Level3Users[i].ID.Trim();
                        user.Password = this.Level3Users[i].Password;
                        user.Group = this.Level3Users[i].Group;
                        return user;
                    }
                }
            }

            return user;
        }
        public UserItem FindDeveloperUser(string id)
        {
            UserItem user = null;

            // 개발자 유저 검색
            if (id == this.DeveloperUser.ID)
            {
                user = new UserItem();
                user.ID = this.DeveloperUser.ID;
                user.Password = this.DeveloperUser.Password;
                user.Group = this.DeveloperUser.Group;
                return user;
            }

            return user;
        }
        
        public bool SearchID(string id)
        {
            bool ret = false;

            for (int i = 0; i < this.Level1Users.Count; i++)
            {
                if (this.Level1Users[i].ID.Trim() == id.Trim())
                    return ret = true;
            }
            for (int i = 0; i < this.Level2Users.Count; i++)
            {
                if (this.Level2Users[i].ID.Trim() == id.Trim())
                    return ret = true;
            }
            for (int i = 0; i < this.Level3Users.Count; i++)
            {
                if (this.Level3Users[i].ID.Trim() == id.Trim())
                    return ret = true;
            }

            return ret;
        }
       
        #region Level1
        public UserItem Level1FindUser(string id)
        {
            UserItem user = null;

            for (int i = 0; i < this.Level1Users.Count; i++)
            {
                if (this.Level1Users[i].ID.Trim() == id.Trim())
                {
                    user = new UserItem();
                    user.ID = this.Level1Users[i].ID.Trim();
                    user.Password = this.Level1Users[i].Password;
                    user.Group = this.Level1Users[i].Group;
                    return user;
                }
            }

            return user;
        }
        public bool Level1SearchID(string id)
        {
            bool ret = false;

            for (int i = 0; i < this.Level1Users.Count; i++)
            {
                if (this.Level1Users[i].ID.Trim() == id.Trim())
                    return ret = true;
            }

            return ret;
        }
        public bool Level1DeleteLevel1User(UserItem user)
        {
            bool ret = false;

            return ret;
        }
        public bool Level1AddUser(UserItem user)
        {
            bool ret = false;

            return ret;
        }
        public bool Level1ModifyUser(UserItem user)
        {
            bool ret = false;

            return ret;
        }
        #endregion
        #region Level2
        public UserItem Level2FindUser(string id)
        {
            UserItem user = null;

            for (int i = 0; i < this.Level2Users.Count; i++)
            {
                if (this.Level2Users[i].ID.Trim() == id.Trim())
                {
                    user = new UserItem();
                    user.ID = this.Level2Users[i].ID.Trim();
                    user.Password = this.Level2Users[i].Password;
                    user.Group = this.Level2Users[i].Group;
                    return user;
                }
            }

            return user;
        }
        public bool Level2DeleteLevel1User(UserItem user)
        {
            bool ret = false;

            return ret;
        }
        public bool Level2AddUser(UserItem user)
        {
            bool ret = false;

            return ret;
        }
        public bool Level2ModifyUser(UserItem user)
        {
            bool ret = false;

            return ret;
        }
        #endregion
        #region Level3
        public UserItem Level3FindUser(string id)
        {
            UserItem user = null;

            for (int i = 0; i < this.Level3Users.Count; i++)
            {
                if (this.Level3Users[i].ID.Trim() == id.Trim())
                {
                    user = new UserItem();
                    user.ID = this.Level3Users[i].ID.Trim();
                    user.Password = this.Level3Users[i].Password;
                    user.Group = this.Level3Users[i].Group;
                    return user;
                }
            }

            return user;
        }
        public bool Level3DeleteLevel1User(UserItem user)
        {
            bool ret = false;

            return ret;
        }
        public bool Level3AddUser(UserItem user)
        {
            bool ret = false;

            return ret;
        }
        public bool Level3ModifyUser(UserItem user)
        {
            bool ret = false;

            return ret;
        }
        #endregion
        
        #endregion
    } 
    #endregion
    #region UserItem
    public class UserItem
    {
        #region Field
        private string m_ID;
        private string m_Password;
        private Define.E_UserGroup m_Group;
        #endregion

        #region Constructor
        public UserItem()
        {
            this.Initialize();
        }
        #endregion

        #region Property
        public string ID
        {
            get { return this.m_ID; }
            set { this.m_ID = value; }
        }
        public string Password
        {
            get { return this.m_Password; }
            set { this.m_Password = value; }
        }
        public Define.E_UserGroup Group
        {
            get { return this.m_Group; }
            set { this.m_Group = value; }
        } 
        #endregion

        #region Method
        private void Initialize()
        {
            this.ID = "-";
            this.Password = "-";
            this.Group = Define.E_UserGroup.None;
        }
        #endregion
    }
    #endregion
    #region StructUserItem
    [StructLayout(LayoutKind.Sequential)]
    public struct StructUserItem
    {
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
        public string ID;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
        public string Password;

        public Define.E_UserGroup Group;

        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
        public string Dummy1;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
        public string Dummy2;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
        public string Dummy3;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
        public string Dummy4;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
        public string Dummy5;
    }
    #endregion

    #region UserGroup
    public class UserGroup
    {
        #region Field
        private UserGroupItem m_Level1;
        private UserGroupItem m_Level2;
        private UserGroupItem m_Level3;
        private UserGroupItem m_NotLogin;
        private UserGroupItem m_Admin;
        #endregion

        #region Constructor
        public UserGroup()
        {
            this.Initialize();
        }
        #endregion

        #region Property
        public UserGroupItem Level1
        {
            get { return this.m_Level1; }
            set { this.m_Level1 = value; }
        }
        public UserGroupItem Level2
        {
            get { return this.m_Level2; }
            set { this.m_Level2 = value; }
        }
        public UserGroupItem Level3
        {
            get { return this.m_Level3; }
            set { this.m_Level3 = value; }
        }
        public UserGroupItem NotLogin
        {
            get { return this.m_NotLogin; }
            set { this.m_NotLogin = value; }
        }
        public UserGroupItem Admin
        {
            get { return this.m_Admin; }
            set { this.m_Admin = value; }
        }
        #endregion

        #region Method
        private void Initialize()
        {
            this.Level1 = new UserGroupItem();
            this.Level2 = new UserGroupItem();
            this.Level3 = new UserGroupItem();
            this.NotLogin = new UserGroupItem();
            this.Admin = new UserGroupItem();
        }

        public bool GetLevel1AccessRight(Define.E_DisplayStore display)
        {
            bool ret = false;

            return ret;
        }
        public bool GetLevel2AccessRight(Define.E_DisplayStore display)
        {
            bool ret = false;

            return ret;
        }
        public bool GetLevel3AccessRight(Define.E_DisplayStore display)
        {
            bool ret = false;

            return ret;
        }
        #endregion
    } 
    #endregion
    #region UserGroupItem
    public class UserGroupItem
    {
        #region Field
        private bool m_IsBasic;
        private bool m_IsConfiguration;
        private bool m_IsSystem;
        private bool m_IsEquipment;
        private bool m_IsInformation;

        private bool m_IsBasicTime;
        private bool m_IsBasicProduct;
        private bool m_IsBasicDataBackup;
        private bool m_IsBasicDataStatistics;

        private bool m_IsConfiSerial;
        private bool m_IsConfiOption;

        private bool m_IsSystemCalibration;
        private bool m_IsSystemJudgmentSetting;
        private bool m_IsSystemSorterSetting;
        private bool m_IsSystemAutoZero;
        private bool m_IsSystemIOTest;
        private bool m_IsSystemExternalOutput;

        private bool m_IsEquipUpdate;
        private bool m_IsEquipInitialize;
        private bool m_IsEquipFunctionSetting;
        private bool m_IsEquipUser;

        private bool m_IsInforSystem;
        private bool m_IsInforAS;

        private bool m_IsConfiEthernet;
        #endregion

        #region Constructor
        public UserGroupItem()
        {
            this.Initialize();
        }
        #endregion

        #region Property
        public bool IsBasic
        {
            get { return this.m_IsBasic; }
            set { this.m_IsBasic = value; }
        }
        public bool IsConfiguration
        {
            get { return this.m_IsConfiguration; }
            set { this.m_IsConfiguration = value; }
        }
        public bool IsSystem
        {
            get { return this.m_IsSystem; }
            set { this.m_IsSystem = value; }
        }
        public bool IsEquipment
        {
            get { return this.m_IsEquipment; }
            set { this.m_IsEquipment = value; }
        }
        public bool IsInformation
        {
            get { return this.m_IsInformation; }
            set { this.m_IsInformation = value; }
        } 

        public bool IsBasicTime
        {
            get { return this.m_IsBasicTime; }
            set { this.m_IsBasicTime = value; }
        }
        public bool IsBasicProduct
        {
            get { return this.m_IsBasicProduct; }
            set { this.m_IsBasicProduct = value; }
        }
        public bool IsBasicDataBackup
        {
            get { return this.m_IsBasicDataBackup; }
            set { this.m_IsBasicDataBackup = value; }
        }
        public bool IsBasicDataStatistics
        {
            get { return this.m_IsBasicDataStatistics; }
            set { this.m_IsBasicDataStatistics = value; }
        }

        public bool IsConfiSerial
        {
            get { return this.m_IsConfiSerial; }
            set { this.m_IsConfiSerial = value; }
        }
        public bool IsConfiOptionBoard
        {
            get { return this.m_IsConfiOption; }
            set { this.m_IsConfiOption = value; }
        }
        
        public bool IsSystemCalibration
        {
            get { return this.m_IsSystemCalibration; }
            set { this.m_IsSystemCalibration = value; }
        }
        public bool IsSystemJudgmentSetting
        {
            get { return this.m_IsSystemJudgmentSetting; }
            set { this.m_IsSystemJudgmentSetting = value; }
        }
        public bool IsSystemSorterSetting
        {
            get { return this.m_IsSystemSorterSetting; }
            set { this.m_IsSystemSorterSetting = value; }
        }
        public bool IsSystemAutoZero
        {
            get { return this.m_IsSystemAutoZero; }
            set { this.m_IsSystemAutoZero = value; }
        }
        public bool IsSystemIOTest
        {
            get { return this.m_IsSystemIOTest; }
            set { this.m_IsSystemIOTest = value; }
        }
        public bool IsSystemExternalOutput
        {
            get { return this.m_IsSystemExternalOutput; }
            set { this.m_IsSystemExternalOutput = value; }
        }

        public bool IsEquipUpdate
        {
            get { return this.m_IsEquipUpdate; }
            set { this.m_IsEquipUpdate = value; }
        }
        public bool IsEquipInitialize
        {
            get { return this.m_IsEquipInitialize; }
            set { this.m_IsEquipInitialize = value; }
        }
        public bool IsEquipFunctionSetting
        {
            get { return this.m_IsEquipFunctionSetting; }
            set { this.m_IsEquipFunctionSetting = value; }
        }
        public bool IsEquipUser
        {
            get { return this.m_IsEquipUser; }
            set { this.m_IsEquipUser = value; }
        }

        public bool IsInforSystem
        {
            get { return this.m_IsInforSystem; }
            set { this.m_IsInforSystem = value; }
        }
        public bool IsInforAS
        {
            get { return this.m_IsInforAS; }
            set { this.m_IsInforAS = value; }
        }

        public bool IsConfiEthernet
        {
            get { return this.m_IsConfiEthernet; }
            set { this.m_IsConfiEthernet = value; }
        }
        #endregion

        #region Method
        private void Initialize()
        {
            this.IsBasic = false;
            this.IsConfiguration = false;
            this.IsSystem = false;
            this.IsEquipment = false;
            this.IsInformation = false;
                
            this.IsBasicTime = false;
            this.IsBasicProduct = false;
            this.IsBasicDataBackup = false;
            this.IsBasicDataStatistics = false;

            this.IsConfiSerial = false;
            this.IsConfiOptionBoard = false;

            this.IsSystemCalibration = false;
            this.IsSystemJudgmentSetting = false;
            this.IsSystemSorterSetting = false;
            this.IsSystemAutoZero = false;
            this.IsSystemIOTest = false;
            this.IsSystemExternalOutput = false;

            this.IsEquipUpdate = false;
            this.IsEquipInitialize = false;
            this.IsEquipFunctionSetting = false;
            this.IsEquipUser = false;

            this.IsInforSystem = false;
            this.IsInforAS = false;

            this.IsConfiEthernet = false;
        }
        #endregion
    }
    #endregion
    #region StructUserGroupItem
    [StructLayout(LayoutKind.Sequential)]
    public struct StructUserGroupItem
    {
        public bool IsBasic;
        public bool IsConfiguration;
        public bool IsSystem;
        public bool IsEquipment;
        public bool IsInformation;

        public bool IsBasicTime;
        public bool IsBasicProduct;
        public bool IsBasicDataBackup;
        public bool IsBasicDataStatistics;

        public bool IsConfiSerial;
        public bool IsConfiOptionBoard;

        public bool IsSystemCalibration;
        public bool IsSystemJudgmentSetting;
        public bool IsSystemSorterSetting;
        public bool IsSystemAutoZero;
        public bool IsSystemIOTest;
        public bool IsSystemExternalOutput;

        public bool IsEquipUpdate;
        public bool IsEquipInitialize;
        public bool IsEquipFunctionSetting;
        public bool IsEquipUser;

        public bool IsInforSystem;
        public bool IsInforAS;

        public bool IsConfiEthernet;
        public bool Dummy2;
        public bool Dummy3;
        public bool Dummy4;
        public bool Dummy5;
        public bool Dummy6;
        public bool Dummy7;
        public bool Dummy8;
        public bool Dummy9;
        public bool Dummy10;
        public bool Dummy11;
        public bool Dummy12;
        public bool Dummy13;
        public bool Dummy14;
        public bool Dummy15;
        public bool Dummy16;
        public bool Dummy17;
        public bool Dummy18;
        public bool Dummy19;
        public bool Dummy20;
    }
    #endregion
}
