Example #1
0
        public AsarExtractEvent(AsarFile file, double index, double total)
        {
            File  = file;
            Index = index;
            Total = total;

            Progress = Math.Round(index / total * 100, 2);
        }
Example #2
0
        private void TokenIterator(JToken token)
        {
            var property = token as JProperty;

            foreach (var jToken in property.Value.Children())
            {
                var prop   = (JProperty)jToken;
                var size   = -1;
                var offset = -1;
                foreach (var jToken1 in prop.Value.Children())
                {
                    var nextProp = (JProperty)jToken1;
                    if (nextProp.Name == "files")
                    {
                        /* ENABLE FOR EMPTY FOLDERS (ONLY IF NEEDED) */
                        if (_emptyDir)
                        {
                            Console.WriteLine($"PROP PATH: {prop.Path}");
                            var afile = new AsarFile(prop.Path, "", size, offset);
                            _filesToExtract.Add(afile);
                        }

                        TokenIterator(nextProp);
                    }
                    else
                    {
                        if (nextProp.Name == "size")
                        {
                            size = int.Parse(nextProp.Value.ToString());
                        }
                        else if (nextProp.Name == "offset")
                        {
                            offset = int.Parse(nextProp.Value.ToString());
                        }
                    }
                }

                if (size <= -1 || offset <= -1)
                {
                    continue;
                }
                {
                    var afile = new AsarFile(prop.Path, prop.Name, size, offset);
                    _filesToExtract.Add(afile);
                }
            }
        }