Esempio n. 1
0
 public void buildSelectedAndLoadTest()
 {
     using (ResourceManager manager = ResourceManagerTests.createManager())
     {
         using (ResourcesInfo info = ScriptableObject.CreateInstance <ResourcesInfo>())
         {
             usingTempFile(() =>
             {
                 ResourcesInfoEditor.build(info, PATH_BUILD_OUTPUT, new ResourceInfo()
                 {
                     type = ResourceType.Resources,
                     path = PATH_RESOURCE_TO_LOAD
                 },
                                           new ResourceInfo()
                 {
                     type = ResourceType.Assetbundle,
                     path = PATH_ASSET_TO_PACK,
                 },
                                           new ResourceInfo()
                 {
                     type = ResourceType.File,
                     path = PATH_FILE_TO_READ
                 });
                 manager.resourcesInfo = info;
                 loadAllKindResAssert(manager);
             });
         }
     }
 }
Esempio n. 2
0
        private void UpdateClick(string ID, string Evalue)
        {
            ResourcesInfo resource     = new ResourcesInfo();
            JsonModel     jsonmodel    = Bll.GetEntityById(int.Parse(ID));
            int           DownCount    = 0;
            int           ClickCount   = 0;
            int           EvalueCount  = 0;
            int           EvalueResult = 0;
            //List<Dictionary<string, object>> list = (List<Dictionary<string, object>>)jsonmodel.retData;
            ResourcesInfo list = (ResourcesInfo)jsonmodel.retData;

            //foreach (Dictionary<string, object> result in list)
            //{
            DownCount    = Convert.ToInt32(list.DownCount);
            ClickCount   = Convert.ToInt32(list.ClickCount);
            EvalueCount  = Convert.ToInt32(list.EvalueCount);
            EvalueCount  = Convert.ToInt32(list.EvalueCount);
            EvalueResult = Convert.ToInt32(list.EvalueResult);
            //}
            resource.DownCount    = DownCount + 1;
            resource.ClickCount   = ClickCount + 1;
            resource.EvalueCount  = EvalueCount + 1;
            resource.EvalueResult = EvalueResult + int.Parse(Evalue);
            resource.ID           = int.Parse(ID);
            Bll.Update(resource);
        }
Esempio n. 3
0
        /// <summary>
        /// 获取分页数据
        /// </summary>
        /// <param name="context"></param>
        private void GetDowDetail(HttpContext context)
        {
            GetUserNameHandler   common    = new GetUserNameHandler();
            ClickDetailService   Clickbll  = new ClickDetailService();
            string               result    = "";
            JsonModel            jsonModel = null;
            JavaScriptSerializer jss       = new System.Web.Script.Serialization.JavaScriptSerializer();

            try
            {
                ResourcesInfo resource = new ResourcesInfo();
                Hashtable     ht       = new Hashtable();
                ht.Add("PageIndex", context.Request["PageIndex"].SafeToString());
                ht.Add("PageSize", context.Request["PageSize"].SafeToString());

                jsonModel = common.AddCreateNameForData(Clickbll.GetPage(ht, true), 1, true);

                //result = "{\"result\":" + jss.Serialize(jsonModel) + "}";
            }
            catch (Exception ex)
            {
                jsonModel = new JsonModel()
                {
                    errNum  = 400,
                    errMsg  = ex.Message,
                    retData = ""
                };
                LogService.WriteErrorLog(ex.Message);
            }
            result = "{\"result\":" + jss.Serialize(jsonModel) + "}";
            context.Response.Write(result);
            context.Response.End();
        }
Esempio n. 4
0
        public void buildAndCheckInfoTest()
        {
            using (ResourcesInfo info = ScriptableObject.CreateInstance <ResourcesInfo>())
            {
                usingTempFile(() =>
                {
                    ResourcesInfoEditor.build(info, PATH_BUILD_OUTPUT);

                    Assert.AreEqual(PATH_BUILD_OUTPUT, info.bundleOutputPath);

                    var resourceToLoad = info.resourceList.Find(r => r.type == ResourceType.Resources && r.path == PATH_RESOURCE_TO_LOAD);
                    Assert.NotNull(resourceToLoad);

                    var resourceNotToLoad = info.resourceList.Find(r => r.path == PATH_RESOURCE_NOT_TO_LOAD);
                    Assert.Null(resourceNotToLoad);

                    Assert.False(info.resourceList.Exists(r => r.type == ResourceType.Resources && Path.GetFileNameWithoutExtension(r.path) == nameof(ResourceManager)));

                    var fileToRead = info.resourceList.Find(r => r.type == ResourceType.File && r.path == PATH_FILE_TO_READ);
                    Assert.NotNull(fileToRead);

                    var assetToPack = info.resourceList.Find(r => r.type == ResourceType.Assetbundle && r.path == PATH_ASSET_TO_PACK.ToLower());
                    Assert.NotNull(assetToPack);
                });
            }
        }
