Пример #1
0
 public SettingsEditor(SettingsFile settings)
 {
     _settings = settings;
     InitializeComponent();
 }
Пример #2
0
 internal ReporterDA(SettingsFile settings)
 {
     _settings = settings;
 }
Пример #3
0
        public static SettingsFile GetSettingsFile(string filePath)
        {
            SettingsFile settingsFile = new SettingsFile();

            if (File.Exists(filePath))
            {
                settingsFile.FilePath = filePath;

                XmlReader reader = XmlReader.Create(filePath);
                while (reader.Read())
                {
                    if (reader.IsStartElement())
                    {
                        switch (reader.Name)
                        {
                        case "LocalReportFolder":
                            if (reader.Read())
                            {
                                settingsFile.LocalReportFolder = reader.Value.Trim().EndsWith("\\") == true?reader.Value.Trim() : reader.Value.Trim() + "\\";
                            }
                            break;

                        case "ServerReportFolder":
                            if (reader.Read())
                            {
                                settingsFile.ServerReportFolder = reader.Value.Trim().EndsWith("\\") == true?reader.Value.Trim() : reader.Value.Trim() + "\\";
                            }
                            break;

                        case "DsnName":
                            if (reader.Read())
                            {
                                settingsFile.DsnName = reader.Value.Trim();
                            }
                            break;

                        case "ServerName":
                            if (reader.Read())
                            {
                                settingsFile.ServerName = reader.Value.Trim();
                            }
                            break;

                        case "DatabaseName":
                            if (reader.Read())
                            {
                                settingsFile.DatabaseName = reader.Value.Trim();
                            }
                            break;

                        case "IntegratedSecurity":
                            if (reader.Read())
                            {
                                settingsFile.IntegratedSecurity = (bool)(reader.Value.Trim() == "1" ? true : false);
                            }
                            break;

                        case "UserID":
                            if (reader.Read())
                            {
                                settingsFile.UserID = reader.Value.Trim();
                            }
                            break;

                        case "Password":
                            if (reader.Read())
                            {
                                settingsFile.Password = reader.Value.Trim();
                            }
                            break;
                        }
                    }
                }
                reader.Close();
                reader = null;
            }
            return(settingsFile);
        }