VixenApplication.VixenApplication.IsProfileLocked C# (CSharp) Méthode

IsProfileLocked() static private méthode

static private IsProfileLocked ( string path ) : bool
path string
Résultat bool
        internal static bool IsProfileLocked(string path)
        {
            bool locked = false;
            try
            {
                if (Directory.Exists(path))
                {
                    var lockFilePath = Path.Combine(path, LockFile);
                    if (File.Exists(lockFilePath))
                    {
                        locked = true;
                    }
                }
            }
            catch (Exception e)
            {
                Logging.Error("An error occured checking the profile lock file.", e);
                locked = true;  //If we cannot determine if it is locked, then we can't assume it isn't.
            }

            return locked;
        }

Usage Example

Exemple #1
0
        private void PopulateProfileList()
        {
            XMLProfileSettings profile = new XMLProfileSettings();

            listBoxProfiles.BeginUpdate();
            //Make sure we start with an empty listbox since we may repopulate after editing profiles
            listBoxProfiles.Items.Clear();
            int profileCount = profile.GetSetting(XMLProfileSettings.SettingType.Profiles, "ProfileCount", 0);

            for (int i = 0; i < profileCount; i++)
            {
                var dataFolder = profile.GetSetting(XMLProfileSettings.SettingType.Profiles, "Profile" + i.ToString() + "/DataFolder", string.Empty);
                // if (!VixenApplication.IsProfileLocked(dataFolder)) //Only add the profile if it is not locked.
                //{
                ProfileItem item = new ProfileItem();
                item.Name = profile.GetSetting(XMLProfileSettings.SettingType.Profiles, "Profile" + i.ToString() + "/Name",
                                               "New Profile");
                item.DataFolder = dataFolder;
                item.IsLocked   = VixenApplication.IsProfileLocked(dataFolder);
                listBoxProfiles.Items.Add(item);

                //}
            }

            listBoxProfiles.EndUpdate();
        }
All Usage Examples Of VixenApplication.VixenApplication::IsProfileLocked