private void ReadSystemFileAttributes() { //** retrieve the File size from Xml file string xmlFilename = string.Format("{0}.{1}", SystemFile.Filename, DataInfExtensionLiteral); if (System.IO.File.Exists(xmlFilename)) { // delete inf file if the data file is missing... if (!System.IO.File.Exists(SystemFile.Filename)) { System.IO.File.Delete(xmlFilename); return; } try { using (var sr = new System.IO.StreamReader(xmlFilename)) { string s = sr.ReadToEnd(); _systemFileInfo = SystemFileSerializer.FromString(s); ((File.IFile)SystemFile).Size = _systemFileInfo.FileSize; HomePath = _systemFileInfo.HomePath; //Log.Logger.Instance.Warning("Read DB Size: {0}", _systemFileInfo.FileSize); } } catch { } //** ignore exception as system file size will be computed from file size itself if not provided... } }
public static SystemFileSerializer FromString(string s) { if (string.IsNullOrEmpty(s)) { return(new SystemFileSerializer()); } string[] parts = s.Split(new[] { ";" }, StringSplitOptions.None); if (parts.Length < 2) { return(new SystemFileSerializer()); } var r = new SystemFileSerializer(); long.TryParse(parts[0], out r.FileSize); r.HomePath = parts[1]; return(r); }
private void ReadSystemFileAttributes() { //** retrieve the File size from Xml file string xmlFilename = string.Format("{0}.{1}", SystemFile.Filename, DataInfExtensionLiteral); if (System.IO.File.Exists(xmlFilename)) { try { using (var sr = new System.IO.StreamReader(xmlFilename)) { string s = sr.ReadToEnd(); _systemFileInfo = SystemFileSerializer.FromString(s); ((File.IFile)SystemFile).Size = _systemFileInfo.FileSize; HomePath = _systemFileInfo.HomePath; } } catch { } //** ignore exception as system file size will be computed from file size itself if not provided... } }