Ejemplo n.º 1
0
 public void Load()
 {
     loading = true;
     if (!string.IsNullOrEmpty(name) && name != "empty")
     {
         string path = string.Empty;
         path = CDirectory.MakeCachePath(name);
         if (!File.Exists(path))
         {
             path = CDirectory.MakeOtherStreamingPath(name);
         }
         if (this.name.EndsWith(".txt"))
         {
             this.text = new StringBuilder(File.ReadAllText(path));
         }
         else
         {
             this.asset_bundle = AssetBundle.CreateFromFile(path);
         }
         //this.complete = true;
     }
     if (!string.IsNullOrEmpty(name))
     {
         this.complete = true;
     }
 }
Ejemplo n.º 2
0
    IEnumerator WWWLoadAssembly()
    {
        yield return(null);

        string path = CDirectory.MakeCachePath(_DllPath);

        if (!File.Exists(path))
        {
            using (var www = new WWW(CDirectory.MakeWWWStreamPath(_DllPath)))
            {
                yield return(www);

                if (!string.IsNullOrEmpty(www.error))
                {
                    throw new Exception(string.Format("WWW download:" + www.error + "  path :  " + www.url));
                }
                Directory.CreateDirectory(Path.GetDirectoryName(path));
                File.WriteAllBytes(path, www.bytes);
            }
        }
        System.Reflection.Assembly assembly = null;
#if ZTK
        assembly = ZToolKit.LoadAssembly(path);
#else
        FileStream stream = File.Open(path, FileMode.Open);
        byte[]     buffer = new byte[stream.Length];
        stream.Read(buffer, 0, (int)stream.Length);
        stream.Close();
        assembly = System.Reflection.Assembly.Load(buffer);
#endif

        this.game = (IGame)assembly.CreateInstance("CGame");
        this.game.StartGame();
    }
Ejemplo n.º 3
0
    IEnumerator WWWLoadLanguage()
    {
        yield return(null);

        string path = CDirectory.MakeCachePath(language);

        if (!File.Exists(path) || Application.isEditor)
        {
            using (var www = new WWW(CDirectory.MakeWWWStreamPath(language)))
            {
                yield return(www);

                if (!string.IsNullOrEmpty(www.error))
                {
                    throw new Exception(string.Format("WWW download:" + www.error + "  path :  " + www.url));
                }
                Directory.CreateDirectory(Path.GetDirectoryName(path));
                File.WriteAllBytes(path, www.bytes);
            }
        }

        byte[] bytes = File.ReadAllBytes(path);
        Localization.language = "language";
        Localization.LoadCSV(bytes);

        LoadDll();
    }
Ejemplo n.º 4
0
            private void DumpToFile()
            {
                if (string.IsNullOrEmpty(filePath))
                {
                    if (!Directory.Exists(CDirectory.MakeCachePath("resdump")))
                    {
                        Directory.CreateDirectory(CDirectory.MakeCachePath("resdump"));
                    }
                    filePath = CDirectory.MakeCachePath(string.Format("resdump/{0}.txt", DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss")));
                }

                StreamWriter writer = File.AppendText(filePath);

                foreach (var c in factory.cookies.Values)
                {
                    if (c.count == 0)
                    {
                        c.create_time = Time.realtimeSinceStartup;
                        continue;
                    }
                    writer.WriteLine(c.ToLogString());
                }
                writer.Close();
            }