예제 #1
0
        private void ProcessSyncEvent(CartridgeProviderSyncEventArgs e)
        {
            // Accepts the files that have been added.
            List <string> filesToRemove = new List <string>();

            foreach (string filename in e.AddedFiles.Where(s => s.EndsWith(".gwc", StringComparison.InvariantCultureIgnoreCase)))
            {
                AcceptCartridge(filename);
            }
            foreach (string filename in e.AddedFiles.Where(s => s.EndsWith(".gws", StringComparison.InvariantCultureIgnoreCase)))
            {
                // Copies this savegame to the content folders of each cartridge
                // whose name matches the cartridge name in the savegame metadata.
                AcceptSavegame(filename);

                // Marks the file to be deleted.
                filesToRemove.Add(filename);
            }

            // Rejects and removes the files marked to be removed.
            filesToRemove.AddRange(e.ToRemoveFiles);
            using (IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication())
            {
                foreach (string filename in filesToRemove)
                {
                    // Removes the file from the list.
                    if (filename.EndsWith(".gwc", StringComparison.InvariantCultureIgnoreCase))
                    {
                        RejectCartridge(filename);
                    }

                    // Deletes the file in the store.
                    if (isf.FileExists(filename))
                    {
                        isf.DeleteFile(filename);
                    }
                }
            }
        }
예제 #2
0
        private void OnProviderSyncProgress(object sender, CartridgeProviderSyncEventArgs e)
        {
            _isBusyAggregator[sender] = true;

            ProcessSyncEvent(e);
        }
예제 #3
0
        private void OnProviderSyncCompleted(object sender, CartridgeProviderSyncEventArgs e)
        {
            ProcessSyncEvent(e);

            _isBusyAggregator[sender] = false;
        }