예제 #1
0
 public static void Dispose(GameActive gameActive)
 {
     _combatProcessList = null;
     _userList          = null;
     _teamList          = null;
     _userTimesList     = null;
 }
예제 #2
0
 public static void Init(GameActive gameActive)
 {
     _combatProcessList = new DictionaryExtend<int, TeamCombatResult>();
     _userList = new DictionaryExtend<string, int>();
     _teamList = new DictionaryExtend<int, MorePlotTeam>();
     _userTimesList = new DictionaryExtend<string, int>();
 }
예제 #3
0
        public ActionResult ExportExcel(string gridUrl,
                                        string referUrl,
                                        string pageNumber,
                                        string pageSize,
                                        string queryParams,
                                        string title,
                                        string sortName,
                                        string sortOrder,
                                        string columns)
        {
            var postData = new Dictionary <string, object>();

            if (!string.IsNullOrEmpty(queryParams))
            {
                postData = queryParams.JsonToDictionary();
            }

            var serverUrl  = string.Format("{0}://{1}", Request.Url.Scheme, Request.Headers["Host"]);
            var requestUrl = gridUrl;

            var dicList = GetDicList(serverUrl, requestUrl, referUrl, postData);

            DataTable dt = null;

            if (!string.IsNullOrEmpty(columns))
            {
                dt = new DataTable();
                var columnDic = columns.JsonToDictionaryList();
                foreach (var dic in columnDic)
                {
                    if (!dt.Columns.Contains(dic.GetValue("title")))
                    {
                        dt.Columns.Add(dic.GetValue("title"));
                    }
                }

                foreach (var dic in dicList)
                {
                    DataRow dr = dt.NewRow();
                    foreach (var item in dic)
                    {
                        var column = columnDic.FirstOrDefault(a => a.GetValue("field") == item.Key);
                        if (column != null)
                        {
                            dr[column.GetValue("title")] = item.Value;
                        }
                    }
                    dt.Rows.Add(dr);
                }
            }
            else
            {
                dt = DictionaryExtend.ConvertDicToTable(dicList.ToList());
            }

            var buffer = NPOIExcelHelper.Export(dt, "").GetBuffer();

            buffer.CheckNotNull("导出excel出现异常");
            return(File(buffer, "application/vnd.ms-excel", Url.Encode(title) + ".xls"));
        }
예제 #4
0
 public static void Init(GameActive gameActive)
 {
     _combatProcessList = new DictionaryExtend <int, TeamCombatResult>();
     _userList          = new DictionaryExtend <string, int>();
     _teamList          = new DictionaryExtend <int, MorePlotTeam>();
     _userTimesList     = new DictionaryExtend <string, int>();
 }
예제 #5
0
 /// <summary>
 /// init
 /// </summary>
 /// <param name="proxyId">local name</param>
 /// <param name="client"></param>
 private RemoteService(string proxyId, RemoteClient client)
 {
     _packagePools   = new DictionaryExtend <int, RemotePackage>();
     _proxySessionId = Guid.NewGuid().ToString("N");
     _proxyId        = string.IsNullOrEmpty(proxyId) ? _proxySessionId : proxyId;
     _client         = client;
     InitClient();
 }
예제 #6
0
        public static void Dispose(GameActive gameActive)
        {
            _combatProcessList = null;
            _userList = null;
            _teamList = null;
            _userTimesList = null;

        }
예제 #7
0
        static EntitySyncManger()
        {
            _syncPools = new DictionaryExtend<string, bool>();
            _sendQueue = new ConcurrentQueue<BaseEntity>();

            _queueProcessThread = new Thread(ProcessQueue);
            _queueProcessThread.Start();
        }
예제 #8
0
        static EntitySyncManger()
        {
            _syncPools = new DictionaryExtend <string, bool>();
            _sendQueue = new ConcurrentQueue <BaseEntity>();

            Interlocked.Exchange(ref _runningQueue, 1);
            _queueProcessThread = new Thread(ProcessQueue);
            _queueProcessThread.Start();
        }
예제 #9
0
        static EntitySyncManger()
        {
            _syncPools = new DictionaryExtend<string, bool>();
            _sendQueue = new ConcurrentQueue<BaseEntity>();

            Interlocked.Exchange(ref _runningQueue, 1);
            _queueProcessThread = new Thread(ProcessQueue);
            _queueProcessThread.Start();
        }
예제 #10
0
        /// <summary>
        /// 获得参战的玩家
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        public BossUser GetCombatUser(string userId)
        {
            DictionaryExtend <string, BossUser> userGeneralList = BossDict.UserGeneralList;

            if (userGeneralList.ContainsKey(userId))
            {
                return(userGeneralList[userId]);
            }

            throw new Exception(string.Format("玩家{0}未加入公会Boss活动id:{1}", userId, _guildID));
        }
