示例#1
0
        public async Task <OcrResults> OCRAnalysis([FromBody] string imageUrl)
        {
            VisionServiceClient VisionServiceClient = new VisionServiceClient(Config.COMPUTER_VISION_API_KEY);
            OcrResults          ocrResult           = await VisionServiceClient.RecognizeTextAsync(imageUrl, "en");

            return(ocrResult);
        }
示例#2
0
        public async Task <OcrResults> OcrRecognizeText(string selectedFile, bool detectOrientation = true, string languageCode = LanguageCodes.AutoDetect)
        {
            IVisionServiceClient visionClient = new VisionServiceClient(_subscriptionKeyVision);
            OcrResults           ocrResult    = null;

            try
            {
                if (File.Exists(selectedFile))
                {
                    using (var fileStreamVision = File.OpenRead(selectedFile))
                    {
                        ocrResult = await visionClient.RecognizeTextAsync(fileStreamVision, languageCode, detectOrientation);
                    }
                }
                else
                {
                    ErrorMesssage = "Invalid image path or Url";
                }
            }
            catch (ClientException e)
            {
                ErrorMesssage = e.Error != null ? e.Error.Message : e.Message;
            }
            catch (Exception exception)
            {
                ErrorMesssage = exception.ToString();
            }
            return(ocrResult);
        }
