예제 #1
0
        /// <summary>
        /// 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>
        /// 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.HostAddress);
        }
        /// <summary>
        /// Constructor.
        /// </summary>
        public CommonConfiguration()

        {
            YamlParser parser        = new YamlParser();
            dynamic    configuration = parser.GetConfiguration("common");
            ConfigurationValuesGetter valuesGetter = new ConfigurationValuesGetter(configuration);

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