private async Task<IList<string>> LoadLabelsAsync(string fileName)
        {
            await using var stream = _assetLoader.GetStream(fileName);
            using var sr = new StreamReader(stream);
            
            var labels = (await sr.ReadToEndAsync())
                .Split('\n', StringSplitOptions.RemoveEmptyEntries)
                .Select(s => s.Trim())
                .Where(s => !string.IsNullOrEmpty(s))
                .ToList();

            return labels;
        }
Ejemplo n.º 2
0
        private async Task <IList <string> > LoadLabels(string fileName)
        {
            using (var stream = _assetLoader.GetStream(fileName))
                using (var sr = new StreamReader(stream))
                {
                    var content = await sr.ReadToEndAsync();

                    var labels = content.Split(
                        new[] { "\r\n" },
                        StringSplitOptions.RemoveEmptyEntries);

                    //for (var i = 0; i < labels.Length; i++)
                    //{
                    //    labels[i] = labels[i].TrimEnd('\r');
                    //}

                    return(labels);
                }
        }