示例#3
0
        static void LogOcrResults(OcrResults results)
        {
            StringBuilder stringBuilder = new StringBuilder();

            if (results != null && results.Regions != null)
            {
                stringBuilder.Append("Details:");
                stringBuilder.AppendLine();
                foreach (var item in results.Regions)
                {
                    foreach (var line in item.Lines)
                    {
                        foreach (var word in line.Words)
                        {
                            stringBuilder.Append(word.Text);
                            stringBuilder.Append(" ");
                        }

                        stringBuilder.AppendLine();
                    }

                    stringBuilder.AppendLine();
                }
            }

            //Console.WriteLine(stringBuilder.ToString());

            //textBox.Text = stringBuilder.ToString();
        }
        /// <summary>
        /// Uploads the image to Project Oxford and performs OCR
        /// </summary>
        /// <param name="imageFilePath">The image file path.</param>
        /// <param name="language">The language code to recognize for</param>
        /// <returns></returns>
        private async Task <OcrResults> UploadAndRecognizeImage(string imageFilePath, string language)
        {
            // -----------------------------------------------------------------------
            // KEY SAMPLE CODE STARTS HERE
            // -----------------------------------------------------------------------

            //
            // Create Project Oxford Vision API Service client
            //
            VisionServiceClient VisionServiceClient = new VisionServiceClient(SubscriptionKey, "https://westcentralus.api.cognitive.microsoft.com/vision/v1.0");

            Log("VisionServiceClient is created");

            using (Stream imageFileStream = File.OpenRead(imageFilePath))
            {
                //
                // Upload an image and perform OCR
                //
                Log("Calling VisionServiceClient.RecognizeTextAsync()...");
                OcrResults ocrResult = await VisionServiceClient.RecognizeTextAsync(imageFileStream, language);

                return(ocrResult);
            }

            // -----------------------------------------------------------------------
            // KEY SAMPLE CODE ENDS HERE
            // -----------------------------------------------------------------------
        }
        public static byte[] DrawBoxesOnImageText(Image img, OcrResults ocrData)
        {
            var imageWithRectangles = new Bitmap(img.Width, img.Height);

            imageWithRectangles.SetResolution(img.HorizontalResolution, img.VerticalResolution);

            using (var graphics = Graphics.FromImage(imageWithRectangles))
            {
                graphics.DrawImage(img, new System.Drawing.Rectangle(0, 0, img.Width, img.Height), 0, 0, img.Width, img.Height, GraphicsUnit.Pixel);
                foreach (var region in ocrData?.Regions)
                {
                    foreach (var line in region.Lines)
                    {
                        var bounds = line?.BoundingBox?.Split(',') ?? null;

                        if (bounds != null)
                        {
                            var boxToDraw = new System.Drawing.Rectangle(int.Parse(bounds[0]), int.Parse(bounds[1]), int.Parse(bounds[2]), int.Parse(bounds[3]));

                            graphics.DrawRectangle(new Pen(System.Drawing.Color.SpringGreen, 2), boxToDraw);
                        }
                        else
                        {
                            System.Diagnostics.Debug.WriteLine($"Unable to draw: {bounds.Count()}");
                        }
                    }
                }
            }

            ImageConverter converter = new ImageConverter();

            return((byte[])converter.ConvertTo(imageWithRectangles, typeof(byte[])));
        }
        private void PopulateUIWithRegions(OcrResults ocrResult)
        {
            // Iterate the regions
            foreach (var region in ocrResult.Regions)
            {
                // Iterate lines per region
                foreach (var line in region.Lines)
                {
                    // For each line, add a panel
                    // to present words horizontally
                    var lineStack = new StackLayout
                    {
                        Orientation = StackOrientation.Horizontal
                    };

                    // Iterate words per line and add the word
                    // to the StackLayout
                    foreach (var word in line.Words)
                    {
                        var textLabel = new Label {
                            Text = word.Text
                        };
                        lineStack.Children.Add(textLabel);
                    }
                    // Add the StackLayout to the UI
                    this.DetectedText.Children.Add(lineStack);
                }
            }
        }
        /// <summary>
        ///     Get text from the given OCR results object.
        /// </summary>
        /// <param name="ocrResults"></param>
        /// <returns>The OCR results.</returns>
        private static string GetTextOcrResults(OcrResults ocrResults)
        {
            var stringBuilder = new StringBuilder();

            if (ocrResults?.Regions != null)
            {
                foreach (var region in ocrResults.Regions)
                {
                    foreach (var line in region.Lines)
                    {
                        foreach (var word in line.Words)
                        {
                            stringBuilder.Append(word.Text);
                            stringBuilder.Append(" ");
                        }
                        stringBuilder.AppendLine();
                    }
                    stringBuilder.AppendLine();
                }
            }
            return
                (stringBuilder.ToString()
                 .Replace(System.Environment.NewLine, string.Empty)
                 .Replace(System.Environment.CommandLine, string.Empty)
                 .ToUpper()
                 .Trim());
        }
        /// <summary>
        /// Recognize text from given image.
        /// </summary>
        /// <param name="imagePathOrUrl">The image path or url.</param>
        /// <param name="detectOrientation">if set to <c>true</c> [detect orientation].</param>
        /// <param name="languageCode">The language code.</param>
        public OcrResults RecognizeText(Stream imageStream, bool detectOrientation = true, string languageCode = LanguageCodes.AutoDetect)
        {
            OcrResults ocrResult = null;
            string     resultStr = string.Empty;

            return(ocrResult = this.visionClient.RecognizeTextAsync(imageStream, languageCode, detectOrientation).Result);
        }
        /// <summary>
        /// Text Extraction (OCR'ing)
        /// </summary>
        /// <param name="photoStream">Picture to analyse and extract text from</param>
        /// <returns>Recognized text from picture. In case of an erro null is returned</returns>
        public async Task <Tuple <string, bool> > DescribeTextAsync(Stream photoStream)
        {
            try
            {
                var        client     = new VisionServiceClient(Addresses.COMPUTER_VISION_API_KEY);
                OcrResults ocrResults = await client.RecognizeTextAsync(photoStream);

                var text = String.Empty;
                foreach (var region in ocrResults.Regions)
                {
                    foreach (var line in region.Lines)
                    {
                        foreach (var word in line.Words)
                        {
                            text = $"{text} {word.Text}";
                        }
                    }
                }

                // Parse the result
                return(new Tuple <string, bool>(text, true));
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine($"ERROR: {ex.Message}");
                return(new Tuple <string, bool>(ex.Message, false));
            }
        }
