├── .gitignore ├── C4DVersion.dpk ├── C4DVersion.dproj ├── C4DVersion.res ├── C4DVersionGroup.groupproj ├── Img └── Readme │ ├── Dados-da-versao-no-Hint-do-executavel.png │ ├── Propriedades-do-executavel.png │ ├── Tela-Demo.png │ └── Tela-Version-Info-Delphi.png ├── README.en.md ├── README.md ├── Samples └── Demo01 │ ├── C4DVersionDemo01.dpr │ ├── C4DVersionDemo01.dproj │ ├── C4DVersionDemo01.res │ └── Src │ ├── Utils │ └── Utils.pas │ └── View │ ├── C4D.VersionDemo01.View.Main.dfm │ └── C4D.VersionDemo01.View.Main.pas ├── Src ├── C4D.Version.Consts.pas ├── C4D.Version.Info.pas ├── C4D.Version.Interfaces.pas ├── C4D.Version.SemanticVersion.pas ├── C4D.Version.Types.pas ├── C4D.Version.Utils.pas └── C4D.Version.pas ├── boss-lock.json └── boss.json /.gitignore: -------------------------------------------------------------------------------- 1 | # Uncomment these types if you want even more clean repository. But be careful. 2 | # It can make harm to an existing project source. Read explanations below. 3 | # 4 | # Resource files are binaries containing manifest, project icon and version info. 5 | # They can not be viewed as text or compared by diff-tools. Consider replacing them with .rc files. 6 | #*.res 7 | # 8 | # Type library file (binary). In old Delphi versions it should be stored. 9 | # Since Delphi 2009 it is produced from .ridl file and can safely be ignored. 10 | #*.tlb 11 | # 12 | # Diagram Portfolio file. Used by the diagram editor up to Delphi 7. 13 | # Uncomment this if you are not using diagrams or use newer Delphi version. 14 | #*.ddp 15 | # 16 | # Visual LiveBindings file. Added in Delphi XE2. 17 | # Uncomment this if you are not using LiveBindings Designer. 18 | #*.vlb 19 | # 20 | # Deployment Manager configuration file for your project. Added in Delphi XE2. 21 | # Uncomment this if it is not mobile development and you do not use remote debug feature. 22 | #*.deployproj 23 | # 24 | # C++ object files produced when C/C++ Output file generation is configured. 25 | # Uncomment this if you are not using external objects (zlib library for example). 26 | #*.obj 27 | # 28 | 29 | # Delphi compiler-generated binaries (safe to delete) 30 | *.exe 31 | *.dll 32 | *.bpl 33 | *.bpi 34 | *.dcp 35 | *.so 36 | *.apk 37 | *.drc 38 | *.map 39 | *.dres 40 | *.rsm 41 | *.tds 42 | *.dcu 43 | *.lib 44 | *.a 45 | *.o 46 | *.ocx 47 | 48 | # Delphi autogenerated files (duplicated info) 49 | *.cfg 50 | *.hpp 51 | *Resource.rc 52 | 53 | # Delphi local files (user-specific info) 54 | *.local 55 | *.identcache 56 | *.projdata 57 | *.tvsconfig 58 | *.dsk 59 | 60 | # Delphi history and backups 61 | __history/ 62 | __recovery/ 63 | *.~* 64 | 65 | # Castalia statistics file (since XE7 Castalia is distributed with Delphi) 66 | *.stat 67 | 68 | # Boss dependency manager vendor folder https://github.com/HashLoad/boss 69 | modules/ 70 | -------------------------------------------------------------------------------- /C4DVersion.dpk: -------------------------------------------------------------------------------- 1 | package C4DVersion; 2 | 3 | {$R *.res} 4 | {$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} 5 | {$ALIGN 8} 6 | {$ASSERTIONS ON} 7 | {$BOOLEVAL OFF} 8 | {$DEBUGINFO OFF} 9 | {$EXTENDEDSYNTAX ON} 10 | {$IMPORTEDDATA ON} 11 | {$IOCHECKS ON} 12 | {$LOCALSYMBOLS ON} 13 | {$LONGSTRINGS ON} 14 | {$OPENSTRINGS ON} 15 | {$OPTIMIZATION OFF} 16 | {$OVERFLOWCHECKS OFF} 17 | {$RANGECHECKS OFF} 18 | {$REFERENCEINFO ON} 19 | {$SAFEDIVIDE OFF} 20 | {$STACKFRAMES ON} 21 | {$TYPEDADDRESS OFF} 22 | {$VARSTRINGCHECKS ON} 23 | {$WRITEABLECONST OFF} 24 | {$MINENUMSIZE 1} 25 | {$IMAGEBASE $400000} 26 | {$DEFINE DEBUG} 27 | {$ENDIF IMPLICITBUILDING} 28 | {$RUNONLY} 29 | {$IMPLICITBUILD ON} 30 | 31 | requires 32 | rtl; 33 | 34 | contains 35 | C4D.Version.Info in 'Src\C4D.Version.Info.pas', 36 | C4D.Version.Utils in 'Src\C4D.Version.Utils.pas', 37 | C4D.Version.Types in 'Src\C4D.Version.Types.pas', 38 | C4D.Version.Consts in 'Src\C4D.Version.Consts.pas', 39 | C4D.Version.Interfaces in 'Src\C4D.Version.Interfaces.pas', 40 | C4D.Version in 'Src\C4D.Version.pas', 41 | C4D.Version.SemanticVersion in 'Src\C4D.Version.SemanticVersion.pas'; 42 | 43 | end. 44 | -------------------------------------------------------------------------------- /C4DVersion.dproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | {4B1C61DF-9505-4718-9A86-64ED7BA98E58} 4 | C4DVersion.dpk 5 | 18.8 6 | None 7 | True 8 | Debug 9 | Win32 10 | 1 11 | Package 12 | 13 | 14 | true 15 | 16 | 17 | true 18 | Base 19 | true 20 | 21 | 22 | true 23 | Base 24 | true 25 | 26 | 27 | true 28 | Base 29 | true 30 | 31 | 32 | true 33 | Base 34 | true 35 | 36 | 37 | true 38 | Cfg_1 39 | true 40 | true 41 | 42 | 43 | true 44 | Base 45 | true 46 | 47 | 48 | .\$(Platform)\$(Config) 49 | .\$(Platform)\$(Config) 50 | false 51 | false 52 | false 53 | false 54 | false 55 | true 56 | true 57 | System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace) 58 | All 59 | C4DVersion 60 | true 61 | 62 | 63 | None 64 | android-support-v4.dex.jar;cloud-messaging.dex.jar;com-google-android-gms.play-services-ads-base.17.2.0.dex.jar;com-google-android-gms.play-services-ads-identifier.16.0.0.dex.jar;com-google-android-gms.play-services-ads-lite.17.2.0.dex.jar;com-google-android-gms.play-services-ads.17.2.0.dex.jar;com-google-android-gms.play-services-analytics-impl.16.0.8.dex.jar;com-google-android-gms.play-services-analytics.16.0.8.dex.jar;com-google-android-gms.play-services-base.16.0.1.dex.jar;com-google-android-gms.play-services-basement.16.2.0.dex.jar;com-google-android-gms.play-services-gass.17.2.0.dex.jar;com-google-android-gms.play-services-identity.16.0.0.dex.jar;com-google-android-gms.play-services-maps.16.1.0.dex.jar;com-google-android-gms.play-services-measurement-base.16.4.0.dex.jar;com-google-android-gms.play-services-measurement-sdk-api.16.4.0.dex.jar;com-google-android-gms.play-services-stats.16.0.1.dex.jar;com-google-android-gms.play-services-tagmanager-v4-impl.16.0.8.dex.jar;com-google-android-gms.play-services-tasks.16.0.1.dex.jar;com-google-android-gms.play-services-wallet.16.0.1.dex.jar;com-google-firebase.firebase-analytics.16.4.0.dex.jar;com-google-firebase.firebase-common.16.1.0.dex.jar;com-google-firebase.firebase-iid-interop.16.0.1.dex.jar;com-google-firebase.firebase-iid.17.1.1.dex.jar;com-google-firebase.firebase-measurement-connector.17.0.1.dex.jar;com-google-firebase.firebase-messaging.17.5.0.dex.jar;fmx.dex.jar;google-play-billing.dex.jar;google-play-licensing.dex.jar 65 | 66 | 67 | None 68 | android-support-v4.dex.jar;cloud-messaging.dex.jar;com-google-android-gms.play-services-ads-base.17.2.0.dex.jar;com-google-android-gms.play-services-ads-identifier.16.0.0.dex.jar;com-google-android-gms.play-services-ads-lite.17.2.0.dex.jar;com-google-android-gms.play-services-ads.17.2.0.dex.jar;com-google-android-gms.play-services-analytics-impl.16.0.8.dex.jar;com-google-android-gms.play-services-analytics.16.0.8.dex.jar;com-google-android-gms.play-services-base.16.0.1.dex.jar;com-google-android-gms.play-services-basement.16.2.0.dex.jar;com-google-android-gms.play-services-gass.17.2.0.dex.jar;com-google-android-gms.play-services-identity.16.0.0.dex.jar;com-google-android-gms.play-services-maps.16.1.0.dex.jar;com-google-android-gms.play-services-measurement-base.16.4.0.dex.jar;com-google-android-gms.play-services-measurement-sdk-api.16.4.0.dex.jar;com-google-android-gms.play-services-stats.16.0.1.dex.jar;com-google-android-gms.play-services-tagmanager-v4-impl.16.0.8.dex.jar;com-google-android-gms.play-services-tasks.16.0.1.dex.jar;com-google-android-gms.play-services-wallet.16.0.1.dex.jar;com-google-firebase.firebase-analytics.16.4.0.dex.jar;com-google-firebase.firebase-common.16.1.0.dex.jar;com-google-firebase.firebase-iid-interop.16.0.1.dex.jar;com-google-firebase.firebase-iid.17.1.1.dex.jar;com-google-firebase.firebase-measurement-connector.17.0.1.dex.jar;com-google-firebase.firebase-messaging.17.5.0.dex.jar;fmx.dex.jar;google-play-billing.dex.jar;google-play-licensing.dex.jar 69 | 70 | 71 | Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) 72 | Debug 73 | true 74 | CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= 75 | 1033 76 | 77 | 78 | DEBUG;$(DCC_Define) 79 | true 80 | false 81 | true 82 | true 83 | true 84 | 85 | 86 | false 87 | true 88 | 1033 89 | 90 | 91 | false 92 | RELEASE;$(DCC_Define) 93 | 0 94 | 0 95 | 96 | 97 | 98 | MainSource 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | Cfg_2 110 | Base 111 | 112 | 113 | Base 114 | 115 | 116 | Cfg_1 117 | Base 118 | 119 | 120 | 121 | Delphi.Personality.12 122 | Package 123 | 124 | 125 | 126 | C4DVersion.dpk 127 | 128 | 129 | Microsoft Office 2000 Sample Automation Server Wrapper Components 130 | Microsoft Office XP Sample Automation Server Wrapper Components 131 | 132 | 133 | 134 | 135 | 136 | true 137 | 138 | 139 | 140 | 141 | true 142 | 143 | 144 | 145 | 146 | true 147 | 148 | 149 | 150 | 151 | C4DVersion.bpl 152 | true 153 | 154 | 155 | 156 | 157 | 1 158 | 159 | 160 | 0 161 | 162 | 163 | 164 | 165 | classes 166 | 1 167 | 168 | 169 | classes 170 | 1 171 | 172 | 173 | 174 | 175 | res\xml 176 | 1 177 | 178 | 179 | res\xml 180 | 1 181 | 182 | 183 | 184 | 185 | library\lib\armeabi-v7a 186 | 1 187 | 188 | 189 | 190 | 191 | library\lib\armeabi 192 | 1 193 | 194 | 195 | library\lib\armeabi 196 | 1 197 | 198 | 199 | 200 | 201 | library\lib\armeabi-v7a 202 | 1 203 | 204 | 205 | 206 | 207 | library\lib\mips 208 | 1 209 | 210 | 211 | library\lib\mips 212 | 1 213 | 214 | 215 | 216 | 217 | library\lib\armeabi-v7a 218 | 1 219 | 220 | 221 | library\lib\arm64-v8a 222 | 1 223 | 224 | 225 | 226 | 227 | library\lib\armeabi-v7a 228 | 1 229 | 230 | 231 | 232 | 233 | res\drawable 234 | 1 235 | 236 | 237 | res\drawable 238 | 1 239 | 240 | 241 | 242 | 243 | res\values 244 | 1 245 | 246 | 247 | res\values 248 | 1 249 | 250 | 251 | 252 | 253 | res\values-v21 254 | 1 255 | 256 | 257 | res\values-v21 258 | 1 259 | 260 | 261 | 262 | 263 | res\values 264 | 1 265 | 266 | 267 | res\values 268 | 1 269 | 270 | 271 | 272 | 273 | res\drawable 274 | 1 275 | 276 | 277 | res\drawable 278 | 1 279 | 280 | 281 | 282 | 283 | res\drawable-xxhdpi 284 | 1 285 | 286 | 287 | res\drawable-xxhdpi 288 | 1 289 | 290 | 291 | 292 | 293 | res\drawable-ldpi 294 | 1 295 | 296 | 297 | res\drawable-ldpi 298 | 1 299 | 300 | 301 | 302 | 303 | res\drawable-mdpi 304 | 1 305 | 306 | 307 | res\drawable-mdpi 308 | 1 309 | 310 | 311 | 312 | 313 | res\drawable-hdpi 314 | 1 315 | 316 | 317 | res\drawable-hdpi 318 | 1 319 | 320 | 321 | 322 | 323 | res\drawable-xhdpi 324 | 1 325 | 326 | 327 | res\drawable-xhdpi 328 | 1 329 | 330 | 331 | 332 | 333 | res\drawable-mdpi 334 | 1 335 | 336 | 337 | res\drawable-mdpi 338 | 1 339 | 340 | 341 | 342 | 343 | res\drawable-hdpi 344 | 1 345 | 346 | 347 | res\drawable-hdpi 348 | 1 349 | 350 | 351 | 352 | 353 | res\drawable-xhdpi 354 | 1 355 | 356 | 357 | res\drawable-xhdpi 358 | 1 359 | 360 | 361 | 362 | 363 | res\drawable-xxhdpi 364 | 1 365 | 366 | 367 | res\drawable-xxhdpi 368 | 1 369 | 370 | 371 | 372 | 373 | res\drawable-xxxhdpi 374 | 1 375 | 376 | 377 | res\drawable-xxxhdpi 378 | 1 379 | 380 | 381 | 382 | 383 | res\drawable-small 384 | 1 385 | 386 | 387 | res\drawable-small 388 | 1 389 | 390 | 391 | 392 | 393 | res\drawable-normal 394 | 1 395 | 396 | 397 | res\drawable-normal 398 | 1 399 | 400 | 401 | 402 | 403 | res\drawable-large 404 | 1 405 | 406 | 407 | res\drawable-large 408 | 1 409 | 410 | 411 | 412 | 413 | res\drawable-xlarge 414 | 1 415 | 416 | 417 | res\drawable-xlarge 418 | 1 419 | 420 | 421 | 422 | 423 | res\values 424 | 1 425 | 426 | 427 | res\values 428 | 1 429 | 430 | 431 | 432 | 433 | 1 434 | 435 | 436 | 1 437 | 438 | 439 | 0 440 | 441 | 442 | 443 | 444 | 1 445 | .framework 446 | 447 | 448 | 1 449 | .framework 450 | 451 | 452 | 0 453 | 454 | 455 | 456 | 457 | 1 458 | .dylib 459 | 460 | 461 | 1 462 | .dylib 463 | 464 | 465 | 0 466 | .dll;.bpl 467 | 468 | 469 | 470 | 471 | 1 472 | .dylib 473 | 474 | 475 | 1 476 | .dylib 477 | 478 | 479 | 1 480 | .dylib 481 | 482 | 483 | 1 484 | .dylib 485 | 486 | 487 | 1 488 | .dylib 489 | 490 | 491 | 0 492 | .bpl 493 | 494 | 495 | 496 | 497 | 0 498 | 499 | 500 | 0 501 | 502 | 503 | 0 504 | 505 | 506 | 0 507 | 508 | 509 | 0 510 | 511 | 512 | 0 513 | 514 | 515 | 0 516 | 517 | 518 | 0 519 | 520 | 521 | 522 | 523 | 1 524 | 525 | 526 | 1 527 | 528 | 529 | 1 530 | 531 | 532 | 533 | 534 | 1 535 | 536 | 537 | 1 538 | 539 | 540 | 1 541 | 542 | 543 | 544 | 545 | 1 546 | 547 | 548 | 1 549 | 550 | 551 | 1 552 | 553 | 554 | 555 | 556 | 1 557 | 558 | 559 | 1 560 | 561 | 562 | 1 563 | 564 | 565 | 566 | 567 | 1 568 | 569 | 570 | 1 571 | 572 | 573 | 1 574 | 575 | 576 | 577 | 578 | 1 579 | 580 | 581 | 1 582 | 583 | 584 | 1 585 | 586 | 587 | 588 | 589 | 1 590 | 591 | 592 | 1 593 | 594 | 595 | 1 596 | 597 | 598 | 599 | 600 | 1 601 | 602 | 603 | 1 604 | 605 | 606 | 1 607 | 608 | 609 | 610 | 611 | 1 612 | 613 | 614 | 1 615 | 616 | 617 | 1 618 | 619 | 620 | 621 | 622 | 1 623 | 624 | 625 | 1 626 | 627 | 628 | 1 629 | 630 | 631 | 632 | 633 | 1 634 | 635 | 636 | 1 637 | 638 | 639 | 1 640 | 641 | 642 | 643 | 644 | 1 645 | 646 | 647 | 1 648 | 649 | 650 | 1 651 | 652 | 653 | 654 | 655 | 1 656 | 657 | 658 | 1 659 | 660 | 661 | 1 662 | 663 | 664 | 665 | 666 | 1 667 | 668 | 669 | 1 670 | 671 | 672 | 1 673 | 674 | 675 | 676 | 677 | 1 678 | 679 | 680 | 1 681 | 682 | 683 | 1 684 | 685 | 686 | 687 | 688 | 1 689 | 690 | 691 | 1 692 | 693 | 694 | 1 695 | 696 | 697 | 698 | 699 | 1 700 | 701 | 702 | 1 703 | 704 | 705 | 1 706 | 707 | 708 | 709 | 710 | 1 711 | 712 | 713 | 1 714 | 715 | 716 | 1 717 | 718 | 719 | 720 | 721 | 1 722 | 723 | 724 | 1 725 | 726 | 727 | 1 728 | 729 | 730 | 731 | 732 | 1 733 | 734 | 735 | 1 736 | 737 | 738 | 1 739 | 740 | 741 | 742 | 743 | 1 744 | 745 | 746 | 1 747 | 748 | 749 | 1 750 | 751 | 752 | 753 | 754 | 1 755 | 756 | 757 | 1 758 | 759 | 760 | 1 761 | 762 | 763 | 764 | 765 | 1 766 | 767 | 768 | 1 769 | 770 | 771 | 1 772 | 773 | 774 | 775 | 776 | 1 777 | 778 | 779 | 1 780 | 781 | 782 | 1 783 | 784 | 785 | 786 | 787 | 1 788 | 789 | 790 | 1 791 | 792 | 793 | 794 | 795 | ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF 796 | 1 797 | 798 | 799 | ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF 800 | 1 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 1 809 | 810 | 811 | 1 812 | 813 | 814 | 1 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | Contents\Resources 823 | 1 824 | 825 | 826 | Contents\Resources 827 | 1 828 | 829 | 830 | 831 | 832 | library\lib\armeabi-v7a 833 | 1 834 | 835 | 836 | library\lib\arm64-v8a 837 | 1 838 | 839 | 840 | 1 841 | 842 | 843 | 1 844 | 845 | 846 | 1 847 | 848 | 849 | 1 850 | 851 | 852 | 1 853 | 854 | 855 | 1 856 | 857 | 858 | 0 859 | 860 | 861 | 862 | 863 | library\lib\armeabi-v7a 864 | 1 865 | 866 | 867 | 868 | 869 | 1 870 | 871 | 872 | 1 873 | 874 | 875 | 876 | 877 | Assets 878 | 1 879 | 880 | 881 | Assets 882 | 1 883 | 884 | 885 | 886 | 887 | Assets 888 | 1 889 | 890 | 891 | Assets 892 | 1 893 | 894 | 895 | 896 | 897 | 898 | 899 | 900 | 901 | 902 | 903 | 904 | 905 | 906 | 907 | False 908 | False 909 | False 910 | True 911 | False 912 | 913 | 914 | 12 915 | 916 | 917 | 918 | 919 | 920 | -------------------------------------------------------------------------------- /C4DVersion.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code4Delphi/C4D-Version/91f443782696c4586a0f1dfff2822d6e1200d321/C4DVersion.res -------------------------------------------------------------------------------- /C4DVersionGroup.groupproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | {CAC74181-52E3-4A52-97DE-975C8C339B3C} 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | Default.Personality.12 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /Img/Readme/Dados-da-versao-no-Hint-do-executavel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code4Delphi/C4D-Version/91f443782696c4586a0f1dfff2822d6e1200d321/Img/Readme/Dados-da-versao-no-Hint-do-executavel.png -------------------------------------------------------------------------------- /Img/Readme/Propriedades-do-executavel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code4Delphi/C4D-Version/91f443782696c4586a0f1dfff2822d6e1200d321/Img/Readme/Propriedades-do-executavel.png -------------------------------------------------------------------------------- /Img/Readme/Tela-Demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code4Delphi/C4D-Version/91f443782696c4586a0f1dfff2822d6e1200d321/Img/Readme/Tela-Demo.png -------------------------------------------------------------------------------- /Img/Readme/Tela-Version-Info-Delphi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code4Delphi/C4D-Version/91f443782696c4586a0f1dfff2822d6e1200d321/Img/Readme/Tela-Version-Info-Delphi.png -------------------------------------------------------------------------------- /README.en.md: -------------------------------------------------------------------------------- 1 | ### Change the language 2 | [![Static Badge](https://img.shields.io/badge/Portugu%C3%AAs-(ptBR)-green)](https://github.com/Code4Delphi/C4D-Version) 3 | [![Static Badge](https://img.shields.io/badge/English-(en)-red)](https://github.com/Code4Delphi/C4D-Version/blob/master/README.en.md) 4 | 5 | 6 | # C4D-Version - Control the versions of your applications 7 | 12 | 13 | With C4D-Version, we can control the versions of our applications, or any other application, in an easy and professional way, through the **Version Info** of the Delphi IDE itself. 14 | 15 | 16 | ## 📞 Contacts 17 | 18 |

