예제 #1
0
        public void Save()
        {
            var history = JsonConvert.SerializeObject(ListHistory);

            Utils.WriteFileAsync(HistoryFile, history);
            ListHistory.Clear();
        }
예제 #2
0
        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);
        }
예제 #3
0
파일: Password.cs 프로젝트: Mrivai/Petir
 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();
     }
 }
예제 #4
0
        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);
        }
예제 #5
0
 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();
     }
 }
예제 #6
0
 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);
     }
 }
예제 #7
0
 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();
     }
 }
예제 #8
0
 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);
     }
 }
예제 #9
0
 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();
     }
 }
예제 #10
0
        public void Save()
        {
            var webshell = JsonConvert.SerializeObject(ListWebshell);

            Utils.WriteFileAsync(Filewebshell, webshell);
        }
예제 #11
0
파일: Password.cs 프로젝트: Mrivai/Petir
        public void Save()
        {
            var pass = JsonConvert.SerializeObject(ListPassword);

            Utils.WriteFileAsync(Filepass, pass);
        }