Advertisement
Guest User

stuff

a guest
Oct 23rd, 2014
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. //initialize
  2. {
  3. //populates backend whitelist of critical proccesses
  4. discover()
  5. importWhiteList(defaultfile)
  6.  
  7. }
  8.  
  9. discover()
  10. {
  11. //gets all active processes
  12. foreach in proccesses
  13. {
  14. if (proccess part of backend whitelist)
  15. { do nothing }
  16. else if (process part of front end whitelist)
  17. { do nothing }
  18. else
  19. { add to blacklist }
  20. }
  21. }
  22.  
  23. importWhitelist(filename)
  24. {
  25. string line;
  26. ifstream myfile ("input.txt");//will add functionality for choosing name
  27. vector<string> input;
  28.  
  29. while (getline (myfile, line))
  30. {
  31. String ^ S = gcnew String(line.c_str());
  32. int index = blacklist->FindStringExact(S);
  33. if (index != ListBox::NoMatches)
  34. this->blacklist->Items->RemoveAt(index);
  35. this->whitelist->Items->Add(S);
  36. }
  37. myfile.close();
  38. }
  39.  
  40. kill()
  41. {
  42. foreach in blacklist
  43. {
  44. kill process
  45. }
  46. }
  47.  
  48. revive()
  49. {
  50. foreach in blacklist
  51. {
  52. rerun process() //in order?
  53. }
  54. }
  55.  
  56. swap() actual code
  57. {
  58. int size = blacklist->Items->Count;
  59. int blacklistsize = blacklist->Items->Count;
  60. int whitelistsize = whitelist->Items->Count;
  61.  
  62. for (int i = 0; i < blacklistsize; i++)
  63. {
  64. if (blacklist->GetItemChecked(i))
  65. {
  66.  
  67. whitelist->Items->Add(blacklist->Items[i]);
  68. blacklist->Items->RemoveAt(i);
  69. blacklistsize--;
  70. whitelistsize++;
  71. i--;
  72. }
  73. }
  74.  
  75.  
  76. for (int i = 0; i < whitelistsize; i++)
  77. {
  78. if (whitelist->GetItemChecked(i))
  79. {
  80. blacklist->Items->Add(whitelist->Items[i]);
  81. whitelist->Items->RemoveAt(i);
  82. whitelistsize--;
  83. blacklistsize++;
  84. i--;
  85. }
  86. }
  87. }
  88.  
  89. save()
  90. {
  91.  
  92. String^ fileName = "textfile.txt";
  93. StreamWriter^ sw = gcnew StreamWriter(fileName); //will add warning and functionality to change name
  94. int count = whitelist->Items->Count;
  95. for (int i = 0; i < count; i++)
  96. {
  97. sw->WriteLine(whitelist->Items[i]);
  98. }
  99.  
  100. sw->Close();
  101. }
  102. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement