private static void ProcessDataLogFile(CollarFile file) { LogGeneralMessage(String.Format("Start local processing of file {0}", file.FileId)); var databaseFunctions = new AnimalMovementFunctions(); //FIXME: check that this is generic to all telonics processing and not just Argos files databaseFunctions.ArgosFile_ClearProcessingResults(file.FileId); var processor = new Gen4Processor(null); var lines = processor.ProcessDataLog(file.Contents.ToArray()); //Add a newline, so that it exactly matches the direct output from TDC var data = Encoding.UTF8.GetBytes(String.Join(Environment.NewLine, lines) + Environment.NewLine); var filename = Path.GetFileNameWithoutExtension(file.FileName) + "_" + DateTime.Now.ToString("yyyyMMdd") + ".csv"; var fileLoader = new FileLoader(filename, data) { Project = file.Project, Owner = file.ProjectInvestigator, Collar = new Collar { CollarManufacturer = file.CollarManufacturer, CollarId = file.CollarId }, Status = file.Status, ParentFileId = file.FileId, AllowDuplicates = true }; fileLoader.Load(); LogGeneralMessage("Finished local processing of file"); }
private static void ProcessIdfFile(CollarFile file) { LogGeneralMessage(String.Format("Start local processing of file {0}", file.FileId)); var databaseViews = new AnimalMovementViews(); var idfLink = databaseViews.CollarParametersForIridiumDownload(file.FileId).FirstOrDefault(); if (idfLink == null) { LogGeneralMessage("No parameters found. Skipping file."); return; } var database = new AnimalMovementDataContext(); var tpfFile = database.CollarParameterFiles.FirstOrDefault(f => f.FileId == idfLink.ParameterFileId); if (tpfFile == null) { LogGeneralMessage("No collar parameter file found. Skipping file."); return; } var collar = database.Collars.FirstOrDefault( c => c.CollarManufacturer == idfLink.CollarManufacturer && (c.CollarId == idfLink.CollarId || c.CollarId == idfLink.CollarId.Substring(0, 6))); if (collar == null) { LogGeneralMessage("No collar found. Skipping file."); return; } var databaseFunctions = new AnimalMovementFunctions(); //FIXME: check that this is generic to all telonics processing and not just Argos files databaseFunctions.ArgosFile_ClearProcessingResults(file.FileId); databaseFunctions.CollarFile_FixOwnerOfIdfFile((file.FileId)); var processor = new Gen4Processor(tpfFile.Contents.ToArray()); var lines = processor.ProcessIdf(file.Contents.ToArray()); var data = Encoding.UTF8.GetBytes(String.Join(Environment.NewLine, lines) + Environment.NewLine); var filename = Path.GetFileNameWithoutExtension(file.FileName) + "_" + DateTime.Now.ToString("yyyyMMdd") + ".csv"; var fileLoader = new FileLoader(filename, data) { Project = null, Owner = tpfFile.ProjectInvestigator, //Must match result from databaseFunctions.CollarFile_FixOwnerOfIdfFile Collar = collar, Status = file.Status, ParentFileId = file.FileId, AllowDuplicates = false }; fileLoader.Load(); LogGeneralMessage("Finished local processing of file"); }
public static void TestArgosAwsGen4File() { const string path = @"..\..\SampleFiles\37780 20121219_231239_Gen4.aws"; const string tpf = @"..\..\SampleFiles\100628007B_37780.tpf"; Console.WriteLine("File {0}", path); ArgosFile a = new ArgosAwsFile(path); var processor = new Gen4Processor(File.ReadAllBytes(tpf)); SummarizeFile(a); Console.WriteLine("Messages in File"); foreach (var s in processor.ProcessTransmissions(a.GetTransmissions(), a)) { Console.WriteLine(s); } }
private static bool HaveAccessToTelonicsSoftware() { var pathToTdc = new Gen4Processor(null).TdcExecutable; return(File.Exists(pathToTdc)); }