using System;
using System.Linq;
using System.Collections.ObjectModel;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.IO;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

using ITC81DB.Forms;

namespace ITC81DB.Controls
{
    public partial class ControlConversionItem : UserControl
    {
        #region Field
        private FormMain m_ParentForm;
        #endregion

        #region Constructor
        public ControlConversionItem(FormMain parent)
        {
            InitializeComponent();

            this.ParentForm = parent;

            int x = 0, y = 0;

            x = Screen.PrimaryScreen.Bounds.Width / 2 - this.Size.Width / 2;
            y = Screen.PrimaryScreen.Bounds.Height / 2 - this.Size.Height / 2;

            this.Location = new Point(x, y);

            this.DefaultSetting();
            this.InitializeDesign();
        }
        #endregion

        #region Property
        public FormMain ParentForm
        {
            get { return this.m_ParentForm; }
            set { this.m_ParentForm = value; }
        }
        #endregion

        #region Method
        public void InitializeDesign()
        {
            if (this.ParentForm.SystemConfig1.Language == DataStore.LanguageID.English)
            {
                this.labelTitle.Text = "Conversion";
                this.labelTitlePreVersion.Text = "Previous(Major)";
                this.labelTitleCurrentVersion.Text = "Current(Major)";
                this.buttonConversion.Text = "Conversion";
                this.labelStatus.Text = "> Please select the first digit of the version to be converted";
            }
            else if (this.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Chinese)
            {
                this.labelTitle.Text = "转换";
                this.labelTitlePreVersion.Text = "以前的版本";
                this.labelTitleCurrentVersion.Text = "当前";
                this.buttonConversion.Text = "转换";
                this.labelStatus.Text = "> 请选择要转换的版本的第一位";
            }
            else if (this.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Czech)
            {
            }
            else if (this.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Russian)
            {
                this.labelTitle.Text = "Преобразование";
                this.labelTitlePreVersion.Text = "Предыдущий";
                this.labelTitleCurrentVersion.Text = "Текущий";
                this.buttonConversion.Text = "Преобразование";
                this.labelStatus.Text = "> Пожалуйста, выберите первую цифру конвертируемой версии";
            }
            else if (this.ParentForm.SystemConfig1.Language == DataStore.LanguageID.German)
            {
                this.labelTitle.Text = "Wandlung";
                this.labelTitlePreVersion.Text = "Zurück";
                this.labelTitleCurrentVersion.Text = "Aktuell";
                this.buttonConversion.Text = "Wandlung";
                this.labelStatus.Text = "> Bitte wählen Sie die erste Ziffer der zu konvertierenden Version aus";
            }
            else if (this.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Spanish)
            {
                this.labelTitle.Text = "Conversión";
                this.labelTitlePreVersion.Text = "Previous(Principal)";
                this.labelTitleCurrentVersion.Text = "Actual(Principal)";
                this.buttonConversion.Text = "Conversión";
                this.labelStatus.Text = "> Seleccione el primer dígito de la versión a convertir";
            }
            else
            {
                this.labelTitle.Text = "Conversion";
                this.labelTitlePreVersion.Text = "이전 버전 (Major)";
                this.labelTitleCurrentVersion.Text = "현재 버전 (Major)";
                this.buttonConversion.Text = "Conversion";
                this.labelStatus.Text = "> Conversion을 진행할 버전의 맨 앞자리를 선택해 주십시오";
            }
        }
        private void DefaultSetting()
        {
            this.labelCurrentVersion.Text = FormMain.DisplayVersion.Substring(0, 1);
            this.progressBarUpdate.Value = 0;

            this.comboBoxPreviousVersion.Items.Clear();
            this.comboBoxPreviousVersion.Items.Add("-");
            this.comboBoxPreviousVersion.Items.Add("3");
            this.comboBoxPreviousVersion.Items.Add("4");
            this.comboBoxPreviousVersion.Items.Add("5");
            this.comboBoxPreviousVersion.Items.Add("6");
            this.comboBoxPreviousVersion.Items.Add("7");
            this.comboBoxPreviousVersion.Items.Add("8");
        }

