diff --git a/Deposits/Deposits.csproj b/Deposits/Deposits.csproj
index 96751ff..f1f9137 100644
--- a/Deposits/Deposits.csproj
+++ b/Deposits/Deposits.csproj
@@ -6,22 +6,10 @@
app.manifest
-
-
- tlbimp
- 9
- 1
- 00020813-0000-0000-c000-000000000046
- 0
- false
- true
-
-
-
PreserveNewest
@@ -32,6 +20,8 @@
+
+
@@ -39,8 +29,8 @@
- True
- True
+ True
+ True
diff --git a/Deposits/Program.cs b/Deposits/Program.cs
index f931e98..fa75181 100644
--- a/Deposits/Program.cs
+++ b/Deposits/Program.cs
@@ -19,20 +19,26 @@ namespace Deposits {
public static void RunEncryption(Data dt) {
if (ToEncrypt()) {
Data.CreateNewKeys();
- System.IO.File.WriteAllBytes(dt.GetLocation(), Data.EncryptData(dt.GetPlainText()));
+ System.IO.File.WriteAllBytes(dt.locations, Data.EncryptData(dt.GetPlainText()));
}
}
static void Main(string[] args) {
- WebDriver driver = new();
- driver.Driver.Url = "https://google.com";
+ //WebDriver driver = new();
+ //driver.Driver.Url = "https://google.com";
- driver.RunWeb(300, "https://mail.google.com/mail/u/0/#inbox", "https://www.tgspot.co.il/");
+ //driver.RunWeb(3, "https://mail.google.com/mail/u/0/#inbox", "https://www.tgspot.co.il/");
+ //foreach (var argu in args) {
+ // System.Console.WriteLine(argu);
+ //}
//Data dt = new Data();
//RunEncryption(dt);
//dt = new();
//string resources = System.IO.File.ReadAllText(@"Resources\res.json");
//var location = (Newtonsoft.Json.Linq.JObject)Newtonsoft.Json.JsonConvert.DeserializeObject(resources);
//System.Console.WriteLine(dt.GetPlainText());
+ //Data data = new Data(true);
+ //data.AddToData("{\"phone\":\"0547477082\"}");
+ //System.Console.WriteLine("yes");
}
}
}
diff --git a/Deposits/SubDep/Data.cs b/Deposits/SubDep/Data.cs
index 7dbe718..384ce0a 100644
--- a/Deposits/SubDep/Data.cs
+++ b/Deposits/SubDep/Data.cs
@@ -1,16 +1,23 @@
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
using System.Security.Cryptography;
using System.Text;
+
namespace Deposits.SubDep {
class Data {
string plainTextData;
- string locations;
+ public JObject? DataJson { get; }
+ public string locations { get; }
byte[] encryptedData;
- public Data() {
+ public Data(bool createJson = false) {
string resources = System.IO.File.ReadAllText(@"Resources\res.json");
- var location = (Newtonsoft.Json.Linq.JObject)Newtonsoft.Json.JsonConvert.DeserializeObject(resources);
+ var location = (JObject)JsonConvert.DeserializeObject(resources);
this.locations = (string)location["data location"];
this.encryptedData = System.IO.File.ReadAllBytes(locations);
this.plainTextData = DecryptData(this.encryptedData);
+ if (createJson) {
+ DataJson = DataObject(this.plainTextData);
+ }
}
public static void CreateNewKeys() {
RSA file = RSA.Create();
@@ -41,6 +48,21 @@ namespace Deposits.SubDep {
//rsaFile.fr
}
+ public void SetPlainText(string newPlainText) {
+ this.plainTextData = newPlainText;
+ }
+ public void SetPlainText(JObject newPlainText) {
+ this.plainTextData = newPlainText.ToString();
+ }
+ public static byte[] EncryptData(JObject ob) {
+ RSA rsaFile = RSA.Create();
+
+ string prive = System.IO.File.ReadAllText(@"D:\pk");
+ rsaFile.FromXmlString(prive);
+
+ byte[] Data = Encoding.UTF8.GetBytes(ob.ToString());
+ return rsaFile.Encrypt(Data, RSAEncryptionPadding.Pkcs1);
+ }
public static string DecryptData(byte[] data) {
RSA rsaFile = RSA.Create();
string prive = System.IO.File.ReadAllText(@"D:\pk");
@@ -48,5 +70,38 @@ namespace Deposits.SubDep {
string Data = System.Text.Encoding.UTF8.GetString(rsaFile.Decrypt(data, RSAEncryptionPadding.Pkcs1));
return Data;
}
+ public static JObject DataObject(string data) {
+ return (JObject)JsonConvert.DeserializeObject(data);
+ }
+ public static void SaveEncryptedData(byte[] data, string path) {
+ System.IO.File.WriteAllBytes(path, data);
+ }
+ public void AddToData(string data) {
+ try {
+ JObject newData = (JObject)JsonConvert.DeserializeObject(data);
+ if (DataJson != null) {
+ foreach (var dt in newData) {
+ DataJson.Add(dt.Key, dt.Value);
+
+ }
+ SaveEncryptedData(EncryptData(DataJson), this.locations);
+ }
+ } catch {
+
+ }
+ }
+ public static void RunEncryption(Data dt) {
+ if (System.DateTime.Today.Day > 24) {
+ CreateNewKeys();
+ System.IO.File.WriteAllBytes(dt.locations, EncryptData(dt.GetPlainText()));
+ }
+ }
+ public void RunEncryption() {
+ if (System.DateTime.Today.Day > 24) {
+ CreateNewKeys();
+ System.IO.File.WriteAllBytes(locations, EncryptData(GetPlainText()));
+ }
+ }
+
}
}
diff --git a/Deposits/SubDep/Depen.cs b/Deposits/SubDep/Depen.cs
new file mode 100644
index 0000000..dfb7699
--- /dev/null
+++ b/Deposits/SubDep/Depen.cs
@@ -0,0 +1,15 @@
+using Newtonsoft.Json;
+public class DataDetails {
+ private static string resources = System.IO.File.ReadAllText(@"Resources\res.json");
+ private static dynamic location = (Newtonsoft.Json.Linq.JObject)JsonConvert.DeserializeObject(resources);
+ public static string DataLocation {
+ get {
+ return (string)location["data location"];
+ }
+ }
+ public static string ExcelLocation {
+ get {
+ return (string)location["deposit xl"];
+ }
+ }
+}
\ No newline at end of file
diff --git a/Deposits/SubDep/Excel.cs b/Deposits/SubDep/Excel.cs
index a36b0ab..96eb463 100644
--- a/Deposits/SubDep/Excel.cs
+++ b/Deposits/SubDep/Excel.cs
@@ -4,13 +4,32 @@
//using System.Text;
//using System.Threading.Tasks;
//using System.Runtime.InteropServices;
-
+//using Microsoft.Office.Interop.Excel;
+//using OfficeOpenXml.Core;
namespace Deposits.SubDep {
class Excel {
-
- Microsoft.Office.Interop.Excel.Workbooks wb;
+ private static System.IO.FileInfo file = new System.IO.FileInfo(DataDetails.ExcelLocation);
+ private OfficeOpenXml.ExcelPackage excelPackage = new OfficeOpenXml.ExcelPackage(file);
+ public OfficeOpenXml.ExcelWorksheet deposits { get; }
+ public OfficeOpenXml.ExcelWorksheet creditCard { get; }
public Excel() {
- wb.Open(@"D:\Drive\מסמכים\מסמכים לסנכרון\צבירוש.xlsx");
+ var wb = excelPackage.Workbook;
+ foreach (var sheet in wb.Worksheets) {
+ if (sheet.Name.Contains("צבירוש") || sheet.Name.Contains("deposit")) {
+ this.deposits = sheet;
+ } else if (sheet.Name.Contains("credit")) {
+ this.creditCard = sheet;
+ }
+ }
+ if (deposits == null) {
+ deposits = wb.Worksheets.Add("deposits");
+ }
+ if (creditCard == null) {
+ creditCard = wb.Worksheets.Add("credit card");
+ }
+
+ }
+ public void UpdateDeposits() {
}
}
diff --git a/Deposits/SubDep/Fnx.cs b/Deposits/SubDep/Fnx.cs
index 9e7f612..c850827 100644
--- a/Deposits/SubDep/Fnx.cs
+++ b/Deposits/SubDep/Fnx.cs
@@ -1,7 +1,22 @@
-namespace Deposits.SubDep
-{
- class Fnx
- {
+using Newtonsoft.Json.Linq;
+//using Deposits.SubDep;
+namespace Deposits.SubDep {
+ class Fnx : WebDriver {
+ string Mail;
+ string Url;
+ WebDriver MailApp;
+ JObject Data;
+ public Fnx(string url, string mail) {
+ Url = url;
+ Mail = mail;
+ this.Driver.Url = Url;
+ Deposits.SubDep.Data data = new(true);
+ Data = (JObject)data.DataJson["humail"];
+ }
+ public void DefineMailApp() {
+ this.MailApp = new();
+ MailApp.RunWeb()
+ }
}
}
diff --git a/Deposits/SubDep/UrlActions.cs b/Deposits/SubDep/UrlActions.cs
new file mode 100644
index 0000000..9e4f80c
--- /dev/null
+++ b/Deposits/SubDep/UrlActions.cs
@@ -0,0 +1,15 @@
+
+namespace Deposits.SubDep {
+ class UrlActions {
+ private string _url;
+ private string?[] fields;
+ private string?[] data;
+ private int timeout;
+ public UrlActions(string url, string?[] fields, string?[] data, int timeout = 0) {
+ _url = url;
+ this.fields = fields;
+ this.data = data;
+ this.timeout = timeout;
+ }
+ }
+}
diff --git a/Deposits/SubDep/WebDriver.cs b/Deposits/SubDep/WebDriver.cs
index eca6918..2cb4680 100644
--- a/Deposits/SubDep/WebDriver.cs
+++ b/Deposits/SubDep/WebDriver.cs
@@ -3,7 +3,9 @@ namespace Deposits.SubDep {
class WebDriver {
FirefoxOptions options = new();
FirefoxProfile profile = new();
+ string?[] Urls;
public FirefoxDriver Driver;
+ //JObject UrlAndActions
private void SetProfile() {
this.profile.SetPreference("browser.download.folderList", 2);
this.profile.SetPreference("browser.download.manager.showWhenStarting", false);
@@ -13,11 +15,13 @@ namespace Deposits.SubDep {
this.profile.SetPreference("browser.download.panel.shown", false);
}
private void SetOption() {
+ SetProfile();
this.options.Profile = this.profile;
this.options.AddArgument("--lang=EN");
}
public WebDriver() {
//System.IO.Path.Join("bins\\geckodriver.exe");
+ SetOption();
this.Driver = new($"bins", options);
}
public void RunWeb(int timeToWait = 0, params string[] urls) {