public ActionResult BundleView(string path) { path = Server.UrlDecode(path); BundleInformation bundleInfo = new BundleInformation(); try { using (ZipFile zipFile = new ZipFile(getFileStream(path))) { foreach (ZipEntry zipEntry in zipFile) { if (zipEntry.IsFile) { if (zipEntry.Name.Length > 0 && zipEntry.Name.ToLower() == ("Manifest.xml").ToLower()) { bundleInfo.BundlePath = path; Stream zipStream = zipFile.GetInputStream(zipEntry); XmlDocument doc = new XmlDocument(); doc.Load(zipStream); XmlDocument tmpXml = new XmlDocument(); XmlNode imgs = doc.GetElementsByTagName("Images")[0]; for (int i = 0; i < imgs.ChildNodes.Count; i++) { ImageInformation imageInfo = new ImageInformation(); imageInfo.BundlePath = bundleInfo.BundlePath; foreach (XmlNode xn in imgs.ChildNodes[i]) { if (xn.Name == "Name") { imageInfo.Name = xn.InnerText; } if (xn.Name == "Original") { tmpXml.LoadXml(xn.OuterXml); imageInfo.Original = tmpXml.GetElementsByTagName("File")[0].InnerText; } if (xn.Name == "Thumbnail") { tmpXml.LoadXml(xn.OuterXml); imageInfo.Thumbnail = tmpXml.GetElementsByTagName("File")[0].InnerText; } } imageInfo.Measurements = getMeasurements(path, imageInfo.Name); bundleInfo.Images.Add(imageInfo); } } } } } return(PartialView("_bundleView", bundleInfo)); } catch { return(null); } }
private Dictionary <string, string> LoadGameBundles() { Game1.content.Load <Dictionary <string, string> >(@"Data\Bundles"); var loadedAssets = Game1.content.GetField <Dictionary <string, object> >("loadedAssets"); var bundles = (Dictionary <string, string>)loadedAssets[@"Data\Bundles"]; foreach (var kv in bundles) { _bundleInformations.Add(BundleInformation.Parse(kv.Value, kv.Key)); } return(bundles); }
public static BundleInformation[] GetBundleInformationById(string path) { List <BundleInformation> result = new List <BundleInformation>(); SQLiteConnection con = GetConnection(); con.Open(); SQLiteDataReader reader = getAllJoinedWhere("bundles", "tocfiles", "tocfile", "id", "lower(bundles.frostid) = '" + path.ToLower() + "'", con); int count = 0; while (reader.Read()) { if (count++ % 1000 == 0) { Application.DoEvents(); } BundleInformation bi = new BundleInformation(); bi.index = reader.GetInt32(0); bi.tocIndex = reader.GetInt32(1); bi.bundlepath = reader.GetString(2).ToLower(); bi.offset = reader.GetInt32(3); bi.size = reader.GetInt32(4); bi.isbase = reader.GetString(5) == "True"; bi.isdelta = reader.GetString(6) == "True"; bi.filepath = reader.GetString(8).ToLower(); bi.incas = reader.GetString(10) == "True"; switch (reader.GetString(11)) { case "b": bi.isbasegamefile = true; break; case "u": bi.isDLC = true; break; case "p": bi.isPatch = true; break; } result.Add(bi); } con.Close(); return(result.ToArray()); }
public static BundleInformation GetBundleInformationByIndex(int index) { BundleInformation result = new BundleInformation(); result.tocIndex = -1; SQLiteConnection con = GetConnection(); con.Open(); SQLiteDataReader reader = getAllJoinedWhere("bundles", "tocfiles", "tocfile", "id", "bundles.id = " + index, con, "frostid"); if (reader.Read()) { BundleInformation bi = new BundleInformation(); bi.index = reader.GetInt32(0); bi.tocIndex = reader.GetInt32(1); bi.bundlepath = reader.GetString(2).ToLower(); bi.offset = reader.GetInt32(3); bi.size = reader.GetInt32(4); bi.isbase = reader.GetString(5) == "True"; bi.isdelta = reader.GetString(6) == "True"; bi.filepath = reader.GetString(8).ToLower(); bi.incas = reader.GetString(10) == "True"; switch (reader.GetString(11)) { case "b": bi.isbasegamefile = true; break; case "u": bi.isDLC = true; break; case "p": bi.isPatch = true; break; } result = bi; } con.Close(); return(result); }
public static BundleInformation GetBundleInformationByIndex(int index) { BundleInformation result = new BundleInformation(); result.tocIndex = -1; SQLiteConnection con = GetConnection(); con.Open(); SQLiteDataReader reader = getAllJoinedWhere("bundles", "tocfiles", "tocfile", "id", "bundles.id = " + index, con, "frostid"); if (reader.Read()) { BundleInformation bi = new BundleInformation(); bi.index = reader.GetInt32(0); bi.tocIndex = reader.GetInt32(1); bi.bundlepath = reader.GetString(2).ToLower(); bi.offset = reader.GetInt32(3); bi.size = reader.GetInt32(4); bi.isbase = reader.GetString(5) == "True"; bi.isdelta = reader.GetString(6) == "True"; bi.filepath = reader.GetString(8).ToLower(); bi.incas = reader.GetString(10) == "True"; switch (reader.GetString(11)) { case "b": bi.isbasegamefile = true; break; case "u": bi.isDLC = true; break; case "p": bi.isPatch = true; break; } result = bi; } con.Close(); return result; }
public static BundleInformation[] GetBundleInformationById(string path) { List<BundleInformation> result = new List<BundleInformation>(); SQLiteConnection con = GetConnection(); con.Open(); SQLiteDataReader reader = getAllJoinedWhere("bundles", "tocfiles", "tocfile", "id", "lower(bundles.frostid) = '" + path.ToLower() + "'", con); int count = 0; while (reader.Read()) { if (count++ % 1000 == 0) Application.DoEvents(); BundleInformation bi = new BundleInformation(); bi.index = reader.GetInt32(0); bi.tocIndex = reader.GetInt32(1); bi.bundlepath = reader.GetString(2).ToLower(); bi.offset = reader.GetInt32(3); bi.size = reader.GetInt32(4); bi.isbase = reader.GetString(5) == "True"; bi.isdelta = reader.GetString(6) == "True"; bi.filepath = reader.GetString(8).ToLower(); bi.incas = reader.GetString(10) == "True"; switch (reader.GetString(11)) { case "b": bi.isbasegamefile = true; break; case "u": bi.isDLC = true; break; case "p": bi.isPatch = true; break; } result.Add(bi); } con.Close(); return result.ToArray(); }
public void QueueMe(BundleInformation bundleInformation, Action <AssetBundle> onSuccess, Action onFailed = null) { bundleQueue.Enqueue(new BundleQueueItem(bundleInformation, onSuccess, onFailed)); StartCoroutine(LoadingQueue()); }
public BundleQueueItem(BundleInformation bundleInformation, Action <AssetBundle> onSuccess, Action onFailed = null) { this.bundleInformation = bundleInformation; this.onSuccess = onSuccess; this.onFailed = onFailed; }
private static void TestParsing(string value) { var bundleInformation = BundleInformation.Parse(value); Assert.AreEqual(value, bundleInformation.ToString()); }