Пример #1
0
        public Configuration()
        {
            // check if local read-only configuration file exists
            var localPath = ApplicationInfo.CurrentDirectory + sar.Tools.AssemblyInfo.Name + ".xml";
            var standardPath = ApplicationInfo.CommonDataDirectory + sar.Tools.AssemblyInfo.Name + ".xml";

            if (File.Exists(localPath))
            {
                this.path = localPath;
                readOnly = true;
            }
            else
            {
                this.path = standardPath;
                readOnly = false;
            }

            // read the file
            if (File.Exists(this.path))
            {
                var reader = new XML.Reader(this.path);
                this.Deserialize(reader);
                reader.Close();
            }
        }
Пример #2
0
        public Configuration(string path)
        {
            this.path = path;
            this.readOnly = true;

            if (File.Exists(this.path))
            {
                var reader = new XML.Reader(this.path);

                try
                {
                    this.Deserialize(reader);
                }
                catch
                {

                }

                reader.Close();
            }
        }