Ejemplo n.º 1
0
        public PackageCacheService(string root, string packageCachePath) : base(ThreadPriority.Lowest, TimeSpan.FromMilliseconds(1000), TimeSpan.FromMinutes(10), TimeSpan.FromSeconds(15))
        {
            this.root             = root;
            this.packageCachePath = packageCachePath;
            this.logWriter        = new LogWriter(Path.Combine(this.packageCachePath, "Log.txt"));

            sweepsPath                 = Path.Combine(packageCachePath, "sweeps");
            nodeModulesPath            = Path.Combine(root, "node_modules");
            pathsToProcess             = new List <string>();
            pathsToNotProcess          = new List <string>();
            pathsProcessed             = new Dictionary <string, List <PathCacheStatus> >();
            installsFromCacheToProcess = new Dictionary <string, PackageWorkingInstallFromCache>();
            statusStack                = new Stack <CacheStatusType>();
            cacheStatusType            = CacheStatusType.Initialized;
            lockObject                 = LockManager.CreateObject();
            memoryStatus               = MemoryStatus.Create();
            currentActionVerb          = "No current action";
            packageModules             = new NpmNodeModules(nodeModulesPath);

            this.NothingToPoll = true;

            if (!Directory.Exists(nodeModulesPath))
            {
                Directory.CreateDirectory(nodeModulesPath);
            }

            fileSystemWatcher = new FileSystemWatcher(nodeModulesPath);
            fileSystemWatcher.EnableRaisingEvents = true;

            fileSystemWatcher.Created += FileSystemWatcher_Created;
            fileSystemWatcher.Changed += FileSystemWatcher_Changed;
        }
Ejemplo n.º 2
0
        public FolderViewService(ListView listViewFolders, string packageCachePath, int updateCount = 100) : base(ThreadPriority.Normal, 100, 20000, 20000)
        {
            cacheDirectory = new DirectoryInfo(packageCachePath);

            lockObject = LockManager.CreateObject();

            backingList = cacheDirectory.GetFileSystemInfos().OrderBy(i => i is FileInfo ? 1 : 0).ThenBy(i => i.Name).ToList();

            this.listViewFolders  = listViewFolders;
            this.updateCount      = updateCount;
            this.packageCachePath = packageCachePath;

            fileSystemWatcher = new FileSystemWatcher(packageCachePath);
            fileSystemWatcher.EnableRaisingEvents = true;

            fileSystemWatcher.Created += FileSystemWatcher_Created;
            fileSystemWatcher.Changed += FileSystemWatcher_Changed;
            fileSystemWatcher.Deleted += FileSystemWatcher_Deleted;

            this.listViewFolders.VirtualListSize = backingList.Count;
            this.listViewFolders.VirtualMode     = true;
            this.listViewFolders.Scrollable      = true;

            listViewFolders.RetrieveVirtualItem += ListViewFolders_RetrieveVirtualItem;
        }
Ejemplo n.º 3
0
 internal OleComponent()
 {
     lockObject = LockManager.CreateObject();
 }
