Quantcast
Channel: Visual Studio Integrate forum
Viewing all articles
Browse latest Browse all 4410

Reading data from text editor in visual studio

$
0
0

In my project I have written my own code of saving a file in project. This method of saving a file is different from how visual studio saves the file.

I have written a code to read each line of text editor and storing it to array of string e.g textbuffer. This action is a part of saving a file  to the host.

Now i want to increase the performance of saving a file. For that i want to reduce the complexity of the method given below which reads the text editor and storing the content to an array of string.

Please help me


Microsoft.VisualStudio.TextManager.Interop.IVsTextLines itbLine = Marshal.GetObjectForIUnknown(docData) as Microsoft.VisualStudio.TextManager.Interop.IVsTextLines;
                                textBuffer = new string[noLines];
                                for (int num = 0; num < noLines; num++)
                                {
                                    itb.GetLengthOfLine(num, out lengthOfLine);
                                    String strData = null;
                                    itbLine.GetLineText(num, 0, num, lengthOfLine, out strData);
                                    textBuffer[num] = strData.Replace("\t", TabSpace).TrimEnd();
                                    int recordLength = 0;
                                    if (strData.Length > 0)
                                        recordLength = MessageUtil.putEBCDICFromString(strData.TrimEnd()).Length;
                                    if (recordLength > textLen)
                                        throw new DeltaManager.LineTooLong(num + 1, textLen);
                                }




Viewing all articles
Browse latest Browse all 4410

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>