Nephele Complete Docmnt

download Nephele Complete Docmnt

If you can't read please download the document

description

testing

Transcript of Nephele Complete Docmnt

NEPHELE ARCHITECTURE FOR PARALLEL DATA PROCESSING CODINGS:Form1 : Parallel Data Processingusing using using using using using using using System; System.Collections.Generic; System.ComponentModel; System.Data; System.Drawing; System.Linq; System.Text; System.Windows.Forms;

namespace NEPHELE_CLOUD { public partial class PARALLELDATA_PROCESS : Form { public PARALLELDATA_PROCESS() { InitializeComponent(); } STARTUP_FORM next = new STARTUP_FORM(); private void OK_Click(object sender, EventArgs e) { next.Show(); } } }

FORM 2 :- STARTUPButton1: Server Login Button2: Client login

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms;

namespace NEPHELE_CLOUD { public partial class STARTUP_FORM : Form {

public STARTUP_FORM() { InitializeComponent(); } SERVER_LOGIN obj = new SERVER_LOGIN(); private void button1_Click(object sender, EventArgs e) //ServerLogin// { obj.Show(); }

private void button2_Click(object sender, EventArgs e) //ClientLogin// { //string dummy = ""; string ip = "", name = ""; LOGIN log = new LOGIN(ip ,name );//dummy); log.Show(); } } }

FORM 3 : SERVER LOGINButton 1 : Register Button 2 : Login Button 3 : Cancelusing System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Data.SqlClient; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms;

namespace NEPHELE_CLOUD

{ public partial class SERVER_LOGIN : Form { public SERVER_LOGIN() { InitializeComponent(); } SERVER_MAIN obj = new SERVER_MAIN();

public SqlConnection con=new SqlConnection ("Data Source=.\\sqlexpress;Initial Catalog=NEPHELE_PROJECT;Integrated Security=True");

/********************SERVER REGISTRATION*********************/

private void registration_Click(object sender, EventArgs e) { con.Open(); string s = "insert into SERVER_LOGIN values('" + username.Text + "','" + password.Text + "')"; SqlCommand cmd = new SqlCommand(s, con); MessageBox.Show("Succesfully Logined....","THANKING FOR THE REGISTRATION"); cmd.ExecuteNonQuery(); cmd.Connection.Close(); con.Close(); this.Show();

}

/*********************SERVER LOGING***********************/

private void login_Click(object sender, EventArgs e) { con.Open(); string log = "select username,password from SERVER_LOGIN where username='" + username.Text.Trim() + "' and password='" + password.Text.Trim() + "'"; SqlCommand cmd = new SqlCommand(log, con); SqlDataReader rdr = cmd.ExecuteReader(); if (rdr.Read()) { MessageBox.Show("WELCOME TO THE PARALLEL DATA PROCESSING", "AUTHORISATION GRANTED"); obj.Show(); this.Close(); }

else { MessageBox.Show("Kindly Check Your UserName & PassWord", "Authorization Restricted"); } } private void CANCEL_Click(object sender, EventArgs e) { MessageBox.Show("Are you Sure"); this.Close(); } } }

FORM 4 : SERVER MAINButton 1 : Client Addition Button 2 : Client Edition Button 3 : Client Deletion Button 4 : Client Updation

Button 5 : Memmory Usage Button 6 : Reportusing System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms;

namespace NEPHELE_CLOUD { public partial class SERVER_MAIN : Form { public SERVER_MAIN() { InitializeComponent(); } ADD_CLIENT obj1= new ADD_CLIENT(); DELETE_CLIENT obj2 = new DELETE_CLIENT(); EDIT_CLIENT obj3 = new EDIT_CLIENT(); VIEW_CLIENT obj4 = new VIEW_CLIENT(); private void button1_Click(object sender, EventArgs e) { obj1.Show(); }

private void button2_Click(object sender, EventArgs e)

{ obj2.Show(); }

private void button3_Click(object sender, EventArgs e) { obj3.Show(); }

private void button4_Click(object sender, EventArgs e) { obj4.Show(); }

private void button5_Click(object sender, EventArgs e) { MessageBox.Show("SUCCESSFULLY LOGOUT"); }

private void memmory_usage_Click(object sender, EventArgs e) { MEMMORY_USAGE ob = new MEMMORY_USAGE(); this.Close(); ob.Show();

}

private void REPORT_Click(object sender, EventArgs e) {

} } }

FORM 6 : ADD_CLIENTButton 1 : View Clients IP's Button 2 : Client Addition Button 3 : Exitusing System;

using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Data.SqlClient; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms;

namespace NEPHELE_CLOUD { public partial class ADD_CLIENT : Form { public ADD_CLIENT() { InitializeComponent(); }

public SqlConnection con=new SqlConnection("Data Source=.\\sqlexpress;Initial Catalog=NEPHELE_PROJECT;Integrated Security=True"); private void button1_Click(object sender, EventArgs e) {

}

/********************************IP VIEWING**********************/

private void button2_Click(object sender, EventArgs e) { this.IPListing.Items.Clear();

con.Open(); SqlDataReader rdr; string qry; qry = "select ip from CLIENT_LOGIN "; SqlCommand cmd = new SqlCommand(qry, con); rdr = cmd.ExecuteReader(); if (rdr.Read()) { while (rdr.Read()) { //MessageBox.Show(rdr.GetString(0)); //this.textBox1.Text=rdr.GetString(0); this.IPListing.Items.Add(rdr.GetString(0)); } } else { MessageBox.Show("Choose a Valid IP"); }

//MessageBox.Show("Inseted"); cmd.Dispose(); cmd.Connection.Close(); con.Close(); //con.Open(); //string insrt = "select ip from CLIENT_LOGIN"; //SqlCommand c = new SqlCommand(insrt, con); //SqlDataReader rdr = c.ExecuteReader(); //while (rdr.Read())

//{ // //} //c.Connection.Close(); //con.Close(); listBox1.Items.Add(rdr.Read ().ToString() );

}

/********************************ADDITION OF CLIENT INTO THE 'REGISTERED_CLIENTS' table DATABASE*************/ private void button6_Click(object sender, EventArgs e) { /* STORING INTO THE REGISTERED_CLIENT Table */ con.Open(); string qry2 = "insert into REGIST_CLIENT values('" + clientname.Text + "','" + ip.Text + "','" + port.Text + "')"; SqlCommand cmd1 = new SqlCommand(qry2, con); cmd1.ExecuteNonQuery(); MessageBox.Show("SUCCESSFULLY ADDED"); cmd1.Connection.Close(); con.Close(); }

private void button5_Click(object sender, EventArgs e) { SERVER_MAIN s1 = new SERVER_MAIN();

this.Hide(); s1.Show(); }

private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { this.ip.Text = IPListing.SelectedItem.ToString(); con.Open(); SqlDataReader rdr; string qry; qry = "select * from CLIENT_LOGIN where ip='" + this.IPListing.SelectedItem + "'"; SqlCommand cmd = new SqlCommand(qry, con); rdr = cmd.ExecuteReader(); if (rdr.Read()) { this.clientname.Text = rdr[0].ToString(); this.port.Text = rdr[3].ToString();

} else { MessageBox.Show("THIS IS NOT A VALID IP"); } cmd.Dispose(); cmd.Connection.Close(); con.Close(); } } }

FORM 7 : DELETE_CLIENTButton 1 : View Clients IP's Button 2 : Client Deletion Button 3 : Exit

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Data.SqlClient; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms;

namespace NEPHELE_CLOUD { public partial class DELETE_CLIENT : Form { public DELETE_CLIENT() { InitializeComponent(); } public SqlConnection con = new SqlConnection("Data Source=.\\sqlexpress;Initial Catalog=NEPHELE_PROJECT;Integrated Security=True");

/********************** IP LISTING FOR DELETION *****************/

private void button1_Click(object sender, EventArgs e) { this.IP_List.Items.Clear();

con.Open(); SqlDataReader rdr; string qry; qry = "select ip from REGIST_CLIENT ";

SqlCommand cmd = new SqlCommand(qry, con); rdr = cmd.ExecuteReader(); if (rdr.Read()) { while (rdr.Read()) { //MessageBox.Show(rdr.GetString(0)); //this.textBox1.Text=rdr.GetString(0); this.IP_List.Items.Add(rdr.GetString(0)); } } else { MessageBox.Show("Choose a Valid IP"); }

//MessageBox.Show("Inseted"); cmd.Dispose(); cmd.Connection.Close(); con.Close(); }

private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { this.textBox2.Text = IP_List.SelectedItem.ToString(); con.Open(); SqlDataReader rdr; string qry; qry = "select * from REGIST_CLIENT where ip='" + this.IP_List.SelectedItem + "'";

SqlCommand cmd = new SqlCommand(qry, con); rdr = cmd.ExecuteReader(); if (rdr.Read()) { this.textBox1.Text = rdr[0].ToString(); this.textBox3.Text = rdr[2].ToString();

} else { MessageBox.Show("THIS IS NOT A VALID IP"); } cmd.Dispose(); cmd.Connection.Close(); con.Close(); }

/****************************** DELETING THE CLIENTS ************************/

private void button2_Click(object sender, EventArgs e) { con.Open(); //SqlDataReader rdr; string qry; qry = "delete from REGIST_CLIENT where ip='" + this.IP_List.SelectedItem + "'"; SqlCommand cmd = new SqlCommand(qry, con);

cmd.ExecuteNonQuery(); MessageBox.Show("deleted");

cmd.Connection.Close(); con.Close(); }

/************************ EXIT FROM THE DELETION PROCESS *******************/

private void button3_Click(object sender, EventArgs e) { SERVER_MAIN s1 = new SERVER_MAIN(); this.Hide(); s1.Show(); } } }

FORM 8 :EDIT-CLIENTButton 1 : View Clients IP's Button 2 : Client Editing Button 3 : Clear Results Button 4 : Exitusing System; using System.Collections.Generic; using System.ComponentModel;

using System.Data; using System.Data.SqlClient; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms;

namespace NEPHELE_CLOUD { public partial class EDIT_CLIENT : Form { public EDIT_CLIENT() { InitializeComponent(); } public SqlConnection con = new SqlConnection("Data Source=.\\sqlexpress;Initial Catalog=NEPHELE_PROJECT;Integrated Security=True");

/********************IP LISTING FOR THE CLIENTS*******************/

private void button1_Click(object sender, EventArgs e) { this.iplist.Items.Clear(); con.Open(); SqlDataReader rdr; string qry; qry = "select ip from REGIST_CLIENT "; SqlCommand cmd = new SqlCommand(qry, con); rdr = cmd.ExecuteReader(); if (rdr.Read())

{ while (rdr.Read()) { //MessageBox.Show(rdr.GetString(0)); //this.textBox1.Text=rdr.GetString(0); this.iplist.Items.Add(rdr.GetString(0)); } } else { MessageBox.Show("Choose a Valid IP"); }

//MessageBox.Show("Inseted"); cmd.Dispose(); cmd.Connection.Close(); con.Close(); }

private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { this.textBox2.Text = iplist.SelectedItem.ToString(); con.Open(); SqlDataReader rdr; string qry; qry = "select * from REGIST_CLIENT where ip='" + this.iplist.SelectedItem + "'"; SqlCommand cmd = new SqlCommand(qry, con); rdr = cmd.ExecuteReader(); if (rdr.Read())

{ this.textBox1.Text = rdr[0].ToString(); this.textBox3.Text = rdr[2].ToString();

} else { MessageBox.Show("THIS IS NOT A VALID IP"); } cmd.Dispose(); cmd.Connection.Close(); con.Close(); }

/************************************UPDATING THE CLIENTS***********************/

private void button2_Click(object sender, EventArgs e) { con.Open(); //SqlDataReader rdr; string qry; qry = "update REGIST_CLIENT set port='" + this.textBox4.Text + "' where ip='" + this.textBox2.Text + "'"; SqlCommand cmd = new SqlCommand(qry, con);

cmd.ExecuteNonQuery(); MessageBox.Show("UPDATED"); cmd.Connection.Close(); con.Close(); }

/************************ EXIT FROM THE UPDATION ***************/

private void button3_Click(object sender, EventArgs e) {

SERVER_MAIN s1 = new SERVER_MAIN(); this.Hide(); s1.Show(); }

/*********************CLEAR THE ENTRIES ****************/

private void button4_Click(object sender, EventArgs e) { textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = "";

} } }

FORM 9 : VIEW_CLIENTButton 1 : View Registered Clients Button 2 : Exitusing System; using System.Collections.Generic; using System.ComponentModel;

using System.Data; using System.Data.SqlClient; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms;

namespace NEPHELE_CLOUD { public partial class VIEW_CLIENT : Form { public VIEW_CLIENT() { InitializeComponent(); } public SqlConnection con = new SqlConnection("Data Source=.\\sqlexpress;Initial Catalog=NEPHELE_PROJECT;Integrated Security=True");

private void VIEW_CLIENT_Load(object sender, EventArgs e) { // TODO: This line of code loads data into the 'nEPHELE_PROJECTDataSet1.REGIST_CLIENT' table. You can move, or remove it, as needed. this.rEGIST_CLIENTTableAdapter2.Fill(this.nEPHELE_PROJECTDataSet1.REGIST_CLIENT); // TODO: This line of code loads data into the 'nEPHELE_PROJECTDataSet.REGIST_CLIENT' table. You can move, or remove it, as needed. this.rEGIST_CLIENTTableAdapter1.Fill(this.nEPHELE_PROJECTDataSet.REGIST_CLIENT); //// TODO: This line of code loads data into the '_D__MCA_NEHRU_MANUPRASAD_NEPHELE_CLOUD_NEPHELE_PROJECT_MDFDataSet.REGIS T_CLIENT' table. You can move, or remove it, as needed. //this.rEGIST_CLIENTTableAdapter.Fill(this.Data Source=.\\sqlexpress;Initial Catalog=NEPHELE_PROJECT;Integrated Security=True.REGIST_CLIENT); dataGridView2.Visible = false;

}

/********************* VIEWING THE REGISTERED CLIENT DETAILS **************/

private void view_Click(object sender, EventArgs e) { dataGridView2.Visible = true; }

/*********************** EXIT FROM THE VIEWING OF REGISTERED CLIENT ***********/

private void exit_Click(object sender, EventArgs e) { SERVER_MAIN s1 = new SERVER_MAIN(); this.Hide(); s1.Show(); }

private void fillByToolStripButton_Click(object sender, EventArgs e) { try { this.rEGIST_CLIENTTableAdapter1.FillBy(this.nEPHELE_PROJECTDataSet.REGIST_CLIENT); } catch (System.Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message); }

}

private void dataGridView2_CellContentClick(object sender, DataGridViewCellEventArgs e) {

}

} }

FORM 10 : MEMMORY-USAGEButton 1 : Registry-Startup Button 2 : Memmory Usage Button 3 : Exit

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Data.SqlClient; using System.Diagnostics; using System.IO; using System.Net;

namespace NEPHELE_CLOUD {

public partial class MEMMORY_USAGE : Form { public MEMMORY_USAGE() { InitializeComponent(); }

/******************** GRAPHICAL VIEWING ******************/

private void graphical_view_Click(object sender, EventArgs e) { Process netUtility1 = new Process(); netUtility1.StartInfo.FileName = AppDomain.CurrentDomain.BaseDirectory + "\\MemoryPerformanceMonitoring.exe";

//netUtility.StartInfo.CreateNoWindow = true; netUtility1.StartInfo.RedirectStandardOutput = true; netUtility1.StartInfo.UseShellExecute = false; netUtility1.StartInfo.RedirectStandardError = true; netUtility1.Start();

}

/******************** REGISTRY STARTING UP ****************/

private void registery_startup_Click(object sender, EventArgs e) { try {

Process netUtility = new Process(); netUtility.StartInfo.FileName = "regedit"; //netUtility.StartInfo.CreateNoWindow = true; netUtility.StartInfo.RedirectStandardOutput = true; netUtility.StartInfo.UseShellExecute = false; netUtility.StartInfo.RedirectStandardError = true; netUtility.Start();

MessageBox.Show("Registery Started");

//Process netUtility1 = new Process(); //netUtility1.StartInfo.FileName = AppDomain.CurrentDomain.BaseDirectory+"\\MemoryPerformanceMonitoring.exe";

////netUtility.StartInfo.CreateNoWindow = true; //netUtility1.StartInfo.RedirectStandardOutput = true; //netUtility1.StartInfo.UseShellExecute = false; //netUtility1.StartInfo.RedirectStandardError = true; //netUtility1.Start();

} catch (Exception ex) { MessageBox.Show("error=" + ex.Message); } }

/******************* EXIT FROM THE MEMMORY CHECK **************/

private void Exit_Click(object sender, EventArgs e) { SERVER_MAIN ob1 = new SERVER_MAIN(); this.Close(); ob1.Show();

}

} }

FORM 11 : REPORTButton 1 : Compressed Files Button 2 : Decompressed Files Button 3 : Exit

FORM 12 : CLIENT MAINButton 1 : Registration Button 2 : Login Button 3 : Cancelusing System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Data.SqlClient ; using System.Drawing;

using System.Linq; using System.Text; using System.Windows.Forms; using System.Net; using System.Net.NetworkInformation;

namespace NEPHELE_CLOUD { public partial class LOGIN : Form { string ipf,cl_name;

public LOGIN(string ip,string name) { InitializeComponent();

} public SqlConnection con=new SqlConnection("Data Source=.\\sqlexpress;Initial Catalog=NEPHELE_PROJECT;Integrated Security=True");

REGISTRATION obj = new REGISTRATION(); //COMPRESSION obj1=new COMPRESSION(); private void register_Click(object sender, EventArgs e) { obj.Show();

}

//private void button2_Click(object sender, EventArgs e) //{

// // con.Open(); // // string check; // // check="select * from CLIENT_LOGIN where username='" +textBox1.Text + "' and password='" +textBox2.Text+ "'"; // // SqlCommand cmd; // // string rs; // // cmd = new SqlCommand(check,con); // // rs = cmd.ExecuteReader(); // // if (rs.Read()) // // { //frmhome f1 = new frmhome(txtuname.Text.Trim()); // // // // // // // // } // // else // // { // // // //} // // cmd.Connection.Close(); // // con.Close(); MessageBox.Show("Wrong user!! Contact Admin"); //f1.Show(); obj1.Show(); this.Hide();

//} /****************CANCEL BUTTON *********************/ private void button3_Click(object sender, EventArgs e) { username.Text = ""; password.Text = "";

}

/****************LOGIN BUTTON *********************/

private void ok_Click(object sender, EventArgs e) {

con.Open(); SqlCommand cmd = new SqlCommand("SELECT username,password,ip FROM CLIENT_LOGIN where username ='" + username.Text + "'and password ='" + password.Text + "'", con); SqlDataReader da = cmd.ExecuteReader(); if (da.Read()) { this.Hide(); MessageBox.Show("Login Sucess!!"); cl_name = da.GetString(0); ipf = da.GetString(2);

CLIENT_TASKINITIALIZATION obj1 = new CLIENT_TASKINITIALIZATION(ipf,cl_name); obj1.Show();

} else { MessageBox.Show("Sorry! Check your Username & Password"); int i = 1; i = i + 1; if (i == 3) { System.Media.SystemSounds.Hand.Play(); MessageBox.Show("Maximum Number of Attempts!!!"); this.Close();

}

}

}

private void LOGIN_Load(object sender, EventArgs e) { //label3.Text = ipf; //label3.Visible = true;

} } }

FORM 12 : CLIENT REGISTRATIONButton 1 : Registration Button 3 : Cancel Button 2 : IP-Testusing System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq;

using System.Text; using System.Windows.Forms; using System.Data.SqlClient; using System.Diagnostics; using System.IO; using System.Net;

namespace NEPHELE_CLOUD { public partial class REGISTRATION : Form { public REGISTRATION() { InitializeComponent(); } public SqlConnection con = new SqlConnection("Data Source=.\\sqlexpress;Initial Catalog=NEPHELE_PROJECT;Integrated Security=True"); private void REGISTRATION_Load(object sender, EventArgs e) {

Process netUtility = new Process();

netUtility.StartInfo.FileName = "net.exe";

netUtility.StartInfo.CreateNoWindow = true;

netUtility.StartInfo.Arguments = "view";

netUtility.StartInfo.RedirectStandardOutput = true;

netUtility.StartInfo.UseShellExecute = false;

netUtility.StartInfo.RedirectStandardError = true;

netUtility.Start();

StreamReader streamReader = new StreamReader(netUtility.StandardOutput.BaseStream, netUtility.StandardOutput.CurrentEncoding);

string line = ""; string strHostName; while ((line = streamReader.ReadLine()) != null) { try {

if (line.StartsWith("\\")) { strHostName = line.Substring(2).Substring(0, line.Substring(2).IndexOf(" ")).ToUpper(); IPHostEntry ipEntry = Dns.GetHostByName(strHostName); IPAddress[] iparrAddr = ipEntry.AddressList;

if (iparrAddr.Length > 0) {

for (int intLoop = 0; intLoop < iparrAddr.Length; intLoop++) { comboBox1.Items.Add(iparrAddr[intLoop].ToString()); // listBox1.Items.Add(iparrAddr[intLoop].ToString());

}

}

//listBox1.Items.Add(line.Substring(2).Substring(0, line.Substring(2).IndexOf(" ")).ToUpper());

}

} catch(Exception ) {

} }

streamReader.Close(); netUtility.WaitForExit(1000);

// //

if (line.StartsWith("\\")) {

// strHostName = line.Substring(2).Substring(0, line.Substring(2).IndexOf(" ")).ToUpper(); // // IPHostEntry ipEntry = Dns.GetHostByName(strHostName); IPAddress[] iparrAddr = ipEntry.AddressList;

// // // // //

if (iparrAddr.Length > 0) { for (int intLoop = 0; intLoop < iparrAddr.Length; intLoop++) { comboBox1.Items.Add(iparrAddr[intLoop].ToString());

// // // }

//listBox1.Items.Add(iparrAddr[intLoop].ToString()); //comboBox4.Items.Add(iparrAddr[intLoop].ToString());

//

}

// // listBox1.Items.Add(line.Substring(2).Substring(0, line.Substring(2).IndexOf(" ")).ToUpper());

//

}

//}

//streamReader.Close(); //netUtility.WaitForExit(1000); }

//CANCELING//

private void button2_Click(object sender, EventArgs e) { MessageBox.Show("ARE YOU SURE?"); textBox1.Text = ""; textBox3.Text = ""; textBox4.Text = ""; textBox5.Text = "";

}

//REGISTRATION//

private void button1_Click(object sender, EventArgs e) { con.Open(); string q1 = "select ip,port from CLIENT_LOGIN where ip='" + comboBox1.Text.Trim()+ "'and port='" +textBox5.Text.Trim() +"'"; SqlCommand cmd = new SqlCommand(q1, con); SqlDataReader rdr = cmd.ExecuteReader();

if(rdr.Read()) { MessageBox.Show("User already registered with the ip and port..Try again"); return;

}

else { if (con.State == ConnectionState.Open) { con.Close(); } con.Open(); string qry1 = "insert into CLIENT_LOGIN values('" + textBox1.Text + "','" + textBox4.Text + "','" + comboBox1.SelectedItem + "','" + textBox5.Text + "')"; SqlCommand cmd3 = new SqlCommand(qry1, con); MessageBox.Show("You are Registered as Authorised user"); cmd3.ExecuteNonQuery(); cmd3.Connection.Close(); this.Hide(); cmd3.Connection.Close(); con.Close();

}

cmd.Connection.Close(); con.Close();

// con.Open();

//if (cmd1 != comboBox1.SelectedItem) //{

//string qry1 = "insert into CLIENT_LOGIN values('" + textBox1.Text + "','" + textBox4.Text + "','" + comboBox1.SelectedItem + "','" + textBox5.Text + "')"; //SqlCommand cmd = new SqlCommand(qry1, con); //MessageBox.Show("You are Registered as Authorised user"); //this.Hide(); //cmd.ExecuteNonQuery(); //cmd.Connection.Close(); //con.Close();

//} //else //{ // //} MessageBox.Show("SORRY U CANNOT REGISTER", "-This is not a valid IP");

}

/* IP TESTING */

private void button3_Click(object sender, EventArgs e) { //con.Open(); //string ip1; //ip1 = comboBox1.SelectedItem.ToString(); ////"SELECT [UserID] FROM [UserInfo] where [UserID] = @UserID and Password = @Password" //string qry2 = "select ip from CLIENT_LOGIN where ip=ip1"; //SqlCommand cmd1 = new SqlCommand(qry2, con);

//MessageBox.Show("ip" + cmd1); ////cmd1.ExecuteNonQuery(); //cmd1.Connection.Close(); //con.Close(); MessageBox.Show("ip"+comboBox1.SelectedItem );

} } }

FORM 13 : CLIENT LOGINButton 1 : Registration

Button 3 : Login Button 2 : Clearusing System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Data.SqlClient ; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Net; using System.Net.NetworkInformation;

namespace NEPHELE_CLOUD { public partial class LOGIN : Form { string ipf,cl_name;

public LOGIN(string ip,string name) { InitializeComponent();

} public SqlConnection con=new SqlConnection("Data Source=.\\sqlexpress;Initial Catalog=NEPHELE_PROJECT;Integrated Security=True");

REGISTRATION obj = new REGISTRATION(); //COMPRESSION obj1=new COMPRESSION(); private void register_Click(object sender, EventArgs e) { obj.Show();

}

//private void button2_Click(object sender, EventArgs e) //{ // // con.Open(); // // string check; // // check="select * from CLIENT_LOGIN where username='" +textBox1.Text + "' and password='" +textBox2.Text+ "'"; // // SqlCommand cmd; // // string rs; // // cmd = new SqlCommand(check,con); // // rs = cmd.ExecuteReader(); // // if (rs.Read()) // // { //frmhome f1 = new frmhome(txtuname.Text.Trim()); // // // // // // // // } // // else // // { // // // //} // // cmd.Connection.Close(); // // con.Close(); MessageBox.Show("Wrong user!! Contact Admin"); //f1.Show(); obj1.Show(); this.Hide();

//} /****************CANCEL BUTTON *********************/ private void button3_Click(object sender, EventArgs e) { username.Text = ""; password.Text = "";

}

private void ok_Click(object sender, EventArgs e) {

con.Open(); SqlCommand cmd = new SqlCommand("SELECT username,password,ip FROM CLIENT_LOGIN where username ='" + username.Text + "'and password ='" + password.Text + "'", con); SqlDataReader da = cmd.ExecuteReader(); if (da.Read()) { this.Hide(); MessageBox.Show("Login Sucess!!"); cl_name = da.GetString(0); ipf = da.GetString(2);

CLIENT_TASKINITIALIZATION obj1 = new CLIENT_TASKINITIALIZATION(ipf,cl_name); obj1.Show();

} else

{ MessageBox.Show("Sorry! Check your Username & Password"); int i = 1; i = i + 1; if (i == 3) { System.Media.SystemSounds.Hand.Play(); MessageBox.Show("Maximum Number of Attempts!!!"); this.Close(); }

}

}

private void LOGIN_Load(object sender, EventArgs e) { //label3.Text = ipf; //label3.Visible = true;

} } }

FORM 14 : CLIENT TASK INITIALIZATIONButton 1 : START

FORM 14 : COMPRESSIONButton 1 : STARTusing System; using System.Collections.Generic; using System.ComponentModel; using System.Data;

using System.Data.SqlClient; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Diagnostics; using System.IO; using Microsoft.WindowsAzure; using Microsoft.WindowsAzure.StorageClient; using System.IO.Compression;

namespace NEPHELE_CLOUD { public partial class COMPRESSION : Form { string recivedip, name; string port; // public SqlConnection con = new SqlConnection("Data Source=.\\sqlexpress;Initial Catalog=NEPHELE_PROJECT;Integrated Security=True"); DBConnection dbc;//=new DBConnection(); private const string AccountKey = null; // use local storage in the Dev Fabric bool didNotExistCreated; private const string AccountName = "bostonazuretemp"; private const string ContainerName = "snippets"; private const string MimeTypeName = "text/plain"; // since these are assumed to be code snippets string snippetFilePath ="";// "c:\\myfiles\\Desert.jpg"; string baseUri = null; CloudBlobClient blobStorage = null; String s, sss;

byte[] sb, comp, decomp; int sdfff, dafter; public String user_name; //public CompressionTask(String un) //{ // // // //} public static byte[] DeCompress(byte[] bytInput) { string strResult = ""; int totalLength = 0; byte[] writeData = new byte[4096]; Stream s2 = new GZipStream(new MemoryStream(bytInput), CompressionMode.Decompress); try { while (true) { int size = s2.Read(writeData, 0, writeData.Length); if (size > 0) { totalLength += size; strResult += System.Text.Encoding.Unicode.GetString(writeData, 0, size); } else { break; } } InitializeComponent(); user_name = un.Trim(); dbc = new DBConnection();

s2.Close(); return Encoding.Unicode.GetBytes(strResult); } catch { return null; } } public static byte[] Compress(byte[] bytData) { try { MemoryStream ms = new MemoryStream(); Stream s = new GZipStream(ms, CompressionMode.Compress); s.Write(bytData, 0, bytData.Length); s.Close(); byte[] compressedData = (byte[])ms.ToArray(); return compressedData; } catch { return null; } } private static string readfile(string path) { StreamReader reader = new StreamReader(path); string s = reader.ReadToEnd(); return s; } private static void makefile(string text, string sd)

{ StreamWriter wr = new StreamWriter(sd); wr.Write(text); wr.Close(); }

public COMPRESSION(string addr, string nam) { InitializeComponent(); name = nam; recivedip = addr; dbc = new DBConnection();

}

private void open_Click(object sender, EventArgs e) { opndlg.Filter = "textfile|*.txt|*AllFiles|*.*"; opndlg.ShowDialog(); txtimage.Text = opndlg.FileName; //opndlg.ShowDialog(); //opndlg.InitialDirectory = "c:\\"; //opndlg.Title = "images"; //openFileDialog1.Filter = "jpeg|*.jpeg|*alterfiles|*.jpg";

//openFileDialog1.Filter = "text file|*.txt|all files|*.*"; //openFileDialog1.ShowDialog(); //string fn = openFileDialog1.FileName; //string fs = new FileStream(fn, FileMode.Open); ////sr = new StreamReader(fs); ////sr.Close(); ////fs.Close(); //fs = new FileStream(openFileDialog1.FileName, FileMode.OpenOrCreate); //sr = new StreamReader(fs); ////sr2 = new StreamReader(fs); //richTextBox1.Text = sr.ReadToEnd(); ////textBox1.Text = sr.ReadToEnd(); ////textBox2.Text = sr.ReadToEnd(); ////textBox3.Text = sr.ReadToEnd(); }

//private void open_todecompress_Click(object sender, EventArgs e) //{ // // opndlg.Filter = "textfile|*.txt|*AllFiles|*.*"; opndlg.ShowDialog();

// // // // // // // //}

imageloc.Text = opndlg.FileName; //openFileDialog2.ShowDialog(); //openFileDialog2.InitialDirectory = "c:\\"; //openFileDialog2.Title = "images"; ////openFileDialog2.Filter = "jpeg|*.jpeg|*alterfiles|*.jpg"; //openFileDialog2.Filter = "textfile|*.txt|*AllFiles|*.*"; //openFileDialog2.ShowDialog();

/**************************** PROCESSING OF DECOMPRESSION & DOWNLOAD***********************/

private void button4_Click(object sender, EventArgs e) { if (File.Exists("ImageUpload/c") == false) { MessageBox.Show("NO FILES TO DECOMPRESS.........Try Again!!!"); return; } else {

sdfff = sss.Length; dafter = comp.Length; decomp = DeCompress(comp);

if (File.Exists("ImageUpload/d")) { File.Delete("ImageUpload/d"); } makefile(Encoding.Unicode.GetString(decomp), "ImageUpload/d"); int dret = decomp.Length; if (sb == decomp) { s = "success"; } else { s = Encoding.Unicode.GetString(decomp);

} Data"); MessageBox.Show("Decompressed Sucessfully......Please Wait CLOUD to View try { /*********************** INSERTION TO THE TABLE FOR UPDATING DECOMPRESSION STATUS**********************/

dbc.openconnection(); SqlCommand decomqry = new SqlCommand("insert into SYSTEM_INFO values('" + name+ "','" + recivedip + "','" + port + "','Decompressed','" + DateTime.Now.ToShortDateString() + "')", dbc.con); decomqry.ExecuteNonQuery(); decomqry.Connection.Close(); dbc.con.Close();

CloudBlobContainer blobContainer = blobStorage.GetContainerReference(ContainerName); didNotExistCreated = blobContainer.CreateIfNotExist();

var perms = new BlobContainerPermissions { PublicAccess = BlobContainerPublicAccessType.Container // Blob (see files if you know the name) or Container (enumerate like a directory) }; blobContainer.SetPermissions(perms); // This line makes the blob public so it is available from a web browser (no magic needed to read it)

var fi = new FileInfo(snippetFilePath); string blobUriPath = fi.Name; // could also use paths, as in: "images/" + fileInfo.Name; CloudBlob blob = blobContainer.GetBlobReference(blobUriPath); blob.UploadFile(fi.FullName); // REST call under the hood; use tool like Fiddler to see generated http traffic (http://fiddler2.com)

blob.Properties.ContentType = MimeTypeName; // IMPORTANT: Mime Type here needs to match type of the uploaded file // e.g., *.png image/png, *.wmv video/x-ms-wmv (http://en.wikipedia.org/wiki/Internet_media_type) blob.SetProperties(); // REST call under the hood

blob.Metadata["SourceFileName"] = fi.FullName; // not required just showing how to store metadata blob.Metadata["WhenFileUploadedUtc"] = DateTime.UtcNow.ToLongTimeString(); blob.SetMetadata(); // REST call under the hood

string url = String.Format("{0}/{1}/{2}", baseUri, ContainerName, blobUriPath); Process process = System.Diagnostics.Process.Start(url); // see the image you just uploaded (works from Console, WPF, or Forms app not from ASP.NET app) }

catch (Exception er) { MessageBox.Show("errror at read=" + er.Message); } }

//delete all files from folder

}

/* ***************************COMPRESSION TASK **********************************/

private void compress_Click(object sender, EventArgs e) {

/*****************************PORT ACCESING********************************/

dbc.openconnection(); string getport = "select port from REGIST_CLIENT where client_name='" + name.Trim() + "' and ip='" + recivedip.Trim() + "'"; SqlCommand command = new SqlCommand(getport,dbc.con); SqlDataReader rdr = command.ExecuteReader(); if (rdr.Read()) { port = rdr.GetString(0); MessageBox.Show("PORT IS:",rdr.GetString(0));

} command.Connection.Close(); dbc.con.Close();

if (txtimage.Text.Trim() == "") { MessageBox.Show("No image selected"); return;

} /////////////////// compressing data //////////////////////

String txt = txtimage.Text.Trim(); int len = txt.Length; int ind= txt.LastIndexOf("\\"); String filenm = txt.Substring(ind,(len-ind)); filenm = filenm.Substring(1,(filenm.Length-1)); snippetFilePath = "ImageUpload\\" + filenm;

if (Directory.Exists("ImageUpload") == false) { Directory.CreateDirectory("ImageUpload"); if (File.Exists("ImageUpload/" + filenm) == true) { File.Delete("ImageUpload/" + filenm); File.Copy(txtimage.Text, "ImageUpload/" + filenm); }

}

else { File.Delete("ImageUpload/" + filenm); File.Copy(txtimage.Text, "ImageUpload/" + filenm); }

s = readfile("ImageUpload/"+filenm);//"c:/myfiles/Koala.jpg"); sb = Encoding.Unicode.GetBytes(s);

makefile(s, "ImageUpload/t");

///////////GZipCompressDecompress(sb);/////////////////////

comp = Compress(sb); sss = Encoding.ASCII.GetString(comp); makefile(sss, "ImageUpload/c"); MessageBox.Show("compressed sucessfully");

/**************************** INSERTION TO THE TABLE**********************/

try { dbc.openconnection(); // MessageBox.Show("insert into SYSTEM_INFO values('" + name + "','" + recivedip + "','" + port + "','Compressed','" + DateTime.Now.ToShortDateString() + "')"); SqlCommand cmd2 = new SqlCommand("insert into SYSTEM_INFO values('" + name+ "','" + recivedip + "','" + port + "','Compressed','" + DateTime.Now.ToShortDateString() + "')", dbc.con); cmd2.ExecuteNonQuery(); dbc.con.Close(); } catch (Exception er) { MessageBox.Show("Error on Saving data:"+er.Message); return; }

//insert into table //try //{ // // String port="", ip=""; dbc.openconnection();

// SqlCommand cmd = new SqlCommand("select ip,port from clientlonginreg where username='" + user_name.Trim() + "'", dbc.con); // // // // // // // // } cmd.Connection.Close(); dbc.con.Close(); SqlDataReader rs = cmd.ExecuteReader(); if (rs.Read()) { ip = rs.GetString(0); port = rs.GetString(1);

//

dbc.openconnection();

// SqlCommand cmd1 = new SqlCommand("insert into SYSTEM_INFO values('" + ip + "','" + port + "','Compressed','" + DateTime.Now.ToShortDateString() + "')", dbc.con); // // // //} //catch (Exception er) //{ // // //} MessageBox.Show("Error on saving data:"+er.Message); return; cmd1.ExecuteNonQuery(); cmd1.Connection.Close(); dbc.con.Close();

//////////////////// //

for storage in cloud ///////////////////////

if (AccountKey == null) { var clientStorageAccount = CloudStorageAccount.DevelopmentStorageAccount; // use storage services in the Developer Fabric, not real cloud baseUri = clientStorageAccount.BlobEndpoint.AbsoluteUri; blobStorage = new CloudBlobClient(baseUri, clientStorageAccount.Credentials); }

else { byte[] key = Convert.FromBase64String(AccountKey); var creds = new StorageCredentialsAccountAndKey(AccountName, key); baseUri = string.Format("http://{0}.blob.core.windows.net", AccountName); blobStorage = new CloudBlobClient(baseUri, creds); }

MessageBox.Show("Compressed and Stored in cloud,,,,,,,,"); }

} }

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Data.SqlClient; using System.Drawing; using System.Linq; using System.Text;

using System.Windows.Forms; using System.Diagnostics; using System.IO; using Microsoft.WindowsAzure; using Microsoft.WindowsAzure.StorageClient; using System.IO.Compression;

namespace NEPHELE_CLOUD { public partial class COMPRESSION : Form { string recivedip, name; string port; // public SqlConnection con = new SqlConnection("Data Source=.\\sqlexpress;Initial Catalog=NEPHELE_PROJECT;Integrated Security=True"); DBConnection dbc;//=new DBConnection(); private const string AccountKey = null; // use local storage in the Dev Fabric bool didNotExistCreated; private const string AccountName = "bostonazuretemp"; private const string ContainerName = "snippets"; private const string MimeTypeName = "text/plain"; // since these are assumed to be code snippets string snippetFilePath ="";// "c:\\myfiles\\Desert.jpg"; string baseUri = null; CloudBlobClient blobStorage = null; String s, sss; byte[] sb, comp, decomp; int sdfff, dafter; public String user_name; //public CompressionTask(String un)

//{ // // // //} public static byte[] DeCompress(byte[] bytInput) { string strResult = ""; int totalLength = 0; byte[] writeData = new byte[4096]; Stream s2 = new GZipStream(new MemoryStream(bytInput), CompressionMode.Decompress); try { while (true) { int size = s2.Read(writeData, 0, writeData.Length); if (size > 0) { totalLength += size; strResult += System.Text.Encoding.Unicode.GetString(writeData, 0, size); } else { break; } } s2.Close(); return Encoding.Unicode.GetBytes(strResult); } catch InitializeComponent(); user_name = un.Trim(); dbc = new DBConnection();

{ return null; } } public static byte[] Compress(byte[] bytData) { try { MemoryStream ms = new MemoryStream(); Stream s = new GZipStream(ms, CompressionMode.Compress); s.Write(bytData, 0, bytData.Length); s.Close(); byte[] compressedData = (byte[])ms.ToArray(); return compressedData; } catch { return null; } } private static string readfile(string path) { StreamReader reader = new StreamReader(path); string s = reader.ReadToEnd(); return s; } private static void makefile(string text, string sd) { StreamWriter wr = new StreamWriter(sd); wr.Write(text); wr.Close();

}

public COMPRESSION(string addr, string nam) { InitializeComponent(); name = nam; recivedip = addr; dbc = new DBConnection();

}

private void open_Click(object sender, EventArgs e) { opndlg.Filter = "textfile|*.txt|*AllFiles|*.*"; opndlg.ShowDialog(); txtimage.Text = opndlg.FileName; //opndlg.ShowDialog(); //opndlg.InitialDirectory = "c:\\"; //opndlg.Title = "images"; //openFileDialog1.Filter = "jpeg|*.jpeg|*alterfiles|*.jpg"; //openFileDialog1.Filter = "text file|*.txt|all files|*.*"; //openFileDialog1.ShowDialog(); //string fn = openFileDialog1.FileName; //string fs = new FileStream(fn, FileMode.Open);

////sr = new StreamReader(fs); ////sr.Close(); ////fs.Close(); //fs = new FileStream(openFileDialog1.FileName, FileMode.OpenOrCreate); //sr = new StreamReader(fs); ////sr2 = new StreamReader(fs); //richTextBox1.Text = sr.ReadToEnd(); ////textBox1.Text = sr.ReadToEnd(); ////textBox2.Text = sr.ReadToEnd(); ////textBox3.Text = sr.ReadToEnd(); }

//private void open_todecompress_Click(object sender, EventArgs e) //{ // // opndlg.Filter = "textfile|*.txt|*AllFiles|*.*"; opndlg.ShowDialog();

// // // // // // // //}

imageloc.Text = opndlg.FileName; //openFileDialog2.ShowDialog(); //openFileDialog2.InitialDirectory = "c:\\"; //openFileDialog2.Title = "images"; ////openFileDialog2.Filter = "jpeg|*.jpeg|*alterfiles|*.jpg"; //openFileDialog2.Filter = "textfile|*.txt|*AllFiles|*.*"; //openFileDialog2.ShowDialog();

/**************************** PROCESSING OF DECOMPRESSION & DOWNLOAD***********************/

private void button4_Click(object sender, EventArgs e)

{ if (File.Exists("ImageUpload/c") == false) { MessageBox.Show("NO FILES TO DECOMPRESS.........Try Again!!!"); return; } else {

sdfff = sss.Length; dafter = comp.Length; decomp = DeCompress(comp);

if (File.Exists("ImageUpload/d")) { File.Delete("ImageUpload/d"); } makefile(Encoding.Unicode.GetString(decomp), "ImageUpload/d"); int dret = decomp.Length; if (sb == decomp) { s = "success"; } else { s = Encoding.Unicode.GetString(decomp); } Data"); MessageBox.Show("Decompressed Sucessfully......Please Wait CLOUD to View try {

/*********************** INSERTION TO THE TABLE FOR UPDATING DECOMPRESSION STATUS**********************/

dbc.openconnection(); SqlCommand decomqry = new SqlCommand("insert into SYSTEM_INFO values('" + name+ "','" + recivedip + "','" + port + "','Decompressed','" + DateTime.Now.ToShortDateString() + "')", dbc.con); decomqry.ExecuteNonQuery(); decomqry.Connection.Close(); dbc.con.Close();

CloudBlobContainer blobContainer = blobStorage.GetContainerReference(ContainerName); didNotExistCreated = blobContainer.CreateIfNotExist();

var perms = new BlobContainerPermissions { PublicAccess = BlobContainerPublicAccessType.Container // Blob (see files if you know the name) or Container (enumerate like a directory) }; blobContainer.SetPermissions(perms); // This line makes the blob public so it is available from a web browser (no magic needed to read it)

var fi = new FileInfo(snippetFilePath); string blobUriPath = fi.Name; // could also use paths, as in: "images/" + fileInfo.Name; CloudBlob blob = blobContainer.GetBlobReference(blobUriPath); blob.UploadFile(fi.FullName); // REST call under the hood; use tool like Fiddler to see generated http traffic (http://fiddler2.com)

blob.Properties.ContentType = MimeTypeName; // IMPORTANT: Mime Type here needs to match type of the uploaded file // e.g., *.png image/png, *.wmv video/x-ms-wmv (http://en.wikipedia.org/wiki/Internet_media_type)

blob.SetProperties(); // REST call under the hood

blob.Metadata["SourceFileName"] = fi.FullName; // not required just showing how to store metadata blob.Metadata["WhenFileUploadedUtc"] = DateTime.UtcNow.ToLongTimeString(); blob.SetMetadata(); // REST call under the hood

string url = String.Format("{0}/{1}/{2}", baseUri, ContainerName, blobUriPath); Process process = System.Diagnostics.Process.Start(url); // see the image you just uploaded (works from Console, WPF, or Forms app not from ASP.NET app) }

catch (Exception er) { MessageBox.Show("errror at read=" + er.Message); } }

//delete all files from folder

}

/* ***************************COMPRESSION TASK **********************************/

private void compress_Click(object sender, EventArgs e) {

/*****************************PORT ACCESING********************************/

dbc.openconnection(); string getport = "select port from REGIST_CLIENT where client_name='" + name.Trim() + "' and ip='" + recivedip.Trim() + "'"; SqlCommand command = new SqlCommand(getport,dbc.con); SqlDataReader rdr = command.ExecuteReader(); if (rdr.Read()) { port = rdr.GetString(0); MessageBox.Show("PORT IS:",rdr.GetString(0));

} command.Connection.Close(); dbc.con.Close();

if (txtimage.Text.Trim() == "") { MessageBox.Show("No image selected"); return; } /////////////////// compressing data //////////////////////

String txt = txtimage.Text.Trim(); int len = txt.Length; int ind= txt.LastIndexOf("\\"); String filenm = txt.Substring(ind,(len-ind)); filenm = filenm.Substring(1,(filenm.Length-1)); snippetFilePath = "ImageUpload\\" + filenm;

if (Directory.Exists("ImageUpload") == false) { Directory.CreateDirectory("ImageUpload"); if (File.Exists("ImageUpload/" + filenm) == true) { File.Delete("ImageUpload/" + filenm); File.Copy(txtimage.Text, "ImageUpload/" + filenm); }

}

else { File.Delete("ImageUpload/" + filenm); File.Copy(txtimage.Text, "ImageUpload/" + filenm); }

s = readfile("ImageUpload/"+filenm);//"c:/myfiles/Koala.jpg"); sb = Encoding.Unicode.GetBytes(s); makefile(s, "ImageUpload/t");

///////////GZipCompressDecompress(sb);/////////////////////

comp = Compress(sb); sss = Encoding.ASCII.GetString(comp); makefile(sss, "ImageUpload/c"); MessageBox.Show("compressed sucessfully");

/**************************** INSERTION TO THE TABLE**********************/

try { dbc.openconnection(); // MessageBox.Show("insert into SYSTEM_INFO values('" + name + "','" + recivedip + "','" + port + "','Compressed','" + DateTime.Now.ToShortDateString() + "')"); SqlCommand cmd2 = new SqlCommand("insert into SYSTEM_INFO values('" + name+ "','" + recivedip + "','" + port + "','Compressed','" + DateTime.Now.ToShortDateString() + "')", dbc.con); cmd2.ExecuteNonQuery(); dbc.con.Close(); } catch (Exception er) { MessageBox.Show("Error on Saving data:"+er.Message); return; }

//insert into table //try //{ // String port="", ip="";

//

dbc.openconnection();

// SqlCommand cmd = new SqlCommand("select ip,port from clientlonginreg where username='" + user_name.Trim() + "'", dbc.con); // // // // // // // // } cmd.Connection.Close(); dbc.con.Close(); SqlDataReader rs = cmd.ExecuteReader(); if (rs.Read()) { ip = rs.GetString(0); port = rs.GetString(1);

//

dbc.openconnection();

// SqlCommand cmd1 = new SqlCommand("insert into SYSTEM_INFO values('" + ip + "','" + port + "','Compressed','" + DateTime.Now.ToShortDateString() + "')", dbc.con); // // // //} //catch (Exception er) //{ // // //} MessageBox.Show("Error on saving data:"+er.Message); return; cmd1.ExecuteNonQuery(); cmd1.Connection.Close(); dbc.con.Close();

//////////////////// //

for storage in cloud ///////////////////////

if (AccountKey == null) { var clientStorageAccount = CloudStorageAccount.DevelopmentStorageAccount; // use storage services in the Developer Fabric, not real cloud

baseUri = clientStorageAccount.BlobEndpoint.AbsoluteUri; blobStorage = new CloudBlobClient(baseUri, clientStorageAccount.Credentials); }

else { byte[] key = Convert.FromBase64String(AccountKey); var creds = new StorageCredentialsAccountAndKey(AccountName, key); baseUri = string.Format("http://{0}.blob.core.windows.net", AccountName); blobStorage = new CloudBlobClient(baseUri, creds); }

MessageBox.Show("Compressed and Stored in cloud,,,,,,,,"); }

} }