Example #1
0
        private void btBuildEmptyConfiguration_Click(object sender, EventArgs e)
        {
            string sConfigFile  = Application.StartupPath + "\\" + FileOutboundAdapterConfigMgt.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);
            }

            FileOutboundAdapterConfigMgt.FileOutAdapterConfig = new FileOutboundAdapterConfig();
            FileOutboundAdapterConfigMgt.Save(sConfigFile);

            MessageBox.Show("New Configuration have been built!");
        }
Example #2
0
        public static void PreLoading()
        {
            //LoadConfigXMLFile();
            string FileName = Application.StartupPath + "\\" + FileOutboundAdapterConfigMgt.FileName;

            if (!FileOutboundAdapterConfigMgt.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)
                {
                    FileOutboundAdapterConfigMgt.Save(FileName);
                }
            }
            else
            {
                //log.LogLevel = FileOutboundAdapterConfigMgt.FileOutAdapterConfig.OutGeneralParams.LogLevel;
            }

            //ConfigMain cm = new ConfigMain();
            //IOutboundRule[] rs = cm.GetRules();
        }
Example #3
0
        private void Save()
        {
            #region Server File parameter
            FileOutGeneralParams gp = FileOutboundAdapterConfigMgt.FileOutAdapterConfig.OutGeneralParams;
            gp.TimerInterval = Convert.ToInt32(this.mtbTimerInterval.Text);
            gp.FilePath      = this.tbFilePath.Text;
            gp.FilePrefix    = this.tbFilePrefix.Text;
            gp.FileSuffix    = this.tbFileSuffix.Text;
            gp.FileDtFormat  = this.tbFileDTFormat.Text;
            #endregion

            string codePageName = ComboxLoader.GetEncoding(this.cbCodePage);
            FileOutboundAdapterConfigMgt.FileOutAdapterConfig.OutGeneralParams.CodePageName = codePageName;

            string FileName = Application.StartupPath + "\\" + FileOutboundAdapterConfigMgt.FileName;
            if (!FileOutboundAdapterConfigMgt.Save(FileName))
            {
                if (FileOutboundAdapterConfigMgt.LastException != null)
                {
                    Program.log.Write(LogType.Error, "Cannot save information to configuration file: " + FileName);
                }
                MessageBox.Show(FileOutboundAdapterConfigMgt.LastException.Message);
            }
        }