Пример #1
0
        private bool InitParameter(UploadParameter data)
        {
            if (!CommonFunction.IsNetworkAvailable())//Check Network before publish
            {
                System.Windows.MessageBox.Show(GlobalData.FindResource("Publish_Window_S_ErrorMessage"));

                return(false);
            }

            IDocumentService doc = ServiceLocator.Current.GetInstance <IDocumentService>();

            if (doc != null && doc.Document != null)
            {
                Guid sGUID = doc.Document.Guid;

                data.id = ConfigFileManager.GetSectionValue(ConstData.sRemoteID, sGUID.ToString());
                data.ProjectPassword = ConfigFileManager.GetSectionValue(ConstData.sProjectPassword, sGUID.ToString());
                data.DocGUID         = sGUID.ToString();

                doc.Document.GeneratorConfigurationSet.DefaultHtmlConfiguration.CurrentPage = Guid.Empty;
            }

            if (String.IsNullOrEmpty(data.id))
            {
                return(true);
            }
            else
            {
                return(HttpGetFileInfo(data));
            }
        }
Пример #2
0
        private void UploadFailed(string errorMessage, string tempFiles, bool bNeedClear = false)
        {
            if (bNeedClear)
            {
                ConfigFileManager.SetSectionValue("RemoteID", _upLoadPara.DocGUID, "");
                ConfigFileManager.SetSectionValue("ProjectPassword", _upLoadPara.DocGUID, "");
            }
            _procesVM.sErrorMessage = errorMessage;
            _busyIndicator.Progress = 100;
            _busyIndicator.Content  = @"Publish Failed!";

            _procesVM.IsCloseEnable = true;
            if (_procesWindow != null)
            {
                _procesWindow.IsAllowClose = true;
            }
            else
            {
                Application.Current.Dispatcher.Invoke(
                    new Action(
                        delegate
                {
                    _differView.UploadError(errorMessage);
                }));
                _procesVM.StopProgress();
            }
            _uploadState = UploadState.upload_End;

            ClearTempFile(tempFiles);
        }
Пример #3
0
        private void skinButton31_Click_1(object sender, EventArgs e)
        {
            int id = 0;

            if (!int.TryParse(textBox6.Text, out id) ||
                !int.TryParse(textBox6.Text, out id) ||
                !int.TryParse(textBox8.Text, out id) ||
                !int.TryParse(textBox9.Text, out id) ||
                !int.TryParse(textBox10.Text, out id)

                )
            {
                MessageBox.Show("数据错误!");
            }

            ConfigFileManager parafile = new ConfigFileManager(Constant.ConfigParamFilePath);

            parafile.WriteConfig("WlNear0", textBox9.Text);
            parafile.WriteConfig("WlNear1", textBox6.Text);
            parafile.WriteConfig("WlNear2", textBox7.Text);
            parafile.WriteConfig("WlNear3", textBox8.Text);
            parafile.WriteConfig("WlNear4", textBox10.Text);
            parafile.WriteConfig("WlNear5", textBox13.Text);
            evokWork?.ReadSimiWlst();
            MessageBox.Show("设置成功!");
        }
Пример #4
0
        public bool Execute(string packageName, XmlNode xmlData)
        {
            try
            {
                Initialize(xmlData);

                PackageActionsHelpers.BackupExistingXmlConfig(_targetConfigFullPath);

                if (!_inTestMode)
                {
                    Log.Add(LogTypes.Debug, -1, string.Format("MergeConfigFiles: {0} into: {1}", _sourceConfigFullPath, _targetConfigFullPath));
                }
                var config = new ConfigFileManager(_targetConfigFullPath, _sourceConfigFullPath);
                config.Save();

                if (!String.IsNullOrWhiteSpace(SourceConfigIntegratedModePath))
                {
                    if (!_inTestMode)
                    {
                        Log.Add(LogTypes.Debug, -1, string.Format("MergeConfigFiles (IIS7): {0} into: {1}", _sourceConfigIntegratedModeFullPath, _targetConfigFullPath));
                    }
                    config = new ConfigFileManager(_targetConfigFullPath, _sourceConfigIntegratedModeFullPath);
                    config.Save();
                }
            }
            catch (Exception ex)
            {
                if (!_inTestMode)
                {
                    Log.Add(LogTypes.Error, -1, string.Concat(new object[] { ex.Message, "\n", ex.TargetSite, "\n", ex.StackTrace }));
                }
                return(false);
            }
            return(true);
        }
