public static string Test(string localStorageName) { StringBuilder strb = new StringBuilder(); strb.AppendLine("Root Path for Local Storage:" + WindowsAzureSystemHelper.GetLocalStorageRootPath(localStorageName)); strb.AppendLine("CanAccessLocalStorage:" + WindowsAzureSystemHelper.CanAccessLocalStorage(localStorageName)); string sysDir; strb.Append("CanAccessSystemDir:" + WindowsAzureSystemHelper.CanAccessSystemDir(out sysDir)); strb.AppendLine("System Directory:" + sysDir); strb.Append("CanAccessWindowsDir:" + WindowsAzureSystemHelper.CanAccessWindowsDir(out sysDir)); strb.AppendLine("Windows Directory:" + sysDir); string output = strb.ToString(); WindowsAzureSystemHelper.LogInfo(output); return(output); }
public static bool CanAccessLocalStorage(string localStorageName) { WindowsAzureSystemHelper.LogInfo("Can access Local Storage?"); bool ret = false; try { string fp = WindowsAzureSystemHelper.GetLocalStorageRootPath(localStorageName) + "proazure.txt"; using (StreamWriter sw = File.CreateText(fp)) { WindowsAzureSystemHelper.LogInfo("Created File " + fp); sw.WriteLine("This is a Pro Azure file."); WindowsAzureSystemHelper.LogInfo("Wrote in File " + fp); }//using string fpNew = WindowsAzureSystemHelper.GetLocalStorageRootPath(localStorageName) + "proazure2.txt"; File.Copy(fp, fpNew); string fpNew2 = WindowsAzureSystemHelper.GetLocalStorageRootPath(localStorageName) + "proazure3.txt"; File.Move(fp, fpNew2); WindowsAzureSystemHelper.LogInfo("Deleting File " + fpNew2); File.Delete(fpNew2); WindowsAzureSystemHelper.LogInfo("Deleted File " + fpNew2); WindowsAzureSystemHelper.LogInfo("Deleting File " + fpNew); File.Delete(fpNew); WindowsAzureSystemHelper.LogInfo("Deleted File " + fpNew); ret = true; } catch (Exception ex) { WindowsAzureSystemHelper.LogError("Error in CanAccessSystemDir " + ex.Message); } return(ret); }