Exemplo n.º 1
0
        /// <summary>
        /// Parse a packaged library file
        /// </summary>
        /// <param name="path">Models owner</param>
        public override void ExploreVirtualPath(PathModel path)
        {
            if (path.WasExplored)
            {
                if (MxmlFilter.HasCatalog(path.Path))
                {
                    MxmlFilter.AddCatalog(path.Path);
                }

                if (path.FilesCount != 0) // already parsed
                {
                    return;
                }
            }

            try
            {
                if (File.Exists(path.Path) && !path.WasExplored)
                {
                    bool isRefresh = path.FilesCount > 0;
                    //TraceManager.AddAsync("parse " + path.Path);
                    lock (path)
                    {
                        path.WasExplored = true;
                        SwfOp.ContentParser parser = new SwfOp.ContentParser(path.Path);
                        parser.Run();
                        AbcConverter.Convert(parser, path, this);
                    }
                    // reset FCSH
                    if (isRefresh)
                    {
                        EventManager.DispatchEvent(this,
                                                   new DataEvent(EventType.Command, "ProjectManager.RestartFlexShell", path.Path));
                    }
                }
            }
            catch (Exception ex)
            {
                string message = TextHelper.GetString("Info.ExceptionWhileParsing");
                TraceManager.AddAsync(message + " " + path.Path);
                TraceManager.AddAsync(ex.Message);
                TraceManager.AddAsync(ex.StackTrace);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Extract documentation from XML included in ASDocs-enriched SWCs
        /// </summary>
        /// <param name="rawDocs"></param>
        private static void ParseDocumentation(ContentParser parser)
        {
            if (parser.Catalog != null)
            {
                MxmlFilter.AddCatalog(parser.Filename, parser.Catalog);
            }

            if (parser.Docs.Count > 0)
            {
                foreach (string docFile in parser.Docs.Keys)
                {
                    if (docFile.EndsWith(".dita.xml"))
                    {
                        continue;
                    }
                    try
                    {
                        Match m = reDocFile.Match(docFile);
                        if (!m.Success)
                        {
                            continue;
                        }
                        string package = m.Groups[1].Value;
                        Dictionary <string, ASDocItem> packageDocs = Docs.ContainsKey(package)
                            ? Docs[package]
                            : new Dictionary <string, ASDocItem>();

                        byte[]       rawDoc = parser.Docs[docFile];
                        ASDocsReader dr     = new ASDocsReader(rawDoc);
                        dr.ExcludedASDocs = ExcludedASDocs;
                        dr.Parse(packageDocs);

                        Docs[package] = packageDocs;
                    }
                    catch (Exception)
                    {
                    }
                }
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Parse a packaged library file
        /// </summary>
        /// <param name="path">Models owner</param>
        public override void ExploreVirtualPath(PathModel path)
        {
            if (path.WasExplored)
            {
                if (MxmlFilter.HasCatalog(path.Path))
                {
                    MxmlFilter.AddCatalog(path.Path);
                }

                if (path.Files.Count != 0) // already parsed
                {
                    return;
                }
            }

            try
            {
                if (File.Exists(path.Path) && !path.WasExplored)
                {
                    //TraceManager.AddAsync("parse " + path.Path);
                    lock (path)
                    {
                        path.WasExplored = true;
                        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);
            }
        }