Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //initialize
- {
- //populates backend whitelist of critical proccesses
- discover()
- importWhiteList(defaultfile)
- }
- discover()
- {
- //gets all active processes
- foreach in proccesses
- {
- if (proccess part of backend whitelist)
- { do nothing }
- else if (process part of front end whitelist)
- { do nothing }
- else
- { add to blacklist }
- }
- }
- importWhitelist(filename)
- {
- string line;
- ifstream myfile ("input.txt");//will add functionality for choosing name
- vector<string> input;
- while (getline (myfile, line))
- {
- String ^ S = gcnew String(line.c_str());
- int index = blacklist->FindStringExact(S);
- if (index != ListBox::NoMatches)
- this->blacklist->Items->RemoveAt(index);
- this->whitelist->Items->Add(S);
- }
- myfile.close();
- }
- kill()
- {
- foreach in blacklist
- {
- kill process
- }
- }
- revive()
- {
- foreach in blacklist
- {
- rerun process() //in order?
- }
- }
- swap() actual code
- {
- int size = blacklist->Items->Count;
- int blacklistsize = blacklist->Items->Count;
- int whitelistsize = whitelist->Items->Count;
- for (int i = 0; i < blacklistsize; i++)
- {
- if (blacklist->GetItemChecked(i))
- {
- whitelist->Items->Add(blacklist->Items[i]);
- blacklist->Items->RemoveAt(i);
- blacklistsize--;
- whitelistsize++;
- i--;
- }
- }
- for (int i = 0; i < whitelistsize; i++)
- {
- if (whitelist->GetItemChecked(i))
- {
- blacklist->Items->Add(whitelist->Items[i]);
- whitelist->Items->RemoveAt(i);
- whitelistsize--;
- blacklistsize++;
- i--;
- }
- }
- }
- save()
- {
- String^ fileName = "textfile.txt";
- StreamWriter^ sw = gcnew StreamWriter(fileName); //will add warning and functionality to change name
- int count = whitelist->Items->Count;
- for (int i = 0; i < count; i++)
- {
- sw->WriteLine(whitelist->Items[i]);
- }
- sw->Close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement