protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { using (WXDBEntities db = new WXDBEntities()) { if (!string.IsNullOrEmpty(Request["del"]) && WebUtil.IsDigit(Request["del"])) { int tmpid = Convert.ToInt32(Request["del"]); AResource model = //DbSession.Default.From<Article>().Where(s => s.AritcleID.Equals(tmpid)).ToFirstDefault(); db.AResource.Where(s => s.RId == tmpid).FirstOrDefault(); if (model != null) { //model.Attach(); db.AResource.DeleteObject(model); //model. = 2; //model.UpdateTime = DateTime.Now; // int ts = DbSession.Default.Update<Article>(model); db.SaveChanges(); } } } BindRepeater(); } }
protected override void doUnload(AResource resource) { TextResource res = (TextResource)resource; res.text = ""; //System.Threading.Thread.Sleep(rand.Next(1000)); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { using (WXDBEntities db = new WXDBEntities()) { if (!string.IsNullOrEmpty(Request["del"]) && WebUtil.IsDigit(Request["del"])) { int tmpid = Convert.ToInt32(Request["del"]); AResource model = //DbSession.Default.From<Article>().Where(s => s.AritcleID.Equals(tmpid)).ToFirstDefault(); db.AResource.Where(s => s.RId == tmpid).FirstOrDefault(); if (model != null) { //model.Attach(); db.AResource.DeleteObject(model); //model. = 2; //model.UpdateTime = DateTime.Now; // int ts = DbSession.Default.Update<Article>(model); db.SaveChanges(); } } } } BindRepeater(); WebConn.ManageInfoType sex = (WebConn.ManageInfoType)typid; switch (sex) { case WebConn.ManageInfoType.半岛美食: stTitle = WebConn.ManageInfoType.半岛美食.ToString(); break; case WebConn.ManageInfoType.万宁四诊: stTitle = WebConn.ManageInfoType.万宁四诊.ToString(); break; case WebConn.ManageInfoType.其他美食: stTitle = WebConn.ManageInfoType.其他美食.ToString(); break; case WebConn.ManageInfoType.特色小吃: stTitle = WebConn.ManageInfoType.特色小吃.ToString(); break; case WebConn.ManageInfoType.美食餐厅: stTitle = WebConn.ManageInfoType.美食餐厅.ToString(); break; } string reqStrUrl = "BDMSList.aspx?tid=" + typid; //if (Request.UrlReferrer != null) //{ // reqStrUrl = Request.UrlReferrer.ToString(); //} btn_Back.Attributes.Add("onclick", "window.location.href='" + reqStrUrl + "';return false;"); }
/// <summary> /// 加载模型 /// </summary> public void OnLoadModel() { if (m_ModelResource != null) { return; } //同步加载熊的sprite m_ModelResource = ResourceManager.instance.Load(m_ModelUrl, false, 0); m_ModelGO = Instantiate(m_ModelResource.asset, m_ModelRoot, false) as GameObject; m_ModelGO.transform.eulerAngles = new Vector3(0, 180, 0); }
/// <summary> /// 切换道具图标 /// </summary> public void OnChangeIcon() { if (m_Icons.Length == 0) { return; } m_IconIndex = ++m_IconIndex % m_Bears.Length; string iconUrl = m_Icons[m_IconIndex]; //同步加载icon AResource resource = ResourceManager.instance.Load(iconUrl, false, 0); m_RawImage_Icon.texture = resource.asset as Texture; }
public void Initialize(AResource resource) { m_Resource = resource; UpdateValueText(resource.Amount); m_Resource.Attach(this); ResourceData resourceData = resource.ResourceBlueprint; m_Icon.sprite = resourceData.Sprite; m_NameText.text = resourceData.Name; m_DraggableComponent.Initialize(resourceData.Sprite); }
/// <summary> /// 卸载模型 /// </summary> public void OnUnloadModel() { if (m_ModelResource == null) { return; } ResourceManager.instance.Unload(m_ModelResource); m_ModelResource = null; if (m_ModelGO) { Destroy(m_ModelGO); m_ModelGO = null; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { using (WXDBEntities db = new WXDBEntities()) { if (!string.IsNullOrEmpty(Request["del"]) && WebUtil.IsDigit(Request["del"])) { int tmpid = Convert.ToInt32(Request["del"]); AResource model = //DbSession.Default.From<Article>().Where(s => s.AritcleID.Equals(tmpid)).ToFirstDefault(); db.AResource.Where(s => s.RId == tmpid).FirstOrDefault(); if (model != null) { //model.Attach(); db.AResource.DeleteObject(model); //model. = 2; //model.UpdateTime = DateTime.Now; // int ts = DbSession.Default.Update<Article>(model); db.SaveChanges(); } } } hidtype.Value = stypid + ""; BindRepeater(); } int tmpid1 = Convert.ToInt32(hidtype.Value); WebConn.ManageInfoType sex = (WebConn.ManageInfoType)tmpid1; string reqStrUrl = string.Empty; switch (sex) { case WebConn.ManageInfoType.半岛住宿: stTitle = WebConn.ManageInfoType.半岛住宿.ToString(); //reqStrUrl = "BDZSList.aspx";//"BDMSList.aspx?tid=" + hidtype.Value; break; case WebConn.ManageInfoType.富饶特产: stTitle = WebConn.ManageInfoType.富饶特产.ToString(); break; case WebConn.ManageInfoType.滨海风情餐饮购物街: stTitle = WebConn.ManageInfoType.滨海风情餐饮购物街.ToString(); break; } reqStrUrl = "BDZSList.aspx?tid=" + stypid; btn_Back.Attributes.Add("onclick", "window.location.href='" + reqStrUrl + "';return false;"); }
/// <summary> /// 切换熊的sprite /// </summary> public void OnChangeBackground() { if (m_Backgrounds.Length == 0) { return; } m_BackgourndIndex = ++m_BackgourndIndex % m_Backgrounds.Length; string backgroundUrl = m_Backgrounds[m_BackgourndIndex]; //同步加载熊的sprite AResource resource = ResourceManager.instance.Load(backgroundUrl, false, 0); m_RawImage_Background.texture = resource.asset as Texture; }
/// <summary> /// 切换熊的sprite /// </summary> public void OnChangeBear() { if (m_Bears.Length == 0) { return; } m_BearIndex = ++m_BearIndex % m_Bears.Length; string bearUrl = m_Bears[m_BearIndex]; //同步加载熊的sprite AResource resource = ResourceManager.instance.Load(bearUrl, false, 0); m_Image_Bear.sprite = resource.asset as Sprite; }
private IEnumerator Initialize() { AResource uiResource = ResourceManager.instance.Load("Assets/AssetBundle/UI/UIRoot.prefab", true, 0); yield return(uiResource); GameObject uiRoot = Instantiate(uiResource.asset) as GameObject; uiRoot.name = uiResource.asset.name; Transform uiParent = GameObject.Find("Canvas").transform; AResource testResource = ResourceManager.instance.Load("Assets/AssetBundle/UI/TestUI.prefab", true, 0); yield return(testResource); GameObject testUIGO = Instantiate(testResource.asset, uiParent, false) as GameObject; testUIGO.name = testResource.asset.name; }
public static DungeonWar Get(int id) { DungeonWar war = null; if (!dataMap.TryGetValue(id, out war)) { string filepath = "data/xml/dugeonWar/section_" + id.ToString(); war = AResource.LoadXML <DungeonWar>(filepath); if (war != null) { dataMap.Add(id, war); } else { ALog.logError(filepath + " doesnot exist!"); } } return(war); }
public AResource Acquire() { while (Interlocked.CompareExchange(ref pendingSlot, 1, 0) != 0) { ; } try { switch (active.state) { case ResourceState.Ready: active.resource.Acquire(); AResource result = active.resource; Interlocked.Decrement(ref pendingSlot); return(result); case ResourceState.Empty: Interlocked.Decrement(ref pendingSlot); Load(); return(resourceLoader.Default.Acquire()); case ResourceState.Loading: Interlocked.Decrement(ref pendingSlot); return(resourceLoader.Default.Acquire()); case ResourceState.Unloading: default: throw new NotSupportedException("Tried to acquire resource that is unloading."); } } catch (Exception e) { Interlocked.Decrement(ref pendingSlot); throw e; } }
public Demand(AResource resource, int value) { m_Resource = resource; m_DemandValue = value; }
protected override void doUnload(AResource resource) { ((TextureResource)resource).texture.Dispose(); }
/** * Produces a new zone from an input XML file. */ public static DNSZone Unserialize(XmlDocument config) { DNSRecord start_of_authority = null; var records = new List <DNSRecord>(); var relays = new List <EndPoint>(); if (config.DocumentElement.Name != "zone") { throw new InvalidDataException("Root element must be called zone"); } foreach (var entry in config.DocumentElement.ChildNodes.OfType <XmlNode>()) { if (entry.NodeType != XmlNodeType.Element) { logger.Trace("Ignoring node of type {0}", entry.NodeType); continue; } bool is_record = entry.Name == "A" || entry.Name == "NS" || entry.Name == "CNAME" || entry.Name == "MX" || entry.Name == "SOA" || entry.Name == "PTR" || entry.Name == "AAAA"; if (is_record) { if (entry.Attributes["name"] == null || entry.Attributes["class"] == null || entry.Attributes["ttl"] == null) { throw new InvalidDataException("Resource records must have 'name', 'class' and 'ttl' attributes"); } var record_name = new Domain(entry.Attributes["name"].Value); AddressClass record_class; switch (entry.Attributes["class"].Value) { case "IN": record_class = AddressClass.INTERNET; break; default: throw new InvalidDataException("Only address class 'IN' is supported"); } UInt32 record_ttl = 0; try { record_ttl = UInt32.Parse(entry.Attributes["ttl"].Value); } catch (Exception err) { if (err is OverflowException || err is FormatException) { throw new InvalidDataException(entry.Attributes["ttl"].Value + " is not a valid TTL"); } else { throw; } } IDNSResource resource = null; switch (entry.Name) { case "A": if (entry.Attributes["address"] == null) { throw new InvalidDataException("A record must have address"); } IPv4Address address; try { address = IPv4Address.Parse(entry.Attributes["address"].Value); } catch (FormatException) { throw new InvalidDataException(entry.Attributes["address"].Value + " is not a valid IPv4 address"); } resource = new AResource(address); logger.Trace("A record: address={0}", ((AResource)resource).Address); break; case "NS": if (entry.Attributes["nameserver"] == null) { throw new InvalidDataException("NS record must have a nameserver"); } resource = new NSResource(new Domain(entry.Attributes["nameserver"].Value)); logger.Trace("NS record: nameserver={0}", ((NSResource)resource).Nameserver); break; case "CNAME": if (entry.Attributes["alias"] == null) { throw new InvalidDataException("CNAME record must have an alias"); } resource = new CNAMEResource(new Domain(entry.Attributes["alias"].Value)); logger.Trace("CNAME record: alias={0}", ((CNAMEResource)resource).Alias); break; case "MX": if (entry.Attributes["priority"] == null || entry.Attributes["mailserver"] == null) { throw new InvalidDataException("MX record must have priority and mailserver"); } var mailserver = new Domain(entry.Attributes["mailserver"].Value); UInt16 preference = 0; try { preference = UInt16.Parse(entry.Attributes["priority"].Value); } catch (Exception err) { if (err is OverflowException || err is FormatException) { throw new InvalidDataException(entry.Attributes["priority"].Value + " is not a valid priority value"); } else { throw; } } resource = new MXResource(preference, mailserver); logger.Trace("MX record: priority={0} mailserver={1}", ((MXResource)resource).Preference, ((MXResource)resource).Mailserver); break; case "PTR": if (entry.Attributes["pointer"] == null) { throw new InvalidDataException("PTR record must have pointer"); } if (!reverse_zone_v4.IsSubdomain(record_name) && !reverse_zone_v6.IsSubdomain(record_name)) { throw new InvalidDataException("PTR record be in the in-addr.arpa or ip6.arpa zone"); } resource = new PTRResource(new Domain(entry.Attributes["pointer"].Value)); logger.Trace("PTR record: pointer={0}", ((PTRResource)resource).Pointer); break; case "AAAA": if (entry.Attributes["address"] == null) { throw new InvalidDataException("AAAA record must have address"); } IPv6Address v6address; try { v6address = IPv6Address.Parse(entry.Attributes["address"].Value); } catch (FormatException) { throw new InvalidDataException(entry.Attributes["address"].Value + " is not a valid IPv4 address"); } resource = new AAAAResource(v6address); logger.Trace("AAAA record: address={0}", ((AAAAResource)resource).Address); break; case "SOA": if (entry.Attributes["primary-ns"] == null || entry.Attributes["hostmaster"] == null || entry.Attributes["serial"] == null || entry.Attributes["refresh"] == null || entry.Attributes["retry"] == null || entry.Attributes["expire"] == null || entry.Attributes["min-ttl"] == null) { throw new InvalidDataException("SOA record missing one of: primary-ns, hostmaster, serial, refresh, retry, expire and min-ttl"); } var primary_ns = new Domain(entry.Attributes["primary-ns"].Value); var hostmaster = new Domain(entry.Attributes["hostmaster"].Value); UInt32 serial = 0; try { serial = UInt32.Parse(entry.Attributes["serial"].Value); } catch (Exception err) { if (err is OverflowException || err is FormatException) { throw new InvalidDataException(entry.Attributes["serial"].Value + " is not a valid serial number"); } else { throw; } } UInt32 refresh = 0; try { refresh = UInt32.Parse(entry.Attributes["refresh"].Value); } catch (Exception err) { if (err is OverflowException || err is FormatException) { throw new InvalidDataException(entry.Attributes["refresh"].Value + " is not a valid refresh value"); } else { throw; } } UInt32 retry = 0; try { retry = UInt32.Parse(entry.Attributes["retry"].Value); } catch (Exception err) { if (err is OverflowException || err is FormatException) { throw new InvalidDataException(entry.Attributes["retry"].Value + " is not a valid retry value"); } else { throw; } } UInt32 expire = 0; try { expire = UInt32.Parse(entry.Attributes["expire"].Value); } catch (Exception err) { if (err is OverflowException || err is FormatException) { throw new InvalidDataException(entry.Attributes["expire"].Value + " is not a valid expire value"); } else { throw; } } UInt32 minttl = 0; try { minttl = UInt32.Parse(entry.Attributes["min-ttl"].Value); } catch (Exception err) { if (err is OverflowException || err is FormatException) { throw new InvalidDataException(entry.Attributes["min-ttl"].Value + " is not a valid expire value"); } else { throw; } } resource = new SOAResource(primary_ns, hostmaster, serial, refresh, retry, expire, minttl); logger.Trace("SOA record: primary-ns={0} hostmaster={1} serial={2} refresh={3} retry={4} expire={5} min-ttl={6}", ((SOAResource)resource).PrimaryNameServer, ((SOAResource)resource).Hostmaster, ((SOAResource)resource).Serial, ((SOAResource)resource).RefreshSeconds, ((SOAResource)resource).RetrySeconds, ((SOAResource)resource).ExpireSeconds, ((SOAResource)resource).MinimumTTL); break; } var record = new DNSRecord(record_name, record_class, record_ttl, resource); if (record.Resource.Type == ResourceRecordType.START_OF_AUTHORITY) { if (start_of_authority == null) { logger.Trace("Found SOA: {0}", record); start_of_authority = record; } else { throw new InvalidDataException("Cannot have more than one SOA record in zone"); } } else { logger.Trace("Found other record: {0}", record); records.Add(record); } } else if (entry.Name == "relay") { if (entry.Attributes["address"] == null || entry.Attributes["port"] == null) { throw new InvalidDataException("relay record must have address and port"); } IPAddress address; int port; try { address = IPAddress.Parse(entry.Attributes["address"].Value); } catch (FormatException) { throw new InvalidDataException(entry.Attributes["address"].Value + " is not a valid IPv4 address"); } try { port = int.Parse(entry.Attributes["port"].Value); } catch (FormatException) { throw new InvalidDataException(entry.Attributes["port"].Value + " is not a valid port"); } try { relays.Add(new IPEndPoint(address, port)); } catch (ArgumentOutOfRangeException) { throw new InvalidDataException(entry.Attributes["port"].Value + " is not a valid port"); } logger.Trace("Found relay: {0}:{1}", address, port); } else { throw new InvalidDataException(entry.Name + " is not a valid zone entry"); } } if (start_of_authority == null) { throw new InvalidDataException("Zone does not have SOA record"); } var zone = new DNSZone(start_of_authority, relays.ToArray()); foreach (var record in records) { if (record.TimeToLive < ((SOAResource)start_of_authority.Resource).MinimumTTL) { logger.Trace("Correcting TTL: Record {0} has smaller TTL than SOA MinTTL {1}", record, start_of_authority); record.TimeToLive = ((SOAResource)start_of_authority.Resource).MinimumTTL; } zone.Add(record); } return(zone); }
abstract protected void doUnload(AResource resource);
protected override void doUnload(AResource resource) { // do nothing since the animation resource does not consume much memory and will be collected by the gc. }
public GruntStateGathering(AResource ResourceTarget) { resourceTarget = ResourceTarget; }
protected override void doUnload(AResource resource) { ((MeshResource)resource).vertexBuffer.Dispose(); ((MeshResource)resource).indexBuffer.Dispose(); }
/// <summary> /// 操作信息 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btn_click_Click(object sender, ImageClickEventArgs e) { if (string.IsNullOrEmpty(txttitle.Text.Trim())) { jsHint.Back("请输入图片名称信息!"); return; } if (!WebUtil.IsDigit(txtOrders.Text.Trim())) { jsHint.Back("排序号请输入数字!"); return; } using (WXDBEntities db = new WXDBEntities()) { var addobj = new AResource(); if (aid != -1) { addobj = db.AResource.Where(s => s.RId == aid).FirstOrDefault(); if (addobj != null) { string str = WebUtil.UpLoadImage(upfile, "/Files/NewsImg/", Guid.NewGuid().ToString().ToLower(), 640, 300); if (str.Equals("没有选择上传图片") || str.Equals("图片格式不正确") || str.Equals("没有选择图片")) { } else { addobj.Creation = str; } } else { addobj = new AResource(); addobj.AddTime = DateTime.Now; string str = WebUtil.UpLoadImage(upfile, "/Files/NewsImg/", Guid.NewGuid().ToString().ToLower(), 640, 300); if (str.Equals("没有选择上传图片") || str.Equals("图片格式不正确") || str.Equals("没有选择图片")) { jsHint.Back("请选择封面后进行操作!"); return; } else { addobj.Creation = str; } } } addobj.Title = txttitle.Text; addobj.ArticleID = string.IsNullOrEmpty(txtOrders.Text) ? 0 : int.Parse(txtOrders.Text); addobj.Contents = ""; addobj.Description = ""; ///类别 addobj.Extend = typid + ""; addobj.AddTime = DateTime.Now; addobj.UpdateTime = DateTime.Now; addobj.Extend1 = ""; if (string.IsNullOrEmpty(hyp.Text)) { db.AResource.AddObject(addobj); } db.SaveChanges(); jsHint.toUrl("信息" + addobj.Title + "操作成功!", "BannerList.aspx?typid=" + typid); } }
protected override void doUnload(AResource resource) { ((EffectResource)resource).Value.Dispose(); }