示例#10
0
        /// <summary>
        /// Uploads the image to Project Oxford and performs OCR
        /// </summary>
        /// <param name="imageStream">The image file stream.
        /// Supported image formats: JPEG, PNG, GIF, BMP.
        /// Image file size must be less than 4MB.
        /// Image dimensions must be between 40 x 40 and 3200 x 3200 pixels, and the image cannot be larger than 100 megapixels.
        /// </param>
        /// <param name="language">The language code to recognize for</param>
        /// <returns></returns>
        public static async Task <string> UploadAndRecognizeImageTextAsync(Stream imageStream, string language)
        {
            // Upload an image and perform OCR
            OcrResults ocrResult = await UploadAndRecognizeImageAsync(imageStream, language);

            return(ConvertOcrResultsToString(ocrResult));
        }
        private static async Task <string[]> TextExtractionCore(string fname, bool wrds, string method)
        {
            VisionServiceClient vsClient = new VisionServiceClient(API_Key, API_Location);

            string[] textres = null;

            if (System.IO.File.Exists(fname))
            {
                using (Stream stream = System.IO.File.OpenRead(fname))
                {
                    switch (method)
                    {
                    case "TextPic":
                        OcrResults ocr = await vsClient.RecognizeTextAsync(stream, "unk", false);

                        textres = GetExtracted(ocr, wrds);
                        break;

                    case "HandwrittenPic":
                        HandwritingRecognitionOperation hdro = await vsClient.CreateHandwritingRecognitionOperationAsync(stream);

                        HandwritingRecognitionOperationResult hresult = await vsClient.GetHandwritingRecognitionOperationResultAsync(hdro);

                        textres = GetHandWrittenExtracted(hresult, wrds);
                        break;
                    }
                }
            }
            return(textres);
        }
示例#12
0
        public static string GetRecognizedText(this OcrResults results)
        {
            var stringBuilder = new StringBuilder();

            if (results?.Regions != null)
            {
                foreach (var item in results.Regions)
                {
                    foreach (var line in item.Lines)
                    {
                        foreach (var word in line.Words)
                        {
                            stringBuilder.Append(word.Text);
                            stringBuilder.Append(" ");
                        }

                        stringBuilder.AppendLine();
                    }

                    stringBuilder.AppendLine();
                }
            }

            return(stringBuilder.ToString());
        }
示例#13
0
        //https://social.msdn.microsoft.com/Forums/vstudio/en-US/5b4f4479-27e9-4d73-a2f3-9a7a5229db55/mvpsample-code-with-vision-sdk-in-c-on-ocr?forum=mlapi

        private static void ShowRetrieveText(OcrResults results)
        {
            StringBuilder stringBuilder = new StringBuilder();

            if (results != null && results.Regions != null)
            {
                stringBuilder.Append("OCR = ");
                stringBuilder.AppendLine();
                foreach (var item in results.Regions)
                {
                    foreach (var line in item.Lines)
                    {
                        foreach (var word in line.Words)
                        {
                            stringBuilder.Append(word.Text);
                            stringBuilder.Append(" ");
                        }

                        stringBuilder.AppendLine();
                    }

                    stringBuilder.AppendLine();
                }
            }


            ResultTextFromOCR = stringBuilder.ToString();
        }
示例#14
0
        private async void consume(MediaFile file)
        {
            // https://forums.xamarin.com/discussion/comment/62875/#Comment_62875
            previewImage.Source = ImageSource.FromFile(file?.Path);

            var client = new VisionServiceClient(
                subscriptionKey: Secrets.ComputerVisionServiceApiKey,
                apiRoot: Consts.ComputerVisionApiEndPoint
                );

            CurrentPage        = Children[1];
            results            = null;
            resultsHere.Text   = "・・・Azure Computer Vision API OCR で解析中・・・";
            textOnly.Text      = "・・・Azure Computer Vision API OCR で解析中・・・";
            progress.IsVisible = true;
            results            = await client.RecognizeTextAsync(file?.GetStream(), "ja");

            progress.IsVisible = false;
            resultsHere.Text   = JsonConvert.SerializeObject(results, Formatting.Indented);
            uiPanel.InvalidateSurface();

            textOnly.Text = String.Join(" ", results.Regions
                                        .SelectMany(region => region.Lines)
                                        .SelectMany(line => line.Words.Concat(new Word[] { new Word {
                                                                                               Text = "\n"
                                                                                           } }))
                                        .Select(word => word.Text)
                                        );
        }
        private static List <Word> GetTotalWords(OcrResults ocrResult, string backupText = null)
        {
            const string STR_Total = "total";
            string       stringToFind;

            if (backupText != null)
            {
                stringToFind = backupText;
            }
            else
            {
                stringToFind = STR_Total;
            }



            List <Word> foundWords = new List <Word>();

            foreach (var eachRegion in ocrResult.Regions)
            {
                List <Line> lstLines = eachRegion.Lines.ToList();

                List <Line> foundLines = lstLines.FindAll(li => FindWord(li, stringToFind));

                foreach (var eachFoundLine in foundLines)
                {
                    //var words = eachFoundLine.Words.ToList().FindAll(wo => string.Equals("total", wo.Text, StringComparison.CurrentCultureIgnoreCase));
                    var words = eachFoundLine.Words.ToList().FindAll(wo => wo.Text.Trim().ToUpper().Contains(stringToFind.ToUpper()));

                    foundWords.AddRange(words);
                }
            }

            return(foundWords);
        }
