You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
75 lines
2.4 KiB
75 lines
2.4 KiB
2 weeks ago
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.Data;
|
||
|
using System.Data.OleDb;
|
||
|
|
||
|
namespace iMonitorApp
|
||
|
{
|
||
|
// Token: 0x02000022 RID: 34
|
||
|
public class ThemeEmails
|
||
|
{
|
||
|
// Token: 0x1700003B RID: 59
|
||
|
// (get) Token: 0x06000138 RID: 312 RVA: 0x0000BC6A File Offset: 0x00009E6A
|
||
|
// (set) Token: 0x06000139 RID: 313 RVA: 0x0000BC72 File Offset: 0x00009E72
|
||
|
public List<ThemeEmail> EmailList { get; set; }
|
||
|
|
||
|
// Token: 0x0600013B RID: 315 RVA: 0x0000BC90 File Offset: 0x00009E90
|
||
|
private void LoadFile()
|
||
|
{
|
||
|
string connectionString = "";
|
||
|
bool flag = this.FileName.Trim().EndsWith(".xlsx");
|
||
|
if (flag)
|
||
|
{
|
||
|
connectionString = string.Format("Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties=\"Excel 12.0 Xml;HDR=YES;IMEX=1\";", this.FileName);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
bool flag2 = this.FileName.Trim().EndsWith(".xls");
|
||
|
if (flag2)
|
||
|
{
|
||
|
connectionString = string.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Extended Properties=\"Excel 8.0;HDR=Yes;IMEX=1\";", this.FileName);
|
||
|
}
|
||
|
}
|
||
|
OleDbConnection oleDbConnection = new OleDbConnection(connectionString);
|
||
|
oleDbConnection.Open();
|
||
|
OleDbDataAdapter oleDbDataAdapter = new OleDbDataAdapter();
|
||
|
string str = "newemails";
|
||
|
string cmdText = "SELECT * FROM [" + str + "$] ";
|
||
|
OleDbCommand selectCommand = new OleDbCommand(cmdText, oleDbConnection);
|
||
|
oleDbDataAdapter.SelectCommand = selectCommand;
|
||
|
DataTable dataTable = new DataTable();
|
||
|
oleDbDataAdapter.Fill(dataTable);
|
||
|
oleDbConnection.Close();
|
||
|
this.EmailList = new List<ThemeEmail>();
|
||
|
foreach (object obj in dataTable.Rows)
|
||
|
{
|
||
|
DataRow dataRow = (DataRow)obj;
|
||
|
string backupEmail = "";
|
||
|
string backupPassword = "";
|
||
|
bool flag3 = dataRow.Table.Columns.Contains("backup");
|
||
|
if (flag3)
|
||
|
{
|
||
|
bool flag4 = dataRow["backup"] != null || !(dataRow["backup"].ToString() == "");
|
||
|
if (flag4)
|
||
|
{
|
||
|
backupEmail = dataRow["backup"].ToString();
|
||
|
backupPassword = dataRow["backup_password"].ToString();
|
||
|
}
|
||
|
}
|
||
|
this.EmailList.Add(new ThemeEmail
|
||
|
{
|
||
|
EmailAddress = dataRow["email"].ToString(),
|
||
|
ThemeName = dataRow["theme"].ToString(),
|
||
|
DisplayName = dataRow["Name"].ToString(),
|
||
|
Password = dataRow["password"].ToString(),
|
||
|
BackupEmail = backupEmail,
|
||
|
BackupPassword = backupPassword
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// Token: 0x040000D7 RID: 215
|
||
|
private string FileName = "C:\\tempFiles\\ThemeEmails.xlsx";
|
||
|
}
|
||
|
}
|