} // func GetInFileExtention private static string GetOutFileExtention(OdetteOutFileState state) { switch (state) { case OdetteOutFileState.Sent: return(".sent"); case OdetteOutFileState.WaitEndToEnd: return(".we2e"); case OdetteOutFileState.ReceivedEndToEnd: return(".re2e"); case OdetteOutFileState.Finished: return(".done"); default: throw new ArgumentException("Invalid state."); } } // func GetInFileExtention
} // func ChangeInFileStateAsync private static Task ChangeOutFileStateAsync(FileInfo fileInfo, OdetteOutFileState newState) { var fiNewFileName = Path.ChangeExtension(fileInfo.FullName, GetOutFileExtention(newState)); return(Task.Run(() => fileInfo.MoveTo(fiNewFileName))); } // func ChangeOutFileStateAsync
/// <summary>Builds the file name with state extention.</summary> /// <param name="file"></param> /// <param name="state"></param> /// <returns></returns> internal FileInfo CreateOutFileName(IOdetteFile file, OdetteOutFileState state) => new FileInfo(Path.Combine(directoryOut.FullName, GetFileName(file) + GetOutFileExtention(state)));
} // func ChangeInFileState private static void ChangeOutFileState(FileInfo fileInfo, OdetteOutFileState newState) { var fiNewFileName = Path.ChangeExtension(fileInfo.FullName, GetOutFileExtention(newState)); fileInfo.MoveTo(fiNewFileName); } // func ChangeOutFileState
} // func CreateInFileName /// <summary>Builds the file name with state extention.</summary> /// <param name="file"></param> /// <param name="state"></param> /// <returns></returns> internal FileInfo CreateOutFileName(IOdetteFile file, OdetteOutFileState state) { return new FileInfo(Path.Combine(directoryOut.FullName, GetFileName(file) + GetOutFileExtention(state))); } // func CreateOutFileName
} // func GetInFileExtention private static string GetOutFileExtention(OdetteOutFileState state) { switch (state) { case OdetteOutFileState.Sent: return ".sent"; case OdetteOutFileState.WaitEndToEnd: return ".we2e"; case OdetteOutFileState.ReceivedEndToEnd: return ".re2e"; default: throw new ArgumentException("Invalid state."); } } // func GetInFileExtention