public static void CreateIfNotExists() { Directory.CreateDirectory(LocalDirectoryHelper.GetProgramAssetFolderPath()); Directory.CreateDirectory(LocalDirectoryHelper.GetAssetFolderPath()); Directory.CreateDirectory(LocalDirectoryHelper.GetCookieFolderPath()); Directory.CreateDirectory(LocalDirectoryHelper.GetLogFolderPath()); Directory.CreateDirectory(LocalDirectoryHelper.GetSettingsFolderPath()); }
public static string Read(string fileName) { try { string path = Path.Combine(LocalDirectoryHelper.GetCookieFolderPath(), fileName); if (File.Exists(path)) { return(File.ReadAllText(path)); } } catch (Exception ex) { string text = "读取Cookie失败, " + fileName + ex.Message; Pandora.Instance.ReportError(text, 0); Logger.LogError(text); } return(string.Empty); }
public static bool Write(string fileName, string content) { try { string path = Path.Combine(LocalDirectoryHelper.GetCookieFolderPath(), fileName); File.WriteAllText(path, content); return(true); } catch (Exception ex) { string text = string.Concat(new string[] { "写入Cookie失败, ", fileName, " ", content, ex.Message }); Pandora.Instance.ReportError(text, 0); Logger.LogError(text); } return(false); }
public static void DeleteExpiredCookie() { LocalDirectoryHelper.DeleteExpiredAsset(LocalDirectoryHelper.GetCookieFolderPath()); }
public static void DeleteCookies() { LocalDirectoryHelper.DeleteDirectoryAssets(LocalDirectoryHelper.GetCookieFolderPath()); }
public static void Clean() { LocalDirectoryHelper.DeleteDirectoryAssets(LocalDirectoryHelper.GetCookieFolderPath()); LocalDirectoryHelper.DeleteDirectoryAssets(LocalDirectoryHelper.GetLogFolderPath()); }