Пример #5
0
        private void UploadSucessed(ref ResponseData data, string tempFiles)
        {
            ConfigFileManager.SetSectionValue("RemoteID", _upLoadPara.DocGUID, data.id);
            ConfigFileManager.SetSectionValue("ProjectPassword", _upLoadPara.DocGUID, _upLoadPara.ProjectPassword);

            _busyIndicator.Progress = 100;
            _busyIndicator.Content  = @"Publish Success";

            _procesVM.sShortUrl = data.shortUrl;
            _procesVM.sUrl      = data.shortUrl;

            _procesVM.IsCloseEnable = true;
            if (_procesWindow != null)
            {
                _procesWindow.IsAllowClose = true;
            }
            else
            {
                Application.Current.Dispatcher.Invoke(
                    new Action(
                        delegate
                {
                    RemovePrePublish_Closing();
                    _differView.Current = _procesVM;
                }));
                _procesVM.StopProgress();
            }
            _uploadState = UploadState.upload_End;

            ClearTempFile(tempFiles);
        }
Пример #6
0
 public void Setup()
 {
     ConfigFileManager.CopyWebConfig();
     ConfigFileManager.CopyConnectionStringsConfig();
     ConfigFileManager.CopyRoadkillConfig();
     SqlServerSetup.RecreateLocalDbData();
 }
Пример #7
0
        void InitDeviceMode()
        {
            //设备有好几种 那就显示不同的UI
            ConfigFileManager cfm = new ConfigFileManager(Constant.ConfigDeviceModeFilePath);

            if (cfm.ReadConfig(Constant.deviceMode).Equals(putongJiaYou.ToString()))
            {
                //加油类型
                //手动
                button15.Visible  = false;
                button14.Visible  = false;
                button13.Visible  = false;
                groupBox9.Visible = false;

                //参数这里
                label76.Visible   = false;
                label77.Visible   = false;
                textBox44.Visible = false;
                textBox45.Visible = false;
                label79.Visible   = false;
                textBox50.Visible = false;
                this.Text         = "水平打孔机-左右拉槽改加油";
            }
            if (cfm.ReadConfig(Constant.deviceMode).Equals(putongChiTiao.ToString()))
            {
                //齿条类型
                // 手动
                lblY13.Visible = false;
                this.Text      = "水平打孔机-左右拉槽带检测铣槽";
            }
        }
Пример #8
0
        private void skinButton30_Click(object sender, EventArgs e)
        {
            SqlConnection
                lo_conn = new SqlConnection("Server=" + textBox2 + ";Database=" + textBox4 + ";uid=" + textBox3 + ";pwd=" + textBox5);

            try
            {
                lo_conn.Open();

                DataTable dt = lo_conn.GetSchema("Tables");

                ConfigFileManager parafile = new ConfigFileManager(Constant.ConfigParamFilePath);
                parafile.WriteConfig("SQL_ServerName", textBox2.Text);
                parafile.WriteConfig("SQL_DatabaseName", textBox4.Text);
                parafile.WriteConfig("SQL_UserName", textBox3.Text);
                parafile.WriteConfig("SQL_Passwd", textBox5.Text);
                parafile.WriteConfig("SQL_Tablename", textBox12.Text);

                MessageBox.Show("设置成功!");
            }
            catch (Exception ex)
            {
                MessageBox.Show("设置成功失败!");
                MessageBox.Show("数据库登录失败,错误:" + ex.Message);
            }
        }
Пример #9
0
        private void skinButton33_Click(object sender, EventArgs e)
        {
            ConfigFileManager parafile = new ConfigFileManager(Constant.ConfigParamFilePath);

            FolderBrowserDialog op = new FolderBrowserDialog();
            string path            = "";

            if (op.ShowDialog() == DialogResult.OK)
            {
                path = op.SelectedPath;
            }
            else
            {
                return;
            }

            textBox1.Text = path;

            if (Directory.Exists(textBox1.Text))
            {
                parafile.WriteConfig("simiDataDir", textBox1.Text);
                MessageBox.Show("写入成功!");
            }
            else
            {
                MessageBox.Show("写入失败!");
            }
        }