        // SystemItem : 시스템 파일 버전별
        public void ConvertingSystemItemFromV3V4()
        {
            string fullFilePath = "";
            bool fileCheck = false;
            string value;
            bool isBarcodeUsing = false;

            StructSystemConfigurationItem1 structItem1;
            StructSystemConfigurationItem2 structItem2;
            StructSystemConfigurationItem3 structItem3;

            #region ParentForm.SystemConfig1
            fullFilePath = this.ParentForm.PathPreVersionSystemFile1Folder + "system.cfg";
            this.ParentForm.smartFileIO.FilePathName = fullFilePath;

            FileInfo fileInfo = new FileInfo(fullFilePath);
            fileCheck = fileInfo.Exists;

            if (fileCheck == true)
            {
                this.ParentForm.smartFileIO.Open(this.ParentForm.BufferSmartUart);

                try
                {
                    structItem1 = (StructSystemConfigurationItem1)this.ParentForm.smartFileIO.ReadStructure(0, typeof(StructSystemConfigurationItem1));

                    this.ParentForm.SystemConfig1.IsDataBackup = structItem1.IsDataBackup;
                    this.ParentForm.SystemConfig1.IsLogin = structItem1.IsLogin;
                    this.ParentForm.SystemConfig1.EquipmentID = structItem1.EquipmentID;
                    this.ParentForm.SystemConfig1.DecimalPlaces = structItem1.DecimalPlaces;
                    this.ParentForm.SystemConfig1.ProductNumber = structItem1.ProductNumber;
                    this.ParentForm.SystemConfig1.SerialCOM1BaudRate = structItem1.Serial1BaudRate;
                    this.ParentForm.SystemConfig1.SerialCOM1Mode = structItem1.Serial1Mode;
                    this.ParentForm.SystemConfig1.SerialCOM3BaudRate = structItem1.Serial2BaudRate;
                    this.ParentForm.SystemConfig1.SerialCOM3Mode = structItem1.Serial2Mode;
                    this.ParentForm.SystemConfig1.SerialCOM4BaudRate = structItem1.Serial3BaudRate;
                    this.ParentForm.SystemConfig1.SerialCOM4Mode = structItem1.Serial3Mode;
                    this.ParentForm.SystemConfig1.SerialNumber = structItem1.SerialNumber;
                    this.ParentForm.SystemConfig1.Unit = structItem1.Unit;
                    this.ParentForm.SystemConfig1.Language = structItem1.Language;

                    this.ParentForm.SystemConfig1.IsAverageTracking = false;
                    this.ParentForm.SystemConfig1.IsExternalInputLamp = structItem1.IsExternalInputLamp;
                    this.ParentForm.SystemConfig1.IsExternalInputBuzzer = structItem1.IsExternalInputBuzzer;
                    this.ParentForm.SystemConfig1.IsPrintPerProductEnable = structItem1.IsPrintPerProductEnable;
                    this.ParentForm.SystemConfig1.StatisticsPrintFormat = 0;
                    this.ParentForm.SystemConfig1.TransmissionDelayTimeCOM1 = structItem1.TransmissionDelayTimeCOM1;
                    this.ParentForm.SystemConfig1.TransmissionDelayTimeCOM3 = structItem1.TransmissionDelayTimeCOM3;
                    this.ParentForm.SystemConfig1.TransmissionDelayTimeCOM4 = structItem1.TransmissionDelayTimeCOM4;
                    this.ParentForm.SystemConfig1.DatabackupFormat = structItem1.DatabackupFormat;
                    isBarcodeUsing = structItem1.DummyBool1;

                    this.ParentForm.SystemConfig1.UserDefineCOM1 = structItem1.UserDefineCOM1;
                    this.ParentForm.SystemConfig1.UserDefineCOM3 = structItem1.UserDefineCOM3;
                    this.ParentForm.SystemConfig1.UserDefineCOM4 = structItem1.UserDefineCOM4;
                }
                catch
                {
                    //DialogFormMessage myMsg = new DialogFormMessage(17, this.ParentForm.SystemConfig1.Language);
                    //myMsg.ShowDialog();

                    //this.ParentForm.smartFileIO.Close();
                }
                this.ParentForm.smartFileIO.Close();
            }
            #endregion

            #region ParentForm.SystemConfig2, 3
            fullFilePath = this.ParentForm.PathPreVersionSystemFile1Folder + "system2.cfg";
            this.ParentForm.smartFileIO.FilePathName = fullFilePath;

            fileInfo = new FileInfo(fullFilePath);
            fileCheck = fileInfo.Exists;

            if (fileCheck == true)
            {
                this.ParentForm.smartFileIO.Open(this.ParentForm.BufferSmartUart);

                try
                {
                    structItem2 = (StructSystemConfigurationItem2)this.ParentForm.smartFileIO.ReadStructure(0, typeof(StructSystemConfigurationItem2));
                    structItem3 = (StructSystemConfigurationItem3)this.ParentForm.smartFileIO.ReadStructure(1, typeof(StructSystemConfigurationItem3));

                    // ParentForm.SystemConfig2
                    this.ParentForm.SystemConfig2.IsCountingOutput1Continuous = structItem2.IsCountingOutput1Continuous;
                    this.ParentForm.SystemConfig2.IsCountingOutput1ConveyorStop = structItem2.IsCountingOutput1ConveyorStop;
                    this.ParentForm.SystemConfig2.IsCountingOutput1BuzzerOn = structItem2.IsCountingOutput1BuzzerOn;
                    this.ParentForm.SystemConfig2.IsCountingOutput1ExternalOutput = structItem2.IsCountingOutput1ExternalOutput;
                    this.ParentForm.SystemConfig2.IsCountingOutput2Continuous = structItem2.IsCountingOutput2Continuous;
                    this.ParentForm.SystemConfig2.IsCountingOutput2ConveyorStop = structItem2.IsCountingOutput2ConveyorStop;
                    this.ParentForm.SystemConfig2.IsCountingOutput2BuzzerOn = structItem2.IsCountingOutput2BuzzerOn;
                    this.ParentForm.SystemConfig2.IsCountingOutput2ExternalOutput = structItem2.IsCountingOutput2ExternalOutput;

                    this.ParentForm.SystemConfig2.IsRFIDSpeedwayR420 = false;
                    this.ParentForm.SystemConfig2.IsBypassOnce = false;
                    this.ParentForm.SystemConfig2.IsBypassDirectionPass = false;
                    this.ParentForm.SystemConfig2.IsHitachiBlankToNoneCOM1 = false;
                    this.ParentForm.SystemConfig2.IsHitachiBlankToNoneCOM3 = false;
                    this.ParentForm.SystemConfig2.IsHitachiBlankToNoneCOM4 = false;
                    this.ParentForm.SystemConfig2.IsMarkoprintTodaytDatePrintEthernet = structItem2.IsMarkoprintTodaytDatePrintEthernet;
                    this.ParentForm.SystemConfig2.IsMarkoprintDatePrintEthernet = structItem2.IsMarkoprintDatePrintEthernet;
                    this.ParentForm.SystemConfig2.IsGroup1UsingRandomMode = structItem2.IsGroup1UsingRandomMode;
                    this.ParentForm.SystemConfig2.IsGroup2UsingRandomMode = structItem2.IsGroup2UsingRandomMode;
                    this.ParentForm.SystemConfig2.IsGroup3UsingRandomMode = structItem2.IsGroup3UsingRandomMode;
                    this.ParentForm.SystemConfig2.IsGroup4UsingRandomMode = structItem2.IsGroup4UsingRandomMode;
                    this.ParentForm.SystemConfig2.IsGroup5UsingRandomMode = structItem2.IsGroup5UsingRandomMode;
                    this.ParentForm.SystemConfig2.IsMarkoprintTodaytDatePrintCOM4 = structItem2.IsMarkoprintTodaytDatePrintCOM4;
                    this.ParentForm.SystemConfig2.IsMarkoprintDatePrintCOM4 = structItem2.IsMarkoprintDatePrintCOM4;
                    this.ParentForm.SystemConfig2.IsMarkoprintTodaytDatePrintCOM3 = structItem2.IsMarkoprintTodaytDatePrintCOM3;
                    this.ParentForm.SystemConfig2.IsMarkoprintDatePrintCOM3 = structItem2.IsMarkoprintDatePrintCOM3;
                    this.ParentForm.SystemConfig2.IsMarkoprintTodaytDatePrintCOM1 = structItem2.IsMarkoprintTodaytDatePrintCOM1;
                    this.ParentForm.SystemConfig2.IsMarkoprintDatePrintCOM1 = structItem2.IsMarkoprintDatePrintCOM1;

                    this.ParentForm.SystemConfig2.CountingOutput1Mode = structItem2.CountingOutput1Mode;
                    this.ParentForm.SystemConfig2.CountingOutput1Number = structItem2.CountingOutput1Number;
                    this.ParentForm.SystemConfig2.CountingOutput2Mode = structItem2.CountingOutput2Mode;
                    this.ParentForm.SystemConfig2.CountingOutput2Number = structItem2.CountingOutput2Number;

                    this.ParentForm.SystemConfig2.MULTiJETSlaveAddressEthernet = 58;
                    this.ParentForm.SystemConfig2.MULTiJETSlaveAddressCOM1 = 58;
                    this.ParentForm.SystemConfig2.MULTiJETSlaveAddressCOM3 = 58;
                    this.ParentForm.SystemConfig2.MULTiJETSlaveAddressCOM4 = 58;
                    this.ParentForm.SystemConfig2.ModbusTCPSelectFunction = 0;
                    this.ParentForm.SystemConfig2.EthernetLocalPort = 0;
                    this.ParentForm.SystemConfig2.CommunicationControlCharacter = 0;
                    if (isBarcodeUsing == true)
                        this.ParentForm.SystemConfig2.Barcode = 2;
                    else
                        this.ParentForm.SystemConfig2.Barcode = 0;
                    this.ParentForm.SystemConfig2.AverageTrackingCount = 0;
                    this.ParentForm.SystemConfig2.ModbusRTUSelectFunction = 0;
                    this.ParentForm.SystemConfig2.ModbusSlaveIDCOM1 = 1;
                    this.ParentForm.SystemConfig2.ModbusSlaveIDCOM3 = 1;
                    this.ParentForm.SystemConfig2.ModbusSlaveIDCOM4 = 1;
                    this.ParentForm.SystemConfig2.CountingOutput1BuzzerTime = 1000;
                    this.ParentForm.SystemConfig2.CountingOutput2BuzzerTime = 1000;
                    this.ParentForm.SystemConfig2.SortingPointLength = 250;
                    this.ParentForm.SystemConfig2.ConveyorLength = 450;
                    this.ParentForm.SystemConfig2.MarkoprintLineNumberEthernet = structItem2.MarkoprintLineNumberEthernet;
                    this.ParentForm.SystemConfig2.HitachiRoomNumberEthernet = structItem2.HitachiRoomNumberEthernet;
                    this.ParentForm.SystemConfig2.EthernetHostPort = structItem2.EthernetHostPort;
                    this.ParentForm.SystemConfig2.EthernetCommMode = structItem2.EthernetCommMode;
                    this.ParentForm.SystemConfig2.EthernetOperationMode = structItem2.EthernetOperationMode;
                    this.ParentForm.SystemConfig2.FileNameExtension = structItem2.FileNameExtension;
                    this.ParentForm.SystemConfig2.MarkoprintLineNumberCOM4 = structItem2.MarkoprintLineNumberCOM4;
                    this.ParentForm.SystemConfig2.HitachiRoomNumberCOM4 = structItem2.HitachiRoomNumberCOM4;
                    this.ParentForm.SystemConfig2.MarkoprintLineNumberCOM3 = structItem2.MarkoprintLineNumberCOM3;
                    this.ParentForm.SystemConfig2.HitachiRoomNumberCOM3 = structItem2.HitachiRoomNumberCOM3;
                    this.ParentForm.SystemConfig2.MarkoprintLineNumberCOM1 = structItem2.MarkoprintLineNumberCOM1;
                    this.ParentForm.SystemConfig2.HitachiRoomNumberCOM1 = structItem2.HitachiRoomNumberCOM1;
                    this.ParentForm.SystemConfig2.RFID_R420_EPC_Filter = "1";
                    this.ParentForm.SystemConfig2.RFID_R420_BARCD = "00000000000000";
                    this.ParentForm.SystemConfig2.MarkoprintDateSettingEthernet = structItem2.MarkoprintDateSettingEthernet;
                    this.ParentForm.SystemConfig2.EthernetAddress = structItem2.EthernetAddress;
                    this.ParentForm.SystemConfig2.MarkoprintDateSettingCOM4 = structItem2.MarkoprintDateSettingCOM4;
                    this.ParentForm.SystemConfig2.MarkoprintDateSettingCOM3 = structItem2.MarkoprintDateSettingCOM3;
                    this.ParentForm.SystemConfig2.MarkoprintDateSettingCOM1 = structItem2.MarkoprintDateSettingCOM1;

                    if (this.ParentForm.SystemConfig1.SerialCOM1Mode > 3 || this.ParentForm.SystemConfig1.SerialCOM3Mode > 3
                        || this.ParentForm.SystemConfig1.SerialCOM4Mode > 3 || structItem2.EthernetCommMode > 3)
                        this.ParentForm.SystemConfig2.IsCommunicationOption = true;
                    else
                        this.ParentForm.SystemConfig2.IsCommunicationOption = false;

                    // ParentForm.SystemConfig3
                    this.ParentForm.SystemConfig3.ModbusTCPStartAddress = 10;
                    this.ParentForm.SystemConfig3.ModbusRTUStartAddressCOM1 = 10;
                    this.ParentForm.SystemConfig3.ModbusRTUStartAddressCOM3 = 10;
                    this.ParentForm.SystemConfig3.ModbusRTUStartAddressCOM4 = 10;
                }
                catch
                {
                    //DialogFormMessage myMsg = new DialogFormMessage(17, this.ParentForm.SystemConfig1.Language);
                    //myMsg.ShowDialog();

                    //this.ParentForm.smartFileIO.Close();
                }

                this.ParentForm.smartFileIO.Close();
            #endregion

                this.ParentForm.SaveSystemConfigurationFile1(this.ParentForm.SystemConfig1);
                this.ParentForm.SaveSystemConfigurationFile2(this.ParentForm.SystemConfig2);
                this.ParentForm.SaveSystemConfigurationFile3(this.ParentForm.SystemConfig3);
            }
        }
        public void ConvertingSystemItemFromV5()
        {
            string fullFilePath = "";
            bool fileCheck = false;
            string value;
            bool isBarcodeUsing = false;

            StructSystemConfigurationItem1 structItem1;
            StructSystemConfigurationItem2 structItem2;
            StructSystemConfigurationItem3 structItem3;

            #region ParentForm.SystemConfig1
            fullFilePath = this.ParentForm.PathPreVersionSystemFile1Folder + "system.cfg";
            this.ParentForm.smartFileIO.FilePathName = fullFilePath;

            FileInfo fileInfo = new FileInfo(fullFilePath);
            fileCheck = fileInfo.Exists;

            if (fileCheck == true)
            {
                this.ParentForm.smartFileIO.Open(this.ParentForm.BufferSmartUart);

                try
                {
                    structItem1 = (StructSystemConfigurationItem1)this.ParentForm.smartFileIO.ReadStructure(0, typeof(StructSystemConfigurationItem1));

                    this.ParentForm.SystemConfig1.IsDataBackup = structItem1.IsDataBackup;
                    this.ParentForm.SystemConfig1.IsLogin = structItem1.IsLogin;
                    this.ParentForm.SystemConfig1.EquipmentID = structItem1.EquipmentID;
                    this.ParentForm.SystemConfig1.DecimalPlaces = structItem1.DecimalPlaces;
                    this.ParentForm.SystemConfig1.ProductNumber = structItem1.ProductNumber;
                    this.ParentForm.SystemConfig1.SerialCOM1BaudRate = structItem1.Serial1BaudRate;
                    this.ParentForm.SystemConfig1.SerialCOM1Mode = structItem1.Serial1Mode;
                    this.ParentForm.SystemConfig1.SerialCOM3BaudRate = structItem1.Serial2BaudRate;
                    this.ParentForm.SystemConfig1.SerialCOM3Mode = structItem1.Serial2Mode;
                    this.ParentForm.SystemConfig1.SerialCOM4BaudRate = structItem1.Serial3BaudRate;
                    this.ParentForm.SystemConfig1.SerialCOM4Mode = structItem1.Serial3Mode;
                    this.ParentForm.SystemConfig1.SerialNumber = structItem1.SerialNumber;
                    this.ParentForm.SystemConfig1.Unit = structItem1.Unit;
                    this.ParentForm.SystemConfig1.Language = structItem1.Language;

                    this.ParentForm.SystemConfig1.IsAverageTracking = false;
                    this.ParentForm.SystemConfig1.IsExternalInputLamp = structItem1.IsExternalInputLamp;
                    this.ParentForm.SystemConfig1.IsExternalInputBuzzer = structItem1.IsExternalInputBuzzer;
                    this.ParentForm.SystemConfig1.IsPrintPerProductEnable = structItem1.IsPrintPerProductEnable;
                    this.ParentForm.SystemConfig1.StatisticsPrintFormat = structItem1.StatisticsPrintFormat;
                    this.ParentForm.SystemConfig1.TransmissionDelayTimeCOM1 = structItem1.TransmissionDelayTimeCOM1;
                    this.ParentForm.SystemConfig1.TransmissionDelayTimeCOM3 = structItem1.TransmissionDelayTimeCOM3;
                    this.ParentForm.SystemConfig1.TransmissionDelayTimeCOM4 = structItem1.TransmissionDelayTimeCOM4;
                    this.ParentForm.SystemConfig1.DatabackupFormat = structItem1.DatabackupFormat;
                    isBarcodeUsing = structItem1.DummyBool1;

                    this.ParentForm.SystemConfig1.UserDefineCOM1 = structItem1.UserDefineCOM1;
                    this.ParentForm.SystemConfig1.UserDefineCOM3 = structItem1.UserDefineCOM3;
                    this.ParentForm.SystemConfig1.UserDefineCOM4 = structItem1.UserDefineCOM4;
                }
                catch
                {
                    //DialogFormMessage myMsg = new DialogFormMessage(17, this.ParentForm.SystemConfig1.Language);
                    //myMsg.ShowDialog();

                    //this.ParentForm.smartFileIO.Close();
                }
                this.ParentForm.smartFileIO.Close();
            }
            #endregion

            #region ParentForm.SystemConfig2, 3
            fullFilePath = this.ParentForm.PathPreVersionSystemFile1Folder + "system2.cfg";
            this.ParentForm.smartFileIO.FilePathName = fullFilePath;

            fileInfo = new FileInfo(fullFilePath);
            fileCheck = fileInfo.Exists;

            if (fileCheck == true)
            {
                this.ParentForm.smartFileIO.Open(this.ParentForm.BufferSmartUart);

                try
                {
                    structItem2 = (StructSystemConfigurationItem2)this.ParentForm.smartFileIO.ReadStructure(0, typeof(StructSystemConfigurationItem2));
                    structItem3 = (StructSystemConfigurationItem3)this.ParentForm.smartFileIO.ReadStructure(1, typeof(StructSystemConfigurationItem3));

                    // ParentForm.SystemConfig2
                    this.ParentForm.SystemConfig2.IsCountingOutput1Continuous = structItem2.IsCountingOutput1Continuous;
                    this.ParentForm.SystemConfig2.IsCountingOutput1ConveyorStop = structItem2.IsCountingOutput1ConveyorStop;
                    this.ParentForm.SystemConfig2.IsCountingOutput1BuzzerOn = structItem2.IsCountingOutput1BuzzerOn;
                    this.ParentForm.SystemConfig2.IsCountingOutput1ExternalOutput = structItem2.IsCountingOutput1ExternalOutput;
                    this.ParentForm.SystemConfig2.IsCountingOutput2Continuous = structItem2.IsCountingOutput2Continuous;
                    this.ParentForm.SystemConfig2.IsCountingOutput2ConveyorStop = structItem2.IsCountingOutput2ConveyorStop;
                    this.ParentForm.SystemConfig2.IsCountingOutput2BuzzerOn = structItem2.IsCountingOutput2BuzzerOn;
                    this.ParentForm.SystemConfig2.IsCountingOutput2ExternalOutput = structItem2.IsCountingOutput2ExternalOutput;

                    this.ParentForm.SystemConfig2.IsRFIDSpeedwayR420 = false;
                    this.ParentForm.SystemConfig2.IsCommunicationOption = structItem2.IsCommunicationOption;
                    this.ParentForm.SystemConfig2.IsBypassOnce = structItem2.IsBypassOnce;
                    this.ParentForm.SystemConfig2.IsBypassDirectionPass = structItem2.IsBypassDirectionPass;
                    this.ParentForm.SystemConfig2.IsHitachiBlankToNoneCOM1 = structItem2.IsHitachiBlankToNoneCOM1;
                    this.ParentForm.SystemConfig2.IsHitachiBlankToNoneCOM3 = structItem2.IsHitachiBlankToNoneCOM3;
                    this.ParentForm.SystemConfig2.IsHitachiBlankToNoneCOM4 = structItem2.IsHitachiBlankToNoneCOM4;
                    this.ParentForm.SystemConfig2.IsMarkoprintTodaytDatePrintEthernet = structItem2.IsMarkoprintTodaytDatePrintEthernet;
                    this.ParentForm.SystemConfig2.IsMarkoprintDatePrintEthernet = structItem2.IsMarkoprintDatePrintEthernet;
                    this.ParentForm.SystemConfig2.IsGroup1UsingRandomMode = structItem2.IsGroup1UsingRandomMode;
                    this.ParentForm.SystemConfig2.IsGroup2UsingRandomMode = structItem2.IsGroup2UsingRandomMode;
                    this.ParentForm.SystemConfig2.IsGroup3UsingRandomMode = structItem2.IsGroup3UsingRandomMode;
                    this.ParentForm.SystemConfig2.IsGroup4UsingRandomMode = structItem2.IsGroup4UsingRandomMode;
                    this.ParentForm.SystemConfig2.IsGroup5UsingRandomMode = structItem2.IsGroup5UsingRandomMode;
                    this.ParentForm.SystemConfig2.IsMarkoprintTodaytDatePrintCOM4 = structItem2.IsMarkoprintTodaytDatePrintCOM4;
                    this.ParentForm.SystemConfig2.IsMarkoprintDatePrintCOM4 = structItem2.IsMarkoprintDatePrintCOM4;
                    this.ParentForm.SystemConfig2.IsMarkoprintTodaytDatePrintCOM3 = structItem2.IsMarkoprintTodaytDatePrintCOM3;
                    this.ParentForm.SystemConfig2.IsMarkoprintDatePrintCOM3 = structItem2.IsMarkoprintDatePrintCOM3;
                    this.ParentForm.SystemConfig2.IsMarkoprintTodaytDatePrintCOM1 = structItem2.IsMarkoprintTodaytDatePrintCOM1;
                    this.ParentForm.SystemConfig2.IsMarkoprintDatePrintCOM1 = structItem2.IsMarkoprintDatePrintCOM1;

                    this.ParentForm.SystemConfig2.CountingOutput1Mode = structItem2.CountingOutput1Mode;
                    this.ParentForm.SystemConfig2.CountingOutput1Number = structItem2.CountingOutput1Number;
                    this.ParentForm.SystemConfig2.CountingOutput2Mode = structItem2.CountingOutput2Mode;
                    this.ParentForm.SystemConfig2.CountingOutput2Number = structItem2.CountingOutput2Number;

                    this.ParentForm.SystemConfig2.MULTiJETSlaveAddressEthernet = 58;
                    this.ParentForm.SystemConfig2.MULTiJETSlaveAddressCOM1 = 58;
                    this.ParentForm.SystemConfig2.MULTiJETSlaveAddressCOM3 = 58;
                    this.ParentForm.SystemConfig2.MULTiJETSlaveAddressCOM4 = 58;
                    this.ParentForm.SystemConfig2.ModbusTCPSelectFunction = 0;
                    this.ParentForm.SystemConfig2.EthernetLocalPort = 0;
                    this.ParentForm.SystemConfig2.CommunicationControlCharacter = 0;
                    if (isBarcodeUsing == true)
                        this.ParentForm.SystemConfig2.Barcode = 2;
                    else
                        this.ParentForm.SystemConfig2.Barcode = 0;
                    this.ParentForm.SystemConfig2.AverageTrackingCount = 0;
                    this.ParentForm.SystemConfig2.ModbusRTUSelectFunction = 0;
                    this.ParentForm.SystemConfig2.ModbusSlaveIDCOM1 = 1;
                    this.ParentForm.SystemConfig2.ModbusSlaveIDCOM3 = 1;
                    this.ParentForm.SystemConfig2.ModbusSlaveIDCOM4 = 1;
                    this.ParentForm.SystemConfig2.CountingOutput1BuzzerTime = 1000;
                    this.ParentForm.SystemConfig2.CountingOutput2BuzzerTime = 1000;
                    this.ParentForm.SystemConfig2.SortingPointLength = 250;
                    this.ParentForm.SystemConfig2.ConveyorLength = structItem2.ConveyorLength;
                    this.ParentForm.SystemConfig2.MarkoprintLineNumberEthernet = structItem2.MarkoprintLineNumberEthernet;
                    this.ParentForm.SystemConfig2.HitachiRoomNumberEthernet = structItem2.HitachiRoomNumberEthernet;
                    this.ParentForm.SystemConfig2.EthernetHostPort = structItem2.EthernetHostPort;
                    this.ParentForm.SystemConfig2.EthernetCommMode = structItem2.EthernetCommMode;
                    this.ParentForm.SystemConfig2.EthernetOperationMode = structItem2.EthernetOperationMode;
                    this.ParentForm.SystemConfig2.FileNameExtension = structItem2.FileNameExtension;
                    this.ParentForm.SystemConfig2.MarkoprintLineNumberCOM4 = structItem2.MarkoprintLineNumberCOM4;
                    this.ParentForm.SystemConfig2.HitachiRoomNumberCOM4 = structItem2.HitachiRoomNumberCOM4;
                    this.ParentForm.SystemConfig2.MarkoprintLineNumberCOM3 = structItem2.MarkoprintLineNumberCOM3;
                    this.ParentForm.SystemConfig2.HitachiRoomNumberCOM3 = structItem2.HitachiRoomNumberCOM3;
                    this.ParentForm.SystemConfig2.MarkoprintLineNumberCOM1 = structItem2.MarkoprintLineNumberCOM1;
                    this.ParentForm.SystemConfig2.HitachiRoomNumberCOM1 = structItem2.HitachiRoomNumberCOM1;
                    this.ParentForm.SystemConfig2.RFID_R420_EPC_Filter = "1";
                    this.ParentForm.SystemConfig2.RFID_R420_BARCD = "00000000000000";
                    this.ParentForm.SystemConfig2.MarkoprintDateSettingEthernet = structItem2.MarkoprintDateSettingEthernet;
                    this.ParentForm.SystemConfig2.EthernetAddress = structItem2.EthernetAddress;
                    this.ParentForm.SystemConfig2.MarkoprintDateSettingCOM4 = structItem2.MarkoprintDateSettingCOM4;
                    this.ParentForm.SystemConfig2.MarkoprintDateSettingCOM3 = structItem2.MarkoprintDateSettingCOM3;
                    this.ParentForm.SystemConfig2.MarkoprintDateSettingCOM1 = structItem2.MarkoprintDateSettingCOM1;

                    // ParentForm.SystemConfig3
                    this.ParentForm.SystemConfig3.ModbusTCPStartAddress = 10;
                    this.ParentForm.SystemConfig3.ModbusRTUStartAddressCOM1 = 10;
                    this.ParentForm.SystemConfig3.ModbusRTUStartAddressCOM3 = 10;
                    this.ParentForm.SystemConfig3.ModbusRTUStartAddressCOM4 = 10;
                }
                catch
                {
                    //DialogFormMessage myMsg = new DialogFormMessage(17, this.ParentForm.SystemConfig1.Language);
                    //myMsg.ShowDialog();

                    //this.ParentForm.smartFileIO.Close();
                }

                this.ParentForm.smartFileIO.Close();
            #endregion

                this.ParentForm.SaveSystemConfigurationFile1(this.ParentForm.SystemConfig1);
                this.ParentForm.SaveSystemConfigurationFile2(this.ParentForm.SystemConfig2);
                this.ParentForm.SaveSystemConfigurationFile3(this.ParentForm.SystemConfig3);
            }
        }
        public void ConvertingSystemItemFromV6()
        {
            string fullFilePath = "";
            bool fileCheck = false;
            string value;
            bool isBarcodeUsing = false;

            StructSystemConfigurationItem1 structItem1;
            StructSystemConfigurationItem2 structItem2;
            StructSystemConfigurationItem3 structItem3;

            #region ParentForm.SystemConfig1
            fullFilePath = this.ParentForm.PathPreVersionSystemFile1Folder + "system.cfg";
            this.ParentForm.smartFileIO.FilePathName = fullFilePath;

            FileInfo fileInfo = new FileInfo(fullFilePath);
            fileCheck = fileInfo.Exists;

            if (fileCheck == true)
            {
                this.ParentForm.smartFileIO.Open(this.ParentForm.BufferSmartUart);

                try
                {
                    structItem1 = (StructSystemConfigurationItem1)this.ParentForm.smartFileIO.ReadStructure(0, typeof(StructSystemConfigurationItem1));

                    this.ParentForm.SystemConfig1.IsDataBackup = structItem1.IsDataBackup;
                    this.ParentForm.SystemConfig1.IsLogin = structItem1.IsLogin;
                    this.ParentForm.SystemConfig1.EquipmentID = structItem1.EquipmentID;
                    this.ParentForm.SystemConfig1.DecimalPlaces = structItem1.DecimalPlaces;
                    this.ParentForm.SystemConfig1.ProductNumber = structItem1.ProductNumber;
                    this.ParentForm.SystemConfig1.SerialCOM1BaudRate = structItem1.Serial1BaudRate;
                    this.ParentForm.SystemConfig1.SerialCOM1Mode = structItem1.Serial1Mode;
                    this.ParentForm.SystemConfig1.SerialCOM3BaudRate = structItem1.Serial2BaudRate;
                    this.ParentForm.SystemConfig1.SerialCOM3Mode = structItem1.Serial2Mode;
                    this.ParentForm.SystemConfig1.SerialCOM4BaudRate = structItem1.Serial3BaudRate;
                    this.ParentForm.SystemConfig1.SerialCOM4Mode = structItem1.Serial3Mode;
                    this.ParentForm.SystemConfig1.SerialNumber = structItem1.SerialNumber;
                    this.ParentForm.SystemConfig1.Unit = structItem1.Unit;
                    this.ParentForm.SystemConfig1.Language = structItem1.Language;

                    this.ParentForm.SystemConfig1.IsAverageTracking = false;
                    this.ParentForm.SystemConfig1.IsExternalInputLamp = structItem1.IsExternalInputLamp;
                    this.ParentForm.SystemConfig1.IsExternalInputBuzzer = structItem1.IsExternalInputBuzzer;
                    this.ParentForm.SystemConfig1.IsPrintPerProductEnable = structItem1.IsPrintPerProductEnable;
                    this.ParentForm.SystemConfig1.StatisticsPrintFormat = structItem1.StatisticsPrintFormat;
                    this.ParentForm.SystemConfig1.TransmissionDelayTimeCOM1 = structItem1.TransmissionDelayTimeCOM1;
                    this.ParentForm.SystemConfig1.TransmissionDelayTimeCOM3 = structItem1.TransmissionDelayTimeCOM3;
                    this.ParentForm.SystemConfig1.TransmissionDelayTimeCOM4 = structItem1.TransmissionDelayTimeCOM4;
                    this.ParentForm.SystemConfig1.DatabackupFormat = structItem1.DatabackupFormat;
                    isBarcodeUsing = structItem1.DummyBool1;

                    this.ParentForm.SystemConfig1.UserDefineCOM1 = structItem1.UserDefineCOM1;
                    this.ParentForm.SystemConfig1.UserDefineCOM3 = structItem1.UserDefineCOM3;
                    this.ParentForm.SystemConfig1.UserDefineCOM4 = structItem1.UserDefineCOM4;
                }
                catch
                {
                    //DialogFormMessage myMsg = new DialogFormMessage(17, this.ParentForm.SystemConfig1.Language);
                    //myMsg.ShowDialog();

                    //this.ParentForm.smartFileIO.Close();
                }
                this.ParentForm.smartFileIO.Close();
            }
            #endregion

            #region ParentForm.SystemConfig2, 3
            fullFilePath = this.ParentForm.PathPreVersionSystemFile1Folder + "system2.cfg";
            this.ParentForm.smartFileIO.FilePathName = fullFilePath;

            fileInfo = new FileInfo(fullFilePath);
            fileCheck = fileInfo.Exists;

            if (fileCheck == true)
            {
                this.ParentForm.smartFileIO.Open(this.ParentForm.BufferSmartUart);

                try
                {
                    structItem2 = (StructSystemConfigurationItem2)this.ParentForm.smartFileIO.ReadStructure(0, typeof(StructSystemConfigurationItem2));
                    structItem3 = (StructSystemConfigurationItem3)this.ParentForm.smartFileIO.ReadStructure(1, typeof(StructSystemConfigurationItem3));

                    // ParentForm.SystemConfig2
                    this.ParentForm.SystemConfig2.IsCountingOutput1Continuous = structItem2.IsCountingOutput1Continuous;
                    this.ParentForm.SystemConfig2.IsCountingOutput1ConveyorStop = structItem2.IsCountingOutput1ConveyorStop;
                    this.ParentForm.SystemConfig2.IsCountingOutput1BuzzerOn = structItem2.IsCountingOutput1BuzzerOn;
                    this.ParentForm.SystemConfig2.IsCountingOutput1ExternalOutput = structItem2.IsCountingOutput1ExternalOutput;
                    this.ParentForm.SystemConfig2.IsCountingOutput2Continuous = structItem2.IsCountingOutput2Continuous;
                    this.ParentForm.SystemConfig2.IsCountingOutput2ConveyorStop = structItem2.IsCountingOutput2ConveyorStop;
                    this.ParentForm.SystemConfig2.IsCountingOutput2BuzzerOn = structItem2.IsCountingOutput2BuzzerOn;
                    this.ParentForm.SystemConfig2.IsCountingOutput2ExternalOutput = structItem2.IsCountingOutput2ExternalOutput;

                    this.ParentForm.SystemConfig2.IsRFIDSpeedwayR420 = false;
                    this.ParentForm.SystemConfig2.IsCommunicationOption = structItem2.IsCommunicationOption;
                    this.ParentForm.SystemConfig2.IsBypassOnce = structItem2.IsBypassOnce;
                    this.ParentForm.SystemConfig2.IsBypassDirectionPass = structItem2.IsBypassDirectionPass;
                    this.ParentForm.SystemConfig2.IsHitachiBlankToNoneCOM1 = structItem2.IsHitachiBlankToNoneCOM1;
                    this.ParentForm.SystemConfig2.IsHitachiBlankToNoneCOM3 = structItem2.IsHitachiBlankToNoneCOM3;
                    this.ParentForm.SystemConfig2.IsHitachiBlankToNoneCOM4 = structItem2.IsHitachiBlankToNoneCOM4;
                    this.ParentForm.SystemConfig2.IsMarkoprintTodaytDatePrintEthernet = structItem2.IsMarkoprintTodaytDatePrintEthernet;
                    this.ParentForm.SystemConfig2.IsMarkoprintDatePrintEthernet = structItem2.IsMarkoprintDatePrintEthernet;
                    this.ParentForm.SystemConfig2.IsGroup1UsingRandomMode = structItem2.IsGroup1UsingRandomMode;
                    this.ParentForm.SystemConfig2.IsGroup2UsingRandomMode = structItem2.IsGroup2UsingRandomMode;
                    this.ParentForm.SystemConfig2.IsGroup3UsingRandomMode = structItem2.IsGroup3UsingRandomMode;
                    this.ParentForm.SystemConfig2.IsGroup4UsingRandomMode = structItem2.IsGroup4UsingRandomMode;
                    this.ParentForm.SystemConfig2.IsGroup5UsingRandomMode = structItem2.IsGroup5UsingRandomMode;
                    this.ParentForm.SystemConfig2.IsMarkoprintTodaytDatePrintCOM4 = structItem2.IsMarkoprintTodaytDatePrintCOM4;
                    this.ParentForm.SystemConfig2.IsMarkoprintDatePrintCOM4 = structItem2.IsMarkoprintDatePrintCOM4;
                    this.ParentForm.SystemConfig2.IsMarkoprintTodaytDatePrintCOM3 = structItem2.IsMarkoprintTodaytDatePrintCOM3;
                    this.ParentForm.SystemConfig2.IsMarkoprintDatePrintCOM3 = structItem2.IsMarkoprintDatePrintCOM3;
                    this.ParentForm.SystemConfig2.IsMarkoprintTodaytDatePrintCOM1 = structItem2.IsMarkoprintTodaytDatePrintCOM1;
                    this.ParentForm.SystemConfig2.IsMarkoprintDatePrintCOM1 = structItem2.IsMarkoprintDatePrintCOM1;

                    this.ParentForm.SystemConfig2.CountingOutput1Mode = structItem2.CountingOutput1Mode;
                    this.ParentForm.SystemConfig2.CountingOutput1Number = structItem2.CountingOutput1Number;
                    this.ParentForm.SystemConfig2.CountingOutput2Mode = structItem2.CountingOutput2Mode;
                    this.ParentForm.SystemConfig2.CountingOutput2Number = structItem2.CountingOutput2Number;

                    this.ParentForm.SystemConfig2.MULTiJETSlaveAddressEthernet = 58;
                    this.ParentForm.SystemConfig2.MULTiJETSlaveAddressCOM1 = 58;
                    this.ParentForm.SystemConfig2.MULTiJETSlaveAddressCOM3 = 58;
                    this.ParentForm.SystemConfig2.MULTiJETSlaveAddressCOM4 = 58;
                    this.ParentForm.SystemConfig2.ModbusTCPSelectFunction = 0;
                    this.ParentForm.SystemConfig2.EthernetLocalPort = 0;
                    this.ParentForm.SystemConfig2.CommunicationControlCharacter = 0;
                    if (isBarcodeUsing == true)
                        this.ParentForm.SystemConfig2.Barcode = 2;
                    else
                        this.ParentForm.SystemConfig2.Barcode = 0;
                    this.ParentForm.SystemConfig2.AverageTrackingCount = 0;
                    this.ParentForm.SystemConfig2.ModbusRTUSelectFunction = 0;
                    this.ParentForm.SystemConfig2.ModbusSlaveIDCOM1 = 1;
                    this.ParentForm.SystemConfig2.ModbusSlaveIDCOM3 = 1;
                    this.ParentForm.SystemConfig2.ModbusSlaveIDCOM4 = 1;
                    this.ParentForm.SystemConfig2.CountingOutput1BuzzerTime = structItem2.Alarm1BuzzerTime;
                    this.ParentForm.SystemConfig2.CountingOutput2BuzzerTime = structItem2.Alarm2BuzzerTime;
                    this.ParentForm.SystemConfig2.SortingPointLength = structItem2.SortingPointLength;
                    this.ParentForm.SystemConfig2.ConveyorLength = structItem2.ConveyorLength;
                    this.ParentForm.SystemConfig2.MarkoprintLineNumberEthernet = structItem2.MarkoprintLineNumberEthernet;
                    this.ParentForm.SystemConfig2.HitachiRoomNumberEthernet = structItem2.HitachiRoomNumberEthernet;
                    this.ParentForm.SystemConfig2.EthernetHostPort = structItem2.EthernetHostPort;
                    this.ParentForm.SystemConfig2.EthernetCommMode = structItem2.EthernetCommMode;
                    this.ParentForm.SystemConfig2.EthernetOperationMode = structItem2.EthernetOperationMode;
                    this.ParentForm.SystemConfig2.FileNameExtension = structItem2.FileNameExtension;
                    this.ParentForm.SystemConfig2.MarkoprintLineNumberCOM4 = structItem2.MarkoprintLineNumberCOM4;
                    this.ParentForm.SystemConfig2.HitachiRoomNumberCOM4 = structItem2.HitachiRoomNumberCOM4;
                    this.ParentForm.SystemConfig2.MarkoprintLineNumberCOM3 = structItem2.MarkoprintLineNumberCOM3;
                    this.ParentForm.SystemConfig2.HitachiRoomNumberCOM3 = structItem2.HitachiRoomNumberCOM3;
                    this.ParentForm.SystemConfig2.MarkoprintLineNumberCOM1 = structItem2.MarkoprintLineNumberCOM1;
                    this.ParentForm.SystemConfig2.HitachiRoomNumberCOM1 = structItem2.HitachiRoomNumberCOM1;
                    this.ParentForm.SystemConfig2.RFID_R420_EPC_Filter = "1";
                    this.ParentForm.SystemConfig2.RFID_R420_BARCD = "00000000000000";
                    this.ParentForm.SystemConfig2.MarkoprintDateSettingEthernet = structItem2.MarkoprintDateSettingEthernet;
                    this.ParentForm.SystemConfig2.EthernetAddress = structItem2.EthernetAddress;
                    this.ParentForm.SystemConfig2.MarkoprintDateSettingCOM4 = structItem2.MarkoprintDateSettingCOM4;
                    this.ParentForm.SystemConfig2.MarkoprintDateSettingCOM3 = structItem2.MarkoprintDateSettingCOM3;
                    this.ParentForm.SystemConfig2.MarkoprintDateSettingCOM1 = structItem2.MarkoprintDateSettingCOM1;

                    // ParentForm.SystemConfig3
                    this.ParentForm.SystemConfig3.ModbusTCPStartAddress = 10;
                    this.ParentForm.SystemConfig3.ModbusRTUStartAddressCOM1 = 10;
                    this.ParentForm.SystemConfig3.ModbusRTUStartAddressCOM3 = 10;
                    this.ParentForm.SystemConfig3.ModbusRTUStartAddressCOM4 = 10;
                }
                catch
                {
                    //DialogFormMessage myMsg = new DialogFormMessage(17, this.ParentForm.SystemConfig1.Language);
                    //myMsg.ShowDialog();

                    //this.ParentForm.smartFileIO.Close();
                }

                this.ParentForm.smartFileIO.Close();
            #endregion

                this.ParentForm.SaveSystemConfigurationFile1(this.ParentForm.SystemConfig1);
                this.ParentForm.SaveSystemConfigurationFile2(this.ParentForm.SystemConfig2);
                this.ParentForm.SaveSystemConfigurationFile3(this.ParentForm.SystemConfig3);
            }
        }
        public void ConvertingSystemItemFromV7V8()
        {
            string fullFilePath = "";
            bool fileCheck = false;
            string value;

            StructSystemConfigurationItem1 structItem1;
            StructSystemConfigurationItem2 structItem2;
            StructSystemConfigurationItem3 structItem3;

            #region ParentForm.SystemConfig1
            fullFilePath = this.ParentForm.PathPreVersionSystemFile1Folder + "system.cfg";
            this.ParentForm.smartFileIO.FilePathName = fullFilePath;

            FileInfo fileInfo = new FileInfo(fullFilePath);
            fileCheck = fileInfo.Exists;

            if (fileCheck == true)
            {
                this.ParentForm.smartFileIO.Open(this.ParentForm.BufferSmartUart);

                try
                {
                    structItem1 = (StructSystemConfigurationItem1)this.ParentForm.smartFileIO.ReadStructure(0, typeof(StructSystemConfigurationItem1));

                    this.ParentForm.SystemConfig1.IsDataBackup = structItem1.IsDataBackup;
                    this.ParentForm.SystemConfig1.IsLogin = structItem1.IsLogin;
                    this.ParentForm.SystemConfig1.EquipmentID = structItem1.EquipmentID;
                    this.ParentForm.SystemConfig1.DecimalPlaces = structItem1.DecimalPlaces;
                    this.ParentForm.SystemConfig1.ProductNumber = structItem1.ProductNumber;
                    this.ParentForm.SystemConfig1.SerialCOM1BaudRate = structItem1.Serial1BaudRate;
                    this.ParentForm.SystemConfig1.SerialCOM1Mode = structItem1.Serial1Mode;
                    this.ParentForm.SystemConfig1.SerialCOM3BaudRate = structItem1.Serial2BaudRate;
                    this.ParentForm.SystemConfig1.SerialCOM3Mode = structItem1.Serial2Mode;
                    this.ParentForm.SystemConfig1.SerialCOM4BaudRate = structItem1.Serial3BaudRate;
                    this.ParentForm.SystemConfig1.SerialCOM4Mode = structItem1.Serial3Mode;
                    this.ParentForm.SystemConfig1.SerialNumber = structItem1.SerialNumber;
                    this.ParentForm.SystemConfig1.Unit = structItem1.Unit;
                    this.ParentForm.SystemConfig1.Language = structItem1.Language;

                    this.ParentForm.SystemConfig1.IsAverageTracking = structItem1.IsAverageTracking;
                    this.ParentForm.SystemConfig1.IsExternalInputLamp = structItem1.IsExternalInputLamp;
                    this.ParentForm.SystemConfig1.IsExternalInputBuzzer = structItem1.IsExternalInputBuzzer;
                    this.ParentForm.SystemConfig1.IsPrintPerProductEnable = structItem1.IsPrintPerProductEnable;
                    this.ParentForm.SystemConfig1.StatisticsPrintFormat = structItem1.StatisticsPrintFormat;
                    this.ParentForm.SystemConfig1.TransmissionDelayTimeCOM1 = structItem1.TransmissionDelayTimeCOM1;
                    this.ParentForm.SystemConfig1.TransmissionDelayTimeCOM3 = structItem1.TransmissionDelayTimeCOM3;
                    this.ParentForm.SystemConfig1.TransmissionDelayTimeCOM4 = structItem1.TransmissionDelayTimeCOM4;
                    this.ParentForm.SystemConfig1.DatabackupFormat = structItem1.DatabackupFormat;

                    this.ParentForm.SystemConfig1.UserDefineCOM1 = structItem1.UserDefineCOM1;
                    this.ParentForm.SystemConfig1.UserDefineCOM3 = structItem1.UserDefineCOM3;
                    this.ParentForm.SystemConfig1.UserDefineCOM4 = structItem1.UserDefineCOM4;
                }
                catch
                {
                    //DialogFormMessage myMsg = new DialogFormMessage(17, this.ParentForm.SystemConfig1.Language);
                    //myMsg.ShowDialog();

                    //this.ParentForm.smartFileIO.Close();
                }
                this.ParentForm.smartFileIO.Close();
            }
            #endregion

            #region ParentForm.SystemConfig2, 3
            fullFilePath = this.ParentForm.PathPreVersionSystemFile1Folder + "system2.cfg";
            this.ParentForm.smartFileIO.FilePathName = fullFilePath;

            fileInfo = new FileInfo(fullFilePath);
            fileCheck = fileInfo.Exists;

            if (fileCheck == true)
            {
                this.ParentForm.smartFileIO.Open(this.ParentForm.BufferSmartUart);

                try
                {
                    structItem2 = (StructSystemConfigurationItem2)this.ParentForm.smartFileIO.ReadStructure(0, typeof(StructSystemConfigurationItem2));
                    structItem3 = (StructSystemConfigurationItem3)this.ParentForm.smartFileIO.ReadStructure(1, typeof(StructSystemConfigurationItem3));

                    // ParentForm.SystemConfig2
                    this.ParentForm.SystemConfig2.IsCountingOutput1Continuous = structItem2.IsCountingOutput1Continuous;
                    this.ParentForm.SystemConfig2.IsCountingOutput1ConveyorStop = structItem2.IsCountingOutput1ConveyorStop;
                    this.ParentForm.SystemConfig2.IsCountingOutput1BuzzerOn = structItem2.IsCountingOutput1BuzzerOn;
                    this.ParentForm.SystemConfig2.IsCountingOutput1ExternalOutput = structItem2.IsCountingOutput1ExternalOutput;
                    this.ParentForm.SystemConfig2.IsCountingOutput2Continuous = structItem2.IsCountingOutput2Continuous;
                    this.ParentForm.SystemConfig2.IsCountingOutput2ConveyorStop = structItem2.IsCountingOutput2ConveyorStop;
                    this.ParentForm.SystemConfig2.IsCountingOutput2BuzzerOn = structItem2.IsCountingOutput2BuzzerOn;
                    this.ParentForm.SystemConfig2.IsCountingOutput2ExternalOutput = structItem2.IsCountingOutput2ExternalOutput;

                    this.ParentForm.SystemConfig2.IsRFIDSpeedwayR420 = structItem2.IsRFIDSpeedwayR420;
                    this.ParentForm.SystemConfig2.IsCommunicationOption = structItem2.IsCommunicationOption;
                    this.ParentForm.SystemConfig2.IsBypassOnce = structItem2.IsBypassOnce;
                    this.ParentForm.SystemConfig2.IsBypassDirectionPass = structItem2.IsBypassDirectionPass;
                    this.ParentForm.SystemConfig2.IsHitachiBlankToNoneCOM1 = structItem2.IsHitachiBlankToNoneCOM1;
                    this.ParentForm.SystemConfig2.IsHitachiBlankToNoneCOM3 = structItem2.IsHitachiBlankToNoneCOM3;
                    this.ParentForm.SystemConfig2.IsHitachiBlankToNoneCOM4 = structItem2.IsHitachiBlankToNoneCOM4;
                    this.ParentForm.SystemConfig2.IsMarkoprintTodaytDatePrintEthernet = structItem2.IsMarkoprintTodaytDatePrintEthernet;
                    this.ParentForm.SystemConfig2.IsMarkoprintDatePrintEthernet = structItem2.IsMarkoprintDatePrintEthernet;
                    this.ParentForm.SystemConfig2.IsGroup1UsingRandomMode = structItem2.IsGroup1UsingRandomMode;
                    this.ParentForm.SystemConfig2.IsGroup2UsingRandomMode = structItem2.IsGroup2UsingRandomMode;
                    this.ParentForm.SystemConfig2.IsGroup3UsingRandomMode = structItem2.IsGroup3UsingRandomMode;
                    this.ParentForm.SystemConfig2.IsGroup4UsingRandomMode = structItem2.IsGroup4UsingRandomMode;
                    this.ParentForm.SystemConfig2.IsGroup5UsingRandomMode = structItem2.IsGroup5UsingRandomMode;
                    this.ParentForm.SystemConfig2.IsMarkoprintTodaytDatePrintCOM4 = structItem2.IsMarkoprintTodaytDatePrintCOM4;
                    this.ParentForm.SystemConfig2.IsMarkoprintDatePrintCOM4 = structItem2.IsMarkoprintDatePrintCOM4;
                    this.ParentForm.SystemConfig2.IsMarkoprintTodaytDatePrintCOM3 = structItem2.IsMarkoprintTodaytDatePrintCOM3;
                    this.ParentForm.SystemConfig2.IsMarkoprintDatePrintCOM3 = structItem2.IsMarkoprintDatePrintCOM3;
                    this.ParentForm.SystemConfig2.IsMarkoprintTodaytDatePrintCOM1 = structItem2.IsMarkoprintTodaytDatePrintCOM1;
                    this.ParentForm.SystemConfig2.IsMarkoprintDatePrintCOM1 = structItem2.IsMarkoprintDatePrintCOM1;

                    this.ParentForm.SystemConfig2.CountingOutput1Mode = structItem2.CountingOutput1Mode;
                    this.ParentForm.SystemConfig2.CountingOutput1Number = structItem2.CountingOutput1Number;
                    this.ParentForm.SystemConfig2.CountingOutput2Mode = structItem2.CountingOutput2Mode;
                    this.ParentForm.SystemConfig2.CountingOutput2Number = structItem2.CountingOutput2Number;

                    this.ParentForm.SystemConfig2.MULTiJETSlaveAddressEthernet = structItem2.MULTiJETSlaveAddressEthernet;
                    this.ParentForm.SystemConfig2.MULTiJETSlaveAddressCOM1 = structItem2.MULTiJETSlaveAddressCOM1;
                    this.ParentForm.SystemConfig2.MULTiJETSlaveAddressCOM3 = structItem2.MULTiJETSlaveAddressCOM3;
                    this.ParentForm.SystemConfig2.MULTiJETSlaveAddressCOM4 = structItem2.MULTiJETSlaveAddressCOM4;
                    this.ParentForm.SystemConfig2.ModbusTCPSelectFunction = structItem2.ModbusTCPSelectFunction;
                    this.ParentForm.SystemConfig2.EthernetLocalPort = structItem2.EthernetLocalPort;
                    this.ParentForm.SystemConfig2.CommunicationControlCharacter = structItem2.CommunicationControlCharacter;
                    this.ParentForm.SystemConfig2.Barcode = structItem2.Barcode;
                    this.ParentForm.SystemConfig2.AverageTrackingCount = structItem2.AverageTracking;
                    this.ParentForm.SystemConfig2.ModbusRTUSelectFunction = structItem2.ModbusRTUSelectFunction;
                    this.ParentForm.SystemConfig2.ModbusSlaveIDCOM1 = structItem2.ModbusRTUSlaveIDCOM1;
                    this.ParentForm.SystemConfig2.ModbusSlaveIDCOM3 = structItem2.ModbusRTUSlaveIDCOM3;
                    this.ParentForm.SystemConfig2.ModbusSlaveIDCOM4 = structItem2.ModbusRTUSlaveIDCOM4;
                    this.ParentForm.SystemConfig2.CountingOutput1BuzzerTime = structItem2.Alarm1BuzzerTime;
                    this.ParentForm.SystemConfig2.CountingOutput2BuzzerTime = structItem2.Alarm2BuzzerTime;
                    this.ParentForm.SystemConfig2.SortingPointLength = structItem2.SortingPointLength;
                    this.ParentForm.SystemConfig2.ConveyorLength = structItem2.ConveyorLength;
                    this.ParentForm.SystemConfig2.MarkoprintLineNumberEthernet = structItem2.MarkoprintLineNumberEthernet;
                    this.ParentForm.SystemConfig2.HitachiRoomNumberEthernet = structItem2.HitachiRoomNumberEthernet;
                    this.ParentForm.SystemConfig2.EthernetHostPort = structItem2.EthernetHostPort;
                    this.ParentForm.SystemConfig2.EthernetCommMode = structItem2.EthernetCommMode;
                    this.ParentForm.SystemConfig2.EthernetOperationMode = structItem2.EthernetOperationMode;
                    this.ParentForm.SystemConfig2.FileNameExtension = structItem2.FileNameExtension;
                    this.ParentForm.SystemConfig2.MarkoprintLineNumberCOM4 = structItem2.MarkoprintLineNumberCOM4;
                    this.ParentForm.SystemConfig2.HitachiRoomNumberCOM4 = structItem2.HitachiRoomNumberCOM4;
                    this.ParentForm.SystemConfig2.MarkoprintLineNumberCOM3 = structItem2.MarkoprintLineNumberCOM3;
                    this.ParentForm.SystemConfig2.HitachiRoomNumberCOM3 = structItem2.HitachiRoomNumberCOM3;
                    this.ParentForm.SystemConfig2.MarkoprintLineNumberCOM1 = structItem2.MarkoprintLineNumberCOM1;
                    this.ParentForm.SystemConfig2.HitachiRoomNumberCOM1 = structItem2.HitachiRoomNumberCOM1;
                    this.ParentForm.SystemConfig2.RFID_R420_EPC_Filter = structItem2.RFID_R420_EPC_Filter;
                    this.ParentForm.SystemConfig2.RFID_R420_BARCD = structItem2.RFID_R420_BARCD;
                    this.ParentForm.SystemConfig2.MarkoprintDateSettingEthernet = structItem2.MarkoprintDateSettingEthernet;
                    this.ParentForm.SystemConfig2.EthernetAddress = structItem2.EthernetAddress;
                    this.ParentForm.SystemConfig2.MarkoprintDateSettingCOM4 = structItem2.MarkoprintDateSettingCOM4;
                    this.ParentForm.SystemConfig2.MarkoprintDateSettingCOM3 = structItem2.MarkoprintDateSettingCOM3;
                    this.ParentForm.SystemConfig2.MarkoprintDateSettingCOM1 = structItem2.MarkoprintDateSettingCOM1;

                    // ParentForm.SystemConfig3
                    this.ParentForm.SystemConfig3.ModbusTCPStartAddress = structItem3.ModbusTCPStartAddress;
                    this.ParentForm.SystemConfig3.ModbusRTUStartAddressCOM1 = structItem3.ModbusRTUStartAddressCOM1;
                    this.ParentForm.SystemConfig3.ModbusRTUStartAddressCOM3 = structItem3.ModbusRTUStartAddressCOM3;
                    this.ParentForm.SystemConfig3.ModbusRTUStartAddressCOM4 = structItem3.ModbusRTUStartAddressCOM4;
                }
                catch
                {
                    //DialogFormMessage myMsg = new DialogFormMessage(17, this.ParentForm.SystemConfig1.Language);
                    //myMsg.ShowDialog();

                    //this.ParentForm.smartFileIO.Close();
                }

                this.ParentForm.smartFileIO.Close();
            #endregion

                this.ParentForm.SaveSystemConfigurationFile1(this.ParentForm.SystemConfig1);
                this.ParentForm.SaveSystemConfigurationFile2(this.ParentForm.SystemConfig2);
                this.ParentForm.SaveSystemConfigurationFile3(this.ParentForm.SystemConfig3);
            }
        }
        // ProductItem : 센싱시간, 디스펜서 지연시간은  try~catch문을 사용하여 모든 버전 호환 가능하도록 함
        public void ConvertingProductItemUntilV7()
        {
            bool fileCheck = false;
            string fullFilePath = "";
            StructProductItemUntilV7 structItem;

            fullFilePath = this.ParentForm.PathPreVersionSystemFile2Folder + "ProductItem.int";
            this.ParentForm.smartFileIO.FilePathName = fullFilePath;

            FileInfo fileInfo = new FileInfo(fullFilePath);
            fileCheck = fileInfo.Exists;

            if (fileCheck == true)
            {
                this.ParentForm.smartFileIO.Open(this.ParentForm.BufferSmartUart);

                try
                {
                    if (this.ParentForm.smartFileIO.ReadStructureAllBuffer() == true)
                    {
                        for (int i = 0; i < this.ParentForm.ProductCount; i++)
                        {
                            structItem = (StructProductItemUntilV7)this.ParentForm.smartFileIO.ReadStructureBuffer(typeof(StructProductItemUntilV7), i);

                            this.ParentForm.CollectionProductItem[i].Number = structItem.Number;
                            this.ParentForm.CollectionProductItem[i].Name = structItem.Name;
                            this.ParentForm.CollectionProductItem[i].LotNo = structItem.LotNo;
                            this.ParentForm.CollectionProductItem[i].OverRange = structItem.OverRange;
                            this.ParentForm.CollectionProductItem[i].PassRange = structItem.PassRange;
                            this.ParentForm.CollectionProductItem[i].UnderRange = structItem.UnderRange;
                            this.ParentForm.CollectionProductItem[i].TareRange = structItem.TareRange;

                            if (structItem.SensingTime == "")
                                this.ParentForm.CollectionProductItem[i].SensingTime = "0";
                            else
                                this.ParentForm.CollectionProductItem[i].SensingTime = structItem.SensingTime;

                            this.ParentForm.CollectionProductItem[i].DispenserDelayTime1 = "200";
                            this.ParentForm.CollectionProductItem[i].DispenserDelayTime2 = "200";
                        }
                    }
                }
                catch
                {
                    //DialogFormMessage myMsg = new DialogFormMessage(17, this.ParentForm.SystemConfig1.Language);
                    //myMsg.ShowDialog();

                    //this.ParentForm.smartFileIO.Close();
                }
            }

            this.ParentForm.SaveProductFile(this.ParentForm.CollectionProductItem);
            this.ParentForm.smartFileIO.Close();
        }
        public void ConvertingProductItemFromV8()
        {
            bool fileCheck = false;
            string fullFilePath = "";
            StructProductItem structItem;

            fullFilePath = this.ParentForm.PathPreVersionSystemFile2Folder + "ProductItem.int";
            this.ParentForm.smartFileIO.FilePathName = fullFilePath;

            FileInfo fileInfo = new FileInfo(fullFilePath);
            fileCheck = fileInfo.Exists;

            if (fileCheck == true)
            {
                this.ParentForm.smartFileIO.Open(this.ParentForm.BufferSmartUart);

                try
                {
                    if (this.ParentForm.smartFileIO.ReadStructureAllBuffer() == true)
                    {
                        for (int i = 0; i < this.ParentForm.ProductCount; i++)
                        {
                            structItem = (StructProductItem)this.ParentForm.smartFileIO.ReadStructureBuffer(typeof(StructProductItem), i);

                            this.ParentForm.CollectionProductItem[i].Number = structItem.Number;
                            this.ParentForm.CollectionProductItem[i].Name = structItem.Name;
                            this.ParentForm.CollectionProductItem[i].LotNo = structItem.LotNo;
                            this.ParentForm.CollectionProductItem[i].OverRange = structItem.OverRange;
                            this.ParentForm.CollectionProductItem[i].PassRange = structItem.PassRange;
                            this.ParentForm.CollectionProductItem[i].UnderRange = structItem.UnderRange;
                            this.ParentForm.CollectionProductItem[i].TareRange = structItem.TareRange;

                            if (structItem.SensingTime == "")
                                this.ParentForm.CollectionProductItem[i].SensingTime = "0";
                            else
                                this.ParentForm.CollectionProductItem[i].SensingTime = structItem.SensingTime;

                            if (structItem.DispenserDelayTime1 == "")
                                this.ParentForm.CollectionProductItem[i].DispenserDelayTime1 = "200";
                            else
                                this.ParentForm.CollectionProductItem[i].DispenserDelayTime1 = structItem.DispenserDelayTime1;

                            if (structItem.DispenserDelayTime2 == "")
                                this.ParentForm.CollectionProductItem[i].DispenserDelayTime2 = "200";
                            else
                                this.ParentForm.CollectionProductItem[i].DispenserDelayTime2 = structItem.DispenserDelayTime2;

                        }
                    }
                }
                catch
                {
                    //DialogFormMessage myMsg = new DialogFormMessage(17, this.ParentForm.SystemConfig1.Language);
                    //myMsg.ShowDialog();

                    //this.ParentForm.smartFileIO.Close();
                }
            }

            this.ParentForm.SaveProductFile(this.ParentForm.CollectionProductItem);
            this.ParentForm.smartFileIO.Close();
        }
        // CounterItem : 값 그대로 불러오기
        public void ConvertingCounterItem()
        {
            string fullFilePath = "";
            bool fileCheck = false;
            StructCounterItem structItemFrom;

            fullFilePath = this.ParentForm.PathPreVersionSystemFile2Folder + "CounterItem.cfg";
            this.ParentForm.smartFileIO.FilePathName = fullFilePath;

            FileInfo fileInfo = new FileInfo(fullFilePath);
            fileCheck = fileInfo.Exists;

            if (fileCheck == true)
            {
                this.ParentForm.smartFileIO.Open(this.ParentForm.BufferSmartUart);

                try
                {
                    if (this.ParentForm.smartFileIO.ReadStructureAllBuffer() == true)
                    {
                        for (int i = 0; i < this.ParentForm.ProductCount; i++)
                        {
                            structItemFrom = (StructCounterItem)this.ParentForm.smartFileIO.ReadStructureBuffer(typeof(StructCounterItem), i);

                            this.ParentForm.CollectionWeightData[i].UnderCount = structItemFrom.UnderCount;
                            this.ParentForm.CollectionWeightData[i].UnderSumWeight = structItemFrom.UnderSumWeight;
                            this.ParentForm.CollectionWeightData[i].PassCount = structItemFrom.PassCount;
                            this.ParentForm.CollectionWeightData[i].PassSumWeight = structItemFrom.PassSumWeight;
                            this.ParentForm.CollectionWeightData[i].OverCount = structItemFrom.OverCount;
                            this.ParentForm.CollectionWeightData[i].OverSumWeight = structItemFrom.OverSumWeight;
                            this.ParentForm.CollectionWeightData[i].ExNGCount = structItemFrom.ExNGCount;

                            this.ParentForm.CollectionWeightData[i].CollectionNormalDistributionCount[0] = structItemFrom.NormalDistribution1;
                            this.ParentForm.CollectionWeightData[i].CollectionNormalDistributionCount[1] = structItemFrom.NormalDistribution2;
                            this.ParentForm.CollectionWeightData[i].CollectionNormalDistributionCount[2] = structItemFrom.NormalDistribution3;
                            this.ParentForm.CollectionWeightData[i].CollectionNormalDistributionCount[3] = structItemFrom.NormalDistribution4;
                            this.ParentForm.CollectionWeightData[i].CollectionNormalDistributionCount[4] = structItemFrom.NormalDistribution5;
                            this.ParentForm.CollectionWeightData[i].CollectionNormalDistributionCount[5] = structItemFrom.NormalDistribution6;
                            this.ParentForm.CollectionWeightData[i].CollectionNormalDistributionCount[6] = structItemFrom.NormalDistribution7;
                            this.ParentForm.CollectionWeightData[i].CollectionNormalDistributionCount[7] = structItemFrom.NormalDistribution8;
                            this.ParentForm.CollectionWeightData[i].CollectionNormalDistributionCount[8] = structItemFrom.NormalDistribution9;
                            this.ParentForm.CollectionWeightData[i].CollectionNormalDistributionCount[9] = structItemFrom.NormalDistribution10;

                            this.ParentForm.CollectionWeightData[i].StartTime = structItemFrom.StartTime;
                            this.ParentForm.CollectionWeightData[i].StopTime = structItemFrom.StopTime;
                        }
                    }
                }
                catch
                {
                    //DialogFormMessage myMsg = new DialogFormMessage(17, this.ParentForm.SystemConfig1.Language);
                    //myMsg.ShowDialog();

                    //this.ParentForm.smartFileIO.Close();
                }

                this.ParentForm.SaveCounterFile(this.ParentForm.CollectionWeightData);
                this.ParentForm.smartFileIO.Close();
            }
        }
        // JudgmentItem : 상승/하강지연은 try~catch문을 사용하여 모든 버전 호환 가능하도록 함
        public void ConvertingJudgmentItem()
        {
            bool fileCheck = false;
            string fullFilePath = "";
            StructJudgmentSetItem structItemFrom;

            fullFilePath = this.ParentForm.PathPreVersionSystemFile2Folder + "JudgmentSetItem.int";
            this.ParentForm.smartFileIO.FilePathName = fullFilePath;

            FileInfo fileInfo = new FileInfo(fullFilePath);
            fileCheck = fileInfo.Exists;

            if (fileCheck == true)
            {
                this.ParentForm.smartFileIO.Open(this.ParentForm.BufferSmartUart);

                try
                {
                    if (this.ParentForm.smartFileIO.ReadStructureAllBuffer() == true)
                    {
                        for (int i = 0; i < this.ParentForm.ProductCount; i++)
                        {
                            structItemFrom = (StructJudgmentSetItem)this.ParentForm.smartFileIO.ReadStructureBuffer(typeof(StructJudgmentSetItem), i);

                            this.ParentForm.CollectionJudgmentItem[i].Filter = structItemFrom.Filter;
                            this.ParentForm.CollectionJudgmentItem[i].JudgmentDelayTime = structItemFrom.JudgmentDelayTime;
                            this.ParentForm.CollectionJudgmentItem[i].DoubleDelayTime = structItemFrom.DoubleDelayTime;
                            this.ParentForm.CollectionJudgmentItem[i].JudgmentCount = structItemFrom.JudgmentCount;
                            this.ParentForm.CollectionJudgmentItem[i].FeedSpeed1 = structItemFrom.FeedSpeed1;
                            this.ParentForm.CollectionJudgmentItem[i].FeedSpeed2 = structItemFrom.FeedSpeed2;
                            this.ParentForm.CollectionJudgmentItem[i].FeedSpeed3 = structItemFrom.FeedSpeed3;
                            this.ParentForm.CollectionJudgmentItem[i].DynamicCorrection = structItemFrom.DynamicCorrection;

                            this.ParentForm.CollectionJudgmentItem[i].Sorter1Mode = structItemFrom.Sorter1Mode;
                            this.ParentForm.CollectionJudgmentItem[i].Sorter1DelayTime = structItemFrom.Sorter1DelayTime;
                            this.ParentForm.CollectionJudgmentItem[i].Sorter1RunTime = structItemFrom.Sorter1RunTime;
                            this.ParentForm.CollectionJudgmentItem[i].Sorter2Mode = structItemFrom.Sorter2Mode;
                            this.ParentForm.CollectionJudgmentItem[i].Sorter2DelayTime = structItemFrom.Sorter2DelayTime;
                            this.ParentForm.CollectionJudgmentItem[i].Sorter2RunTime = structItemFrom.Sorter2RunTime;

                            this.ParentForm.CollectionJudgmentItem[i].ProductLength = structItemFrom.ProductLength;
                            this.ParentForm.CollectionJudgmentItem[i].AutoJudgment1 = structItemFrom.AutoJudgment1;
                            this.ParentForm.CollectionJudgmentItem[i].AutoJudgment2 = structItemFrom.AutoJudgment2;
                            this.ParentForm.CollectionJudgmentItem[i].AutoJudgment3 = structItemFrom.AutoJudgment3;

                            try
                            {
                                this.ParentForm.CollectionJudgmentItem[i].AscendDelayTime = structItemFrom.AscendDelayTime;
                                this.ParentForm.CollectionJudgmentItem[i].DescendDelayTime = structItemFrom.DescendDelayTime;
                            }
                            catch
                            {
                                this.ParentForm.CollectionJudgmentItem[i].AscendDelayTime = 1000;
                                this.ParentForm.CollectionJudgmentItem[i].DescendDelayTime = 1000;
                            }
                        }
                    }
                }
                catch
                {
                    //DialogFormMessage myMsg = new DialogFormMessage(17, this.ParentForm.SystemConfig1.Language);
                    //myMsg.ShowDialog();

                    //this.ParentForm.smartFileIO.Close();
                }

                this.ParentForm.SaveJudgmentSetFile(this.ParentForm.CollectionJudgmentItem);
                this.ParentForm.smartFileIO.Close();
            }
        }
        // SystemParameter1 : SystemParameter1 파일 버전별
        public int ConvertingExternalInputUntilV6(int portNum, int modeNum)
        {
            int ret = 0;

            /*
             *  V1~V6 External Input
             *  PI2 - 0:미사용, 1:문열림감지센서
             *  PI3 - 0:미사용, 1:STOP
             *  PI4 - 0:미사용, 1:공압확인센서, 2:START
             *  PI5 - 0:미사용, 1:디스펜서FULL센서(=적체확인센서), 2:외부운전
             *  PI6 - 0:미사용, 1:디스펜서진입2센서
             *  PI7 - 0:미사용, 1:디스펜서진입1센서, 2:STOPPER
             *  PI8 - 0:미사용, 1:배출확인센서, 2:Metal
            */

            /*
             * V7~V8 External Input
             * 0:미사용, 1:금속검출, 2:START, 3:STOP, 4:배출확인A, 5:공압확인, 
             * 6:문열림감지, 7:STOPPER, 8:방풍커버, 9:외부운전, 10:디스펜서진입1, 
             * 11:디스펜서진입2, 12:적체확인, 13:ExNG1, 14:ExNG2, 15:외부입력확인, 
             * 16:배출확인B
            */

            switch (portNum)
            {
                case 2:
                    switch (modeNum)
                    {
                        case 0:
                            ret = 0;
                            break;
                        case 1:
                            ret = 6;
                            break;
                        default:
                            ret = 0;
                            break;
                    }
                    break;
                case 3:
                    switch (modeNum)
                    {
                        case 0:
                            ret = 3;
                            break;
                        case 1:
                            ret = 3;
                            break;
                        default:
                            ret = 3;
                            break;
                    }
                    break;
                case 4:
                    switch (modeNum)
                    {
                        case 0:
                            ret = 2;
                            break;
                        case 1:
                            ret = 5;
                            break;
                        case 2:
                            ret = 2;
                            break;
                        default:
                            ret = 2;
                            break;
                    }
                    break;
                case 5:
                    switch (modeNum)
                    {
                        case 0:
                            ret = 0;
                            break;
                        case 1:
                            ret = 12;
                            break;
                        case 2:
                            ret = 9;
                            break;
                        default:
                            ret = 0;
                            break;
                    }
                    break;
                case 6:
                    switch (modeNum)
                    {
                        case 0:
                            ret = 0;
                            break;
                        case 1:
                            ret = 11;
                            break;
                        default:
                            ret = 0;
                            break;
                    }
                    break;
                case 7:
                    switch (modeNum)
                    {
                        case 0:
                            ret = 0;
                            break;
                        case 1:
                            ret = 10;
                            break;
                        case 2:
                            ret = 7;
                            break;
                        default:
                            ret = 0;
                            break;
                    }
                    break;
                case 8:
                    switch (modeNum)
                    {
                        case 0:
                            ret = 1;
                            break;
                        case 1:
                            ret = 4;
                            break;
                        case 2:
                            ret = 1;
                            break;
                        default:
                            ret = 1;
                            break;
                    }
                    break;
                default:
                    break;
            }

            return ret;
        }
        //private void ConvertingSystemParameter1FromV1V2()
        //{
        //    string fullFilePath = "";
        //    bool fileCheck = false;
        //    StructSystemParameter1V1V2 structItem;

