public void Save() { var history = JsonConvert.SerializeObject(ListHistory); Utils.WriteFileAsync(HistoryFile, history); ListHistory.Clear(); }
internal static bool w(string Title, Exception ex) { var Message = ex.Message; var StackTrace = ex.StackTrace; var report = string.Format("[{0}]:{1} {2} {3}", DateTime.Now.ToLongTimeString(), Title, Message, StackTrace); try { if (!(new DirectoryInfo(Path)).Exists) { Directory.CreateDirectory(Path); } if (!File.Exists(ErrorLogPath)) { File.Create(ErrorLogPath).Close(); } else { Utils.WriteFileAsync(ErrorLogPath, report); } } catch (Exception) { return(false); } return(true); }
public Password() { if (!File.Exists(Filepass)) { PasswordItem h = new PasswordItem(); h.Text = "Google"; h.Pwd = "satria89"; ListPassword.Add(h); var pass = JsonConvert.SerializeObject(ListPassword); Utils.WriteFileAsync(Filepass, pass); } else { Load(); } }
public void InstallScript(string url, string code) { var x = ParseUserScript.Parse(code, false); var name = Utils.GetFileNameFromUrl(url); Utils.WriteFileAsync(ScriptPath + name, code); x.Path = ScriptPath + name; if (x.Name == String.Empty) { x.Name = "Userscript from " + url; } if (String.IsNullOrWhiteSpace(x.UpdateUrl)) { x.UpdateUrl = url; } AddScript(x); }
public Bookmark() { if (!File.Exists(FileBookmark)) { BookmarkItem h = new BookmarkItem(); h.Title = "Google"; h.Url = "https:\\www.google.com"; ListBookmark.Add(h); var book = JsonConvert.SerializeObject(ListBookmark); Utils.WriteFileAsync(FileBookmark, book); Load(); } else { Load(); } }
private void Load() { try { if (!File.Exists(downloadlog)) { var dl = JsonConvert.SerializeObject(downloads); Utils.WriteFileAsync(downloadlog, dl); } var data = Utils.ReadFile(downloadlog); downloads = JsonConvert.DeserializeObject <Dictionary <int, DownloadItem> >(data); } catch (Exception ex) { Logger.w("Cannot Load Download History", ex); } }
public Webshell() { if (!File.Exists(Filewebshell)) { WebshellItem h = new WebshellItem(); h.Title = "Google"; h.Url = "https:\\www.google.com"; h.Pwd = "satria89"; ListWebshell.Add(h); var webshell = JsonConvert.SerializeObject(ListWebshell); Utils.WriteFileAsync(Filewebshell, webshell); } else { Load(); } }
public void Save(bool immediate = false) { try { var data = JsonConvert.SerializeObject(Userscript); if (immediate) { Utils.WriteFile(ScriptFile, data); } else { Utils.WriteFileAsync(ScriptFile, data); } } catch (Exception ex) { Logger.w("Unable To Save", ex); } }
public History() { if (!File.Exists(HistoryFile)) { HistoryItem h = new HistoryItem(); h.Title = "Google"; h.Url = "https:\\www.google.com"; h.Tanggal = DateTime.UtcNow; h.Id = Utils.GenerateNewUCID(); ListHistory.Add(h); var history = JsonConvert.SerializeObject(ListHistory); Utils.WriteFileAsync(HistoryFile, history); Load(); } else { Load(); } }
public void Save() { var webshell = JsonConvert.SerializeObject(ListWebshell); Utils.WriteFileAsync(Filewebshell, webshell); }
public void Save() { var pass = JsonConvert.SerializeObject(ListPassword); Utils.WriteFileAsync(Filepass, pass); }