예제 #11
0
        /// <summary>
        /// 
        /// </summary>
        public override void Init()
        {
            _modelCodeCache = new DictionaryExtend<string, ScriptFileInfo>();
            _csharpCodeCache = new DictionaryExtend<string, ScriptFileInfo>();
            _modelScriptPath = Path.Combine(SettupInfo.RuntimePath, SettupInfo.ScriptRelativePath, SettupInfo.ModelScriptPath);
            AddWatchPath(_modelScriptPath, FileFilter);

            _csharpScriptPath = Path.Combine(SettupInfo.RuntimePath, SettupInfo.ScriptRelativePath, SettupInfo.CSharpScriptPath);
            AddWatchPath(_csharpScriptPath, FileFilter);

            Load();
            base.Init();
        }
예제 #12
0
        /// <summary>
        ///
        /// </summary>
        public override void Init()
        {
            _modelCodeCache  = new DictionaryExtend <string, ScriptFileInfo>();
            _csharpCodeCache = new DictionaryExtend <string, ScriptFileInfo>();
            _modelScriptPath = Path.Combine(SettupInfo.RuntimePath, SettupInfo.ScriptRelativePath, SettupInfo.ModelScriptPath);
            AddWatchPath(_modelScriptPath, FileFilter);

            _csharpScriptPath = Path.Combine(SettupInfo.RuntimePath, SettupInfo.ScriptRelativePath, SettupInfo.CSharpScriptPath);
            AddWatchPath(_csharpScriptPath, FileFilter);

            Load();
            base.Init();
        }
예제 #13
0
 /// <summary>
 /// 
 /// </summary>
 public override void Init()
 {
     if (!SettupInfo.DisablePython)
     {
         _pythonCodeCache = new DictionaryExtend<string, PythonFileInfo>();
         string refPath = Path.GetDirectoryName(SettupInfo.PythonReferenceLibFile);
         if (!string.IsNullOrEmpty(refPath) && !Directory.Exists(refPath))
         {
             Directory.CreateDirectory(refPath);
         }
         pythonPath = Path.Combine(SettupInfo.RuntimePath, SettupInfo.ScriptRelativePath, SettupInfo.PythonScriptPath);
         AddWatchPath(pythonPath, FileFilter);
         InitPython();
     }
     base.Init();
 }
예제 #14
0
 /// <summary>
 ///
 /// </summary>
 public override void Init()
 {
     if (!SettupInfo.DisablePython)
     {
         _pythonCodeCache = new DictionaryExtend <string, PythonFileInfo>();
         string refPath = Path.GetDirectoryName(SettupInfo.PythonReferenceLibFile);
         if (!string.IsNullOrEmpty(refPath) && !Directory.Exists(refPath))
         {
             Directory.CreateDirectory(refPath);
         }
         pythonPath = Path.Combine(SettupInfo.RuntimePath, SettupInfo.ScriptRelativePath, SettupInfo.PythonScriptPath);
         AddWatchPath(pythonPath, FileFilter);
         InitPython();
     }
     base.Init();
 }
예제 #15
0
        public JsonResult ExportExcel()
        {
            string code = QueryString("UICode");

            code.CheckNotNullOrEmpty("UICode");
            var listConfig = UnitOfWork.GetSingle <ListConfig>(a => a.UICode == code);

            listConfig.CheckNotNull("listConfig");
            var colList = listConfig.GetColumnList();//列设置

            #region 数据库数据
            string sql = listConfig.SQL;
            if (!string.IsNullOrEmpty(listConfig.OrderBy))
            {
                if (!listConfig.OrderBy.ToLower().Contains("order") && !listConfig.OrderBy.ToLower().Contains("by"))
                {
                    sql += (" order by " + listConfig.OrderBy);
                }
                else
                {
                    sql += (" " + listConfig.OrderBy);
                }
            }
            var res = UnitOfWork.DynamicListFromSql(listConfig.DBName, sql);
            #endregion
            //fieldName替换为标题
            var dt = DictionaryExtend.ConvertDicToTable(res.ToList());
            foreach (DataColumn dataCol in dt.Columns)
            {
                var colItem = colList.FirstOrDefault(a => a.GetValue("field") == dataCol.ColumnName);
                if (colItem != null)
                {
                    dataCol.ColumnName = colItem.GetValue("title");
                }
            }
            NPOIExcelHelper.ExportByWeb(dt, listConfig.Name, listConfig.Name);
            return(Json(""));
        }
예제 #16
0
 static ProfileManager()
 {
     _summary = new ProfileSummary();
     _entityObjectCollection = new DictionaryExtend <string, EntityProfileCollection>();
     _sqlCollection          = new DictionaryExtend <string, SqlProfileCollection>();
 }
