private void LoadCabinet() { if (webFile.State == StateType.Error) { Script.Literal("alert({0})", webFile.Message); } else if (webFile.State == StateType.Received) { mainBlob = (System.Html.Data.Files.Blob)webFile.GetBlob(); FileReader chunck = new FileReader(); chunck.OnLoadEnd = delegate(System.Html.Data.Files.FileProgressEvent e) { int offset = GetSize((string)chunck.Result); FileReader header = new FileReader(); header.OnLoadEnd = delegate(System.Html.Data.Files.FileProgressEvent ee) { string data = header.Result as string; XmlDocumentParser xParser = new XmlDocumentParser(); Extract(xParser.ParseFromString(data, "text/xml"), offset); callMe(); }; header.ReadAsText(mainBlob.Slice(0, offset)); }; chunck.ReadAsText(mainBlob.Slice(0, 255)); } }
public Blob GetFileBlob(string filename) { FileEntry fe = GetFileEntry(filename); if (fe != null) { string ext = filename.Substr(filename.LastIndexOf(".")).ToLowerCase(); string type = null; switch (ext) { case ".png": type = "image/png"; break; case ".jpg": case ".jpeg": type = "image/jpeg"; break; case ".mp3": type = "audio/mpeg3"; break; } return(mainBlob.Slice(fe.Offset, fe.Offset + fe.Size, type)); } return(null); }