public static int ResetState(PersonalizationStateInfoCollection data) { int num = 0; PersonalizationProviderHelper.CheckNullEntries(data, "data"); StringCollection strings = null; foreach (PersonalizationStateInfo info in data) { UserPersonalizationStateInfo info2 = info as UserPersonalizationStateInfo; if (info2 != null) { if (ResetUserState(info2.Path, info2.Username)) { num++; } } else { if (strings == null) { strings = new StringCollection(); } strings.Add(info.Path); } } if (strings != null) { string[] array = new string[strings.Count]; strings.CopyTo(array, 0); num += ResetStatePrivate(PersonalizationScope.Shared, array, null); } return(num); }
public static int ResetState(PersonalizationStateInfoCollection data) { int count = 0; PersonalizationProviderHelper.CheckNullEntries(data, "data"); StringCollection sharedPaths = null; foreach (PersonalizationStateInfo stateInfo in data) { UserPersonalizationStateInfo userStateInfo = stateInfo as UserPersonalizationStateInfo; if (userStateInfo != null) { if (ResetUserState(userStateInfo.Path, userStateInfo.Username)) { count += 1; } } else { if (sharedPaths == null) { sharedPaths = new StringCollection(); } sharedPaths.Add(stateInfo.Path); } } if (sharedPaths != null) { string [] sharedPathsArray = new string [sharedPaths.Count]; sharedPaths.CopyTo(sharedPathsArray, 0); count += ResetStatePrivate(PersonalizationScope.Shared, sharedPathsArray, null); } return(count); }