예제 #17
0
 /// <summary>
 ///
 /// </summary>
 public static void Init()
 {
     SchemaSet = new DictionaryExtend <string, SchemaTable>();
     StartCheckTableTimer();
 }
예제 #18
0
        static ScriptEngines()
        {
            //init object.
            _pythonOptions   = new Dictionary <string, object>();
            _watcherDict     = new DictionaryExtend <string, FileWatcherInfo>();
            _scriptCodeCache = new DictionaryExtend <string, ScriptFileInfo>();
            _changedFiles    = new HashSet <string>();

            //init runtime path.
            _runtimePath    = MathUtils.RuntimePath;
            _runtimeBinPath = MathUtils.RuntimeBinPath;
            if (string.IsNullOrEmpty(_runtimeBinPath))
            {
                _runtimeBinPath = _runtimePath;
            }
            _relativeDirName   = ConfigUtils.GetSetting("ScriptRelativePath", "");
            _disablePython     = ConfigUtils.GetSetting("Python_Disable", false);
            _scriptIsDebug     = ConfigUtils.GetSetting("Script_IsDebug", false);
            SetPythonDebug     = ConfigUtils.GetSetting("Python_IsDebug", _scriptIsDebug);
            CSharpDirName      = ConfigUtils.GetSetting("CSharpRootPath", "Script");
            ScriptMainClass    = ConfigUtils.GetSetting("ScriptMainClass", Path.Combine(CSharpDirName, "MainClass.cs"));
            ScriptMainTypeName = ConfigUtils.GetSetting("ScriptMainTypeName", "");

            //init script dir.
            var directorys = new[]
            {
                string.Format("{0};{1}", ModelDirName, false),
                string.Format("{0};{1};{2}", CSharpDirName, false, ModelDirName)
            };

            foreach (string temp in directorys)
            {
                var      arr      = temp.Split(';');
                string   dirName  = arr[0];
                bool     isMemory = arr.Length > 1 ? arr[1].ToBool() : false;
                string[] refArr   = arr.Length > 2 ? arr[2].Split(',') : new string[0];
                _watcherDict[dirName] = new FileWatcherInfo()
                {
                    Path          = Path.Combine(_runtimePath, _relativeDirName, dirName),
                    Filter        = "*.cs",
                    CompileLevel  = dirName == ModelDirName ? 9 : 3,
                    IsInMemory    = isMemory,
                    ReferenceKeys = refArr
                };
            }
            if (!_disablePython)
            {
                PythonDirName    = ConfigUtils.GetSetting("PythonRootPath", "PyScript");
                ReferenceLibFile = Path.Combine(_runtimePath, _relativeDirName, PythonDirName, ConfigUtils.GetSetting("ReferenceLibFile", "Lib/ReferenceLib.py"));
                string path = Path.GetDirectoryName(ReferenceLibFile);
                if (!string.IsNullOrEmpty(path) && !Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }
                _watcherDict[PythonDirName] = new FileWatcherInfo()
                {
                    IsPython     = true,
                    CompileLevel = 0,
                    Path         = Path.Combine(_runtimePath, _relativeDirName, PythonDirName),
                    Filter       = "*.py"
                };
            }

            //init Assemblies
            _referencedAssemblies = new HashSet <string>(new[]
            {
                Path.Combine(_runtimeBinPath, "NLog.dll"),
                Path.Combine(_runtimeBinPath, "Newtonsoft.Json.dll"),
                Path.Combine(_runtimeBinPath, "protobuf-net.dll"),
                Path.Combine(_runtimeBinPath, "ServiceStack.Redis.dll"),
                Path.Combine(_runtimeBinPath, "ZyGames.Framework.Common.dll"),
                Path.Combine(_runtimeBinPath, "ZyGames.Framework.dll")
            });
        }
예제 #19
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="settupInfo"></param>
 public CSharpRuntimeScope(ScriptSettupInfo settupInfo)
     : base(settupInfo)
 {
     _modelCodeCache  = new DictionaryExtend <string, ScriptFileInfo>();
     _csharpCodeCache = new DictionaryExtend <string, ScriptFileInfo>();
 }
예제 #20
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="settupInfo"></param>
 public CSharpRuntimeScope(ScriptSettupInfo settupInfo)
     : base(settupInfo)
 {
     _modelCodeCache = new DictionaryExtend<string, ScriptFileInfo>();
     _csharpCodeCache = new DictionaryExtend<string, ScriptFileInfo>();
 }
예제 #21
0
 /// <summary>
 ///
 /// </summary>
 public static void Init()
 {
     SchemaSet = new DictionaryExtend <string, SchemaTable>();
 }
