Example #1
0
        public void extractFile(string file)
        {
            extracted = false;
            if (Application.platform == RuntimePlatform.WebGLPlayer)
            {
                Debug.LogWarning("Extraction is not allowed in browser!");
                return;
            }


            string[] dir      = file.Split(System.IO.Path.DirectorySeparatorChar);
            string   filename = dir[dir.Length - 1].Split('.')[0];

            string exportLocation = getCurrentDirectory() + System.IO.Path.DirectorySeparatorChar + "Games" + System.IO.Path.DirectorySeparatorChar + filename;

            ZipUtil.Unzip(file, exportLocation);

            foreach (string f in System.IO.Directory.GetFiles(exportLocation))
            {
                if (!f.Contains(".xml"))
                {
                    System.IO.File.Delete(f);
                }
            }

            string[] tmp;
            foreach (string f in System.IO.Directory.GetDirectories(exportLocation))
            {
                tmp = f.Split(System.IO.Path.DirectorySeparatorChar);
                if (tmp[tmp.Length - 1] != "assets" && tmp[tmp.Length - 1] != "gui")
                {
                    System.IO.Directory.Delete(f, true);
                }
            }

            VideoConverter converter = new VideoConverter();

            foreach (string video in System.IO.Directory.GetFiles(exportLocation + "/assets/video/"))
            {
                converter.Convert(video);
            }
            extracted = true;
        }
Example #2
0
        public void extractFile(string file)
        {
            extracted = false;
#if !(UNITY_WEBPLAYER || UNITY_WEBGL)
            string[] dir      = file.Split(System.IO.Path.DirectorySeparatorChar);
            string   filename = dir[dir.Length - 1].Split('.')[0];

            string exportLocation = getCurrentDirectory() + System.IO.Path.DirectorySeparatorChar + "Games" + System.IO.Path.DirectorySeparatorChar + filename;

            ZipUtil.Unzip(file, exportLocation);

            foreach (string f in System.IO.Directory.GetFiles(exportLocation))
            {
                if (!f.Contains(".xml"))
                {
                    System.IO.File.Delete(f);
                }
            }

            string[] tmp;
            foreach (string f in System.IO.Directory.GetDirectories(exportLocation))
            {
                tmp = f.Split(System.IO.Path.DirectorySeparatorChar);
                if (tmp[tmp.Length - 1] != "assets" && tmp[tmp.Length - 1] != "gui")
                {
                    System.IO.Directory.Delete(f, true);
                }
            }

            VideoConverter converter = new VideoConverter();
            foreach (string video in System.IO.Directory.GetFiles(exportLocation + "/assets/video/"))
            {
                converter.Convert(video);
            }

            extracted = true;
#endif
        }