Exemplo n.º 1
0
        private bool ParseFoundFiles()
        {
            bool writeCache = false;

            // parse files
            int n = foundFiles.Count;
            NotifyProgress(String.Format(TextHelper.GetString("Info.Parsing"), n), 0, n);
            FileModel aFile = null;
            string basePath = "";
            string packagePath = "";
            int cpt = 0;
            string filename;
            for (int i = 0; i < n; i++)
            {
                if (stopExploration) return writeCache;
                // parse
                filename = foundFiles[i] as string;
                if (!File.Exists(filename))
                    continue;
                if (pathModel.HasFile(filename))
                {
                    FileModel cachedModel = pathModel.GetFile(filename);
                    if (cachedModel.OutOfDate)
                    {
                        cachedModel.Check();
                        writeCache = true;
                    }
                    continue;
                }
                else writeCache = true;

                aFile = GetFileModel(filename); //ASContext.Panel.Invoke(new GetFileModelHandler(GetFileModel), new object[] { filename }) as FileModel;

                if (aFile == null || pathModel.HasFile(filename)) continue;
                // store model
                basePath = Path.GetDirectoryName(filename);
                if (aFile.Package != "")
                {
                    packagePath = '\\' + aFile.Package.Replace('.', '\\');
                    if (basePath.EndsWith(packagePath))
                        basePath = basePath.Substring(0, basePath.Length - packagePath.Length);
                }
                basePath += "\\";
                lock (pathModel.Files) { pathModel.Files[aFile.FileName.ToUpper()] = aFile; }
                aFile = null;
                cpt++;
                // update status
                if (stopExploration) return writeCache;
                if (i % 10 == 0) NotifyProgress(String.Format(TextHelper.GetString("Info.Parsing"), n), i, n);
                Thread.Sleep(1);
            }
            return writeCache;
        }
Exemplo n.º 2
0
        private bool ParseFoundFiles()
        {
            bool writeCache = false;

            // parse files
            int n = foundFiles.Count;

            NotifyProgress(String.Format(TextHelper.GetString("Info.Parsing"), n), 0, n);
            FileModel aFile = null;
            int       cpt   = 0;
            string    filename;

            for (int i = 0; i < n; i++)
            {
                if (stopExploration)
                {
                    return(writeCache);
                }
                // parse
                filename = foundFiles[i];
                if (!File.Exists(filename))
                {
                    continue;
                }
                if (pathModel.HasFile(filename))
                {
                    FileModel cachedModel = pathModel.GetFile(filename);
                    if (cachedModel.OutOfDate)
                    {
                        cachedModel.Check();
                        writeCache = true;
                    }
                    continue;
                }
                else
                {
                    writeCache = true;
                }

                aFile = GetFileModel(filename);

                if (aFile == null || pathModel.HasFile(filename))
                {
                    continue;
                }
                // store model
                if (aFile.Context.IsModelValid(aFile, pathModel))
                {
                    pathModel.AddFile(aFile);
                }
                aFile = null;
                cpt++;
                // update status
                if (stopExploration)
                {
                    return(writeCache);
                }
                if (i % 10 == 0)
                {
                    NotifyProgress(String.Format(TextHelper.GetString("Info.Parsing"), n), i, n);
                }
                Thread.Sleep(1);
            }
            return(writeCache);
        }