예제 #22
0
 /// <summary>
 /// init
 /// </summary>
 /// <param name="proxyId">local name</param>
 /// <param name="client"></param>
 private RemoteService(string proxyId, RemoteClient client)
 {
     _packagePools = new DictionaryExtend<int, RemotePackage>();
     _proxySessionId = Guid.NewGuid().ToString("N");
     _proxyId = string.IsNullOrEmpty(proxyId) ? _proxySessionId : proxyId;
     _client = client;
     InitClient();
 }
 static ProfileManager()
 {
     _summary = new ProfileSummary();
     _entityObjectCollection = new DictionaryExtend<string, EntityProfileCollection>();
     _sqlCollection = new DictionaryExtend<string, SqlProfileCollection>();
 }
예제 #24
0
 public BossDictionary()
 {
     UserGeneralList = new DictionaryExtend <string, BossUser>();
 }
예제 #25
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="settupInfo"></param>
 public PythonRuntimeScope(ScriptSettupInfo settupInfo)
     : base(settupInfo)
 {
     _pythonCodeCache = new DictionaryExtend <string, PythonFileInfo>();
 }
예제 #26
0
 public BossDictionary()
 {
     UserGeneralList = new DictionaryExtend<string, BossUser>();
 }
예제 #27
0
파일: ScriptEngines.cs 프로젝트: qiuhe/Scut
        static ScriptEngines()
        {
            //init object.
            _pythonOptions = new Dictionary<string, object>();
            _watcherDict = new DictionaryExtend<string, FileWatcherInfo>();
            _scriptCodeCache = new DictionaryExtend<string, ScriptFileInfo>();
            _changedFiles = new HashSet<string>();

            //init runtime path.
            _runtimePath = MathUtils.RuntimePath;
            _runtimeBinPath = MathUtils.RuntimeBinPath;
            if (string.IsNullOrEmpty(_runtimeBinPath))
            {
                _runtimeBinPath = _runtimePath;
            }
            _relativeDirName = ConfigUtils.GetSetting("ScriptRelativePath", "");
            _disablePython = ConfigUtils.GetSetting("Python_Disable", false);
            _scriptIsDebug = ConfigUtils.GetSetting("Script_IsDebug", false);
            SetPythonDebug = ConfigUtils.GetSetting("Python_IsDebug", _scriptIsDebug);
            CSharpDirName = ConfigUtils.GetSetting("CSharpRootPath", "Script");
            ScriptMainClass = ConfigUtils.GetSetting("ScriptMainClass", Path.Combine(CSharpDirName, "MainClass.cs"));
            ScriptMainTypeName = ConfigUtils.GetSetting("ScriptMainTypeName", "");

            //init script dir.
            var directorys = new[]
            {
                string.Format("{0};{1}", ModelDirName, false),
                string.Format("{0};{1};{2}", CSharpDirName, false, ModelDirName)
            };
            foreach (string temp in directorys)
            {
                var arr = temp.Split(';');
                string dirName = arr[0];
                bool isMemory = arr.Length > 1 ? arr[1].ToBool() : false;
                string[] refArr = arr.Length > 2 ? arr[2].Split(',') : new string[0];
                _watcherDict[dirName] = new FileWatcherInfo()
                {
                    Path = Path.Combine(_runtimePath, _relativeDirName, dirName),
                    Filter = "*.cs",
                    CompileLevel = dirName == ModelDirName ? 9 : 3,
                    IsInMemory = isMemory,
                    ReferenceKeys = refArr
                };
            }
            if (!_disablePython)
            {
                PythonDirName = ConfigUtils.GetSetting("PythonRootPath", "PyScript");
                ReferenceLibFile = Path.Combine(_runtimePath, _relativeDirName, PythonDirName, ConfigUtils.GetSetting("ReferenceLibFile", "Lib/ReferenceLib.py"));
                string path = Path.GetDirectoryName(ReferenceLibFile);
                if (!string.IsNullOrEmpty(path) && !Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }
                _watcherDict[PythonDirName] = new FileWatcherInfo()
                {
                    IsPython = true,
                    CompileLevel = 0,
                    Path = Path.Combine(_runtimePath, _relativeDirName, PythonDirName),
                    Filter = "*.py"
                };
            }

            //init Assemblies
            _referencedAssemblies = new HashSet<string>(new[]
            {
                Path.Combine(_runtimeBinPath, "NLog.dll"),
                Path.Combine(_runtimeBinPath, "Newtonsoft.Json.dll"),
                Path.Combine(_runtimeBinPath, "protobuf-net.dll"),
                Path.Combine(_runtimeBinPath, "ServiceStack.Redis.dll"),
                Path.Combine(_runtimeBinPath, "ZyGames.Framework.Common.dll"),
                Path.Combine(_runtimeBinPath, "ZyGames.Framework.dll")
            });
        }
예제 #28
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="settupInfo"></param>
 public PythonRuntimeScope(ScriptSettupInfo settupInfo)
     : base(settupInfo)
 {
     _pythonCodeCache = new DictionaryExtend<string, PythonFileInfo>();
 }