Exemple #1
0
        private void Save()
        {
            #region Check input
            if (this.cbFTTAR.Text.ToString() == FileInGeneralParams.InFileTreatTypeAfterRead.Move.ToString())
            {
                if (this.tbFilePathForMove.Text == this.tbFilePath.Text)
                {
                    throw new Exception("File Path is not allow identical to file path for move!");
                }
            }
            #endregion
            #region Server File parameter
            FileInGeneralParams gp = FileInboundAdapterConfigMgt.FileInAdapterConfig.InGeneralParams;
            gp.TimerInterval          = Convert.ToInt32(this.mtbTimerInterval.Text);
            gp.FilePath               = this.tbFilePath.Text;
            gp.FilePrefix             = this.tbFilePrefix.Text;
            gp.FileSuffix             = this.tbFileSuffix.Text;
            gp.InFileMovePath         = this.tbFilePathForMove.Text;
            gp.FileTreatTypeAfterRead = (FileInGeneralParams.InFileTreatTypeAfterRead)System.Enum.Parse(typeof(FileInGeneralParams.InFileTreatTypeAfterRead), this.cbFTTAR.Text);
            #endregion

            string codePageName = ComboxLoader.GetEncoding(this.cbCodePage);
            FileInboundAdapterConfigMgt.FileInAdapterConfig.InGeneralParams.CodePageName = codePageName;

            string FileName = Application.StartupPath + "\\" + FileInboundAdapterConfigMgt.FileName;
            if (!FileInboundAdapterConfigMgt.Save(FileName))
            {
                if (FileInboundAdapterConfigMgt.LastException != null)
                {
                    Program.log.Write(LogType.Error, "Cannot Save information to Configuration file: " + FileName);
                }
                MessageBox.Show(FileInboundAdapterConfigMgt.LastException.Message);
            }
        }
Exemple #2
0
        public static void PreLoading()
        {
            //LoadConfigXMLFile();
            string FileName = Application.StartupPath + "\\" + FileInboundAdapterConfigMgt.FileName;

            if (!FileInboundAdapterConfigMgt.Load(FileName))
            {
                log.Write(LogType.Error, "Cannot Load Configuration file: " + FileName);
                if (MessageBox.Show("Cannot load configuration file. Do you want to create an empty configuration file?",
                                    "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
                {
                    FileInboundAdapterConfigMgt.Save(FileName);
                }
            }
        }
Exemple #3
0
        private void btBuildEmptyConfiguration_Click(object sender, EventArgs e)
        {
            string sConfigFile  = Application.StartupPath + "\\" + FileInboundAdapterConfigMgt.FileName;
            string sBakFileName = StarFile.BackupFile(sConfigFile);

            if (sBakFileName == "")
            {
                Program.Log.Write(LogType.Error, "Cannot backup configuration file:" + sConfigFile);
            }
            else
            {
                Program.Log.Write(LogType.Debug, "Configuration file:" + sConfigFile + " has been backup to " + sBakFileName);
            }

            FileInboundAdapterConfigMgt.FileInAdapterConfig = new FileInboundAdapterConfig();
            FileInboundAdapterConfigMgt.Save(sConfigFile);

            MessageBox.Show("New Configuration have been built!");
        }