Ejemplo n.º 4
0
        public SDKSymbolResolver()
        {
            var vcDirectory           = new DirectoryInfo(VSEnvironment.ExpandEnvironmentVariables("$(VCInstallDir)"));
            var crtDirectory          = new DirectoryInfo(VSEnvironment.ExpandEnvironmentVariables(@"$(VCInstallDir)crt\src"));
            var windowsSdkDirectory   = new DirectoryInfo(VSEnvironment.ExpandEnvironmentVariables("$(WindowsSdkDir)"));
            var atlmfcDirectory       = new DirectoryInfo(VSEnvironment.ExpandEnvironmentVariables(@"$(VCInstallDir)atlmfc"));
            var frameworkSdkDirectory = new DirectoryInfo(VSEnvironment.ExpandEnvironmentVariables(@"$(FrameworkSDKDir)"));
            var connectionString      = SDKLibraryConnection.ConnectionString;

            logFile = new FileInfo(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "SDKSymbolResolver.log"));

            if (logFile.Exists)
            {
                logFile.Delete();
            }

            versionRegex = new Regex(@"v?(?<version>\d+?\.\d+?\w*)");

            lockObject    = LockManager.CreateObject();
            searchManager = new SearchManager();
            searchManager.AddCatalog("MSVCInclude");

            entities          = new SdkInterfaceLibraryEntities(connectionString);
            tblSDKHeaderFiles = entities.tblSDKHeaderFiles;
            tblVendorSDKs     = entities.tblVendorSDKs;

            HeaderEntityExtensions.Entities    = entities;
            HeaderEntityExtensions.WriteLog   += new EventHandlerT <string>(HeaderEntityExtensions_WriteLog);
            HeaderEntityExtensions.IndentLog  += new EventHandler(HeaderEntityExtensions_IndentLog);
            HeaderEntityExtensions.OutdentLog += new EventHandler(HeaderEntityExtensions_OutdentLog);

            var tblMSVendor = entities.SaveIfNotExists <tblVendor>(v => v.VendorName == "Microsoft", () =>
            {
                return(new tblVendor
                {
                    VendorId = Guid.NewGuid(),
                    VendorName = "Microsoft"
                });
            });

            if (crtDirectory.Exists)
            {
                var version = string.Empty;

                if (versionRegex.IsMatch(crtDirectory.FullName))
                {
                    var match = versionRegex.Match(crtDirectory.FullName);

                    version = match.Groups["version"].Value;
                }

                var tblMSVendorSdk = entities.SaveIfNotExists <tblVendorSDK>(s => s.SdkName == "C Runtime Language" && s.SdkVersion == version, () =>
                {
                    return(new tblVendorSDK
                    {
                        VendorSdkId = Guid.NewGuid(),
                        VendorId = tblMSVendor.VendorId,
                        SdkName = "C Runtime Language",
                        SdkVersion = version,
                        SdkRootFolder = crtDirectory.FullName,
                        IncludeFolders = string.Empty,
                        SourceFolders = string.Empty,
                        LibraryFolders = string.Empty,
                        ExecutableFolders = string.Empty,
                    });
                });
            }

            if (vcDirectory.Exists)
            {
                var version = string.Empty;

                if (versionRegex.IsMatch(vcDirectory.FullName))
                {
                    var match = versionRegex.Match(vcDirectory.FullName);

                    version = match.Groups["version"].Value;
                }

                var tblMSVendorSdk = entities.SaveIfNotExists <tblVendorSDK>(s => s.SdkName == "Visual C++" && s.SdkVersion == version, () =>
                {
                    return(new tblVendorSDK
                    {
                        VendorSdkId = Guid.NewGuid(),
                        VendorId = tblMSVendor.VendorId,
                        SdkName = "Visual C++",
                        SdkVersion = version,
                        SdkRootFolder = vcDirectory.FullName,
                        IncludeFolders = "include",
                        SourceFolders = "src",
                        LibraryFolders = "lib",
                        ExecutableFolders = "bin",
                    });
                });
            }

            if (windowsSdkDirectory.Exists)
            {
                var version = string.Empty;

                if (versionRegex.IsMatch(vcDirectory.FullName))
                {
                    var match = versionRegex.Match(windowsSdkDirectory.FullName);

                    version = match.Groups["version"].Value;
                }

                var tblMSVendorSdk = entities.SaveIfNotExists <tblVendorSDK>(s => s.SdkName == "Windows SDK" && s.SdkVersion == version, () =>
                {
                    return(new tblVendorSDK
                    {
                        VendorSdkId = Guid.NewGuid(),
                        VendorId = tblMSVendor.VendorId,
                        SdkName = "Windows SDK",
                        SdkVersion = version,
                        SdkRootFolder = windowsSdkDirectory.FullName,
                        IncludeFolders = "include",
                        SourceFolders = "src",
                        LibraryFolders = "lib",
                        ExecutableFolders = "bin"
                    });
                });
            }

            if (atlmfcDirectory.Exists)
            {
                var version = string.Empty;

                if (versionRegex.IsMatch(vcDirectory.FullName))
                {
                    var match = versionRegex.Match(atlmfcDirectory.FullName);

                    version = match.Groups["version"].Value;
                }

                var tblMSVendorSdk = entities.SaveIfNotExists <tblVendorSDK>(s => s.SdkName == "ATL MFC" && s.SdkVersion == version, () =>
                {
                    return(new tblVendorSDK
                    {
                        VendorSdkId = Guid.NewGuid(),
                        VendorId = tblMSVendor.VendorId,
                        SdkName = "ATL MFC",
                        SdkVersion = version,
                        SdkRootFolder = atlmfcDirectory.FullName,
                        IncludeFolders = "include",
                        SourceFolders = "src",
                        LibraryFolders = "lib",
                        ExecutableFolders = "bin"
                    });
                });
            }

            if (frameworkSdkDirectory.Exists)
            {
                var version = string.Empty;

                if (versionRegex.IsMatch(vcDirectory.FullName))
                {
                    var match = versionRegex.Match(frameworkSdkDirectory.FullName);

                    version = match.Groups["version"].Value;
                }

                var tblMSVendorSdk = entities.SaveIfNotExists <tblVendorSDK>(s => s.SdkName == "Framework SDK" && s.SdkVersion == version, () =>
                {
                    return(new tblVendorSDK
                    {
                        VendorSdkId = Guid.NewGuid(),
                        VendorId = tblMSVendor.VendorId,
                        SdkName = "Framework SDK",
                        SdkVersion = version,
                        SdkRootFolder = frameworkSdkDirectory.FullName,
                        IncludeFolders = "include",
                        SourceFolders = "src",
                        LibraryFolders = "lib",
                        ExecutableFolders = "bin"
                    });
                });
            }

            serializedEventArgs = new List <EventArgsXml>();
            includeDirectories  = new Dictionary <tblVendorSDK, DirectoryInfo>();
            libraryDirectories  = new Dictionary <tblVendorSDK, DirectoryInfo>();
            tblVendorSDKs       = entities.tblVendorSDKs;

            foreach (var tblVendorSdk in tblVendorSDKs)
            {
                AddIncludes(tblVendorSdk);
            }

            this.OnParserDiagnostic += new Utils.EventHandlerT <CppSharp.Parser.ParserDiagnostic>(symbolResolver_OnParserDiagnostic);
            this.OnParserProgress   += new ParserProgressEventHandler(symbolResolver_OnParserProgress);
        }
Ejemplo n.º 5
0
 public CacheStatusAgent() : base(ThreadPriority.BelowNormal, 5000, 30000, 15000)
 {
     lockObject = LockManager.CreateObject();
 }