Example #1
0
        public static void CheckOnAssetRefs()
        {
            string assetPath = BundleEditorUtil.GetSelectedAssetPathOrFallback();
            var    asset     = AssetDatabase.LoadAssetAtPath(assetPath, typeof(UObj));

            //查找资源的Package节点
            string inPackagePath = AssetBundleUtility.GetRelativePath(assetPath, AssetBundleUtility.AssetGameAssets);
            int    indexOf       = inPackagePath.IndexOf('/');

            if (indexOf != -1)
            {
                inPackagePath = inPackagePath.Substring(0, indexOf);
            }

            var         checker = ScriptableWizard.DisplayWizard <CheckAssetReferencesWin>("资源被引用列表", "删除");
            List <UObj> refList = null;

            FindProject.Find((pathList) =>
            {
                checker.refAssetArray = pathList.ToArray();

                checker.targetAssetPath = assetPath;
                checker.target          = asset;
            });
        }
Example #2
0
    private void Find()
    {
        if (selectShader == null)
        {
            unusedStaticRes = null;
            return;
        }

        AssetDatabase.TryGetGUIDAndLocalFileIdentifier(selectShader, out string guid, out long fileId);
        string path = AssetDatabase.GetAssetPath(selectShader);

        Debug.LogError($@"GUID: {guid} 
                        localId: {fileId} 
                        path: {path}", selectShader);
        if (string.IsNullOrEmpty(guid))
        {
            unusedStaticRes = null;
            return;
        }

        if (guid == "0000000000000000f000000000000000" || path.ToLower().Contains("unity_builtin_extra"))
        {
            unusedStaticRes = null;

            return;
        }

        FindProject.FindWithGuid(guid, fileId, list => { unusedStaticRes = list.ToArray(); });
    }
Example #3
0
    private void Find()
    {
        if (selectMaterial == null)
        {
            unusedStaticRes = null;
            return;
        }

        AssetDatabase.TryGetGUIDAndLocalFileIdentifier(selectMaterial, out string guid, out long localId);
        Debug.LogError($"GUID: {guid} \n localId: {localId}", selectMaterial);
        if (string.IsNullOrEmpty(guid))
        {
            unusedStaticRes = null;
            return;
        }

        FindProject.FindWithGuid(guid, localId, (o) => { unusedStaticRes = o.ToArray(); });
    }
Example #4
0
 private void OpenProject_Click(object sender, EventArgs e)
 {
     if (FindProject.ShowDialog() == DialogResult.OK)
     {
         FileInfo fi = new FileInfo(FindProject.SelectedPath + "\\ProjectTestConfig.json");
         if (fi.Exists)
         {
             StreamReader sr        = new StreamReader(FindProject.SelectedPath + "\\ProjectTestConfig.json");
             string       ConfigStr = sr.ReadToEnd();
             sr.Close();
             ResultConfig rc = JsonHelper.DeserializeJsonToObject <ResultConfig>(ConfigStr);
             Project.ProjectName = rc.projectName;
             Project.ProjectPath = FindProject.SelectedPath.Replace("\\" + Project.ProjectName, "");
             projectStatus.Text  = Project.ProjectName;
             string CaseName = "";
             string Result   = "";
             foreach (var item in rc.result)
             {
                 CaseName = "";
                 Result   = "";
                 CaseName = item.Key;
                 Result   = item.Value;
                 if (CaseName != "")
                 {
                     bool flag = false;
                     foreach (TreeNode tn in tvTestCase.Nodes)
                     {
                         if (tn.Nodes.Count > 0)
                         {
                             foreach (TreeNode tnchild in tn.Nodes)
                             {
                                 if (tnchild.Text.Contains(CaseName))
                                 {
                                     tnchild.ImageIndex         = -1;
                                     tnchild.SelectedImageIndex = -1;
                                     tnchild.ImageIndex         = Result == "PASS" ? 1 : 2;
                                     tnchild.SelectedImageIndex = Result == "PASS" ? 1 : 2;
                                     flag = true;
                                     break;
                                 }
                             }
                             if (flag)
                             {
                                 break;
                             }
                         }
                     }
                 }
             }
         }
         else
         {
             DialogResult dr = MetroMessageBox.Show(this, "配置文件不存在,是否新建", "提示", MessageBoxButtons.YesNo);
             if (dr == DialogResult.Yes)
             {
                 using (FileStream fs = new FileStream(FindProject.SelectedPath + "\\ProjectTestConfig.json", FileMode.Create, FileAccess.ReadWrite))
                 {
                     using (StreamWriter sw = new StreamWriter(fs))
                     {
                         Global.ResultConfig rc = new Global.ResultConfig();
                         rc.projectName = FindProject.SelectedPath.Substring(FindProject.SelectedPath.LastIndexOf("\\") + 1, FindProject.SelectedPath.Length - FindProject.SelectedPath.LastIndexOf("\\") - 1);
                         string str = JsonHelper.SerializeObject(rc);
                         sw.Write(str);
                         sw.Close();
                     }
                 }
             }
         }
     }
 }