public static void Serialize(Settings rptSettings, string fileName)
 {
     try
     {
         XmlSerializer xs = new XmlSerializer(typeof(Settings));
         TextWriter tw = File.CreateText(fileName);
         xs.Serialize(tw, rptSettings);
         tw.Close();
     }
     catch (Exception ex)
     {
         System.Windows.Forms.MessageBox.Show(ex.Message, "Error ...", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
     }
 }
        private void deployRptToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Settings rpt = new Settings();
            string reportserver = MCls.ReportURL.Replace("http://", "");
            reportserver = reportserver.Substring(0, reportserver.IndexOf("/"));
            string[] arr = MCls.ReportURL.Split(Convert.ToChar("/"));
            rpt.GlobalSettings(reportserver, arr[arr.Length - 1]);
            System.Data.SqlClient.SqlConnectionStringBuilder constring = new System.Data.SqlClient.SqlConnectionStringBuilder(MCls.SQLConStrStoreAccount);
            string constringpro = string.Format(@"data source={0};initial catalog={1}", constring.DataSource, constring.InitialCatalog);
            rpt.CreateDataSource("DataSourceStoreAccount", true, true, "Data Sources", constringpro, Settings.CredentialRetrievalValues.Store, false, constring.UserID, constring.Password);
            Settings.Report[] reports = null;
            foreach (MCls.SQLReportsStr item in MCls.SQLRep)
            {
                if (reports == null)
                    Array.Resize<Settings.Report>(ref reports, 1);
                else
                    Array.Resize<Settings.Report>(ref reports, reports.Length + 1);

                reports[reports.Length - 1].Name = item.RepFileName.Replace(".rdl", "");
                reports[reports.Length - 1].FilePathValue = @"\rdl\" + item.RepFileName;
            }
            rpt.CreateReport("GroupDS", "DataSourceStoreAccount", MCls.ReportPath, 10080, reports);
            MCls.DeploySSRSReports(rpt);
        }