Example #1
0
        public void Start()
        {
            canvas = GetComponent <Canvas>();

            UiStack           = new Stack <GameObject>();
            timeCountList     = new List <GameObject>();
            chooseTowerPanel  = transform.Find("ChooseTower") as RectTransform;
            settingPanel      = transform.Find("Setting") as RectTransform;
            upGradeTowerPanel = transform.Find("UpGradeTower") as RectTransform;
            hightLightRect    = transform.Find("HightLight") as RectTransform;

            playerPackageRect = transform.Find("PlayerPackage") as RectTransform;

            resTextDic = new Dictionary <ResType, Text>();
            for (int i = 0; i != (int)ResType.End; i++)
            {
                ResType type = (ResType)i;
                Text    text = playerPackageRect.Find(type.ToString()).Find("Text").GetComponent <Text>();
                if (text != null)
                {
                    resTextDic.Add(type, text);
                }
            }

            timerList      = transform.Find("TimerList");
            timeCountPanel = transform.Find("TimeCountPanel");

            timer   = timerList.Find("TimeCount").gameObject;
            uiEvent = gameObject.AddComponent <UIEvent>();
            EnemyUi = transform.Find("EnemyUi").GetComponent <EnemyUiManager>();

            EventCenter.GetInstance().AddEventListener("GameManagerInitComplete", Init);

            EnemyUi.SetUiCamera(UiCamera);
        }
Example #2
0
        public override string ToString()
        {
            string str = ClmPrefix;

            if (empty)
            {
                str += "EMPTY=1;";
            }
            else
            {
                str += "RESTYPE=" + res.ToString() + ";";
                if (res == ResType.RES)
                {
                    str += "TOP=" + top.ToString() + ";BONUS=" + bonus.ToString() + ";";
                }
                str += "NAME=" + name + ";TEAM=" + team + ";IID=" + iid.ToString() + ";START=" + start.ToString() + ";";
            }
            if (this.res == ResType.NYA)
            {
                str += "NYA=1;";
            }
            else if (this.res == ResType.DSQ)
            {
                str += "DISQ=1;";
            }
            str += ClmTail;
            return(str);
        }
Example #3
0
    private IEnumerator LoadAllTowerObj(List <TowerType> choosedTowerList)
    {
        LoadComplete = false;
        ResourceRequest rr;

        for (int i = 0; i < choosedTowerList.Count; i++)
        {
            TowerType towerType = choosedTowerList[i];
            Tower     tower     = Resources.Load <Tower>($"ScriptableObject/Tower/{towerType.ToString()}Tower");

            _towerDic.Add(towerType, tower);
            tower.maxLevel = SetTowerLevel(tower.towerMsg, 0);


            rr = Resources.LoadAsync <GameObject>($"Tower/{towerType.ToString()}Tower");
            yield return(rr);

            _curLoad++;

            _towerBaseObjDic.Add(towerType, rr.asset as GameObject);

            for (int j = 0; j != (int)UiType.End; j++)
            {
                UiType uitype = (UiType)j;
                string uiType = uitype.ToString();

                rr = Resources.LoadAsync <GameObject>($"UI/{uiType}/{towerType.ToString()}{uiType}");
                yield return(rr);

                switch (uitype)
                {
                case UiType.ChooseBtn:
                    _chooseUiDic.Add(towerType, rr.asset as GameObject);
                    break;

                case UiType.UpGradeBtn:
//                        upgradeUiDic.Add(towerType,rr.asset as GameObject);
                    break;
                }
                _curLoad++;
            }
        }

        //LoadBuildRes
        for (int i = 0; i != (int)ResType.End; i++)
        {
            ResType resType    = (ResType)i;
            string  resTypeStr = resType.ToString();
            rr = Resources.LoadAsync <BuildRes>($"ScriptableObject/BuildResources/{resTypeStr}");
            yield return(rr);

            if (!_buildResDic.ContainsKey(resType) && rr.asset != null)
            {
                _buildResDic.Add(resType, rr.asset as BuildRes);
            }
        }

        LoadComplete = true;
    }
Example #4
0
        string ResTypeName(ResType type)
        {
            switch (type)
            {
            case ResType.AudioPath: return("Audio path");

            case ResType.CDAudio: return("CD Audio");

            default: return(type.ToString());
            }
        }
