Beispiel #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ApplicationConfiguration"/> class.
        /// Get license path from the application configuration section of the web.config.
        /// </summary>
        public ApplicationConfiguration()
        {
            YamlParser parser        = new YamlParser();
            dynamic    configuration = parser.GetConfiguration("application");
            ConfigurationValuesGetter valuesGetter = new ConfigurationValuesGetter(configuration);
            string license = valuesGetter.GetStringPropertyValue("licensePath");

            if (string.IsNullOrEmpty(license))
            {
                string[] files = System.IO.Directory.GetFiles(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, this.licensePath), "*.lic");
                this.licensePath = Path.Combine(this.licensePath, files[0]);
            }
            else
            {
                if (!IsFullPath(license))
                {
                    license = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, license);
                    if (!Directory.Exists(Path.GetDirectoryName(license)))
                    {
                        Directory.CreateDirectory(Path.GetDirectoryName(license));
                    }
                }

                this.licensePath = license;
                if (!File.Exists(this.licensePath))
                {
                    Debug.WriteLine("License file path is incorrect, launched in trial mode");
                    this.licensePath = string.Empty;
                }
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ServerConfiguration"/> class.
        /// Get server configuration section of the web.config.
        /// </summary>
        public ServerConfiguration()
        {
            YamlParser parser        = new YamlParser();
            dynamic    configuration = parser.GetConfiguration("server");
            ConfigurationValuesGetter valuesGetter = new ConfigurationValuesGetter(configuration);
            int defaultPort = Convert.ToInt32(this.serverConfiguration["httpPort"]);

            this.HttpPort    = valuesGetter.GetIntegerPropertyValue("connector", defaultPort, "port");
            this.HostAddress = valuesGetter.GetStringPropertyValue("hostAddress", this.serverConfiguration["hostAddress"]);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="CommonConfiguration"/> class.
        /// </summary>
        public CommonConfiguration()
        {
            YamlParser parser        = new YamlParser();
            dynamic    configuration = parser.GetConfiguration("common");
            ConfigurationValuesGetter valuesGetter = new ConfigurationValuesGetter(configuration);

            this.pageSelector     = valuesGetter.GetBooleanPropertyValue("pageSelector", Convert.ToBoolean(this.commonConfiguration["isPageSelector"]));
            this.download         = valuesGetter.GetBooleanPropertyValue("download", Convert.ToBoolean(this.commonConfiguration["isDownload"]));
            this.upload           = valuesGetter.GetBooleanPropertyValue("upload", Convert.ToBoolean(this.commonConfiguration["isUpload"]));
            this.print            = valuesGetter.GetBooleanPropertyValue("print", Convert.ToBoolean(this.commonConfiguration["isPrint"]));
            this.browse           = valuesGetter.GetBooleanPropertyValue("browse", Convert.ToBoolean(this.commonConfiguration["isBrowse"]));
            this.rewrite          = valuesGetter.GetBooleanPropertyValue("rewrite", Convert.ToBoolean(this.commonConfiguration["isRewrite"]));
            this.enableRightClick = valuesGetter.GetBooleanPropertyValue("enableRightClick", Convert.ToBoolean(this.commonConfiguration["enableRightClick"]));
        }