public static APCDataSet Create(ushort nComsAddress, string strRTTServer) { APCDataSet ds = new APCDataSet(); ds.m_nComsAddress = nComsAddress; ds.m_strRTTServer = strRTTServer; //it is not able to create directory in Android yet //DirectoryInfo di = new DirectoryInfo( cCNXPath ); //if( di.Exists ) //{ // IEnumerable<FileInfo> query = di.GetFiles( "*.dat" ).OrderBy( FileInfo => FileInfo.Name ); // foreach( FileInfo fi in query ) // { // if( fi.Length > cHdrLength ) // ds.m_Queue.Enqueue( fi ); // else // fi.Delete(); // } //} //else // di.Create(); ds.m_LastCounts = LastCounts.Create(cCNXPath + "LastCounts.bin"); return(ds); }
public static LastCounts Create(string strPath) { LastCounts lc = new LastCounts(); lc.m_File = new FileInfo(strPath); if (lc.m_File.Exists) { try { using (BinaryReader rdr = new BinaryReader(lc.m_File.OpenRead())) { uint nElapsedSec = (uint)(DateTime.UtcNow - cDateOfBuild).TotalSeconds - rdr.ReadUInt32(); if (nElapsedSec < 300) { lc.m_nLoading = rdr.ReadByte(); rdr.Read(lc.m_naBA, 0, lc.m_naBA.Length); } } } catch (Exception) { } } return(lc); }