* preserving modification times

This commit is contained in:
chudov
2008-10-25 19:14:44 +00:00
parent 47534c491a
commit e54126a978
4 changed files with 13 additions and 7 deletions

View File

@@ -176,6 +176,8 @@ namespace APETagsDotNet
public APETagDotNet (string filename, bool analyze, bool isReadonly)
{
m_spIO = new FileStream(filename, FileMode.Open, isReadonly?FileAccess.Read:FileAccess.ReadWrite, FileShare.Read);
m_spInfo = new FileInfo(filename);
m_lastModified = m_spInfo.LastWriteTime;
m_bAnalyzed = false;
m_aryFields = new APETagField[0];
m_nTagBytes = 0;
@@ -578,6 +580,7 @@ namespace APETagsDotNet
m_spIO.Seek(0, SeekOrigin.End);
m_spIO.Write(pBuffer, 0, pBuffer.Length);
m_spIO.Seek(nOriginalPosition, SeekOrigin.Begin);
//m_spInfo.LastWriteTime = m_lastModified;
}
private bool LoadField(byte[] pBuffer, ref int nLocation)
{
@@ -627,6 +630,8 @@ namespace APETagsDotNet
// private data
private FileStream m_spIO;
private FileInfo m_spInfo;
private DateTime m_lastModified;
private bool m_bAnalyzed;
private int m_nTagBytes;
private APETagField[] m_aryFields;

View File

@@ -104,7 +104,8 @@ namespace CUEToolsLib {
public WAVReader(string path) {
_path = path;
_fs = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read);
//_fs = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read);
_fs = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read, 0x10000, FileOptions.SequentialScan);
_br = new BinaryReader(_fs);
ParseHeaders();
@@ -416,9 +417,9 @@ namespace CUEToolsLib {
set { _flacReader.Tags = value; }
}
public bool UpdateTags()
public bool UpdateTags(bool preserveTime)
{
return _flacReader.UpdateTags();
return _flacReader.UpdateTags(preserveTime);
}
public ulong Length {

View File

@@ -1521,7 +1521,7 @@ namespace CUEToolsLib
GenerateAccurateRipTags (tags, 0, bestOffset, -1);
#if !MONO
if (audioSource is FLACReader)
((FLACReader)audioSource).UpdateTags();
((FLACReader)audioSource).UpdateTags (true);
#endif
audioSource.Close();
audioSource = null;
@@ -1537,7 +1537,7 @@ namespace CUEToolsLib
NameValueCollection tags = audioSource.Tags;
CleanupTags(tags, "ACCURATERIP");
GenerateAccurateRipTags (tags, 0, bestOffset, iTrack);
((FLACReader)audioSource).UpdateTags();
((FLACReader)audioSource).UpdateTags(true);
}
#endif
audioSource.Close();

View File

@@ -160,7 +160,7 @@ namespace FLACDotNet {
}
}
bool UpdateTags ()
bool UpdateTags (bool preserveTime)
{
Close ();
@@ -219,7 +219,7 @@ namespace FLACDotNet {
FLAC__metadata_iterator_insert_block_after (i, vorbiscomment);
FLAC__metadata_iterator_delete (i);
FLAC__metadata_chain_sort_padding (chain);
res = FLAC__metadata_chain_write (chain, true, false);
res = FLAC__metadata_chain_write (chain, true, preserveTime);
FLAC__metadata_chain_delete (chain);
return 0 != res;
}