private void AddCitation(Citation new_citation) { // Utilities.LockPerfTimer l1_clk = Utilities.LockPerfChecker.Start(); lock (citations_lock) { // l1_clk.LockPerfTimerStop(); // We can't cite ourself! if (0 == new_citation.fingerprint_outbound.CompareTo(new_citation.fingerprint_inbound)) { return; } // Try to update an existing record bool needs_write = false; bool citation_exists = false; List <Citation> citations = Citations_RAW; foreach (Citation citation in citations) { if (new_citation.Equals(citation)) { citation_exists = true; break; } } // If there was no existing record if (!citation_exists) { citations.Add(new_citation); needs_write = true; } // If we need to write, write! if (needs_write) { WriteToDisk(pdf_document, citations); } } }
private void AddCitation(Citation new_citation) { lock (this) { // We can't cite ourself! if (0 == new_citation.fingerprint_outbound.CompareTo(new_citation.fingerprint_inbound)) { return; } // Try to update an existing record bool needs_write = false; bool citation_exists = false; List <Citation> citations = Citations; foreach (Citation citation in citations) { if (new_citation.Equals(citation)) { citation_exists = true; break; } } // If there was no existing record if (!citation_exists) { citations.Add(new_citation); needs_write = true; } // If we need to write, write! if (needs_write) { WriteToDisk(pdf_document, citations); } } }