![]() |
|
Playing a little bit with power shell - Printable Version +- Little Fighter Empire - Forums (https://lf-empire.de/forum) +-- Forum: General Zone (https://lf-empire.de/forum/forumdisplay.php?fid=23) +--- Forum: Programming (https://lf-empire.de/forum/forumdisplay.php?fid=50) +--- Thread: Playing a little bit with power shell (/showthread.php?tid=10129) |
Playing a little bit with power shell - Ariel - 11-21-2015 So im into power shell alot lately and i want to try and do something with lf2 through ps Can anyone tell me the idea of how to load a .dat file like all the dc editors? Main idea can be cool i want to try and write it by myself, but i dont have knowledge in anything else that connect to programing so i dont realy know what to try in order to read the files Anyway, idea on how to read the file would be great RE: Playing a little bit with power shell - A-Man - 11-21-2015 1-Open the file for reading and store what's inside into a variable (or stream it, whatever you prefer/have available). The content of the file is gibberish (because it's encrypted). 2-Skip over the first one hundred and twenty three characters and start going through all characters in the file. Since counting in computers starts from 0, this means you will start from the 124rd letter character (index 123). 3-For every character you go through, convert it to its ASCII code, subtract from it the ASCII code of the Nth character in the key "odBearBecauseHeIsVeryGoodSiuHungIsAGo" (yes, the letters are shifted because there is a caeser cipher step we can skip with using this shifted key). 4- N is an index in the key which keeps increasing for every character and restarts back to 0 when it reaches the end of the key. RE: Playing a little bit with power shell - Hate - 11-21-2015 the hell is power shell !! RE: Playing a little bit with power shell - Ariel - 11-21-2015 Code: $data = Get-Content E:\LittleFighter\data\template.dat -Encoding Bytestill gives me weird letters :\ RE: Playing a little bit with power shell - A-Man - 11-21-2015 You have a problem here: Code: if ($bc -eq 37)Edit: I missed up with something. You subtract the ASCII value you get from the key, not add. You add when you want to encrypt (reverse the process completely). RE: Playing a little bit with power shell - Ariel - 11-21-2015 thanks alot now its working! edit: btw any idea on how to get clear lines? now it gives me the output char by char like this: b d y : k i n d : 0 x : 2 7 RE: Playing a little bit with power shell - A-Man - 11-21-2015 Depends on how you output your data. If it's to a terminal, and you use something analogous to "echo", it will finish what it types with a newline character ('\n'). See if there is something like printf in power shell, and use it. Or anything which doesn't print a new line character after it. If you're stuck with echo, or if you want to output what you have into a text file or something, then just append/push_back your characters to a string/character-array and print it/save it as a whole once it's done. |