コード例 #1
0
        private static bool ReadConfig()
        {
            bool blnResult = false;

            try
            {
                XmlSerializer xs = new XmlSerializer(typeof(Config));
                FileStream reader = new FileStream(Framework.Paths.ConfigPath, FileMode.Open);
                Framework.Config = (Config)xs.Deserialize(reader);
                Framework.Config.Init();
                reader.Close();
                blnResult = true;
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show("error reading config" + ex.Message + "\n" + ex.InnerException + "\n" + ex.StackTrace + "\n" + ex.Source + "\n");
            }

            return blnResult;
        }
コード例 #2
0
        /// <summary>
        /// 
        /// </summary>
        public static bool Start()
        {
            bool blnResult = false;
            Framework.Config = new Config();

            try
            {
                Framework.Connection = new ConnectionSettings();
                Framework.Paths = new Paths();
            }
            catch (Exception ex)
            {
                Framework.Log.AddError("Cannot read connection / paths. Check xml.", ex.Message, ex.StackTrace);
                return blnResult;
            }

            if (Framework.Init())
            {
                blnResult = true;
                Framework.Log.AddCorrect("Connection / Paths set.");
            }
            else
            {
                Framework.Log.AddIssue("Unknown repository found: " + Framework.Connection.Repository.ToString());
            }

            Framework.Ready = blnResult;
            return blnResult;
        }