Esempio n. 5
0
 void Start()
 {
     _confirmButton.onClick.AddListener(Confirm);
     _resInfo = new Dictionary <CardType, ResourcesInfo>();
     foreach (Resources r in _storages)
     {
         var info = new ResourcesInfo();
         info.Place       = r.Place;
         info.Counts      = r.Counts;
         _resInfo[r.Type] = info;
         r.Place.channelForCardSelection.CardSelectionEvent += UpdateResources;
     }
 }
        public bool InitSystem(bool isAb = true)
        {
            DisposeSystem();
            IsAB = isAb;
            ResourcesInfo info = Resources.Load <ResourcesInfo>("ScriptableObject/ResourcesInfo");

            for (int i = 0; i < info.Data.Count; i++)
            {
                ResDict.Add(info.Data[i].Name, info.Data[i]);
            }
            IsInit = true;
            return(ResDict.Count > 0);
        }
Esempio n. 7
0
        IEnumerator createManagerBuildAndAssertAsync(Func <ResourceManager, IEnumerator> onAssert, bool reCreate = false)
        {
            if (!reCreate && manager != null)
            {
                bool isFileTemp = false;
                if (!Directory.Exists(Path.GetDirectoryName(PATH_FILE_TO_READ)))
                {
                    Directory.CreateDirectory(Path.GetDirectoryName(PATH_FILE_TO_READ));
                }
                if (!File.Exists(PATH_FILE_TO_READ))
                {
                    isFileTemp = true;
                    File.Create(PATH_FILE_TO_READ).Close();
                }
                yield return(onAssert?.Invoke(manager));

                if (isFileTemp)
                {
                    File.Delete(PATH_FILE_TO_READ);
                }
                yield break;
            }
            using (manager = ResourceManagerTests.createManager())
            {
                using (ResourcesInfo info = ScriptableObject.CreateInstance <ResourcesInfo>())
                {
                    bool isFileTemp = false;
                    if (!Directory.Exists(Path.GetDirectoryName(PATH_FILE_TO_READ)))
                    {
                        Directory.CreateDirectory(Path.GetDirectoryName(PATH_FILE_TO_READ));
                    }
                    if (!File.Exists(PATH_FILE_TO_READ))
                    {
                        isFileTemp = true;
                        File.Create(PATH_FILE_TO_READ).Close();
                    }
                    ResourcesInfoEditor.build(info, PATH_BUILD_OUTPUT);
                    manager.resourcesInfo = info;
                    yield return(onAssert?.Invoke(manager));

                    if (isFileTemp)
                    {
                        File.Delete(PATH_FILE_TO_READ);
                    }
                }
            }
            manager = null;
        }
Esempio n. 8
0
 void Expand(ResourcesInfo info)
 {
     info.pos = EditorGUILayout.BeginScrollView(info.pos);
     for (int i = 0; i < info.objCount; i++)
     {
         Object     obj = info.GetObject(i);
         GUIContent g   = EditorGUIUtility.ObjectContent(obj, typeof(Object));
         g.text = AssetDatabase.GetAssetPath(obj);
         if (GUILayout.Button(g, "PR PrefabLabel", GUILayout.Height(20)))
         {
             EditorGUIUtility.PingObject(obj);
             Selection.activeObject = obj;
         }
     }
     EditorGUILayout.EndScrollView();
 }
Esempio n. 9
0
        /// <summary>
        /// 文件删除
        /// </summary>
        /// <returns></returns>

        private void Del(HttpContext context)
        {
            JsonModel            jsonModel = null;
            JavaScriptSerializer jss       = new System.Web.Script.Serialization.JavaScriptSerializer();

            string ids = context.Request.Form["DelID"] == null ? "" : context.Request.Form["DelID"].ToString();

            string result = "0";

            try
            {
                string[] idarry = ids.TrimEnd(',').Split(',');
                for (int i = 0; i < idarry.Length; i++)
                {
                    #region 文件删除
                    JsonModel     model    = Bll.GetEntityById(int.Parse(idarry[i]));
                    ResourcesInfo resource = (ResourcesInfo)(model.retData);
                    string        FileUrl  = resource.FileUrl;
                    if (resource.postfix == "")
                    {
                        FileHelper.DeleteDirectory(context.Server.MapPath(FileUrl));
                    }
                    else
                    {
                        FileHelper.DeleteFile(context.Server.MapPath(FileUrl));
                    }
                    #endregion
                    //数据删除
                    jsonModel = Bll.Delete(int.Parse(idarry[i]));
                }
            }
            catch (Exception ex)
            {
                jsonModel = new JsonModel()
                {
                    errNum  = 400,
                    errMsg  = ex.Message,
                    retData = ""
                };
                LogService.WriteErrorLog(ex.Message);
            }
            result = "{\"result\":" + jss.Serialize(jsonModel) + "}";

            context.Response.Write(result);
            context.Response.End();
        }
