Beispiel #1
0
        /// <summary>
        /// Saves the application configuration to the specified file,
        /// or to the default configuration file-path if absent.
        /// </summary>
        public static void StoreConfigurationTo(string ConfigFile = null)
        {
            if (ConfigFile.IsAbsent())
            {
                if (ConfigurationFilePath.IsAbsent())
                {
                    return; // Case of the "Admin-Utils".
                }
                else
                {
                    ConfigFile = ConfigurationFilePath;
                }
            }

            StreamWriter Writer = new StreamWriter(new FileStream(ConfigFile,
                                                                  FileMode.Create,
                                                                  FileAccess.Write));

            foreach (var Configuration in CurrentConfiguration)
            {
                var ValueLines = Configuration.Value.Segment(Environment.NewLine);

                for (int Index = 0; Index < ValueLines.Length; Index++)
                {
                    Writer.WriteLine((Index == 0 ? Configuration.Key : "") + CONFIG_ASSIGNATOR + ValueLines[Index]);
                }
            }

            Writer.Flush();
            Writer.Close();
        }
        public JsonFileConfigurationLayer(
            [NotNull] string filename, [NotNull] Encoding encoding, bool isOptional)
        {
            if (filename == null)
            {
                throw new ArgumentNullException(nameof(filename));
            }

            _FilePath  = ConfigurationFilePath.GetFullPath(filename);
            _Encoding  = encoding ?? throw new ArgumentNullException(nameof(encoding));
            IsOptional = isOptional;

            _StateCheck = StateCheckForFileComingIntoExistence;
        }
Beispiel #3
0
        private void Button3_Click_1(object sender, EventArgs e)
        {
            if (!IncXmlFile && !CsqlFile && !ExTextFile && !ExExcelFile)
            {
                MessageBox.Show("You must select at least one output file.");
                return;
            }

            if (ConfigurationFilePath.Equals(""))
            {
                MessageBox.Show("You must select a configuration input file.");
                return;
            }

            if (ETSFIlePath.Equals(""))
            {
                MessageBox.Show("You must select an Alstom ETS input file.");
                return;
            }
            this.FormClosed -= new System.Windows.Forms.FormClosedEventHandler(this.Form1_FormClosed); //Disable if we exit through the 'Begin Processing' button
            Console.WriteLine("Hit the Begin Processing Button");
            Form1.ActiveForm.Dispose();
        }
Beispiel #4
0
        private void Button3_Click_1(object sender, EventArgs e)
        {
            if (!IncXmlFile && !CsqlFile && !ExTextFile && !ExExcelFile)
            {
                MessageBox.Show("You must select at least one output file.");
                return;
            }

            if (ConfigurationFilePath.Equals(""))
            {
                MessageBox.Show("You must select a configuration input file.");
                return;
            }

            if (ETSFIlePath.Equals(""))
            {
                MessageBox.Show("You must select an Alstom ETS input file.");
                return;
            }

            Console.WriteLine("Hit the Begin Processing Button");
            Form1.ActiveForm.Dispose();
        }