        //    fullFilePath = this.PathPreVersionSystemFile1BackupFolder + "SystemParameter1.cfg";
        //    this.ParentForm.smartFileIO.FilePathName = fullFilePath;

        //    FileInfo fileInfo = new FileInfo(fullFilePath);
        //    fileCheck = fileInfo.Exists;

        //    if (fileCheck == true)
        //    {
        //        this.ParentForm.smartFileIO.Open(this.ParentForm.BufferSmartUart);

        //        try
        //        {
        //            structItem = (StructSystemParameter1V1V2)this.ParentForm.smartFileIO.ReadStructure(0, typeof(StructSystemParameter1V1V2));

        //            if (structItem.BuzzerOnTime != "0")
        //                this.ParentForm.CurrentSystemParameter1.BuzzerOnTime = structItem.BuzzerOnTime;
        //            else
        //                this.ParentForm.CurrentSystemParameter1.BuzzerOnTime = "1000";
        //            if (structItem.RelayOnTime != "0")
        //                this.ParentForm.CurrentSystemParameter1.RelayOnTime = structItem.RelayOnTime;
        //            else
        //                this.ParentForm.CurrentSystemParameter1.RelayOnTime = "1000";
        //            if (structItem.Chattering != "0")
        //                this.ParentForm.CurrentSystemParameter1.Chattering = structItem.Chattering;
        //            else
        //                this.ParentForm.CurrentSystemParameter1.Chattering = "100";
        //            this.ParentForm.CurrentSystemParameter1.SorterDoubleEntry = structItem.SorterDoubleEntry;
        //            this.ParentForm.CurrentSystemParameter1.SorterExternalNgInput = structItem.SorterExternalNgInput;
        //            this.ParentForm.CurrentSystemParameter1.InitialDrive = structItem.InitialDrive;
        //            this.ParentForm.CurrentSystemParameter1.OptionBoard = structItem.OptionBoard;
        //            this.ParentForm.CurrentSystemParameter1.StopWeighing = structItem.StopWeighting;