Example #5
0
        public Node GetBinaryOp(Node left, Node right, string op, ResType opType, ResType resType)
        {
            var defleft  = DefineResType(left);
            var defright = DefineResType(right);

            if ((defleft == opType) &&
                (defright == opType || right is NodeMethodExpression))
            {
                return new NodeBinaryOp
                       {
                           left    = left,
                           right   = right,
                           op      = op,
                           resType = resType
                       }
            }
            ;
            return(new NodeError()
            {
                message = "not all operands are " + opType.ToString()
            });
        }
Example #6
0
        public static string GetResStreamingPath(ResType res)
        {
#if UNITY_EDITOR || UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX
            return(string.Format("file:///{0}/{1}_{2}.dat", Application.streamingAssetsPath, RuntimeInfo.GetPlatformString(), res.ToString()));
#elif UNITY_ANDROID
            return(string.Format("{0}/{1}_{2}.dat", Application.streamingAssetsPath, RuntimeInfo.GetPlatformString(), res.ToString()));
#else
            return(string.Format("file:///{0}/{1}_{2}.dat", Application.streamingAssetsPath, RuntimeInfo.GetPlatformString(), res.ToString()));
#endif
        }
Example #7
0
 public static string GetResPersistentPath(ResType res)
 {
     return(string.Format("{0}/data/{1}_{2}.dat", LocalDir, GetPlatformString(), res.ToString()));
 }
