77using System . Xml . Linq ;
88using System . Threading . Tasks ;
99using System . Text . RegularExpressions ;
10+ using System . Text ;
1011
1112
1213namespace FetchFromXML
@@ -87,11 +88,12 @@ from att in root.Elements("channel").Attributes("id")
8788 //Fetching Data
8889 private void Fetch_Data ( object sender , RoutedEventArgs e )
8990 {
90- String allData = "" ;
91- progressBar . IsIndeterminate = true ;
91+ //String allData = "";
92+ StringBuilder allData = new StringBuilder ( ) ;
93+ allData . Append ( "" ) ;
9294
95+ progressBar . IsIndeterminate = true ;
9396
94-
9597
9698 if ( filePath != "" )
9799 {
@@ -110,80 +112,80 @@ private void Fetch_Data(object sender, RoutedEventArgs e)
110112 {
111113 if ( channelNames . Length != 0 )
112114 foreach ( string line in channelNames )
113- allData += fullNameMethod ( line ) ;
115+ allData . Append ( fullNameMethod ( line ) ) ;
114116
115117 if ( value != "" )
116118 {
117- allData += fullNameMethod ( value ) ;
119+ allData . Append ( fullNameMethod ( value ) ) ;
118120 appendTextInFile ( $ "{ value } ", "history.txt" ) ;
119121 }
120122 if ( value1 != "" )
121123 {
122- allData += fullNameMethod ( value1 ) ;
124+ allData . Append ( fullNameMethod ( value1 ) ) ;
123125 appendTextInFile ( $ "{ value1 } ", "history.txt" ) ;
124126 }
125127 if ( value2 != "" ) {
126- allData += fullNameMethod ( value2 ) ;
128+ allData . Append ( fullNameMethod ( value2 ) ) ;
127129 appendTextInFile ( $ "{ value2 } ", "history.txt" ) ;
128130 }
129131 if ( value3 != "" )
130132 {
131- allData += fullNameMethod ( value3 ) ;
133+ allData . Append ( fullNameMethod ( value3 ) ) ;
132134 appendTextInFile ( $ "{ value3 } ", "history.txt" ) ;
133135 }
134136 if ( value4 != "" )
135137 {
136- allData += fullNameMethod ( value4 ) ;
138+ allData . Append ( fullNameMethod ( value4 ) ) ;
137139 appendTextInFile ( $ "{ value4 } ", "history.txt" ) ;
138140 }
139141 if ( value5 != "" )
140142 {
141- allData += fullNameMethod ( value5 ) ;
143+ allData . Append ( fullNameMethod ( value5 ) ) ;
142144 appendTextInFile ( $ "{ value5 } ", "history.txt" ) ;
143145 }
144146 if ( value6 != "" )
145147 {
146- allData += fullNameMethod ( value6 ) ;
148+ allData . Append ( fullNameMethod ( value6 ) ) ;
147149 appendTextInFile ( $ "{ value6 } ", "history.txt" ) ;
148150 }
149151 if ( value7 != "" )
150152 {
151- allData += fullNameMethod ( value7 ) ;
153+ allData . Append ( fullNameMethod ( value7 ) ) ;
152154 appendTextInFile ( $ "{ value7 } ", "history.txt" ) ;
153155 }
154156 if ( value8 != "" )
155157 {
156- allData += fullNameMethod ( value8 ) ;
158+ allData . Append ( fullNameMethod ( value8 ) ) ;
157159 appendTextInFile ( $ "{ value8 } ", "history.txt" ) ;
158160 }
159161 if ( value9 != "" )
160162 {
161- allData += fullNameMethod ( value9 ) ;
163+ allData . Append ( fullNameMethod ( value9 ) ) ;
162164 appendTextInFile ( $ "{ value9 } ", "history.txt" ) ;
163165 }
164166 if ( selectId . Text != "" || selectId . Text != "--Select Channel ID--" )
165167 {
166- allData += fullNameMethod ( selectId . Text ) ;
168+ allData . Append ( fullNameMethod ( selectId . Text ) ) ;
167169 appendTextInFile ( $ "{ selectId . Text } ", "history.txt" ) ;
168170 }
169171 if ( selectId1 . Text != "" || selectId1 . Text != "--Select Channel ID--" )
170172 {
171- allData += fullNameMethod ( selectId1 . Text ) ;
173+ allData . Append ( fullNameMethod ( selectId1 . Text ) ) ;
172174 appendTextInFile ( $ "{ selectId1 . Text } ", "history.txt" ) ;
173175 }
174176 if ( selectId2 . Text != "" || selectId2 . Text != "--Select Channel ID--" )
175177 {
176- allData += fullNameMethod ( selectId2 . Text ) ;
178+ allData . Append ( fullNameMethod ( selectId2 . Text ) ) ;
177179 appendTextInFile ( $ "{ selectId2 . Text } ", "history.txt" ) ;
178180 }
179181 if ( selectId3 . Text != "" || selectId3 . Text != "--Select Channel ID--" )
180- {
181- allData += fullNameMethod ( selectId3 . Text ) ;
182+ {
183+ allData . Append ( fullNameMethod ( selectId3 . Text ) ) ;
182184 appendTextInFile ( $ "{ selectId3 . Text } ", "history.txt" ) ;
183185 }
184186 if ( selectId4 . Text != "" || selectId4 . Text != "--Select Channel ID--" )
185187 {
186- allData += fullNameMethod ( selectId4 . Text ) ;
188+ allData . Append ( fullNameMethod ( selectId4 . Text ) ) ;
187189 appendTextInFile ( $ "{ selectId4 . Text } ", "history.txt" ) ;
188190 }
189191 }
@@ -194,7 +196,7 @@ private void Fetch_Data(object sender, RoutedEventArgs e)
194196
195197 txtEditor . Text = $ "{ allData } \r \n ";
196198 if ( exportFile . IsChecked == true )
197- writeTextInFile ( allData , "channel.xml" ) ;
199+ writeTextInFile ( ToString ( ) , "channel.xml" ) ;
198200 }
199201 else
200202 MessageBox . Show ( "Please Select File..." , "Checking..." ) ;
@@ -254,7 +256,6 @@ public static async Task clearTextFromFile(string channelName)
254256 {
255257 MessageBox . Show ( "Error Can't clear history (" ) ;
256258 }
257-
258259 }
259260
260261 private static async Task readFromFile ( string fileName ) {
0 commit comments