public ActionResult Index() { WebInfo info = new WebInfo(); ViewBag.IsFirstPage = true; using (db0 = getDB0()) { info.News = db0.News.Where(x => x.i_Hide == false && x.i_Lang == System.Globalization.CultureInfo.CurrentCulture.Name).OrderByDescending(x => x.sort).Take(3).ToList(); info.Banner = db0.Banner.Where(x => x.i_Hide == false & x.i_Lang == System.Globalization.CultureInfo.CurrentCulture.Name & x.type == (int)BannerType.index).OrderByDescending(x => x.sort).ToList(); foreach (var item in info.Banner) { item.imgsrc = GetImg(item.banner_id, "Banner", "Banner", "Banner");//顯示列表圖 } return View(info); }; }
public WebInfo GetDefault() { var query = from n in _WebInfoRepository.Table select n; var obj = query.FirstOrDefault(); if (obj == null) { obj = new WebInfo(); obj.Id = Common.GenerateId(); Create(obj); } return(obj); }
// #if UNITY_ANDROID // void selectFileListener() // { // if (BGACommon.IS_PC) { // //for testing // resultFromJava("Dreams~Lost Sky~Dreams"); // } // else { // Debug.Log("Opening select file on android..."); // //https://docs.unity3d.com/ScriptReference/AndroidJavaRunnable.html // AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); // AndroidJavaObject activity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity"); // string filePath = Application.persistentDataPath + "/Songs"; // Debug.Log(filePath); // if (!Directory.Exists(filePath)) { // Directory.CreateDirectory(filePath); // } // //path = "file://" + filePath; // activity.Call("CallFromUnity", filePath); // } // } // void resultFromJava(string s) // { // Debug.Log("Got a result from java"); // Debug.Log(s); // if (string.Equals(s, "bgaerror")) { // Debug.Log("err"); // return; //Chances are user did not pick a song so we just silently fail // } // string[] strings = s.Split(new char[] {BGACommon.DELIMITER}); // song = new song_meta_struct(strings[0], strings[1], strings[2]); // songNameText.text = song.title + " by " + song.artist; // path = Application.persistentDataPath + "/Songs/" + s; // //start loading song // state = STATE.AUDIO_CLIP_LOADING; // StartCoroutine(getAudioClipFromPath(path + BGACommon.SONG_FORMAT)); // } // #else // void selectFileListener() // { // } // #endif IEnumerator getAudioClipFromPath(string path, string dataUrl) { //see https://docs.unity3d.com/ScriptReference/Networking.UnityWebRequestMultimedia.GetAudioClip.html Debug.Log(BGACommon.AUDIO_TYPE); Debug.Log(BGACommon.SONG_FORMAT); using (UnityWebRequest www = UnityWebRequestMultimedia.GetAudioClip(path, BGACommon.AUDIO_TYPE)) { yield return(www.Send()); if (www.isNetworkError) { Debug.Log("err"); Debug.Log(www.error); state = STATE.AUDIO_CLIP_ERROR; } else { inputAudioClip = DownloadHandlerAudioClip.GetContent(www); Debug.Log("Loaded"); //state = STATE.AUDIO_CLIP_LOADED; } } if (state == STATE.AUDIO_CLIP_ERROR) { yield break; } using (UnityWebRequest www = UnityWebRequest.Get(dataUrl)) { yield return(www.SendWebRequest()); if (www.isNetworkError) { Debug.Log("err"); Debug.Log(www.error); state = STATE.AUDIO_CLIP_ERROR; } else { webInfo = WebInfo.CreateFromJSON(www.downloadHandler.text); state = STATE.AUDIO_CLIP_LOADED; } } }
/// <summary>返回用户验证密钥</summary> /// <param name="sid">sid</param> /// <param name="uid">用户id</param> /// <param name="name">用户名</param> /// <param name="pwd">密码</param> /// <returns>返回用户验证密钥</returns> public static string GetVerKey(string sid, string uid, string name, string pwd) { string mpwd = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(pwd, "SHA1"); if (WebInfo.IsSysManageUser(name, mpwd)) { return(""); } StringBuilder sb = new StringBuilder(); sb.Append(sid); sb.Append("|"); sb.Append(uid); sb.Append("|"); sb.Append(name); sb.Append("|"); sb.Append(pwd); return(TripleDes.DesEn(sb.ToString())); }
/// <summary> /// 添加新对象 /// </summary> /// <param name="model"></param> public static void Add(WebInfo model) { try { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into webinfo("); strSql.Append("[id],[templateID],[name],[domain],[jsqq],[kfqq],[phone],[footer],[code],[logopath],[payurl])"); strSql.Append(" values ("); strSql.Append("@id,@templateID,@name,@domain,@jsqq,@kfqq,@phone,@footer,@code,@logopath,@payurl)"); SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@id", SqlDbType.Int, 4), new SqlParameter("@templateID", SqlDbType.VarChar, 50), new SqlParameter("@name", SqlDbType.VarChar, 50), new SqlParameter("@domain", SqlDbType.VarChar, 50), new SqlParameter("@jsqq", SqlDbType.VarChar, 50), new SqlParameter("@kfqq", SqlDbType.VarChar, 50), new SqlParameter("@phone", SqlDbType.VarChar, 50), new SqlParameter("@footer", SqlDbType.VarChar, 50), new SqlParameter("@code", SqlDbType.VarChar, 50), new SqlParameter("@logopath", SqlDbType.VarChar, 50), new SqlParameter("@payurl", SqlDbType.VarChar, 50) }; parameters[0].Value = model.ID; parameters[1].Value = model.TemplateId; parameters[2].Value = model.Name; parameters[3].Value = model.Domain; parameters[4].Value = model.Jsqq; parameters[5].Value = model.Kfqq; parameters[6].Value = model.Phone; parameters[7].Value = model.Footer; parameters[8].Value = model.Code; parameters[9].Value = model.LogoPath; parameters[9].Value = model.PayUrl; DataBase.ExecuteNonQuery(CommandType.Text, strSql.ToString(), parameters); } catch (Exception ex) { ExceptionHandler.HandleException(ex); } }
private bool CheckOrder(string order, out List <OrderSystemDetail> orderDetails) { bool result = false; orderDetails = null; try { //获取订单数据 Dictionary <string, string> orderParam = new Dictionary <string, string>(); orderParam.Add(ORDER_CODE_PARAM, order); string strOrderInfo = WebInfo.PostPageInfo(ORDER_URL, orderParam); //订单解码 DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(List <OrderSystemDetail>)); MemoryStream stream = new MemoryStream(System.Text.Encoding.UTF8.GetBytes(strOrderInfo)); orderDetails = (List <OrderSystemDetail>)serializer.ReadObject(stream); if (orderDetails.Count < 1) { return(result); } //校验车间权限 OrderSystemDetail orderItem = orderDetails[0]; FactoryRoom room = db.FactoryRoom.FirstOrDefault(item => item.RoomNumber == orderItem.ocrcode); if (room == null) { return(result); } int userId = Convert.ToInt32(Session["UserID"]); UsersInRooms tempUserRoom = db.UsersInRooms.FirstOrDefault(item => item.RoomId == room.RoomID && item.UserId == userId); if (tempUserRoom == null) { return(result); } orderItem.roomName = room.RoomName; orderItem.roomId = room.RoomID; result = true; } catch { } return(result); }
/// <summary> /// Adds the specified it. /// </summary> /// <param name="webInformation">web Information.</param> /// <returns>Add Cache</returns> public bool Add(WebInfo webInformation) { using (var data = new themanorContext()) { bool rt; try { data.WebInfo.Add(webInformation); data.SaveChanges(); rt = true; } catch (Exception) { rt = false; } return(rt); } }
/// <summary> /// 获取全部网站信息 /// </summary> /// <returns></returns> public static List <WebInfo> GetAllWebInfo() { List <WebInfo> list = new List <WebInfo>(); SqlDataReader dr = DBHelper.ExecuteReader("Select_WebInfo", CommandType.StoredProcedure); while (dr.Read()) { WebInfo webinfo = new WebInfo() { Web_Date = dr["Web_Date"].ToString(), Web_Index = dr["Web_Index"].ToString(), Web_Name = dr["Web_Name"].ToString(), Web_No = Convert.ToInt32(dr["Web_No"]) }; list.Add(webinfo); } dr.Close(); DBHelper.CloseCon(); return(list); }
public ActionResult Register(RegisterViewModel register) { #region 网站设置 CustomCon custom = (CustomCon)ConfigurationManager.GetSection("customCon"); WebInfo webInfo = custom.WebInfo; ViewBag.WebInfo = webInfo; #endregion if (userManager.HasUserName(register.UserName)) { ModelState.AddModelError("UserName", "用户名已存在"); } if (userManager.HasEmail(register.Email)) { ModelState.AddModelError("Email", "Email已存在"); } if (ModelState.IsValid) { User user = new User(); if (TryUpdateModel(user)) { user.Password = Security.SHA256(register.Password); user.RegTime = DateTime.Now; user.RoleID = 1; Response response = userManager.Add(user); if (response.Code == 1) { user = response.Data; CurrUser.Serialize(user.ID, user.Username); return(RedirectToAction("Index", "Home")); } else { ViewBag.er = "注册失败:" + response.Message; } } } ViewBag.er = "注册失败"; return(View(register)); }
public void StartBGA(ref AudioClip audioClip, ref WebInfo webInfo, bga_settings settings, song_meta_struct song, string songFilePath) { this.songFilePath = songFilePath; this.song_meta = song; if (this.state != STATE.READY) { throw new Exception("Cannot start the beat generating algorithim if it is already being run! State: " + this.state); } this.state = STATE.ACTIVE; Debug.Log("Threshold, multiplier:"); Debug.Log(settings.threshold_time); Debug.Log(settings.threshold_multiplier); this.settings = settings; if (settings.rng_seed == 0) { this.settings.rng_seed = generateNewRandomSeed(); Debug.Log(this.settings.rng_seed); } bga_random = new System.Random(settings.rng_seed); song_info = new song_info_struct(audioClip); song_info.samples = new float[song_info.sampleCount * song_info.channels]; song_info.sampleLength = song_info.length / (float)song_info.sampleCount; //GetData returns samples for both the L(eft) and R(ight) channels //audioClip.GetData(song_info.samples, 0); song_info.samples = webInfo.samples; output = new output_struct(); persistentDataPath = Application.persistentDataPath; //We can't use unity specific calls in the bga thread, and we need this variable for later //Create the background thread and run the BGA algorithim //The algorthim will have access to all the public structs Debug.Log("make thread"); //Thread BGAThread = new Thread(new ThreadStart(algorithimWrapper)); //BGAThread.Start(); // crash the ui thread #yolo algorithimWrapper(); }
/// <summary> /// 根据条件查询网站信息 /// </summary> /// <returns></returns> public static WebInfo GetWebInfoByConn(string demandType, string demandContent) { string sql = "Select * from WebInfo where " + demandType + "= @" + demandType; WebInfo webinfo = new WebInfo(); SqlDataReader dr = DBHelper.ExecuteReader(sql, CommandType.Text, new SqlParameter[] { new SqlParameter("@" + demandType, demandContent) }); if (dr.Read()) { webinfo = new WebInfo() { Web_Date = dr["Web_Date"].ToString(), Web_Index = dr["Web_Index"].ToString(), Web_Name = dr["Web_Name"].ToString(), Web_No = Convert.ToInt32(dr["Web_No"]) }; } dr.Close(); DBHelper.CloseCon(); return(webinfo); }
/// <summary> /// 根据域名取得网站的配置值 /// </summary> /// <param name="domain"></param> /// <returns></returns> public static WebInfo GetWebInfoByDomain(string domain) { try { string sqlstr = @"DECLARE @TempID int SELECT @TempID = [id] FROM [webinfo] WHERE [domain]=@domain IF(@TempID IS NULL) SELECT @TempID = 1 SELECT [id] ,[templateID] ,[name] ,[domain] ,[jsqq] ,[kfqq] ,[phone] ,[footer] ,[code] ,[logopath] ,[payurl] ,[apibankname] ,[apibankversion] ,[apicardname] ,[apicardversion] FROM [dbo].[webinfo] WHERE [id] = @TempID "; SqlParameter[] prams = new SqlParameter[] { DataBase.MakeInParam("@domain", SqlDbType.VarChar, 50, domain) }; SqlDataReader dr = DataBase.ExecuteReader(CommandType.Text, sqlstr, prams); WebInfo _webinfo = GetObjectFromDR(dr); return(_webinfo); } catch (Exception ex) { ExceptionHandler.HandleException(ex); return(null); } }
/// <summary> /// /// </summary> /// <param name="domain"></param> /// <returns></returns> public static WebInfo GetCacheWebInfoByDomain(string domain) { string cacheKey = string.Format(WEBINFO_DOMAIN_CACHEKEY, domain); WebInfo _webinfo = new WebInfo(); _webinfo = (WebInfo)viviapi.Cache.WebCache.GetCacheService().RetrieveObject(cacheKey); if (_webinfo == null) { IDictionary <string, object> sqldepparms = new Dictionary <string, object>(); sqldepparms.Add("domain", domain); SqlDependency sqlDep = DataBase.AddSqlDependency(cacheKey, SQL_TABLE, SQL_TABLE_FIELD, "[domain]=@domain", sqldepparms); _webinfo = GetWebInfoByDomain(domain); if (_webinfo == null) { return(null); } viviapi.Cache.WebCache.GetCacheService().AddObject(cacheKey, _webinfo); } return(_webinfo); }
/// <summary> /// Edits the specified it. /// </summary> /// <param name="webInformation">web Information.</param> /// <returns>Edit Cache</returns> public bool Edit(WebInfo webInformation) { using (var data = new themanorContext()) { bool rt; try { var c_gen = data.WebInfo.Where(p => p.GeneralId == webInformation.GeneralId).FirstOrDefault(); c_gen.GeneralName = webInformation.GeneralName; c_gen.GeneralContent = webInformation.GeneralContent; c_gen.Datemodified = webInformation.Datemodified; data.SaveChanges(); rt = true; } catch (Exception) { rt = false; } return(rt); } }
/// <summary> /// 更新对象 /// </summary> /// <param name="_webinfo"></param> /// <returns></returns> public static bool Update(WebInfo _webinfo) { try { SqlParameter[] prams = new SqlParameter[] { DataBase.MakeInParam("@id", SqlDbType.Int, 4, _webinfo.ID) , DataBase.MakeInParam("@templateID", SqlDbType.VarChar, 20, _webinfo.TemplateId) , DataBase.MakeInParam("@name", SqlDbType.VarChar, 100, _webinfo.Name) , DataBase.MakeInParam("@domain", SqlDbType.VarChar, 500, _webinfo.Domain) , DataBase.MakeInParam("@jsqq", SqlDbType.VarChar, 300, _webinfo.Jsqq) , DataBase.MakeInParam("@kfqq", SqlDbType.VarChar, 300, _webinfo.Kfqq) , DataBase.MakeInParam("@phone", SqlDbType.VarChar, 50, _webinfo.Phone) , DataBase.MakeInParam("@footer", SqlDbType.VarChar, 500, _webinfo.Footer) , DataBase.MakeInParam("@code", SqlDbType.VarChar, 500, _webinfo.Code) , DataBase.MakeInParam("@logopath", SqlDbType.VarChar, 500, _webinfo.LogoPath) , DataBase.MakeInParam("@payurl", SqlDbType.VarChar, 500, _webinfo.PayUrl) , DataBase.MakeInParam("@apibankname", SqlDbType.VarChar, 100, _webinfo.apibankname) , DataBase.MakeInParam("@apibankversion", SqlDbType.VarChar, 20, _webinfo.apibankversion) , DataBase.MakeInParam("@apicardname", SqlDbType.VarChar, 100, _webinfo.apicardname) , DataBase.MakeInParam("@apicardversion", SqlDbType.VarChar, 20, _webinfo.apicardversion) }; bool succ = DataBase.ExecuteNonQuery(CommandType.StoredProcedure, "proc_webinfo_Update", prams) > 0; if (succ == true) { ClearCache(HttpContext.Current.Request.Url.Host); } return(succ); } catch (Exception ex) { ExceptionHandler.HandleException(ex); return(false); } }
public Result Login() { string loginUrl = Url.PostGetCookieAndHtml(new NameValueCollection(), "http://m.baidu.com/", Encoding.UTF8, new System.Net.CookieContainer(), new System.Net.CookieCollection(), "") .Html .FindText("输入法[\\s\\S]*?<a href=\"", "\">登录</a>"); NameValueCollection nv = new NameValueCollection(); nv.Add("login_username", this.UserName); nv.Add("login_loginpass", this.PassWord); nv.Add("login_save", "0"); nv.Add("aaa", "登录"); nv.Add("login", "yes"); nv.Add("can_input", "0"); nv.Add("u", ""); nv.Add("tpl", ""); nv.Add("tn", ""); nv.Add("pu", ""); nv.Add("ssid", "0"); nv.Add("from", "0"); nv.Add("bd_page_type", "1"); nv.Add("uid", ""); WebInfo web = Url.PostGetCookieAndHtml(nv, loginUrl, Encoding.UTF8, new System.Net.CookieContainer(), new System.Net.CookieCollection(), "http://m.baidu.com"); Result r = new Result(); if (web.Html.Contains("登录成功")) { r.Success = true; this.userCookie = web; } else { r.Success = false; } this.userCookie = web.Click("<div class=\"ftr\">[\\w\\W]*?<a href=\"(?<key>.*?)\">百度首页</a><br/>", Encoding.UTF8); return r; }
public IEnumerable <object> Get(string key, string VisitPage, string IpAddress, string Address) { try { WebInfo web = work.CreateRepository <WebInfo>().GetFirst(m => m.WebKey == key); if (web != null) { #region 获取访客信息&添加访客信息 //搜索引擎来源 var se = System.Web.HttpContext.Current.Request.UserAgent; //获取浏览器信息 //火狐浏览器 if (se.Contains("Firefox")) { se = "火狐"; } //谷歌浏览器 else if (se.Contains("Chrome")) { se = "谷歌"; } //Safari浏览器(苹果浏览器) else if (se.Contains("Version")) { se = "苹果"; } //Opera浏览器 else if (se.Contains("Opera")) { se = "Opera"; } //LBBROWSER浏览器(猎豹) else if (se.Contains("LBBROWSER")) { se = "猎豹"; } //sougou浏览器(sougou) else if (se.Contains("MetaSr")) { se = "搜狗"; } //Maxthon浏览器(傲游) else if (se.Contains("Maxthon")) { se = "傲游"; } //因特网浏览器 else { se = "未知"; } VisitorInfo vist = new VisitorInfo(); vist.AccessTime = DateTime.Now; vist.VisitPage = VisitPage; vist.IpAddress = IpAddress; vist.VisitSE = se; vist.WebInfo = web; vist.Address = Address; vist.Age = 0; vist.AccessEndTime = DateTime.Now; //判断用户是否访问一个就退出 if (IsPostUrl == string.Empty) { IsPostUrl = VisitPage; } if (IsPostUrl != VisitPage) { vist.PageNumber = 1; } //随机生成标识码(identification code) 32位字符 string IC = Guid.NewGuid().ToString("N"); var bo = work.CreateRepository <VisitorInfo>().GetList(m => m.IC == IC); if (bo.Count() > 0) { IC = Guid.NewGuid().ToString("N"); } vist.IC = IC; //判断用户是否相同用户 List <VisitorInfo> alikeCount = work.CreateRepository <VisitorInfo>().GetList( m => m.IpAddress == vist.IpAddress ).ToList(); //通过ip地址保证访客数计算 if (alikeCount.Count() == 0) { work.CreateRepository <VisitorInfo>().Insert(vist); work.Save(); List <VisitorInfo> list = work.CreateRepository <VisitorInfo>().GetList().ToList(); var model = list.Where(p => p.IC == IC).FirstOrDefault(); int id = 0; id = model.Id; HttpContext.Current.Session["id"] = id; } else { foreach (var item in alikeCount) { TimeSpan span = DateTime.Now - item.AccessEndTime; //判断该ip地址访客访问时间是否超过24小时 int temp = Convert.ToInt32(span.TotalHours); if (temp >= 24 && item.Lock == 0) { item.Lock = 1; work.CreateRepository <VisitorInfo>().Update(item); work.Save(); work.CreateRepository <VisitorInfo>().Insert(vist); work.Save(); List <VisitorInfo> list = work.CreateRepository <VisitorInfo>().GetList().ToList(); var model = list.Where(p => p.IC == IC).FirstOrDefault(); int id = 0; id = model.Id; HttpContext.Current.Session["id"] = id; } } } #endregion #region 获取PV信息&添加PV信息 FlowComputer flow = new FlowComputer(); flow.VisitPage = VisitPage; flow.WebHost = System.Web.HttpContext.Current.Request.Url.Host.ToString(); string str = HttpContext.Current.Request.UrlReferrer.ToString(); //判断是否搜索引擎链接 if (searchkey.IsSearchEnginesGet(str)) { //取得搜索关键字 flow.SearchTerms = searchkey.SearchKey(str); //取得搜索引擎名称 flow.VisitSE = searchkey.EngineName; } else { flow.SearchTerms = "其他"; flow.VisitSE = vist.VisitSE; } flow.CurrentTime = DateTime.Now; flow.WebInfo = web; lock (flow) { work.CreateRepository <FlowComputer>().Insert(flow); work.Save(); } #endregion //web = work.CreateRepository<WebInfo>().GetFirst(m => m.WebKey == key);//获取pv web.WebPv = web.WebPv + 1; web.WebUv = work.CreateRepository <VisitorInfo>().GetCount(m => m.WebInfo.Id == web.Id); int rate = work.CreateRepository <VisitorInfo>().GetCount(m => m.PageNumber == 0); decimal rateResult = Math.Round((decimal)rate / web.WebPv, 4); if (rateResult >= 1) { rateResult = 1; } web.BounceRate = (rateResult * 100).ToString().Length >= 5 ? (rateResult * 100).ToString().Substring(0, 4) + "%" : (rateResult * 100).ToString() + "%"; List <VisitorInfo> webuv = work.CreateRepository <VisitorInfo>().GetList().ToList();//获取uv for (int i = 0; i < webuv.Count(); i++) { for (int j = webuv.Count() - 1; j > i; j--) { if (webuv[i].IpAddress == webuv[j].IpAddress) { webuv.RemoveAt(j); } } } web.IpCount = webuv.Count;//获取ip数 去重 lock (web) { work.CreateRepository <WebInfo>().Update(web); work.Save(); } } else { //var resp = new HttpResponseMessage(HttpStatusCode.NotFound) //{ // Content = new StringContent(string.Format("没有找到Key={0}的密钥", key)), // ReasonPhrase = "object is not found" //}; //throw new HttpResponseException(resp); } } catch (Exception ex) { //var resp = new HttpResponseMessage(HttpStatusCode.NotFound) //{ // Content = new StringContent(string.Format("没有找到Key={0}的密钥", key)), // ReasonPhrase = "object is not found" //}; //throw new HttpResponseException(resp); return(new object[] { "" + ex }); throw ex; } return(new object[] { "持行成功" }); }
public void Put(int id, [FromBody] WebInfo model) { }
/// <summary> /// 删除网站数据 /// </summary> /// <returns></returns> public static int DeleteWebInfo(WebInfo obj) { return(WebInfo_Service.DeleteWebInfo(obj)); }
/// <summary> /// メインフォームロード. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private async void CallBackMainFormLoad(object sender, EventArgs e) { // タイトルをセット. this.Text = "{0} {1}".Fmt(Ssm.Title, SkillSimulatorMhw.Implementator); // スキル選択コンボボックスの初期化. this.UpdateSkillSelectComb(); // 検索条件(武器)の初期化. var wepon = this.Requirements.RequirementDataList.Get(Part.Wepon); var masterWepon = Ssm.Master.MasterWepon.GetRecordList() .OrderByDescending(awp => awp.GetIndex()) .Select(awp => (MasterDataBase)awp) .ToList(); var ctrlWepon = new RequirementControl(wepon, masterWepon) { Location = new Point(6, 16) }; this.grpbSerchRequirements.Controls.Add(ctrlWepon); // 検索条件レア度の初期化. switch (this.Requirements.RequirementRareData.Rank) { case Rank.Non: this.radioRareAll.Checked = true; break; case Rank.Low: this.radioRareLow.Checked = true; break; case Rank.High: this.radioRareHigh.Checked = true; break; } // 検索条件(防具)の初期化. var baseY = 66; for (var i = 0; i < Define.ArmorList.Count; i++) { var part = Define.ArmorList[i]; var y = baseY + (i * 66); var armor = this.Requirements.RequirementDataList.Get(part); var masterArmor = Ssm.Master.MasterArmor.GetMasterDataList(part); var ctrlArmor = new RequirementControl(armor, masterArmor) { Location = new Point(6, y) }; this.grpbRequirementArmor.Controls.Add(ctrlArmor); } // 検索条件(護符)の初期化. var amulet = this.Requirements.RequirementDataList.Get(Part.Amulet); var masterAmulet = Ssm.Master.MasterAmulet.GetMasterDataList(); var ctrlAmulet = new RequirementControl(amulet, masterAmulet) { Location = new Point(6, 510) }; this.grpbSerchRequirements.Controls.Add(ctrlAmulet); // 検索条件(装飾品)の初期化. var accessory = this.Requirements.RequirementDataList.Get(Part.Accessory); var masterAccessory = Ssm.Master.MasterAccessory.GetMasterDataList(); var ctrlAccessory = new RequirementControl(accessory, masterAccessory) { Location = new Point(6, 580) }; this.grpbSerchRequirements.Controls.Add(ctrlAccessory); // 設定内容を反映. this.UpdateMainForm(); // 結果コントロールを生成. this.ResultListControl.Init(); this.ResultListControl.Location = new Point(3, 12); this.grpbSearchResult.Controls.Add(this.ResultListControl); Log.Write("メインフォームの初期化完了"); // 最新バージョンのチェック var result = await Task.Run(() => Ssm.WebInfo.IsLatestVersion()); if (!result.Item1) { // 最新ではない場合メッセージを表示. var dialogResult = MessageBox.Show( "新しいバージョン[{0}]がリリースされています。\nホームページを開きますか?".Fmt(result.Item2), Ssm.Title, MessageBoxButtons.YesNo); if (DialogResult.Yes == dialogResult) { WebInfo.OpenHomePage(); } } }
public void Update(WebInfo u) { entity.Entry(u).State = EntityState.Modified; }
/// <summary> /// メール送信クリック. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void llblMail_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { WebInfo.SendMail(); }
public void HandleLogin(FastTunnelServer server, Socket client, LogInMassage requet) { bool hasTunnel = false; var filters = FastTunnelGlobal.GetFilters(typeof(IFastTunnelAuthenticationFilter)); if (filters.Count() > 0) { foreach (IFastTunnelAuthenticationFilter item in filters) { var result = item.Authentication(server, requet); if (!result) { client.Send(new Message <LogMassage> { MessageType = MessageType.Log, Content = new LogMassage(LogMsgType.Error, "认证失败") }); return; } } } var sb = new StringBuilder($"{Environment.NewLine}=====隧道已建立成功,可通过以下方式访问内网服务====={Environment.NewLine}"); if (requet.Webs != null && requet.Webs.Count() > 0) { hasTunnel = true; foreach (var item in requet.Webs) { var hostName = $"{item.SubDomain}.{server.ServerSettings.WebDomain}".Trim(); var info = new WebInfo { Socket = client, WebConfig = item }; _logger.LogDebug($"new domain '{hostName}'"); server.WebList.AddOrUpdate(hostName, info, (key, oldInfo) => { return(info); }); sb.Append($"{Environment.NewLine} http://{hostName}{(server.ServerSettings.WebHasNginxProxy ? string.Empty : ":" + server.ServerSettings.WebProxyPort)} => {item.LocalIp}:{item.LocalPort}"); if (item.WWW != null) { foreach (var www in item.WWW) { if (!www.EndsWith(server.ServerSettings.WebDomain)) { server.WebList.AddOrUpdate(www, info, (key, oldInfo) => { return(info); }); sb.Append($"{Environment.NewLine} http://{www}{(server.ServerSettings.WebHasNginxProxy ? string.Empty : ":" + server.ServerSettings.WebProxyPort)} => {item.LocalIp}:{item.LocalPort}"); } else { // can`t use WebDomain _logger.LogError($"Invalid WebDomain IN WWW {www}"); } } } } } if (requet.SSH != null && requet.SSH.Count() > 0) { hasTunnel = true; foreach (var item in requet.SSH) { try { if (item.RemotePort.Equals(server.ServerSettings.BindPort)) { _logger.LogError($"RemotePort can not be same with BindPort: {item.RemotePort}"); continue; } if (item.RemotePort.Equals(server.ServerSettings.WebProxyPort)) { _logger.LogError($"RemotePort can not be same with ProxyPort_HTTP: {item.RemotePort}"); continue; } SSHInfo <SSHHandlerArg> old; if (server.SSHList.TryGetValue(item.RemotePort, out old)) { _logger.LogDebug($"Remove Listener {old.Listener.ListenIp}:{old.Listener.ListenPort}"); old.Listener.Stop(); server.SSHList.TryRemove(item.RemotePort, out SSHInfo <SSHHandlerArg> _); } var ls = new PortProxyListener("0.0.0.0", item.RemotePort, _logger); ls.Start(new SSHDispatcher(server, client, item)); // listen success server.SSHList.TryAdd(item.RemotePort, new SSHInfo <SSHHandlerArg> { Listener = ls, Socket = client, SSHConfig = item }); _logger.LogDebug($"SSH proxy success: {item.RemotePort} => {item.LocalIp}:{item.LocalPort}"); sb.Append($"{Environment.NewLine} {server.ServerSettings.WebDomain}:{item.RemotePort} => {item.LocalIp}:{item.LocalPort}"); } catch (Exception ex) { _logger.LogError($"SSH proxy error: {item.RemotePort} => {item.LocalIp}:{item.LocalPort}"); _logger.LogError(ex.Message); client.Send(new Message <LogMassage> { MessageType = MessageType.Log, Content = new LogMassage(LogMsgType.Info, ex.Message) }); continue; } } } if (!hasTunnel) { client.Send(new Message <LogMassage> { MessageType = MessageType.Log, Content = new LogMassage(LogMsgType.Info, TunnelResource.NoTunnel) }); } else { sb.Append($"{Environment.NewLine}{Environment.NewLine}===================================================="); client.Send(new Message <LogMassage> { MessageType = MessageType.Log, Content = new LogMassage(LogMsgType.Info, sb.ToString()) }); } }
/// <summary> /// 获取书籍标题和URL /// </summary> /// <param name="book"></param> /// <returns></returns> public List <ChapterTitleAndUrl> GetChapterTitleAndUrl(string book) { List <ChapterTitleAndUrl> chapters = new List <ChapterTitleAndUrl>(); //1.搜索 NameValueCollection nv = new NameValueCollection(); nv.Add("searchkey", book); nv.Add("searchtype", "articlename"); var SearchResult = Voodoo.Net.Url.PostGetCookieAndHtml(nv, "http://www.wcxiaoshuo.com/modules/article/search.php", Encoding.GetEncoding("gbk")); while (SearchResult.Html.Length == 0) { SearchResult = Voodoo.Net.Url.PostGetCookieAndHtml(nv, "http://www.wcxiaoshuo.com/modules/article/search.php", Encoding.GetEncoding("gbk")); } //2.打开书籍信息页面 string hrml_BookInfo = "";//书籍信息页内容 var match_Url = SearchResult.Html.GetMatchGroup("td class=\"odd\"><a href=\"(?<url>.*?)\">(?<title>.*?)</a></td>"); if (match_Url.Success) { string url = match_Url.Groups["url"].Value.AppendToDomain(SearchResult.url); hrml_BookInfo = Url.GetHtml(url, "gbk"); } else { //直接进入了书籍信息页 hrml_BookInfo = SearchResult.Html; } //3.打开章节列表页 //没有找到这本书 if (!Regex.IsMatch(hrml_BookInfo, "<a href=\"(?<key>[^\"']*?)\" title=\"开始阅读\"><span>开始阅读</span></a>")) { return(new List <ChapterTitleAndUrl>()); } string list_url = hrml_BookInfo.GetMatch("<a href=\"(?<key>[^\"']*?)\" title=\"开始阅读\"><span>开始阅读</span></a>").First().AppendToDomain(SearchResult.url); WebInfo listInfo = Url.PostGetCookieAndHtml(new NameValueCollection(), list_url, Encoding.GetEncoding("gbk")); while (listInfo.Html.Length == 0) { listInfo = Url.PostGetCookieAndHtml(new NameValueCollection(), list_url, Encoding.GetEncoding("gbk")); } //4。获得 var matchresult = listInfo.Html.GetMatchGroup("<li.*?><a.*?href=\"(?<url>.*?)\">(?<title>.+?)</a.*?></li.*?>"); while (matchresult.Success) { chapters.Add(new ChapterTitleAndUrl() { Title = matchresult.Groups["title"].Value, Url = matchresult.Groups["url"].Value.AppendToDomain(listInfo.url) }); matchresult = matchresult.NextMatch(); } return(chapters); }
/// <summary> /// メインフォームロード. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private async void CallBackMainFormLoad(object sender, EventArgs e) { // タイトルをセット. this.Text = "{0} {1}".Fmt(Ssm.Title, SkillSimulatorMhw.Implementator); // スキル選択コンボボックスの初期化. this.UpdateSkillSelectComb(); // 検索条件(武器)の初期化. var masterWepon = Ssm.Master.MasterWepon.GetRecordList() .OrderByDescending(awp => awp.GetIndex()) .Select(awp => (MasterDataBase)awp) .ToList(); var ctrlWepon = new RequirementControl(masterWepon) { Location = new Point(6, 16) }; this.grpbSerchRequirements.Controls.Add(ctrlWepon); this.RequirementControlDic.Add(Part.Wepon, ctrlWepon); // 検索条件(防具)の初期化. var baseY = 40; for (var i = 0; i < Define.ArmorList.Count; i++) { var part = Define.ArmorList[i]; var y = baseY + (i * 66); var masterArmor = Ssm.Master.MasterArmor.GetMasterDataList(part); var ctrlArmor = new RequirementControl(masterArmor) { Location = new Point(6, y) }; this.grpbRequirementArmor.Controls.Add(ctrlArmor); this.RequirementControlDic.Add(part, ctrlArmor); } // 検索条件(護符)の初期化. var masterAmulet = Ssm.Master.MasterAmulet.GetMasterDataList(); var ctrlAmulet = new RequirementControl(masterAmulet) { Location = new Point(6, 466) }; this.grpbSerchRequirements.Controls.Add(ctrlAmulet); this.RequirementControlDic.Add(Part.Amulet, ctrlAmulet); // 検索条件(装飾品)の初期化. var masterAccessory = Ssm.Master.MasterAccessory.GetMasterDataList(); var ctrlAccessory = new RequirementControl(masterAccessory) { Location = new Point(6, 532) }; this.grpbSerchRequirements.Controls.Add(ctrlAccessory); this.RequirementControlDic.Add(Part.Accessory, ctrlAccessory); // 空きスロット必要数変更イベントハンドラをセット. this.numBlankSlotLv3.ValueChange += this.CallBackNumBlankSlotChangeed; this.numBlankSlotLv2.ValueChange += this.CallBackNumBlankSlotChangeed; this.numBlankSlotLv1.ValueChange += this.CallBackNumBlankSlotChangeed; // 結果コントロールを生成. this.ResultListControl.Location = new Point(3, 12); this.grpbSearchResult.Controls.Add(this.ResultListControl); // 初期検索条件のロードと反映 var requirement = Requirement.LoadCharactor(Ssm.Config.DefaultCharactor); this.SetRequirements(requirement); Log.Write("メインフォームの初期化完了"); // 最新バージョンのチェック(非同期) var verInfo = await Task.Run(() => Ssm.WebInfo.IsLatestVersion()); // 上記の非同期処理完了後の処理. if (!verInfo.IsLatest) { // 最新ではない場合メッセージを表示. var dialogResult = MessageBox.Show( "新しいバージョン[{0}]がリリースされています。\nホームページを開きますか?\n\n--- 新しいバージョンのトピック ---\n{1}".Fmt(verInfo.Version, verInfo.Remark), Ssm.Title, MessageBoxButtons.YesNo); if (DialogResult.Yes == dialogResult) { WebInfo.OpenHomePage(); } } }
/// <summary> /// 添加网站数据 /// </summary> /// <returns></returns> public static int InsertWebInfo(WebInfo obj) { return(WebInfo_Service.InsertWebInfo(obj)); }
/// <summary> /// 用户登录,私有 /// </summary> /// <returns></returns> protected Result log() { string url = "http://3g.renren.com/login.do?autoLogin=true"; NameValueCollection nv = new NameValueCollection(); nv.Add("email", this.UserName); nv.Add("login", "登录"); nv.Add("origURL", ""); nv.Add("password", this.PassWord); WebInfo inf = Url.PostGetCookieAndHtml(nv, url, Encoding.UTF8, new System.Net.CookieContainer(), new System.Net.CookieCollection(), "http://3g.renren.com/wlogout.do?htf=734&sid=eLWROt8CIQoOW1YKYP1puu&for5m5&from="); Result r = new Result(); if (inf.Html.Contains("退出")) { r.Success = true; this.userCookie = inf; } else { r.Success = false; } return r; }
//public ActionResult GetReportData(int day) //{ // try // { // var webList = work.CreateRepository<WebInfo>().GetList(m => m.Id == webId).Select(m => new // { // Id = m.Id, // WebPv = m.WebPv, // WebUv = m.WebUv, // BounceRate = m.BounceRate, // IpCount = m.IpCount, // WebTS = m.WebTS, // WebDomain = m.WebDomain, // WebConversion = m.WebConversion, // WebKey = m.WebKey // }).FirstOrDefault(); // //当前日期 // DateTime current = DateTime.Now.AddDays(day); // var today = GetVistiorByDay(current, webList.Id); // //昨天日期 // DateTime preterite = DateTime.Now.AddDays(day); // var yesterday = GetVistiorByDay(preterite, webList.Id); // return Json(new { today, yesterday, siteId = webId.ToString(), users = user.UserName.ToString() }, JsonRequestBehavior.AllowGet); // } // catch (Exception ex) // { // throw ex; // } //} /// <summary> /// 根据指定日期计算统计流量 /// </summary> /// <param name="startTime">设置时间</param> /// <param name="site">网站id</param> /// <returns></returns> public WebInfo GetVistiorByDay(DateTime startTime, int site) { WebInfo web = new WebInfo(); try { List <VisitorInfo> vistio = work.CreateRepository <VisitorInfo>().GetList( m => DbFunctions.DiffDays(m.AccessTime, startTime) == 0 && m.WebInfo.Id == site ).ToList(); //获取pv量,根据条件时间&网站id web.WebPv = work.CreateRepository <FlowComputer>().GetList( m => DbFunctions.DiffDays(m.CurrentTime, startTime) == 0 && m.WebInfo.Id == site ).Count(); //获取uv值,根据条件时间&网站id web.WebUv = work.CreateRepository <VisitorInfo>().GetList( m => DbFunctions.DiffDays(m.AccessTime, startTime) == 0 && m.WebInfo.Id == site ).Count(); //获取ip数 去重 List <VisitorInfo> webuv = work.CreateRepository <VisitorInfo>().GetList( m => DbFunctions.DiffDays(m.AccessTime, startTime) == 0 && m.WebInfo.Id == site ).ToList(); for (int i = 0; i < webuv.Count(); i++) { for (int j = webuv.Count() - 1; j > i; j--) { if (webuv[i].IpAddress == webuv[j].IpAddress) { webuv.RemoveAt(j); } } } web.IpCount = webuv.Count; //计算跳出率,根据条件时间&网站id int rate = work.CreateRepository <VisitorInfo>().GetCount( m => m.PageNumber == 0 && DbFunctions.DiffDays(m.AccessTime, startTime) == 0 && m.WebInfo.Id == site); //int sumPv = work.CreateRepository<WebInfo>().GetList(m => m.UserInfo.Id == site).FirstOrDefault().WebPv; //int sumUv = work.CreateRepository<VisitorInfo>().GetCount( // m => DbFunctions.DiffDays(m.AccessTime, startTime) == 0 && m.WebInfo.Id == site); decimal rateResult = Math.Round((decimal)rate / web.WebPv, 4); if (rateResult >= 1) { rateResult = 1; } web.BounceRate = (rateResult * 100).ToString().Length >= 5 ? (rateResult * 100).ToString().Substring(0, 4) + "%" : (rateResult * 100).ToString() + "%"; //计算转换次数,根据条件时间&网站id web.WebConversion = 0; //计算平均时长,根据条件时间&网站id int sumDuration = work.CreateRepository <VisitorInfo>().GetCount( m => DbFunctions.DiffDays(m.AccessTime, startTime) == 0 && m.WebInfo.Id == site); double duration = work.CreateRepository <VisitorInfo>().GetCount( m => DbFunctions.DiffDays(m.AccessTime, startTime) == 0 && m.WebInfo.Id == site); duration = vistio.Sum(a => a.Duration); int averageTime = (int)Math.Ceiling(Convert.ToDouble(duration / sumDuration)); TimeSpan ts = new TimeSpan(0, 0, averageTime); web.WebTS = ts.ToString(); if (web.WebTS.Contains("-24855.03:14:08")) { web.WebTS = "00:00:00"; } } catch (Exception ex) { web.IpCount = 0; web.WebConversion = 0; web.WebDomain = ""; web.WebPv = 0; web.WebTS = "00:00:00"; web.WebUv = 0; web.BounceRate = "0%"; return(web); throw ex; } return(web); }
/// <summary> /// 修改网站数据 /// </summary> /// <returns></returns> public static int UpdateWebInfo(WebInfo obj) { return(WebInfo_Service.UpdateWebInfo(obj)); }
public WebInfo FindByID(int id = 1) { WebInfo u = entity.WebInfo.Find(id); return(u); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { setPower(); if (!this.IsPostBack) { try { loginip = currentManage.lastLoginIp; logintime = viviLib.TimeControl.FormatConvertor.DateTimeToTimeString(currentManage.lastLoginTime.Value); username = currentManage.username; //paysouid.InnerText = "欢迎使用第三方支付平台"; //未审核商户数量 List <int> list = viviapi.BLL.User.Factory.GetUsers(" status=1"); uncheckeduserCount = list.Count; DataSet ds = viviapi.BLL.Order.OrderIncome.Instance.TodayIncomeStat(-1); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { DataRow row = ds.Tables[0].Rows[0]; int bankcount = 0; int cardcount = 0; if (row["bankcount"] != DBNull.Value) { bankcount = Convert.ToInt32(row["bankcount"].ToString()); } if (row["cardcount"] != DBNull.Value) { cardcount = Convert.ToInt32(row["cardcount"].ToString()); } orderCount = bankcount + cardcount; } WebInfo webInfo = WebInfoFactory.GetWebInfoByDomain(XRequest.GetHost()); if (webInfo != null) { webdomain = webInfo.Domain; paydomain = webInfo.PayUrl; } //DataSet ds = viviapi.BLL.Order.OrderIncome.Instance. //if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) //{ // DataRow row = ds.Tables[0].Rows[0]; // int bankcount = 0; // int cardcount = 0; // if (row["bankcount"] != DBNull.Value) // { // //ordercount.InnerText = row["bankcount"].ToString(); // bankcount = Convert.ToInt32(row["bankcount"]); // } // if (row["bankamt"] != DBNull.Value) // //totalmoney.InnerText = string.Format("{0:f2}", row["bankamt"]); // if (row["cardcount"] != DBNull.Value) // { // //succordercount.InnerText = row["cardcount"].ToString(); // cardcount = Convert.ToInt32(row["cardcount"]); // } // if (row["cardamt"] != DBNull.Value) // //succtotalmoney.InnerText = string.Format("{0:f2}", row["cardamt"]); // Span1.InnerText = (bankcount + cardcount).ToString(); //} } catch { } } }
/// <summary> /// HomePageのLinkクリック. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void llblHomePage_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { WebInfo.OpenHomePage(); }