示例#1
0
    public void DeleteSingleResourceFile(ResourceUnit resUnit)
    {
        int type = ResourceUnit.GetAnalyzeType(Path.GetExtension(resUnit.GetFileName()).ToLower());

        if (mTypeFileDictionary.ContainsKey(type))
        {
            Dictionary <string, ResourceUnit> fileDictionary = mTypeFileDictionary[type];
            string fullName = resUnit.GetPathName() + "/" + resUnit.GetFileName();

            if (fileDictionary.ContainsKey(fullName))
            {
                fileDictionary.Remove(fullName);
                File.Delete(fullName);
            }
        }
    }
示例#2
0
    protected void AnalyzeYAMLResource(ResourceUnit res)
    {
        string fullName = res.GetPathName() + "/" + res.GetFileName();

        YamlEmittor emittor = new YamlEmittor();

        bool success = emittor.AnalyzeYAMLFile(fullName);

        if (success)
        {
            {
                // foreach(var guid in emittor.mGuidList)
                var __enumerator1 = (emittor.mGuidList).GetEnumerator();
                while (__enumerator1.MoveNext())
                {
                    var guid = (string)__enumerator1.Current;
                    {
                        string name        = AssetDatabase.GUIDToAssetPath(guid);
                        string extName     = Path.GetExtension(name).ToLower();
                        int    analyzeType = ResourceUnit.GetAnalyzeType(extName);

                        mResourceRedundanceMgr.ProcessResource(analyzeType, name, res);
                    }
                }
            }
        }
        else
        {
            Debug.LogError("Failed to parse " + fullName);
        }
    }
    public override void Analyze(ResourceUnit res)
    {
        int startIndex = res.GetPathName().IndexOf(mTableFolderName);

        string resourcesPath = res.GetPathName().Remove(startIndex);
        string tableSubPath  = res.GetPathName().Remove(0, startIndex);

        string[] list     = res.GetFileName().Split('.');
        string   fileName = tableSubPath + "/" + list[0];

        int col = res.GetTableValidColmn();

        TextAsset textContent = Resources.Load(fileName, typeof(TextAsset)) as TextAsset;

        if (textContent == null)
        {
            Debug.LogError("Failed to open " + fileName);
            return;
        }

        string[] alldataline = textContent.text.Split('\n');
        for (int i = 2; i < alldataline.Length; i++)
        {
            string line = alldataline[i];
            if (String.IsNullOrEmpty(line))
            {
                continue;
            }

            if (line.IndexOf('#') == 0)
            {
                continue;
            }

            string[] strCols = line.Split('\t');

            if (strCols.Length > col)
            {
                string name = strCols[col - 1];

                mResourceRedundanceMgr.ProcessResource((int)(AnalyzeType.AT_PREFAB), resourcesPath + res.GetTablePathSectorName() + name + ".prefab", res);
            }
        }
    }