public static bool IsValidFile(string filename, bool doStrictChecking = false) { try { EdfPlusFile edf = new EdfPlusFile(filename, true, false, PrereadTALs.None, false) { CheckVersionOnOpen = true }; return edf.ValidFormat; } catch (Exception) { return false; } }
public static bool IsValidFile(string filename, bool doStrictChecking = false) { try { EdfPlusFile edf = new EdfPlusFile(filename, true, false, PrereadTALs.None, false) { CheckVersionOnOpen = true }; return(edf.ValidFormat); } catch (Exception) { return(false); } }
/// <summary> /// Sets (resizes) the EDF+ signal number of data for selected signal number. /// </summary> /// <param name="edfFile">The edf file.</param> /// <param name="signalNr">The signal nr.</param> /// <param name="newNrBytes">The new number of bytes.</param> /// <param name="marginPercentage">The percentage to use as margin; e.g. 20 means leave 20% of the space unused.</param> public static void DoResizeTALBufferSize(EdfPlusFile edfFile, int signalNr, int newNrBytes, byte marginPercentage) { if (!Range.InRange(marginPercentage, 1, 99)) { throw new ArgumentOutOfRangeException("marginPercentage"); } if (edfFile.AnnotationSignalNrs.Count == 1 && MathEx.IsZero(edfFile.FileInfo.SampleRecDuration)) { DoResizeBuffer_OneSignalZeroDuration(edfFile.TAL, (int)Math.Truncate(newNrBytes * (100 - marginPercentage) / 100d)); } else { throw new NotImplementedException(); } }
/// <summary> /// Sets (resizes) the EDF+ signal number of data for selected signal number. /// </summary> /// <param name="edfFile">The edf file.</param> /// <param name="signalNr">The signal nr.</param> /// <param name="newNrBytes">The new number of bytes.</param> /// <param name="marginPercentage">The percentage to use as margin; e.g. 20 means leave 20% of the space unused.</param> public static void DoResizeTALBufferSize(EdfPlusFile edfFile, int signalNr, int newNrBytes, byte marginPercentage) { if (!Range.InRange(marginPercentage, 1, 99)) throw new ArgumentOutOfRangeException("marginPercentage"); if (edfFile.AnnotationSignalNrs.Count == 1 && MathEx.IsZero(edfFile.FileInfo.SampleRecDuration)) DoResizeBuffer_OneSignalZeroDuration(edfFile.TAL, (int)Math.Truncate(newNrBytes * (100 - marginPercentage) / 100d)); else throw new NotImplementedException(); }