Пример #10
0
 void Init()
 {
     userPara = new ConfigFileManager(Constant.ConfigSimiUserDataFilePath);
     restM    = new RestMaterial();
     InitParam();
     InitSimiParam();
 }
        public bool Execute(string packageName, XmlNode xmlData)
        {
            Initialize(xmlData);

            PackageActionsHelpers.BackupExistingXmlConfig(_targetConfigFullPath);

            var config = new ConfigFileManager(_targetConfigFullPath);

            var current = GetRewritingNode(config, "umbracoReservedPaths");

            if (!String.IsNullOrEmpty(current))
            {
                if (!current.Contains(",~/ucommerceapi/"))
                {
                    AddValue(config, "umbracoReservedPaths", string.Concat(current, ",~/ucommerceapi/"));
                }
            }
            else
            {
                throw new ArgumentOutOfRangeException("umbracoReservedPaths", "No setting for umbracoReservedPaths could be found in your web.config -are you sure this is an Umbraco install?");
            }

            config.Save();

            return(true);
        }
 public void ExecuteSave(object parameter)
 {
     ConfigFileManager.WriteJsonValue(Constants.LeftLogoStr, ReportHeaderLeftLogo);
     ConfigFileManager.WriteJsonValue(Constants.RightLogoStr, ReportHeaderRightLogo);
     ConfigFileManager.WriteJsonValue(Constants.FooterTextStr, ReportFooterText);
     ConfigFileManager.WriteJsonValue(Constants.FooterTextColorStr, FooterTextColor.ToString());
     ExecuteClose(parameter);
 }
Пример #13
0
 private static string GetfileName(string url)
 {
     if (url.EndsWith("/"))
     {
         url += ".default";
     }
     return(ConfigFileManager.GetConfig <NetConfig>().TempPath + url.Replace("http://", ""));
 }
Пример #14
0
        public static Point3D[] Parse3DPoints(SingleScanData single_scan_data)
        {
            List <Point3D> list_3d_point = new List <Point3D>();

            double x_pos       = single_scan_data.XPos;
            double plane_angle = single_scan_data.PlaneAngle;

            double[] scan_data = single_scan_data.ScanData;

            double start_scan_angle = double.Parse(ConfigFileManager.ReadSensorStartAngle());
            double angle_resolution = double.Parse(ConfigFileManager.ReadSensorAngleResolution());

            double plane_angle_rad = plane_angle * Math.PI / 180;

            // calculate the start and end angle
            double start_spreader_range_angle = Math.Atan((single_scan_data.XPos + ConfigParameters.SENSOR_OFFSET_X
                                                           - (single_scan_data.XPos + ConfigParameters.SPREADER_OFFSET_X + ConfigParameters.CONTAINER_WIDTH
                                                              + ConfigParameters.SPREADER_SWING_RANGE)) / single_scan_data.YPos) / Math.PI * 180 + 90;

            double end_spreader_range_angle = Math.Atan((single_scan_data.XPos + ConfigParameters.SENSOR_OFFSET_X
                                                         - (single_scan_data.XPos + ConfigParameters.SPREADER_OFFSET_X - ConfigParameters.SPREADER_SWING_RANGE)) //rate
                                                        / (single_scan_data.YPos - ConfigParameters.CONTAINER_HEIGHT)) / Math.PI * 180 + 90;

            double spreader_angle_range = (end_spreader_range_angle - start_spreader_range_angle);

            bool isRemoveSpreader = false;

            if (Math.Abs((1 / Math.Tan(plane_angle_rad)) * (single_scan_data.YPos - ConfigParameters.CONTAINER_HEIGHT))
                < ConfigParameters.MIDDLE_STACK_CONTAINER_LENGTH / 2 + ConfigParameters.SPREADER_SWING_RANGE)
            {
                isRemoveSpreader = true;
            }

            for (int i = 0; i < scan_data.Length; i++)
            {
                Point3D point          = new Point3D();
                double  beam_angle_deg = start_scan_angle + i * angle_resolution;

                // skip if in spreader range
                if (beam_angle_deg >= start_spreader_range_angle && beam_angle_deg <= (start_spreader_range_angle + spreader_angle_range) && isRemoveSpreader)
                {
                    continue;
                }

                double beam_angle_rad = beam_angle_deg * Math.PI / 180;

                // change the angle
                //plane_angle_rad -= Math.PI;

                point.X = scan_data[i] * Math.Cos(beam_angle_rad) + x_pos;
                point.Y = scan_data[i] * Math.Sin(beam_angle_rad) * Math.Sin(plane_angle_rad);
                point.Z = scan_data[i] * Math.Sin(beam_angle_rad) * Math.Cos(plane_angle_rad);

                list_3d_point.Add(point);
            }

            return(list_3d_point.ToArray());
        }
