this is what the data in the line looks like:
<temp><id>TGPU1</id><label>GPU</label><value>67</value></temp><temp><id>THDD1</id><label>ST3320620AS</label><value>34</value></temp><temp><id>FCPU</id><label>CPU</label><value>1430</value></temp>
(more, it's just a little discarding the original output). what I would like to do is feed it through some quick code (not how long the actual code works, but how long it takes to execute), which will delete everything
<temp><id>TGPU1</id><label>GPU</label><value>
and print it on a new line with only a value between all the <value> and </value> parameters. im looking for output in line: 67341430.
I found this code:
bool FoundMatch = false; try { Regex regex = new Regex(@"<([be])pt[^>]+>.+?</\1pt>"); while(regex.IsMatch(yourstring) ) { yourstring = regex.Replace(yourstring, ""); } } catch (ArgumentException ex) {
but only removes <* pt> that the cold needs to be changed in order to remove something else. but it will only remove one tag at a time. not very fast if I need to remove all tags.
thanks
PS, if you want to know, the code below is the code I want to add. this is also the code that printed the source line mentioned above:
static void Main(string[] args) { Console.WriteLine("Memory mapped file reader started"); using (var file = MemoryMappedFile.OpenExisting("sensor")) { using (var reader = file.CreateViewAccessor(0, 3800)) { var encoding = Encoding.ASCII; Console.WriteLine(encoding.GetString(bytes)); } } Console.WriteLine("Press any key to exit ..."); Console.ReadLine(); }
source share