public Rename ( |
||
tag | ||
name | string | |
isf | ||
Результат | void |
/// <summary> /// Exports a savegame to the isolated storage and adds it to this tag. /// </summary> /// <param name="cs">The savegame to add.</param> public void AddSavegame(CartridgeSavegame cs) { // Sanity check: a savegame with similar name should // not exist. if (Savegames.Any(c => c.Name == cs.Name)) { System.Diagnostics.Debug.WriteLine("CartridgeTag: Renaming new savegame because an old one with same name exists: " + cs.Name); // What's the last savegame following the pattern "name (n)"? int dbl = GetLastSavegameNameInteger(cs.Name, " ({0})"); // Renames the savegame. using (IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication()) { cs.Rename(this, cs.Name + " (" + ++dbl + ")", isf); } } // Makes sure the savegame is exported to the cache. cs.ExportToIsoStore(); // Adds the savegame. _savegames.Add(cs); // Notifies of a change. RaisePropertyChanged("Savegames"); }
/// <summary> /// Exports a savegame to the isolated storage and adds it to this tag. /// </summary> /// <param name="cs">The savegame to add.</param> public void AddSavegame(CartridgeSavegame cs) { // Sanity check: a savegame with similar name should // not exist. if (Savegames.Any(c => c.Name == cs.Name)) { System.Diagnostics.Debug.WriteLine("CartridgeTag: Renaming new savegame because an old one with same name exists: " + cs.Name); // What's the last savegame following the pattern "name (n)"? int dbl = GetLastSavegameNameInteger(cs.Name, " ({0})"); // Renames the savegame. using (IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication()) { cs.Rename(this, cs.Name + " (" + ++dbl + ")", isf); } } // Makes sure the savegame is exported to the cache. cs.ExportToIsoStore(); // Adds the savegame. _savegames.Add(cs); // Notifies of a change. RaisePropertyChanged("Savegames"); }