Перейти к содержанию
Fire Monkey от А до Я

gonzales

Пользователи
  • Постов

    334
  • Зарегистрирован

  • Посещение

  • Победитель дней

    27

gonzales стал победителем дня 10 марта 2022

gonzales имел наиболее популярный контент!

Посетители профиля

15 112 просмотра профиля
  1. Боюсь такую задачку тяжело решить без сторонних компонентов. Я бы подумал в сторону другого кодека - MJPEG, я в свое время разбирал поток MJPEG over RTP и вытаскивал из потока jpeg, то есть решал обратную задачу. Вроде там ничего особенного не было. Вот статейки на тему https://habr.com/ru/articles/115808/ https://habr.com/ru/articles/117735/
  2. На всякий случай оставлю здесь информацию по поводу линковки сторонних библиотек. Если мы генерируем приложение сразу под две архитектуры arm64-v8a и armeabi-v7a, то есть ставим галку на опции Generate Android 32-bit and 64-bit binaries, то необходимо в секции deployment для 64-битной архитектуры добавить все библиотеки и для 32-битной версии.
  3. а TKeyboardState разве не только для VLC? Забыл написать, что это все удовольствие конечно для FMX
  4. Доброго все дня! Подскажите, как реализовать следующее. Таскаю Trectangle из одного контейнера в другой. При нажатии Ctrl создается копия TRectangle в контейнере, куда его дропнул. Если ничего не нажато, то простое перетаскивание. Все работает за одним нюансом, Ctrl нужно нажимать ДО начала перетаскивания, потому как в событии MouseMove я разрешаю перетаскивание и событие MouseMove больше не вызывается, пока объект не будет дропнут. События DragOver контейнера не содержат информацию, нажат ли Ctrl, или я не умею ее доставать. Подскажите, возможно ли такое сделать.
  5. Вот команда собрать из aab файла универсальный apks файл. java.exe -jar "C:\Program Files (x86)\Embarcadero\Studio\22.0\bin\Android\bundletool-all-1.2.0.jar" build-apks --mode=universal --bundle="D:\485\Application_v4.5(11)\Android64\Release\Cluster25\bin\Cluster25.aab" --output="D:\485\Application_v4.5(11)\Android64\Release\Cluster25\bin\Cluster25.apks" --ks="D:\485\Application_v2 (10.1 Berlin)\GooglePlay\Keys\keys.keystore" --ks-pass=pass:<пароль keystore> --ks-key-alias=<alias keystore> --key-pass=pass:<пароль keystore> заменить пути до своего aab файла, до желаемого apks файла, до keystore файла. А также вписать alias и пароль из keystore. По сути apks файл - это архив, внутри лежит файл universal.apk, можно просто разархивировать, вынуть universal.apk и установить на телефон. Или воспользоваться командой java.exe -jar "C:\Program Files (x86)\Embarcadero\Studio\22.0\bin\Android\bundletool-all-1.2.0.jar" install-apks --apks="D:\485\Application_v4.5(11)\Android64\Release\Cluster25\bin\Cluster25.apks" --adb="C:\Users\Public\Documents\Embarcadero\Studio\22.0\PlatformSDKs\android-sdk-windows\platform-tools\adb.exe" PS. Но я нашел один косяк, при использовании aab файла у меня проблема с линковкой сторонних библиотек (программа их не находит, не смотря на то, что они есть в deployment, а при создании универсального apk, все работает правильно. Я это к тому, что такой способ проверки не всегда дает 100% результат
  6. Нет, не удалось одолеть самостоятельно, прикупили компонент из поста выше)))
  7. Может это поможет function CalcTextSize(text: string; Font: TFont; Size: single = 0): TSizeF; var TextLayout: TTextLayout; begin TextLayout := TTextLayoutManager.DefaultTextLayout.Create; try TextLayout.BeginUpdate; try TextLayout.text := text; TextLayout.MaxSize := TPointF.Create(9999, 9999); TextLayout.Font.Assign(Font); if not SameValue(0, Size) then begin TextLayout.Font.Size := Size; end; TextLayout.WordWrap := False; TextLayout.Trimming := TTextTrimming.None; TextLayout.HorizontalAlign := TTextAlign.Leading; TextLayout.VerticalAlign := TTextAlign.Leading; finally TextLayout.EndUpdate; end; Result.Width := TextLayout.Width; Result.Height := TextLayout.Height; finally TextLayout.DisposeOf; TextLayout := nil; end; end;
  8. Тоже столкнулся с подобной проблемой. Есть диалоговое окно, которое вызывалось методом ShowModal. На 12 и 13 iPhone перестал отображаться. Решения так и нет?
  9. Часто помогают методы beginupdate endupdate
  10. Привет. Давно было, уже не помню, но судя по тому, что я написал проблема в файле проекта. Открой dproj файл, посмотрю, что там внутри
  11. ааа, вообще все свое))) текст в том числе))) я понял, спасибо! так радикально я не додумался поступить
  12. я так пробовал сделать, но почему-то чекбокс вставленный в итем с выравниванием по левому краю перекрывает текст итема, я так и не разобрался, почему это происходит, но нашел процедуру у родного итема - ChangeCheck. Корявенько конечно получилось с точки зрения логики, часть функционала в компоненте, а часть нет, но пока забил
  13. Доброго времени суток. Собственно вопрос в теме поста. Пишу наследника от TListBoxItem, хочу выполнить процедуру при нажатии на чекбокс, но подходящих событий не наблюдаю. OnClick не приводит к нужному результату. Есть еще StylesData['check'], который вроде как должен быть TCheckBox, но я не пойму как с ним работать.
  14. Оставлю тут инфу, чтобы не забыть. Понадобилось тоже шифровать текст, сделал себе простенький юнит на основе https://github.com/MHumm/DelphiEncryptionCompendium unit Encrypt_unit; interface uses DECCipherBase, DECFormatBase, DECCipherModes, System.SysUtils, System.TypInfo, Generics.Collections, DECBaseClass, DECFormat, DECCipherFormats, DECCiphers, DECUtil, DECCipherInterface, FMX.Dialogs; const FILLER_TEXT = '01'; INIT_VECTOR_TEXT = '127E22'; KEY_TEXT = '123456ADE'; CIPHER_FUNCTION = 'TCipher_1DES'; CIPHER_MODE = 'cmCTSx'; AuthenticationBitLength = 128; EditAuthenticatedData = ''; EditExpectedAuthenthicationResult = ''; EditCalculatedAuthenticationValue = ''; FORMAT_TEXT = 'TFormat_Copy'; var EditFiller: string; EditInitVector: string; EditKey: string; function EncryptText(EditPlainText: string): string; function DecryptText(EditCipherText: string): string; implementation function GetSelectedCipherMode: TCipherMode; var ModeStr: string; begin ModeStr := CIPHER_MODE; if ModeStr.Contains('(') then ModeStr := ModeStr.Remove(ModeStr.IndexOf('(') - 1); result := TCipherMode(System.TypInfo.GetEnumValue(TypeInfo(TCipherMode), ModeStr)); end; function GetCipherInstance: TDECCipherModes; begin result := TDECCipher.ClassByName(CIPHER_FUNCTION).Create as TDECCipherModes; result.Mode := GetSelectedCipherMode; end; {function IsAuthenticatedCipher: Boolean; var Cipher: TDECCipherModes; begin Cipher := GetCipherInstance; try result := Cipher.IsAuthenticated; finally Cipher.Free; end; end; procedure UpdateAuthenticationStatus; begin IsAuthenticatedCipher; end; procedure InitCipherAlgorithm; var Context: TCipherContext; begin Context := TDECCipher.ClassByName(CIPHER_FUNCTION).Context; UpdateAuthenticationStatus; end;} function GetInitializedCipherInstance: TDECCipherModes; var FillerByte: UInt8; begin EditFiller := FILLER_TEXT; EditInitVector := INIT_VECTOR_TEXT; EditKey := KEY_TEXT; if not EditFiller.IsEmpty then begin while length(EditFiller) < 2 do EditFiller := '0' + EditFiller; FillerByte := StrToInt('0x' + EditFiller) end else FillerByte := 0; if TFormat_HEXL.IsValid(RawByteString(EditInitVector.ToLower)) and TFormat_HEXL.IsValid(RawByteString(EditKey.ToLower)) then begin result := GetCipherInstance; result.Init(BytesOf(TFormat_HEXL.Decode(RawByteString(EditKey.ToLower))), BytesOf(TFormat_HEXL.Decode(RawByteString(EditInitVector.ToLower))), FillerByte); end else raise Exception.Create('No valid encryption key or init vector given!'); end; procedure SetAuthenticationParams(Cipher: TDECCipherModes); begin Assert(Assigned(Cipher)); if Cipher.IsAuthenticated then begin Cipher.AuthenticationResultBitLength := AuthenticationBitLength; Cipher.DataToAuthenticate := TFormat_HEXL.Decode(BytesOf(RawByteString(EditAuthenticatedData))); Cipher.ExpectedAuthenticationResult := TFormat_HEXL.Decode(BytesOf(RawByteString(EditExpectedAuthenthicationResult))); end; end; function GetFormatSettings(var PlainTextFormatting, CipherTextFormatting: TDECFormatClass): Boolean; begin PlainTextFormatting := TDECFormat.ClassByName(FORMAT_TEXT); CipherTextFormatting := TDECFormat.ClassByName(FORMAT_TEXT); result := true; end; function EncryptText(EditPlainText: string): string; var Cipher: TDECCipherModes; InputFormatting: TDECFormatClass; OutputFormatting: TDECFormatClass; InputBuffer: TBytes; OutputBuffer: TBytes; begin result := ''; if not GetFormatSettings(InputFormatting, OutputFormatting) then exit; try Cipher := GetInitializedCipherInstance; try InputBuffer := System.SysUtils.BytesOf(EditPlainText); if InputFormatting.IsValid(InputBuffer) then begin // Set all authentication related properties SetAuthenticationParams(Cipher); try OutputBuffer := (Cipher as TDECFormattedCipher).EncodeBytes(InputFormatting.Decode(InputBuffer)); (Cipher as TDECFormattedCipher).Done; except On e: Exception do ShowMessage('Encryption failure:' + sLineBreak + e.Message); end; result := string(DECUtil.BytesToRawString(OutputFormatting.Encode(OutputBuffer))); end else ShowMessage('Input has wrong format'); finally Cipher.Free; end; except On e: Exception do ShowMessage('Encryption init failure: ' + e.Message); end; end; function DecryptText(EditCipherText: string): string; var Cipher: TDECCipherModes; CipherTextFormatting: TDECFormatClass; PlainTextFormatting: TDECFormatClass; CipherTextBuffer: TBytes; PlainTextBuffer: TBytes; AuthenticationOK: Boolean; begin result := ''; if not GetFormatSettings(PlainTextFormatting, CipherTextFormatting) then exit; try Cipher := GetInitializedCipherInstance; try CipherTextBuffer := System.SysUtils.BytesOf(EditCipherText); if CipherTextFormatting.IsValid(CipherTextBuffer) then begin // Set all authentication related properties SetAuthenticationParams(Cipher); AuthenticationOK := false; try PlainTextBuffer := (Cipher as TDECFormattedCipher).DecodeBytes(CipherTextFormatting.Decode(CipherTextBuffer)); // in case of an authenticated cipher mode like cmGCM the Done method // will raise an exceptino when the calculated authentication value does // not match the given expected one (Cipher as TDECFormattedCipher).Done; // If we managed to get to here, the calculated authentication value is // ok if we're in an authenticated mode and have entered an expected value. if (length(EditExpectedAuthenthicationResult) > 0) and (length(EditExpectedAuthenthicationResult) = length(EditCalculatedAuthenticationValue)) then AuthenticationOK := true; except On e: Exception do ShowMessage('Decryption failure:' + sLineBreak + e.Message); end; result := string(DECUtil.BytesToRawString(PlainTextFormatting.Encode(PlainTextBuffer))); end else ShowMessage('Input has wrong format'); finally Cipher.Free; end; except On e: Exception do ShowMessage('Decryption init failure: ' + e.Message); end; end; end.
×
×
  • Создать...