one key multiple values from different sources c#
Posted
by
user2964034
on Stack Overflow
See other posts from Stack Overflow
or by user2964034
Published on 2013-11-07T09:29:10Z
Indexed on
2013/11/07
9:53 UTC
Read the original article
Hit count: 221
c#
|dictionary
I am trying to make a c# program that will compare two files for me, and tell me the differences of specific parts. I have been able to get the parts I need into variables while looping through, but I now want to add these to a key with 3 values per file, so a key with 6 values overall which I will then compare to eachother later on. But I can only add 3 values at a time using the loop I have, so I need to be able to add the last 3 values to the key without overwriting the first 3.
example of data from file:
[\Advanced\Rules\Correlation Rules\Suspect_portscan\];
CheckDescription =S Detect Port scans;
Enabled =B 0;
Priority =L 3;
I have managed to get what I need into variables so I have: string SigName would be "Suspect_portscan" Int Enabled, Priority, Blocking as 0 3 and null respectivly.
I then want to make a dictionary type thing, with a key which would be the SigName and the first 3 values as enabled, priority, blocking. Then when looping through the second file, I want to add the 2nd files settings for the enabled, priority, blocking for the same SigName (so to the key) in the last 3 value slots.
I will then compare this against itself, like 'if signame(0) != signame(3)' so if file 1 enabled is not the same as file two enabled make a note and tell me.
But the problem I have is not being able to get the data into a dictionary or lookup, I'm completely stumped. It seems like I should use a dictionary with a list for the values but I cant get it working on the second loop through.
Thanks.
© Stack Overflow or respective owner