        //            this.ParentForm.CurrentSystemParameter1.SorterEtcNg = "0";
        //            this.ParentForm.CurrentSystemParameter1.EquipmentType = "0";
        //            this.ParentForm.CurrentSystemParameter1.SortingWhenNGLength = "0";

        //            this.ParentForm.CurrentSystemParameter1.PI2 = 0;
        //            this.ParentForm.CurrentSystemParameter1.PI3 = 3;
        //            if(structItem.PressureSensing != "0")
        //                this.ParentForm.CurrentSystemParameter1.PI4 = 5;
        //            else
        //                this.ParentForm.CurrentSystemParameter1.PI4 = 2;
        //            if (structItem.StackSensing != "0")
        //                this.ParentForm.CurrentSystemParameter1.PI5 = 12;
        //            else
        //                this.ParentForm.CurrentSystemParameter1.PI5 = 0;
        //            this.ParentForm.CurrentSystemParameter1.PI6 = 0;
        //            try
        //            {
        //                if (structItem.EntryStopper != "0")
        //                    this.ParentForm.CurrentSystemParameter1.PI7 = 7;
        //                else
        //                    this.ParentForm.CurrentSystemParameter1.PI7 = 0;
        //            }
        //            catch
        //            {
        //                this.ParentForm.CurrentSystemParameter1.PI7 = 0;
        //            }
        //            if (structItem.SorterDetecting != "0")
        //                this.ParentForm.CurrentSystemParameter1.PI8 = 4;
        //            else
        //                this.ParentForm.CurrentSystemParameter1.PI8 = 1;

