private void checkDatafile(DatafileCheckerStruct pDatafileCheckerStruct, DoWorkEventArgs e) { StreamWriter sw; datafile dataFile = new datafile(); XmlSerializer serializer = new XmlSerializer(dataFile.GetType()); TextReader textReader = new StreamReader(pDatafileCheckerStruct.datafilePath); dataFile = (datafile)serializer.Deserialize(textReader); textReader.Close(); AuditingUtil auditingUtil = new AuditingUtil(dataFile); // Check for duplicates string dupePath = pDatafileCheckerStruct.outputPath + Path.DirectorySeparatorChar + "_DUPE.TXT"; if (File.Exists(dupePath)) { File.Delete(dupePath); } sw = File.CreateText(dupePath); // Update max items maxItems = auditingUtil.ChecksumHash.Count; this.checkForDupes(auditingUtil, sw); sw.Close(); sw.Dispose(); }
private void datafileCreatorWorker_WorkComplete(object sender, RunWorkerCompletedEventArgs e) { if (e.Cancelled) { toolStripStatusLabel1.Text = ConfigurationManager.AppSettings["Form_AuditDatafileCreator_MessageCancel"]; tbOutput.Text += ConfigurationManager.AppSettings["Form_Global_OperationCancelled"]; } else { lblProgressLabel.Text = String.Empty; datafile dataFile = new datafile(); dataFile.header = DatafileCreatorWorker.buildHeader(tbDatCreator_Author.Text, tbDatCreator_Category.Text, tbDatCreator_Comment.Text, tbDatCreator_Date.Text, tbDatCreator_Description.Text, tbDatCreator_Email.Text, tbDatCreator_Homepage.Text, tbDatCreator_Name.Text, tbDatCreator_Url.Text, tbDatCreator_Version.Text); dataFile.game = (VGMToolbox.format.auditing.game[])e.Result; XmlSerializer serializer = new XmlSerializer(dataFile.GetType()); TextWriter textWriter = new StreamWriter(tbDatCreator_OutputDat.Text); serializer.Serialize(textWriter, dataFile); textWriter.Close(); textWriter.Dispose(); toolStripStatusLabel1.Text = ConfigurationManager.AppSettings["Form_AuditDatafileCreator_MessageComplete"]; } // update node color setNodeAsComplete(); }