Example #8
0
    public bool CheckVersion(string xml)
    {
        XmlDocument doc = new XmlDocument();

        if (doc == null)
        {
            return(false);
        }
        doc.LoadXml(xml);
        XmlElement ele = doc.DocumentElement;

        if (ele == null)
        {
            return(false);
        }
        XmlNode nodeVer = ele.SelectSingleNode("Net");

        if (nodeVer == null)
        {
            return(false);
        }
        string resftp    = nodeVer.Attributes["resftp"].Value;
        string runftp    = nodeVer.Attributes["runftp"].Value;
        string clientUrl = nodeVer.Attributes["clienturl"].Value;

        if (nodeVer.Attributes["ftpport"] != null)
        {
            ServerSetting.ResFtpPort = ushort.Parse(nodeVer.Attributes["ftpport"].Value);
        }
        ServerSetting.SetRunFTP(runftp);
        ServerSetting.ServerList.Clear();
        for (int i = 0; i < nodeVer.ChildNodes.Count; ++i)
        {
            XmlNode node = nodeVer.ChildNodes[i];
            if (node.Name == "IP")
            {
                ServerIPData sid = new ServerIPData();
                sid.IP   = node.FirstChild.Value;
                sid.Port = ushort.Parse(node.Attributes["port"].Value);
                ServerSetting.ServerList.Add(sid);
            }
            else if (node.Name == "FTP")
            {
                ServerIPData rfd = new ServerIPData();
                rfd.IP   = node.FirstChild.Value;
                rfd.Port = ushort.Parse(node.Attributes["port"].Value);
                rfd.ISP  = byte.Parse(node.Attributes["dx"].Value);
                m_ResFtpList.Add(rfd);
            }
        }

        ServerSetting.SERVICES_URL = "";// ele.SelectSingleNode("Services").FirstChild.Value;
        XmlNode reporterNode = ele.SelectSingleNode("Reporter");

        if (reporterNode != null)
        {
            ServerSetting.ReporterIP   = reporterNode.FirstChild.Value;
            ServerSetting.ReporterPort = ushort.Parse(reporterNode.Attributes["port"].Value);
        }
        XmlNode ShareNode = ele.SelectSingleNode("Share");

        if (ShareNode != null)
        {
            string  wxid = "", wxpwd = "", sinaid = "", sinapwd = "", qqid = "", qqpwd = "";
            XmlNode xn = ShareNode.ChildNodes[0];
            if (xn != null)
            {
                wxid  = xn.Attributes["id"].Value;
                wxpwd = xn.Attributes["pwd"].Value;
            }
            xn = ShareNode.ChildNodes[1];
            if (xn != null)
            {
                sinaid  = xn.Attributes["id"].Value;
                sinapwd = xn.Attributes["pwd"].Value;
            }
            xn = ShareNode.ChildNodes[2];
            if (xn != null)
            {
                qqid  = xn.Attributes["id"].Value;
                qqpwd = xn.Attributes["pwd"].Value;
            }
            NativeInterface.InitShare(wxid, wxpwd, sinaid, sinapwd, qqid, qqpwd);
            xn = ShareNode.ChildNodes[3];
            if (xn != null)
            {
                ServerSetting.ShareWebUrl = xn.Attributes["weburl"].Value;
                ServerSetting.ShareTxt    = xn.Attributes["txt"].Value;
                ServerSetting.ShareImgUrl = xn.Attributes["imgurl"].Value;
            }
        }
        //读取现有的资源,进行比较
        XmlNode clientNode = ele.SelectSingleNode("Client");
        string  clientVer  = clientNode.FirstChild.Value;;
        uint    clientCrc  = uint.Parse(clientNode.Attributes["crc"].Value);
        uint    clientSize = uint.Parse(clientNode.Attributes["size"].Value);

        if (clientNode.Attributes["resver"] != null)
        {
            ServerSetting.RES_VERSION = uint.Parse(clientNode.Attributes["resver"].Value);
        }
        if (clientNode.Attributes["ping"] != null)
        {
            ServerSetting.SHOW_PING = uint.Parse(clientNode.Attributes["ping"].Value) != 0;
        }
        if (clientNode.Attributes["extrabtn"] != null)
        {
            ServerSetting.ShowExtraBtn = uint.Parse(clientNode.Attributes["extrabtn"].Value) != 0;
        }
        if (clientNode.Attributes["ftp_newftp"] != null)
        {
            FTPClient.USE_NEW_FTP = byte.Parse(clientNode.Attributes["ftp_newftp"].Value);
        }
        if (clientNode.Attributes["showgame"] != null)
        {
            ServerSetting.ShowGame = byte.Parse(clientNode.Attributes["showgame"].Value) != 0;
        }
        if (clientNode.Attributes["ftp_chunkcount"] != null)
        {
            FTPClient.MAX_CHUNK_COUNT = byte.Parse(clientNode.Attributes["ftp_chunkcount"].Value);
        }
        if (clientNode.Attributes["ftp_chunksize"] != null)
        {
            FTPClient.CHUNK_SIZE = int.Parse(clientNode.Attributes["ftp_chunksize"].Value);
        }
        if (clientNode.Attributes["thirdbtn"] != null)
        {
            ServerSetting.ShowHallThirdBtn = int.Parse(clientNode.Attributes["thirdbtn"].Value) != 0;
        }
        if (clientNode.Attributes["exchange"] != null)
        {
            ServerSetting.ShowExchange = int.Parse(clientNode.Attributes["exchange"].Value) != 0;
        }
        if (clientNode.Attributes["showjbp"] != null)
        {
            ServerSetting.ShowJBP = int.Parse(clientNode.Attributes["showjbp"].Value) != 0;
        }
        if (clientNode.Attributes["showmatch"] != null)
        {
            ServerSetting.ShowMatch = int.Parse(clientNode.Attributes["showmatch"].Value) != 0;
        }
        if (clientNode.Attributes["showthirdlogin"] != null)
        {
            ServerSetting.ShowThirdLoginBtn = int.Parse(clientNode.Attributes["showthirdlogin"].Value) != 0;
        }

        m_State = UpdateState.UPDATE_COMPLETE;
        //检查客户端版本号
        if (clientVer == null)
        {
            return(false);
        }
        uint ver = Utility.VersionToUint(clientVer);

        if (ver > ServerSetting.ClientVer)
        {
            //clientUrl = ReplaceFTPAddress(clientUrl);
            //版本更新
            if (RuntimeInfo.GetPlatform() == GamePlatformType.Android)
            {
                if (CheckClientFile(clientCrc))
                {
                    //文件已经下载完成。
                    //NativeInterface.DownNewClientVersion(GetClientPath());
                }
                else
                {
                    //下载资源文件
                    DownResData drd = new DownResData();
                    drd.ResType = ResType.MAX;
                    drd.ResUrl  = clientUrl;
                    drd.ResCrc  = clientCrc;
                    drd.ResSize = clientSize;
                    m_DownList.Add(drd);
                    m_State             = UpdateState.UPDATE_DOWNLOAD_RES;
                    m_AllDownloadBytes += clientSize;
                }
                m_bNewClient = true;
            }
            else if (RuntimeInfo.GetPlatform() == GamePlatformType.Windows)
            {
                m_WinSizeList = new int[5];
                for (int i = 0; i < 5; ++i)
                {
                    string str = "winsize" + (i + 1).ToString();
                    if (clientNode.Attributes[str] != null)
                    {
                        m_WinSizeList[i] = int.Parse(clientNode.Attributes[str].Value);
                    }
                }
                DownResData drd = new DownResData();
                drd.ResType = ResType.MAX;
                drd.ResUrl  = clientUrl;
                drd.ResCrc  = clientCrc;
                drd.ResSize = clientSize;
                m_DownList.Add(drd);
                m_State             = UpdateState.UPDATE_DOWNLOAD_RES;
                m_AllDownloadBytes += clientSize;
                m_bNewClient        = true;
            }
            else
            {
                NativeInterface.DownNewClientVersion(clientUrl);
                m_State = UpdateState.UPDATE_NEW_CLIENT;
                return(true);
            }
        }
        for (int i = 0; i < (int)ResManager.RES_NUM; ++i)
        {
            ResType     rt   = (ResType)i;
            XmlNode     node = ele.SelectSingleNode(rt.ToString());
            DownResData vd   = new DownResData();
            vd.ResCrc       = uint.Parse(node.Attributes["crc"].Value);
            vd.ResUnzipSize = uint.Parse(node.Attributes["unzipsize"].Value);
            if (ResManager.Instance.VersionMgr.CheckVerAndCrc(rt, vd.ResCrc, vd.ResUnzipSize))
            {
                //下载资源文件
                vd.ResType = rt;
                vd.ResUrl  = resftp + node.Attributes["url"].Value;
                vd.ResSize = uint.Parse(node.Attributes["size"].Value);
                m_DownList.Add(vd);
                m_AllDownloadBytes += vd.ResSize;
            }
        }

        //保存当前的RES_VERSION
        if (m_DownList.Count > 0)
        {
            m_State = UpdateState.UPDATE_DOWNLOAD_RES;
            return(true);
        }
        else
        {
            return(true);
        }
    }