19 | 20 | 21 | 22 |   23 | 24 | 25 | 26 |   27 | 28 | 29 | 30 |   31 | 32 | 33 | 34 |

35 | 36 |
37 | 38 | ## ▶️ Demo video 39 | * [Access demo video](https://www.youtube.com/watch?v=nl2cBL-9VSs&list=PLLHSz4dOnnN1Hx0KtSwqN1Ory9HP7IDJn&index=4) 40 | 41 |
42 | 43 | 44 | ## ⚙️ Installation 45 | 46 | * Installation using [**Boss**](https://github.com/HashLoad/boss): 47 | 48 | ``` 49 | boss install github.com/Code4Delphi/C4D-Version 50 | ``` 51 | 52 | * **Manual installation**: Open your Delphi and add the following folder to your project, in *Project > Options > Resource Compiler > Directories and Conditionals > Include file search path* 53 | 54 | ``` 55 | ..\C4D-Version\Src 56 | ``` 57 | 58 | 59 | 60 | ## 🚀 Quickstart 61 | * We can define and control the version data of our applications directly through Delphi. Just access the menu *Project > Options... (or Shift+Ctrl+F11) > Application > Version Info* 62 | 63 | ![Tela-Version-Info-Delphi.png](https://github.com/Code4Delphi/C4D-Version/blob/master/Img/Readme/Tela-Version-Info-Delphi.png) 64 | 65 | * Add uses to your system: 66 | ``` 67 | uses 68 | C4D.Version; 69 | ``` 70 | 71 | ## 📝 Complete version data 72 | * Adding data from the **current system version** in a TMemo: 73 | ``` 74 | var 75 | LVersao: IC4DVersionInfo; 76 | begin 77 | LVersao := TC4DVersion.Info; 78 | Memo1.Lines.Clear; 79 | Memo1.Lines.Add('GetFileName: ' + LVersao.GetFileName); 80 | Memo1.Lines.Add('FileDescription: ' + LVersao.FileDescription); 81 | Memo1.Lines.Add('VersionShort: ' + LVersao.VersionShort); 82 | Memo1.Lines.Add('VersionLong: ' + LVersao.VersionLong); 83 | Memo1.Lines.Add('VersionMajor: ' + LVersao.VersionMajor.ToString); 84 | Memo1.Lines.Add('VersionMinor: ' + LVersao.VersionMinor.ToString); 85 | Memo1.Lines.Add('VersionPatch: ' + LVersao.VersionPatch.ToString); 86 | Memo1.Lines.Add('PreRelease: ' + BoolToStr(LVersao.PreRelease, True)); 87 | Memo1.Lines.Add('VersionPreRelease: ' + LVersao.VersionPreRelease); 88 | Memo1.Lines.Add('VersionNum: ' + LVersao.VersionNum.ToString); 89 | Memo1.Lines.Add('ProductName: ' + LVersao.ProductName); 90 | Memo1.Lines.Add('VersionProductShort: ' + LVersao.VersionProductShort); 91 | Memo1.Lines.Add('VersionProductLong: ' + LVersao.VersionProductLong); 92 | Memo1.Lines.Add('Comments: ' + LVersao.Comments); 93 | Memo1.Lines.Add('CompanyName: ' + LVersao.CompanyName); 94 | Memo1.Lines.Add('InternalName: ' + LVersao.InternalName); 95 | Memo1.Lines.Add('LegalCopyright: ' + LVersao.LegalCopyright); 96 | Memo1.Lines.Add('LegalTrademarks: ' + LVersao.LegalTrademarks); 97 | Memo1.Lines.Add('OriginalFilename: ' + LVersao.OriginalFilename); 98 | Memo1.Lines.Add('TranslationString: ' + LVersao.TranslationString); 99 | Memo1.Lines.Add('VerFileDate: ' + DateTimeToStr(LVersao.VerFileDate)); 100 | Memo1.Lines.Add('SpecialBuild: ' + LVersao.SpecialBuild); 101 | Memo1.Lines.Add('PrivateBuild: ' + LVersao.PrivateBuild); 102 | Memo1.Lines.Add('DebugBuild: ' + BoolToStr(LVersao.DebugBuild, True)); 103 | Memo1.Lines.Add('Patched: ' + BoolToStr(LVersao.Patched, True)); 104 | Memo1.Lines.Add('InfoInferred: ' + BoolToStr(LVersao.InfoInferred, True)); 105 | end; 106 | ``` 107 | * Here's what the return would look like: 108 | ``` 109 | GetFileName: C:\Componentes-Delphi\Code4D\C4D-Version\Samples\Demo01\Win32\Debug\C4DVersionDemo01.exe 110 | FileDescription: Code4Delphi Controle de Versão 111 | VersionShort: 1.0.0 112 | VersionLong: 1.0.0.0 113 | VersionMajor: 1 114 | VersionMinor: 0 115 | VersionPatch: 0 116 | PreRelease: False 117 | VersionPreRelease: 118 | VersionNum: 65536 119 | ProductName: Code4Delphi VersionInfo 120 | VersionProductShort: 1.0.0 121 | VersionProductLong: 1.0.0.0 122 | Comments: contato@code4delphi.com.br 123 | CompanyName: Code4Delphi - Cursos e conteúdos de Programação Delphi 124 | InternalName: Internal Name Code4Delphi 125 | LegalCopyright: Copyright Code4Delphi 126 | LegalTrademarks: https://github.com/Code4Delphi 127 | OriginalFilename: C4DVersionDemo01 128 | TranslationString: 041604E4 129 | VerFileDate: 11/05/2023 22:47:48 130 | SpecialBuild: 131 | PrivateBuild: 132 | DebugBuild: False 133 | Patched: False 134 | InfoInferred: False 135 | ``` 136 | 137 | 138 | ## 🆚 Semantic versioning 139 | * Adding only the system's **Semantic versioning** data to a TMemo: 140 | ``` 141 | begin 142 | Memo1.Lines.Clear; 143 | Memo1.Lines.Add('Major: ' + TC4DVersion.SemanticVersion.Major.ToString); 144 | Memo1.Lines.Add('Minor: ' + TC4DVersion.SemanticVersion.Minor.ToString); 145 | Memo1.Lines.Add('Patch: ' + TC4DVersion.SemanticVersion.Patch.ToString); 146 | Memo1.Lines.Add('PreRelease: ' + TC4DVersion.SemanticVersion.PreRelease); 147 | Memo1.Lines.Add('Semantic versioning complete: ' + TC4DVersion.SemanticVersion.GetString); 148 | end; 149 | ``` 150 | * Here's what the return would look like: 151 | ``` 152 | Major: 1 153 | Minor: 0 154 | Patch: 0 155 | PreRelease: 156 | SemanticVersion: 1.0.0 157 | ``` 158 | 159 | 160 | ## 🖥 Accessing data from other .exe 161 | * It is also possible to access data from other .exes, just pass the .exe path as a parameter when calling the method: TC4DVersion.Info(). Here's how we would recover data from the Windows calculator .exe: 162 | ``` 163 | var 164 | LVersao: IC4DVersionInfo; 165 | begin 166 | LVersao := TC4DVersion.Info('C:\Windows\System32\calc.exe'); 167 | ``` 168 | 169 | ## ⌨️ Demo 170 | * Next to the project sources, you will find a test project, in the folder: 171 | ``` 172 | ..\C4D-Version\Samples\Demo01 173 | ``` 174 | ![Tela-Demo.png](https://github.com/Code4Delphi/C4D-Version/blob/master/Img/Readme/Tela-Demo.png) 175 | 176 | 177 | 178 | ## ✅ Advantages of using Delphi's Version Info: 179 | * The version data is inserted in the .exe, so when you rest the mouse over our .exe files, the version data and product information are displayed: 180 | 181 | ![Dados-da-versao-no-Hint-do-executavel.png](https://github.com/Code4Delphi/C4D-Version/blob/master/Img/Readme/Dados-da-versao-no-Hint-do-executavel.png) 182 | 183 | 184 | * If we access the .exe properties, we will see that the version data and product information will also be displayed in the Details tab: 185 | 186 | ![Propriedades-do-executavel.png](https://github.com/Code4Delphi/C4D-Version/blob/master/Img/Readme/Propriedades-do-executavel.png) 187 | 188 | 189 | > [!TIP] 190 | > You can use C4D-Version to create an updater, this updater would access the .exe version of your application, and based on the data, make the necessary updates. 191 | 192 | > [!IMPORTANT] 193 | > ### ⭐ Don't forget to leave your star to help propagate the repository. 194 | 195 | [Back to top](#change-the-language) 196 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### Alterar idioma 2 | [![Static Badge](https://img.shields.io/badge/Portugu%C3%AAs-(ptBR)-green)](https://github.com/Code4Delphi/C4D-Version) 3 | [![Static Badge](https://img.shields.io/badge/English-(en)-red)](https://github.com/Code4Delphi/C4D-Version/blob/master/README.en.md) 4 | 5 | 6 | # C4D-Version - Controle as versões de suas aplicações 7 | 12 | 13 | Com o C4D-Version, conseguimos controlar as versões de nossas aplicações, ou de qualquer outra aplicação, de uma forma fácil e profissional, através do **Version Info** do próprio IDE do Delphi. 14 | 15 | ## 📞 Contatos 16 | 17 |

