public async Task <IAbsoluteFilePath> WriteParFile(WriteParFileInfo info) { var filePath = GetFilePath(info); this.Logger().Info("Writing par file at: {0}, with:\n{1}", filePath, info.Content); await _writer.WriteFileAsync(filePath.ToString(), info.Content, Encoding.UTF8).ConfigureAwait(false); // Encoding.Default :S return(filePath); }
static string GetFileName(WriteParFileInfo info) { var additionalIdentifier = info.AdditionalIdentifier == null ? null : "_" + info.AdditionalIdentifier; return("par" + additionalIdentifier + ".txt"); }
IAbsoluteFilePath GetFilePath(WriteParFileInfo info) => _parPath.GetChildDirectoryWithName(new ShortGuid(info.GameId).ToString()) .GetChildFileWithName(GetFileName(info));