        //        }
        //        catch
        //        {
        //            //DialogFormMessage myMsg = new DialogFormMessage(17, this.ParentForm.SystemConfig1.Language);
        //            //myMsg.ShowDialog();

        //            //this.ParentForm.smartFileIO.Close();
        //        }

        //        this.SaveSystemParameter1File(this.ParentForm.CurrentSystemParameter1);
        //        this.ParentForm.smartFileIO.Close();
        //    }
        //}
        public void ConvertingSystemParameter1UntilV6()
        {
            string fullFilePath = "";
            bool fileCheck = false;
            StructSystemParameter1 structItem;

            fullFilePath = this.ParentForm.PathPreVersionSystemFile1Folder + "SystemParameter1.cfg";
            this.ParentForm.smartFileIO.FilePathName = fullFilePath;

            FileInfo fileInfo = new FileInfo(fullFilePath);
            fileCheck = fileInfo.Exists;

            if (fileCheck == true)
            {
                this.ParentForm.smartFileIO.Open(this.ParentForm.BufferSmartUart);

                try
                {
                    structItem = (StructSystemParameter1)this.ParentForm.smartFileIO.ReadStructure(0, typeof(StructSystemParameter1));

                    this.ParentForm.CurrentSystemParameter1.BuzzerOnTime = structItem.BuzzerOnTime;
                    this.ParentForm.CurrentSystemParameter1.RelayOnTime = structItem.RelayOnTime;
                    this.ParentForm.CurrentSystemParameter1.SorterDoubleEntry = structItem.SorterDoubleEntry;
                    this.ParentForm.CurrentSystemParameter1.Chattering = structItem.Chattering;
                    this.ParentForm.CurrentSystemParameter1.SorterExternalNgInput = structItem.SorterExternalNgInput;
                    this.ParentForm.CurrentSystemParameter1.SorterEtcNg = structItem.SorterEtcNgInput;
                    this.ParentForm.CurrentSystemParameter1.StopWeighing = structItem.StopWeighing;
                    this.ParentForm.CurrentSystemParameter1.OptionBoard = structItem.OptionBoard;
                    this.ParentForm.CurrentSystemParameter1.InitialDrive = structItem.InitialDrive;
                    try
                    {
                        this.ParentForm.CurrentSystemParameter1.EquipmentType = structItem.EquipmentType;
                    }
                    catch
                    {
                        this.ParentForm.CurrentSystemParameter1.EquipmentType = "0";
                    }
                    try
                    {
                        this.ParentForm.CurrentSystemParameter1.SortingWhenNGLength = structItem.SortingWhenNGLength;
                    }
                    catch
                    {
                        this.ParentForm.CurrentSystemParameter1.SortingWhenNGLength = "0";
                    }

                    this.ParentForm.CurrentSystemParameter1.PI2 = this.ConvertingExternalInputUntilV6(2, structItem.PI2);
                    this.ParentForm.CurrentSystemParameter1.PI3 = this.ConvertingExternalInputUntilV6(3, structItem.PI3);
                    this.ParentForm.CurrentSystemParameter1.PI4 = this.ConvertingExternalInputUntilV6(4, structItem.PI4);
                    this.ParentForm.CurrentSystemParameter1.PI5 = this.ConvertingExternalInputUntilV6(5, structItem.PI5);
                    this.ParentForm.CurrentSystemParameter1.PI6 = this.ConvertingExternalInputUntilV6(6, structItem.PI6);
                    this.ParentForm.CurrentSystemParameter1.PI7 = this.ConvertingExternalInputUntilV6(7, structItem.PI7);
                    this.ParentForm.CurrentSystemParameter1.PI8 = this.ConvertingExternalInputUntilV6(8, structItem.PI8);
                }
                catch
                {
                    //DialogFormMessage myMsg = new DialogFormMessage(17, this.ParentForm.SystemConfig1.Language);
                    //myMsg.ShowDialog();

                    //this.ParentForm.smartFileIO.Close();
                }

                this.ParentForm.SaveSystemParameter1File(this.ParentForm.CurrentSystemParameter1);
                this.ParentForm.smartFileIO.Close();
            }
        }
        public void ConvertingSystemParameter1FromV7()
        {
            string fullFilePath = "";
            bool fileCheck = false;
            StructSystemParameter1 structItem;

            fullFilePath = this.ParentForm.PathPreVersionSystemFile1Folder + "SystemParameter1.cfg";
            this.ParentForm.smartFileIO.FilePathName = fullFilePath;

            FileInfo fileInfo = new FileInfo(fullFilePath);
            fileCheck = fileInfo.Exists;

            if (fileCheck == true)
            {
                this.ParentForm.smartFileIO.Open(this.ParentForm.BufferSmartUart);

                try
                {
                    structItem = (StructSystemParameter1)this.ParentForm.smartFileIO.ReadStructure(0, typeof(StructSystemParameter1));

                    this.ParentForm.CurrentSystemParameter1.BuzzerOnTime = structItem.BuzzerOnTime;
                    this.ParentForm.CurrentSystemParameter1.RelayOnTime = structItem.RelayOnTime;
                    this.ParentForm.CurrentSystemParameter1.SorterDoubleEntry = structItem.SorterDoubleEntry;
                    this.ParentForm.CurrentSystemParameter1.Chattering = structItem.Chattering;
                    this.ParentForm.CurrentSystemParameter1.SorterExternalNgInput = structItem.SorterExternalNgInput;
                    this.ParentForm.CurrentSystemParameter1.SorterEtcNg = structItem.SorterEtcNgInput;
                    this.ParentForm.CurrentSystemParameter1.StopWeighing = structItem.StopWeighing;
                    this.ParentForm.CurrentSystemParameter1.OptionBoard = structItem.OptionBoard;
                    this.ParentForm.CurrentSystemParameter1.InitialDrive = structItem.InitialDrive;
                    this.ParentForm.CurrentSystemParameter1.EquipmentType = structItem.EquipmentType;
                    this.ParentForm.CurrentSystemParameter1.SortingWhenNGLength = structItem.SortingWhenNGLength;

                    this.ParentForm.CurrentSystemParameter1.PI2 = structItem.PI2;
                    this.ParentForm.CurrentSystemParameter1.PI3 = structItem.PI3;
                    this.ParentForm.CurrentSystemParameter1.PI4 = structItem.PI4;
                    this.ParentForm.CurrentSystemParameter1.PI5 = structItem.PI5;
                    this.ParentForm.CurrentSystemParameter1.PI6 = structItem.PI6;
                    this.ParentForm.CurrentSystemParameter1.PI7 = structItem.PI7;
                    this.ParentForm.CurrentSystemParameter1.PI8 = structItem.PI8;
                }
                catch
                {
                    //DialogFormMessage myMsg = new DialogFormMessage(17, this.ParentForm.SystemConfig1.Language);
                    //myMsg.ShowDialog();

                    //this.ParentForm.smartFileIO.Close();
                }

                this.ParentForm.SaveSystemParameter1File(this.ParentForm.CurrentSystemParameter1);
                this.ParentForm.smartFileIO.Close();
            }
        }
        // SystemParameter2 : 값 그대로 불러오기
        public void ConvertingSystemParameter2()
        {
            string fullFilePath = "";
            bool fileCheck = false;
            StructSystemParameter2 structItem;

            fullFilePath = this.ParentForm.PathPreVersionSystemFile1Folder + "SystemParameter2.cfg";
            this.ParentForm.smartFileIO.FilePathName = fullFilePath;

            FileInfo fileInfo = new FileInfo(fullFilePath);
            fileCheck = fileInfo.Exists;

            if (fileCheck == true)
            {
                this.ParentForm.smartFileIO.Open(this.ParentForm.BufferSmartUart);

                try
                {
                    structItem = (StructSystemParameter2)this.ParentForm.smartFileIO.ReadStructure(0, typeof(StructSystemParameter2));

                    this.ParentForm.CurrentSystemParameter2.OPT1SamplingCount = structItem.OPT1SamplingCount;
                    this.ParentForm.CurrentSystemParameter2.OPT1DelayCount = structItem.OPT1DelayCount;
                    this.ParentForm.CurrentSystemParameter2.OPT1PulseWidth = structItem.OPT1PulseWidth;
                    this.ParentForm.CurrentSystemParameter2.OPT1IsWeightSetting = structItem.OPT1IsWeightSetting;
                    this.ParentForm.CurrentSystemParameter2.OPT1OverRange = structItem.OPT1OverRange;
                    this.ParentForm.CurrentSystemParameter2.OPT1UnderRange = structItem.OPT1UnderRange;
                    this.ParentForm.CurrentSystemParameter2.OPT1Port = structItem.OPT1Port;

                    this.ParentForm.CurrentSystemParameter2.OPT2Port = structItem.OPT2Port;
                    this.ParentForm.CurrentSystemParameter2.OPT2DelayTime1 = structItem.OPT2DelayTime1;
                    this.ParentForm.CurrentSystemParameter2.OPT2DelayTime2 = structItem.OPT2DelayTime2;
                }
                catch
                {
                    //DialogFormMessage myMsg = new DialogFormMessage(17, this.ParentForm.SystemConfig1.Language);
                    //myMsg.ShowDialog();

                    //this.ParentForm.smartFileIO.Close();
                }

                this.ParentForm.SaveSystemParameter2File(this.ParentForm.CurrentSystemParameter2);
                this.ParentForm.smartFileIO.Close();
            }
        }
        // SystemParameter3 : 값 그대로 불러오기
        public void ConvertingSystemParameter3()
        {
            string fullFilePath = "";
            bool fileCheck = false;
            StructSystemParameter3 structItem;

            fullFilePath = this.ParentForm.PathPreVersionSystemFile1Folder + "SystemParameter3.cfg";
            this.ParentForm.smartFileIO.FilePathName = fullFilePath;

            FileInfo fileInfo = new FileInfo(fullFilePath);
            fileCheck = fileInfo.Exists;

            if (fileCheck == true)
            {
                this.ParentForm.smartFileIO.Open(this.ParentForm.BufferSmartUart);

                try
                {
                    structItem = (StructSystemParameter3)this.ParentForm.smartFileIO.ReadStructure(0, typeof(StructSystemParameter3));

                    this.ParentForm.CurrentSystemParameter3.ExternalOut1Mode = structItem.ExternalOut1Mode;
                    this.ParentForm.CurrentSystemParameter3.ExternalOut1DelayTime = structItem.ExternalOut1DelayTime;
                    this.ParentForm.CurrentSystemParameter3.ExternalOut1RunTime = structItem.ExternalOut1RunTime;

                    this.ParentForm.CurrentSystemParameter3.ExternalOut2Mode = structItem.ExternalOut2Mode;
                    this.ParentForm.CurrentSystemParameter3.ExternalOut2DelayTime = structItem.ExternalOut2DelayTime;
                    this.ParentForm.CurrentSystemParameter3.ExternalOut2RunTime = structItem.ExternalOut2RunTime;

                    this.ParentForm.CurrentSystemParameter3.ExternalOut3Mode = structItem.ExternalOut3Mode;
                    this.ParentForm.CurrentSystemParameter3.ExternalOut3DelayTime = structItem.ExternalOut3DelayTime;
                    this.ParentForm.CurrentSystemParameter3.ExternalOut3RunTime = structItem.ExternalOut3RunTime;

                    this.ParentForm.CurrentSystemParameter3.ExternalOut4Mode = structItem.ExternalOut4Mode;
                    this.ParentForm.CurrentSystemParameter3.ExternalOut4DelayTime = structItem.ExternalOut4DelayTime;
                    this.ParentForm.CurrentSystemParameter3.ExternalOut4RunTime = structItem.ExternalOut4RunTime;

                    this.ParentForm.CurrentSystemParameter3.ExternalOut9Mode = structItem.ExternalOut9Mode;
                    this.ParentForm.CurrentSystemParameter3.ExternalOut9DelayTime = structItem.ExternalOut9DelayTime;
                    this.ParentForm.CurrentSystemParameter3.ExternalOut9RunTime = structItem.ExternalOut9RunTime;

                    this.ParentForm.CurrentSystemParameter3.ExternalOut10Mode = structItem.ExternalOut10Mode;
                    this.ParentForm.CurrentSystemParameter3.ExternalOut10DelayTime = structItem.ExternalOut10DelayTime;
                    this.ParentForm.CurrentSystemParameter3.ExternalOut10RunTime = structItem.ExternalOut10RunTime;
                }
                catch
                {
                    //DialogFormMessage myMsg = new DialogFormMessage(17, this.ParentForm.SystemConfig1.Language);
                    //myMsg.ShowDialog();

                    //this.ParentForm.smartFileIO.Close();
                }

                this.ParentForm.SaveSystemParameter3File(this.ParentForm.CurrentSystemParameter3);
                this.ParentForm.smartFileIO.Close();
            }
        }
        // SystemParameter4 : 값 그대로 불러오기
        public void ConvertingSystemParameter4()
        {
            string fullFilePath = "";
            bool fileCheck = false;
            StructSystemParameter4 structItem;

            fullFilePath = this.ParentForm.PathPreVersionSystemFile1Folder + "SystemParameter4.cfg";
            this.ParentForm.smartFileIO.FilePathName = fullFilePath;

            FileInfo fileInfo = new FileInfo(fullFilePath);
            fileCheck = fileInfo.Exists;

            if (fileCheck == true)
            {
                this.ParentForm.smartFileIO.Open(this.ParentForm.BufferSmartUart);

                try
                {
                    structItem = (StructSystemParameter4)this.ParentForm.smartFileIO.ReadStructure(0, typeof(StructSystemParameter4));

                    this.ParentForm.CurrentSystemParameter4.LCDAutoZero1Range = structItem.AutoZero1UserSettingRange;
                    this.ParentForm.CurrentSystemParameter4.LCDAutoZero1Time = structItem.AutoZero1UserSettingTime;
                    this.ParentForm.CurrentSystemParameter4.LCDAutoZero1Variate = structItem.AutoZero1UserSettingVariate;
                    this.ParentForm.CurrentSystemParameter4.LCDAutoZero1Mode = structItem.AutoZero1Mode;

                    this.ParentForm.CurrentSystemParameter4.LCDAutoZero2Range = structItem.AutoZero2UserSettingRange;
                    this.ParentForm.CurrentSystemParameter4.LCDAutoZero2Time = structItem.AutoZero2UserSettingTime;
                    this.ParentForm.CurrentSystemParameter4.LCDAutoZero2Variate = structItem.AutoZero2UserSettingVariate;
                    this.ParentForm.CurrentSystemParameter4.LCDAutoZero2Mode = structItem.AutoZero2Mode;
                }
                catch
                {
                    //DialogFormMessage myMsg = new DialogFormMessage(17, this.ParentForm.SystemConfig1.Language);
                    //myMsg.ShowDialog();

                    //this.ParentForm.smartFileIO.Close();
                }

                this.ParentForm.SaveSystemParameter4File(this.ParentForm.CurrentSystemParameter4);
                this.ParentForm.smartFileIO.Close();
            }
        }
        // UserItem : V1~V6에서 업데이트할 경우
        public void ConvertingUserItemUntilV6()
        {
            string fullFilePath = "";
            bool fileCheck = false;
            StructUserGroupItem structItem;

            fullFilePath = this.ParentForm.PathPreVersionSystemFile1Folder + "UserGroup.int";
            this.ParentForm.smartFileIO.FilePathName = fullFilePath;

            FileInfo fileInfo = new FileInfo(fullFilePath);
            fileCheck = fileInfo.Exists;

            if (fileCheck == true)
            {
                this.ParentForm.smartFileIO.Open(this.ParentForm.BufferSmartUart);

                try
                {
                    if (this.ParentForm.smartFileIO.ReadStructureAllBuffer() == true)
                    {
                        #region Level1
                        structItem = (StructUserGroupItem)this.ParentForm.smartFileIO.ReadStructureBuffer(typeof(StructUserGroupItem), (int)DataStore.EnumFileUserGroup.f0_Level1);

                        this.ParentForm.CurrentUserGroup.Level1.IsBasicDataBackup = structItem.IsBasicDataBackup;
                        this.ParentForm.CurrentUserGroup.Level1.IsBasicDataStatistics = structItem.IsBasicDataStatistics;
                        this.ParentForm.CurrentUserGroup.Level1.IsBasicProduct = structItem.IsBasicProduct;
                        this.ParentForm.CurrentUserGroup.Level1.IsBasicTime = structItem.IsBasicTime;

                        this.ParentForm.CurrentUserGroup.Level1.IsConfiSerial = structItem.IsConfiSerial;
                        this.ParentForm.CurrentUserGroup.Level1.IsConfiOptionBoard = structItem.IsConfiOptionBoard;
                        this.ParentForm.CurrentUserGroup.Level1.IsConfiEthernet = false;
                        this.ParentForm.CurrentUserGroup.Level1.IsConfiCountingOutput = false;

                        this.ParentForm.CurrentUserGroup.Level1.IsEquipFunctionSetting = structItem.IsEquipFunctionSetting;
                        this.ParentForm.CurrentUserGroup.Level1.IsEquipInitialize = structItem.IsEquipInitialize;
                        this.ParentForm.CurrentUserGroup.Level1.IsEquipUpdate = structItem.IsEquipUpdate;
                        this.ParentForm.CurrentUserGroup.Level1.IsEquipUserSetting = structItem.IsEquipUserSetting;
                        this.ParentForm.CurrentUserGroup.Level1.IsEquipEngineerSetting = false;
                        this.ParentForm.CurrentUserGroup.Level1.IsEquipSystemLog = structItem.IsEquipSystemLog;

                        this.ParentForm.CurrentUserGroup.Level1.IsInforAS = true;
                        this.ParentForm.CurrentUserGroup.Level1.IsInforSystem = true;

                        this.ParentForm.CurrentUserGroup.Level1.IsSystemAutoZero = structItem.IsSystemAutoZero;
                        this.ParentForm.CurrentUserGroup.Level1.IsSystemCalibration = structItem.IsSystemCalibration;
                        this.ParentForm.CurrentUserGroup.Level1.IsSystemExternalOutput = structItem.IsSystemExternalOutput;
                        this.ParentForm.CurrentUserGroup.Level1.IsSystemIOTest = structItem.IsSystemIOTest;
                        this.ParentForm.CurrentUserGroup.Level1.IsSystemJudgmentSetting = structItem.IsSystemJudgmentSetting;
                        this.ParentForm.CurrentUserGroup.Level1.IsSystemSorterSetting = structItem.IsSystemSorterSetting;
                        this.ParentForm.CurrentUserGroup.Level1.IsSystemExternalInput = false;

                        this.ParentForm.CurrentUserGroup.Level1.IsMainDisplayProductNo = true;
                        this.ParentForm.CurrentUserGroup.Level1.IsMainDisplayWeightSetting = true;
                        this.ParentForm.CurrentUserGroup.Level1.IsMainDisplayClear = true;
                        this.ParentForm.CurrentUserGroup.Level1.IsMainDisplaySubMenu = false;
                        #endregion

                        #region Level2
                        structItem = (StructUserGroupItem)this.ParentForm.smartFileIO.ReadStructureBuffer(typeof(StructUserGroupItem), (int)DataStore.EnumFileUserGroup.f1_Level2);

                        this.ParentForm.CurrentUserGroup.Level2.IsBasicDataBackup = structItem.IsBasicDataBackup;
                        this.ParentForm.CurrentUserGroup.Level2.IsBasicDataStatistics = structItem.IsBasicDataStatistics;
                        this.ParentForm.CurrentUserGroup.Level2.IsBasicProduct = structItem.IsBasicProduct;
                        this.ParentForm.CurrentUserGroup.Level2.IsBasicTime = structItem.IsBasicTime;

                        this.ParentForm.CurrentUserGroup.Level2.IsConfiSerial = structItem.IsConfiSerial;
                        this.ParentForm.CurrentUserGroup.Level2.IsConfiOptionBoard = structItem.IsConfiOptionBoard;
                        this.ParentForm.CurrentUserGroup.Level2.IsConfiEthernet = false;
                        this.ParentForm.CurrentUserGroup.Level2.IsConfiCountingOutput = false;

                        this.ParentForm.CurrentUserGroup.Level2.IsEquipFunctionSetting = structItem.IsEquipFunctionSetting;
                        this.ParentForm.CurrentUserGroup.Level2.IsEquipInitialize = structItem.IsEquipInitialize;
                        this.ParentForm.CurrentUserGroup.Level2.IsEquipUpdate = structItem.IsEquipUpdate;
                        this.ParentForm.CurrentUserGroup.Level2.IsEquipUserSetting = structItem.IsEquipUserSetting;
                        this.ParentForm.CurrentUserGroup.Level2.IsEquipEngineerSetting = false;
                        this.ParentForm.CurrentUserGroup.Level2.IsEquipSystemLog = structItem.IsEquipSystemLog;

                        this.ParentForm.CurrentUserGroup.Level2.IsInforAS = true;
                        this.ParentForm.CurrentUserGroup.Level2.IsInforSystem = true;

                        this.ParentForm.CurrentUserGroup.Level2.IsSystemAutoZero = structItem.IsSystemAutoZero;
                        this.ParentForm.CurrentUserGroup.Level2.IsSystemCalibration = structItem.IsSystemCalibration;
                        this.ParentForm.CurrentUserGroup.Level2.IsSystemExternalOutput = structItem.IsSystemExternalOutput;
                        this.ParentForm.CurrentUserGroup.Level2.IsSystemIOTest = structItem.IsSystemIOTest;
                        this.ParentForm.CurrentUserGroup.Level2.IsSystemJudgmentSetting = structItem.IsSystemJudgmentSetting;
                        this.ParentForm.CurrentUserGroup.Level2.IsSystemSorterSetting = structItem.IsSystemSorterSetting;
                        this.ParentForm.CurrentUserGroup.Level2.IsSystemExternalInput = true;

                        this.ParentForm.CurrentUserGroup.Level2.IsMainDisplayProductNo = true;
                        this.ParentForm.CurrentUserGroup.Level2.IsMainDisplayWeightSetting = true;
                        this.ParentForm.CurrentUserGroup.Level2.IsMainDisplayClear = true;
                        this.ParentForm.CurrentUserGroup.Level2.IsMainDisplaySubMenu = true;
                        #endregion

                        #region Level3
                        structItem = (StructUserGroupItem)this.ParentForm.smartFileIO.ReadStructureBuffer(typeof(StructUserGroupItem), (int)DataStore.EnumFileUserGroup.f2_Level3);

                        this.ParentForm.CurrentUserGroup.Level3.IsBasicDataBackup = true;
                        this.ParentForm.CurrentUserGroup.Level3.IsBasicDataStatistics = true;
                        this.ParentForm.CurrentUserGroup.Level3.IsBasicProduct = true;
                        this.ParentForm.CurrentUserGroup.Level3.IsBasicTime = true;

                        this.ParentForm.CurrentUserGroup.Level3.IsConfiSerial = true;
                        this.ParentForm.CurrentUserGroup.Level3.IsConfiOptionBoard = true;
                        this.ParentForm.CurrentUserGroup.Level3.IsConfiEthernet = true;
                        this.ParentForm.CurrentUserGroup.Level3.IsConfiCountingOutput = true;

                        this.ParentForm.CurrentUserGroup.Level3.IsEquipFunctionSetting = true;
                        this.ParentForm.CurrentUserGroup.Level3.IsEquipInitialize = true;
                        this.ParentForm.CurrentUserGroup.Level3.IsEquipUpdate = true;
                        this.ParentForm.CurrentUserGroup.Level3.IsEquipUserSetting = true;
                        this.ParentForm.CurrentUserGroup.Level3.IsEquipEngineerSetting = false;
                        this.ParentForm.CurrentUserGroup.Level2.IsEquipSystemLog = false;

                        this.ParentForm.CurrentUserGroup.Level3.IsInforAS = true;
                        this.ParentForm.CurrentUserGroup.Level3.IsInforSystem = true;

                        this.ParentForm.CurrentUserGroup.Level3.IsSystemAutoZero = true;
                        this.ParentForm.CurrentUserGroup.Level3.IsSystemCalibration = true;
                        this.ParentForm.CurrentUserGroup.Level3.IsSystemExternalOutput = true;
                        this.ParentForm.CurrentUserGroup.Level3.IsSystemIOTest = true;
                        this.ParentForm.CurrentUserGroup.Level3.IsSystemJudgmentSetting = true;
                        this.ParentForm.CurrentUserGroup.Level3.IsSystemSorterSetting = true;
                        this.ParentForm.CurrentUserGroup.Level3.IsSystemExternalInput = true;

                        this.ParentForm.CurrentUserGroup.Level3.IsMainDisplayProductNo = true;
                        this.ParentForm.CurrentUserGroup.Level3.IsMainDisplayWeightSetting = true;
                        this.ParentForm.CurrentUserGroup.Level3.IsMainDisplayClear = true;
                        this.ParentForm.CurrentUserGroup.Level3.IsMainDisplaySubMenu = true;
                        #endregion

                        #region Not Login
                        try
                        {
                            structItem = (StructUserGroupItem)this.ParentForm.smartFileIO.ReadStructureBuffer(typeof(StructUserGroupItem), (int)DataStore.EnumFileUserGroup.f3_NotLogin);

                            this.ParentForm.CurrentUserGroup.NotLogin.IsBasicDataBackup = structItem.IsBasicDataBackup;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsBasicDataStatistics = structItem.IsBasicDataStatistics;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsBasicProduct = structItem.IsBasicProduct;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsBasicTime = structItem.IsBasicTime;

                            this.ParentForm.CurrentUserGroup.NotLogin.IsConfiSerial = structItem.IsConfiSerial;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsConfiOptionBoard = structItem.IsConfiOptionBoard;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsConfiEthernet = true;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsConfiCountingOutput = true;

                            this.ParentForm.CurrentUserGroup.NotLogin.IsEquipFunctionSetting = structItem.IsEquipFunctionSetting;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsEquipInitialize = structItem.IsEquipInitialize;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsEquipUpdate = structItem.IsEquipUpdate;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsEquipUserSetting = structItem.IsEquipUserSetting;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsEquipEngineerSetting = false;
                            //this.ParentForm.CurrentUserGroup.Level2.IsEquipSystemLog = false;

                            this.ParentForm.CurrentUserGroup.NotLogin.IsInforAS = true;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsInforSystem = true;

                            this.ParentForm.CurrentUserGroup.NotLogin.IsSystemAutoZero = structItem.IsSystemAutoZero;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsSystemCalibration = structItem.IsSystemCalibration;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsSystemExternalOutput = structItem.IsSystemExternalOutput;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsSystemIOTest = structItem.IsSystemIOTest;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsSystemJudgmentSetting = structItem.IsSystemJudgmentSetting;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsSystemSorterSetting = structItem.IsSystemSorterSetting;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsSystemExternalInput = true;

                            this.ParentForm.CurrentUserGroup.NotLogin.IsMainDisplayProductNo = true;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsMainDisplayWeightSetting = true;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsMainDisplayClear = true;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsMainDisplaySubMenu = true;
                        }
                        catch
                        {
                            #region Not Login
                            this.ParentForm.CurrentUserGroup.NotLogin.IsBasicDataBackup = structItem.IsBasicDataBackup = true;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsBasicDataStatistics = structItem.IsBasicDataStatistics = true;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsBasicProduct = structItem.IsBasicProduct = true;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsBasicTime = structItem.IsBasicTime = true;

                            this.ParentForm.CurrentUserGroup.NotLogin.IsConfiSerial = structItem.IsConfiSerial = true;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsConfiOptionBoard = structItem.IsConfiOptionBoard = true;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsConfiEthernet = structItem.IsConfiEthernet = true;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsConfiCountingOutput = structItem.IsConfiCountingOutput = true;

                            this.ParentForm.CurrentUserGroup.NotLogin.IsEquipFunctionSetting = structItem.IsEquipFunctionSetting = true;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsEquipInitialize = structItem.IsEquipInitialize = true;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsEquipUpdate = structItem.IsEquipUpdate = true;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsEquipUserSetting = structItem.IsEquipUserSetting = false;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsEquipEngineerSetting = structItem.IsEquipEngineerSetting = false;
                            //this.ParentForm.CurrentUserGroup.Level2.IsEquipSystemLog = false;

                            this.ParentForm.CurrentUserGroup.NotLogin.IsInforAS = structItem.IsInforAS = true;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsInforSystem = structItem.IsInforSystem = true;

                            this.ParentForm.CurrentUserGroup.NotLogin.IsSystemAutoZero = structItem.IsSystemAutoZero = true;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsSystemCalibration = structItem.IsSystemCalibration = true;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsSystemExternalOutput = structItem.IsSystemExternalOutput = true;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsSystemIOTest = structItem.IsSystemIOTest = true;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsSystemJudgmentSetting = structItem.IsSystemJudgmentSetting = true;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsSystemSorterSetting = structItem.IsSystemSorterSetting = true;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsSystemExternalInput = structItem.IsSystemExternalInput = true;

                            this.ParentForm.CurrentUserGroup.NotLogin.IsMainDisplayProductNo = structItem.IsMainDisplayWeightSetting = true;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsMainDisplayWeightSetting = structItem.IsMainDisplayClear = true;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsMainDisplayClear = structItem.IsMainDisplayProductNo = true;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsMainDisplaySubMenu = structItem.IsMainDisplaySubMenu = true;

                            structItem.IsEquipSystemLog = false;
                            structItem.Dummy1 = false;
                            structItem.Dummy2 = false;
                            structItem.Dummy3 = false;
                            structItem.Dummy4 = false;
                            structItem.Dummy5 = false;
                            structItem.Dummy6 = false;
                            structItem.Dummy7 = false;
                            structItem.Dummy8 = false;
                            structItem.Dummy9 = false;
                            structItem.Dummy10 = false;
                            structItem.Dummy11 = false;
                            structItem.Dummy12 = false;
                            structItem.Dummy13 = false;
                            structItem.Dummy14 = false;
                            structItem.Dummy15 = false;
                            structItem.Dummy16 = false;
                            #endregion

                            this.ParentForm.smartFileIO.WriteStructure_Begin(structItem, 3);
                            this.ParentForm.smartFileIO.WriteStructure_End();
                        }
                        #endregion
                    }
                }
                catch
                {
                    //DialogFormMessage myMsg = new DialogFormMessage(17, this.ParentForm.SystemConfig1.Language);
                    //myMsg.ShowDialog();

                    //this.ParentForm.smartFileIO.Close();
                }

                this.ParentForm.SaveUserGroupFile(this.ParentForm.CurrentUserGroup);
                this.ParentForm.smartFileIO.Close();
            }
        }
        // UserItem : V7~에서 업데이트할 경우, 값 그대로 불러오기
        public void ConvertingUserItemFromV7()
        {
            string fullFilePath = "";
            bool fileCheck = false;
            StructUserGroupItem structItem;

            fullFilePath = this.ParentForm.PathPreVersionSystemFile1Folder + "UserGroup.int";
            this.ParentForm.smartFileIO.FilePathName = fullFilePath;

            FileInfo fileInfo = new FileInfo(fullFilePath);
            fileCheck = fileInfo.Exists;

            if (fileCheck == true)
            {
                this.ParentForm.smartFileIO.Open(this.ParentForm.BufferSmartUart);

                try
                {
                    if (this.ParentForm.smartFileIO.ReadStructureAllBuffer() == true)
                    {
                        #region Level1
                        structItem = (StructUserGroupItem)this.ParentForm.smartFileIO.ReadStructureBuffer(typeof(StructUserGroupItem), (int)DataStore.EnumFileUserGroup.f0_Level1);

                        this.ParentForm.CurrentUserGroup.Level1.IsBasicDataBackup = structItem.IsBasicDataBackup;
                        this.ParentForm.CurrentUserGroup.Level1.IsBasicDataStatistics = structItem.IsBasicDataStatistics;
                        this.ParentForm.CurrentUserGroup.Level1.IsBasicProduct = structItem.IsBasicProduct;
                        this.ParentForm.CurrentUserGroup.Level1.IsBasicTime = structItem.IsBasicTime;

                        this.ParentForm.CurrentUserGroup.Level1.IsConfiSerial = structItem.IsConfiSerial;
                        this.ParentForm.CurrentUserGroup.Level1.IsConfiOptionBoard = structItem.IsConfiOptionBoard;
                        this.ParentForm.CurrentUserGroup.Level1.IsConfiEthernet = structItem.IsConfiEthernet;
                        this.ParentForm.CurrentUserGroup.Level1.IsConfiCountingOutput = structItem.IsConfiCountingOutput;

                        this.ParentForm.CurrentUserGroup.Level1.IsEquipFunctionSetting = structItem.IsEquipFunctionSetting;
                        this.ParentForm.CurrentUserGroup.Level1.IsEquipInitialize = structItem.IsEquipInitialize;
                        this.ParentForm.CurrentUserGroup.Level1.IsEquipUpdate = structItem.IsEquipUpdate;
                        this.ParentForm.CurrentUserGroup.Level1.IsEquipUserSetting = structItem.IsEquipUserSetting;
                        this.ParentForm.CurrentUserGroup.Level1.IsEquipEngineerSetting = structItem.IsEquipEngineerSetting;
                        //this.ParentForm.CurrentUserGroup.Level2.IsEquipSystemLog = false;

                        this.ParentForm.CurrentUserGroup.Level1.IsInforAS = true;
                        this.ParentForm.CurrentUserGroup.Level1.IsInforSystem = true;

                        this.ParentForm.CurrentUserGroup.Level1.IsSystemAutoZero = structItem.IsSystemAutoZero;
                        this.ParentForm.CurrentUserGroup.Level1.IsSystemCalibration = structItem.IsSystemCalibration;
                        this.ParentForm.CurrentUserGroup.Level1.IsSystemExternalOutput = structItem.IsSystemExternalOutput;
                        this.ParentForm.CurrentUserGroup.Level1.IsSystemIOTest = structItem.IsSystemIOTest;
                        this.ParentForm.CurrentUserGroup.Level1.IsSystemJudgmentSetting = structItem.IsSystemJudgmentSetting;
                        this.ParentForm.CurrentUserGroup.Level1.IsSystemSorterSetting = structItem.IsSystemSorterSetting;
                        this.ParentForm.CurrentUserGroup.Level1.IsSystemExternalInput = structItem.IsSystemExternalInput;

                        this.ParentForm.CurrentUserGroup.Level1.IsMainDisplayProductNo = structItem.IsMainDisplayProductNo;
                        this.ParentForm.CurrentUserGroup.Level1.IsMainDisplayWeightSetting = structItem.IsMainDisplayWeightSetting;
                        this.ParentForm.CurrentUserGroup.Level1.IsMainDisplayClear = structItem.IsMainDisplayClear;
                        this.ParentForm.CurrentUserGroup.Level1.IsMainDisplaySubMenu = structItem.IsMainDisplaySubMenu;
                        #endregion

                        #region Level2
                        structItem = (StructUserGroupItem)this.ParentForm.smartFileIO.ReadStructureBuffer(typeof(StructUserGroupItem), (int)DataStore.EnumFileUserGroup.f1_Level2);

                        this.ParentForm.CurrentUserGroup.Level2.IsBasicDataBackup = structItem.IsBasicDataBackup;
                        this.ParentForm.CurrentUserGroup.Level2.IsBasicDataStatistics = structItem.IsBasicDataStatistics;
                        this.ParentForm.CurrentUserGroup.Level2.IsBasicProduct = structItem.IsBasicProduct;
                        this.ParentForm.CurrentUserGroup.Level2.IsBasicTime = structItem.IsBasicTime;

                        this.ParentForm.CurrentUserGroup.Level2.IsConfiSerial = structItem.IsConfiSerial;
                        this.ParentForm.CurrentUserGroup.Level2.IsConfiOptionBoard = structItem.IsConfiOptionBoard;
                        this.ParentForm.CurrentUserGroup.Level2.IsConfiEthernet = structItem.IsConfiEthernet;
                        this.ParentForm.CurrentUserGroup.Level2.IsConfiCountingOutput = structItem.IsConfiCountingOutput;

                        this.ParentForm.CurrentUserGroup.Level2.IsEquipFunctionSetting = structItem.IsEquipFunctionSetting;
                        this.ParentForm.CurrentUserGroup.Level2.IsEquipInitialize = structItem.IsEquipInitialize;
                        this.ParentForm.CurrentUserGroup.Level2.IsEquipUpdate = structItem.IsEquipUpdate;
                        this.ParentForm.CurrentUserGroup.Level2.IsEquipUserSetting = structItem.IsEquipUserSetting;
                        this.ParentForm.CurrentUserGroup.Level2.IsEquipEngineerSetting = structItem.IsEquipEngineerSetting;
                        //this.ParentForm.CurrentUserGroup.Level2.IsEquipSystemLog = false;

                        this.ParentForm.CurrentUserGroup.Level2.IsInforAS = true;
                        this.ParentForm.CurrentUserGroup.Level2.IsInforSystem = true;

                        this.ParentForm.CurrentUserGroup.Level2.IsSystemAutoZero = structItem.IsSystemAutoZero;
                        this.ParentForm.CurrentUserGroup.Level2.IsSystemCalibration = structItem.IsSystemCalibration;
                        this.ParentForm.CurrentUserGroup.Level2.IsSystemExternalOutput = structItem.IsSystemExternalOutput;
                        this.ParentForm.CurrentUserGroup.Level2.IsSystemIOTest = structItem.IsSystemIOTest;
                        this.ParentForm.CurrentUserGroup.Level2.IsSystemJudgmentSetting = structItem.IsSystemJudgmentSetting;
                        this.ParentForm.CurrentUserGroup.Level2.IsSystemSorterSetting = structItem.IsSystemSorterSetting;
                        this.ParentForm.CurrentUserGroup.Level2.IsSystemExternalInput = structItem.IsSystemExternalInput;

                        this.ParentForm.CurrentUserGroup.Level2.IsMainDisplayProductNo = structItem.IsMainDisplayProductNo;
                        this.ParentForm.CurrentUserGroup.Level2.IsMainDisplayWeightSetting = structItem.IsMainDisplayWeightSetting;
                        this.ParentForm.CurrentUserGroup.Level2.IsMainDisplayClear = structItem.IsMainDisplayClear;
                        this.ParentForm.CurrentUserGroup.Level2.IsMainDisplaySubMenu = structItem.IsMainDisplaySubMenu;
                        #endregion

                        #region Level3
                        structItem = (StructUserGroupItem)this.ParentForm.smartFileIO.ReadStructureBuffer(typeof(StructUserGroupItem), (int)DataStore.EnumFileUserGroup.f2_Level3);

                        this.ParentForm.CurrentUserGroup.Level3.IsBasicDataBackup = structItem.IsBasicDataBackup;
                        this.ParentForm.CurrentUserGroup.Level3.IsBasicDataStatistics = structItem.IsBasicDataStatistics;
                        this.ParentForm.CurrentUserGroup.Level3.IsBasicProduct = structItem.IsBasicProduct;
                        this.ParentForm.CurrentUserGroup.Level3.IsBasicTime = structItem.IsBasicTime;

                        this.ParentForm.CurrentUserGroup.Level3.IsConfiSerial = structItem.IsConfiSerial;
                        this.ParentForm.CurrentUserGroup.Level3.IsConfiOptionBoard = structItem.IsConfiOptionBoard;
                        this.ParentForm.CurrentUserGroup.Level3.IsConfiEthernet = structItem.IsConfiEthernet;
                        this.ParentForm.CurrentUserGroup.Level3.IsConfiCountingOutput = structItem.IsConfiCountingOutput;

                        this.ParentForm.CurrentUserGroup.Level3.IsEquipFunctionSetting = true;
                        this.ParentForm.CurrentUserGroup.Level3.IsEquipInitialize = structItem.IsEquipInitialize;
                        this.ParentForm.CurrentUserGroup.Level3.IsEquipUpdate = structItem.IsEquipUpdate;
                        this.ParentForm.CurrentUserGroup.Level3.IsEquipUserSetting = true;
                        this.ParentForm.CurrentUserGroup.Level3.IsEquipEngineerSetting = true;
                        //this.ParentForm.CurrentUserGroup.Level2.IsEquipSystemLog = false;

                        this.ParentForm.CurrentUserGroup.Level3.IsInforAS = true;
                        this.ParentForm.CurrentUserGroup.Level3.IsInforSystem = true;

                        this.ParentForm.CurrentUserGroup.Level3.IsSystemAutoZero = structItem.IsSystemAutoZero;
                        this.ParentForm.CurrentUserGroup.Level3.IsSystemCalibration = structItem.IsSystemCalibration;
                        this.ParentForm.CurrentUserGroup.Level3.IsSystemExternalOutput = structItem.IsSystemExternalOutput;
                        this.ParentForm.CurrentUserGroup.Level3.IsSystemIOTest = structItem.IsSystemIOTest;
                        this.ParentForm.CurrentUserGroup.Level3.IsSystemJudgmentSetting = structItem.IsSystemJudgmentSetting;
                        this.ParentForm.CurrentUserGroup.Level3.IsSystemSorterSetting = structItem.IsSystemSorterSetting;
                        this.ParentForm.CurrentUserGroup.Level3.IsSystemExternalInput = structItem.IsSystemExternalInput;

                        this.ParentForm.CurrentUserGroup.Level3.IsMainDisplayProductNo = structItem.IsMainDisplayProductNo;
                        this.ParentForm.CurrentUserGroup.Level3.IsMainDisplayWeightSetting = structItem.IsMainDisplayWeightSetting;
                        this.ParentForm.CurrentUserGroup.Level3.IsMainDisplayClear = structItem.IsMainDisplayClear;
                        this.ParentForm.CurrentUserGroup.Level3.IsMainDisplaySubMenu = structItem.IsMainDisplaySubMenu;
                        #endregion

                        #region Not Login
                        try
                        {
                            structItem = (StructUserGroupItem)this.ParentForm.smartFileIO.ReadStructureBuffer(typeof(StructUserGroupItem), (int)DataStore.EnumFileUserGroup.f3_NotLogin);

                            this.ParentForm.CurrentUserGroup.NotLogin.IsBasicDataBackup = structItem.IsBasicDataBackup;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsBasicDataStatistics = structItem.IsBasicDataStatistics;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsBasicProduct = structItem.IsBasicProduct;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsBasicTime = structItem.IsBasicTime;

                            this.ParentForm.CurrentUserGroup.NotLogin.IsConfiSerial = structItem.IsConfiSerial;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsConfiOptionBoard = structItem.IsConfiOptionBoard;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsConfiEthernet = structItem.IsConfiEthernet;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsConfiCountingOutput = structItem.IsConfiCountingOutput;

                            this.ParentForm.CurrentUserGroup.NotLogin.IsEquipFunctionSetting = structItem.IsEquipFunctionSetting;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsEquipInitialize = structItem.IsEquipInitialize;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsEquipUpdate = structItem.IsEquipUpdate;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsEquipUserSetting = structItem.IsEquipUserSetting;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsEquipEngineerSetting = structItem.IsEquipEngineerSetting;
                            //this.ParentForm.CurrentUserGroup.Level2.IsEquipSystemLog = false;

                            this.ParentForm.CurrentUserGroup.NotLogin.IsInforAS = true;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsInforSystem = true;

                            this.ParentForm.CurrentUserGroup.NotLogin.IsSystemAutoZero = structItem.IsSystemAutoZero;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsSystemCalibration = structItem.IsSystemCalibration;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsSystemExternalOutput = structItem.IsSystemExternalOutput;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsSystemIOTest = structItem.IsSystemIOTest;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsSystemJudgmentSetting = structItem.IsSystemJudgmentSetting;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsSystemSorterSetting = structItem.IsSystemSorterSetting;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsSystemExternalInput = structItem.IsSystemExternalInput;

                            this.ParentForm.CurrentUserGroup.NotLogin.IsMainDisplayProductNo = structItem.IsMainDisplayProductNo;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsMainDisplayWeightSetting = structItem.IsMainDisplayWeightSetting;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsMainDisplayClear = structItem.IsMainDisplayClear;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsMainDisplaySubMenu = structItem.IsMainDisplaySubMenu;
                        }
                        catch
                        {
                            #region Not Login
                            this.ParentForm.CurrentUserGroup.NotLogin.IsBasicDataBackup = structItem.IsBasicDataBackup = true;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsBasicDataStatistics = structItem.IsBasicDataStatistics = true;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsBasicProduct = structItem.IsBasicProduct = true;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsBasicTime = structItem.IsBasicTime = true;

                            this.ParentForm.CurrentUserGroup.NotLogin.IsConfiSerial = structItem.IsConfiSerial = true;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsConfiOptionBoard = structItem.IsConfiOptionBoard = true;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsConfiEthernet = structItem.IsConfiEthernet = true;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsConfiCountingOutput = structItem.IsConfiCountingOutput = true;

                            this.ParentForm.CurrentUserGroup.NotLogin.IsEquipFunctionSetting = structItem.IsEquipFunctionSetting = true;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsEquipInitialize = structItem.IsEquipInitialize = true;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsEquipUpdate = structItem.IsEquipUpdate = true;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsEquipUserSetting = structItem.IsEquipUserSetting = false;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsEquipEngineerSetting = structItem.IsEquipEngineerSetting = false;
                            //this.ParentForm.CurrentUserGroup.Level2.IsEquipSystemLog = false;

                            this.ParentForm.CurrentUserGroup.NotLogin.IsInforAS = structItem.IsInforAS = true;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsInforSystem = structItem.IsInforSystem = true;

                            this.ParentForm.CurrentUserGroup.NotLogin.IsSystemAutoZero = structItem.IsSystemAutoZero = true;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsSystemCalibration = structItem.IsSystemCalibration = true;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsSystemExternalOutput = structItem.IsSystemExternalOutput = true;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsSystemIOTest = structItem.IsSystemIOTest = true;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsSystemJudgmentSetting = structItem.IsSystemJudgmentSetting = true;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsSystemSorterSetting = structItem.IsSystemSorterSetting = true;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsSystemExternalInput = structItem.IsSystemExternalInput = true;

                            this.ParentForm.CurrentUserGroup.NotLogin.IsMainDisplayProductNo = structItem.IsMainDisplayWeightSetting = true;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsMainDisplayWeightSetting = structItem.IsMainDisplayClear = true;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsMainDisplayClear = structItem.IsMainDisplayProductNo = true;
                            this.ParentForm.CurrentUserGroup.NotLogin.IsMainDisplaySubMenu = structItem.IsMainDisplaySubMenu = true;

                            structItem.IsEquipSystemLog = false;
                            structItem.Dummy1 = false;
                            structItem.Dummy2 = false;
                            structItem.Dummy3 = false;
                            structItem.Dummy4 = false;
                            structItem.Dummy5 = false;
                            structItem.Dummy6 = false;
                            structItem.Dummy7 = false;
                            structItem.Dummy8 = false;
                            structItem.Dummy9 = false;
                            structItem.Dummy10 = false;
                            structItem.Dummy11 = false;
                            structItem.Dummy12 = false;
                            structItem.Dummy13 = false;
                            structItem.Dummy14 = false;
                            structItem.Dummy15 = false;
                            structItem.Dummy16 = false;
                            #endregion

                            this.ParentForm.smartFileIO.WriteStructure_Begin(structItem, 3);
                            this.ParentForm.smartFileIO.WriteStructure_End();
                        }
                        #endregion
                    }
                }
                catch
                {
                    //DialogFormMessage myMsg = new DialogFormMessage(17, this.ParentForm.SystemConfig1.Language);
                    //myMsg.ShowDialog();

                    //this.ParentForm.smartFileIO.Close();
                }


                this.ParentForm.SaveUserGroupFile(this.ParentForm.CurrentUserGroup);
                this.ParentForm.smartFileIO.Close();
            }
        }
        // 기타 User 관련 파일은 그대로 복사하기
        public void CopyUserFiles()
        {
            string fullFilePath = "";
            bool fileCheck = false;

            FileInfo fileInfo;
            fileInfo = new FileInfo(this.ParentForm.PathPreVersionSystemFile1Folder + "UserGroupPassword.int");
            fileInfo.CopyTo(this.ParentForm.PathSDCardSystemFile1Folder + "UserGroupPassword.int", true);
            fileInfo = new FileInfo(this.ParentForm.PathPreVersionSystemFile1Folder + "UserLevel1.int");
            fileInfo.CopyTo(this.ParentForm.PathSDCardSystemFile1Folder + "UserLevel1.int", true);
            fileInfo = new FileInfo(this.ParentForm.PathPreVersionSystemFile1Folder + "UserLevel2.int");
            fileInfo.CopyTo(this.ParentForm.PathSDCardSystemFile1Folder + "UserLevel2.int", true);
            fileInfo = new FileInfo(this.ParentForm.PathPreVersionSystemFile1Folder + "UserLevel3.int");
            fileInfo.CopyTo(this.ParentForm.PathSDCardSystemFile1Folder + "UserLevel3.int", true);
        }

