示例#1
0
        public override string GetCRC()
        {
            string        result = string.Empty;
            StringBuilder sb     = new StringBuilder();

            sb.Append(this.Block0.GetData());
            sb.Append(this.Block1.GetData());
            result = MakeCRC.ToModbusCRC16(sb.ToString(), false);
            return(result);
        }
示例#2
0
    public static bool GetAssetBundleCheck(Object o, ref CAssetBundleCheck abc)
    {
        string collectDependenciesAssetPath = AssetDatabase.GetAssetPath(o).ToLower();

        Object[] dependencies;

        //        dependencies = new[] { o };
        if (o is GameObject)
        {
            dependencies = EditorUtility.CollectDependencies(new[] { o });
        }
        else if (o is TextAsset || o is Texture2D || o is AudioClip)
        {
            dependencies = new[] { o };
        }
        else
        {
            return(false);
        }

        foreach (var od in dependencies)
        {
            //if (od is TextAsset == false && od is GameObject == false && od is Texture2D == false && od is AudioClip == false)
            //{
            //    continue;
            //}

            string assetPath = AssetDatabase.GetAssetPath(od).ToLower();
            if (Path.GetExtension(assetPath) == ".cs")
            {
                MagiDebug.Log("GetAssetBundleCheck .cs - " + assetPath);
                continue;
            }

            var path = System.Environment.CurrentDirectory + "/" + assetPath;
            if (File.Exists(path) == false)
            {
                continue;
            }

            uint crc;
            if (MakeCRC.Make(path, out crc) == true)
            {
                abc.crc += crc;
            }
            FileInfo fi = new FileInfo(path);
            abc.size += (ulong)fi.Length;
            abc.count++;
        }
        dependencies = null;
        return(true);
    }
示例#3
0
    public static bool GetAssetBundleCheck(Object[] objects, out CAssetBundleCheck abc)
    {
        HashSet <string> hsFileList = new HashSet <string>();

        abc = new CAssetBundleCheck();

        int i = 0;

        foreach (var ob in objects)
        {
            float s = (float)i / objects.Length;

            string collectDependenciesAssetPath = AssetDatabase.GetAssetPath(ob).ToLower();
            EditorUtility.DisplayProgressBar("CollectDependencies", collectDependenciesAssetPath, s);

            var dependencies = EditorUtility.CollectDependencies(new[] { ob });
            foreach (var o in dependencies)
            {
                if (o is TextAsset == false && o is GameObject == false && o is Texture2D == false && o is AudioClip == false)
                {
                    continue;
                }

                string assetPath = AssetDatabase.GetAssetPath(o).ToLower();
                if (hsFileList.Contains(assetPath) == false)
                {
                    //                    hsFileList.Add(assetPath);
                }
            }
            dependencies = null;
        }
        EditorUtility.ClearProgressBar();

        i         = 0;
        abc.count = (uint)hsFileList.Count;
        foreach (var fileName in hsFileList)
        {
            float s = (float)i / abc.count;
            EditorUtility.DisplayProgressBar("GetAssetBundleCheck", string.Format("Get asset bundle check {0}/{1}", i, abc.count), s);

            var path = System.Environment.CurrentDirectory + "/" + fileName;
            if (File.Exists(path) == false)
            {
                ++i;
                continue;
            }

            uint crc;
            if (MakeCRC.Make(path, out crc) == true)
            {
                abc.crc += crc;
            }
            FileInfo fi = new FileInfo(path);
            abc.size += (ulong)fi.Length;
            ++i;

            //            int totalMemory = System.GC.GetTotalMemory(true);
        }
        EditorUtility.ClearProgressBar();
        return(true);
    }