本文整理汇总了C#中System.IO.IsolatedStorage.IsolatedStorageFile.DeleteFile方法的典型用法代码示例。如果您正苦于以下问题:C# IsolatedStorageFile.DeleteFile方法的具体用法?C# IsolatedStorageFile.DeleteFile怎么用?C# IsolatedStorageFile.DeleteFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.IO.IsolatedStorage.IsolatedStorageFile
的用法示例。
在下文中一共展示了IsolatedStorageFile.DeleteFile方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SafeDeleteFile
private static void SafeDeleteFile(IsolatedStorageFile store)
{
try
{
store.DeleteFile(Filename);
}
catch (Exception ex)
{
}
}
示例2: SafeDeleteFile
private static void SafeDeleteFile(IsolatedStorageFile store)
{
try
{
store.DeleteFile(FILENAME);
}
catch (Exception)
{
}
}
示例3: InnerClear
private void InnerClear(IsolatedStorageFile iso, string path) {
var fs = iso.GetFileNames(string.Format("{0}/*", path));
foreach (var f in fs) {
iso.DeleteFile(Path.Combine(path, f));
}
var ds = iso.GetDirectoryNames(string.Format("{0}/*", path));
foreach (var d in ds) {
var sp = Path.Combine(path, d);
this.InnerClear(iso, sp);
iso.DeleteDirectory(sp);
}
}
示例4: DeleteAllFilesInDirectory
private void DeleteAllFilesInDirectory(IsolatedStorageFile store, string path)
{
if (!store.DirectoryExists(path))
{
return;
}
var files = store.GetFileNames(path + "/*");
foreach (var file in files)
{
store.DeleteFile(path + "/" + file);
}
}
示例5: SafeDeleteFile
public static void SafeDeleteFile(IsolatedStorageFile storage, string fileName)
{
try
{
if (storage.FileExists(fileName))
{
storage.DeleteFile(fileName);
}
}
catch (Exception)
{
}
}
示例6: Clear
public override void Clear()
{
base.Clear();
using ( _storage = IsolatedStorageFile.GetUserStoreForApplication() ) {
try {
foreach ( string file in _storage.GetFileNames( CACHE_FOLDER + @"\*" ) ) {
_storage.DeleteFile( GetFilePath( file ) );
}
}
catch ( Exception e ) {
e.ToString();
}
}
}
示例7: RecursiveDeleteDirectory
public static void RecursiveDeleteDirectory(string directory, IsolatedStorageFile store)
{
foreach (var fileName in store.GetFileNames(directory + "\\*"))
{
store.DeleteFile(directory + "\\" + fileName);
}
foreach (var directoryName in store.GetDirectoryNames(directory + "\\*"))
{
RecursiveDeleteDirectory(directory + "\\" + directoryName, store);
}
store.DeleteDirectory(directory);
}
示例8: DeleteDirectoryRecursively
public static void DeleteDirectoryRecursively(IsolatedStorageFile storageFile, string directoryName)
{
var pattern = directoryName + @"\*";
var files = storageFile.GetFileNames(pattern);
foreach (var fileName in files)
{
storageFile.DeleteFile(Path.Combine(directoryName, fileName));
}
var dirs = storageFile.GetDirectoryNames(pattern);
foreach (var dirName in dirs)
{
DeleteDirectoryRecursively(storageFile, Path.Combine(directoryName, dirName));
}
storageFile.DeleteDirectory(directoryName);
}
示例9: DeleteDirectoryRecursive
public void DeleteDirectoryRecursive(IsolatedStorageFile isolatedStorageFile, String dirName)
{
String pattern = dirName + @"\*";
String[] files = isolatedStorageFile.GetFileNames(pattern);
foreach (String fName in files)
{
isolatedStorageFile.DeleteFile(Path.Combine(dirName, fName));
}
String[] dirs = isolatedStorageFile.GetDirectoryNames(pattern);
foreach (String dName in dirs)
{
DeleteDirectoryRecursive(isolatedStorageFile, Path.Combine(dirName, dName));
}
isolatedStorageFile.DeleteDirectory(dirName);
}
示例10: Write
// use the caller stack to execute some write operations
private void Write (IsolatedStorageFile isf)
{
isf.CreateDirectory ("testdir");
string filename = Path.Combine ("testdir", "file");
using (IsolatedStorageFileStream isfs = new IsolatedStorageFileStream (filename, FileMode.Create, isf)) {
}
isf.DeleteFile (filename);
isf.DeleteDirectory ("testdir");
try {
isf.Remove ();
}
catch (IsolatedStorageException) {
// fx 1.x doesn't like removing when things "could" still be in use
}
}
示例11: TryToDeleteAllFiles
private static void TryToDeleteAllFiles(IsolatedStorageFile storageFolder, string directory)
{
if (storageFolder.DirectoryExists(directory))
{
try
{
string[] files = storageFolder.GetFileNames(directory);
foreach (string file in files)
{
storageFolder.DeleteFile(directory + file);
}
}
catch (Exception)
{
// could be in use
}
}
}
示例12: TryToDeleteAllFiles
public static void TryToDeleteAllFiles(IsolatedStorageFile storageFolder, string directory)
{
if (storageFolder.DirectoryExists(directory))
{
try
{
string[] files = storageFolder.GetFileNames(directory);
foreach (string File in files)
{
storageFolder.DeleteFile(directory + files);
}
}
catch (Exception)
{
//ignoring the exception
}
}
}
示例13: DeleteDirectory
public static void DeleteDirectory(IsolatedStorageFile store, String root)
{
String dir = root;
// delete file in current dir
foreach (String file in store.GetFileNames(dir + "/*"))
{
store.DeleteFile(dir + "/" + file);
}
// delete sub-dir
foreach (String subdir in store.GetDirectoryNames(dir + "/*"))
{
DeleteDirectory(store, dir + "/" + subdir + "/");
}
// delete current dir
store.DeleteDirectory(dir);
}
示例14: SafeDeleteFile
public static void SafeDeleteFile(IsolatedStorageFile store)
{
try
{
store.DeleteFile(filename);
IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings;
if (settings.Contains("errordata"))
{
settings.Remove("erroedata");
}
}
catch (Exception)
{
}
}
示例15: Configure
/// <summary>
/// Configures the diagnostic log
/// </summary>
/// <param name="fileName"></param>
/// <param name="enable"> </param>
public static void Configure(string fileName, bool enable) {
try {
_IsolatedStorage = IsolatedStorageFile.GetUserStoreForApplication();
_FileName = fileName;
#if DEBUG
if (_IsolatedStorage.FileExists(_FileName)) {
_IsolatedStorage.DeleteFile(_FileName);
}
#endif
IsEnabled = enable;
if (enable) {
WriteLogFileHeader();
}
} catch (Exception ex) {
Debug.WriteLine(ex.ToString());
}
}