Пример #15
0
        private void MainNoStatic()
        {
            CreateFiles();
            ConfigFileManager.LoadConfigFiles(MainApp);

            /*var test = Settings.Database ?? new Dictionary<string, string>();
             * test.Add("test", "tast");*/
            Settings.SaveConfig();
        }
Пример #16
0
        /// <summary>
        /// 获取文件
        /// </summary>
        /// <returns></returns>
        public static RegConfigInfo GetConfig()
        {
            if (_configFileManager == null)
            {
                _configFileManager = new ConfigFileManager <RegConfigInfo>("/config/reg.config");
            }

            return(_configFileManager.LoadConfig());
        }
Пример #17
0
        /// <summary>
        /// 获取文件
        /// </summary>
        /// <returns></returns>
        public static SerializableStringDictionary GetConfig()
        {
            if (_configFileManager == null)
            {
                _configFileManager = new ConfigFileManager <SerializableStringDictionary>("/config/global.config");
            }

            return(_configFileManager.LoadConfig());
        }
Пример #18
0
 public static T GetGenericFromCfgFile <T>(string path, bool neccesary)
 {
     if (neccesary | ConfigFileHelper.IsFileExisting(path))
     {
         var cfgFileMgr = new ConfigFileManager(path);
         return(cfgFileMgr.ConvertToGeneric <T>());
     }
     return(default(T));
 }
Пример #19
0
 public static void UpdateConfig()
 {
     ConfigFileManager.WriteConfig(FileSettingsPath, new List <ConfigStructure>
     {
         ExtractPath,
         GameFolderPath,
         ContentPath,
         SevenZipExePath
     });
 }
Пример #20
0
        private void ExecuteOpenShower(object parameter)
        {
            //select shower from dialog
            IMessageBoxService _msgboxcommand = new MessageBoxService();
            string             _exefolder     = ConfigFileManager.GetLocalExePath();//  Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
            string             _filename      = _msgboxcommand.OpenFileDlg("Select Shower", true, false, "Shower Files(*." + Constants._showerfilenameext + ")| *." + Constants._showerfilenameext, null, _exefolder);

            _msgboxcommand = null;
            OpenSelectedShowerFile(_filename);
        }
Пример #21
0
 void AddSDK_Execute(object parameters)
 {
     this.Items.Add(new SDK()
     {
         Name = this.Name, Path = this.Path
     });
     ConfigFileManager.AddSDK(this.Path, this.Name);
     this.Name = string.Empty;
     this.Path = string.Empty;
 }
