mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
DEL: Move xpi_wdx to plugins repo
This commit is contained in:
parent
e0e2fb0553
commit
cb5c744996
8 changed files with 0 additions and 876 deletions
|
|
@ -18,7 +18,6 @@ lazbuild wcx\zip\src\zip.lpi %DC_ARCH%
|
|||
rem WDX plugins
|
||||
lazbuild wdx\rpm_wdx\src\rpm_wdx.lpi %DC_ARCH%
|
||||
lazbuild wdx\deb_wdx\src\deb_wdx.lpi %DC_ARCH%
|
||||
lazbuild wdx\xpi_wdx\src\xpi_wdx.lpi %DC_ARCH%
|
||||
lazbuild wdx\audioinfo\src\AudioInfo.lpi %DC_ARCH%
|
||||
|
||||
rem WFX plugins
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ $lazbuild wcx/zip/src/Zip.lpi $DC_ARCH
|
|||
# WDX plugins
|
||||
$lazbuild wdx/rpm_wdx/src/rpm_wdx.lpi $DC_ARCH
|
||||
$lazbuild wdx/deb_wdx/src/deb_wdx.lpi $DC_ARCH
|
||||
$lazbuild wdx/xpi_wdx/src/xpi_wdx.lpi $DC_ARCH
|
||||
$lazbuild wdx/audioinfo/src/AudioInfo.lpi $DC_ARCH
|
||||
|
||||
# WFX plugins
|
||||
|
|
|
|||
|
|
@ -1,165 +0,0 @@
|
|||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
|
||||
This version of the GNU Lesser General Public License incorporates
|
||||
the terms and conditions of version 3 of the GNU General Public
|
||||
License, supplemented by the additional permissions listed below.
|
||||
|
||||
0. Additional Definitions.
|
||||
|
||||
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||
General Public License.
|
||||
|
||||
"The Library" refers to a covered work governed by this License,
|
||||
other than an Application or a Combined Work as defined below.
|
||||
|
||||
An "Application" is any work that makes use of an interface provided
|
||||
by the Library, but which is not otherwise based on the Library.
|
||||
Defining a subclass of a class defined by the Library is deemed a mode
|
||||
of using an interface provided by the Library.
|
||||
|
||||
A "Combined Work" is a work produced by combining or linking an
|
||||
Application with the Library. The particular version of the Library
|
||||
with which the Combined Work was made is also called the "Linked
|
||||
Version".
|
||||
|
||||
The "Minimal Corresponding Source" for a Combined Work means the
|
||||
Corresponding Source for the Combined Work, excluding any source code
|
||||
for portions of the Combined Work that, considered in isolation, are
|
||||
based on the Application, and not on the Linked Version.
|
||||
|
||||
The "Corresponding Application Code" for a Combined Work means the
|
||||
object code and/or source code for the Application, including any data
|
||||
and utility programs needed for reproducing the Combined Work from the
|
||||
Application, but excluding the System Libraries of the Combined Work.
|
||||
|
||||
1. Exception to Section 3 of the GNU GPL.
|
||||
|
||||
You may convey a covered work under sections 3 and 4 of this License
|
||||
without being bound by section 3 of the GNU GPL.
|
||||
|
||||
2. Conveying Modified Versions.
|
||||
|
||||
If you modify a copy of the Library, and, in your modifications, a
|
||||
facility refers to a function or data to be supplied by an Application
|
||||
that uses the facility (other than as an argument passed when the
|
||||
facility is invoked), then you may convey a copy of the modified
|
||||
version:
|
||||
|
||||
a) under this License, provided that you make a good faith effort to
|
||||
ensure that, in the event an Application does not supply the
|
||||
function or data, the facility still operates, and performs
|
||||
whatever part of its purpose remains meaningful, or
|
||||
|
||||
b) under the GNU GPL, with none of the additional permissions of
|
||||
this License applicable to that copy.
|
||||
|
||||
3. Object Code Incorporating Material from Library Header Files.
|
||||
|
||||
The object code form of an Application may incorporate material from
|
||||
a header file that is part of the Library. You may convey such object
|
||||
code under terms of your choice, provided that, if the incorporated
|
||||
material is not limited to numerical parameters, data structure
|
||||
layouts and accessors, or small macros, inline functions and templates
|
||||
(ten or fewer lines in length), you do both of the following:
|
||||
|
||||
a) Give prominent notice with each copy of the object code that the
|
||||
Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
4. Combined Works.
|
||||
|
||||
You may convey a Combined Work under terms of your choice that,
|
||||
taken together, effectively do not restrict modification of the
|
||||
portions of the Library contained in the Combined Work and reverse
|
||||
engineering for debugging such modifications, if you also do each of
|
||||
the following:
|
||||
|
||||
a) Give prominent notice with each copy of the Combined Work that
|
||||
the Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
c) For a Combined Work that displays copyright notices during
|
||||
execution, include the copyright notice for the Library among
|
||||
these notices, as well as a reference directing the user to the
|
||||
copies of the GNU GPL and this license document.
|
||||
|
||||
d) Do one of the following:
|
||||
|
||||
0) Convey the Minimal Corresponding Source under the terms of this
|
||||
License, and the Corresponding Application Code in a form
|
||||
suitable for, and under terms that permit, the user to
|
||||
recombine or relink the Application with a modified version of
|
||||
the Linked Version to produce a modified Combined Work, in the
|
||||
manner specified by section 6 of the GNU GPL for conveying
|
||||
Corresponding Source.
|
||||
|
||||
1) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (a) uses at run time
|
||||
a copy of the Library already present on the user's computer
|
||||
system, and (b) will operate properly with a modified version
|
||||
of the Library that is interface-compatible with the Linked
|
||||
Version.
|
||||
|
||||
e) Provide Installation Information, but only if you would otherwise
|
||||
be required to provide such information under section 6 of the
|
||||
GNU GPL, and only to the extent that such information is
|
||||
necessary to install and execute a modified version of the
|
||||
Combined Work produced by recombining or relinking the
|
||||
Application with a modified version of the Linked Version. (If
|
||||
you use option 4d0, the Installation Information must accompany
|
||||
the Minimal Corresponding Source and Corresponding Application
|
||||
Code. If you use option 4d1, you must provide the Installation
|
||||
Information in the manner specified by section 6 of the GNU GPL
|
||||
for conveying Corresponding Source.)
|
||||
|
||||
5. Combined Libraries.
|
||||
|
||||
You may place library facilities that are a work based on the
|
||||
Library side by side in a single library together with other library
|
||||
facilities that are not Applications and are not covered by this
|
||||
License, and convey such a combined library under terms of your
|
||||
choice, if you do both of the following:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based
|
||||
on the Library, uncombined with any other library facilities,
|
||||
conveyed under the terms of this License.
|
||||
|
||||
b) Give prominent notice with the combined library that part of it
|
||||
is a work based on the Library, and explaining where to find the
|
||||
accompanying uncombined form of the same work.
|
||||
|
||||
6. Revised Versions of the GNU Lesser General Public License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions
|
||||
of the GNU Lesser General Public License from time to time. Such new
|
||||
versions will be similar in spirit to the present version, but may
|
||||
differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Library as you received it specifies that a certain numbered version
|
||||
of the GNU Lesser General Public License "or any later version"
|
||||
applies to it, you have the option of following the terms and
|
||||
conditions either of that published version or of any later version
|
||||
published by the Free Software Foundation. If the Library as you
|
||||
received it does not specify a version number of the GNU Lesser
|
||||
General Public License, you may choose any version of the GNU Lesser
|
||||
General Public License ever published by the Free Software Foundation.
|
||||
|
||||
If the Library as you received it specifies that a proxy can decide
|
||||
whether future versions of the GNU Lesser General Public License shall
|
||||
apply, that proxy's public statement of acceptance of any version is
|
||||
permanent authorization for you to choose that version for the
|
||||
Library.
|
||||
|
|
@ -1,109 +0,0 @@
|
|||
{
|
||||
Double commander
|
||||
-------------------------------------------------------------------------
|
||||
xpi_wdx is destined to obtainin the information from xpi-files
|
||||
in which extensions and themes for Gecko-based applications are distributed.
|
||||
|
||||
Copyright (C) 2010-2019 Alexander Koblov (alexx2000@mail.ru)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
}
|
||||
|
||||
unit xpi_def;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils;
|
||||
|
||||
type
|
||||
|
||||
{ TInstallManifest }
|
||||
|
||||
TInstallManifest = class
|
||||
public
|
||||
ID,
|
||||
Name,
|
||||
Version,
|
||||
Description,
|
||||
Creator,
|
||||
Developer,
|
||||
Contributor,
|
||||
Translator,
|
||||
HomePageURL,
|
||||
UpdateURL,
|
||||
TargetPlatform,
|
||||
Compatibility,
|
||||
AddonType: AnsiString;
|
||||
Unpack: Boolean;
|
||||
TargetApplication: TStringList;
|
||||
public
|
||||
constructor Create;
|
||||
destructor Destroy; override;
|
||||
procedure Clear;
|
||||
end;
|
||||
|
||||
var
|
||||
ApplicationList: TStringList;
|
||||
|
||||
implementation
|
||||
|
||||
{ TInstallManifest }
|
||||
|
||||
procedure TInstallManifest.Clear;
|
||||
begin
|
||||
ID := EmptyStr;
|
||||
Name := EmptyStr;
|
||||
Version := EmptyStr;
|
||||
Description := EmptyStr;
|
||||
Creator := EmptyStr;
|
||||
Developer := EmptyStr;
|
||||
Contributor := EmptyStr;
|
||||
Translator := EmptyStr;
|
||||
HomePageURL := EmptyStr;
|
||||
UpdateURL := EmptyStr;
|
||||
TargetPlatform := EmptyStr;
|
||||
Compatibility := EmptyStr;
|
||||
TargetApplication.Clear;
|
||||
end;
|
||||
|
||||
constructor TInstallManifest.Create;
|
||||
begin
|
||||
TargetApplication:= TStringList.Create;
|
||||
end;
|
||||
|
||||
destructor TInstallManifest.Destroy;
|
||||
begin
|
||||
FreeAndNil(TargetApplication);
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
initialization
|
||||
ApplicationList:= TStringList.Create;
|
||||
ApplicationList.Add('{ec8030f7-c20a-464f-9b0e-13a3a9e97384}=fx'); // Firefox
|
||||
ApplicationList.Add('{86c18b42-e466-45a9-ae7a-9b95ba6f5640}=mz'); // Mozilla Suite
|
||||
ApplicationList.Add('{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}=sm'); // SeaMonkey
|
||||
ApplicationList.Add('{3550f703-e582-4d05-9a08-453d09bdfdc6}=mt'); // Mozilla Thunderbird
|
||||
ApplicationList.Add('{a463f10c-3994-11da-9945-000d60ca027b}=fl'); // Flock
|
||||
ApplicationList.Add('{718e30fb-e89b-41dd-9da7-e25a45638b28}=sb'); // Sunbird
|
||||
ApplicationList.Add('{a23983c0-fd0e-11dc-95ff-0800200c9a66}=fc'); // Fennec
|
||||
ApplicationList.Add('{8de7fcbb-c55c-4fbe-bfc5-fc555c87dbc4}=pm'); // Pale Moon
|
||||
|
||||
finalization
|
||||
FreeAndNil(ApplicationList);
|
||||
|
||||
end.
|
||||
|
||||
|
|
@ -1,198 +0,0 @@
|
|||
{
|
||||
Double commander
|
||||
-------------------------------------------------------------------------
|
||||
xpi_wdx is destined to obtainin the information from xpi-files
|
||||
in which extensions and themes for Gecko-based applications are distributed.
|
||||
|
||||
Copyright (C) 2010-2019 Alexander Koblov (alexx2000@mail.ru)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
}
|
||||
|
||||
unit xpi_io;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, xpi_def;
|
||||
|
||||
function ParseInsatallManifest(FileName: PAnsiChar; out InstallManifest: TInstallManifest): Boolean;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Unzip, ZipUtils, DOM, XMLRead;
|
||||
|
||||
function ExtractInstallManifest(FileName: PAnsiChar; out MemoryStream: TMemoryStream): Boolean;
|
||||
var
|
||||
xpiFile: unzFile = nil;
|
||||
rdfInfo: unz_file_info;
|
||||
iError: LongInt;
|
||||
FileBuffer: Pointer = nil;
|
||||
begin
|
||||
Result:= False;
|
||||
xpiFile:= unzOpen(FileName);
|
||||
if Assigned(xpiFile) then
|
||||
try
|
||||
iError:= unzLocateFile(xpiFile, 'install.rdf', 0);
|
||||
if iError <> UNZ_OK then Exit;
|
||||
iError:= unzGetCurrentFileInfo(xpiFile, @rdfInfo, nil, 0, nil, 0, nil, 0);
|
||||
if iError <> UNZ_OK then Exit;
|
||||
FileBuffer:= AllocMem(rdfInfo.uncompressed_size);
|
||||
if FileBuffer = nil then Exit;
|
||||
iError := unzOpenCurrentFile(xpiFile);
|
||||
if iError <> UNZ_OK then Exit;
|
||||
iError := unzReadCurrentFile(xpiFile, FileBuffer, rdfInfo.uncompressed_size);
|
||||
if iError < 0 then Exit;
|
||||
if MemoryStream.Write(FileBuffer^, iError) = iError then
|
||||
Result:= True;
|
||||
iError := unzCloseCurrentFile(xpiFile);
|
||||
finally
|
||||
iError := unzClose(xpiFile);
|
||||
if Assigned(FileBuffer) then
|
||||
FreeMem(FileBuffer);
|
||||
end;
|
||||
end;
|
||||
|
||||
function AddonType(const sType: AnsiString): AnsiString;
|
||||
var
|
||||
iType: Integer;
|
||||
begin
|
||||
iType:= StrToIntDef(sType, 0);
|
||||
case iType of
|
||||
2: Result:= 'Extension';
|
||||
4: Result:= 'Theme';
|
||||
8: Result:= 'Locale';
|
||||
16: Result:= 'Plugin';
|
||||
32: Result:= 'Multiple Item Package';
|
||||
64: Result:= 'Spell check dictionary';
|
||||
else
|
||||
Result:= 'Unknown';
|
||||
end;
|
||||
end;
|
||||
|
||||
function AddString(const TargetStr, SourceStr: AnsiString): AnsiString;
|
||||
begin
|
||||
if Length(TargetStr) = 0 then
|
||||
Result:= SourceStr
|
||||
else
|
||||
Result:= TargetStr + ', ' + SourceStr;
|
||||
end;
|
||||
|
||||
procedure AddApplication(const InstallManifest: TInstallManifest; Node: TDOMNode);
|
||||
var
|
||||
I: LongWord;
|
||||
Application: AnsiString;
|
||||
ID,
|
||||
MinVersion,
|
||||
MaxVersion: AnsiString;
|
||||
begin
|
||||
Node:= Node.FindNode('Description');
|
||||
if Assigned(Node) then
|
||||
begin
|
||||
for I:= 0 to Node.ChildNodes.Count - 1 do
|
||||
with Node.ChildNodes.Item[I] do
|
||||
begin
|
||||
if nodeName = 'em:id' then
|
||||
ID:= FirstChild.NodeValue
|
||||
else if nodeName = 'em:minVersion' then
|
||||
MinVersion:= FirstChild.NodeValue
|
||||
else if nodeName = 'em:maxVersion' then
|
||||
MaxVersion:= FirstChild.NodeValue
|
||||
end;
|
||||
if InstallManifest.TargetApplication.IndexOfName(ID) < 0 then
|
||||
begin
|
||||
InstallManifest.TargetApplication.Add(ID + '=' + MinVersion + '-' + MaxVersion);
|
||||
Application:= ApplicationList.Values[ID];
|
||||
if Length(Application) <> 0 then
|
||||
begin
|
||||
InstallManifest.Compatibility:= AddString(InstallManifest.Compatibility, Application);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
function ParseInsatallManifest(FileName: PAnsiChar; out InstallManifest: TInstallManifest): Boolean;
|
||||
var
|
||||
I: LongWord;
|
||||
MemoryStream: TMemoryStream = nil;
|
||||
Doc: TXMLDocument = nil;
|
||||
mainNode: TDOMNode = nil;
|
||||
childNode: TDOMNode = nil;
|
||||
begin
|
||||
Result:= False;
|
||||
MemoryStream:= TMemoryStream.Create;
|
||||
try
|
||||
if ExtractInstallManifest(FileName, MemoryStream) then;
|
||||
begin
|
||||
MemoryStream.Position:= 0;
|
||||
ReadXMLFile(Doc, MemoryStream);
|
||||
if Assigned(Doc.documentElement) then
|
||||
mainNode:= Doc.documentElement.FindNode('Description');
|
||||
{
|
||||
if not Assigned(mainNode) then
|
||||
mainNode:= Doc.documentElement.FindNode('RDF:Description');
|
||||
}
|
||||
if Assigned(mainNode) then
|
||||
begin
|
||||
InstallManifest.Clear;
|
||||
for I:= 0 to mainNode.ChildNodes.Count - 1 do
|
||||
begin
|
||||
childNode := mainNode.ChildNodes.Item[I];
|
||||
if Assigned(childNode) then
|
||||
with childNode do
|
||||
begin
|
||||
if nodeName = 'em:id' then
|
||||
InstallManifest.ID:= FirstChild.NodeValue
|
||||
else if nodeName = 'em:name' then
|
||||
InstallManifest.Name:= FirstChild.NodeValue
|
||||
else if nodeName = 'em:version' then
|
||||
InstallManifest.Version:= FirstChild.NodeValue
|
||||
else if nodeName = 'em:type' then
|
||||
InstallManifest.AddonType:= AddonType(FirstChild.NodeValue)
|
||||
else if nodeName = 'em:description' then
|
||||
InstallManifest.Description:= FirstChild.NodeValue
|
||||
else if nodeName = 'em:creator' then
|
||||
InstallManifest.Creator:= FirstChild.NodeValue
|
||||
else if nodeName = 'em:contributor' then
|
||||
InstallManifest.Contributor:= AddString(InstallManifest.Contributor, FirstChild.NodeValue)
|
||||
else if nodeName = 'em:developer' then
|
||||
InstallManifest.Developer:= AddString(InstallManifest.Developer, FirstChild.NodeValue)
|
||||
else if nodeName = 'em:translator' then
|
||||
InstallManifest.Translator:= AddString(InstallManifest.Translator, FirstChild.NodeValue)
|
||||
else if nodeName = 'em:homepageURL' then
|
||||
InstallManifest.HomePageURL:= FirstChild.NodeValue
|
||||
else if nodeName = 'em:updateURL' then
|
||||
InstallManifest.UpdateURL:= FirstChild.NodeValue
|
||||
else if nodeName = 'em:targetPlatform' then
|
||||
InstallManifest.TargetPlatform:= AddString(InstallManifest.TargetPlatform, FirstChild.NodeValue)
|
||||
else if nodeName = 'em:targetApplication' then
|
||||
AddApplication(InstallManifest, childNode)
|
||||
else if nodeName = 'em:unpack' then
|
||||
InstallManifest.Unpack:= StrToBoolDef(FirstChild.NodeValue, False);
|
||||
end;
|
||||
end;
|
||||
Result:= True;
|
||||
end;
|
||||
FreeAndNil(Doc);
|
||||
end;
|
||||
finally
|
||||
FreeAndNil(MemoryStream);
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
|
|
@ -1,159 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="9"/>
|
||||
<PathDelim Value="\"/>
|
||||
<General>
|
||||
<Flags>
|
||||
<SaveOnlyProjectUnits Value="True"/>
|
||||
<MainUnitHasCreateFormStatements Value="False"/>
|
||||
<MainUnitHasTitleStatement Value="False"/>
|
||||
</Flags>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<MainUnit Value="0"/>
|
||||
<UseAppBundle Value="False"/>
|
||||
<ResourceType Value="res"/>
|
||||
</General>
|
||||
<VersionInfo>
|
||||
<UseVersionInfo Value="True"/>
|
||||
<MinorVersionNr Value="1"/>
|
||||
<StringTable FileDescription="XPI WDX plugin for Double Commander" LegalCopyright="Copyright (C) 2006-2012 Koblov Alexander" ProductVersion=""/>
|
||||
</VersionInfo>
|
||||
<BuildModes Count="2">
|
||||
<Item1 Name="Release" Default="True"/>
|
||||
<Item2 Name="Debug">
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<Target>
|
||||
<Filename Value="..\xpi_wdx.wdx" ApplyConventions="False"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir);..\..\..\..\sdk"/>
|
||||
<OtherUnitFiles Value="..\..\..\..\sdk"/>
|
||||
<UnitOutputDirectory Value="..\lib"/>
|
||||
</SearchPaths>
|
||||
<Conditionals Value="if (TargetCPU <> 'arm') then
|
||||
begin
|
||||
CustomOptions += '-fPIC';
|
||||
end;
|
||||
|
||||
if (TargetOS = 'darwin') then
|
||||
begin
|
||||
LinkerOptions += ' -no_order_inits';
|
||||
end;"/>
|
||||
<Parsing>
|
||||
<SyntaxOptions>
|
||||
<IncludeAssertionCode Value="True"/>
|
||||
</SyntaxOptions>
|
||||
</Parsing>
|
||||
<CodeGeneration>
|
||||
<Checks>
|
||||
<IOChecks Value="True"/>
|
||||
<RangeChecks Value="True"/>
|
||||
<OverflowChecks Value="True"/>
|
||||
<StackChecks Value="True"/>
|
||||
</Checks>
|
||||
</CodeGeneration>
|
||||
<Linking>
|
||||
<Debugging>
|
||||
<DebugInfoType Value="dsDwarf2Set"/>
|
||||
<UseHeaptrc Value="True"/>
|
||||
<UseExternalDbgSyms Value="True"/>
|
||||
</Debugging>
|
||||
<Options>
|
||||
<PassLinkerOptions Value="True"/>
|
||||
<ExecutableType Value="Library"/>
|
||||
</Options>
|
||||
</Linking>
|
||||
</CompilerOptions>
|
||||
</Item2>
|
||||
</BuildModes>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
<IgnoreBinaries Value="False"/>
|
||||
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
|
||||
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<local>
|
||||
<FormatVersion Value="1"/>
|
||||
<HostApplicationFilename Value="D:\totalcmd\totalcmd.exe"/>
|
||||
<LaunchingApplication PathPlusParams="\usr\X11R6\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/>
|
||||
</local>
|
||||
</RunParams>
|
||||
<Units Count="4">
|
||||
<Unit0>
|
||||
<Filename Value="xpi_wdx.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="xpi_wdx_intf.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit1>
|
||||
<Unit2>
|
||||
<Filename Value="xpi_def.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit2>
|
||||
<Unit3>
|
||||
<Filename Value="xpi_io.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit3>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<Target>
|
||||
<Filename Value="..\xpi_wdx.wdx" ApplyConventions="False"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir);..\..\..\..\sdk"/>
|
||||
<OtherUnitFiles Value="..\..\..\..\sdk"/>
|
||||
<UnitOutputDirectory Value="..\lib"/>
|
||||
</SearchPaths>
|
||||
<Conditionals Value="if (TargetCPU <> 'arm') then
|
||||
begin
|
||||
CustomOptions += '-fPIC';
|
||||
end;
|
||||
|
||||
if (TargetOS = 'darwin') then
|
||||
begin
|
||||
LinkerOptions += ' -no_order_inits';
|
||||
end;
|
||||
|
||||
if (TargetOS = 'linux') then
|
||||
begin
|
||||
LinkerOptions += ' -z relro --as-needed';
|
||||
end;"/>
|
||||
<CodeGeneration>
|
||||
<SmartLinkUnit Value="True"/>
|
||||
<Optimizations>
|
||||
<OptimizationLevel Value="3"/>
|
||||
</Optimizations>
|
||||
</CodeGeneration>
|
||||
<Linking>
|
||||
<Debugging>
|
||||
<GenerateDebugInfo Value="False"/>
|
||||
</Debugging>
|
||||
<LinkSmart Value="True"/>
|
||||
<Options>
|
||||
<PassLinkerOptions Value="True"/>
|
||||
<ExecutableType Value="Library"/>
|
||||
</Options>
|
||||
</Linking>
|
||||
</CompilerOptions>
|
||||
<Debugging>
|
||||
<Exceptions Count="3">
|
||||
<Item1>
|
||||
<Name Value="EAbort"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<Name Value="ECodetoolError"/>
|
||||
</Item2>
|
||||
<Item3>
|
||||
<Name Value="EFOpenError"/>
|
||||
</Item3>
|
||||
</Exceptions>
|
||||
</Debugging>
|
||||
</CONFIG>
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
{
|
||||
Double commander
|
||||
-------------------------------------------------------------------------
|
||||
xpi_wdx is destined to obtainin the information from xpi-files
|
||||
in which extensions and themes for Gecko-based applications are distributed.
|
||||
|
||||
Copyright (C) 2010 Koblov Alexander (Alexx2000@mail.ru)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
}
|
||||
|
||||
library xpi_wdx;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
uses
|
||||
Classes, xpi_wdx_intf, xpi_def, xpi_io
|
||||
{ you can add units after this };
|
||||
|
||||
exports
|
||||
ContentGetDetectString,
|
||||
ContentGetSupportedField,
|
||||
ContentGetValue;
|
||||
|
||||
{$R *.res}
|
||||
|
||||
begin
|
||||
end.
|
||||
|
||||
|
|
@ -1,203 +0,0 @@
|
|||
{
|
||||
Double commander
|
||||
-------------------------------------------------------------------------
|
||||
xpi_wdx is destined to obtainin the information from xpi-files
|
||||
in which extensions and themes for Gecko-based applications are distributed.
|
||||
|
||||
Copyright (C) 2010-2019 Alexander Koblov (alexx2000@mail.ru)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
}
|
||||
|
||||
unit xpi_wdx_intf;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
{$include calling.inc}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, WdxPlugin;
|
||||
|
||||
procedure ContentGetDetectString(DetectString: PAnsiChar; MaxLen: Integer); dcpcall;
|
||||
function ContentGetSupportedField(FieldIndex: Integer; FieldName: PAnsiChar;
|
||||
Units: PAnsiChar; MaxLen: Integer): Integer; dcpcall;
|
||||
function ContentGetValue(FileName: PAnsiChar; FieldIndex, UnitIndex: Integer;
|
||||
FieldValue: PByte; MaxLen, Flags: Integer): Integer; dcpcall;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
xpi_def, xpi_io;
|
||||
|
||||
const
|
||||
IDX_ID = 0;
|
||||
IDX_NAME = 1;
|
||||
IDX_VERSION = 2;
|
||||
IDX_TYPE = 3;
|
||||
IDX_DESCRIPTION = 4;
|
||||
IDX_CREATOR = 5;
|
||||
IDX_DEVELOPER = 6;
|
||||
IDX_CONTRIBUTOR = 7;
|
||||
IDX_TRANSLATOR = 8;
|
||||
IDX_UNPACK = 9;
|
||||
IDX_HOMEPAGEURL = 10;
|
||||
IDX_UPDATEURL = 11;
|
||||
IDX_PLATFORM = 12;
|
||||
IDX_COMPATIBILITY = 13;
|
||||
IDX_FIREFOX = 14;
|
||||
IDX_MOZILLA = 15;
|
||||
IDX_SEAMONKEY = 16;
|
||||
IDX_THUNDERBIRD = 17;
|
||||
IDX_FLOCK = 18;
|
||||
IDX_SUNBIRD = 19;
|
||||
IDX_FENNEC = 20;
|
||||
IDX_PALEMOON = 21;
|
||||
|
||||
FIELD_COUNT = 22;
|
||||
|
||||
var
|
||||
CurrentFileName: AnsiString; // Current *.xpi file
|
||||
InstallManifest: TInstallManifest; // Cache for current file
|
||||
|
||||
function EnsureLength(S: AnsiString; MaxLen: Integer): AnsiString;
|
||||
begin
|
||||
Result := S;
|
||||
if Length(Result) >= MaxLen then
|
||||
begin
|
||||
Result := Copy(Result, 1, MaxLen - 4);
|
||||
Result := Result + '...';
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure ContentGetDetectString(DetectString: PAnsiChar; MaxLen: Integer); dcpcall;
|
||||
begin
|
||||
StrPLCopy(DetectString, 'EXT="XPI"', MaxLen)
|
||||
end;
|
||||
|
||||
function ContentGetSupportedField(FieldIndex: Integer; FieldName: PAnsiChar;
|
||||
Units: PAnsiChar; MaxLen: Integer): Integer; dcpcall;
|
||||
var
|
||||
Field: AnsiString;
|
||||
begin
|
||||
StrPCopy(Units, EmptyStr);
|
||||
|
||||
if FieldIndex >= FIELD_COUNT then
|
||||
begin
|
||||
Result := FT_NOMOREFIELDS;
|
||||
Exit;
|
||||
end;
|
||||
|
||||
if (FieldIndex = IDX_UNPACK) then
|
||||
begin
|
||||
StrPLCopy(FieldName, 'Unpack', MaxLen);
|
||||
Exit(FT_BOOLEAN);
|
||||
end;
|
||||
|
||||
Result := FT_STRING;
|
||||
|
||||
case FieldIndex of
|
||||
IDX_ID: Field := 'ID';
|
||||
IDX_NAME: Field := 'Name';
|
||||
IDX_VERSION: Field := 'Version';
|
||||
IDX_TYPE: Field := 'Type';
|
||||
IDX_DESCRIPTION: Field := 'Description';
|
||||
IDX_CREATOR: Field := 'Creator';
|
||||
IDX_DEVELOPER: Field := 'Developer(s)';
|
||||
IDX_CONTRIBUTOR: Field := 'Contributor(s)';
|
||||
IDX_TRANSLATOR: Field := 'Translator(s)';
|
||||
IDX_HOMEPAGEURL: Field := 'Home page';
|
||||
IDX_UPDATEURL: Field := 'Update URL';
|
||||
IDX_PLATFORM: Field := 'Platform(s)';
|
||||
IDX_COMPATIBILITY: Field := 'Compatibility';
|
||||
IDX_FIREFOX: Field := 'Firefox';
|
||||
IDX_MOZILLA: Field := 'Mozilla Suite';
|
||||
IDX_SEAMONKEY: Field := 'SeaMonkey';
|
||||
IDX_THUNDERBIRD: Field := 'Mozilla Thunderbird';
|
||||
IDX_FLOCK: Field := 'Flock';
|
||||
IDX_SUNBIRD: Field := 'Sunbird';
|
||||
IDX_FENNEC: Field := 'Fennec';
|
||||
IDX_PALEMOON: Field := 'Pale Moon';
|
||||
end;
|
||||
|
||||
StrPLCopy(FieldName, Field, MaxLen);
|
||||
end;
|
||||
|
||||
function ContentGetValue(FileName: PAnsiChar; FieldIndex, UnitIndex: Integer;
|
||||
FieldValue: PByte; MaxLen, Flags: Integer): Integer; dcpcall;
|
||||
var
|
||||
Value : AnsiString;
|
||||
begin
|
||||
Result := FT_FILEERROR;
|
||||
if not FileExists(FileName) then Exit;
|
||||
|
||||
if CurrentFileName <> FileName then
|
||||
begin
|
||||
if not ParseInsatallManifest(FileName, InstallManifest) then Exit;
|
||||
CurrentFileName := FileName;
|
||||
end;
|
||||
|
||||
if (FieldIndex >= FIELD_COUNT) then
|
||||
begin
|
||||
Result := FT_NOSUCHFIELD;
|
||||
Exit;
|
||||
end;
|
||||
|
||||
if (FieldIndex = IDX_UNPACK) then
|
||||
begin
|
||||
PBoolean(FieldValue)^:= InstallManifest.Unpack;
|
||||
Exit(FT_BOOLEAN);
|
||||
end;
|
||||
|
||||
Result := FT_STRING;
|
||||
|
||||
case FieldIndex of
|
||||
IDX_ID: Value := InstallManifest.ID;
|
||||
IDX_NAME: Value := InstallManifest.Name;
|
||||
IDX_VERSION: Value := InstallManifest.Version;
|
||||
IDX_TYPE: Value := InstallManifest.AddonType;
|
||||
IDX_DESCRIPTION: Value := InstallManifest.Description;
|
||||
IDX_CREATOR: Value := InstallManifest.Creator;
|
||||
IDX_DEVELOPER: Value := InstallManifest.Developer;
|
||||
IDX_CONTRIBUTOR: Value := InstallManifest.Contributor;
|
||||
IDX_TRANSLATOR: Value := InstallManifest.Translator;
|
||||
IDX_HOMEPAGEURL: Value := InstallManifest.HomePageURL;
|
||||
IDX_UPDATEURL: Value := InstallManifest.UpdateURL;
|
||||
IDX_PLATFORM: Value := InstallManifest.TargetPlatform;
|
||||
IDX_COMPATIBILITY: Value := InstallManifest.Compatibility;
|
||||
IDX_FIREFOX: Value := InstallManifest.TargetApplication.Values[ApplicationList.Names[0]];
|
||||
IDX_MOZILLA: Value := InstallManifest.TargetApplication.Values[ApplicationList.Names[1]];
|
||||
IDX_SEAMONKEY: Value := InstallManifest.TargetApplication.Values[ApplicationList.Names[2]];
|
||||
IDX_THUNDERBIRD: Value := InstallManifest.TargetApplication.Values[ApplicationList.Names[3]];
|
||||
IDX_FLOCK: Value := InstallManifest.TargetApplication.Values[ApplicationList.Names[4]];
|
||||
IDX_SUNBIRD: Value := InstallManifest.TargetApplication.Values[ApplicationList.Names[5]];
|
||||
IDX_FENNEC: Value := InstallManifest.TargetApplication.Values[ApplicationList.Names[6]];
|
||||
IDX_PALEMOON: Value := InstallManifest.TargetApplication.Values[ApplicationList.Names[7]];
|
||||
else
|
||||
Result := FT_FIELDEMPTY;
|
||||
Exit;
|
||||
end;
|
||||
|
||||
StrPLCopy(PAnsiChar(FieldValue), EnsureLength(Value, MaxLen), MaxLen);
|
||||
end;
|
||||
|
||||
initialization
|
||||
CurrentFileName := EmptyStr;
|
||||
InstallManifest := TInstallManifest.Create;
|
||||
|
||||
finalization
|
||||
FreeAndNil(InstallManifest);
|
||||
|
||||
end.
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue