public string GetFirstCalendarType(HttpContext context) { BCtrl_CalendarType bll = new BCtrl_CalendarType(); List <CalendarTypeEntity> list = bll.QueryFirstCalendarType(); return(StringUti.ToUnicode(JsonObj <object> .ToJsonString(list))); }
public string GetFestivalList(HttpContext context) { BCtrl_Festival bll = new BCtrl_Festival(); List <FestivalEntity> list = bll.GetFestivalList("", 3); if (list == null) { return(string.Empty); } var groupYear = list.OrderByDescending(o => o.StartTime).GroupBy(o => o.StartTime.ToString("yyyy年")); List <FestivalEntity> resultlist = new List <FestivalEntity>(); foreach (var year in groupYear) { FestivalEntity entity = new FestivalEntity { FestivalName = year.Key, FestivalList = year.Select(o => o).ToList() }; resultlist.Add(entity); } string result = StringUti.ToUnicode(JsonObj <object> .ToJsonString(resultlist)); return(result); }
public string GetProvinceToGroup(HttpContext context) { BCtrl_Zone bll = new BCtrl_Zone(); List <ZoneEntity> list = bll.QueryZoneToGroup(); return(StringUti.ToUnicode(JsonObj <object> .ToJsonString(list))); }
/// <summary> /// ログインボーナスを取得しているかどうかチェックする /// </summary> /// <returns>The login bonus.</returns> private IEnumerator CheckLoginBonus() { WWWForm wwwForm = new WWWForm(); wwwForm.AddField("keyword", "data"); //不正接続防止用キーワード // get_debug_index string url = ApiList.ApiList.BASE_API_URL + ApiList.ApiList.CHECK_GOT_LOGIN_BONUS + "/" + TerminalId; WWW result = new WWW(url, wwwForm); // レスポンスを待つ yield return(result); JsonObj jsonData = Json.Deserialize(result.text) as Dictionary <string, object>; if (!jsonData ["is_today_login"]) { // ログインボーナスWindow開く LoginBonusWindow.Instance.ActivateLoginBonusWindow(); } else { ActivateStartBtn(); } }
/// <summary> /// この端末が登録されているかどうかをチェックするためのAPI接続 /// </summary> /// <returns>The registered terminal identifier.</returns> public IEnumerator CheckRegisteredTerminalId() { //データ送信準備 WWWForm wwwForm = new WWWForm(); wwwForm.AddField("keyword", "data"); //不正接続防止用キーワード // get_debug_index string url = ApiList.ApiList.BASE_API_URL + ApiList.ApiList.CHECK_REGISTER + "/" + TerminalId; WWW result = new WWW(url, wwwForm); // レスポンスを待つ yield return(result); userData = Json.Deserialize(result.text) as Dictionary <string, object>; if (userData ["is_register"]) { SetUserName(); StartCoroutine(CheckLoginBonus()); } else { RegisterWindow.Instance.ActivateResisterWindow(); } }
protected string SendSucessMsg(string msg, int state = 1) { return(JsonObj <JsonMessageBase> .ToJson(new JsonMessageBase() { Status = state, Msg = msg })); }
/// <summary> /// 连接FTP服务器 /// </summary> /// <param name="ftpInfo"></param> /// <returns></returns> public static bool ConnectFtpServer(FtpConfigEntity ftpInfo) { try { using (FTPConnection ftpConn = new FTPConnection { ServerAddress = ftpInfo.ServerAddress, //ServerDirectory = ftpInfo.ServerDirectory, UserName = ftpInfo.UserName, Password = ftpInfo.UserPassword, CommandEncoding = Encoding.GetEncoding("GBK") }) { ftpConn.Connect(); if (!ftpConn.DirectoryExists(ftpInfo.ServerDirectory)) { throw new Exception($"FTP服务器连接成功,但FTP服务器不存在目录名[{ftpInfo.ServerDirectory}]"); } } return(true); } catch (Exception ex) { string errMsg = $"FTP服务器连接失败,FTP信息[{JsonObj<FtpConfigEntity>.ToJson(ftpInfo)}],异常[{ ex.Message}]"; LogUtil.WriteLog(errMsg); throw new Exception(errMsg); } }
public string DoAction(string modulename, string methodname, string data, int httpmethod) { try { if (G.CurrentSession == null) { G.CurrentSession = new UserSessionEntity(); } Dictionary <string, string> dic = new Dictionary <string, string>(); if (httpmethod == 0) { string url = APIUrlBuilder.CreateUrl(modulename, methodname, G.CurrentSession.SessionID, data, out dic); string json = h.Post(url, "data=" + System.Web.HttpUtility.UrlEncode(data, Encoding.UTF8), "", Encoding.UTF8, dic); return(json); } else { string url = APIUrlBuilder.CreateUrlWithGet(modulename, methodname, G.CurrentSession.SessionID, data, out dic); string json = h.Get(url, "", Encoding.UTF8, dic); return(json); } } catch (Exception ex) { LogUtil.WriteLog(ex); return(JsonObj <JsonMessageBase> .ToJson(new JsonMessageBase() { Status = 0, Msg = ex.Message })); } }
/// <summary> /// 重写 /// </summary> protected override void RenderJsonData() { if (ValidQueryCondition()) { this.Visible = false; Response.Clear(); DataTable dt = QueryDataPerPage(); var data = new { cnt = TotalRecords, showstyle = 2, list = dt }; Response.Write(StringUti.ToUnicode(JsonObj <object> .ToJsonString(data))); } else { var data = new { cnt = 0, list = new DataTable() }; Response.Write(StringUti.ToUnicode(JsonObj <object> .ToJsonString(data))); } }
/// <summary> /// 重写 /// </summary> protected override void RenderJsonData() { if (ValidQueryCondition()) { this.Visible = false; Response.Clear(); DataTable dt = GetQueryData(false); var data = new { cnt = TotalRecords, list = dt, fun = base.fun }; Response.Write(StringUti.ToUnicode(JsonObj <object> .ToJsonString(data))); } else { var data = new { cnt = 0, message = "暂无权限", list = new DataTable() }; Response.Write(StringUti.ToUnicode(JsonObj <object> .ToJsonString(data))); } }
/// <summary> /// 重写 /// </summary> protected override void RenderJsonData() { if (ValidQueryCondition()) { this.Visible = false; Response.Clear(); DataTable dt = QueryDataPerPage(); DataTable tableLocation = bll.GetExhibitorLocation(entity.ExhibitionID); List <ExhibitorToCustomerEntity> list = bll.GetExhibitorEntityList(dt, tableLocation); var data = new { cnt = TotalRecords, pindex = this.PageIndex, showstyle = 2, list = list }; Response.Write(StringUti.ToUnicode(JsonObj <object> .ToJsonString(data))); } else { var data = new { cnt = 0, pindex = this.PageIndex, list = new List <ExhibitorToCustomerEntity>() }; Response.Write(StringUti.ToUnicode(JsonObj <object> .ToJsonString(data))); } }
private static string TitleCase(string text, JsonObj part) { if (part.ContainsKey("titleCase") && (bool)part["titleCase"]) { return(ti.ToTitleCase(text.ToLowerInvariant())); } return(text); }
/// <summary> /// 获取微信Token /// </summary> /// <returns></returns> public static string GetJsapi_ticket() { string ACCESS_TOKEN = IsExistAccess_Token(); string Jsapi_str = HttpGet("https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=" + ACCESS_TOKEN + "&type=jsapi"); Jsapi_ticket obj = JsonObj <Jsapi_ticket> .FromJson(Jsapi_str); return(obj.ticket); }
public Gender(JsonObj source, string species) { this.Name = source.Path <string>("/name"); this.Image = Assets.GetImage(source.Path <string>("/image")); this.CharacterImage = Assets.GetImage(source.Path <string>("/characterImage")); this.source = source; this.species = species; }
public string GetEventItemGroup(HttpContext context) { string groupName = context.Request.Form["groupname"]; BCtrl_EventItemGroup bll = new BCtrl_EventItemGroup(); List <EventItemGroupEntity> list = bll.QueryTop20GroupList(groupName); return(StringUti.ToUnicode(JsonObj <object> .ToJsonString(list))); }
public static void Load(JsonObj source) { GlobalOffset = source.Path <double[]>("/globalOffset"); HeadRunOffset = source.Path <double[]>("/headRunOffset"); HeadSwimOffset = source.Path <double[]>("/headSwimOffset"); RunFallOffset = source.Path <double>("/runFallOffset"); BackArmOffset = source.Path <double[]>("/backArmOffset"); Personalities = ((List <object>)source["personalities"]).Select(p => ((List <object>)p).ToArray()).ToArray(); }
public Frames(JsonObj source) { this.Names = new Dictionary <string, int[]>(); if (source.ContainsKey("frameList")) { var frameList = (JsonObj)source["frameList"]; foreach (var frame in frameList) { var rect = ((List <object>)frame.Value).Select(f => (int)((double)f)).ToArray(); this.Names.Add((string)frame.Key, new[] { rect[0], rect[1], rect[2] - rect[0], rect[3] - rect[1] }); } } else if (source.ContainsKey("frameGrid")) { var frameGrid = (JsonObj)source["frameGrid"]; var size = ((List <object>)frameGrid["size"]).Select(f => (int)((double)f)).ToArray(); this.Size = size; var dimensions = ((List <object>)frameGrid["dimensions"]).Select(f => (int)((double)f)).ToArray(); if (frameGrid.ContainsKey("names")) { var rowIndex = 0; foreach (var row in ((List <object>)frameGrid["names"]).Cast <List <object> >()) { var colIndex = 0; foreach (var frame in row) { if (frame is string) { Names.Add((string)frame, new[] { colIndex *size[0], rowIndex *size[1], size[0], size[1] }); } colIndex++; } rowIndex++; } } else { var i = 0; for (var rowIndex = 0; rowIndex < dimensions[1]; rowIndex++) { for (var colIndex = 0; colIndex < dimensions[0]; colIndex++, i++) { Names.Add(i.ToString(), new[] { colIndex *size[0], rowIndex *size[1], size[0], size[1] }); } } } } if (source.ContainsKey("aliases")) { var aliases = (JsonObj)source["aliases"]; foreach (var alias in aliases) { Names.Add((string)alias.Key, Names[(string)alias.Value]); } } }
public static void WriteIpsToFile(List <RangeObj> obj) { JsonObj toAddObj = new JsonObj { IpRange = obj }; var jsonString = JsonConvert.SerializeObject(toAddObj); File.WriteAllText(ConfigPath, jsonString); }
public FestivalModule() : base("/Festival") { Get["/Handshake"] = _ => { try { var data = FecthQueryData(); DateTime dt = data.date; string hash = data.hash; string hash2 = fesobj.QueryAllFestivalsHash(dt); if (hash == hash2) { return(JsonObj <JsonMessageBase> .ToJson(new JsonMessageBase() { Status = 1, Msg = "数据一致", Tag = "1" })); } else { return(JsonObj <JsonMessageBase> .ToJson(new JsonMessageBase() { Status = 1, Msg = "数据不一致", Tag = "0" })); } } catch (Exception ex) { return(JsonObj <JsonMessageBase> .ToJson(new JsonMessageBase() { Status = 0, Msg = ex.Message })); } }; Get["/GetAllFestival"] = _ => { try { var data = FecthQueryData(); DateTime dt = data.date; List <FestivalEntity> items = fesobj.QueryAllFestivalsTillNow(dt); if (items != null) { return(JsonObj <JsonMessageBase <List <FestivalEntity> > > .ToJson(new JsonMessageBase <List <FestivalEntity> >() { Status = 1, Msg = "OK", Value = items })); } else { return(JsonObj <JsonMessageBase <List <FestivalEntity> > > .ToJson(new JsonMessageBase <List <FestivalEntity> >() { Status = 1, Msg = "数据为空", Value = new List <FestivalEntity>() })); } } catch (Exception ex) { return(JsonObj <JsonMessageBase <List <FestivalEntity> > > .ToJson(new JsonMessageBase <List <FestivalEntity> >() { Status = 0, Msg = ex.Message, Value = new List <FestivalEntity>() })); } }; }
private void Awake() { _instance = this; if (objConfig == null) { objConfig = Resources.Load <TextAsset>("ObjConfig/ObjConfig"); } string str = objConfig.ToString(); jsonObj = JsonUtility.FromJson <JsonObj>(str); }
private void InitPageData() { BCtrl_Couplet bll = new BCtrl_Couplet(); List <CoupletGroupEntity> list = bll.GetCoupletGroupEntityListWithCache(); this.hid_coupletlist.Value = JsonObj <List <CoupletGroupEntity> > .ToJsonString(list); List <FuImageEntity> imgList = bll.GetFuImageEntityListWithCache(); this.hid_fuImagelist.Value = JsonObj <List <FuImageEntity> > .ToJsonString(imgList); }
public Species(JsonObj source) { this.Kind = source.Path <string>("/kind"); this.CharGenTextLabels = source.Path <string[]>("/charGenTextLabels"); this.Name = this.CharGenTextLabels[8]; var genders = source.Path <JsonObj[]>("/genders"); this.Genders = new[] { new Gender(genders[0], this.Kind), new Gender(genders[1], this.Kind) }; this.source = source; }
public BackgroundLayer(JsonObj json, Background parent) { Parent = parent; if (json.ContainsKey("fighters")) { IsPlayerLayer = true; return; } if (!json.ContainsKey("rect")) { throw new MissingFieldException("Background layer must have a rect."); } Rect = json.Path <Rectangle>("/rect"); Origin = json.Path <Vector2>("/origin", Vector2.Zero); Parallax = json.Path <Vector2>("/parallax", Vector2.One); Movement = json.Path <Vector2>("/movement", Vector2.Zero); if (json.ContainsKey("floor")) { Floor = (bool)json["floor"]; FloorVals = json.Path <int[]>("/floorVals", new[] { 128, 182 }); } Frames = new int[1] { 0 }; if (json.ContainsKey("frames")) { if (json["frames"] is List <object> ) { Frames = json.Path <int[]>("/frames"); } else { var i = json.Path <int>("/frames"); Frames = new int[i]; for (var j = 0; j < i; j++) { Frames[j] = j; } } } FrameRate = json.Path <int>("/rate", 100); frameTimeLeft = FrameRate; BlendMode = json.Path <string>("/blend", "none"); }
private void button4_Click(object sender, EventArgs e) { FeedbackEntity fb = new FeedbackEntity(); fb.Content = "test"; fb.ContactMethod = ""; textBox6.Text = JsonObj <FeedbackEntity> .ToJson(fb).ToLower(); return; //textBox6.Text = SendCode(""); //return; List <EventItemEntity> items = new List <EventItemEntity>(); items.Add(new EventItemEntity() { CalendarTypeID = 1, Content = "test", CreateTime = DateTime.Now, EventItemGUID = Guid.NewGuid(), EventItemState = 1, //EventTypeID = 1, Remark = "remark", RepeatTypeID = 0, StartTime = new DateTime(2015, 7, 9), Title = "test title", UserID = 1, Locate = "20,345" , Tags = new List <string>() { "tag1", "tag2" } , Reminder = new ReminderEntity() { ReminderPreTime = 1, ReminderGUID = Guid.NewGuid() } , Pics = new List <int>() { 234, 12, 24 } }); CalendarTypeEntity cc = new CalendarTypeEntity() { CalendarTypeID = 100, CalendarTypeName = "aaaaaaa" }; Dictionary <CalendarTypeEntity, List <EventItemEntity> > dd = new Dictionary <CalendarTypeEntity, List <EventItemEntity> >(); dd.Add(cc, items); textBox6.Text = JsonObj <Dictionary <CalendarTypeEntity, List <EventItemEntity> > > .ToJson(dd).ToLower(); }
public static string Generate(JsonObj source, string key) { if (rand == null) { rand = new Random(); } var part = source[key]; if (part is List <object> ) { return(Parse((List <object>)part)); } throw new InvalidCastException("Expected a list."); }
public string GetSecondCalendarType(HttpContext context) { int parentCalendarTypeID = 0; if (int.TryParse(context.Request.Form["pid"], out parentCalendarTypeID) && parentCalendarTypeID > 0) { BCtrl_CalendarType bll = new BCtrl_CalendarType(); List <CalendarTypeEntity> list = bll.QuerySecondCalendarType(parentCalendarTypeID); return(StringUti.ToUnicode(JsonObj <object> .ToJsonString(list))); } else { return(null); } }
public void SwitchTo(object anim) { var newAnim = 0; if (anim == null) { newAnim = 0; } else if (anim is string) { for (var i = 0; i < animations.Count; i++) { if ((string)animations[i]["name"] == (string)anim) { newAnim = i; break; } } } else if (anim is double) { newAnim = (int)(double)anim; } else if (anim is StandardAnims) { newAnim = (int)anim; } else if (anim is int) { newAnim = (int)anim; } if (newAnim == -1) { newAnim = (int)currentAnim; } if (newAnim != (int)currentAnim) { currentAnim = (StandardAnims)newAnim; animation = animations[(int)currentAnim]; SetupFrames(); currentFrame = 0; } totalFrames = frames.Count; if (currentFrame >= totalFrames) { currentFrame = 0; } }
public string GetInfo(HttpContext context) //返回客户信息 { string sid = context.Request.Form["sid"]; int signID = 0; int.TryParse(sid, out signID); IList <SignBookEntity> entity = BCtrl_SignBook.Instance.SignBook_Get(signID); if (entity == null || entity.Count == 0) { return("false"); } string json = JsonObj <SignBookEntity> .ToJson(entity[0]); return(json); }
public string ExhibitorList(HttpContext context) { int exhibitionid = 0; int.TryParse(HttpUtility.UrlDecode(context.Request.QueryString["eid"]), out exhibitionid); BCtrl_Exhibitor bll = new BCtrl_Exhibitor(); List <ExhibitorToCustomerEntity> list = bll.GetExhibitorEntityList(exhibitionid); var data = new { state = "1", list = list }; return(Utils.StringUti.ToUnicode(JsonObj <object> .ToJsonString(data))); }
public Clothing(JsonObj source, string path) { var origPath = path; var myPath = path; if (!myPath.EndsWith("/")) { myPath = myPath.Substring(0, myPath.LastIndexOf('/') + 1); } this.ItemName = source.Path <string>("/itemName"); this.ShortDescription = source.Path <string>("/shortdescription"); this.Category = source.Path <string>("/category", GuessCategory(origPath)); this.source = source; this.path = myPath; }