示例#16
0
文件: Program.cs 项目: szelor/Hekaton
        private static void LogOcrResults(OcrResults results)
        {
            Console.ForegroundColor = ConsoleColor.Cyan;

            StringBuilder stringBuilder = new StringBuilder();

            if (results != null && results.Regions != null)
            {
                stringBuilder.Append("Text: ");
                stringBuilder.AppendLine();
                foreach (var item in results.Regions)
                {
                    foreach (var line in item.Lines)
                    {
                        foreach (var word in line.Words)
                        {
                            stringBuilder.Append(word.Text);
                            stringBuilder.Append(" ");
                        }

                        stringBuilder.AppendLine();
                    }

                    stringBuilder.AppendLine();
                }
            }

            Log(stringBuilder.ToString());
        }
示例#17
0
        private string PopulateUIWithRegions(OcrResults ocrResult)
        {
            string s = null;

            // Iterate the regions
            foreach (var region in ocrResult.Regions)
            {
                // Iterate lines per region
                foreach (var line in region.Lines)
                {
                    // For each line, add a panel
                    // to present words horizontally
                    var lineStack = new StackLayout
                    {
                        Orientation = StackOrientation.Horizontal
                    };
                    // Iterate words per line and add the word
                    // to the StackLayout
                    foreach (var word in line.Words)
                    {
                        s += word.Text + " ";
                        //var textLabel = new Label { Text = word.Text };
                        //lineStack.Children.Add(textLabel);
                    }
                    s += Environment.NewLine;
                    // Add the StackLayout to the UI
                    //this.DetectedText.Children.Add(lineStack);
                }
            }
            return(s);
        }
        /// <summary>
        /// Retrieve text from the given OCR results object.
        /// </summary>
        /// <param name="results">The OCR results.</param>
        /// <returns>Return the text.</returns>
        public string GetRetrieveText(OcrResults results)
        {
            StringBuilder stringBuilder = new StringBuilder();

            if (results != null && results.Regions != null)
            {
                stringBuilder.AppendLine();
                foreach (var item in results.Regions)
                {
                    foreach (var line in item.Lines)
                    {
                        foreach (var word in line.Words)
                        {
                            stringBuilder.Append(word.Text);
                            stringBuilder.Append(" ");
                        }

                        stringBuilder.AppendLine();
                    }

                    stringBuilder.AppendLine();
                }
            }

            return(stringBuilder.ToString());
        }
 public CognitiveImageAnalysis()
 {
     VisionAnalysis  = new AnalysisResult();
     TextAnalysis    = new OcrResults();
     EmotionAnalysis = new Emotion[0];
     FacialAnalysis  = new Face[0];
 }
        private async Task AnalyzeAndProcessPhoto(MediaFile file)
        {
            Indicator1.IsVisible = true;
            Indicator1.IsRunning = true;
            Image1.Source        = ImageSource.FromStream(() => file.GetStream());
            var analysisResult = await AnalyzePictureAsync(file.GetStream());

            BindingContext = analysisResult;
            tags.IsVisible = true;

            //Text analysis
            if (analysisResult.Tags.Any(t => t.Name.ToLower() == "text"))
            {
                OcrResults ocrResult = await AnalyzePictureTextAsync(file.GetStream());

                pnlOcr.IsVisible = true;
                lblAngel.Text    = $"Text Angel: {ocrResult.TextAngle.ToString()}";
                lblLanguage.Text = $"Language: {ocrResult.Language}";
                PopulateUIWithRegions(ocrResult);
            }
            else
            {
                pnlOcr.IsVisible = false;
            }

            //Detect Celebrity
            AnalysisInDomainResult analysisDomain = await AnalyzePictureDomainAsync(file.GetStream());

            CelebrityName.Text = ParseCelebrityName(analysisDomain.Result);

            Indicator1.IsRunning = false;
            Indicator1.IsVisible = false;
        }
