Esempio n. 1
0
        public static void Preloading()
        {
            Log.WriteAppStart("SocketInboundAdapter");

            string FileName = Application.StartupPath + "\\" + SocketInboundAdapterConfigMgt.FileName;

            //SocketInboundAdapterConfigMgt.SocketInAdapterConfig = SocketInboundAdapterConfigMgt.BuildSampleConfig();
            //SocketInboundAdapterConfigMgt.Save(FileName);

            if (!SocketInboundAdapterConfigMgt.Load(FileName))
            {
                Log.Write(LogType.Error, "Load configuration failed. \r\n" + FileName + "\r\n" + SocketInboundAdapterConfigMgt.LastException.Message);
            }
        }
Esempio n. 2
0
        public static void PreLoading()
        {
            //LoadConfigXMLFile();
            string FileName = Application.StartupPath + "\\" + SocketInboundAdapterConfigMgt.FileName;

            if (!SocketInboundAdapterConfigMgt.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)
                {
                    SocketInboundAdapterConfigMgt.Save(FileName);
                }
            }
            else
            {
                //log.LogLevel = SocketInboundAdapterConfigMgt.SocketInAdapterConfig.InGeneralParams.LogLevel;
            }
        }
Esempio n. 3
0
        private void btBuildEmptyConfiguration_Click(object sender, EventArgs e)
        {
            string sConfigFile  = Application.StartupPath + "\\" + SocketInboundAdapterConfigMgt.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);
            }

            SocketInboundAdapterConfigMgt.SocketInAdapterConfig = new SocketInboundAdapterConfig();
            SocketInboundAdapterConfigMgt.Save(sConfigFile);

            MessageBox.Show("New Configuration have been built!");
        }
Esempio n. 4
0
        private void Save()
        {
            #region Server Socket parameter
            ServerSocketParams.ListenIP        = this.txtIP.Text;
            ServerSocketParams.ListenPort      = Int32.Parse(this.txtPort.Text);
            ServerSocketParams.ConnectTimeout  = Int32.Parse(this.txtConnectTimeout.Text);
            ServerSocketParams.ConnectTryCount = Int32.Parse(this.txtTryCount.Text);
            ServerSocketParams.RecTimeout      = Int32.Parse(this.txtReceiveTimeout.Text);
            ServerSocketParams.SendTimeout     = Int32.Parse(this.txtSendTimeout.Text);
            ServerSocketParams.CodePageName    = EncodingPage.GetAllCodePages()[cbCodePage.SelectedIndex].Name;
            #endregion

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