protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int id = 1; try { string teacher = Session["AdminID"].ToString(); id = Convert.ToInt32(Request.QueryString["id"].ToString()); using (var db = new TeachingCenterEntities()) { var cate = from it in db.DevelopCategory select it; dropCategory.DataSource = cate.ToList(); dropCategory.DataTextField = "DevelopCategory_name"; dropCategory.DataBind(); Develop dev = db.Develop.Single(a => a.Develop_id == id); txtTitle.Text = dev.Develop_title; TextBox1.Text = dev.Develop_summary; txtLink.Text = dev.Develop_link; txtAuthor.Text = dev.Develop_author; pushlishTime.Value = dev.Develop_time.ToString(); myEditor11.InnerHtml = Server.HtmlDecode(dev.Develop_content); } } catch { JSHelper.AlertThenRedirect("请先登录!", "Login.aspx"); } } }
protected void rptService_ItemCommand(object source, RepeaterCommandEventArgs e) { //删除专题分类 if (e.CommandName == "Delete") { int id = Convert.ToInt32(e.CommandArgument.ToString()); using (var db = new TeachingCenterEntities()) { Develop service = db.Develop.Single(a => a.Develop_id == id); db.Develop.Remove(service); db.SaveChanges(); //JSHelper.AlertThenRedirect("删除成功!", "RecycleDevelop.aspx"); Server.Transfer("RecycleDevelop.aspx"); } } if (e.CommandName == "Recycle") { int id = Convert.ToInt32(e.CommandArgument.ToString()); using (var db = new TeachingCenterEntities()) { Develop service = db.Develop.Single(a => a.Develop_id == id); service.Develop_deleted = 0; db.SaveChanges(); //JSHelper.AlertThenRedirect("恢复成功!", "RecycleDevelop.aspx"); Server.Transfer("RecycleDevelop.aspx"); } } }
private static Bundle _LoadBundleAsyncFile(string bundle_path, string bundle_name) { Bundle bundle; if (_Bundle_Dic.TryGetValue(bundle_name, out bundle)) { return(bundle); } var bundle_request = AssetBundle.LoadFromFileAsync(bundle_path); if (null == bundle_request) { Develop.LogError("Load FAIL" + bundle_path); return(null); } #if AUTO_UNLOAD if (_destroying_coroutine == null) { _destroying_coroutine = Main.Behaviour.StartCoroutine(_UnloadClosedBundle()); } #endif var real = new Bundle_Real(bundle_request, bundle_name); return(real); }
public static Bundle LoadBundleAsyncWww(string bundle_path, string bundle_name, Hash128 code) { Bundle bundle; if (_Bundle_Dic.TryGetValue(bundle_name, out bundle)) { return(bundle); } var cachedVersion = Caching.IsVersionCached(bundle_path, code); var bundle_www = cachedVersion ? WWW.LoadFromCacheOrDownload(bundle_path, code) : new WWW(bundle_path); #if !AFTER_CHECK var after_cacheAble = Caching.IsVersionCached(bundle_path, code); if (cachedVersion != after_cacheAble) { Develop.LogError(cachedVersion + "Cached:" + bundle_path); } #endif if (!string.IsNullOrEmpty(bundle_www.error)) { Develop.LogError("Load FAIL" + bundle_path + ":" + bundle_www.error); } var real = new Bundle_Real(bundle_www, bundle_name); _Bundle_Dic.Add(bundle_name, real); return(real); }
/// <summary> /// 从资源包里加载资源,资源包和资源名相同 /// </summary> /// <param name="asset_name"></param> /// <returns></returns> public static T LoadAssetFromBundle <T>(string asset_name) where T : UObject { string bundle_name = asset_name.ToLower(); Asset <T> asset; #if UNITY_EDITOR if (!UseBundleInEditor) { var br = new Bundle_Real(bundle_name); asset = br.LoadAsset <T>(asset_name); return(asset.Object); } #endif Bundle bundle; if (!_Bundle_Dic.TryGetValue(bundle_name, out bundle)) { Develop.LogError("Can't find bundle :" + bundle_name); return(null); } asset = bundle.LoadAsset <T>(bundle_name); if (asset == null) { Develop.LogError("Can't find asset :" + bundle_name); return(null); } return(asset.Object); }
/// <summary> /// 同步加载一个资源,暂时不使用 /// </summary> /// <param name="asset_name"></param> /// <returns></returns> public static UObject SyncLoadAsset(string asset_name) { string bundle_path = BundlePath + asset_name.ToLower(); Bundle bundle; if (!_Bundle_Dic.TryGetValue(asset_name, out bundle)) { bundle = LoadBundle(bundle_path); } if (bundle == null) { Develop.LogError("Load Bundle Failed! BundleName:" + asset_name); return(null); } Asset asset = bundle.LoadAsset(asset_name); if (asset == null) { Develop.LogError("Load Asset Failed! AssetName:" + asset_name); return(null); } return(asset.Object); }
public static void ImplementDelegate() { Develop obj = Operation.Add; obj += Operation.Square; obj(5, 5); obj(8, 3); }
//加载Multiple Sprite public Asset <T> LoadAsset <T>([NotNull] string asset_name, int multple_index) where T : UObject { #if UI_RESOURCE GameObject asset = ResourcesEx.Load <GameObject>(texturePath + asset_name); if (asset == null) { Develop.LogError("Load Error!Cant find sprite:" + asset_name); return(null); } SpritePrefab sp = asset.GetComponent <SpritePrefab>(); if (sp == null) { Develop.LogError("Sprite Component Missing:" + asset_name); return(null); } T sprite = (T)sp.GetSprite(asset_name, -1); if (sprite == null) { Develop.LogError("Load Error!Cant find sprite:" + asset_name); return(null); } return(new Asset_Real <T>(this, sprite)); #else #if UNITY_EDITOR if (!UseBundleInEditor) { var data_object = Manifest.LoadAssetDataBase <T>(this.BundleName, asset_name, multple_index); return(new Asset_Real <T>(this, data_object)); } #endif if (this.BundleObject == null) { Develop.LogErrorF("Bundle is not loaded {0}.{1}, Index = {2}", this.BundleName, asset_name, multple_index); return(null); } if (!this.BundleObject.Contains(asset_name)) { Develop.LogErrorF("Asset Multiple Sprite CantFind {0}.{1}, Index = {2}", this.BundleName, asset_name, multple_index); return(null); } var asset_object = this.BundleObject.LoadAssetWithSubAssets <T>(asset_name); if (null == asset_object) { Develop.LogErrorF("Asset Multiple Sprite CantFind {0}.{1}, Index = {2}", this.BundleName, asset_name, multple_index); return(null); } if (asset_object.Length > multple_index) { return(new Asset_Real <T>(this, asset_object[multple_index])); } return(null); #endif }
public static T Load <T>(string szName) where T : Object { if (AsyncLoadCount != 0) { Develop.LogError("AsyncLoad res, can't ResourcesEx.Load" + szName); return(default(T)); } return(Resources.Load <T>(szName)); }
public static Object[] LoadAll(string szName) { if (AsyncLoadCount != 0) { Develop.LogError("AsyncLoad res, can't ResourcesEx.Load" + szName); return(null); } return(Resources.LoadAll(szName)); }
public void withmoq() { Mock <Email> EmailMOqed = new Mock <Email>(); EmailMOqed.Setup(x => x.sendEmail()).Returns(true); Develop mydev = new Develop(); bool Result = mydev.DoSomething(); Assert.AreEqual(Result, true); }
public void Release(T element) { if (m_Stack.Count > 0 && ReferenceEquals(m_Stack.Peek(), element)) { Develop.LogError("Internal error. Trying to destroy object that is already released to pool."); } if (m_ActionOnRelease != null) { m_ActionOnRelease(element); } m_Stack.Push(element); }
public void TestCreateDevelop() { var entities = Develop.LoadEntities(); foreach (var item in entities) { Develop.CreateRespositoryInterface(item); Develop.CreateRepositoryImplement(item); Develop.CreateEntityTypeConfig(item); } Assert.Pass(); }
public void TestDevelop() { var d = Develop.CurrentDirect; Console.WriteLine(d); Assert.IsTrue(d.Contains("template")); var entities = Develop.LoadEntities(); foreach (var item in entities) { Console.WriteLine(item.FullName); } }
bool IEnumerator.MoveNext() { if (null != this.BundleWww) { if (!this.BundleWww.isDone) { return(true); //yield return this.BundleWww; } if (!Manifest.DependenciesDone(this)) { return(this.DependenciesWait = true); //yield return null; } if (this.BundleWww.error != null) { Develop.LogError("Error:" + this.BundleWww.error); } this.BundleObject = this.BundleWww.assetBundle; if (this.BundleObject == null) { Develop.LogError("Error: null == BundleObject"); } this.BundleWww.Dispose(); this.BundleWww = null; return(false); } // 요청된 async load가 없으면 enumerate를 중지한다. if (this._bundle_request == null) { return(false); } Assert.IsNull(this.BundleObject); // loading이 완료되지 않았으면, true를 리턴하여, enumerate를 진행한다. if (!this._bundle_request.isDone) { return(true); } // load가 완료되면, object를 얻고 enumerate를 중지한다. this.BundleObject = this._bundle_request.assetBundle; this._bundle_request = null; return(false); }
public Asset LoadAssetAsync([NotNull] string asset_name) { #if UI_RESOURCE GameObject asset = ResourcesEx.Load <GameObject>(texturePath + asset_name); if (asset == null) { Develop.LogError("Load Error!Cant find sprite:" + asset_name); return(null); } SpritePrefab sp = asset.GetComponent <SpritePrefab>(); if (sp == null) { Develop.LogError("Sprite Component Missing:" + asset_name); return(null); } Sprite sprite = (Sprite)sp.GetSprite(1); if (sprite == null) { Develop.LogError("Load Error!Cant find sprite:" + asset_name); return(null); } return(new Asset_Real(this, sprite)); #else #if UNITY_EDITOR if (!UseBundleInEditor) { var data_object = Manifest.LoadAssetDataBase <UObject>(this.BundleName, asset_name); return(new Asset_Real(this, data_object)); } #endif if (this.BundleObject == null) { Develop.LogErrorF("Bundle is not loaded {0}.{1}", this.BundleName, asset_name); return(null); } var asset_request = this.BundleObject.LoadAssetAsync(asset_name); if (null == asset_request) { Develop.LogErrorF("Asset LoadFail {0}.{1}", this.BundleName, asset_name); return(null); } return(new Asset_Real(this, asset_request)); #endif }
static public EventTriggerClick Get(GameObject go) { if (go == null) { Develop.LogWarning("EventTriggerClick.Get, GameObject is null!!"); return(null); } EventTriggerClick listener = go.GetComponent <EventTriggerClick>(); if (listener == null) { listener = go.AddComponent <EventTriggerClick>(); } return(listener); }
public void SetDevelopData() { Debug.Log("발전 품목 초기화"); JsonData ChartJson = JsonMapper.ToObject(Backend.Chart.GetLocalChartData("Develop")); var rows = ChartJson["rows"]; DevelopList.Clear(); foreach (JsonData item in rows) { Develop develop = new Develop(item); int count = int.Parse(item["Count"]["S"].ToString()); Debug.Log(develop.Name + ":" + count + "개"); for (int i = 0; i < count; i++) { DevelopList.Add(develop); Debug.Log(develop.Name + "추가됨"); } } }
// get T from pool public static T GenObj(GameObject objPrefab = null) { // 设置prefab s_objPrefab = objPrefab; if (s_transRecycleParent == null || s_objPrefab == null) { Develop.LogErrorF("not init pool : {0}", typeof(T)); return(default(T)); } if (s_pool == null) { s_pool = new UnityEngine.UI.ObjectPool <T>( (t) => { t.__Init(); }, (t) => { t.__Release(); } ); } return((T)s_pool.Get()); }
protected void btnFup_Click(object sender, EventArgs e) { try { if (fup.PostedFile.FileName == "") { lblInfo.Text = "请选择文件!"; } else { if (!IsAllowedExtension(fup)) { lblInfo.Text = "上传文件格式不正确!"; } else { string filepath = fup.PostedFile.FileName; string filename = filepath.Substring(filepath.LastIndexOf("\\") + 1); string serverpath = Server.MapPath("picture/") + filename; fup.PostedFile.SaveAs(serverpath); serverpath = filename; lblInfo.Text = "上传成功!"; using (var db = new TeachingCenterEntities()) { int id = Convert.ToInt32(Request.QueryString["id"]); Develop acsu = db.Develop.Single(a => a.Develop_id == id); acsu.Develop_path = serverpath; db.SaveChanges(); } Server.Transfer("DevelopManage.aspx"); // JSHelper.AlertThenRedirect("修改成功!", "DevelopManage.aspx"); } } } catch (Exception ex) { lblInfo.Text = "上传发生错误!原因是:" + ex.ToString(); } }
protected void ltbRecycle_Click(object sender, EventArgs e) { for (int i = 0; i < this.rptService.Items.Count; i++) { CheckBox cbx = (CheckBox)rptService.Items[i].FindControl("checkbox"); int id = Convert.ToInt32(((Label)rptService.Items[i].FindControl("lbID")).Text); if (cbx != null) { if (cbx.Checked == true) { using (var db = new TeachingCenterEntities()) { Develop sc = db.Develop.Single(a => a.Develop_id == id); sc.Develop_deleted = 0; db.SaveChanges(); } } } } Server.Transfer("RecycleDevelop.aspx"); //JSHelper.AlertThenRedirect("恢复成功!", "RecycleDevelop.aspx"); }
public Asset <T> LoadAssetAsync <T>([NotNull] string asset_name) where T : UObject { #if UNITY_EDITOR if (!UseBundleInEditor) { var data_object = Manifest.LoadAssetDataBase <T>(this.BundleName, asset_name); return(new Asset_Real <T>(this, data_object)); } #endif if (this.BundleObject == null) { Develop.LogErrorF("Bundle is not loaded {0}.{1}", this.BundleName, asset_name); return(null); } var asset_request = this.BundleObject.LoadAssetAsync(asset_name); if (null == asset_request) { Develop.LogErrorF("Asset LoadFail {0}.{1}", this.BundleName, asset_name); return(null); } return(new Asset_Real <T>(this, asset_request)); }
protected void btnSub_Click(object sender, EventArgs e) { string title = txtTitle.Text; string link = txtLink.Text; string content = myEditor11.InnerHtml; string arthor = txtAuthor.Text; string summary = TextBox1.Text; if (title.Length == 0 || arthor.Length == 0) { JSHelper.ShowAlert("输入不能为空!"); } else if (cbxLink.Checked && link.Length == 0) { JSHelper.ShowAlert("输入不能为空!"); } else if (!cbxLink.Checked && content.Length == 0) { JSHelper.ShowAlert("输入不能为空!"); } else if (summary.Length == 0) { JSHelper.ShowAlert("输入不能为空!"); } else { try { if (fup.PostedFile.FileName == "") { lblInfo.Text = "请选择文件!"; } else { if (!IsAllowedExtension(fup)) { lblInfo.Text = "上传文件格式不正确!"; } else { string filepath = fup.PostedFile.FileName; string filename = filepath.Substring(filepath.LastIndexOf("\\") + 1); string serverpath = Server.MapPath("picture/") + filename; fup.PostedFile.SaveAs(serverpath); serverpath = filename; lblInfo.Text = "上传成功!"; using (var db = new TeachingCenterEntities()) { if (!cbxLink.Checked) { link = ""; } Develop dev = new Develop(); dev.Develop_title = title; dev.Develop_author = arthor; dev.Develop_time = DateTime.Now; dev.Develop_content = content; dev.Develop_summary = summary; dev.Develop_link = link; dev.Develop_category = DevelopHelper.getCategoryId(dropCategory.SelectedValue); dev.Develop_hit = 0; dev.Develop_path = serverpath; dev.Develop_deleted = 0; db.Develop.Add(dev); db.SaveChanges(); //JSHelper.ShowAlert("发布成功!"); //JSHelper.Redirect("DevelopManage.aspx"); Server.Transfer("DevelopManage.aspx"); } } } } catch { } } }
private static void _LogDetail(string message) { Develop.Log(message); }
public void test1() { test_dict = Develop.AddPing(ping_msg); }
protected void btnSub_Click(object sender, EventArgs e) { string title = txtTitle.Text; string link = txtLink.Text; string content = myEditor11.InnerHtml; string summary = TextBox1.Text; string arthor = txtAuthor.Text; if (title.Length == 0 || arthor.Length == 0) { JSHelper.ShowAlert("输入不能为空!"); } else if (cbxLink.Checked && link.Length == 0) { JSHelper.ShowAlert("输入不能为空!"); } else if (!cbxLink.Checked && content.Length == 0) { JSHelper.ShowAlert("输入不能为空!"); } else if (summary.Length == 0) { JSHelper.ShowAlert("输入不能为空!"); } else { int id = 1; try { string teacher = Session["AdminID"].ToString(); id = Convert.ToInt32(Request.QueryString["id"].ToString()); //using (var db = new TeachingCenterEntities()) //{ // var cate = from it in db.DevelopCategory select it; // dropCategory.DataSource = cate.ToList(); // dropCategory.DataTextField = "DevelopCategory_name"; // dropCategory.DataBind(); // Develop dev = db.Develop.Single(a => a.Develop_id == id); // txtTitle.Text = dev.Develop_title; // TextBox1.Text = dev.Develop_summary; // txtLink.Text = dev.Develop_link; // txtAuthor.Text = dev.Develop_author; // myEditor11.InnerHtml = Server.HtmlDecode(dev.Develop_content); //} using (var db = new TeachingCenterEntities()) { Develop dev = db.Develop.Single(a => a.Develop_id == id); dev.Develop_title = title; dev.Develop_author = arthor; dev.Develop_time = DateTime.Now; dev.Develop_content = content; dev.Develop_link = link; if (!cbxLink.Checked) { link = ""; } dev.Develop_summary = summary; dev.Develop_category = DevelopHelper.getCategoryId(dropCategory.SelectedValue); dev.Develop_hit = 0; dev.Develop_deleted = 0; dev.Develop_time = Convert.ToDateTime(pushlishTime.Value.ToString()); //db.Develop.Add(dev); db.SaveChanges(); //JSHelper.ShowAlert("修改成功!"); //JSHelper.Redirect("DevelopManage.aspx"); Server.Transfer("DevelopManage.aspx"); } } catch { } } }