Пример #22
0
        public void InitWork()
        {
            SetControlInEvokWork();
            if (propertyA)
            {
                // evokWork0.InitDgvParam(dgvParam);
                //evokWork0.InitDgvIO(dgvIO);
                evokWork0.DeviceProperty = Constant.devicePropertyA;
                // evokWork0.SetRtbResult(richTextBox2);
                // evokWork0.SetRtbWork(richTextBox1);
                evokWork0.SetLblStatus(label8);
                evokWork0.SetOptSize(opXiaLiao);
                evokWork0.SetPrintReport();
                errorList = evokWork0.ErrorList;
            }
            if (propertyB)
            {
                //evokWork1.InitDgvParam(dgvParam1);
                // evokWork1.InitDgvIO(dgvIO1);
                evokWork1.DeviceProperty = Constant.devicePropertyB;
                // evokWork1.SetRtbResult(richTextBox3);
                // evokWork1.SetRtbWork(richTextBox4);
                evokWork1.SetLblStatus(label9);
                evokWork1.SetOptSize(opDoorShell);
            }
            if (propertyC)
            {
                //evokWork2.InitDgvParam(dgvParam2);
                //evokWork2.InitDgvIO(dgvIO2);
                evokWork2.DeviceProperty = Constant.devicePropertyC;
                // evokWork2.SetRtbResult(richTextBox5);
                // evokWork2.SetRtbWork(richTextBox6);
                evokWork2.SetLblStatus(label11);
                evokWork2.SetOptSize(opDoorBan);
            }
            //读取设备名
            paraFile = new ConfigFileManager();
            paraFile.LoadFile(Constant.ConfigParamFilePath);
            if (propertyA)
            {
                evokWork0.DeviceName = paraFile.ReadConfig("work0");
                evokWorkLst.Add(evokWork0);
            }

            if (propertyB)
            {
                evokWork1.DeviceName = paraFile.ReadConfig("work1");
                evokWorkLst.Add(evokWork1);
            }
            if (propertyC)
            {
                evokWork2.DeviceName = paraFile.ReadConfig("work2");
                evokWorkLst.Add(evokWork2);
            }
        }
Пример #23
0
        public void TestFixtureSetUp()
        {
            if (!IsAdmin())
            {
                Assert.Fail("In order for these tests to work, you need to run them as an administrator (for LocalDB to work). Try running Visual Studio as an administrator.");
            }

            ConfigFileManager.CopyConnectionStringsConfig();
            SqlCeSetup.CopyDb();
            SqliteSetup.CopyDb();
        }
Пример #24
0
        public void Setup()
        {
            DeleteSqliteBinaries();
            _iisExpress = new IISExpress();
            _iisExpress.Start();

            ConfigFileManager.CopyWebConfig();
            ConfigFileManager.CopyConnectionStringsConfig();
            ConfigFileManager.CopyRoadkillConfig();
            Driver = LaunchChrome();
        }
Пример #25
0
 void ReadUserData()
 {
     if (cfg == null)
     {
         cfg = new ConfigFileManager(Constant.ConfigUserDataFilePath);
     }
     textBox3.Text = cfg.ReadConfig("pos1");
     textBox2.Text = cfg.ReadConfig("pos2");
     textBox4.Text = cfg.ReadConfig("pos3");
     textBox5.Text = cfg.ReadConfig("pos4");
     textBox6.Text = cfg.ReadConfig("pos5");
 }
Пример #26
0
        void Init()
        {
            cfg = new ConfigFileManager(Constant.cfgPrjFile);

            SetCombBx(dirCb, prjDirLst);
            SetCombBx(gdTypeCb, guanDuanTypeLst);
            SetCombBx(gdMaterialCb, guanDuanMaterialLst);
            SetCombBx(pgbzCb, evalIdLst);
            SetCombBx(areaImportanceCb, areaImportanceLst);
            SetCombBx(soilQuantityCb, soilQuantityLst);
            SetCombBx(payLoadCb, payLoadLst);
        }
