Beispiel #1
0
 public static RedisSetting Load()
 {
     var tempPath = Path.Combine(ConfigPath, _fileName);
     RedisSetting setting = new RedisSetting();
     try
     {
         if (File.Exists(tempPath))
         {
             byte[] data = File.ReadAllBytes(tempPath);
             setting = ProtoBufUtils.Deserialize<RedisSetting>(data);
         }
         else
         {
             Save(setting);
         }
     }
     catch (Exception ex)
     {
         TraceLog.WriteError("RedisSetting load error:{0}", ex);
         if (File.Exists(tempPath))
         {
             File.Delete(tempPath);
         }
     }
     return setting;
 }
Beispiel #2
0
        public RedisForm(RedisSetting setting, Action callback)
        {
            _callback = callback;
            InitializeComponent();

            settingPropertyGrid.SelectedObject = setting;
        }
Beispiel #3
0
 public static void Save(RedisSetting setting)
 {
     if (!Directory.Exists(ConfigPath))
     {
         Directory.CreateDirectory(ConfigPath);
     }
     var tempPath = Path.Combine(ConfigPath, _fileName);
     var buffer = ProtoBufUtils.Serialize(setting);
     using (var sw = File.Open(tempPath, FileMode.OpenOrCreate))
     {
         sw.Write(buffer, 0, buffer.Length);
         sw.Flush();
     }
 }
Beispiel #4
0
 public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
 {
     if (destinationType == typeof(String))
     {
         if (value is RedisSetting)
         {
             RedisSetting so = (RedisSetting)value;
             return("Host:" + so.Host +
                    ",ReadHost:" + so.ReadOnlyHost +
                    ",Db:" + so.Db);
         }
         if (value is ConnectionString)
         {
             ConnectionString so = (ConnectionString)value;
             return("Name:" + so.Name
                    + ",Source:" + so.DataSource
                    + ",Database:" + so.Database);
         }
     }
     return(base.ConvertTo(context, culture, value, destinationType));
 }
Beispiel #5
0
        public GameSetting()
        {
            IsModify  = true;
            Redis     = new RedisSetting();
            PayCenter = new ConnectionString()
            {
                Name = DbPaycenter, Database = "PayDB"
            };
            SnsCenter = new ConnectionString()
            {
                Name = DbSnscenter, Database = "SnsCenter"
            };
            Connections = new List <ConnectionString>();

            GameCode       = DefaultConfig.GameCode;
            GameServerCode = DefaultConfig.ServerCode;
            SocketPort     = DefaultConfig.SocketPort;
            GameName       = DefaultConfig.GameName;
            GameSignKey    = DefaultConfig.GameSignKey;

            HttpHost             = DefaultConfig.HttpHost;
            HttpPort             = DefaultConfig.HttpPort;
            HttpName             = DefaultConfig.HttpName;
            HttpTimeout          = DefaultConfig.HttpTimeout;
            SocketMaxConnections = DefaultConfig.SocketMaxConnections;
            SocketBacklog        = DefaultConfig.SocketBacklog;
            SocketMaxAcceptOps   = DefaultConfig.SocketMaxAcceptOps;
            SocketBufferSize     = DefaultConfig.SocketBufferSize;

            ActionEnableGZip     = DefaultConfig.ActionEnableGZip;
            ActionGZipOutLength  = DefaultConfig.ActionGZipOutLength;
            ActionTypeName       = DefaultConfig.ActionTypeName;
            ActionAssemblyName   = DefaultConfig.ActionAssemblyName;
            ActionScriptTypeName = DefaultConfig.ActionScriptTypeName;
            PythonDisable        = DefaultConfig.PythonDisable;
            ScriptIsDebug        = DefaultConfig.ScriptIsDebug;
            LuaDisable           = DefaultConfig.LuaDisable;

            //Scut lib 6.1.5.6 modify
            ScriptRelativePath       = "Script";
            CSharpRootPath           = "CsScript";
            LuaRootPath              = DefaultConfig.LuaRootPath;
            PythonRootPath           = DefaultConfig.PythonRootPath;
            ScriptMainClass          = DefaultConfig.ScriptMainClass;
            ScriptMainTypeName       = DefaultConfig.ScriptMainTypeName;
            ScriptAsmReferences      = new string[0];
            ScriptSysAsmReferences   = new string[0];
            ModelEntityAssemblyName  = DefaultConfig.ModelEntityAssemblyName;
            ScriptDecodeFuncTypeName = DefaultConfig.ScriptDecodeFuncTypeName;
            RemoteScriptTypeName     = DefaultConfig.RemoteScriptTypeName;

            CacheGlobalPeriod     = DefaultConfig.CacheGlobalPeriod;
            CacheUserPeriod       = DefaultConfig.CacheUserPeriod;
            CacheUpdateDbInterval = DefaultConfig.CacheUpdateDbInterval;
            CacheUpdateInterval   = DefaultConfig.CacheUpdateInterval;
            CacheExpiredInterval  = DefaultConfig.CacheExpiredInterval;
            CacheEnableWritetoDb  = DefaultConfig.CacheEnableWritetoDb;
            DataSyncQueueNum      = DefaultConfig.DataSyncQueueNum;
            SqlWaitSyncQueueNum   = DefaultConfig.SqlWaitSyncQueueNum;
            SqlSyncQueueNum       = DefaultConfig.SqlSyncQueueNum;
            CacheSerializer       = DefaultConfig.CacheSerializer;

            LogTableNameFormat = DefaultConfig.LogTableNameFormat;
            LogPriorBuildMonth = DefaultConfig.LogPriorBuildMonth;

            PublishType          = DefaultConfig.DefPublishType;
            EnableGm             = DefaultConfig.EnableGm;
            SnsAccountPrefixChar = DefaultConfig.SnsAccountPrefixChar;
            LanguageTypeName     = DefaultConfig.LanguageTypeName;
            ProductDesEnKey      = DefaultConfig.ProductDesEnKey;
            ClientDesDeKey       = DefaultConfig.ClientDesDeKey;
        }