示例#21
0
        public static string[] GetExtracted(OcrResults res, bool words, bool mergeLines)
        {
            List <string> items = new List <string>();
            int           reg   = 1;

            foreach (Region r in res.Regions)
            {
                foreach (Line l in r.Lines)
                {
                    if (words)
                    {
                        items.AddRange(GetWords(l));
                    }
                    else
                    {
                        items.Add(GetLineAsString(l, mergeLines, reg));
                    }
                }

                reg++;
            }


            return(items.ToArray());
        }
        private static async Task<OcrResults> DetectText(string imageUrl, string VisionServiceApiKey, TraceWriter log)
        {
            VisionServiceClient visionServiceClient = new VisionServiceClient(VisionServiceApiKey);

            int retriesLeft = int.Parse(CloudConfigurationManager.GetSetting("CognitiveServicesRetryCount"));
            int delay = int.Parse(CloudConfigurationManager.GetSetting("CognitiveServicesInitialRetryDelayms"));

            OcrResults response = null;
            while (true)
            {
                try
                {
                    response = await visionServiceClient.RecognizeTextAsync(imageUrl);
                    break;
                }
                catch (ClientException exception) when (exception.HttpStatus == (HttpStatusCode)429 && retriesLeft > 0)
                {
                    log.Info($"Computer Vision OCR call has been throttled. {retriesLeft} retries left.");
                    if (retriesLeft == 1)
                    {
                        log.Warning($"Computer Vision OCR call still throttled after {CloudConfigurationManager.GetSetting("CognitiveServicesRetryCount")} attempts, giving up.");
                    }

                    await Task.Delay(delay);
                    retriesLeft--;
                    delay *= 2;
                    continue;
                }
            }

            return response;
        }
示例#23
0
        public string OcrRecognizeTextAsString(OcrResults ocrResult)
        {
            var result = $@"Language: {ocrResult.Language}
Orientation: {ocrResult.Orientation}
Text Angle: {ocrResult.TextAngle}
";

            foreach (var region in ocrResult.Regions)
            {
                result += $@"Region

BoundingBox: {region.BoundingBox}
Rectangle: 
    Left {region.Rectangle.Left}, Top {region.Rectangle.Top}, 
    Height {region.Rectangle.Height}, Width {region.Rectangle.Width} 

Lines
";
                foreach (var line in region.Lines)
                {
                    foreach (var word in line.Words)
                    {
                        result += $@"{word.Text} ";
                    }
                    result += $@"
";
                }
            }

            return(result);
        }
示例#24
0
        string LogOcrResults(OcrResults results)
        {
            StringBuilder stringBuilder = new StringBuilder();

            if (results != null && results.Regions != null)
            {
                //stringBuilder.Append("Text: ");
                stringBuilder.AppendLine();
                foreach (var item in results.Regions)
                {
                    foreach (var line in item.Lines)
                    {
                        foreach (var word in line.Words)
                        {
                            stringBuilder.Append(word.Text);
                            stringBuilder.Append(" ");
                        }

                        stringBuilder.AppendLine();
                    }

                    stringBuilder.AppendLine();
                }
            }

            Log(stringBuilder.ToString());
            return(stringBuilder.ToString());
        }
示例#25
0
        /// <summary>
        /// Sends a url to Project Oxford and performs OCR
        /// </summary>
        /// <param name="imageUrl">The url to perform recognition on</param>
        /// <param name="language">The language code to recognize for</param>
        /// <returns></returns>
        private static async Task <OcrResults> RecognizeUrl(string imageUrl, string language)
        {
            // -----------------------------------------------------------------------
            // KEY SAMPLE CODE STARTS HERE
            // -----------------------------------------------------------------------

            //
            // Create Project Oxford Vision API Service client
            //
            VisionServiceClient VisionServiceClient = new VisionServiceClient(ComKey);

            Log("VisionServiceClient is created");

            //
            // Perform OCR on the given url
            //
            Log("Calling VisionServiceClient.RecognizeTextAsync()...");
            OcrResults ocrResult = await VisionServiceClient.RecognizeTextAsync(imageUrl, language);

            return(ocrResult);

            // -----------------------------------------------------------------------
            // KEY SAMPLE CODE ENDS HERE
            // -----------------------------------------------------------------------
        }
