public static string Serialize <T>(T obj)
 {
     if (obj == null)
     {
         CLog.LogError("Serialize obj can not null!");
         return(null);
     }
     try
     {
         IFormatter   formatter = new BinaryFormatter();
         MemoryStream ms        = new MemoryStream();
         formatter.Serialize(ms, obj);
         ms.Position = 0;
         byte[] buffer = new byte[ms.Length];
         ms.Read(buffer, 0, buffer.Length);
         ms.Flush();
         ms.Close();
         return(Convert.ToBase64String(buffer));
     }
     catch (Exception ex)
     {
         throw new Exception("Serialize fail,reason:" + ex.Message);
     }
 }
        public void Init(string assetBundleEntryXmlContent)
        {
            try
            {
                XmlDocument document = new XmlDocument();
                document.LoadXml(assetBundleEntryXmlContent);

                foreach (XmlElement element in document.FirstChild.NextSibling.ChildNodes)
                {
                    if (element.Name == "AssetMappings")
                    {
                        mainAssetBundlePath = element.GetAttribute("manifest");
                        foreach (XmlElement mapping in element.ChildNodes)
                        {
                            assetPathToAssetBundleNames.Add(mapping.GetAttribute("assetName"), mapping.GetAttribute("bundleName"));
                        }
                    }
                }
            }
            catch (Exception e)
            {
                CLog.LogError(e.Message + "," + e.StackTrace);
            }
        }
示例#3
0
 public static void LogError(string msg)
 {
     CLog.LogError(msg);
 }
示例#4
0
 public static void LogWarn(string msg)
 {
     CLog.LogWarn(msg);
 }
 public static void Log(string msg)
 {
     CLog.Log(msg);
 }