private static IEnumerable <Selection> UnsupportedParserRandomFeatureToFile( AbstractTableWriter writer, string output, RandomSelectionBlock block) { var outputOptions = output.Split(new[] { "#" }, StringSplitOptions.RemoveEmptyEntries); if (outputOptions.Length != 2) { return(null); } var export = new ConvertAction(); export.Execute(block.RandomSelection, new[] { output }, writer); var form = outputOptions[0]; var path = outputOptions[1]; var nam = Path.GetFileNameWithoutExtension(path); var ext = Path.GetExtension(path); var dir = Path.GetDirectoryName(path); if (!string.IsNullOrWhiteSpace(dir) && !Directory.Exists(dir)) { Directory.CreateDirectory(dir); } export.Execute(block.RandomInvertSelection, new[] { $"{form}#\"{Path.Combine(dir, $"{nam}_inverse{ext}")}\"" }, writer); return(null); }
private static IEnumerable <Selection> UnsupportedParserFeatureAutosplitToFile( AbstractTableWriter writer, string output, IEnumerable <Selection> selections) { var outputOptions = output.Split(new[] { "#" }, StringSplitOptions.RemoveEmptyEntries); if (outputOptions.Length != 2) { return(null); } var form = outputOptions[0]; var path = outputOptions[1]; var dir = Path.GetDirectoryName(path); var nam = Path.GetFileNameWithoutExtension(path); var ext = Path.GetExtension(path); if (!string.IsNullOrWhiteSpace(dir) && !Directory.Exists(dir)) { Directory.CreateDirectory(dir); } var export = new ConvertAction(); foreach (var cluster in selections) { export.Execute(cluster, new[] { $"{form}#\"{Path.Combine(dir, $"{nam}_{cluster.Displayname.EnsureFileName()}{ext}")}\"" }, writer); } return(null); }