czwartek, 30 stycznia 2020

Data from the file WindowsUpdate.log (Visual C++)


 System::Void read_Windows(String^ phrase)
{
System::Int64 i;
System::Int64 count_Line=0;
    System::String^ temp_Text;
String^ path="C:\\Users\\luk\\Documents\\C_plus\\Windows_U.txt.txt";
StreamReader^ my_File=gcnew StreamReader(path,System::Text::Encoding::Default);
 array<System::String^>^ buff=gcnew array<System::String^>(1024);
while(temp_Text=my_File->ReadLine())
{
 
 buff[count_Line]=temp_Text+System::Environment::NewLine;
 ++count_Line;
}
my_File->Close();
for(i=0;i<count_Line;i++)
  if(buff[i]->Contains(phrase))
  if(buff[i]->Contains("="))
  listBox1->Items->Add(buff[i]->Remove(buff[i]->IndexOf("="))+System::Environment::NewLine);
  else
  listBox1->Items->Add(buff[i]+System::Environment::NewLine);
 
 }
private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {

array<System::String^>^ windows_Update=gcnew array<System::String^>(8);
windows_Update[0]="Computer Brand";
windows_Update[1]="Computer Model";
windows_Update[2]="Bios Revision";
windows_Update[3]="Bios Name";
windows_Update[4]="OS Version";
windows_Update[5]="Process:";
windows_Update[6]="Module:";
windows_Update[7]="Base directory:";
for(System::Int64 i=0;i<8;i++)
read_Windows(windows_Update[i]);

 
}