Esempio n. 10
0
        /// <summary>
        /// 获取分页数据
        /// </summary>
        /// <param name="context"></param>
        private void GetPage(HttpContext context)
        {
            string               IDCard    = context.Request["IDCard"].SafeToString();
            string               result    = "";
            JsonModel            jsonModel = null;
            JavaScriptSerializer jss       = new System.Web.Script.Serialization.JavaScriptSerializer();

            try
            {
                ResourcesInfo resource = new ResourcesInfo();
                Hashtable     ht       = new Hashtable();
                ht.Add("PageIndex", context.Request["PageIndex"].SafeToString());
                ht.Add("PageSize", context.Request["PageSize"].SafeToString());
                ht.Add("IDCard", IDCard);// "ResourcesInfo T left join ClickDetail detail on T.ID=detail.ResourcesID and detail.ClickType=2 and detail.CreateUID='" + IDCard + "'");
                ht.Add("DocName", context.Request.Form["DocName"].SafeToString());
                ht.Add("GroupName", context.Request.Form["GroupName"].SafeToString());
                ht.Add("Postfixs", context.Request.Form["Postfixs"].SafeToString());
                ht.Add("CatagoryID", context.Request.Form["CatagoryID"].SafeToString().Replace("|0", ""));
                ht.Add("ChapterID", context.Request.Form["ChapterID"].SafeToString());

                jsonModel = Bll.GetPage(ht);
                //result = "{\"result\":" + jss.Serialize(jsonModel) + "}";
            }
            catch (Exception ex)
            {
                jsonModel = new JsonModel()
                {
                    errNum  = 400,
                    errMsg  = ex.Message,
                    retData = ""
                };
                LogService.WriteErrorLog(ex.Message);
            }
            result = "{\"result\":" + jss.Serialize(jsonModel) + "}";
            context.Response.Write(result);
            context.Response.End();
        }
Esempio n. 11
0
 private void createManagerBuildAndAssert(Action <ResourceManager> onAssert, bool reCreate = true)
 {
     if (!reCreate && manager != null)
     {
         usingTempFile(() =>
         {
             onAssert?.Invoke(manager);
         });
         return;
     }
     using (manager = ResourceManagerTests.createManager())
     {
         using (ResourcesInfo info = ScriptableObject.CreateInstance <ResourcesInfo>())
         {
             usingTempFile(() =>
             {
                 ResourcesInfoEditor.build(info, PATH_BUILD_OUTPUT);
                 manager.resourcesInfo = info;
                 onAssert?.Invoke(manager);
             });
         }
     }
     manager = null;
 }
Esempio n. 12
0
 private static extern int criAtomExDebug_GetResourcesInfo(out ResourcesInfo resourcesInfo);
Esempio n. 13
0
 /**
  * <summary>CriAtomEx 内部の各種リソースの状況の取得</summary>
  * <param name="resourcesInfo">CriAtomEx 内部の各種リソースの状況</param>
  * \par 説明:
  * CriAtomEx 内部の各種リソースの状況取得します。<br>
  */
 public static void GetResourcesInfo(out ResourcesInfo resourcesInfo)
 {
     criAtomExDebug_GetResourcesInfo(out resourcesInfo);
 }
Esempio n. 14
0
 private static void criAtomExDebug_GetResourcesInfo(out ResourcesInfo resourcesInfo)
 {
     resourcesInfo = new ResourcesInfo();
 }
