Exemplo n.º 1
0
 /// <summary>
 /// 得到游戏角色列表,客服主页用
 /// </summary>
 /// <param name="userid"></param>
 /// <returns></returns>
 public static DataSet GetGameRoleCR(string value)
 {
     try
     {
         string.Format("GetGameRoleCR->param:[ {0} ]", value).Logger();
         string[] values   = value.Split('|');
         string   url      = GetWebServUrl("1000", values[0]);
         string   whereStr = values[1];
         if (url.Trim().Length == 0)
         {
             string.Format("GetGameRoleCR->query url is null").Logger();
             return(null);
         }
         else
         {
             webserv.Url         = url;
             webserv.Credentials = System.Net.CredentialCache.DefaultCredentials;
         }
         string.Format("will call {0}/GetGameRoleCR", url).Logger();
         byte[]  bytes = webserv.GetGameRoleCR(whereStr);
         DataSet ds    = DataSerialize.GetDatasetFromByte(bytes);
         DataSetRowTotalLog(ds, typeof(WebServiceLib).Name + ".GetGameRoleCR");
         return(ds);
     }
     catch (System.Exception ex)
     {
         //日志记录
         ShareData.Log.Error("得到WEBSERVICE游戏角色列表错误\r\n" + ex.Message, ex);
         return(null);
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// 得到游戏角色列表,客服主页用
        /// </summary>
        /// <param name="userid"></param>
        /// <returns></returns>
        public static DataSet GetGameRoleCRALL(string value)
        {
            try
            {
                string  sql = @"SELECT F_Name,F_Value FROM T_GameConfig WITH(NOLOCK) where F_ParentID=1000";
                DataSet dsc = DbHelperSQL.Query(sql);
                DataSetRowsLog(dsc, "GetGameRoleCRALL [step] T_GameConfig");
                if (dsc == null)
                {
                    return(null);
                }

                string  url = "";
                DataSet ds  = null;

                string[] values = value.Split('|');
                foreach (DataRow dr in dsc.Tables[0].Rows)
                {
                    url = dr["F_Value"].ToString();

                    if (url.Trim().Length == 0)
                    {
                        continue;
                    }
                    else
                    {
                        webserv.Url = url;
                        string.Format("{0}/{1}", url, "GetGameRoleCR").Logger();
                        webserv.Credentials = System.Net.CredentialCache.DefaultCredentials;
                        byte[]  bytes  = webserv.GetGameRoleCR(values[1]);
                        DataSet dstemp = DataSerialize.GetDatasetFromByte(bytes);
                        if (dstemp != null)
                        {
                            dstemp.Tables[0].Columns.Add("F_BigZoneName", System.Type.GetType("System.String"));
                            foreach (DataRow drt in dstemp.Tables[0].Rows)
                            {
                                drt["F_BigZoneName"] = dr["F_Name"].ToString();
                            }
                            if (ds == null)
                            {
                                ds = dstemp.Copy();
                            }
                            else
                            {
                                ds.Tables[0].Merge(dstemp.Tables[0]);
                            }
                        }
                    }
                }
                DataSetRowsLog(ds, "GetGameRoleCRALL");
                return(ds);
            }
            catch (System.Exception ex)
            {
                ex.Message.Logger(typeof(GSSServer.WebServiceLib).Name);
                //日志记录
                ShareData.Log.Error("得到WEBSERVICE游戏角色列表错误\r\n" + ex.Message, ex);
                return(null);
            }
        }
        /// <summary>
        /// 从缓存文件中得到DATASET
        /// </summary>
        public static DataSet GetCacheDS()
        {
            string cachePath = System.Windows.Forms.Application.StartupPath;

            ("cache dir" + cachePath).Logger();
            string   fileName = cachePath + "\\GSSData\\GSSCache\\DBCache.dat";
            FileInfo file     = new FileInfo(fileName);

            //if (!file.Exists)
            //{
            //    return null;
            //}
            try
            {
                mtx.WaitOne();
                StreamReader CacheInfo  = new StreamReader(fileName);
                string       cache      = CacheInfo.ReadToEnd();
                byte[]       cachebytes = Convert.FromBase64String(cache);
                DataSet      ds         = DataSerialize.GetDatasetFromByte(cachebytes);
                CacheInfo.Close();
                mtx.ReleaseMutex();
                return(ds);
            }
            catch (System.Exception ex)
            {
                "ClientCache Exception ".ErrorLogger();
                ex.ToString().ErrorLogger();
                //日志记录
                ShareData.Log.Error(ex);
                return(null);
            }
        }
        /// <summary>
        /// 工单列表:从缓存文件中得到DATASET
        /// </summary>
        public static DataSet GetTaskCache(string cachename)
        {
            string   fileName = System.Windows.Forms.Application.StartupPath + "\\GSSData\\GSSCache\\TaskCache" + cachename + ".dat";
            FileInfo file     = new FileInfo(fileName);

            if (!file.Exists)
            {
                return(null);
            }
            try
            {
                mtx.WaitOne();
                StreamReader CacheInfo  = new StreamReader(fileName);
                string       cache      = CacheInfo.ReadToEnd();
                byte[]       cachebytes = Convert.FromBase64String(cache);
                DataSet      ds         = DataSerialize.GetDatasetFromByte(cachebytes);
                CacheInfo.Close();
                mtx.ReleaseMutex();
                return(ds);
            }
            catch (System.Exception ex)
            {
                ex.ToString().ErrorLogger();
                //日志记录
                ShareData.Log.Error(ex);
                return(null);
            }
        }
        private void LoginComplateQueryCacheCallBack(object cache)
        {
            "loading cache end".Logger();
            MsgStruts msgb = cache as MsgStruts;

            try
            {
                if (cache == null)
                {
                    this.DialogResult = DialogResult.No;
                    string tip = "Error,please see above tip. ";
                    tip.Logger();
                    ShareData.Log.Info(tip);
                    MsgBox.Show(LanguageResource.Language.Tip_LoseCacheRefuseComing, LanguageResource.Language.Tip_Tip, MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Error);
                    return;
                }
                System.Data.DataSet ds = DataSerialize.GetDatasetFromByte(msgb.Data);
                if (ds == null || ds.Tables.Count == 0)
                {
                    string temp = "Because the network query Cache error.refuse use login,in fact use login success";
                    temp.Logger();
                    this.DialogResult = DialogResult.No;
                    ShareData.Log.Info(temp);
                    MsgBox.Show(LanguageResource.Language.Tip_LoseCacheRefuseComing, LanguageResource.Language.Tip_Tip, MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Error);
                    return;
                }
                int tables = ds.Tables.Count;
                if (SystemConfig.SyncVersionCache)
                {
                    DataTable version = ds.Tables["T_Version"];
                    object    obj     = version.Rows[0]["F_DB_Version"];
                    ds.Tables["T_Version"].Dispose();
                    string ver = string.Empty;
                    if (obj != null)
                    {
                        ver = obj.ToString();
                    }
                    //转换为文件流
                    System.IO.StreamWriter sr = new System.IO.StreamWriter(System.Windows.Forms.Application.StartupPath + "/GSSDATA/Version.DAT", false);
                    sr.Write(ver);
                    sr.Close();
                }
                (" [table]" + tables).Logger();
                ClientCache.SetCache(msgb.Data);
                ShareData.UserPower = ClientCache.GetUserPower(ShareData.UserID);
                this.DialogResult   = DialogResult.OK;
                "cache convert complae".Logger();
            }
            catch (Exception ex)
            {
                ex.ToString().ErrorLogger();
                MsgBox.Show(ex.Message, LanguageItems.BaseLanguageItem.Tip_Tip, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// 同步游戏中的战区和战线到GSS系统的配置表
        /// </summary>
        /// <returns></returns>
        public static string SynGameZoneLine()
        {
            try
            {
                string  sql = @"SELECT F_ID,F_Name, F_Value, F_ValueGame FROM T_GameConfig WHERE (F_ParentID = 1000)";
                DataSet ds  = DbHelperSQL.Query(sql);

                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    return("true");
                }
                string reback = "";
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    string url = dr["F_Value"].ToString();
                    webserv.Url         = url;
                    webserv.Credentials = System.Net.CredentialCache.DefaultCredentials;
                    DataSet dszl = DataSerialize.GetDatasetFromByte(webserv.GetZoneLine());
                    if (dszl == null || ds.Tables[0].Rows.Count == 0)
                    {
                        continue;
                    }
                    sql = @"delete from T_GameConfig where F_ParentID=" + dr["F_ID"].ToString() + " ";
                    DbHelperSQL.ExecuteSql(sql);
                    int i = 0;
                    foreach (DataRow drz in dszl.Tables[0].Select("F_GParentID=0", "F_GID ASC"))
                    {
                        i++;
                        string id = dr["F_ID"].ToString() + i.ToString().PadLeft(2, '0');
                        sql = @"INSERT INTO T_GameConfig (F_ID,F_ParentID, F_Name, F_Value, F_ValueGame, F_IsUsed, F_Sort) VALUES (" + id + "," + dr["F_ID"] + ", N'" + drz["F_GName"] + "', N'', N'" + drz["F_GID"] + "', 1, 0)";
                        DbHelperSQL.ExecuteSql(sql);


                        sql = @"delete from T_GameConfig where F_ParentID=" + id + " ";
                        DbHelperSQL.ExecuteSql(sql);
                        int ii = 0;
                        foreach (DataRow drl in dszl.Tables[0].Select(" F_GParentID=" + drz["F_GID"] + " and F_GParentID<>0 "))
                        {
                            ii++;
                            string idl = id + ii.ToString().PadLeft(2, '0');
                            sql = @"INSERT INTO T_GameConfig (F_ID,F_ParentID, F_Name, F_Value, F_ValueGame, F_IsUsed, F_Sort) VALUES (" + idl + "," + id + ", N'" + drl["F_GName"] + "', N'', N'" + drl["F_GID"] + "', 1, 0)";
                            DbHelperSQL.ExecuteSql(sql);
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                ShareData.Log.Error(ex);
                return(ex.Message);
            }
            return("true");
        }
        /// <summary>
        /// 得到工单列表(同步)
        /// </summary>
        /// <param name="whereStr"></param>
        public DataSet GetAllTasksSyn(string whereStr)
        {
            MsgStruts msg = new MsgStruts();

            msg.command      = msgCommand.GetAllTasks;
            msg.msgtype      = msgType.SendText;
            msg.msgsendstate = msgSendState.single;
            msg.Data         = _coder.GetEncodingBytes(whereStr);
            MsgStruts msgb = _tcpcli.SendAndBack(msg);
            DataSet   ds   = DataSerialize.GetDatasetFromByte(msgb.Data);

            ClientCache.SetTaskCache(msgb.Data, "TaskList");
            return(ds);
        }
        /// <summary>
        /// 得到客户端缓存(同步)
        /// </summary>
        public bool GetCahceSyn(string userid)
        {
            TcpCli    client = new TcpCli(ShareData.LocalIp, ShareData.LocalPort);
            MsgStruts msg    = new MsgStruts();

            msg.command      = msgCommand.GetCache;
            msg.msgtype      = msgType.SendText;
            msg.msgsendstate = msgSendState.single;
            msg.Data         = _coder.GetEncodingBytes(userid);
            MsgStruts msgb = client.SendAndBack(msg);
            DataSet   ds   = DataSerialize.GetDatasetFromByte(msgb.Data);

            return(ClientCache.SetCache(msgb.Data));
        }
Exemplo n.º 9
0
        /// <summary>
        /// 得到游戏用户列表,客服主页用
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public DataSet GSSTool_GetGameUser(string bigzone, string query)
        {
            string  sql = @"SELECT top 1 F_Name,F_Value FROM T_GameConfig WITH(NOLOCK) where F_ParentID=1000 and F_Name='" + bigzone + "'";
            DataSet dsc = DbHelperSQL.Query(sql);

            if (dsc == null)
            {
                throw (new ApplicationException("没有此大区的配置项:" + bigzone));
            }

            string  url = "";
            DataSet ds  = null;

            url = dsc.Tables[0].Rows[0]["F_Value"].ToString();

            if (url.Trim().Length == 0)
            {
                throw (new ApplicationException("此大区的URL为空:" + bigzone));;
            }
            else
            {
                // ServiceXLJ.ServiceXLJSoapClient webserv = new ServiceXLJ.ServiceXLJSoapClient();

                ServiceXLJ.ServiceXLJSoapClient webserv = new ServiceXLJ.ServiceXLJSoapClient("ServiceXLJSoap", url);
                //webserv.Endpoint.Address=(System.ServiceModel.EndpointAddress)url;

                byte[]  bytes  = webserv.GetGameUsersC(query);
                DataSet dstemp = DataSerialize.GetDatasetFromByte(bytes);
                if (dstemp != null)
                {
                    dstemp.Tables[0].Columns.Add("F_BigZoneName", System.Type.GetType("System.String"));
                    foreach (DataRow drt in dstemp.Tables[0].Rows)
                    {
                        drt["F_BigZoneName"] = dsc.Tables[0].Rows[0]["F_Name"].ToString();
                    }
                    if (ds == null)
                    {
                        ds = dstemp.Copy();
                    }
                    else
                    {
                        ds.Tables[0].Merge(dstemp.Tables[0]);
                    }
                }
            }

            return(ds);
        }
        /// <summary>
        /// 得到工单列表(同步)
        /// </summary>
        /// <param name="whereStr"></param>
        public DataSet GetAllTasksSyn(string param, string whereStr, string OrderFieldName, string OrderType, int PageSize, int PageIndex)
        {
            MsgStruts msg = new MsgStruts();

            msg.command      = msgCommand.GetAllTasks;
            msg.msgtype      = msgType.SendText;
            msg.msgsendstate = msgSendState.single;
            msg.MsgParam.p0  = param;
            msg.MsgParam.p1  = OrderFieldName;
            msg.MsgParam.p2  = OrderType;
            msg.MsgParam.p3  = PageSize.ToString();
            msg.MsgParam.p4  = PageIndex.ToString();
            msg.Data         = _coder.GetEncodingBytes(whereStr);
            MsgStruts msgb = _tcpcli.SendAndBack(msg);
            DataSet   ds   = DataSerialize.GetDatasetFromByte(msgb.Data);

            ClientCache.SetTaskCache(msgb.Data, "TaskList");
            return(ds);
        }
        /// <summary>
        /// 游戏工具:实时查询GS日志
        /// </summary>
        public DataSet QueryLiveGSLog(string zoneid, string querysql)
        {
            MsgStruts msg = new MsgStruts();

            msg.command      = msgCommand.QueryLiveGSLog;
            msg.msgtype      = msgType.SendText;
            msg.msgsendstate = msgSendState.single;
            msg.MsgParam.p0  = zoneid;
            msg.MsgParam.p1  = querysql;
            MsgStruts msgb = _tcpcli.SendAndBack(msg);

            if (msgb == null)
            {
                return(null);
            }
            DataSet ds = DataSerialize.GetDatasetFromByte(msgb.Data);

            ClientCache.SetTaskCache(msgb.Data, "QueryLiveGSLog");
            return(ds);
        }
Exemplo n.º 12
0
 /// <summary>
 /// 得到游戏角色列表,客服主页用
 /// </summary>
 /// <param name="userid"></param>
 /// <returns></returns>
 public static DataSet GetGameRoleC(string value)
 {
     try
     {
         value = value.Trim();
         string.Format("class:{0},function:{1} is runing,param :[ {2} ]", typeof(WebServiceLib).Name, "GetGameRoleC", value).Logger();
         string[] values = value.Split('|');
         string   url    = GetWebServUrl("1000", values[0]);
         string   userid = values[1];
         if (url.Trim().Length == 0)
         {
             "query web url is: null".Logger();
             return(null);
         }
         else
         {
             string.Format("query web url is :", url).Logger();
             webserv.Url         = url;
             webserv.Credentials = System.Net.CredentialCache.DefaultCredentials;
         }
         byte[] bytes = webserv.GetGameRoleC(userid);
         if (bytes == null)
         {
             "call wcf :[GetGameRoleC] ,query result is :null".Logger();
             return(null);
         }
         else
         {
             string.Format("call wcf :[GetGameRoleC] ,query result is[byte]:{0}", bytes.Length).Logger();
         }
         DataSet ds = DataSerialize.GetDatasetFromByte(bytes);
         return(ds);
     }
     catch (System.Exception ex)
     {
         ex.Message.Logger();
         //日志记录
         ShareData.Log.Error("得到WEBSERVICE游戏角色列表错误\r\n" + ex.Message, ex);
         return(null);
     }
 }
Exemplo n.º 13
0
        /// <summary>
        /// 得到游戏用户列表,客服主页用
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public static DataSet GetGameUsersC(string query)
        {
            try
            {
                string sql = @"SELECT F_Name,F_Value,F_ValueGame FROM T_GameConfig WITH(NOLOCK) where F_ParentID=1000 and F_IsUsed=1";
                string.Format(typeof(WebServiceLib).Name + "\r\n" + query).Logger();
                DataSet dsc = DbHelperSQL.Query(sql);
                if (dsc == null)
                {
                    "query result:null".Logger();
                    return(null);
                }


                string  url = "";
                DataSet ds  = null;
                "GetGameUsersC->url".Logger();
                foreach (DataRow dr in dsc.Tables[0].Rows)
                {
                    url = dr["F_Value"].ToString();

                    if (url.Trim().Length == 0)
                    {
                        continue;
                    }
                    else
                    {
                        webserv.Url = url;
                        (typeof(WebServiceLib).Name + ":" + url).Logger();
                        webserv.Credentials = System.Net.CredentialCache.DefaultCredentials;
                        string.Format("  webserv.Credentials :{0}", webserv.Credentials.ToString()).Logger();
                        string.Format("will call wcf:[GetGameUsersC] ->").Logger();
                        byte[] bytes = webserv.GetGameUsersC(query);
                        string.Format("end call wcf:[GetGameUsersC] ->").Logger();
                        if (bytes != null)
                        {
                            string.Format("call wcf response byte:{0}", bytes.Length).Logger();
                        }
                        else
                        {
                            string.Format("call wcf response byte:null").Logger();
                            return(null);
                        }
                        DataSet dstemp = DataSerialize.GetDatasetFromByte(bytes);
                        if (dstemp != null)
                        {
                            DataTable table = dstemp.Tables[0];
                            table.Columns.Add("F_BigZoneName", System.Type.GetType("System.String"));
                            table.Columns.Add("F_ValueGame", System.Type.GetType("System.String"));
                            foreach (DataRow drt in dstemp.Tables[0].Rows)
                            {
                                drt["F_BigZoneName"] = dr["F_Name"].ToString();
                                drt["F_ValueGame"]   = dr["F_ValueGame"].ToString();
                            }
                            if (ds == null)
                            {
                                ds = dstemp.Copy();
                            }
                            else
                            {
                                table.Merge(dstemp.Tables[0]);
                            }
                            ("GetGameUsersC Query Rows:" + table.Rows.Count).Logger();
                        }
                        else
                        {
                            ("GetGameUsersC Query Rows: null").Logger();
                        }
                    }
                }
                return(ds);
            }
            catch (System.Exception ex)
            {
                ex.Message.Logger();
                //日志记录
                ShareData.Log.Error("得到WEBSERVICE游戏用户列表错误\r\n" + ex.Message, ex);
                return(null);
            }
        }