

direktor05
Members-
Content Count
21 -
Joined
-
Last visited
Community Reputation
2 NeutralRecent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
-
DAMN, I just discovered there is also TJsonTreeView component. Delphi 10.4. A nono, its a component I installed. Made by some Polish guy at Embarcadero.
-
No I want to make a tool to create HTML menus. So I want a treeview that will be just like a website menu then export to json and read with javascript. The menu must not only have name, but also link url, onclick event description and parent/child id, stored in tTreeview1.items.data pointer.
-
Or give me some code snippet to parse TTreeView, then will make json manually
-
Hello, Is there a TTreeview component that can export items to JSON? Probably not or is very simple, because I also need to export data associated with a node which is in Pointer to Json. Any suggestion welcome.
-
Hello, Is there a TTreeview component that can export items to JSON? Probably not or is very simple, because I also need to export data associated with a node which is in Pointer to Json. Any suggestion welcome.
-
Parse Json again, complicated
direktor05 replied to direktor05's topic in RTL and Delphi Object Pascal
Full Json: {"result": [{ "animals": [{ "id":1, "name":"pig", } ] } ] } -
Hello, How do I parse this Json: {"result": [{ "animals": [{ "id":1, "name": So.... I parse Json first: jsonobject := TJsonObject.ParseJSONValue(RestResponse.Content) as TJsonObject; Then I get to "animals":[{"id".... now here gets complicated. How do I parse further to get ID and name? Parse Json further or parse Json Array? Can someone help with some example code please?
-
Binary file encryption/decription problem?
direktor05 replied to direktor05's topic in Algorithms, Data Structures and Class Design
Ok Ladies and G... Ladies, here is the macho man solution for the brave. FileCrypt2.zip -
Binary file encryption/decription problem?
direktor05 replied to direktor05's topic in Algorithms, Data Structures and Class Design
Ok boss, got it. When I solve the problem of shooting myself Ill post it here. 🙂 -
Binary file encryption/decription problem?
direktor05 replied to direktor05's topic in Algorithms, Data Structures and Class Design
Ah you used LockBox component... what a shame! Real professionals don't use other people's components they make their own. But it's OK, it works. -
Binary file encryption/decription problem?
direktor05 replied to direktor05's topic in Algorithms, Data Structures and Class Design
Thanks teacher 🙂 -
Binary file encryption/decription problem?
direktor05 replied to direktor05's topic in Algorithms, Data Structures and Class Design
Should not use FileStream or MemoryStream, no stream at all, just readblock - encrypt block - write block -
Binary file encryption/decription problem?
direktor05 replied to direktor05's topic in Algorithms, Data Structures and Class Design
Ok thanks I think the problem with the above code is that it gives whole file buffer as input while only 16 B is acceptable. Thats why it takes first 16 B and the rest throws away. The right way should be ReadBlock 16 by 16 B until EOF and perform readblock 16B - encrypt 16B - write 16 B until EOF. -
Binary file encryption/decription problem?
direktor05 replied to direktor05's topic in Algorithms, Data Structures and Class Design
This doesnt work: var Source, Dest: TFileStream; SrcFile, DestFile: string; Start, Stop: cardinal; Size: integer; SourceKey,NewKey: AESBlock; Key: AES128Key; SrcBuf, DstBuf: array [0..16383] of byte; SrcSize, DstSize: integer; MyInBlock, MyOutBlock: AESBlock; begin Source := TFileStream.Create(txtFile.Text, fmOpenRead); DestFile := ExtractFilePath(Application.ExeName) + 'aestemp.enc'; Dest := TFileStream.Create(DestFile, fmCreate); try Size:=Source.Read(SourceKey,SizeOf(SourceKey)); if Size<>SizeOf(SourceKey) then raise Exception.Create('Unable to read SourceKey from file.'); FillChar( Key, SizeOf(Key), 0 ); Move( PAnsiChar(AnsiString(txtPassword.Text))^, Key, Min( SizeOf( Key ), Length( txtPassword.Text ) )); //FillChar( MyInBlock, SizeOf(MyInBlock), 0 ); //Move(Source.ReadBuffer(SrcBuf,Size), MyInBlock, Min( SizeOf( MyInBLock ), Size )); NewKey:=AES128Cipher(SourceKey,Key); Dest.WriteBuffer(NewKey,SizeOf(NewKey)); //AES128Cipher(Source,Key) //Dest.WriteBuffer(AES128Cipher(Source,Key),Size); finally Dest.Free; Source.Free; end; showmessage('Finished');