Example #1
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;
        }
Example #2
0
        public OneTimeTimer(int milliseconds)
        {
            lockObject = LockManager.CreateObject();

            internalTimer          = new Timer();
            internalTimer.Interval = milliseconds;
        }
Example #3
0
 public static void LockSet(this IManagedLockObject lockObject, Action setter)
 {
     using (lockObject.Lock())
     {
         setter();
     }
 }
Example #4
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;
        }
Example #5
0
        public BaseThreadedService(ThreadPriority threadPriority, TimeSpan iterationSleep, TimeSpan iterationTimeOut, TimeSpan startTimeOut)
        {
            this.threadPriority   = threadPriority;
            this.iterationSleep   = iterationSleep;
            this.iterationTimeOut = iterationTimeOut;
            this.startTimeOut     = startTimeOut;
            runningEvent          = new ManualResetEvent(false);

            lockObject = LockManager.CreateObject();
        }
Example #6
0
        public static T LockGet <T>(this IManagedLockObject lockObject, Func <T> getter)
        {
            T value;

            using (lockObject.Lock())
            {
                value = getter();
            }

            return(value);
        }
Example #7
0
 internal OleComponent()
 {
     lockObject = LockManager.CreateObject();
 }
Example #8
0
 static LoggerExtensions()
 {
     lockObject = LockManager.CreateObject();
     eventSinks = new List <LoggerRelayEventSink>();
 }
Example #9
0
 public BaseThreadedService(IManagedLockObject lockObject = null) : this(ThreadPriority.Lowest, lockObject)
 {
 }
Example #10
0
 public BaseThreadedService(ThreadPriority threadPriority, IManagedLockObject lockObject = null) : this(threadPriority, TimeSpan.FromMilliseconds(100), TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(15), lockObject)
 {
 }
Example #11
0
 public BaseThreadedService(ThreadPriority threadPriority, int iterationSleepMilliseconds, int iterationTimeOutMilliseconds, int startTimeOutMilliseconds, IManagedLockObject lockObject = null) : this(threadPriority, TimeSpan.FromMilliseconds(iterationSleepMilliseconds), TimeSpan.FromMilliseconds(iterationTimeOutMilliseconds), TimeSpan.FromMilliseconds(startTimeOutMilliseconds), lockObject)
 {
 }
Example #12
0
 static TraceExtensions()
 {
     lockObject = LockManager.CreateObject();
     eventSinks = new List <TraceLogEventSink>();
 }
Example #13
0
 public ActionQueueService()
 {
     lockObject  = LockManager.CreateObject();
     actionQueue = new Queue <Action>();
 }
Example #14
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);
        }
Example #15
0
        static ConsoleTimer()
        {
            lockObject = LockManager.CreateObject();

            timers = new List <ConsoleTimer>();
        }
Example #16
0
 public CacheStatusAgent() : base(ThreadPriority.BelowNormal, 5000, 30000, 15000)
 {
     lockObject = LockManager.CreateObject();
 }