in reply to How do i color font in a listbox? (Solved!!!)
So in the end, it was TextCtrl that worked for what i needed. this will get md5 of each file in a directory, compare it against known md5s in a file (@md5s) if it matches text will be green, else it will be red. I really hope this helps someone in the future.my ($red, $green) = ( Wx::Colour->newRGB(235, 0, 0), Wx::Colour->newRGB(0, 110, 63) ); @md5s = ""; $md5s = ""; $filesize = ''; @md5s = read_file("md5"); $md5s = join( '', @md5s ); my $dirname1 = "some/path/to/files/with/known/md5s"; foreach my $file (<'$dirname1'/*>) { next if -d $file; open( my $FILE, $file ); binmode($FILE); $filesize = -s $file; $file =~ s{.*/}{}; $md5 = Digest::MD5->new->addfile($FILE)->hexdigest; if ( $md5s =~ $md5 ) { my $style1 = Wx::TextAttr->new(); $style->Wx::TextAttr::SetTextColour($green); $lc->SetStyle(-1,-1,$style1); $lc->AppendText("$file | $filesize\n"); } else { my $style2 = Wx::TextAttr->new(); $style1->Wx::TextAttr::SetTextColour($red); $lc->SetStyle(-1,-1,$style2); $lc->AppendText("$file | $filesize\n"); open( my $temporary, '>>', "$dir/md5.txt" ); for ($md5s) { syswrite( $temporary, "$md5\n" ); } } }
|
|---|