Beispiel #6
0
        public GameSetting()
        {
            IsModify = true;
            Redis = new RedisSetting();
            PayCenter = new ConnectionString() { Name = DbPaycenter, Database = "PayDB" };
            SnsCenter = new ConnectionString() { Name = DbSnscenter, Database = "SnsCenter" };
            Connections = new List<ConnectionString>();

            GameCode = DefaultConfig.GameCode;
            GameServerCode = DefaultConfig.ServerCode;
            SocketPort = DefaultConfig.SocketPort;
            GameName = DefaultConfig.GameName;
            GameSignKey = DefaultConfig.GameSignKey;

            HttpHost = DefaultConfig.HttpHost;
            HttpPort = DefaultConfig.HttpPort;
            HttpName = DefaultConfig.HttpName;
            HttpTimeout = DefaultConfig.HttpTimeout;
            SocketMaxConnections = DefaultConfig.SocketMaxConnections;
            SocketBacklog = DefaultConfig.SocketBacklog;
            SocketMaxAcceptOps = DefaultConfig.SocketMaxAcceptOps;
            SocketBufferSize = DefaultConfig.SocketBufferSize;

            ActionEnableGZip = DefaultConfig.ActionEnableGZip;
            ActionGZipOutLength = DefaultConfig.ActionGZipOutLength;
            ActionTypeName = DefaultConfig.ActionTypeName;
            ActionAssemblyName = DefaultConfig.ActionAssemblyName;
            ActionScriptTypeName = DefaultConfig.ActionScriptTypeName;
            PythonDisable = DefaultConfig.PythonDisable;
            ScriptIsDebug = DefaultConfig.ScriptIsDebug;
            LuaDisable = DefaultConfig.LuaDisable;

            //Scut lib 6.1.5.6 modify
            ScriptRelativePath = "Script";
            CSharpRootPath = "CsScript";
            LuaRootPath = DefaultConfig.LuaRootPath;
            PythonRootPath = DefaultConfig.PythonRootPath;
            ScriptMainClass = DefaultConfig.ScriptMainClass;
            ScriptMainTypeName = DefaultConfig.ScriptMainTypeName;
            ScriptAsmReferences = new string[0];
            ScriptSysAsmReferences = new string[0];

            CacheGlobalPeriod = DefaultConfig.CacheGlobalPeriod;
            CacheUserPeriod = DefaultConfig.CacheUserPeriod;
            CacheUpdateDbInterval = DefaultConfig.CacheUpdateDbInterval;
            CacheUpdateInterval = DefaultConfig.CacheUpdateInterval;
            CacheExpiredInterval = DefaultConfig.CacheExpiredInterval;
            CacheEnableWritetoDb = DefaultConfig.CacheEnableWritetoDb;
            DataSyncQueueNum = DefaultConfig.DataSyncQueueNum;
            SqlWaitSyncQueueNum = DefaultConfig.SqlWaitSyncQueueNum;
            SqlSyncQueueNum = DefaultConfig.SqlSyncQueueNum;

            LogTableNameFormat = DefaultConfig.LogTableNameFormat;
            LogPriorBuildMonth = DefaultConfig.LogPriorBuildMonth;

            PublishType = DefaultConfig.DefPublishType;
            EnableGm = DefaultConfig.EnableGm;
            SnsAccountPrefixChar = DefaultConfig.SnsAccountPrefixChar;
            LanguageTypeName = DefaultConfig.LanguageTypeName;
            ProductDesEnKey = DefaultConfig.ProductDesEnKey;
            ClientDesDeKey = DefaultConfig.ClientDesDeKey;
        }