18 | 19 | 20 | 21 |   22 | 23 | 24 | 25 |   26 | 27 | 28 | 29 |   30 | 31 | 32 | 33 |

34 | 35 |
36 | 37 | ## ▶️ Vídeo de demonstração 38 | * [Acessar vídeo de demonstração](https://www.youtube.com/watch?v=nl2cBL-9VSs&list=PLLHSz4dOnnN1Hx0KtSwqN1Ory9HP7IDJn&index=4) 39 | 40 |
41 | 42 | ## ⚙️ Instalação 43 | 44 | * Instalação usando o [**Boss**](https://github.com/HashLoad/boss): 45 | 46 | ``` 47 | boss install github.com/Code4Delphi/C4D-Version 48 | ``` 49 | 50 | * **Instalação manual**: Abra seu Delphi e adicione a seguinte pasta ao seu projeto, em *Project > Options > Resource Compiler > Directories and Conditionals > Include file search path* 51 | 52 | ``` 53 | ..\C4D-Version\Src 54 | ``` 55 | 56 | 57 | 58 | ## 🚀 Como usar 59 | * Podemos definir e controlar os dados das versões de nossas aplicações diretamente pelo Delphi. Basta acessar o menu Project > Options... (ou Shift+Ctrl+F11) > Application > Version Info. 60 | 61 | ![Tela-Version-Info-Delphi.png](https://github.com/Code4Delphi/C4D-Version/blob/master/Img/Readme/Tela-Version-Info-Delphi.png) 62 | 63 | * Adicione a uses a sua aplicação: 64 | ``` 65 | uses 66 | C4D.Version; 67 | ``` 68 | 69 | ## 📝 Dados completos sobre a versão 70 | * Adicionando os dados da **versão da aplicação atual** em um TMemo: 71 | ``` 72 | var 73 | LVersao: IC4DVersionInfo; 74 | begin 75 | LVersao := TC4DVersion.Info; 76 | Memo1.Lines.Clear; 77 | Memo1.Lines.Add('GetFileName: ' + LVersao.GetFileName); 78 | Memo1.Lines.Add('FileDescription: ' + LVersao.FileDescription); 79 | Memo1.Lines.Add('VersionShort: ' + LVersao.VersionShort); 80 | Memo1.Lines.Add('VersionLong: ' + LVersao.VersionLong); 81 | Memo1.Lines.Add('VersionMajor: ' + LVersao.VersionMajor.ToString); 82 | Memo1.Lines.Add('VersionMinor: ' + LVersao.VersionMinor.ToString); 83 | Memo1.Lines.Add('VersionPatch: ' + LVersao.VersionPatch.ToString); 84 | Memo1.Lines.Add('PreRelease: ' + BoolToStr(LVersao.PreRelease, True)); 85 | Memo1.Lines.Add('VersionPreRelease: ' + LVersao.VersionPreRelease); 86 | Memo1.Lines.Add('VersionNum: ' + LVersao.VersionNum.ToString); 87 | Memo1.Lines.Add('ProductName: ' + LVersao.ProductName); 88 | Memo1.Lines.Add('VersionProductShort: ' + LVersao.VersionProductShort); 89 | Memo1.Lines.Add('VersionProductLong: ' + LVersao.VersionProductLong); 90 | Memo1.Lines.Add('Comments: ' + LVersao.Comments); 91 | Memo1.Lines.Add('CompanyName: ' + LVersao.CompanyName); 92 | Memo1.Lines.Add('InternalName: ' + LVersao.InternalName); 93 | Memo1.Lines.Add('LegalCopyright: ' + LVersao.LegalCopyright); 94 | Memo1.Lines.Add('LegalTrademarks: ' + LVersao.LegalTrademarks); 95 | Memo1.Lines.Add('OriginalFilename: ' + LVersao.OriginalFilename); 96 | Memo1.Lines.Add('TranslationString: ' + LVersao.TranslationString); 97 | Memo1.Lines.Add('VerFileDate: ' + DateTimeToStr(LVersao.VerFileDate)); 98 | Memo1.Lines.Add('SpecialBuild: ' + LVersao.SpecialBuild); 99 | Memo1.Lines.Add('PrivateBuild: ' + LVersao.PrivateBuild); 100 | Memo1.Lines.Add('DebugBuild: ' + BoolToStr(LVersao.DebugBuild, True)); 101 | Memo1.Lines.Add('Patched: ' + BoolToStr(LVersao.Patched, True)); 102 | Memo1.Lines.Add('InfoInferred: ' + BoolToStr(LVersao.InfoInferred, True)); 103 | end; 104 | ``` 105 | * Veja como ficaria o retorno: 106 | ``` 107 | GetFileName: C:\Componentes-Delphi\Code4D\C4D-Version\Samples\Demo01\Win32\Debug\C4DVersionDemo01.exe 108 | FileDescription: Code4Delphi Controle de Versão 109 | VersionShort: 1.0.0 110 | VersionLong: 1.0.0.0 111 | VersionMajor: 1 112 | VersionMinor: 0 113 | VersionPatch: 0 114 | PreRelease: False 115 | VersionPreRelease: 116 | VersionNum: 65536 117 | ProductName: Code4Delphi VersionInfo 118 | VersionProductShort: 1.0.0 119 | VersionProductLong: 1.0.0.0 120 | Comments: contato@code4delphi.com.br 121 | CompanyName: Code4Delphi - Cursos e conteúdos de Programação Delphi 122 | InternalName: Internal Name Code4Delphi 123 | LegalCopyright: Copyright Code4Delphi 124 | LegalTrademarks: https://github.com/Code4Delphi 125 | OriginalFilename: C4DVersionDemo01 126 | TranslationString: 041604E4 127 | VerFileDate: 11/05/2023 22:47:48 128 | SpecialBuild: 129 | PrivateBuild: 130 | DebugBuild: False 131 | Patched: False 132 | InfoInferred: False 133 | ``` 134 | 135 | 136 | ## 🆚 Versionamento semântico (Semantic versioning) 137 | * Adicionando apenas os dados do **Semantic versioning** da aplicação em um TMemo: 138 | ``` 139 | begin 140 | Memo1.Lines.Clear; 141 | Memo1.Lines.Add('Major: ' + TC4DVersion.SemanticVersion.Major.ToString); 142 | Memo1.Lines.Add('Minor: ' + TC4DVersion.SemanticVersion.Minor.ToString); 143 | Memo1.Lines.Add('Patch: ' + TC4DVersion.SemanticVersion.Patch.ToString); 144 | Memo1.Lines.Add('PreRelease: ' + TC4DVersion.SemanticVersion.PreRelease); 145 | Memo1.Lines.Add('Semantic versioning complete: ' + TC4DVersion.SemanticVersion.GetString); 146 | end; 147 | ``` 148 | * Veja como ficaria o retorno: 149 | ``` 150 | Major: 1 151 | Minor: 0 152 | Patch: 0 153 | PreRelease: 154 | SemanticVersion: 1.0.0 155 | ``` 156 | 157 | 158 | ## 🖥 Acessando dados de outros .exe 159 | * Também é possível, acessar os dados de outros .exe, para isso basta passar o caminho do .exe como parâmetro ao chamar o método: TC4DVersion.Info(). Veja como fariamos para recuperar os dados do .exe da calculadora do Windows: 160 | ``` 161 | var 162 | LVersao: IC4DVersionInfo; 163 | begin 164 | LVersao := TC4DVersion.Info('C:\Windows\System32\calc.exe'); 165 | ``` 166 | 167 | ## ⌨️ Demo 168 | * Junto aos fontes do projeto, você encontrara um projeto teste, na pasta: 169 | ``` 170 | ..\C4D-Version\Samples\Demo01 171 | ``` 172 | ![Tela-Demo.png](https://github.com/Code4Delphi/C4D-Version/blob/master/Img/Readme/Tela-Demo.png) 173 | 174 | 175 | 176 | ## ✅ Vantagens em se utilizar o Version Info do Delphi: 177 | * Os dados da versão são inseridos no .exe, como isso ao repousar o mouse sobre nosso arquivos .exe, os dados da versão e informações do produto são exibidos: 178 | 179 | ![Dados-da-versao-no-Hint-do-executavel.png](https://github.com/Code4Delphi/C4D-Version/blob/master/Img/Readme/Dados-da-versao-no-Hint-do-executavel.png) 180 | 181 | 182 | * Se acessarmos as propriedades do .exe, veremos que os dados da versão, e as informações do produto, também seram exibidos na aba Detalhes: 183 | 184 | ![Propriedades-do-executavel.png](https://github.com/Code4Delphi/C4D-Version/blob/master/Img/Readme/Propriedades-do-executavel.png) 185 | 186 | 187 | > [!TIP] 188 | > Você pode usar o C4D-Version para criação de um atualizador, esse atualizador acessaria a versão do .exe do sua aplicação, e com base nos dados faria as atualizações necessárias. 189 | 190 | > [!IMPORTANT] 191 | > ### ⭐ Não se esqueça de deixar sua estrela para ajudar a propagar o repositório. 192 | 193 | [Voltar ao topo](#alterar-idioma) 194 | -------------------------------------------------------------------------------- /Samples/Demo01/C4DVersionDemo01.dpr: -------------------------------------------------------------------------------- 1 | program C4DVersionDemo01; 2 | 3 | uses 4 | Vcl.Forms, 5 | C4D.VersionDemo01.View.Main in 'Src\View\C4D.VersionDemo01.View.Main.pas' {C4DVersionInfoDemo01ViewMain}, 6 | Utils in 'Src\Utils\Utils.pas'; 7 | 8 | {$R *.res} 9 | 10 | 11 | begin 12 | ReportMemoryLeaksOnShutdown := True; 13 | Application.Initialize; 14 | Application.MainFormOnTaskbar := True; 15 | Application.Title := 'C4D VersionInfo Title'; 16 | Application.Hint := 'C4D VersionInfo Hint'; 17 | Application.CreateForm(TC4DVersionInfoDemo01ViewMain, C4DVersionInfoDemo01ViewMain); 18 | Application.Run; 19 | 20 | end. 21 | -------------------------------------------------------------------------------- /Samples/Demo01/C4DVersionDemo01.dproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | {B112F10E-07BC-4CEA-B488-01EC5C50D139} 4 | C4DVersionDemo01.dpr 5 | True 6 | Debug 7 | 1 8 | Application 9 | VCL 10 | 18.8 11 | Win32 12 | 13 | 14 | true 15 | 16 | 17 | true 18 | Base 19 | true 20 | 21 | 22 | true 23 | Base 24 | true 25 | 26 | 27 | true 28 | Base 29 | true 30 | 31 | 32 | true 33 | Base 34 | true 35 | 36 | 37 | true 38 | Cfg_1 39 | true 40 | true 41 | 42 | 43 | true 44 | Base 45 | true 46 | 47 | 48 | true 49 | Cfg_2 50 | true 51 | true 52 | 53 | 54 | true 55 | Cfg_2 56 | true 57 | true 58 | 59 | 60 | false 61 | false 62 | false 63 | false 64 | false 65 | 00400000 66 | C4DVersionDemo01 67 | Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace) 68 | 1046 69 | CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=;CFBundleName= 70 | 71 | 72 | android-support-v4.dex.jar;cloud-messaging.dex.jar;com-google-android-gms.play-services-ads-base.17.2.0.dex.jar;com-google-android-gms.play-services-ads-identifier.16.0.0.dex.jar;com-google-android-gms.play-services-ads-lite.17.2.0.dex.jar;com-google-android-gms.play-services-ads.17.2.0.dex.jar;com-google-android-gms.play-services-analytics-impl.16.0.8.dex.jar;com-google-android-gms.play-services-analytics.16.0.8.dex.jar;com-google-android-gms.play-services-base.16.0.1.dex.jar;com-google-android-gms.play-services-basement.16.2.0.dex.jar;com-google-android-gms.play-services-gass.17.2.0.dex.jar;com-google-android-gms.play-services-identity.16.0.0.dex.jar;com-google-android-gms.play-services-maps.16.1.0.dex.jar;com-google-android-gms.play-services-measurement-base.16.4.0.dex.jar;com-google-android-gms.play-services-measurement-sdk-api.16.4.0.dex.jar;com-google-android-gms.play-services-stats.16.0.1.dex.jar;com-google-android-gms.play-services-tagmanager-v4-impl.16.0.8.dex.jar;com-google-android-gms.play-services-tasks.16.0.1.dex.jar;com-google-android-gms.play-services-wallet.16.0.1.dex.jar;com-google-firebase.firebase-analytics.16.4.0.dex.jar;com-google-firebase.firebase-common.16.1.0.dex.jar;com-google-firebase.firebase-iid-interop.16.0.1.dex.jar;com-google-firebase.firebase-iid.17.1.1.dex.jar;com-google-firebase.firebase-measurement-connector.17.0.1.dex.jar;com-google-firebase.firebase-messaging.17.5.0.dex.jar;fmx.dex.jar;google-play-billing.dex.jar;google-play-licensing.dex.jar 73 | 74 | 75 | Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) 76 | Debug 77 | true 78 | CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName) 79 | $(BDS)\bin\default_app.manifest 80 | true 81 | $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png 82 | $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png 83 | ..\..\Src;$(DCC_UnitSearchPath) 84 | .\$(Platform)\$(Config) 85 | .\$(Platform)\$(Config) 86 | 87 | 88 | $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png 89 | $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png 90 | 91 | 92 | RELEASE;$(DCC_Define) 93 | 0 94 | false 95 | 0 96 | 97 | 98 | true 99 | PerMonitorV2 100 | true 101 | CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName) 102 | 103 | 104 | DEBUG;$(DCC_Define) 105 | false 106 | true 107 | 108 | 109 | Debug 110 | 111 | 112 | true 113 | PerMonitorV2 114 | CompanyName=Code4Delphi - Cursos e conteúdos de Programação Delphi;FileDescription=Code4Delphi Controle de Versão;FileVersion=1.0.0.0;InternalName=Internal Name Code4Delphi;LegalCopyright=Copyright Code4Delphi;LegalTrademarks=https://github.com/Code4Delphi;OriginalFilename=$(MSBuildProjectName);ProductName=Code4Delphi VersionInfo;ProductVersion=1.0.0.0;Comments=contato@code4delphi.com.br;ProgramID=br.com.code4delphi.$(MSBuildProjectName);PreRelease=-alpha.0 115 | true 116 | $(BDS)\bin\delphi_PROJECTICON.ico 117 | 118 | 119 | 120 | MainSource 121 | 122 | 123 |
C4DVersionInfoDemo01ViewMain
124 |
125 | 126 | 127 | Cfg_2 128 | Base 129 | 130 | 131 | Base 132 | 133 | 134 | Cfg_1 135 | Base 136 | 137 |
138 | 139 | Delphi.Personality.12 140 | 141 | 142 | 143 | 144 | C4DVersionDemo01.dpr 145 | 146 | 147 | Embarcadero LiveBindings Components FireMonkey 148 | Microsoft Office 2000 Sample Automation Server Wrapper Components 149 | Microsoft Office XP Sample Automation Server Wrapper Components 150 | 151 | 152 | 153 | False 154 | False 155 | True 156 | False 157 | 158 | 159 | 160 | 161 | C4DVersionDemo01.exe 162 | true 163 | 164 | 165 | 166 | 167 | 1 168 | 169 | 170 | Contents\MacOS 171 | 1 172 | 173 | 174 | 0 175 | 176 | 177 | 178 | 179 | classes 180 | 1 181 | 182 | 183 | classes 184 | 1 185 | 186 | 187 | 188 | 189 | res\xml 190 | 1 191 | 192 | 193 | res\xml 194 | 1 195 | 196 | 197 | 198 | 199 | library\lib\armeabi-v7a 200 | 1 201 | 202 | 203 | 204 | 205 | library\lib\armeabi 206 | 1 207 | 208 | 209 | library\lib\armeabi 210 | 1 211 | 212 | 213 | 214 | 215 | library\lib\armeabi-v7a 216 | 1 217 | 218 | 219 | 220 | 221 | library\lib\mips 222 | 1 223 | 224 | 225 | library\lib\mips 226 | 1 227 | 228 | 229 | 230 | 231 | library\lib\armeabi-v7a 232 | 1 233 | 234 | 235 | library\lib\arm64-v8a 236 | 1 237 | 238 | 239 | 240 | 241 | library\lib\armeabi-v7a 242 | 1 243 | 244 | 245 | 246 | 247 | res\drawable 248 | 1 249 | 250 | 251 | res\drawable 252 | 1 253 | 254 | 255 | 256 | 257 | res\values 258 | 1 259 | 260 | 261 | res\values 262 | 1 263 | 264 | 265 | 266 | 267 | res\values-v21 268 | 1 269 | 270 | 271 | res\values-v21 272 | 1 273 | 274 | 275 | 276 | 277 | res\values 278 | 1 279 | 280 | 281 | res\values 282 | 1 283 | 284 | 285 | 286 | 287 | res\drawable 288 | 1 289 | 290 | 291 | res\drawable 292 | 1 293 | 294 | 295 | 296 | 297 | res\drawable-xxhdpi 298 | 1 299 | 300 | 301 | res\drawable-xxhdpi 302 | 1 303 | 304 | 305 | 306 | 307 | res\drawable-ldpi 308 | 1 309 | 310 | 311 | res\drawable-ldpi 312 | 1 313 | 314 | 315 | 316 | 317 | res\drawable-mdpi 318 | 1 319 | 320 | 321 | res\drawable-mdpi 322 | 1 323 | 324 | 325 | 326 | 327 | res\drawable-hdpi 328 | 1 329 | 330 | 331 | res\drawable-hdpi 332 | 1 333 | 334 | 335 | 336 | 337 | res\drawable-xhdpi 338 | 1 339 | 340 | 341 | res\drawable-xhdpi 342 | 1 343 | 344 | 345 | 346 | 347 | res\drawable-mdpi 348 | 1 349 | 350 | 351 | res\drawable-mdpi 352 | 1 353 | 354 | 355 | 356 | 357 | res\drawable-hdpi 358 | 1 359 | 360 | 361 | res\drawable-hdpi 362 | 1 363 | 364 | 365 | 366 | 367 | res\drawable-xhdpi 368 | 1 369 | 370 | 371 | res\drawable-xhdpi 372 | 1 373 | 374 | 375 | 376 | 377 | res\drawable-xxhdpi 378 | 1 379 | 380 | 381 | res\drawable-xxhdpi 382 | 1 383 | 384 | 385 | 386 | 387 | res\drawable-xxxhdpi 388 | 1 389 | 390 | 391 | res\drawable-xxxhdpi 392 | 1 393 | 394 | 395 | 396 | 397 | res\drawable-small 398 | 1 399 | 400 | 401 | res\drawable-small 402 | 1 403 | 404 | 405 | 406 | 407 | res\drawable-normal 408 | 1 409 | 410 | 411 | res\drawable-normal 412 | 1 413 | 414 | 415 | 416 | 417 | res\drawable-large 418 | 1 419 | 420 | 421 | res\drawable-large 422 | 1 423 | 424 | 425 | 426 | 427 | res\drawable-xlarge 428 | 1 429 | 430 | 431 | res\drawable-xlarge 432 | 1 433 | 434 | 435 | 436 | 437 | res\values 438 | 1 439 | 440 | 441 | res\values 442 | 1 443 | 444 | 445 | 446 | 447 | 1 448 | 449 | 450 | Contents\MacOS 451 | 1 452 | 453 | 454 | 0 455 | 456 | 457 | 458 | 459 | Contents\MacOS 460 | 1 461 | .framework 462 | 463 | 464 | Contents\MacOS 465 | 1 466 | .framework 467 | 468 | 469 | 0 470 | 471 | 472 | 473 | 474 | 1 475 | .dylib 476 | 477 | 478 | 1 479 | .dylib 480 | 481 | 482 | 1 483 | .dylib 484 | 485 | 486 | Contents\MacOS 487 | 1 488 | .dylib 489 | 490 | 491 | Contents\MacOS 492 | 1 493 | .dylib 494 | 495 | 496 | 0 497 | .dll;.bpl 498 | 499 | 500 | 501 | 502 | 1 503 | .dylib 504 | 505 | 506 | 1 507 | .dylib 508 | 509 | 510 | 1 511 | .dylib 512 | 513 | 514 | Contents\MacOS 515 | 1 516 | .dylib 517 | 518 | 519 | Contents\MacOS 520 | 1 521 | .dylib 522 | 523 | 524 | 0 525 | .bpl 526 | 527 | 528 | 529 | 530 | 0 531 | 532 | 533 | 0 534 | 535 | 536 | 0 537 | 538 | 539 | 0 540 | 541 | 542 | 0 543 | 544 | 545 | Contents\Resources\StartUp\ 546 | 0 547 | 548 | 549 | Contents\Resources\StartUp\ 550 | 0 551 | 552 | 553 | 0 554 | 555 | 556 | 557 | 558 | 1 559 | 560 | 561 | 1 562 | 563 | 564 | 1 565 | 566 | 567 | 568 | 569 | 1 570 | 571 | 572 | 1 573 | 574 | 575 | 1 576 | 577 | 578 | 579 | 580 | 1 581 | 582 | 583 | 1 584 | 585 | 586 | 1 587 | 588 | 589 | 590 | 591 | 1 592 | 593 | 594 | 1 595 | 596 | 597 | 1 598 | 599 | 600 | 601 | 602 | 1 603 | 604 | 605 | 1 606 | 607 | 608 | 1 609 | 610 | 611 | 612 | 613 | 1 614 | 615 | 616 | 1 617 | 618 | 619 | 1 620 | 621 | 622 | 623 | 624 | 1 625 | 626 | 627 | 1 628 | 629 | 630 | 1 631 | 632 | 633 | 634 | 635 | 1 636 | 637 | 638 | 1 639 | 640 | 641 | 1 642 | 643 | 644 | 645 | 646 | 1 647 | 648 | 649 | 1 650 | 651 | 652 | 1 653 | 654 | 655 | 656 | 657 | 1 658 | 659 | 660 | 1 661 | 662 | 663 | 1 664 | 665 | 666 | 667 | 668 | 1 669 | 670 | 671 | 1 672 | 673 | 674 | 1 675 | 676 | 677 | 678 | 679 | 1 680 | 681 | 682 | 1 683 | 684 | 685 | 1 686 | 687 | 688 | 689 | 690 | 1 691 | 692 | 693 | 1 694 | 695 | 696 | 1 697 | 698 | 699 | 700 | 701 | 1 702 | 703 | 704 | 1 705 | 706 | 707 | 1 708 | 709 | 710 | 711 | 712 | 1 713 | 714 | 715 | 1 716 | 717 | 718 | 1 719 | 720 | 721 | 722 | 723 | 1 724 | 725 | 726 | 1 727 | 728 | 729 | 1 730 | 731 | 732 | 733 | 734 | 1 735 | 736 | 737 | 1 738 | 739 | 740 | 1 741 | 742 | 743 | 744 | 745 | 1 746 | 747 | 748 | 1 749 | 750 | 751 | 1 752 | 753 | 754 | 755 | 756 | 1 757 | 758 | 759 | 1 760 | 761 | 762 | 1 763 | 764 | 765 | 766 | 767 | 1 768 | 769 | 770 | 1 771 | 772 | 773 | 1 774 | 775 | 776 | 777 | 778 | 1 779 | 780 | 781 | 1 782 | 783 | 784 | 1 785 | 786 | 787 | 788 | 789 | 1 790 | 791 | 792 | 1 793 | 794 | 795 | 1 796 | 797 | 798 | 799 | 800 | 1 801 | 802 | 803 | 1 804 | 805 | 806 | 1 807 | 808 | 809 | 810 | 811 | 1 812 | 813 | 814 | 1 815 | 816 | 817 | 1 818 | 819 | 820 | 821 | 822 | 1 823 | 824 | 825 | 1 826 | 827 | 828 | 829 | 830 | ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF 831 | 1 832 | 833 | 834 | ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF 835 | 1 836 | 837 | 838 | 839 | 840 | 1 841 | 842 | 843 | 1 844 | 845 | 846 | 847 | 848 | ..\ 849 | 1 850 | 851 | 852 | ..\ 853 | 1 854 | 855 | 856 | 857 | 858 | 1 859 | 860 | 861 | 1 862 | 863 | 864 | 1 865 | 866 | 867 | 868 | 869 | 1 870 | 871 | 872 | 1 873 | 874 | 875 | 1 876 | 877 | 878 | 879 | 880 | ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF 881 | 1 882 | 883 | 884 | 885 | 886 | ..\ 887 | 1 888 | 889 | 890 | ..\ 891 | 1 892 | 893 | 894 | 895 | 896 | Contents 897 | 1 898 | 899 | 900 | Contents 901 | 1 902 | 903 | 904 | 905 | 906 | Contents\Resources 907 | 1 908 | 909 | 910 | Contents\Resources 911 | 1 912 | 913 | 914 | 915 | 916 | library\lib\armeabi-v7a 917 | 1 918 | 919 | 920 | library\lib\arm64-v8a 921 | 1 922 | 923 | 924 | 1 925 | 926 | 927 | 1 928 | 929 | 930 | 1 931 | 932 | 933 | 1 934 | 935 | 936 | Contents\MacOS 937 | 1 938 | 939 | 940 | Contents\MacOS 941 | 1 942 | 943 | 944 | 0 945 | 946 | 947 | 948 | 949 | library\lib\armeabi-v7a 950 | 1 951 | 952 | 953 | 954 | 955 | 1 956 | 957 | 958 | 1 959 | 960 | 961 | 962 | 963 | Assets 964 | 1 965 | 966 | 967 | Assets 968 | 1 969 | 970 | 971 | 972 | 973 | Assets 974 | 1 975 | 976 | 977 | Assets 978 | 1 979 | 980 | 981 | 982 | 983 | 984 | 985 | 986 | 987 | 988 | 989 | 990 | 991 | 992 | 993 | 12 994 | 995 | 996 | 997 | 998 |
999 | -------------------------------------------------------------------------------- /Samples/Demo01/C4DVersionDemo01.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code4Delphi/C4D-Version/91f443782696c4586a0f1dfff2822d6e1200d321/Samples/Demo01/C4DVersionDemo01.res -------------------------------------------------------------------------------- /Samples/Demo01/Src/Utils/Utils.pas: -------------------------------------------------------------------------------- 1 | unit Utils; 2 | 3 | interface 4 | 5 | uses 6 | System.SysUtils, 7 | Vcl.Dialogs; 8 | 9 | type 10 | TUtils = class 11 | private 12 | public 13 | class function SelectFile(const ADefaultFile: string; const ADefaultExt: string = 'exe'): string; 14 | end; 15 | 16 | implementation 17 | 18 | 19 | class function TUtils.SelectFile(const ADefaultFile: string; const ADefaultExt: string = 'exe'): string; 20 | var 21 | LOpenDialog: TOpenDialog; 22 | LFolder: string; 23 | begin 24 | LOpenDialog := TOpenDialog.Create(nil); 25 | try 26 | LOpenDialog.Title := 'C4D - Select a file'; 27 | if(not ADefaultFile.Trim.IsEmpty)then 28 | begin 29 | LFolder := ExtractFilePath(ADefaultFile); 30 | if(System.SysUtils.DirectoryExists(LFolder))then 31 | LOpenDialog.InitialDir := LFolder; 32 | 33 | if(System.SysUtils.FileExists(ADefaultFile))then 34 | LOpenDialog.FileName := ExtractFileName(ADefaultFile); 35 | end; 36 | 37 | if(not ADefaultExt.Trim.IsEmpty)then 38 | begin 39 | LOpenDialog.DefaultExt := ADefaultExt; 40 | LOpenDialog.Filter := Format('Arquivo %s|*.%s', [ADefaultExt.ToUpper, ADefaultExt]); 41 | end; 42 | 43 | if(not LOpenDialog.Execute)then 44 | Exit(ADefaultFile); 45 | 46 | Result := LOpenDialog.FileName; 47 | finally 48 | LOpenDialog.Free; 49 | end; 50 | end; 51 | 52 | end. 53 | -------------------------------------------------------------------------------- /Samples/Demo01/Src/View/C4D.VersionDemo01.View.Main.dfm: -------------------------------------------------------------------------------- 1 | object C4DVersionInfoDemo01ViewMain: TC4DVersionInfoDemo01ViewMain 2 | Left = 0 3 | Top = 0 4 | Caption = 'Code4Delphi - VersionInfo - Demo' 5 | ClientHeight = 651 6 | ClientWidth = 964 7 | Color = clBtnFace 8 | Font.Charset = DEFAULT_CHARSET 9 | Font.Color = clWindowText 10 | Font.Height = -11 11 | Font.Name = 'Tahoma' 12 | Font.Style = [] 13 | OldCreateOrder = False 14 | Position = poScreenCenter 15 | WindowState = wsMaximized 16 | PixelsPerInch = 96 17 | TextHeight = 13 18 | object Memo1: TMemo 19 | Left = 0 20 | Top = 235 21 | Width = 964 22 | Height = 416 23 | Align = alClient 24 | Font.Charset = ANSI_CHARSET 25 | Font.Color = clWindowText 26 | Font.Height = -11 27 | Font.Name = 'Courier New' 28 | Font.Style = [] 29 | ParentFont = False 30 | ScrollBars = ssVertical 31 | TabOrder = 0 32 | ExplicitTop = 247 33 | ExplicitHeight = 393 34 | end 35 | object Panel1: TPanel 36 | Left = 0 37 | Top = 203 38 | Width = 964 39 | Height = 32 40 | Align = alTop 41 | BevelOuter = bvLowered 42 | Padding.Left = 2 43 | Padding.Top = 2 44 | Padding.Right = 2 45 | Padding.Bottom = 2 46 | TabOrder = 1 47 | object btnLimparLog: TButton 48 | Left = 3 49 | Top = 3 50 | Width = 118 51 | Height = 26 52 | Cursor = crHandPoint 53 | Align = alLeft 54 | Caption = 'Limpar log' 55 | TabOrder = 0 56 | OnClick = btnLimparLogClick 57 | ExplicitHeight = 28 58 | end 59 | object ckLogLimparACadaBusca: TCheckBox 60 | Left = 126 61 | Top = 9 62 | Width = 123 63 | Height = 17 64 | Cursor = crHandPoint 65 | Caption = 'Limpar a cada busca' 66 | Checked = True 67 | State = cbChecked 68 | TabOrder = 1 69 | end 70 | end 71 | object GroupBox1: TGroupBox 72 | Left = 0 73 | Top = 135 74 | Width = 964 75 | Height = 68 76 | Align = alTop 77 | Caption = ' Acessando dados de outros programas ' 78 | TabOrder = 2 79 | object Label1: TLabel 80 | Left = 18 81 | Top = 20 82 | Width = 43 83 | Height = 13 84 | Caption = 'Path exe' 85 | end 86 | object edtPathExe01: TEdit 87 | Left = 19 88 | Top = 34 89 | Width = 531 90 | Height = 21 91 | TabOrder = 0 92 | Text = 'C:\Windows\System32\calc.exe' 93 | end 94 | object btnVersaoSistemaDoEdit01: TButton 95 | Left = 581 96 | Top = 32 97 | Width = 200 98 | Height = 25 99 | Cursor = crHandPoint 100 | Caption = 'Dados da vers'#227'o' 101 | TabOrder = 1 102 | OnClick = btnVersaoSistemaDoEdit01Click 103 | end 104 | object btnBuscarExe: TButton 105 | Left = 552 106 | Top = 32 107 | Width = 26 108 | Height = 25 109 | Cursor = crHandPoint 110 | Hint = 'Buscar .exe' 111 | Caption = '...' 112 | ParentShowHint = False 113 | ShowHint = True 114 | TabOrder = 2 115 | OnClick = btnBuscarExeClick 116 | end 117 | end 118 | object GroupBox2: TGroupBox 119 | Left = 0 120 | Top = 83 121 | Width = 964 122 | Height = 52 123 | Align = alTop 124 | Caption = ' Dados do programa atual ' 125 | Padding.Left = 5 126 | Padding.Bottom = 5 127 | TabOrder = 3 128 | ExplicitTop = 84 129 | object btnSemanticVersion: TButton 130 | Left = 207 131 | Top = 15 132 | Width = 200 133 | Height = 30 134 | Cursor = crHandPoint 135 | Align = alLeft 136 | Caption = 'Somente Semantic versioning' 137 | TabOrder = 0 138 | OnClick = btnSemanticVersionClick 139 | ExplicitLeft = 137 140 | end 141 | object btnVersaoSistemaAtual: TButton 142 | Left = 7 143 | Top = 15 144 | Width = 200 145 | Height = 30 146 | Cursor = crHandPoint 147 | Align = alLeft 148 | Caption = 'Dados da vers'#227'o' 149 | TabOrder = 1 150 | OnClick = btnVersaoSistemaAtualClick 151 | ExplicitLeft = 8 152 | ExplicitTop = 14 153 | end 154 | end 155 | object GroupBox3: TGroupBox 156 | Left = 0 157 | Top = 0 158 | Width = 964 159 | Height = 83 160 | Align = alTop 161 | Caption = ' Como usar ' 162 | Padding.Left = 3 163 | Padding.Right = 3 164 | Padding.Bottom = 3 165 | TabOrder = 4 166 | object Memo2: TMemo 167 | Left = 5 168 | Top = 15 169 | Width = 954 170 | Height = 63 171 | Align = alClient 172 | BorderStyle = bsNone 173 | Lines.Strings = ( 174 | 175 | 'Para utiliza, basta configurar a vers'#227'o so seu projeto diretamen' + 176 | 'te pela IDE do Delphi em: Project > Options... (ou Shift+Ctrl+F' + 177 | '11)' 178 | 'Na tela que abrir acessar: Application > Version Info' 179 | '' 180 | 181 | 'Basta preencher os dados da vers'#227'o na tela que sera aberta, e ut' + 182 | 'ilizar esse framework para pegar as informa'#231#245'es.' 183 | ' ') 184 | ScrollBars = ssVertical 185 | TabOrder = 0 186 | end 187 | end 188 | end 189 | -------------------------------------------------------------------------------- /Samples/Demo01/Src/View/C4D.VersionDemo01.View.Main.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code4Delphi/C4D-Version/91f443782696c4586a0f1dfff2822d6e1200d321/Samples/Demo01/Src/View/C4D.VersionDemo01.View.Main.pas -------------------------------------------------------------------------------- /Src/C4D.Version.Consts.pas: -------------------------------------------------------------------------------- 1 | unit C4D.Version.Consts; 2 | 3 | interface 4 | 5 | uses 6 | C4D.Version.Types; 7 | 8 | const 9 | LanguageValues: array[TVersionLanguage] of Word = ($0401, $0402, $0403, 10 | $0404, $0405, $0406, $0407, $0408, $0409, $040A, $040B, $040C, $040D, 11 | $040E, $040F, $0410, $0411, $0412, $0413, $0414, $0415, $0416, $0417, 12 | $0418, $0419, $041A, $041B, $041C, $041D, $041E, $041F, $0420, $0421, 13 | $0804, $0807, $0809, $080A, $080C, $0810, $0813, $0814, $0816, $081A, 14 | $0C0C, $100C, $0000); 15 | 16 | const 17 | CharacterSetValues: array[TVersionCharSet] of Integer = (0, 932, 949, 950, 18 | 1200, 1250, 1251, 1252, 1253, 1254, 1255, 1256, -1); 19 | 20 | implementation 21 | 22 | end. 23 | -------------------------------------------------------------------------------- /Src/C4D.Version.Info.pas: -------------------------------------------------------------------------------- 1 | unit C4D.Version.Info; 2 | 3 | //INSPIRADO NA UNIT RxVerInf DO COMPONENTE RXLib 4 | 5 | interface 6 | 7 | uses 8 | System.SysUtils, 9 | Winapi.Windows, 10 | C4D.Version.Interfaces, 11 | C4D.Version.Types, 12 | C4D.Version.Utils; 13 | 14 | type 15 | TC4DVersionInfo = class(TInterfacedObject, IC4DVersionInfo) 16 | private 17 | FFileName: PChar; 18 | FIsValid: Boolean; 19 | FSize: DWORD; 20 | FBuffer: PChar; 21 | FHandle: DWORD; 22 | FFixedFileInfo: PVSFixedFileInfo; 23 | FVersion: TRecordVersion; 24 | FVersionProduct: TRecordVersion; 25 | procedure ReadAllDados; 26 | procedure ReadVersionInfo; 27 | procedure ReadFixedFileInfo; 28 | procedure ReadVersionFile; 29 | procedure ReadVersionProduct; 30 | function FileNameAppCurrent: string; 31 | function VersionToShortStr(const Version: TRecordVersion): string; 32 | function VersionToLongStr(const Version: TRecordVersion): string; 33 | function GetVerValue(const AVerName: string): string; 34 | function GetTranslation: Pointer; 35 | protected 36 | function GetFileName: string; 37 | procedure SetFileName(const Value: string); 38 | function FileDescription: string; 39 | function VersionShort: string; 40 | function VersionLong: string; 41 | function VersionMajor: Integer; 42 | function VersionMinor: Integer; 43 | function VersionPatch: Integer; 44 | function PreRelease: Boolean; 45 | function VersionPreRelease: string; 46 | function VersionNum: LongInt; 47 | function ProductName: string; 48 | function VersionProductShort: string; 49 | function VersionProductLong: string; 50 | function Comments: string; 51 | function CompanyName: string; 52 | function InternalName: string; 53 | function LegalCopyright: string; 54 | function LegalTrademarks: string; 55 | function OriginalFilename: string; 56 | function VerFileDate: TDateTime; 57 | function TranslationString: string; 58 | function IsValid: Boolean; 59 | function SpecialBuild: string; 60 | function PrivateBuild: string; 61 | function DebugBuild: Boolean; 62 | function Patched: Boolean; 63 | function InfoInferred: Boolean; 64 | function Value(AName: string): string; 65 | public 66 | class function New: IC4DVersionInfo; overload; 67 | class function New(const AFileName: string): IC4DVersionInfo; overload; 68 | constructor Create; overload; 69 | constructor Create(const AFileName: string); overload; 70 | destructor Destroy; override; 71 | end; 72 | 73 | implementation 74 | 75 | uses 76 | WinTypes, 77 | WinProcs, 78 | C4D.Version.Consts; 79 | 80 | class function TC4DVersionInfo.New: IC4DVersionInfo; 81 | begin 82 | Result := Self.Create; 83 | end; 84 | 85 | class function TC4DVersionInfo.New(const AFileName: string): IC4DVersionInfo; 86 | begin 87 | Result := Self.Create(AFileName); 88 | end; 89 | 90 | constructor TC4DVersionInfo.Create; 91 | begin 92 | Self.Create(Self.FileNameAppCurrent); 93 | end; 94 | 95 | constructor TC4DVersionInfo.Create(const AFileName: string); 96 | var 97 | LFileName: string; 98 | begin 99 | inherited Create; 100 | 101 | LFileName := AFileName; 102 | if(LFileName.Trim.IsEmpty)then 103 | LFileName := Self.FileNameAppCurrent; 104 | 105 | FFileName := StrPCopy(StrAlloc(Length(LFileName) + 1), LFileName); 106 | Self.ReadAllDados; 107 | end; 108 | 109 | function TC4DVersionInfo.GetFileName: string; 110 | begin 111 | Result := StrPas(FFileName); 112 | end; 113 | 114 | procedure TC4DVersionInfo.SetFileName(const Value: string); 115 | begin 116 | if(FBuffer <> nil)then 117 | FreeMem(FBuffer, FSize); 118 | FBuffer := nil; 119 | StrDispose(FFileName); 120 | FFileName := StrPCopy(StrAlloc(Length(Value) + 1), Value); 121 | Self.ReadAllDados; 122 | end; 123 | 124 | procedure TC4DVersionInfo.ReadAllDados; 125 | begin 126 | FIsValid := False; 127 | if(not FileExists(FFileName))then 128 | Exit; 129 | 130 | Self.ReadVersionInfo; 131 | Self.ReadFixedFileInfo; 132 | Self.ReadVersionFile; 133 | Self.ReadVersionProduct; 134 | end; 135 | 136 | procedure TC4DVersionInfo.ReadVersionInfo; 137 | begin 138 | FIsValid := False; 139 | FSize := GetFileVersionInfoSize(FFileName, FHandle); 140 | if(FSize > 0)then 141 | try 142 | FBuffer := TC4DVersionUtils.MemAlloc(FSize); 143 | FIsValid := GetFileVersionInfo(FFileName, FHandle, FSize, FBuffer); 144 | except 145 | FIsValid := False; 146 | raise; 147 | end; 148 | end; 149 | 150 | procedure TC4DVersionInfo.ReadFixedFileInfo; 151 | var 152 | LPuLen: {$IFNDEF VER80} UINT; {$ELSE} Cardinal; {$ENDIF} 153 | begin 154 | FFixedFileInfo := nil; 155 | if(FIsValid)then 156 | VerQueryValue(FBuffer, '\', Pointer(FFixedFileInfo), LPuLen); 157 | end; 158 | 159 | procedure TC4DVersionInfo.ReadVersionFile; 160 | begin 161 | FVersion.MS := FFixedFileInfo^.dwFileVersionMS; 162 | FVersion.LS := FFixedFileInfo^.dwFileVersionLS; 163 | end; 164 | 165 | procedure TC4DVersionInfo.ReadVersionProduct; 166 | begin 167 | FVersionProduct.MS := FFixedFileInfo^.dwProductVersionMS; 168 | FVersionProduct.LS := FFixedFileInfo^.dwProductVersionLS; 169 | end; 170 | 171 | destructor TC4DVersionInfo.Destroy; 172 | begin 173 | if(FBuffer <> nil)then 174 | FreeMem(FBuffer, FSize); 175 | StrDispose(FFileName); 176 | inherited Destroy; 177 | end; 178 | 179 | function TC4DVersionInfo.FileNameAppCurrent: string; 180 | var 181 | LFileName: array[0..MAX_PATH] of Char; 182 | begin 183 | if(IsLibrary)then 184 | begin 185 | GetModuleFileName(HInstance, LFileName, {$IFDEF UNICODE}Length(LFileName){$ELSE}SizeOf(LFileName) - 1{$ENDIF}); 186 | Result := StrPas(LFileName); 187 | end 188 | else 189 | Result := ParamStr(0); 190 | end; 191 | 192 | function TC4DVersionInfo.TranslationString: string; 193 | var 194 | LPointer: Pointer; 195 | begin 196 | Result := ''; 197 | LPointer := Self.GetTranslation; 198 | if(LPointer <> nil)then 199 | Result := IntToHex(MakeLong(HiWord(LongInt(LPointer^)), LoWord(LongInt(LPointer^))), 8); 200 | end; 201 | 202 | function TC4DVersionInfo.GetTranslation: Pointer; 203 | var 204 | LPuLen: {$IFNDEF VER80} UINT; {$ELSE} Cardinal; {$ENDIF} 205 | begin 206 | Result := nil; 207 | if(FIsValid)then 208 | VerQueryValue(FBuffer, '\VarFileInfo\Translation', Result, LPuLen); 209 | end; 210 | 211 | function TC4DVersionInfo.VersionNum: LongInt; 212 | begin 213 | Result := 0; 214 | if(FIsValid)then 215 | Result := FFixedFileInfo^.dwFileVersionMS 216 | end; 217 | 218 | function TC4DVersionInfo.GetVerValue(const AVerName: string): string; 219 | var 220 | LszName: array[0..255] of Char; 221 | LPointer: Pointer; 222 | LPuLen: {$IFNDEF VER80} UINT; {$ELSE} Cardinal; {$ENDIF} 223 | begin 224 | Result := ''; 225 | if(FIsValid)then 226 | begin 227 | StrPCopy(LszName, '\StringFileInfo\' + TranslationString + '\' + AVerName); 228 | if(VerQueryValue(FBuffer, LszName, LPointer, LPuLen))then 229 | Result := StrPas(PChar(LPointer)); 230 | end; 231 | end; 232 | 233 | function TC4DVersionInfo.VersionShort: string; 234 | begin 235 | Result := ''; 236 | if(FIsValid)then 237 | Result := Self.VersionToShortStr(FVersion); 238 | end; 239 | 240 | function TC4DVersionInfo.VersionLong: string; 241 | begin 242 | Result := Self.GetVerValue('FileVersion'); 243 | if(Result.IsEmpty)and(FIsValid)then 244 | Result := Self.VersionToLongStr(FVersion); 245 | end; 246 | 247 | function TC4DVersionInfo.Comments: string; 248 | begin 249 | Result := Self.GetVerValue('Comments'); 250 | end; 251 | 252 | function TC4DVersionInfo.CompanyName: string; 253 | begin 254 | Result := Self.GetVerValue('CompanyName'); 255 | end; 256 | 257 | function TC4DVersionInfo.FileDescription: string; 258 | begin 259 | Result := Self.GetVerValue('FileDescription'); 260 | end; 261 | 262 | function TC4DVersionInfo.InternalName: string; 263 | begin 264 | Result := Self.GetVerValue('InternalName'); 265 | end; 266 | 267 | function TC4DVersionInfo.LegalCopyright: string; 268 | begin 269 | Result := Self.GetVerValue('LegalCopyright'); 270 | end; 271 | 272 | function TC4DVersionInfo.LegalTrademarks: string; 273 | begin 274 | Result := Self.GetVerValue('LegalTrademarks'); 275 | end; 276 | 277 | function TC4DVersionInfo.OriginalFilename: string; 278 | begin 279 | Result := Self.GetVerValue('OriginalFilename'); 280 | end; 281 | 282 | function TC4DVersionInfo.VersionMajor: Integer; 283 | begin 284 | Result := StrToIntDef(Format('%d', [FVersion.All[2]]), 0); 285 | end; 286 | 287 | function TC4DVersionInfo.VersionMinor: Integer; 288 | begin 289 | Result := StrToIntDef(Format('%d', [FVersion.All[1]]), 0); 290 | end; 291 | 292 | function TC4DVersionInfo.VersionPatch: Integer; 293 | begin 294 | Result := StrToIntDef(Format('%d', [FVersion.All[4]]), 0); 295 | end; 296 | 297 | function TC4DVersionInfo.VersionPreRelease: string; 298 | begin 299 | Result := ''; 300 | if(Self.PreRelease)then 301 | Result := Self.GetVerValue('PreRelease'); 302 | end; 303 | 304 | function TC4DVersionInfo.VersionProductShort: string; 305 | begin 306 | Result := ''; 307 | if(FIsValid)then 308 | Result := Self.VersionToShortStr(FVersionProduct); 309 | end; 310 | 311 | function TC4DVersionInfo.VersionProductLong: string; 312 | begin 313 | Result := Self.GetVerValue('ProductVersion'); 314 | if(Result.IsEmpty)and(FIsValid)then 315 | Result := Self.VersionToLongStr(FVersionProduct); 316 | end; 317 | 318 | function TC4DVersionInfo.ProductName: string; 319 | begin 320 | Result := Self.GetVerValue('ProductName'); 321 | end; 322 | 323 | function TC4DVersionInfo.SpecialBuild: string; 324 | begin 325 | Result := Self.GetVerValue('SpecialBuild'); 326 | end; 327 | 328 | function TC4DVersionInfo.PrivateBuild: string; 329 | begin 330 | Result := Self.GetVerValue('PrivateBuild'); 331 | end; 332 | 333 | function TC4DVersionInfo.DebugBuild: Boolean; 334 | begin 335 | Result := TC4DVersionUtils.HasdwFileFlags(FFixedFileInfo, VS_FF_DEBUG); 336 | end; 337 | 338 | function TC4DVersionInfo.PreRelease: Boolean; 339 | begin 340 | Result := TC4DVersionUtils.HasdwFileFlags(FFixedFileInfo, VS_FF_PRERELEASE); 341 | end; 342 | 343 | function TC4DVersionInfo.Patched: Boolean; 344 | begin 345 | Result := TC4DVersionUtils.HasdwFileFlags(FFixedFileInfo, VS_FF_PATCHED); 346 | end; 347 | 348 | function TC4DVersionInfo.InfoInferred: Boolean; 349 | begin 350 | Result := TC4DVersionUtils.HasdwFileFlags(FFixedFileInfo, VS_FF_INFOINFERRED); 351 | end; 352 | 353 | function TC4DVersionInfo.IsValid: Boolean; 354 | begin 355 | Result := FIsValid; 356 | end; 357 | 358 | function TC4DVersionInfo.Value(AName: string): string; 359 | begin 360 | Result := Self.GetVerValue(AName); 361 | end; 362 | 363 | function TC4DVersionInfo.VerFileDate: TDateTime; 364 | begin 365 | Result := NullDate; 366 | if(FileExists(GetFileName))then 367 | Result := TC4DVersionUtils.FileDateTime(GetFileName) 368 | end; 369 | 370 | function TC4DVersionInfo.VersionToShortStr(const Version: TRecordVersion): string; 371 | begin 372 | Result := Format('%d.%d.%d', [Version.All[2], Version.All[1], Version.All[4]]); 373 | end; 374 | 375 | function TC4DVersionInfo.VersionToLongStr(const Version: TRecordVersion): string; 376 | begin 377 | Result := Format('%d.%d.%d.%d', [Version.All[2], Version.All[1], Version.All[4], Version.All[3]]); 378 | end; 379 | 380 | end. 381 | -------------------------------------------------------------------------------- /Src/C4D.Version.Interfaces.pas: -------------------------------------------------------------------------------- 1 | unit C4D.Version.Interfaces; 2 | 3 | interface 4 | 5 | USES 6 | Winapi.Windows; 7 | 8 | type 9 | IC4DVersionInfo = interface 10 | ['{063CB77C-1AD6-494E-9ACF-D102CB447167}'] 11 | function GetFileName: string; 12 | procedure SetFileName(const Value: string); 13 | function FileDescription: string; 14 | function VersionShort: string; 15 | function VersionLong: string; 16 | function VersionMajor: Integer; 17 | function VersionMinor: Integer; 18 | function VersionPatch: Integer; 19 | function PreRelease: Boolean; 20 | function VersionPreRelease: string; 21 | function VersionNum: LongInt; 22 | function ProductName: string; 23 | function VersionProductShort: string; 24 | function VersionProductLong: string; 25 | function Comments: string; 26 | function CompanyName: string; 27 | function InternalName: string; 28 | function LegalCopyright: string; 29 | function LegalTrademarks: string; 30 | function OriginalFilename: string; 31 | function VerFileDate: TDateTime; 32 | function TranslationString: string; 33 | function IsValid: Boolean; 34 | function SpecialBuild: string; 35 | function PrivateBuild: string; 36 | function DebugBuild: Boolean; 37 | function Patched: Boolean; 38 | function InfoInferred: Boolean; 39 | function Value(AName: string): string; 40 | end; 41 | 42 | implementation 43 | 44 | end. 45 | -------------------------------------------------------------------------------- /Src/C4D.Version.SemanticVersion.pas: -------------------------------------------------------------------------------- 1 | unit C4D.Version.SemanticVersion; 2 | 3 | interface 4 | 5 | uses 6 | System.SysUtils, 7 | C4D.Version.Interfaces, 8 | C4D.Version.Info; 9 | 10 | type 11 | TC4DVersionSemanticVersion = class 12 | private 13 | FMajor: Integer; 14 | FMinor: Integer; 15 | FPatch: Integer; 16 | FPreRelease: string; 17 | constructor Create; 18 | public 19 | class function GetInstance: TC4DVersionSemanticVersion; 20 | function GetString: string; 21 | property Major: Integer read FMajor; 22 | property Minor: Integer read FMinor; 23 | property Patch: Integer read FPatch; 24 | property PreRelease: string read FPreRelease; 25 | end; 26 | 27 | implementation 28 | 29 | var 30 | Instance: TC4DVersionSemanticVersion; 31 | 32 | class function TC4DVersionSemanticVersion.GetInstance: TC4DVersionSemanticVersion; 33 | begin 34 | if(not Assigned(Instance))then 35 | Instance := Self.Create; 36 | Result := Instance; 37 | end; 38 | 39 | constructor TC4DVersionSemanticVersion.Create; 40 | var 41 | LC4DVersionInfo: IC4DVersionInfo; 42 | begin 43 | LC4DVersionInfo := TC4DVersionInfo.New; 44 | FMajor := LC4DVersionInfo.VersionMajor; 45 | FMinor := LC4DVersionInfo.VersionMinor; 46 | FPatch := LC4DVersionInfo.VersionPatch; 47 | FPreRelease := LC4DVersionInfo.VersionPreRelease; 48 | end; 49 | 50 | function TC4DVersionSemanticVersion.GetString: string; 51 | begin 52 | Result := FMajor.ToString + '.' + FMinor.ToString + '.' + FPatch.ToString + FPreRelease; 53 | end; 54 | 55 | initialization 56 | 57 | finalization 58 | if(Assigned(Instance))then 59 | FreeAndNil(Instance); 60 | 61 | end. 62 | -------------------------------------------------------------------------------- /Src/C4D.Version.Types.pas: -------------------------------------------------------------------------------- 1 | unit C4D.Version.Types; 2 | 3 | interface 4 | 5 | type 6 | TVersionLanguage = (vlArabic, vlBulgarian, vlCatalan, vlTraditionalChinese, 7 | vlCzech, vlDanish, vlGerman, vlGreek, vlUSEnglish, vlCastilianSpanish, 8 | vlFinnish, vlFrench, vlHebrew, vlHungarian, vlIcelandic, vlItalian, 9 | vlJapanese, vlKorean, vlDutch, vlNorwegianBokmel, vlPolish, 10 | vlBrazilianPortuguese, vlRhaetoRomanic, vlRomanian, vlRussian, 11 | vlCroatoSerbian, vlSlovak, vlAlbanian, vlSwedish, vlThai, vlTurkish, 12 | vlUrdu, vlBahasa, vlSimplifiedChinese, vlSwissGerman, vlUKEnglish, 13 | vlMexicanSpanish, vlBelgianFrench, vlSwissItalian, vlBelgianDutch, 14 | vlNorwegianNynorsk, vlPortuguese, vlSerboCroatian, vlCanadianFrench, 15 | vlSwissFrench, vlUnknown); 16 | 17 | TVersionCharSet = (vcsASCII, vcsJapan, vcsKorea, vcsTaiwan, vcsUnicode, 18 | vcsEasternEuropean, vcsCyrillic, vcsMultilingual, vcsGreek, vcsTurkish, 19 | vcsHebrew, vcsArabic, vcsUnknown); 20 | 21 | {$IFDEF VER80} 22 | PVSFixedFileInfo = Pvs_FixedFileInfo; 23 | DWORD = LongInt; 24 | {$ENDIF} 25 | 26 | TRecordVersion = record 27 | case Integer of 28 | 0: (All: array[1..4] of Word); 29 | 1:(MS, LS: LongInt); 30 | end; 31 | 32 | implementation 33 | 34 | end. 35 | -------------------------------------------------------------------------------- /Src/C4D.Version.Utils.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code4Delphi/C4D-Version/91f443782696c4586a0f1dfff2822d6e1200d321/Src/C4D.Version.Utils.pas -------------------------------------------------------------------------------- /Src/C4D.Version.pas: -------------------------------------------------------------------------------- 1 | unit C4D.Version; 2 | 3 | interface 4 | 5 | uses 6 | System.SysUtils, 7 | C4D.Version.Interfaces, 8 | C4D.Version.Info, 9 | C4D.Version.SemanticVersion; 10 | 11 | type 12 | IC4DVersionInfo = C4D.Version.Interfaces.IC4DVersionInfo; 13 | 14 | TC4DVersion = class 15 | public 16 | class function Info: IC4DVersionInfo; overload; 17 | class function Info(const AFileName: string): IC4DVersionInfo; overload; 18 | class function SemanticVersion: TC4DVersionSemanticVersion; 19 | end; 20 | 21 | implementation 22 | 23 | class function TC4DVersion.Info: IC4DVersionInfo; 24 | begin 25 | Result := TC4DVersionInfo.New; 26 | end; 27 | 28 | class function TC4DVersion.Info(const AFileName: string): IC4DVersionInfo; 29 | begin 30 | if(not AFileName.Trim.IsEmpty)and(not FileExists(AFileName))then 31 | raise Exception.Create('Informed file not found'); 32 | Result := TC4DVersionInfo.New(AFileName); 33 | end; 34 | 35 | class function TC4DVersion.SemanticVersion: TC4DVersionSemanticVersion; 36 | begin 37 | Result := TC4DVersionSemanticVersion.GetInstance; 38 | end; 39 | 40 | end. 41 | -------------------------------------------------------------------------------- /boss-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "hash": "d41d8cd98f00b204e9800998ecf8427e", 3 | "updated": "2023-05-12T00:34:46.1544436-03:00", 4 | "installedModules": {} 5 | } -------------------------------------------------------------------------------- /boss.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "C4D-Version", 3 | "description": "", 4 | "version": "1.0.0", 5 | "homepage": "https://github.com/Code4Delphi/C4D-Version", 6 | "mainsrc": "Src", 7 | "projects": [], 8 | "dependencies": {} 9 | } --------------------------------------------------------------------------------