        public void DisplayRefresh()
        {

        }
        #endregion

        #region Event Handler
        private void comboBoxPreviousVersion_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (this.ParentForm.SystemConfig1.Language == DataStore.LanguageID.English)
            {
                this.labelStatus.Text = "> Click the [Conversion] button to start the update.";
            }
            else if (this.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Chinese)
            {
                this.labelStatus.Text = "> 单击[转换]按钮开始更新。";
            }
            else if (this.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Czech)
            {
            }
            else if (this.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Russian)
            {
                this.labelStatus.Text = "> Нажмите кнопку [Преобразование], чтобы начать обновление.";
            }
            else if (this.ParentForm.SystemConfig1.Language == DataStore.LanguageID.German)
            {
                this.labelStatus.Text = "> Klicken Sie auf die Schaltfläche [Konvertierung], um das Update zu starten.";
            }
            else if (this.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Spanish)
            {
                this.labelStatus.Text = "> Haga clic en el botón [Conversión] para iniciar la actualización.";
            }
            else
            {
                this.labelStatus.Text = "> [Conversion] 버튼을 누르면 업데이트가 시작됩니다.";
            }
        }

        private void buttonConversion_Click(object sender, EventArgs e)
        {
            if (this.ParentForm.SystemConfig1.Language == DataStore.LanguageID.English)
            {
                this.labelStatus.Text = "> Please wait a moment";
            }
            else if (this.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Chinese)
            {
                this.labelStatus.Text = "> 请稍候";
            }
            else if (this.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Czech)
            {
            }
            else if (this.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Russian)
            {
                this.labelStatus.Text = "> Пожалуйста, подождите несколько секунд";
            }
            else if (this.ParentForm.SystemConfig1.Language == DataStore.LanguageID.German)
            {
                this.labelStatus.Text = "> Bitte warte einen Moment";
            }
            else if (this.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Spanish)
            {
                this.labelStatus.Text = "> Esperar";
            }
            else
            {
                this.labelStatus.Text = "> 잠시만 기다려 주십시오.";
            }

            try
            {
                this.comboBoxPreviousVersion.Enabled = false;

                this.CopyUserFiles();

                this.progressBarUpdate.Value += 10;

                this.ConvertingCounterItem();

                this.progressBarUpdate.Value += 20;

                this.ConvertingJudgmentItem();

                this.progressBarUpdate.Value += 20;

                this.ConvertingSystemParameter2();
                this.ConvertingSystemParameter3();
                this.ConvertingSystemParameter4();

                this.progressBarUpdate.Value += 10;

                switch (this.comboBoxPreviousVersion.SelectedIndex + 2)
                {
                    case 3:
                        this.ConvertingProductItemUntilV7();
                        this.ConvertingSystemItemFromV3V4();
                        this.ConvertingSystemParameter1UntilV6();
                        this.ConvertingUserItemUntilV6();
                        break;
                    case 4:
                        this.ConvertingProductItemUntilV7();
                        this.ConvertingSystemItemFromV3V4();
                        this.ConvertingSystemParameter1UntilV6();
                        this.ConvertingUserItemUntilV6();
                        break;
                    case 5:
                        this.ConvertingProductItemUntilV7();
                        this.ConvertingSystemItemFromV5();
                        this.ConvertingSystemParameter1UntilV6();
                        this.ConvertingUserItemUntilV6();
                        break;
                    case 6:
                        this.ConvertingProductItemUntilV7();
                        this.ConvertingSystemItemFromV6();
                        this.ConvertingSystemParameter1UntilV6();
                        this.ConvertingUserItemUntilV6();
                        break;
                    case 7:
                        this.ConvertingProductItemUntilV7();
                        this.ConvertingSystemItemFromV7V8();
                        this.ConvertingSystemParameter1FromV7();
                        this.ConvertingUserItemFromV7();
                        break;
                    case 8:
                        this.ConvertingProductItemFromV8();
                        this.ConvertingSystemItemFromV7V8();
                        this.ConvertingSystemParameter1FromV7();
                        this.ConvertingUserItemFromV7();
                        break;
                    default:
                        break;
                }

                #region Loading
                // UserGroup 파일 읽기
                this.ParentForm.LoadUserGroupFile(ref this.ParentForm.CurrentUserGroup);
                // User 파일 읽기
                this.ParentForm.LoadUserLevel1File(this.ParentForm.CurrentUser.Level1Users);
                this.ParentForm.LoadUserLevel2File(this.ParentForm.CurrentUser.Level2Users);
                this.ParentForm.LoadUserLevel3File(this.ParentForm.CurrentUser.Level3Users);
                #endregion

                this.ParentForm.ChildFormMainDisplay.DefaultSetting();
                this.ParentForm.ChildFormMainDisplay.DisplayRefreshLogin();
                this.ParentForm.ChildFormMenu.bottomEquipment.DefaultSetting();
                this.ParentForm.ChildFormMenu.CenterEquipHelp.DefaultSetting();

                this.comboBoxPreviousVersion.Enabled = true;
                this.progressBarUpdate.Value = 100;
            }
            catch
            {
                this.labelStatus.Text = "> Loading....";
                this.progressBarUpdate.Value = 100;
            }

            // Write SystemParameter1
            this.ParentForm.TransferParameter1();

            this.ParentForm.smartForm.Show((int)DataStore.FormStore.FormMainDisplay);
            this.ParentForm.ChildFormMainDisplay.BringToFront();
            this.ParentForm.ChildFormMainDisplay.MainWeightBigScreen.UpdateDisplay();
            this.ParentForm.ChildFormMainDisplay.MainWeightSmallScreen.UpdateDisplay();
            this.ParentForm.ChildFormMainDisplay.CurrentBottomMenuControlEnable();

            this.Hide();
        }
        #endregion
    }
}