Пример #27
0
        private void SaveConfigurations()
        {
            //Launcher Settings
            Parameter.GameClientSettingsInformation.SavedNickname = nicknameTextBox.Text;
            NetworkObjectParameters.LoginServerInformation.ServerPublicAddress = loginServerIPTextBox.Text;
            NetworkObjectParameters.LoginServerInformation.ServerPort          = int.Parse(loginServerPortTextBox.Text);

            NetworkObjectParameters.LobbyServerInformation.ServerPublicAddress = lobbyServerIPTextBox.Text;
            NetworkObjectParameters.LobbyServerInformation.ServerPort          = int.Parse(lobbyServerPortTextBox.Text);

            NetworkObjectParameters.FetchServerInformation.ServerPublicAddress = fetchServerIPTextBox.Text;
            NetworkObjectParameters.FetchServerInformation.ServerPort          = int.Parse(fetchServerPortTextBox.Text);

            //Graphic Settings
            //-- Windowed Settings
            string[] windowedRes = windowedResolution.Text.Split(" x ");
            Parameter.GameClientSettingsInformation.WindowedWidth  = int.Parse(windowedRes[0]);
            Parameter.GameClientSettingsInformation.WindowedHeight = int.Parse(windowedRes[1]);
            Parameter.GameClientSettingsInformation.IsFullScreen   = !isWindowedCheckbox.Checked;

            //-- In-Game Settings
            string[] ingameRes = inGameResolutionComboBox.Text.Split(" x ");
            Parameter.GameClientSettingsInformation.InGameResolutionWidth  = int.Parse(ingameRes[0]);
            Parameter.GameClientSettingsInformation.InGameResolutionHeight = int.Parse(ingameRes[1]);

            //Graphical Enhancements
            //-- Anti-Aliasing
            Parameter.GameClientSettingsInformation.IsMultiSamplingEnabled = isAntiAliasingOnCheckbox.Checked;
            Parameter.GameClientSettingsInformation.MultiSamplingCount     = int.Parse(antiAliasingSamplesComboBox.Text.Split(" x ")[1]);

            //VSync
            Parameter.GameClientSettingsInformation.IsVSyncOn = isVSyncOnCheckbox.Checked;

            //Game Settings
            //--Background
            Parameter.GameClientSettingsInformation.IsBackgroundOn              = shouldRenderBackgroundCheckBox.Checked;
            Parameter.GameClientSettingsInformation.BackgroundColorRedChannel   = int.Parse(redBackgroundColorTextBox.Text);
            Parameter.GameClientSettingsInformation.BackgroundColorGreenChannel = int.Parse(greenBackgroundColorTextBox.Text);
            Parameter.GameClientSettingsInformation.BackgroundColorBlueChannel  = int.Parse(blueBackgroundColorTextBox.Text);

            Parameter.GameClientSettingsInformation.BGM = (int)Math.Clamp((bgmTrackBar.Value / (float)bgmTrackBar.Maximum) * 100f, 0, 100);
            Parameter.GameClientSettingsInformation.SFX = (int)Math.Clamp((soundEffectTrackBar.Value / (float)soundEffectTrackBar.Maximum) * 100f, 0, 100);

            ConfigFileManager.OverwriteGameServerSettings(Parameter.GameClientSettingsInformation);

            ConfigFileManager.OverwriteLauncherServerSettings(new List <ServerInformation>()
            {
                NetworkObjectParameters.LoginServerInformation,
                NetworkObjectParameters.LobbyServerInformation,
                NetworkObjectParameters.FetchServerInformation
            });
        }
Пример #28
0
 private void button_0_Click(object sender, EventArgs e)
 {
     this.ruleConfigInfo_0 = (RuleConfigInfo)ConfigFileManager.LoadConfig(this.comboBox_0.Text, this.ruleConfigInfo_0);
     this.propertyInfo_0   = this.ruleConfigInfo_0.GetType().GetProperties();
     for (int i = 0; i < (int)this.propertyInfo_0.Length; i++)
     {
         this.listBox_0.Items.Add(this.propertyInfo_0[i].Name);
     }
     this.button_0.Enabled   = false;
     this.comboBox_0.Enabled = false;
     this.button_1.Enabled   = true;
     ConfigFileManager.SaveConfig(this.comboBox_0.Text, this.ruleConfigInfo_0);
 }
Пример #29
0
 /// <summary>
 /// 直接返回流,如果文件存在且配置为不检查更新则会返回文件流
 /// </summary>
 /// <returns></returns>
 public Stream GetResponseStream()
 {
     if (!ConfigFileManager.GetConfig <NetConfig>().CheckUpdate&& File.Exists(LocalFileName))
     {
         try
         {
             return(GetFileStream(LocalFileName));
         }
         catch (Exception)
         {
         }
     }
     return(GetResponse().GetResponseStream());
 }
