Esempio n. 1
0
        public PackageLockState GetPackageLockState(string name, string libraryPath)
        {
            string dllPath = GetPackageDllPath(name, libraryPath);

            if (!string.IsNullOrEmpty(dllPath))
            {
                var processes = RestartManager.GetProcessesUsingFiles(new string[] { dllPath }).ToArray();
                if (processes != null)
                {
                    if (processes.Length == 1 && processes[0].Id == _interactiveWorkflow.RSession.ProcessId)
                    {
                        return(PackageLockState.LockedByRSession);
                    }

                    if (processes.Length > 0)
                    {
                        return(PackageLockState.LockedByOther);
                    }
                }
            }

            return(PackageLockState.Unlocked);
        }