示例#26
0
        protected string CombineOcrResults(OcrResults results)
        {
            System.Diagnostics.Debug.WriteLine(results.Regions.Count().ToString());

            StringBuilder stringBuilder = new StringBuilder();

            if (results != null && results.Regions != null)
            {
                stringBuilder.AppendLine();
                foreach (var item in results.Regions)
                {
                    foreach (var line in item.Lines)
                    {
                        foreach (var word in line.Words)
                        {
                            stringBuilder.Append(word.Text);
                            stringBuilder.Append(" ");
                        }

                        stringBuilder.AppendLine();
                    }

                    stringBuilder.AppendLine();
                }
            }

            System.Diagnostics.Debug.WriteLine(stringBuilder.ToString());
            return(stringBuilder.ToString());
        }
示例#27
0
        private static async Task <OcrResults> UploadAndRecognizeImage(string imageFilePath, string language)
        {
            // -----------------------------------------------------------------------
            // KEY SAMPLE CODE STARTS HERE
            // -----------------------------------------------------------------------

            //
            // Create Project Oxford Vision API Service client
            //
            VisionServiceClient VisionServiceClient = new VisionServiceClient(ComKey);

            Log("VisionServiceClient is created");

            using (Stream imageFileStream = File.OpenRead(imageFilePath))
            {
                //
                // Upload an image and perform OCR
                //
                Log("Calling VisionServiceClient.RecognizeTextAsync()...");
                OcrResults ocrResult = await VisionServiceClient.RecognizeTextAsync(imageFileStream, language);

                return(ocrResult);
            }

            // -----------------------------------------------------------------------
            // KEY SAMPLE CODE ENDS HERE
            // -----------------------------------------------------------------------
        }
示例#28
0
        /// <summary>
        /// Retrieve text from the given OCR results object.
        /// </summary>
        /// <param name="results">The OCR results.</param>
        /// <returns>Return the text.</returns>
        private void ShowRetrieveText(OcrResults results)
        {
            StringBuilder stringBuilder = new StringBuilder();

            if (results != null && results.Regions != null)
            {
                stringBuilder.Append("Text: ");
                stringBuilder.AppendLine();
                foreach (var item in results.Regions)
                {
                    foreach (var line in item.Lines)
                    {
                        foreach (var word in line.Words)
                        {
                            stringBuilder.Append(word.Text);
                            stringBuilder.Append(" ");
                        }

                        stringBuilder.AppendLine();
                    }

                    stringBuilder.AppendLine();
                }
            }

            Console.ForegroundColor = ConsoleColor.Green;
            Console.Write(stringBuilder.ToString());
            Console.ResetColor();
        }
示例#29
0
        public static string GetNaturalText(this OcrResults result)
        {
            var newLine = '\n';
            var text    = string.Empty;

            if (result == null && result.Regions == null)
            {
                return(null);
            }

            foreach (var item in result.Regions)
            {
                foreach (var line in item.Lines)
                {
                    foreach (var word in line.Words)
                    {
                        text += string.Format("{0} ", word.Text);
                    }

                    text += newLine;
                }

                text += newLine;
            }

            return(text);
        }
 public CognitiveImageAnalysis()
 {
     VisionAnalysis  = new AnalysisResult();
     TextAnalysis    = new OcrResults();
     EmotionAnalysis = new Emotion[0];
     FacialAnalysis  = new Microsoft.ProjectOxford.Face.Contract.Face[0];
 }
示例#31
0
            /// <summary>
            /// Retrieve text from the given OCR results object.
            /// </summary>
            /// <param name="results">The OCR results.</param>
            /// <returns>Return the text.</returns>
            public string GetRetrieveText(OcrResults results)
            {
                StringBuilder stringBuilder = new StringBuilder();

                if (results != null && results.Regions != null)
                {
                    stringBuilder.Append("Text: ");
                    stringBuilder.AppendLine();
                    foreach (var item in results.Regions)
                    {
                        foreach (var line in item.Lines)
                        {
                            foreach (var word in line.Words)
                            {
                                stringBuilder.Append(word.Text);
                                stringBuilder.Append(" ");
                            }

                            stringBuilder.AppendLine();
                        }

                        stringBuilder.AppendLine();
                    }
                }

                return stringBuilder.ToString();
            }