Example #9
0
        /// <summary>
        /// This method gets the file extension for a given ResType.
        /// </summary>
        /// <param name="type">The type to get the extension for</param>
        /// <returns>The extension for the given type</returns>
        private string GetFileExtension(ResType type)
        {
            // Invalid has no file extension
            if (ResType.Invalid == type) return string.Empty;

            // Convert the ResType to a string and return the last 3
            // characters, this is the file extension.
            return type.ToString().Substring(3, 3).ToLower();
        }
Example #10
0
    public static void CreateSDRes(float scaling)
    {
        string sdfile = Application.dataPath + "/sd.dat";

        if (File.Exists(sdfile))
        {
            EditorUtility.DisplayDialog("错误", "当前SD目录已经是低清版本", "OK");
            return;
        }

        if (Application.dataPath.LastIndexOf("NewClient_SD") == -1)
        {
            EditorUtility.DisplayDialog("错误", "当前目录不是SD目录", "OK");
            return;
        }

        EditorUtility.DisplayProgressBar("稍候", "正在转换资源", 0.4f);
        List <FileFlagData> ffdList = new List <FileFlagData>();
        string dir = Application.dataPath + "/Resources";


        for (int i = 0; i < ResManager.RES_NUM; ++i)
        {
            ResType  rt          = (ResType)i;
            string[] fileEntries = Directory.GetFiles(dir + "/" + rt.ToString(), "*", SearchOption.AllDirectories);
            foreach (string s in fileEntries)
            {
                string lower = s.ToLower();
                if (lower.LastIndexOf(".meta") != -1 ||
                    lower.LastIndexOf(".svn") != -1)
                {
                    continue;
                }
                if (lower.LastIndexOf(".png") != -1 ||
                    lower.LastIndexOf(".jpg") != -1 ||
                    lower.LastIndexOf(".tga") != -1)
                {
                    FileFlagData ffd = new FileFlagData();
                    ffd.path   = s.Replace('\\', '/');
                    ffd.Prefab = false;
                    ffdList.Add(ffd);
                }
                else if (lower.LastIndexOf(".prefab") != -1)
                {
                    FileFlagData ffd = new FileFlagData();
                    ffd.path   = s.Replace('\\', '/');
                    ffd.Prefab = true;
                    ffdList.Add(ffd);
                }
            }
        }

        //字体不缩放
        Dictionary <string, bool> fontMap = new Dictionary <string, bool>();

        foreach (FileFlagData ffd in ffdList)
        {
            string filePath = "Assets" + ffd.path.Replace(Application.dataPath, "");
            if (ffd.Prefab)
            {
                Object obj = AssetDatabase.LoadAssetAtPath(filePath, typeof(GameObject));
                if (obj == null)
                {
                    Debug.Log("加载图集失败:" + filePath);
                    continue;
                }
                GameObject go   = (GameObject)obj;
                UIFont     font = go.GetComponent <UIFont>();
                if (font != null)
                {
                    if (font.atlas != null)
                    {
                        EditorUtility.DisplayDialog("错误", "字体只能使用材质,不能使用图集:" + filePath, "OK");
                        EditorUtility.ClearProgressBar();
                        Debug.Log("转换SD资源失败!");
                        return;
                    }
                    if (font.material == null)
                    {
                        continue;
                        EditorUtility.DisplayDialog("错误", "字体未找到材质属性:" + filePath, "OK");
                        EditorUtility.ClearProgressBar();
                        Debug.Log("转换SD资源失败!");
                        return;
                    }
                    //保存字体使用的图片,不做缩放
                    if (font.material.mainTexture != null)
                    {
                        string picPath = AssetDatabase.GetAssetPath(font.material.mainTexture.GetInstanceID());
                        if (fontMap.ContainsKey(picPath) == false)
                        {
                            fontMap.Add(picPath, true);
                        }
                        else
                        {
                            Debug.Log("相同的路径:" + picPath);
                        }
                    }
                }
            }
        }

        EditorUtility.DisplayProgressBar("稍候", "正在转换贴图", 0.45f);
        Dictionary <string, FileFlagData> picList = new Dictionary <string, FileFlagData>();

        foreach (FileFlagData ffd in ffdList)
        {
            string filePath = "Assets" + ffd.path.Replace(Application.dataPath, "");
            if (!ffd.Prefab)
            {
                if (fontMap.ContainsKey(filePath))
                {
                    Debug.Log("字体不转换:" + filePath);
                    continue;
                }
                //系统设置弹出图片不缩放
                if (filePath.LastIndexOf("SceneBtnWindImage") != -1 || filePath.LastIndexOf("BackImages/BackImg") != -1 || filePath.LastIndexOf("FishShowImage") != -1)
                {
                    ffd.wscaling = 1.0f;
                    ffd.hscaling = 1.0f;
                }
                else
                {
                    ScalingTex(filePath, scaling, out ffd.wscaling, out ffd.hscaling);
                }
                picList.Add(filePath, ffd);
            }
        }
        EditorUtility.DisplayProgressBar("稍候", "正在转换图集", 0.7f);
        foreach (FileFlagData ffd in ffdList)
        {
            string filePath = "Assets" + ffd.path.Replace(Application.dataPath, "");
            if (ffd.Prefab)
            {
                Object obj = AssetDatabase.LoadAssetAtPath(filePath, typeof(GameObject));
                if (obj == null)
                {
                    Debug.Log("加载图集失败:" + filePath);
                    continue;
                }
                GameObject go  = (GameObject)obj;
                UIAtlas    atl = go.GetComponent <UIAtlas>();
                if (atl != null)
                {
                    if (atl.spriteMaterial == null || atl.spriteMaterial.mainTexture == null)
                    {
                        Debug.Log("不存在的图集的贴图:" + filePath);
                        continue;
                    }
                    string       picPath = AssetDatabase.GetAssetPath(atl.spriteMaterial.mainTexture.GetInstanceID());
                    FileFlagData picffd;
                    if (picList.TryGetValue(picPath, out picffd))
                    {
                        ScalingAtlas(filePath, picffd.wscaling, picffd.hscaling);
                    }
                    else
                    {
                        Debug.Log("不存在图集的贴图,atlas:" + filePath + ", pic:" + picPath);
                    }
                }
            }
        }

        EditorUtility.ClearProgressBar();
        FileStream fs = File.Create(sdfile);

        if (fs != null)
        {
            fs.Close();
        }
        Debug.Log("转换SD资源成功!");
    }
