public static void Parse() { var packagePath = string.Format("{0}/../UIProject/UIProject", Application.dataPath); var outputPath = string.Format("{0}/../Output", packagePath); PackageLoader.Load(packagePath, outputPath); }
private static void ExtractPkg(FileInfo file, bool appendFolderName = false, string defaultProjectName = "") { Console.WriteLine(Resources.ExtractingPackage, file.FullName); // Load package var loader = new PackageLoader(true); var package = loader.Load(file); // Get output directory string outputDirectory; var preview = string.Empty; if (appendFolderName) { GetProjectFolderNameAndPreviewImage(file, defaultProjectName, out outputDirectory, out preview); } else { outputDirectory = _options.OutputDirectory; } // Extract package entries var entries = FilterEntries(package.Entries); foreach (var entry in entries) { ExtractEntry(entry, ref outputDirectory); } // Copy project files project.json/preview image if (!_options.CopyProject || _options.SingleDir || file.Directory == null) { return; } var files = file.Directory.GetFiles().Where(x => x.Name.Equals(preview, StringComparison.OrdinalIgnoreCase) || ProjectFiles.Contains(x.Name, StringComparer.OrdinalIgnoreCase)); CopyFiles(files, outputDirectory); }
private static void InfoPKG(FileInfo file, string name) { var projectInfo = GetProjectInfo(file); if (!MatchesFilter(projectInfo)) { return; } Console.WriteLine(Resources.InfoAboutPackage, name); if (projectInfo != null && _projectInfoToPrint != null && _projectInfoToPrint.Length > 0) { IEnumerable <string> projectInfoEnumerator; if (_projectInfoToPrint.Length == 1 && _projectInfoToPrint[0] == "*") { projectInfoEnumerator = Helper.GetPropertyKeysForDynamic(projectInfo); } else { projectInfoEnumerator = Helper.GetPropertyKeysForDynamic(projectInfo); projectInfoEnumerator = projectInfoEnumerator.Where(x => _projectInfoToPrint.Contains(x, StringComparer.OrdinalIgnoreCase)); } foreach (var key in projectInfoEnumerator) { if (projectInfo[key] == null) { Console.WriteLine(key + @": null"); } else { Console.WriteLine(key + @": " + projectInfo[key].ToString()); } } } if (_options.PrintEntries) { Console.WriteLine(Resources.PackageEntries); var loader = new PackageLoader(false); var package = loader.Load(file); var entries = package.Entries; if (_options.Sort) { if (_options.SortBy == "extension") { entries.Sort((a, b) => String.Compare(a.EntryPath, b.EntryPath, StringComparison.OrdinalIgnoreCase)); } else if (_options.SortBy == "size") { entries.Sort((a, b) => a.Length.CompareTo(b.Length)); } else { entries.Sort((a, b) => String.Compare(a.EntryPath, b.EntryPath, StringComparison.OrdinalIgnoreCase)); } } foreach (var entry in entries) { Console.WriteLine(@"* " + entry.FullName + $@" - {entry.Length} bytes"); } } }