Пример #30
0
        //# set
        internal void SetApplicationStartPolicy(FormType formType, string funcCodeOrRelativePath)
        {
            var formCFgDir = "";

            if (formType == FormType.Mvi)
            {
                formCFgDir = _appCfgDir + "\\UIs\\WinForm\\Functions\\" + funcCodeOrRelativePath;
            }
            else if (formType == FormType.SviOfView)
            {
                formCFgDir = _appCfgDir + "\\UIs\\WinForm\\Views\\" + funcCodeOrRelativePath;
            }
            else
            {
                formCFgDir = _appCfgDir + "\\UIs\\WinForm\\Zones\\" + funcCodeOrRelativePath;
            }
            if (!DirectoryHelper.IsDirectoryExisting(formCFgDir))
            {
                throw new ArgumentException(String.Format("Forn config Folder: {0} doesn't exist! ", formCFgDir));
            }

            var startPolicy = new StartPolicy();
            var cfgFile     = formCFgDir + "\\StartPolicy";

            if (!ConfigFileHelper.IsFileExisting(cfgFile))
            {
                return;
            }
            try
            {
                var confFileMgr = new ConfigFileManager(cfgFile);
                startPolicy = confFileMgr.ConvertToGeneric <StartPolicy>();

                ApplicationStartParamSet.VerifyPasswordAtStart = startPolicy.VerifyPasswordAtStartFlag.ToLower() == "false" ? false
                    : (startPolicy.VerifyPasswordAtStartFlag.ToLower() == "true" ? true : ApplicationStartParamSet.VerifyPasswordAtStart);

                ApplicationStartParamSet.ShowSoftwareCoverAtStart = startPolicy.ShowSoftwareCoverAtStartFlag.ToLower() == "false" ? false
                    : (startPolicy.ShowSoftwareCoverAtStartFlag.ToLower() == "true" ? true : ApplicationStartParamSet.ShowSoftwareCoverAtStart);

                ApplicationStartParamSet.LogonAtStart = startPolicy.LogonAtStartFlag.ToLower() == "false" ? false
                    : (startPolicy.LogonAtStartFlag.ToLower() == "true" ? true : ApplicationStartParamSet.LogonAtStart);

                ApplicationStartParamSet.RunBootStrapperTasksAtStart = startPolicy.RunBootStrapperTasksAtStartFlag.ToLower() == "false" ? false
                    : (startPolicy.RunBootStrapperTasksAtStartFlag.ToLower() == "true" ? true : ApplicationStartParamSet.RunBootStrapperTasksAtStart);
            }
            catch (Exception ex)
            {
                throw new ArgumentException("\n>> " + GetType().FullName + ".SetApplicationStartParamSet Error: " + ex.Message);
            }
        }
Пример #31
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            /***
             * Implements error logging.
             * Configure all appenders.
             * Get logging level out of App.config.
             */
            Logger logger = Logger.Instance;

            // Create file appender for logging
            FileAppender filelogger = new FileAppender();
            filelogger.Configure();

            // Add all logger appenders to static list
            Logger.Appenders.Add(filelogger);

            // Get logging level out of config file
            AppSettingsReader config = new AppSettingsReader(); // Settings.Default.
            Logger.Loggerlevel = (int)config.GetValue("LoggerLevel", typeof(int));

            // Program startup logging
            logger.Log(Logger.Level.Info, "-----------------------------------------------------------");
            logger.Log(Logger.Level.Info, "Program is started.");
            logger.Log(Logger.Level.Info, "Logging level: " + Logger.Loggerlevel);

            /***
             * Checks data base existance and creates if needed.
             */
            ConfigFileManager cfm = new ConfigFileManager();
            bool exists = false;

            try
            {
                // Check if mock database shall be used. Result is stored in var ConfigFileManager.mockDB
                cfm.UsingMockDatabase();

                // Save info in logfile
                if (ConfigFileManager.MockDB == true)
                {
                    logger.Log(Logger.Level.Info, "Using mock database.");
                }
                else
                {
                    logger.Log(Logger.Level.Info, "Using SQLite database.");
                }

                exists = cfm.CheckDataBaseExistance();
            }
            // probably syntax error in config file - see logfile
            catch (System.Configuration.ConfigurationErrorsException)
            {
                Application.Exit();
            }

            // Open window, which one depends on whether the database has been found or not
            if (!exists)
            {
                Application.Run(new DBNotFoundForm());
            }
            else // database found. Start with home screen.
            {
                Application.Run(new HomeForm());
            }
        }