Example #11
0
 private void setResourceOnPage(TextboxList holder, ResType type, double value)
 {
     holder[type.ToString()] = value.ToString();
 }
Example #12
0
        private double getResourceFromPage(TextboxList holder, ResType type)
        {
            try
            {
                return double.Parse(holder[type.ToString()]);

            }
            catch
            { }
            return 0;
        }
Example #13
0
    static void LoadAssembly(string InAssemblyPath, bool InitialLoad = false)
    {
        AssemblyPath = InAssemblyPath;
        try
        {
            tv.Nodes.Clear();
            AppDomain.CurrentDomain.AssemblyResolve -= ResolveExternalAssembly;
            AppDomain.CurrentDomain.AssemblyResolve += ResolveExternalAssembly;
            AssemblyPath        = new FileInfo(AssemblyPath).FullName;
            DependencyDirs      = new [] { Path.GetDirectoryName(AssemblyPath), Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) };
            IgnoredDependencies = new string[0];
            Assembly assembly         = Assembly.LoadFile(AssemblyPath);
            bool     IsReflectionOnly = false;
            AssemblySize = new FileInfo(assembly.Location).Length;
            if (AssemblyPath != assembly.Location && !FileContentsMatch(AssemblyPath, assembly.Location))
            {
                MessageBox.Show("Requested assembly:\n" + AssemblyPath + "\n\nAssembly loaded by system:\n" + assembly.Location + "\n\nA different assembly was loaded because an assembly with the same name exists in the global assembly cache.\n\nResorting to loading the assembly in 'reflection only' mode which disables dependency resolving which can make certain type evaluations impossible.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                assembly         = Assembly.ReflectionOnlyLoadFrom(AssemblyPath);
                IsReflectionOnly = true;
            }

            BindingFlags all     = BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance;
            BindingFlags statics = BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static;

            TreeNode nAssembly = new TreeNode(assembly.GetName().Name);
            nAssembly.Tag = 0L;

            TreeNode nResources = nAssembly.Nodes.Add("Resources");
            nResources.Tag = 0L;

            //Enumerate Win32 resources
            try
            {
                IntPtr AssemblyHandle = LoadLibraryEx(AssemblyPath, IntPtr.Zero, LoadLibraryFlags.LOAD_LIBRARY_AS_DATAFILE);
                if (AssemblyHandle == IntPtr.Zero)
                {
                    throw new Exception();
                }
                EnumResourceTypes(AssemblyHandle, new EnumResTypeProc((IntPtr hModule, IntPtr lpszType, IntPtr lParam) =>
                {
                    try { lpszType.ToInt32(); } catch (Exception) { return(true); }
                    EnumResourceNames(hModule, lpszType.ToInt32(), new EnumResNameProc((IntPtr hModule2, IntPtr lpszType2, IntPtr lpzName, IntPtr lParam2) =>
                    {
                        ResType rt       = unchecked ((ResType)(long)lpszType2);
                        IntPtr hResource = FindResource(hModule2, lpzName, lpszType2);
                        long Size        = SizeofResource(hModule2, hResource);

                        string name        = System.Runtime.InteropServices.Marshal.PtrToStringUni(lpzName);
                        TreeNode nResource = nResources.Nodes.Add("Resource: " + rt.ToString() + " " + (name == null ? "#" + lpzName.ToInt64() : name));
                        SetNodeTag(nResource, Size);

                        return(true);
                    }), IntPtr.Zero);
                    return(true);
                }), IntPtr.Zero);
                FreeLibrary(AssemblyHandle);
            }
            catch (Exception) { } //ignore Win32 resources

            //Enumerate manifest resources
            foreach (string mr in assembly.GetManifestResourceNames())
            {
                ResourceLocation rl = assembly.GetManifestResourceInfo(mr).ResourceLocation;
                if ((rl & ResourceLocation.Embedded) == 0 || (rl & ResourceLocation.ContainedInAnotherAssembly) != 0)
                {
                    continue;
                }
                TreeNode nResource = nResources.Nodes.Add("Manifest Resource: " + mr);
                Stream   mrs       = assembly.GetManifestResourceStream(mr);
                SetNodeTag(nResource, mrs.Length);
                mrs.Dispose();
            }

            foreach (Module module in assembly.GetModules())
            {
                foreach (MethodInfo mi in module.GetMethods(all))
                {
                    AddMethodNode(nAssembly, mi);
                }

                int lenModuleFields = 0;
                foreach (FieldInfo fi in module.GetFields(all))
                {
                    lenModuleFields += Overhead_Field + fi.Name.Length;
                }
                if (lenModuleFields != 0)
                {
                    TreeNode nModuleInfo = nAssembly.Nodes.Add(module.GetFields(all).Length.ToString() + " Fields in " + module.Name + " (Overhead)"); SetNodeTag(nModuleInfo, lenModuleFields);
                }
            }

            Type[] AssemblyTypes;
            try { AssemblyTypes = assembly.GetTypes(); }
            catch (ReflectionTypeLoadException e) { AssemblyTypes = e.Types; }

            int UnresolvedTypes = 0;
            foreach (Type type in AssemblyTypes)
            {
                if (type == null)
                {
                    UnresolvedTypes++; continue;
                }
                TreeNode nType = nAssembly;
                bool     IsStaticArrayInitType = type.Name.Contains("StaticArrayInitTypeSize=");
                foreach (string NSPart in type.FullName.Split('.', '+'))
                {
                    if (nType.Nodes.ContainsKey(NSPart))
                    {
                        nType = nType.Nodes[NSPart];
                    }
                    else
                    {
                        (nType = nType.Nodes.Add(NSPart, NSPart)).Tag = 0L;
                    }
                }

                int lenType = Overhead_Type + type.FullName.Length;
                try { foreach (Type it in type.GetInterfaces())
                      {
                          lenType += Overhead_InterfaceImpl;
                      }
                } catch { }
                #if DOTNET35
                try { foreach (object ca in type.GetCustomAttributes(false))
                      {
                          lenType += Overhead_CustomAttribute;
                      }
                } catch { }
                #else
                try { foreach (CustomAttributeData ad in type.GetCustomAttributesData())
                      {
                          lenType += Overhead_CustomAttribute;
                      }
                } catch { }
                #endif
                SetNodeTag(nType, lenType);

                foreach (FieldInfo fi in type.GetFields(statics))
                {
                    try
                    {
                        if (fi.FieldType.ContainsGenericParameters || fi.FieldType.IsGenericType)
                        {
                            continue;
                        }
                        long fiSize = CalculateSize(IsReflectionOnly, fi.FieldType, fi);
                        if (fiSize > 0)
                        {
                            SetNodeTag(nType.Nodes.Add("Static Field: " + fi.Name), fiSize);
                        }
                    }
                    catch (Exception) { }
                }

                int numTypeFields = 0, numTypeProperties = 0, numTypeEvents = 0, lenTypeFields = 0, lenTypeProperties = 0, lenTypeEvents = 0;
                foreach (FieldInfo fi in type.GetFields(all))
                {
                    numTypeFields++;     lenTypeFields += Overhead_Field + fi.Name.Length;
                }
                foreach (PropertyInfo pi in type.GetProperties(all))
                {
                    numTypeProperties++; lenTypeProperties += Overhead_Property + (pi.Name == null ? 0 : pi.Name.Length);
                }
                foreach (EventInfo ei in type.GetEvents(all))
                {
                    numTypeEvents++;     lenTypeEvents += Overhead_Event + ei.Name.Length;
                }
                if (lenTypeFields != 0)
                {
                    SetNodeTag(nType.Nodes.Add(numTypeFields.ToString() + " Fields (Overhead)"), lenTypeFields);
                }
                if (lenTypeProperties != 0)
                {
                    SetNodeTag(nType.Nodes.Add(numTypeProperties.ToString() + " Properties (Overhead)"), lenTypeProperties);
                }
                if (lenTypeEvents != 0)
                {
                    SetNodeTag(nType.Nodes.Add(numTypeEvents.ToString() + " Events (Overhead)"), lenTypeEvents);
                }

                foreach (ConstructorInfo ci in type.GetConstructors(all))
                {
                    AddMethodNode(nType, ci);
                }
                foreach (MethodInfo mi in type.GetMethods(all))
                {
                    AddMethodNode(nType, mi);
                }
            }

            SetNodeTag(nAssembly.Nodes.Add("Other Overhead"), AssemblySize - (long)nAssembly.Tag);
            SortByNodeByTag(nAssembly.Nodes);
            //FilterNodeByTag(nAssembly.Nodes, AssemblySize/100);
            nAssembly.Expand();
            tv.Nodes.Add(nAssembly);

            if (UnresolvedTypes != 0)
            {
                MessageBox.Show(UnresolvedTypes.ToString() + " types could not be evaluated due to missing dependency errors.\nThese are included in the 'Other Overhead' entry.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
        catch (Exception e)
        {
            MessageBox.Show("Assembly loading error:\n\n" + e.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            if (InitialLoad)
            {
                f.Close();
            }
        }
    }