Ejemplo n.º 1
0
        static pub()
        {
            Default = new pub();
            string configFile = ConfigurationManager.AppSettings["configFile"];

            if (configFile == null)
            {
                configFile = fastCSharp.pub.ApplicationPath + defaultConfigFile;
            }
            else if (configFile.IndexOf(':') == -1)
            {
                configFile = fastCSharp.pub.ApplicationPath + configFile;
            }
            else
            {
                Default.configPath = new FileInfo(configFile).Directory.fullName().toLower();
            }

            if (File.Exists(configFile))
            {
                if (Default.LogPath == null || !directory.Create(Default.LogPath = Default.LogPath.pathSuffix().toLower()))
                {
                    Default.LogPath = fastCSharp.pub.ApplicationPath;
                }
                try
                {
                    Default.configs = new ajax.jsonParser().Parse(File.ReadAllText(configFile));
                    Default.FromJson(Default.getConfig(typeof(pub)));
                }
                catch (Exception error)
                {
                    log.Default.Add(error, null, false);
                }
            }
            else
            {
                log.Default.Add("找不到配置文件 : " + configFile, false, false);
            }

            if (Default.WorkPath == null)
            {
                Default.WorkPath = fastCSharp.pub.ApplicationPath;
            }
            else
            {
                Default.WorkPath = Default.WorkPath.pathSuffix().toLower();
            }
            if (Default.LogPath == null || !directory.Create(Default.LogPath = Default.LogPath.pathSuffix().toLower()))
            {
                Default.LogPath = fastCSharp.pub.ApplicationPath;
            }
            if (Default.CachePath == null || !directory.Create(Default.CachePath = Default.CachePath.pathSuffix().toLower()))
            {
                Default.CachePath = fastCSharp.pub.ApplicationPath;
            }
        }
Ejemplo n.º 2
0
 static unsafe pub()
 {
     configs = dictionary.CreateHashString <subString>();
     new loader().Load(appSetting.ConfigFile);
     Default = new pub();
 }