Esempio n. 15
0
        private void UploadPubResource(HttpContext context)
        {
            JsonModel            jsonModel = null;
            JavaScriptSerializer jss       = new System.Web.Script.Serialization.JavaScriptSerializer();

            string FoldUrl = context.Request["FoldUrl"] == null ? "" : context.Request["FoldUrl"].SafeToString();

            FoldUrl = ConfigHelper.GetConfigString("FileManageName") + FoldUrl;
            string GroupName  = context.Request["GroupName"].SafeToString().Trim();
            string CatagoryID = context.Request["CatagoryID"].SafeToString().Trim().Replace("|0", "");
            string ChapterID  = context.Request["ChapterID"].SafeToString().Trim();
            string result     = "0";
            string CreateUID  = context.Request["CreateUID"].SafeToString();

            try
            {
                if (!FileHelper.IsExistDirectory(context.Server.MapPath(FoldUrl + "/" + GroupName)))
                {
                    FileHelper.CreateDirectory(context.Server.MapPath(FoldUrl + "/" + GroupName));
                }
                HttpPostedFile file = context.Request.Files[0];

                string ext = Path.GetExtension(file.FileName);

                string fileName = Path.GetFileName(file.FileName);
                string p        = FoldUrl + "/" + fileName;

                string path = context.Server.MapPath(p);

                #region 处理文件同名问题
                if (FileHelper.IsExistFile(path))
                {
                    int i = 0;
                    while (true)
                    {
                        i++;
                        if (!FileHelper.IsExistFile(context.Server.MapPath(FoldUrl + "/" + fileName.Split('.')[0] + "(" + i + ")" + "." + fileName.Split('.')[1])))
                        {
                            fileName = fileName.Split('.')[0] + "(" + i + ")" + "." + fileName.Split('.')[1];
                            p        = FoldUrl + "/" + fileName;
                            path     = context.Server.MapPath(p);

                            break;
                        }
                    }
                }
                #endregion

                file.SaveAs(path);
                ResourcesInfo re = new ResourcesInfo();
                re.Name        = fileName.Replace(ext, "");
                re.FileSize    = file.ContentLength;
                re.FileUrl     = p;
                re.FileIcon    = "ico-" + fileName.Split('.')[1] + "b.png";
                re.FileIconBig = "ico-" + fileName.Split('.')[1] + "t.png";
                re.postfix     = ext;
                re.CreateUID   = CreateUID;
                re.EditUID     = CreateUID;

                re.DownCount    = 0;
                re.CheckMessage = "";
                re.CatagoryID   = CatagoryID;
                re.ChapterID    = ChapterID == "" ? 0 : int.Parse(ChapterID);
                re.IsOpen       = 0;
                re.Status       = 0;
                re.FileGroup    = GroupName;
                jsonModel       = pubBll.Add(re);
            }
            catch (Exception ex)
            {
                jsonModel = new JsonModel()
                {
                    errNum  = 400,
                    errMsg  = ex.Message,
                    retData = ""
                };
                LogService.WriteErrorLog(ex.Message);
            }
            result = "{\"result\":" + jss.Serialize(jsonModel) + "}";

            context.Response.Write(result);
            context.Response.End();
        }
Esempio n. 16
0
        /// <summary>
        /// 文件下载
        /// </summary>
        /// <returns></returns>

        private void Down(HttpContext context)
        {
            string IDCard = context.Request["IDCard"].SafeToString();

            ZipHelper            zip       = new ZipHelper();
            JsonModel            jsonModel = null;
            JavaScriptSerializer jss       = new System.Web.Script.Serialization.JavaScriptSerializer();

            string ids     = context.Request.Form["DownID"] == null ? "" : context.Request.Form["DownID"].ToString();
            string ZipUrl  = context.Server.MapPath(ConfigHelper.GetConfigString("ZipUrl")) + "/" + DateTime.Now.Ticks;
            string DownUrl = ConfigHelper.GetConfigString("DownUrl");
            string result  = "0";

            try
            {
                string[] idarry = ids.TrimEnd(',').Split(',');
                FileHelper.CreateDirectory(ZipUrl);
                for (int i = 0; i < idarry.Length; i++)
                {
                    #region 文件移动
                    JsonModel     model    = Bll.GetEntityById(int.Parse(idarry[i]));
                    ResourcesInfo resource = (ResourcesInfo)(model.retData);
                    string        FileUrl  = resource.FileUrl;
                    if (resource.postfix == "")
                    {
                        FileHelper.CopyFolder(context.Server.MapPath(FileUrl), ZipUrl);
                    }
                    else
                    {
                        //增加下载记录
                        UpdateClick(idarry[i].ToString(), "3", IDCard, "0");
                        UpdateClick(idarry[i].ToString(), "0");

                        FileHelper.CopyTo(context.Server.MapPath(FileUrl), ZipUrl + FileUrl.Substring(FileUrl.LastIndexOf("/")));
                    }
                    #endregion
                }
                string ZipName = "/下载文件" + DateTime.Now.Ticks + ".rar";
                //文件打包
                SharpZip.PackFiles(context.Server.MapPath(ConfigHelper.GetConfigString("ZipUrl")) + ZipName, ZipUrl);

                jsonModel = new JsonModel()
                {
                    errNum = 0,
                    errMsg = "",
                    //retData = DownUrl + "\\" + ZipName + ".rar"
                    retData = DownUrl + "\\" + ZipName
                };
            }
            catch (Exception ex)
            {
                jsonModel = new JsonModel()
                {
                    errNum  = 400,
                    errMsg  = ex.Message,
                    retData = ""
                };
                LogService.WriteErrorLog(ex.Message);
            }
            result = "{\"result\":" + jss.Serialize(jsonModel) + "}";

            context.Response.Write(result);
            context.Response.End();
        }