private static void RespCallback(IAsyncResult AsyncResult) { GRequestState myState = ((GRequestState)(AsyncResult.AsyncState)); try { WebRequest myRequest = myState.Request; string myDescription = ""; string myContentLength = ""; HttpWebResponse myResponse = ((HttpWebResponse)(myRequest.EndGetResponse(AsyncResult))); myState.Response = myResponse; myDescription = myResponse.StatusDescription; myState.TotalBytes = myState.Response.ContentLength; myContentLength = myState.Response.ContentLength.ToString(); Stream myResponseStream = myState.Response.GetResponseStream(); myState.StreamResponse = myResponseStream; IAsyncResult myIAsyncResult = myResponseStream.BeginRead(myState.BufferRead, 0, BUFFER_SIZE, new AsyncCallback(ReadCallback), myState); return; } catch (Exception ex) { ErrorDump.AddError(System.IntPtr.Zero, "GDownload.cs", "RespCallback", ex); if (myState.FinishedEvent != null) { myState.FinishedEvent(new DriveFinishedEventArgs(false, "Fout bij downloaden", ex)); } } }
private void Init() { sGlobals.DB_File = Path.Combine(@"G:\", "FDB", "FDB.sqlite"); sGlobals.DB_Connected = DBConnect.ConnectDB(); try { List <Serie> mySeries = sGlobals.DB.Series.ToList(); List <Film> myFilms = sGlobals.DB.Films.ToList(); List <Instelling> myInstellingen = sGlobals.DB.Instellingen.ToList(); } catch (Exception ex) { ErrorDump.AddError("FormMain.cs", "Init", ex); } //tcTab.SelectedTab = tabFilm; try { m_FormSeries = new FormSeries(); m_FormSeries.TopLevel = false; m_FormSeries.WindowState = FormWindowState.Maximized; pnlSeries.Controls.Add(m_FormSeries); } catch (Exception ex) { ErrorDump.AddError("FormMain.cs", "Shown", ex); } }
public bool DownloadFile(Google.Apis.Drive.v2.Data.File myFile, string BestandsNaam) { bool Succes = false; m_File = myFile; m_BestandsNaam = BestandsNaam; try { HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(new Uri(myFile.DownloadUrl)); m_Authenticator.ApplyAuthenticationToRequest(myRequest); m_State = new GRequestState(BUFFER_SIZE); m_State.Request = myRequest; m_State.WriteStream = System.IO.File.OpenWrite(BestandsNaam); m_State.ProgressEvent += ProgressEvent; m_State.FinishedEvent += FinishedEvent; IAsyncResult myResult = (IAsyncResult)myRequest.BeginGetResponse(new AsyncCallback(RespCallback), m_State); } catch (Exception ex) { ErrorDump.AddError(System.IntPtr.Zero, "GDownload.cs", "DownloadFile", ex); if (FinishedEvent != null) { FinishedEvent(new DriveFinishedEventArgs(false, "Fout bij downloaden", ex)); } } return(Succes); }
/********************************************** Functions ******************************************************************/ private void LaadIDs() { try { using (SQLiteCommand cmd = m_Conn.CreateCommand()) { cmd.CommandText = "SELECT ID FROM moz_places"; using (SQLiteDataAdapter myAdapter = new SQLiteDataAdapter(cmd)) { using (DataSet ds = new DataSet()) { myAdapter.Fill(ds); m_Table = ds.Tables[0]; } } } object myObject = m_Table.Rows[0].ItemArray[0]; m_IDs = m_Table.Rows.OfType <DataRow>().Select(r => Convert.ToInt32(r.ItemArray[0])).ToList(); Globals.Log(string.Format("{0} IDs geladen", m_IDs.Count.ToString())); } catch (Exception ex) { ErrorDump.AddError(System.IntPtr.Zero, "LiteDB.cs", "Init", ex); } }
/********************************************** Events *****************************************************************/ public void myProgressChanged(Google.Apis.Upload.IUploadProgress myProgress) { try { if (myProgress.Status == Google.Apis.Upload.UploadStatus.Uploading) { double myProcent = myProgress.BytesSent / (m_TotalBytesSize / 100); if (ProgressEvent != null) { ProgressEvent(new DriveProgressEventArgs(myProcent)); } } else if (myProgress.Status == Google.Apis.Upload.UploadStatus.Completed) { if (FinishedEvent != null) { FinishedEvent(new DriveFinishedEventArgs(true)); } } else if (myProgress.Status == Google.Apis.Upload.UploadStatus.Failed) { if (FinishedEvent != null) { FinishedEvent(new DriveFinishedEventArgs(false)); } } } catch (Exception ex) { ErrorDump.AddError(System.IntPtr.Zero, "GUpload.cs", "myProgressChanged", ex); } }
private void MyDriveFinishedEvent(DriveFinishedEventArgs e) { if (this.InvokeRequired) { this.Invoke(new DelegateDriveFinished(MyDriveFinishedEvent), e); } else { try { StopVoortgang(); if (e.Succes) { Voortgang("Gereed"); } else { Voortgang("Mislukt"); } } catch (Exception ex) { ErrorDump.AddError(System.IntPtr.Zero, "FormMain.cs", "MyActionFinishedEvent", ex); } } }
public List <ErrorInfo> Validate() { ErrorDump listener = new ErrorDump(); source.Compile(listener); List <ErrorInfo> errors = listener.Errors; //Try to execute script to get more errors if (errors.Count == 0) { try { source.Execute(scope); } catch (System.Exception e) { ErrorInfo error = new ErrorInfo(); error.Message = e.Message; error.Line = -1; error.Severity = ErrorInfo.SeverityType.Error; errors.Add(error); } } return(errors); }
private bool DeleteFilesInFolder(Google.Apis.Drive.v2.Data.File Folder) { bool Succes = false; try { FilesResource.ListRequest myList = m_Drive.Files.List(); myList.Q = string.Format("trashed = false and '{0}' in parents", Folder.Id); Google.Apis.Drive.v2.Data.FileList myFiles = myList.Fetch(); foreach (Google.Apis.Drive.v2.Data.File myFile in myFiles.Items) { FilesResource.DeleteRequest myDelRequest = m_Drive.Files.Delete(myFile.Id); myDelRequest.Fetch(); } Succes = true; } catch (Exception ex) { ErrorDump.AddError(System.IntPtr.Zero, "DriveSync.cs", "DeleteFilesInFolder", ex); if (FinishedEvent != null) { FinishedEvent(new DriveFinishedEventArgs(false, "Fout bij verwijderen oude database", ex)); } } return(Succes); }
/********************************************** Functions ******************************************************************/ private void StartConnect() { try { m_Connected = (GetPlacesFolder() && GetPlacesBestand()); m_GDownload = new GDownload(m_Drive.Authenticator); m_GDownload.ProgressEvent = ProgressEvent; m_GDownload.FinishedEvent = FinishedEvent; m_GUpload = new GUpload(m_Drive, m_PlacesFolder); m_GUpload.ProgressEvent = ProgressEvent; m_GUpload.FinishedEvent = FinishedEvent; } catch (Exception ex) { m_Connected = false; ErrorDump.AddError(System.IntPtr.Zero, "DriveSync.cs", "Connect", ex); } if (ConnectEvent != null) { ConnectEvent(new DriveConnectEventArgs(m_Connected)); } }
/********************************************** Variables ******************************************************************/ #endregion Variables #region Constructor, Load & Closing /********************************************** Constructor, Load & Closing ************************************************/ #endregion Constructor, Load & Closing #region Functions /********************************************** Functions ******************************************************************/ public static bool ConnectDB() { bool bSucces = false; try { Database.SetInitializer(new FDBInitializer()); SQLiteConnectionStringBuilder mySQLiteConnectionStringBuilder = new SQLiteConnectionStringBuilder(); mySQLiteConnectionStringBuilder.DataSource = sGlobals.DB_File; sGlobals.DB_New = !File.Exists(sGlobals.DB_File); SQLiteConnection myConn = new SQLiteConnection(mySQLiteConnectionStringBuilder.ConnectionString); sGlobals.DB = new FDB(myConn); sGlobals.DB.Database.Initialize(false); bSucces = true; } catch (Exception ex) { ErrorDump.AddError("DBConnect.cs", "ConnectDB", ex); } return(bSucces); }
public bool DownloadPlaces() { bool Succes = false; try { m_GDownload.ProgressEvent = ProgressEvent; m_GDownload.FinishedEvent = FinishedEvent; if (DeleteIfExists(Globals.PlacesFileNieuw)) { m_GDownload.DownloadFile(m_PlacesBestand, Globals.PlacesFileNieuw); Succes = true; } } catch (Exception ex) { ErrorDump.AddError(System.IntPtr.Zero, "DriveSync.cs", "DownloadPlaces", ex); if (FinishedEvent != null) { FinishedEvent(new DriveFinishedEventArgs(false, "Fout bij downloaden", ex)); } } return(Succes); }
public bool UploadPlaces() { bool Succes = false; try { if (DeleteFilesInFolder(m_PlacesFolder)) { m_GUpload.ProgressEvent = ProgressEvent; m_GUpload.FinishedEvent = FinishedEvent; m_GUpload.UploadFile(Globals.PlacesFileNieuw, m_PlacesFolder); Succes = true; } } catch (Exception ex) { ErrorDump.AddError(System.IntPtr.Zero, "DriveSync.cs", "UploadPlaces", ex); if (FinishedEvent != null) { FinishedEvent(new DriveFinishedEventArgs(false, "Fout bij uploaden", ex)); } } return(Succes); }
public static IAuthorizationState GetAuthorization(NativeApplicationClient Client) { try { const string KEY = "z},drdzf11x9;87"; string myScope = DriveService.Scopes.Drive.GetStringValue(); // Check if there is a cached refresh token available. IAuthorizationState myState = AuthorizationMgr.GetCachedRefreshToken(KEY); if (myState != null) { try { Client.RefreshToken(myState); return(myState); // Yes - we are done. } catch (DotNetOpenAuth.Messaging.ProtocolException ex) { ErrorDump.AddError(System.IntPtr.Zero, "GAuth.cs", "GetAuthorization", ex, "Using existing refresh token failed"); } } // If we get here, there is no stored token. Retrieve the authorization from the user. myState = AuthorizationMgr.RequestNativeAuthorization(Client, myScope); AuthorizationMgr.SetCachedRefreshToken(KEY, myState); return(myState); } catch (Exception ex) { ErrorDump.AddError(System.IntPtr.Zero, "GAuth.cs", "GetAuthorization", ex); return(null); } }
private void btnUpdate_Click(object sender, EventArgs e) { try { checkIfFileExist(Application.StartupPath + "\\UpdateExeFile.zip"); #region download the Update File from server Network network = new Network(); try { network.DownloadFile("http://kayakkitchen.com/privateeye/UpdateExeFile.zip", Application.StartupPath + "\\UpdateExeFile.zip"); } catch (Exception ex) { ErrorDump er = new ErrorDump(); er.WriteToErrorLog(ErrorDump.ErrorDumpErrorLogType.Critical, ex, "Unable to Download the Update File"); } #endregion download the Update File from server #region unzip the file try { ZipFile.ExtractToDirectory(Application.StartupPath + "\\UpdateExeFile.zip", Application.StartupPath); } catch (Exception ex) { ErrorDump er = new ErrorDump(); er.WriteToErrorLog(ErrorDump.ErrorDumpErrorLogType.Critical, ex, "Unable to Extract the Update File"); } #endregion unzip the file #region writeupdated Version No. XmlDocument xml = new XmlDocument(); xml.Load(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile); Configuration config = ConfigurationManager.OpenExeConfiguration(Application.ExecutablePath); config.AppSettings.Settings.Remove("Version"); config.AppSettings.Settings.Add("Version", serverVersion); config.Save(ConfigurationSaveMode.Minimal); xml.Save(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile); ConfigurationManager.RefreshSection("appSettings"); #endregion writeupdated Version No. File.Delete(Application.StartupPath + "\\updateVersionLog\\updateVersionLog.xml"); File.Delete(Application.StartupPath + "\\UpdateExeFile.zip"); Process.Start(Application.StartupPath + "\\updateHelper.exe"); mailUpdateConfirmation(serverVersion); Application.Exit(); } catch (Exception ex) { ErrorDump ed = new ErrorDump(); ed.WriteToErrorLog(ErrorDump.ErrorDumpErrorLogType.Critical, ex, "Update Failed."); MessageBox.Show("Update Failed. Please try Again.", "Secusys - EID Update", MessageBoxButtons.OK); } }
public static IAuthenticator CreateAuthenticator() { try { NativeApplicationClient myClient = new NativeApplicationClient(GoogleAuthenticationServer.Description); myClient.ClientIdentifier = Globals.CLIENT_ID; myClient.ClientSecret = Globals.CLIENT_SECRET; return(new OAuth2Authenticator <NativeApplicationClient>(myClient, GetAuthorization)); } catch (Exception ex) { ErrorDump.AddError(System.IntPtr.Zero, "GAuth.cs", "CreateAuthenticator", ex); return(null); } }
private void Init() { try { m_Conn = new SQLiteConnection(string.Format("Data Source={0}", m_FileName)); m_Conn.Open(); m_IDs = new List <int>(); LaadIDs(); } catch (Exception ex) { ErrorDump.AddError(System.IntPtr.Zero, "LiteDB.cs", "Init", ex); } }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); try { FormMain fm = new FormMain(); fm.Visible = false; Application.Run(fm); } catch (Exception ex) { ErrorDump.AddError("Program.cs", "Main", ex); } }
private static void ReadCallback(IAsyncResult AsyncResult) { GRequestState myState = ((GRequestState)(AsyncResult.AsyncState)); try { Stream myResponseStream = myState.StreamResponse; int myBytesRead = myResponseStream.EndRead(AsyncResult); myState.WriteStream.Write(myState.BufferRead, 0, myBytesRead); if (myBytesRead > 0) { myState.BytesRead += myBytesRead; double myPctComplete = ((double)myState.BytesRead / (double)myState.TotalBytes) * 100.0f; if (myState.ProgressEvent != null) { myState.ProgressEvent(new DriveProgressEventArgs(myPctComplete)); } IAsyncResult myIAsyncResult = myResponseStream.BeginRead(myState.BufferRead, 0, BUFFER_SIZE, new AsyncCallback(ReadCallback), myState); return; } else { myState.WriteStream.Close(); myState.StreamResponse.Close(); myState.Response.Close(); if (myState.FinishedEvent != null) { myState.FinishedEvent(new DriveFinishedEventArgs(true)); } } } catch (Exception ex) { ErrorDump.AddError(System.IntPtr.Zero, "GDownload.cs", "ReadCallback", ex); if (myState.FinishedEvent != null) { myState.FinishedEvent(new DriveFinishedEventArgs(false, "Fout bij downloaden", ex)); } } }
/********************************************** Functions ******************************************************************/ public void UploadFile(string FileName, Google.Apis.Drive.v2.Data.File Folder) { Google.Apis.Drive.v2.Data.File myFile = new Google.Apis.Drive.v2.Data.File(); try { myFile.Title = "places.sqlite"; myFile.MimeType = "chemical/x-mdl-sdfile"; myFile.Parents = new List <ParentReference>() { new ParentReference() { Id = Folder.Id } }; byte[] myByteArray = System.IO.File.ReadAllBytes(FileName); MemoryStream myStream = new MemoryStream(myByteArray); myStream.Position = 0; FilesResource.InsertMediaUpload myRequest = m_Drive.Files.Insert(myFile, myStream, myFile.MimeType); myRequest.ChunkSize = 262144; myRequest.ProgressChanged += new Action <Google.Apis.Upload.IUploadProgress>(myProgressChanged); m_TotalBytesSize = myStream.Length; Action myAsyncAction = () => { myRequest.Upload(); }; System.Threading.Thread myThread = new System.Threading.Thread(new System.Threading.ThreadStart(myAsyncAction)); myThread.Start(); } catch (Exception ex) { ErrorDump.AddError(System.IntPtr.Zero, "GUpload.cs", "UploadFile", ex); if (FinishedEvent != null) { FinishedEvent(new DriveFinishedEventArgs(false, "Fout bij uploaden", ex)); } } }
/********************************************** Variables ******************************************************************/ #endregion Variables #region Constructor, Load & Closing /********************************************** Constructor, Load & Closing ************************************************/ public void InitializeDatabase(FDB DB) { try { if (sGlobals.DB_New) { string myFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Data", "SQL", "Create.SQL"); string mySQL = File.ReadAllText(myFile); DB.Database.ExecuteSqlCommand(mySQL); } //if versie ongelijk dan update } catch (Exception ex) { ErrorDump.AddError("FDBInitializer.cs", "InitializeDatabase", ex); } }
private bool DeleteIfExists(string BestandsNaam) { bool Succes = false; try { if (System.IO.File.Exists(BestandsNaam)) { System.IO.File.Delete(BestandsNaam); } Succes = true; } catch (Exception ex) { ErrorDump.AddError(System.IntPtr.Zero, "FormMain.cs", "DeleteIfExists", ex); } return(Succes); }
public string RetrieveAuthorization(UserAgentClient client, IAuthorizationState authorizationState) { if (!HttpListener.IsSupported) { throw new NotSupportedException("HttpListener is not supported by this platform."); } // Create a HttpListener for the specified url. string url = string.Format(LoopbackCallback, GetRandomUnusedPort(), Assembly.GetEntryAssembly().GetName().Name); authorizationState.Callback = new Uri(url); var webserver = new HttpListener(); webserver.Prefixes.Add(url); // Retrieve the authorization url. Uri authUrl = client.RequestUserAuthorization(authorizationState); try { // Start the webserver. webserver.Start(); // Open the browser. Process.Start(authUrl.ToString()); // Wait for the incoming connection, then handle the request. return(HandleRequest(webserver.GetContext())); } catch (HttpListenerException ex) { ErrorDump.AddError(System.IntPtr.Zero, "LoopbackServerAuthorizationFlow.cs", "RetrieveAuthorization", ex, "The HttpListener threw an exception."); return(null); //throw new NotSupportedException("The HttpListener threw an exception.", ex); } finally { // Stop the server after handling the one request. webserver.Stop(); } }
/********************************************** Functions ******************************************************************/ private static bool SaveEntity <T>(T[] entity) where T : Entity { bool bSucces = false; try { if (sGlobals.DB_Connected) { sGlobals.DB.Set <T>().AddOrUpdate <T>(entity); sGlobals.DB.SaveChanges(); bSucces = true; } } catch (Exception ex) { ErrorDump.AddError("DBSave.cs", "SaveEntity", ex); } return(bSucces); }
/********************************************** Functions ******************************************************************/ public Stream DownloadFileSimple(Google.Apis.Drive.v2.Data.File Bestand) { Stream myFile = null; try { HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(new Uri(Bestand.DownloadUrl)); m_Authenticator.ApplyAuthenticationToRequest(myRequest); HttpWebResponse myResponse = (HttpWebResponse)myRequest.GetResponse(); myFile = myResponse.GetResponseStream(); } catch (Exception ex) { ErrorDump.AddError(System.IntPtr.Zero, "GDownload.cs", "DownloadBestand", ex); if (FinishedEvent != null) { FinishedEvent(new DriveFinishedEventArgs(false, "Fout bij downloaden", ex)); } } return(myFile); }
private bool GetPlacesBestand() { bool Succes = false; try { FilesResource.ListRequest myList = m_Drive.Files.List(); myList.Q = string.Format("title = 'places.sqlite' and mimeType = 'application/octet-stream' and trashed = false and '{0}' in parents", m_PlacesFolder.Id); Google.Apis.Drive.v2.Data.FileList myFiles = myList.Fetch(); if (myFiles.Items.Count > 0) { m_PlacesBestand = myFiles.Items[0]; Succes = true; } } catch (Exception ex) { ErrorDump.AddError(System.IntPtr.Zero, "DriveSync.cs", "GetPlacesBestand", ex); } return(Succes); }
private bool DeleteIfExists(string BestandsNaam) { bool Succes = false; try { if (System.IO.File.Exists(BestandsNaam)) { System.IO.File.Delete(BestandsNaam); } Succes = true; } catch (Exception ex) { ErrorDump.AddError(System.IntPtr.Zero, "DriveSync.cs", "DeleteIfExists", ex); if (FinishedEvent != null) { FinishedEvent(new DriveFinishedEventArgs(false, "Fout bij verwijderen oude database", ex)); } } return(Succes); }
private bool GetPlacesFolder() { bool Succes = false; try { FilesResource.ListRequest myList = m_Drive.Files.List(); myList.Q = "title = 'BookSync' and mimeType = 'application/vnd.google-apps.folder' and trashed = false"; Google.Apis.Drive.v2.Data.FileList myFiles = myList.Fetch(); if (myFiles.Items.Count > 0) { m_PlacesFolder = myFiles.Items[0]; Succes = true; } } catch (Exception ex) { ErrorDump.AddError(System.IntPtr.Zero, "DriveSync.cs", "GetPlacesFolder", ex); } return(Succes); }
protected override void btnsave_Click(object sender, EventArgs e) { UserMasterSaver userMasterSaver = new UserMasterSaver(); int USPUserid; if (string.IsNullOrEmpty(txtUsrname.Text) || string.IsNullOrEmpty(txtPass.Text) || string.IsNullOrEmpty(txtConPass.Text)) { MessageBox.Show("Username and Password are Mandatory." + Environment.NewLine + "Please try again.", "Incorrect Input", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } #region check if pass and con pass match if (string.Compare(txtConPass.Text, txtPass.Text) != 0) { MessageBox.Show("Password and Confirm Password do not match." + Environment.NewLine + "Please try again.", "Incorrect Input", MessageBoxButtons.OK, MessageBoxIcon.Error); txtPass.Text = string.Empty; txtUsrname.Focus(); txtUsrname.Text = string.Empty; txtConPass.Text = string.Empty; return; } #endregion check if pass and con pass match #region InsertUserPrivileges if (UpdateState != true) { try { userMasterSaver.insertUserPrivileges(txtUsrname.Text, txtPass.Text); USPUserid = userMasterSaver.fetchEmpID(txtUsrname.Text); for (int i = 0; i < this.chklstbx.Items.Count; i++) { userMasterSaver.insertUserAttribute(USPUserid, i, Convert.ToInt16(this.chklstbx.GetItemChecked(i))); } } catch (Exception ex) { ErrorDump ed = new ErrorDump(); ed.WriteToErrorLog(ErrorDump.ErrorDumpErrorLogType.Information, ex, "Saving UserMaster Failed. Please try again"); } } #endregion InsertUserPrivileges else #region updateUserPrivilege { USPUserid = userMasterSaver.fetchEmpID(txtUsrname.Text); userMasterSaver.updateUserPrivilege(USPUserid); for (int i = 0; i < this.chklstbx.Items.Count; i++) { userMasterSaver.updateUserAttribute(USPUserid, Convert.ToInt16(this.chklstbx.GetItemChecked(i)), i); MysqlConn.executeQry(qry); } txtPass.Enabled = true; txtConPass.Enabled = true; UpdateState = false; } #endregion updateUserPrivilege updateStatus(this, "Values Saved"); com.clearAllControl(GrbxNewUser, false); LoadUserPrivileges_CheckBox(""); txtUsrname.Focus(); }
private void winformUpdate_Load(object sender, EventArgs e) { try { checkIfFileExist(Application.StartupPath + "\\UpdateVersionLog.zip"); #region download the File from server Network network = new Network(); try { network.DownloadFile("http://kayakkitchen.com/privateeye/UpdateVersionLog.zip", Application.StartupPath + "\\UpdateVersionLog.zip"); } catch (Exception ex) { ErrorDump er = new ErrorDump(); er.WriteToErrorLog(ErrorDump.ErrorDumpErrorLogType.Critical, ex, "Unable to Download the UpdateVersionLog File"); } #endregion download the File from server string updateVersionLogPath = Application.StartupPath + "\\updateVersionLog"; #region Create_updateVersionLogPath_Directory_ifNotExist if (!Directory.Exists(updateVersionLogPath)) Directory.CreateDirectory(updateVersionLogPath); #endregion Create_updateVersionLogPath_Directory_ifNotExist checkIfFileExist(updateVersionLogPath + "\\updateVersionLog.xml"); #region unzip the file try { ZipFile.ExtractToDirectory(Application.StartupPath + "\\UpdateVersionLog.zip", updateVersionLogPath); } catch (Exception ex) { ErrorDump er = new ErrorDump(); er.WriteToErrorLog(ErrorDump.ErrorDumpErrorLogType.Critical, ex, "Unable to Extract the UpdateVersionLog File"); } File.Delete(Application.StartupPath + "\\UpdateVersionLog.zip"); #endregion unzip the file #region compare current version are equal to server versions string appVersion = ConfigurationManager.AppSettings["Version"]; lblVersion.Text = "Version: " + appVersion; serverVersion = readXmlValue(Application.StartupPath + "\\updateVersionLog\\updateVersionLog.xml"); if (appVersion == serverVersion) { btnUpdate.Enabled = false; btnUpdate.Text = "Secusys-EID is upto date"; } else { btnUpdate.Enabled = true; btnUpdate.Text = "Secusys-EID Update is available"; } #endregion } catch (Exception ex) { ErrorDump ed = new ErrorDump(); ed.WriteToErrorLog(ErrorDump.ErrorDumpErrorLogType.Critical, ex, "Update Failed."); MessageBox.Show("Something Nasty Happened. Please try Again.", "Secusys - EID Update", MessageBoxButtons.OK); } }