bool OpenVirtualFileModel(string virtualPath) { var p = virtualPath.IndexOfOrdinal("::"); if (p < 0) { return(false); } var container = virtualPath.Substring(0, p); if (!File.Exists(container)) { return(false); } var ext = Path.GetExtension(container).ToLower(); if (ext == ".swf" || ext == ".swc") { var fileName = Path.Combine(container, virtualPath.Substring(p + 2).Replace('.', Path.DirectorySeparatorChar)); var path = new PathModel(container, contextInstance); var parser = new ContentParser(path.Path); parser.Run(); AbcConverter.Convert(parser, path, contextInstance); if (!path.HasFile(fileName)) { return(false); } var model = path.GetFile(fileName); ASComplete.OpenVirtualFile(model); return(true); } return(false); }
private static PathModel ParseSWC(string swcFile) { PathModel path = new PathModel(System.IO.Path.GetFullPath(swcFile), context); if (!File.Exists(swcFile)) { Console.WriteLine("Error: missing {0}, copy Flex SDK's lib directory", swcFile); return(path); } SwfOp.ContentParser parser = new SwfOp.ContentParser(path.Path); parser.Run(); AbcConverter.Convert(parser.Abcs, path, context); return(path); }
/// <summary> /// Parse a packaged library file /// </summary> /// <param name="path">Models owner</param> public override void ExploreVirtualPath(PathModel path) { try { if (File.Exists(path.Path)) { SwfOp.ContentParser parser = new SwfOp.ContentParser(path.Path); parser.Run(); AbcConverter.Convert(parser, path, this); } } catch (Exception ex) { string message = TextHelper.GetString("Info.ExceptionWhileParsing"); TraceManager.AddAsync(message + " " + path.Path); TraceManager.AddAsync(ex.Message); } }