mirror of
https://github.com/claunia/cuetools.net.git
synced 2025-12-16 18:14:25 +00:00
* preserving modification times
This commit is contained in:
@@ -176,6 +176,8 @@ namespace APETagsDotNet
|
|||||||
public APETagDotNet (string filename, bool analyze, bool isReadonly)
|
public APETagDotNet (string filename, bool analyze, bool isReadonly)
|
||||||
{
|
{
|
||||||
m_spIO = new FileStream(filename, FileMode.Open, isReadonly?FileAccess.Read:FileAccess.ReadWrite, FileShare.Read);
|
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_bAnalyzed = false;
|
||||||
m_aryFields = new APETagField[0];
|
m_aryFields = new APETagField[0];
|
||||||
m_nTagBytes = 0;
|
m_nTagBytes = 0;
|
||||||
@@ -578,6 +580,7 @@ namespace APETagsDotNet
|
|||||||
m_spIO.Seek(0, SeekOrigin.End);
|
m_spIO.Seek(0, SeekOrigin.End);
|
||||||
m_spIO.Write(pBuffer, 0, pBuffer.Length);
|
m_spIO.Write(pBuffer, 0, pBuffer.Length);
|
||||||
m_spIO.Seek(nOriginalPosition, SeekOrigin.Begin);
|
m_spIO.Seek(nOriginalPosition, SeekOrigin.Begin);
|
||||||
|
//m_spInfo.LastWriteTime = m_lastModified;
|
||||||
}
|
}
|
||||||
private bool LoadField(byte[] pBuffer, ref int nLocation)
|
private bool LoadField(byte[] pBuffer, ref int nLocation)
|
||||||
{
|
{
|
||||||
@@ -627,6 +630,8 @@ namespace APETagsDotNet
|
|||||||
|
|
||||||
// private data
|
// private data
|
||||||
private FileStream m_spIO;
|
private FileStream m_spIO;
|
||||||
|
private FileInfo m_spInfo;
|
||||||
|
private DateTime m_lastModified;
|
||||||
private bool m_bAnalyzed;
|
private bool m_bAnalyzed;
|
||||||
private int m_nTagBytes;
|
private int m_nTagBytes;
|
||||||
private APETagField[] m_aryFields;
|
private APETagField[] m_aryFields;
|
||||||
|
|||||||
@@ -104,7 +104,8 @@ namespace CUEToolsLib {
|
|||||||
|
|
||||||
public WAVReader(string path) {
|
public WAVReader(string path) {
|
||||||
_path = 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);
|
_br = new BinaryReader(_fs);
|
||||||
|
|
||||||
ParseHeaders();
|
ParseHeaders();
|
||||||
@@ -416,9 +417,9 @@ namespace CUEToolsLib {
|
|||||||
set { _flacReader.Tags = value; }
|
set { _flacReader.Tags = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool UpdateTags()
|
public bool UpdateTags(bool preserveTime)
|
||||||
{
|
{
|
||||||
return _flacReader.UpdateTags();
|
return _flacReader.UpdateTags(preserveTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ulong Length {
|
public ulong Length {
|
||||||
|
|||||||
@@ -1521,7 +1521,7 @@ namespace CUEToolsLib
|
|||||||
GenerateAccurateRipTags (tags, 0, bestOffset, -1);
|
GenerateAccurateRipTags (tags, 0, bestOffset, -1);
|
||||||
#if !MONO
|
#if !MONO
|
||||||
if (audioSource is FLACReader)
|
if (audioSource is FLACReader)
|
||||||
((FLACReader)audioSource).UpdateTags();
|
((FLACReader)audioSource).UpdateTags (true);
|
||||||
#endif
|
#endif
|
||||||
audioSource.Close();
|
audioSource.Close();
|
||||||
audioSource = null;
|
audioSource = null;
|
||||||
@@ -1537,7 +1537,7 @@ namespace CUEToolsLib
|
|||||||
NameValueCollection tags = audioSource.Tags;
|
NameValueCollection tags = audioSource.Tags;
|
||||||
CleanupTags(tags, "ACCURATERIP");
|
CleanupTags(tags, "ACCURATERIP");
|
||||||
GenerateAccurateRipTags (tags, 0, bestOffset, iTrack);
|
GenerateAccurateRipTags (tags, 0, bestOffset, iTrack);
|
||||||
((FLACReader)audioSource).UpdateTags();
|
((FLACReader)audioSource).UpdateTags(true);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
audioSource.Close();
|
audioSource.Close();
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ namespace FLACDotNet {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UpdateTags ()
|
bool UpdateTags (bool preserveTime)
|
||||||
{
|
{
|
||||||
Close ();
|
Close ();
|
||||||
|
|
||||||
@@ -219,7 +219,7 @@ namespace FLACDotNet {
|
|||||||
FLAC__metadata_iterator_insert_block_after (i, vorbiscomment);
|
FLAC__metadata_iterator_insert_block_after (i, vorbiscomment);
|
||||||
FLAC__metadata_iterator_delete (i);
|
FLAC__metadata_iterator_delete (i);
|
||||||
FLAC__metadata_chain_sort_padding (chain);
|
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);
|
FLAC__metadata_chain_delete (chain);
|
||||||
return 0 != res;
|
return 0 != res;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user