Skip to content

Instantly share code, notes, and snippets.

@Unison1
Last active May 8, 2022 12:52
Show Gist options
  • Save Unison1/930a3e524755c9b94962f09e02a04967 to your computer and use it in GitHub Desktop.
Save Unison1/930a3e524755c9b94962f09e02a04967 to your computer and use it in GitHub Desktop.
Forensics
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SQLite;
using System.IO;
using System.IO.Compression;
using iTextSharp;
using iTextSharp.text;
using iTextSharp.text.pdf;
namespace Receiver
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
splitContainer1.Visible = true;
splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
splitContainer2.Visible = false;
splitContainer3.Visible = false;
toolStripStatusLabel1.Text = "Disconnected";
toolStripStatusLabel2.Visible = false;
}
string currDirDB;//Путь к БД Telegram
public string currDirDBVD;//Путь к БД звонков Viber
string currDirDBVM;//Путь к БД сообщений Viber
string currDirDBW;//Путь к БД WhatsApp
SQLiteConnection connection, connectionV, connectionW;
string U, P;
String hexN;
//
private void SQLiteQuery(string currDirDB)//работа с БД
{
try
{
connection =
new SQLiteConnection(string.Format("Data Source={0};", currDirDB));
U = textBox1.Text;//фильтр uid
SQLiteDataAdapter adapter =
new SQLiteDataAdapter("SELECT CAST(u.data AS text) AS [Информация о пользователе в явном виде], mes.mid AS [Идентификатор сообщения],u.uid AS[Идентификатор контакта], u.name AS[Имя контакта], DATETIME(mes.date, 'unixepoch', 'localtime') AS [Дата сообщения]" +
",CASE mes.out " +
"WHEN 0 THEN u.name " +
"WHEN 1 THEN 'Сообщение пользователя' END AS [Источник сообщения], " +
"CAST(mes.data AS text) AS [Сообщение] " +
"FROM messages AS mes join users AS u ON mes.uid = u.uid where u.uid =" + U, connection);
System.Data.DataTable dt = new System.Data.DataTable();
adapter.Fill(dt);
dataGridView1.DataSource = dt;
SQLiteCommand com =
new SQLiteCommand("SELECT hex(data) FROM users WHERE uid =" + U, connection);
try
{
connection.Open();
object result = com.ExecuteScalar();
string hex = Convert.ToString(result);
string newStr = hex.Substring(hex.IndexOf("333830"));//Начала номера 380
//newStr = newStr.Remove(newStr.IndexOf("000000"));//конец сигнатуры номера 000,
//так как преобразуем в тектовый формат то конечная сигнатура не важна.
string nhex = HexStringToString(newStr);
textBox5.Text = hexN;
connection.Close();
}
catch
{
MessageBox.Show("Пользователь Telegram не связан с контактом!", "Сообщение");
}
}
catch
{
toolStripStatusLabel1.Text = "Disconnected";
MessageBox.Show("Подключитесь к БД!", "Сообщение");
}
}
private void SQLiteQueryUsers(string currDirDB)//вывод пользователей
{
try
{
SQLiteConnection connection =
new SQLiteConnection(string.Format("Data Source={0};", currDirDB));
SQLiteDataAdapter adapter =
new SQLiteDataAdapter("SELECT uid AS [User ID],name AS [Name],CAST(data AS text) AS [Data] FROM users", connection);
System.Data.DataTable dt = new System.Data.DataTable();
adapter.Fill(dt);
dataGridView2.DataSource = dt;
}
catch
{
toolStripStatusLabel1.Text = "Disconnected";
MessageBox.Show("Подключитесь к БД!", "Сообщение");
}
}
public void ReportToPDF(DataGridView dt, string pdfName)
{
try
{
BaseFont baseFont = BaseFont.CreateFont("C:\\Windows\\Fonts\\arial.ttf", BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
iTextSharp.text.Font font = new iTextSharp.text.Font(baseFont, iTextSharp.text.Font.DEFAULTSIZE, iTextSharp.text.Font.NORMAL);
if (dt == dataGridView6)
{
PdfPTable wtableMess = new PdfPTable(dt.Columns.Count - 1);//-1(столбец с картинками) так как картинки не вывожу в PDF
for (int j = 0; j <= 5; j++)
{
wtableMess.AddCell(new Phrase(dt.Columns[j].HeaderText, font));
}
//Тело
for (int i = 0; i < dt.Rows.Count; i++)
{
for (int j = 0; j <= 5; j++)
{
wtableMess.AddCell(new Phrase(dt.Rows[i].Cells[j].Value.ToString(), font));
//if (j == 7)
//{
// wtableMess.AddCell(new Phrase(dataGridView6.Rows[i].Cells[j].Value.ToString()));
//}
}
}
//Создание документа
using (FileStream stream = new FileStream("ReportWhatsAppMessages.pdf", FileMode.Create))
{
Document pdfDoc = new Document(PageSize.A2, 10f, 10f, 10f, 0f);//Формат документа
PdfWriter.GetInstance(pdfDoc, stream);
pdfDoc.Open();
pdfDoc.Add(wtableMess);
pdfDoc.Close();
stream.Close();
MessageBox.Show("Файл ReportWhatsAppMessages.pdf находиться в папке с программой.", "Внимание!",
MessageBoxButtons.OK,
MessageBoxIcon.Exclamation);
//Открытие документа
System.Diagnostics.Process.Start(@".\ReportWhatsAppMessages.pdf");
}
}
else
{
PdfPTable ttable = new PdfPTable(dt.Columns.Count);
//Шапка
for (int j = 0; j < dt.Columns.Count; j++)
{
ttable.AddCell(new Phrase(dt.Columns[j].HeaderText, font));
}
//Тело
for (int i = 0; i < dt.Rows.Count; i++)
{
for (int j = 0; j < dt.Columns.Count; j++)
{
ttable.AddCell(new Phrase(dt.Rows[i].Cells[j].Value.ToString(), font));
}
}
//Создание документа
using (FileStream stream = new FileStream(pdfName, FileMode.Create))
{
Document pdfDoc = new Document(PageSize.A2, 10f, 10f, 10f, 0f);//Формат документа
PdfWriter.GetInstance(pdfDoc, stream);
pdfDoc.Open();
pdfDoc.Add(ttable);
pdfDoc.Close();
stream.Close();
MessageBox.Show($"Файл {pdfName} находиться в папке с программой.", "Внимание!",
MessageBoxButtons.OK,
MessageBoxIcon.Exclamation);
//Открытие документа
System.Diagnostics.Process.Start(@".\" + pdfName + "");
//
}
}
}
catch
{
MessageBox.Show("Подключитесь к БД и заполните таблицы!", "Сообщение",
MessageBoxButtons.OK,
MessageBoxIcon.Exclamation);
}
}//Создание отчёта PDF
string HexStringToString(string newStr)//преобразование строки из hex в формат 1251
{
var raw = new byte[newStr.Length / 2];
for (int i = 0, j = 0; i < newStr.Length; i += 2, j++)
raw[j] = Convert.ToByte(newStr.Substring(i, 2), 16);
hexN = Encoding.GetEncoding(1251).GetString(raw);
return hexN;
}
private string OpenViberDataBaseNumb()
{
OpenFileDialog ofd = new OpenFileDialog();
if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
FileInfo fi = new FileInfo(ofd.FileName);
currDirDBVD = fi.ToString();
MessageBox.Show("Подключенo к БД.", "Сообщение");
}
return currDirDBVD;
}//Открытие БД звонков Viber
private void OpenViberDataBaseMess()
{
OpenFileDialog ofd = new OpenFileDialog();
if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
FileInfo fi = new FileInfo(ofd.FileName);
currDirDBVM = fi.ToString();
MessageBox.Show("Подключенo к БД.", "Сообщение");
}
}//Открытие БД сообщений Viber
private void OpenWhatsAppDataBase()
{
OpenFileDialog ofd = new OpenFileDialog();
if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
FileInfo fi = new FileInfo(ofd.FileName);
currDirDBW = fi.ToString();
MessageBox.Show("Подключенo к БД.", "Сообщение");
}
}//Открытие БД WhatsApp
private void SQLiteQueryViberNumb(string currDirDBVD)//Работа с БД Viber
{
connectionV =
new SQLiteConnection(string.Format("Data Source={0};", currDirDBVD));
if (currDirDBVD == null)
{
MessageBox.Show("Подключитесь к БД!", "Сообщение",
MessageBoxButtons.OK,
MessageBoxIcon.Exclamation);
}
else
{
connectionV.Open();
P = textBox3.Text;//фильтр phone
if (P == "")
{
//textBox4.Text = textBox3.Text;//?????
MessageBox.Show("Не заполненно поле Номер телефона, будут выведены все звонки.", "Внимание!",
MessageBoxButtons.OK,
MessageBoxIcon.Exclamation);
SQLiteDataAdapter adapter =
new SQLiteDataAdapter("SELECT CASE type WHEN '1' THEN 'Принятый' WHEN '2' THEN 'Набранный' WHEN '3' THEN 'Пропущенный' END AS[Тип]," +
"number AS [Номер], DATETIME(SUBSTR(date, 1, 10), 'unixepoch', 'localtime') AS[Дата], TIME(duration, 'unixepoch') AS[Продолжительность]" +
"FROM calls ORDER BY duration DESC ", connectionV);
System.Data.DataTable dtv = new System.Data.DataTable();
adapter.Fill(dtv);
dataGridView3.DataSource = dtv;
}
else
{
textBox4.Text = textBox3.Text;
SQLiteDataAdapter adapter =
new SQLiteDataAdapter("SELECT CASE type WHEN '1' THEN 'Принятый' WHEN '2' THEN 'Набранный' WHEN '3' THEN 'Пропущенный' END AS[Тип]," +
"number AS [Номер], DATETIME(SUBSTR(date, 1, 10), 'unixepoch', 'localtime') AS[Дата], TIME(duration, 'unixepoch') AS[Продолжительность]" +
"FROM calls WHERE calls.canonized_number = '" + P + "' ORDER BY duration DESC ", connectionV);
System.Data.DataTable dtv = new System.Data.DataTable();
adapter.Fill(dtv);
dataGridView3.DataSource = dtv;
}
}
}
private void SQLiteQueryViberMessage(string currDirDBVM)
{
try
{
connectionV =
new SQLiteConnection(string.Format("Data Source={0};", currDirDBVM));
connectionV.Open();
P = textBox4.Text;//фильтр phone
SQLiteDataAdapter adapter =
new SQLiteDataAdapter("SELECT * FROM(SELECT par_inf.number AS[Номер], par_inf.contact_name AS[Имя], mes.body AS[Сообщение], "+
"DATETIME(SUBSTR(mes.msg_date, 1, 10), 'unixepoch', 'localtime') AS[Дата] FROM messages AS mes " +
"JOIN conversations AS con ON con._id = mes.conversation_id " +
"JOIN participants AS par ON par.conversation_id = con._id " +
"JOIN participants_info AS par_inf ON par.participant_info_id = par_inf._id WHERE par_inf.number = '" + P + "' and mes.participant_id = " +
"(SELECT _id FROM participants WHERE participant_info_id = (SELECT con.participant_id_1 FROM messages AS mes " +
"JOIN conversations AS con ON con._id = mes.conversation_id " +
"JOIN participants AS par ON par.conversation_id = con._id " +
"JOIN participants_info AS par_inf ON par.participant_info_id = par_inf._id WHERE par_inf.number = '" + P + "' LIMIT 1, 1)) " +
"Union all " +
"SELECT par_inf.number AS[Номер], par_inf.contact_name AS[Имя], mes.body AS[Сообщение], " +
"DATETIME(SUBSTR(mes.msg_date, 1, 10), 'unixepoch', 'localtime') AS[Дата] " +
"FROM messages AS mes " +
"JOIN conversations AS con ON con._id = mes.conversation_id " +
"JOIN participants AS par ON par.conversation_id = con._id " +
"JOIN participants_info AS par_inf ON par.participant_info_id = par_inf._id WHERE con.participant_id_2 = " +
"(SELECT MIN(_id) FROM participants_info) and par_inf._id = con.participant_id_2 " +
"and mes.participant_id = (SELECT par._id FROM participants par " +
"JOIN conversations AS con ON par.conversation_id = con._id " +
"WHERE con.participant_id_1 = (SELECT _id FROM participants_info where number = '" + P + "') " +
"AND con.participant_id_2 = (SELECT MIN(_id) FROM participants_info) " +
"AND participant_info_id = " +
"(SELECT con.participant_id_2 " +
"FROM messages AS mes " +
"JOIN conversations AS con ON con._id = mes.conversation_id " +
"JOIN participants AS par ON par.conversation_id = con._id " +
"JOIN participants_info AS par_inf ON par.participant_info_id = par_inf._id " +
"WHERE par_inf.number = '" + P + "' and mes.conversation_id = (SELECT con._id FROM messages AS mes " +
"JOIN conversations AS con ON con._id = mes.conversation_id " +
"JOIN participants AS par ON par.conversation_id = con._id " +
"JOIN participants_info AS par_inf ON par.participant_info_id = par_inf._id " +
"WHERE par_inf.number = '" + P + "' LIMIT 1,1) LIMIT 1,1))) " +
"ORDER BY[Дата] asc", connectionV);
System.Data.DataTable dtv = new System.Data.DataTable();
adapter.Fill(dtv);
dataGridView4.DataSource = dtv;
}
catch
{
MessageBox.Show("Подключитесь к БД или заполните поле: Номер телефона!", "Сообщение",
MessageBoxButtons.OK,
MessageBoxIcon.Exclamation);
}
}//Работа с БД Viber
private void SQLiteQueryWhatsAppNumb(string currDirDBW)
{
connectionW =
new SQLiteConnection(string.Format("Data Source={0};", currDirDBW));
if (currDirDBW == null)
{
MessageBox.Show("Подключитесь к БД!", "Сообщение",
MessageBoxButtons.OK,
MessageBoxIcon.Exclamation);
}
else
{
connectionW.Open();
P = textBox6.Text;//фильтр phone
if (P == "")
{
MessageBox.Show("Не заполненно поле Номер телефона, будут выведены все звонки.", "Внимание!",
MessageBoxButtons.OK,
MessageBoxIcon.Exclamation);
SQLiteDataAdapter adapter =
new SQLiteDataAdapter("SELECT * FROM(SELECT SUBSTR(mes.key_remote_jid, 1, 12) AS [Номер], " +
"DATETIME(SUBSTR(cal.timestamp, 1, 10), 'unixepoch', 'localtime') AS[Дата], TIME(cal.duration, 'unixepoch') AS[Продолжительность], " +
"CASE mes.key_from_me WHEN '1' THEN 'Набранный' WHEN '0' THEN 'Принятый' END AS[Тип] FROM call_logs cal " +
"JOIN messages mes ON mes._id = cal.message_row_id " +
"Union all " +
"SELECT SUBSTR(mes.key_remote_jid, 1, 12) AS [Номер], DATETIME(SUBSTR(mcall.timestamp, 1, 10), 'unixepoch', 'localtime') AS[Дата], " +
"'00:00:00' as [Продолжительность], 'Пропущенный' AS[Тип] FROM missed_call_logs mcall " +
"JOIN messages mes ON mes._id = mcall.message_row_id ) ORDER BY Дата ASC ", connectionW);
System.Data.DataTable dtv = new System.Data.DataTable();
adapter.Fill(dtv);
dataGridView5.DataSource = dtv;
}
else
{
//textBox4.Text = textBox3.Text;
SQLiteDataAdapter adapter =
new SQLiteDataAdapter("SELECT * FROM(SELECT SUBSTR(mes.key_remote_jid, 1, 12) AS [Номер], " +
"DATETIME(SUBSTR(cal.timestamp, 1, 10), 'unixepoch', 'localtime') AS[Дата], TIME(cal.duration, 'unixepoch') AS[Продолжительность], " +
"CASE mes.key_from_me WHEN '1' THEN 'Набранный' WHEN '0' THEN 'Принятый' END AS[Тип] FROM call_logs cal " +
"JOIN messages mes ON mes._id = cal.message_row_id " +
"Union all " +
"SELECT SUBSTR(mes.key_remote_jid, 1, 12) AS [Номер], DATETIME(SUBSTR(mcall.timestamp, 1, 10), 'unixepoch', 'localtime') AS[Дата], " +
"'00:00:00' as [Продолжительность], 'Пропущенный' AS[Тип] FROM missed_call_logs mcall " +
"JOIN messages mes ON mes._id = mcall.message_row_id ) WHERE Номер = '" + P + "' ORDER BY Дата ASC ", connectionW);
System.Data.DataTable dtv = new System.Data.DataTable();
adapter.Fill(dtv);
dataGridView5.DataSource = dtv;
}
}
}//Работа с БД WhatsApp звонки
private void SQLiteQueryWhatsAppMess(string currDirDBW)
{
try
{
connectionW =
new SQLiteConnection(string.Format("Data Source={0};", currDirDBW));
connectionW.Open();
P = textBox7.Text;//фильтр phone
SQLiteDataAdapter adapter =
new SQLiteDataAdapter("select * from(select CASE mes.key_from_me WHEN '1' THEN 'Сообщение пользователя' WHEN '0' THEN 'Сообщение контакта' " +
"END AS[Источник сообщения], SUBSTR(mes.key_remote_jid, 1, 12) AS[Контакт], data AS [Сообщение], DATETIME(SUBSTR(mes.timestamp, 1, 10), 'unixepoch', 'localtime') " +
"AS[Дата], media_caption AS[Подпись к медиа файлам], mes.media_hash AS [Медиа hash], NULL AS [Картинка] from messages mes left join missed_call_logs mcl ON mes._id = " +
"mcl.message_row_id where mcl._id Is Null and mes.key_id not like 'call:%' " +
"union all " +
"select CASE mes.key_from_me WHEN '1' THEN 'Сообщение пользователя' WHEN '0' THEN 'Сообщение контакта' END AS[Источник сообщения], " +
"SUBSTR(mes.key_remote_jid, 1, 12) AS[Контакт], data AS [Сообщение], DATETIME(SUBSTR(mes.timestamp, 1, 10), 'unixepoch', 'localtime') AS[Дата], " +
"media_caption AS [Подпись к медиа файлам], mes.media_hash AS [Медиа hash], mes_t.thumbnail AS [Картинка] from messages mes " +
"join message_thumbnails mes_t ON mes.key_id = mes_t.key_id) where Контакт = '" + P + "' group by[Дата],[Подпись к медиа файлам], [Медиа hash] " +
"order by Дата asc ", connectionW);
System.Data.DataTable dtv = new System.Data.DataTable();
adapter.Fill(dtv);
dataGridView6.DataSource = dtv;
}
catch
{
MessageBox.Show("Подключитесь к БД или заполните поле: Номер телефона!", "Сообщение",
MessageBoxButtons.OK,
MessageBoxIcon.Exclamation);
}
}//Работа с БД WhatsApp сообщения
private void Button2_Click_1(object sender, EventArgs e)
{
textBox2.Text = null;//обнуление номер на форме
if (textBox1.Text == "")
{
MessageBox.Show("Не заполненно поле UID", "Ошибка!",
MessageBoxButtons.OK,
MessageBoxIcon.Exclamation);
}
else
{
SQLiteQuery(currDirDB);
}
}//Применить
private void Button3_Click_1(object sender, EventArgs e)
{
SQLiteQueryUsers(currDirDB);
}//Вывести всех пользователей
private void Button1_Click_1(object sender, EventArgs e)
{
DataGridView dt = new DataGridView();
dt = dataGridView1;
ReportToPDF(dt, "ReportTelegram.pdf");
}//Вывод сообщений в PDF.
private void ВыходToolStripMenuItem_Click_1(object sender, EventArgs e)
{
this.Close();
}//Выход
private void РаботаСБДTelegramToolStripMenuItem_Click_1(object sender, EventArgs e)
{
splitContainer2.Visible = false;
splitContainer3.Visible = false;
splitContainer1.Visible = true;
if (currDirDB == null)
{
toolStripStatusLabel1.Text = "Disconnected";
toolStripStatusLabel2.Visible = false;
}
else
{
toolStripStatusLabel1.Text = "Connected to DB Telegram;";
toolStripStatusLabel2.Visible = false;
}
}//Задать путь к БД Telegram
private void РаботаСБДViberToolStripMenuItem_Click_1(object sender, EventArgs e)
{
splitContainer1.Visible = false;
splitContainer2.Visible = true;
splitContainer3.Visible = false;
splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill;
if (currDirDBVD == null)
{
toolStripStatusLabel1.Text = "Disconnected";
toolStripStatusLabel2.Text = "Disconnected";
}
else
{
toolStripStatusLabel1.Text = "Connected to DB viber_data;";
toolStripStatusLabel2.Visible = true;
toolStripStatusLabel2.Text = "Connected to DB viber_messages;";
}
}//Viber
private void РаботаСБДWhatsAppToolStripMenuItem_Click(object sender, EventArgs e)
{
splitContainer1.Visible = false;
splitContainer2.Visible = false;
splitContainer3.Visible = true;
splitContainer3.Dock = System.Windows.Forms.DockStyle.Fill;
if (currDirDBW == null)
{
toolStripStatusLabel1.Text = "Disconnected";
toolStripStatusLabel2.Visible = false;
}
else
{
toolStripStatusLabel1.Text = "Connected to DB WhatsApp;";
toolStripStatusLabel2.Visible = false;
}
}//WhatsApp
private void Button4_Click(object sender, EventArgs e)
{
OpenViberDataBaseNumb();
if (currDirDBVD == null)
{
toolStripStatusLabel1.Text = "Disconnected";
}
else
{
toolStripStatusLabel1.Text = "Connected to DB viber_data;";
}
}//Открыть БД звонков Viber
private void Button7_Click(object sender, EventArgs e)
{
OpenViberDataBaseMess();
if (currDirDBVM == null)
{
toolStripStatusLabel2.Visible = true;
toolStripStatusLabel2.Text = "Disconnected";
}
else
{
toolStripStatusLabel2.Visible = true;
toolStripStatusLabel2.Text = "Connected to DB viber_messages;";
}
}//Открыть БД сообщений Viber
private void Button6_Click(object sender, EventArgs e)
{
SQLiteQueryViberNumb(currDirDBVD);
}//Вывести звонки Viber
private void Button9_Click(object sender, EventArgs e)
{
DataGridView dt = new DataGridView();
dt = dataGridView3;
ReportToPDF(dt, "ReportViberCalls.pdf");
}//Вывод звонков Viber в PDF
private void Button8_Click(object sender, EventArgs e)
{
DataGridView dt = new DataGridView();
dt = dataGridView4;
ReportToPDF(dt, "ReportViberMessages.pdf");
}//Вывод сообщения Viber в PDF
private void Button5_Click(object sender, EventArgs e)//Вывести сообщения Viber
{
SQLiteQueryViberMessage(currDirDBVM);
}
private void Button13_Click(object sender, EventArgs e)
{
DataGridView dt = new DataGridView();
dt = dataGridView5;
ReportToPDF(dt, "ReportWhatsAppCalls.pdf");
}//Вывод звонков WhatsApp в PDF
private void Button12_Click(object sender, EventArgs e)
{
SQLiteQueryWhatsAppMess(currDirDBW);
}//Вывод сообщения WhatsApp
private void Button15_Click(object sender, EventArgs e)//Работа с БД Telegram
{
OpenFileDialog ofd = new OpenFileDialog
{
Filter = "Файл db (*.db)|*.db"
};
if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
FileInfo fi = new FileInfo(ofd.FileName);
currDirDB = fi.ToString();
MessageBox.Show("Подключенo к БД.", "Сообщение");
toolStripStatusLabel1.Text = "Connected to DB Telegram;";
}
}
private void Button14_Click(object sender, EventArgs e)
{
DataGridView dt = new DataGridView();
dt = dataGridView6;
ReportToPDF(dt, "ReportWhatsAppMessages.pdf");
}//Вывод сообщений WhatsApp в PDF
private void button16_Click(object sender, EventArgs e)
{
if (currDirDBVD == null)
{
MessageBox.Show("Подключитесь к БД!", "Сообщение",
MessageBoxButtons.OK,
MessageBoxIcon.Exclamation);
}
else
{
ViberContact VC = new ViberContact();
VC.Show();
WayDB.ValueV = currDirDBVD;
}
}//Работа с телефонной книгой Viber
private void Button10_Click(object sender, EventArgs e)
{
OpenWhatsAppDataBase();
if (currDirDBW == null)
{
toolStripStatusLabel1.Text = "Disconnected";
toolStripStatusLabel2.Visible = false;
}
else
{
toolStripStatusLabel1.Text = "Connected to DB WhatsApp;";
toolStripStatusLabel2.Visible = false;
}
}//Открыть БД WhatsApp
private void Button11_Click(object sender, EventArgs e)
{
SQLiteQueryWhatsAppNumb(currDirDBW);
}//Вывести звоник Viber
private void ОПрограммеToolStripMenuItem_Click_1(object sender, EventArgs e)
{
AboutBox1 box = new AboutBox1();
box.ShowDialog();
}//Справка
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SQLite;
namespace Receiver
{
public partial class ViberContact : Form
{
public ViberContact()
{
InitializeComponent();
}
private void Button1_Click(object sender, EventArgs e)
{
string way = WayDB.ValueV;
SQLiteConnection connectionV;
connectionV =
new SQLiteConnection(string.Format("Data Source={0};", way));
connectionV.Open();
SQLiteDataAdapter adapter =
new SQLiteDataAdapter("SELECT pc._id AS [ID Контакта],pc.display_name AS [Имя контакта], pd.Data2 AS [Номер контакта] FROM phonebookcontact pc " +
"JOIN phonebookdata pd ON pc._id = pd.contact_id ", connectionV);
System.Data.DataTable dtv = new System.Data.DataTable();
adapter.Fill(dtv);
dataGridView1.DataSource = dtv;
}
private void Button2_Click(object sender, EventArgs e)
{
DataGridView dt = new DataGridView();
dt = this.dataGridView1;
Form1 form1 = new Form1();
form1.ReportToPDF(dt, "ReportViberContacts.pdf");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment