diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000000..59695180d6
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,68 @@
+
+[*.{appxmanifest,axml,build,c,c++,cc,cginc,compute,config,cp,cpp,csproj,cu,cuh,cxx,dbml,discomap,dtd,h,hh,hlsl,hlsli,hlslinc,hpp,hxx,inc,inl,ino,ipp,jsproj,lsproj,mpp,mq4,mq5,mqh,njsproj,nuspec,proj,props,proto,resw,resx,shader,StyleCop,targets,tasks,tpp,usf,ush,vbproj,xml,xsd}]
+indent_style = space
+indent_size = cs
+tab_width = 4
+
+[*.{asax,ascx,asmdef,aspx,axaml,cs,cshtml,css,htm,html,js,json,jsx,master,paml,razor,resjson,skin,ts,tsx,vb,xaml,xamlx,xoml}]
+indent_style = space
+indent_size = 4
+tab_width = 4
+
+[*]
+
+# Microsoft .NET properties
+csharp_new_line_before_members_in_object_initializers = false
+csharp_preferred_modifier_order = public, private, protected, internal, new, abstract, virtual, sealed, override, static, readonly, extern, unsafe, volatile, async:suggestion
+csharp_style_var_elsewhere = true:suggestion
+csharp_style_var_for_built_in_types = true:suggestion
+csharp_style_var_when_type_is_apparent = true:suggestion
+dotnet_naming_rule.private_constants_rule.severity = warning
+dotnet_naming_rule.private_constants_rule.style = upper_camel_case_style
+dotnet_naming_rule.private_constants_rule.symbols = private_constants_symbols
+dotnet_naming_rule.private_instance_fields_rule.severity = warning
+dotnet_naming_rule.private_instance_fields_rule.style = lower_camel_case_style
+dotnet_naming_rule.private_instance_fields_rule.symbols = private_instance_fields_symbols
+dotnet_naming_rule.private_static_fields_rule.severity = warning
+dotnet_naming_rule.private_static_fields_rule.style = lower_camel_case_style_1
+dotnet_naming_rule.private_static_fields_rule.symbols = private_static_fields_symbols
+dotnet_naming_rule.private_static_readonly_rule.severity = warning
+dotnet_naming_rule.private_static_readonly_rule.style = upper_camel_case_style
+dotnet_naming_rule.private_static_readonly_rule.symbols = private_static_readonly_symbols
+dotnet_naming_style.lower_camel_case_style.capitalization = camel_case
+dotnet_naming_style.lower_camel_case_style_1.capitalization = camel_case
+dotnet_naming_style.lower_camel_case_style_1.required_prefix = _
+dotnet_naming_style.upper_camel_case_style.capitalization = pascal_case
+dotnet_naming_symbols.private_constants_symbols.applicable_accessibilities = private
+dotnet_naming_symbols.private_constants_symbols.applicable_kinds = field
+dotnet_naming_symbols.private_constants_symbols.required_modifiers = const
+dotnet_naming_symbols.private_instance_fields_symbols.applicable_accessibilities = private
+dotnet_naming_symbols.private_instance_fields_symbols.applicable_kinds = field
+dotnet_naming_symbols.private_static_fields_symbols.applicable_accessibilities = private
+dotnet_naming_symbols.private_static_fields_symbols.applicable_kinds = field
+dotnet_naming_symbols.private_static_fields_symbols.required_modifiers = static
+dotnet_naming_symbols.private_static_readonly_symbols.applicable_accessibilities = private
+dotnet_naming_symbols.private_static_readonly_symbols.applicable_kinds = field
+dotnet_naming_symbols.private_static_readonly_symbols.required_modifiers = static,readonly
+dotnet_style_parentheses_in_arithmetic_binary_operators = never_if_unnecessary:none
+dotnet_style_parentheses_in_other_binary_operators = never_if_unnecessary:none
+dotnet_style_parentheses_in_relational_binary_operators = never_if_unnecessary:none
+dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
+dotnet_style_predefined_type_for_member_access = true:suggestion
+dotnet_style_qualification_for_event = false:suggestion
+dotnet_style_qualification_for_field = false:suggestion
+dotnet_style_qualification_for_method = false:suggestion
+dotnet_style_qualification_for_property = false:suggestion
+
+# ReSharper properties
+resharper_default_private_modifier = implicit
+
+# ReSharper inspection severities
+resharper_arrange_redundant_parentheses_highlighting = hint
+resharper_arrange_this_qualifier_highlighting = hint
+resharper_built_in_type_reference_style_for_member_access_highlighting = hint
+resharper_built_in_type_reference_style_highlighting = hint
+resharper_redundant_base_qualifier_highlighting = warning
+resharper_suggest_var_or_type_built_in_types_highlighting = hint
+resharper_suggest_var_or_type_elsewhere_highlighting = hint
+resharper_suggest_var_or_type_simple_types_highlighting = hint
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000000..9068a80499
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,33 @@
+* text=auto
+
+*.cs text eol=crlf
+
+*.h text eol=crlf
+*.c text eol=crlf
+*.cpp text eol=crlf
+
+*.as text eol=crlf
+*.hx text eol=crlf
+
+*.sln text eol=crlf
+*.csproj text eol=crlf
+*.vbproj text eol=crlf
+*.vcxproj text eol=crlf
+*.vcproj text eol=crlf
+*.dbproj text eol=crlf
+*.fsproj text eol=crlf
+*.lsproj text eol=crlf
+*.wixproj text eol=crlf
+*.modelproj text eol=crlf
+*.sqlproj text eol=crlf
+*.wmaproj text eol=crlf
+
+*.xproj text eol=crlf
+*.props text eol=crlf
+*.filters text eol=crlf
+*.vcxitems text eol=crlf
+
+*.bat text eol=crlf
+*.cmd text eol=crlf
+
+*.sh text eol=lf
diff --git a/.gitignore b/.gitignore
index 47461f7170..c868e0da44 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,25 +1,39 @@
Thumbs.db
-*.suo
-*.user
-*.pdb
-*.obj
-*.vshost.exe
-*.vshost.exe.manifest
*.config
+*.fda
*.fdb
*.fdl
-*.fda
*.nupkg
-obj/
-FlashDevelop/Properties/AssemblyInfo.cs
-FlashDevelop/Bin/Debug/FlashDevelop.*
-FlashDevelop/Bin/Debug/PluginCore.*
-FlashDevelop/Bin/Debug/Plugins/
-FlashDevelop/Bin/Debug/Data/
-FlashDevelop/Bin/Debug/Apps/
-FlashDevelop/Bin/Debug/Settings/FormStates/
-PluginCore/Bin
-/FlashDevelop/Bin/Debug/Settings/FileStates
-/FlashDevelop/Bin/Debug/Settings/Recovery
-/FlashDevelop/Bin/Debug/Exceptions.log
+*.obj
+*.pdb
+*.suo
+*.user
+*.vs/
+*.vshost.exe
+*.vshost.exe.manifest
+**/obj/
+**/NSubstitute.*
+**/nunit.framework.*
+**/Castle.Core.*
+/FlashDevelop/Bin/Debug/Apps/
+/FlashDevelop/Bin/Debug/Data/
+/FlashDevelop/Bin/Debug/Plugins/
+/FlashDevelop/Bin/Debug/Settings/FileStates/
+/FlashDevelop/Bin/Debug/Settings/FormStates/
+/FlashDevelop/Bin/Debug/Settings/Recovery/
+/FlashDevelop/Bin/Debug/Settings/Themes/CURRENT
/FlashDevelop/Bin/Debug/Tools/fdbuild/fdbuild.exe
+/FlashDevelop/Bin/Debug/*.Tests.dll
+/FlashDevelop/Bin/Debug/Exceptions.log
+/FlashDevelop/Bin/Debug/FlashDevelop.*
+/FlashDevelop/Bin/Debug/FlashDevelop64.*
+/FlashDevelop/Bin/Debug/PluginCore.*
+/FlashDevelop/Properties/AssemblyInfo.cs
+/FlashDevelop/Scripting.*
+/FlashDevelop/Bin/Debug/CSScriptLibrary.*
+/FlashDevelop/Bin/Debug/Microsoft.*
+/FlashDevelop/Bin/Debug/System.*
+/FlashDevelop/Bin/Debug/Mono.*
+/packages/
+/PluginCore/Bin
+FlashDevelop/Bin/Debug/LitJSON.*
diff --git a/CI/README.md b/CI/README.md
new file mode 100644
index 0000000000..684e27f7d7
--- /dev/null
+++ b/CI/README.md
@@ -0,0 +1 @@
+Coming soon...
diff --git a/CI/build.cmd b/CI/build.cmd
index 42a632aead..da152e4c7b 100644
--- a/CI/build.cmd
+++ b/CI/build.cmd
@@ -1,32 +1,58 @@
:: Builds the binary on the server for CI
:: Set paths
-set PATH=%PATH%;C:\Windows\Microsoft.NET\Framework\v4.0.30319\
-set PATH=%PATH%;C:\Program Files (x86)\Git\bin\
-set PATH=%PATH%;C:\Program Files (x86)\NSIS
-set PATH=%PATH%;C:\Program Files\7-Zip\
+:: set PATH=%PATH%;C:\Windows\Microsoft.NET\Framework\v4.0.30319\
+:: set PATH=%PATH%;C:\Program Files (x86)\Git\bin\
+:: set PATH=%PATH%;C:\Program Files (x86)\NSIS
+:: set PATH=%PATH%;C:\Program Files\7-Zip\
-:: Reset bin files
-git clean -f -x -d FlashDevelop\Bin\Debug
+:flashdevelop
+
+:: Extract version from HEAD
+call SetVersion.bat
+
+:: Build the main solution and run tests
+msbuild FlashDevelop.sln /p:Configuration=Release+Tests /p:Platform="x64" /t:Rebuild %MSBuildLogger%
+
+:: Check for build errors
+if %errorlevel% neq 0 goto :error
+
+if "%AppVeyorCI%" neq "" powershell.exe -file ci\tests.ps1
+
+:: Check for build errors
+if %errorlevel% neq 0 goto :error
+
+:: Build the main solution and run tests
+msbuild FlashDevelop.sln /p:Configuration=Release+Tests /p:Platform="x86" /t:Rebuild %MSBuildLogger%
:: Check for build errors
if %errorlevel% neq 0 goto :error
-:: Build the PluginCore
-msbuild PluginCore\PluginCore.csproj /p:Configuration=Release /p:Platform=x86
+if "%AppVeyorCI%" neq "" powershell.exe -file ci\tests.ps1
:: Check for build errors
if %errorlevel% neq 0 goto :error
+git clean -xfd FlashDevelop\Bin\Debug
+
:: Extract version from HEAD
call SetVersion.bat
-:: Build the solution
-msbuild FlashDevelop.sln /p:Configuration=Release /p:Platform=x86
+nuget restore FlashDevelop.sln
+
+:: Build the solutions
+msbuild FlashDevelop.sln /p:Configuration=Release /p:Platform="Any CPU" /t:Rebuild
+ping -n 5 127.0.0.1 > nul
+msbuild FlashDevelop.sln /p:Configuration=Release /p:Platform=x86 /t:Rebuild
:: Check for build errors
if %errorlevel% neq 0 goto :error
+:: Remove files after build
+del "FlashDevelop\Bin/Debug\System.*" /Q
+del "FlashDevelop\Bin/Debug\Microsoft.*" /Q
+del "FlashDevelop\Bin/Debug\Mono.CSharp.*" /Q
+
:: Create the installer
makensis FlashDevelop\Installer\Installer.nsi
@@ -39,8 +65,60 @@ if %errorlevel% neq 0 goto :error
:: Check for 7zip errors
if %errorlevel% neq 0 goto :error
+:haxedevelop
+
+:: Reset bin files
+git clean -xfd FlashDevelop\Bin\Debug
+
+:: Remove unnecessary files
+rd "FlashDevelop\Bin\Debug\Tools\flexpmd" /s /q
+rd "FlashDevelop\Bin\Debug\Tools\flexlibs\frameworks\libs\player" /s /q
+for /d %%G in ("FlashDevelop\Bin\Debug\Projects\*ActionScript 3*") do rd /s /q "%%~G"
+del "FlashDevelop\Bin\Debug\StartPage\images\*.*" /q
+
+:: Copy distro files
+xcopy Distros\HaxeDevelop /s /e /y
+
+:: Check for build errors
+if %errorlevel% neq 0 goto :error
+
+:: Extract version from HEAD
+call SetVersion.bat
+
+:: Build the solutions
+msbuild FlashDevelop.sln /p:Configuration=Release /p:Platform="Any CPU" /t:Rebuild
+ping -n 5 127.0.0.1 > nul
+msbuild FlashDevelop.sln /p:Configuration=Release /p:Platform=x86 /t:Rebuild
+
+:: Check for build errors
+if %errorlevel% neq 0 goto :error
+
+:: Remove files after build
+del "FlashDevelop\Bin\Debug\Plugins\CodeAnalyzer.dll" /q
+del "FlashDevelop\Bin/Debug\System.*" /Q
+del "FlashDevelop\Bin/Debug\Microsoft.*" /Q
+del "FlashDevelop\Bin/Debug\Mono.CSharp.*" /Q
+
+:: Rename binaries
+ren FlashDevelop\Bin\Debug\FlashDevelop.exe HaxeDevelop.exe
+ren FlashDevelop\Bin\Debug\FlashDevelop64.exe HaxeDevelop64.exe
+ren FlashDevelop\Bin\Debug\FlashDevelop.exe.config HaxeDevelop.exe.config
+ren FlashDevelop\Bin\Debug\FlashDevelop64.exe.config HaxeDevelop64.exe.config
+
+:: Check for build errors
+if %errorlevel% neq 0 goto :error
+
+:: Create the installer
+makensis FlashDevelop\Installer\Installer.nsi
+
+:: Check for nsis errors
+if %errorlevel% neq 0 goto :error
+
+:: Create the archive
+7z a -tzip FlashDevelop\Installer\Binary\HaxeDevelop.zip .\FlashDevelop\Bin\Debug\* -xr!.empty
+
:: Done
-exit
+exit 0
:error
-exit -1
+exit -1
\ No newline at end of file
diff --git a/CI/buildl.cmd b/CI/buildl.cmd
index 3ccef5da2f..877a1a6ada 100644
--- a/CI/buildl.cmd
+++ b/CI/buildl.cmd
@@ -1,24 +1,30 @@
:: Builds the binary locally and launches the installer
:: Set paths
-set PATH=%PATH%;C:\Windows\Microsoft.NET\Framework\v4.0.30319\
-set PATH=%PATH%;C:\Program Files\Git\bin\
-set PATH=%PATH%;C:\Program Files (x86)\Git\bin\
-set PATH=%PATH%;C:\Program Files\7-Zip\
-set PATH=%PATH%;C:\Program Files (x86)\7-Zip\
-set PATH=%PATH%;C:\Program Files (x86)\NSIS
+:: set PATH=%PATH%;C:\Program Files (x86)\MSBuild\15.0\Bin\
+:: set PATH=%PATH%;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin
+:: set PATH=%PATH%;C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\MSBuild\Current\Bin
+:: set PATH=%PATH%;C:\Program Files\Git\bin\
+:: set PATH=%PATH%;C:\Program Files (x86)\Git\bin\
+:: set PATH=%PATH%;C:\Program Files\7-Zip\
+:: set PATH=%PATH%;C:\Program Files (x86)\7-Zip\
+:: set PATH=%PATH%;C:\Program Files (x86)\NSIS
:: Need path up
cd ..
+:flashdevelop
+
:: Reset bin files
git clean -f -x -d FlashDevelop\Bin\Debug
+del FlashDevelop\Installer\Binary\*.exe /Q
+del FlashDevelop\Installer\Binary\*.zip /Q
:: Check for build errors
if %errorlevel% neq 0 goto :error
:: Build the PluginCore
-msbuild PluginCore\PluginCore.csproj /p:Configuration=Release /p:Platform=x86 /t:Rebuild
+msbuild PluginCore\PluginCore.csproj /p:Configuration=Release /p:Platform="AnyCPU" /t:Rebuild
:: Check for build errors
if %errorlevel% neq 0 goto :error
@@ -26,7 +32,9 @@ if %errorlevel% neq 0 goto :error
:: Extract version from HEAD
call SetVersion.bat
-:: Build the solution
+:: Build the solutions
+msbuild FlashDevelop.sln /p:Configuration=Release /p:Platform="Any CPU" /t:Rebuild
+ping -n 5 127.0.0.1 > nul
msbuild FlashDevelop.sln /p:Configuration=Release /p:Platform=x86 /t:Rebuild
:: Check for build errors
@@ -38,16 +46,73 @@ makensis FlashDevelop\Installer\Installer.nsi
:: Check for nsis errors
if %errorlevel% neq 0 goto :error
-:: Delete old and create an new archive
-del FlashDevelop\Installer\Binary\FlashDevelop.zip
+:: Create the archive
7z a -tzip FlashDevelop\Installer\Binary\FlashDevelop.zip .\FlashDevelop\Bin\Debug\* -xr!.empty
:: Check for 7zip errors
if %errorlevel% neq 0 goto :error
-:: Done
+:haxedevelop
+
+:: Reset bin files
+git clean -f -x -d FlashDevelop\Bin\Debug
+
+:: Remove unnecessary files
+rd "FlashDevelop\Bin\Debug\Tools\flexpmd" /s /q
+rd "FlashDevelop\Bin\Debug\Tools\flexlibs\frameworks\libs\player" /s /q
+for /d %%G in ("FlashDevelop\Bin\Debug\Projects\*ActionScript 3*") do rd /s /q "%%~G"
+del "FlashDevelop\Bin\Debug\StartPage\images\*.*" /q
+
+:: Copy distro files
+xcopy Distros\HaxeDevelop /s /e /y
+
+:: Build the PluginCore
+msbuild PluginCore\PluginCore.csproj /p:Configuration=Release /p:Platform="AnyCPU" /t:Rebuild
+
+:: Check for build errors
+if %errorlevel% neq 0 goto :error
+
+:: Extract version from HEAD
+call SetVersion.bat
+
+:: Build the solutions
+msbuild FlashDevelop.sln /p:Configuration=Release /p:Platform="Any CPU" /t:Rebuild
+ping -n 5 127.0.0.1 > nul
+msbuild FlashDevelop.sln /p:Configuration=Release /p:Platform=x86 /t:Rebuild
+
+:: Check for build errors
+if %errorlevel% neq 0 goto :error
+
+:: Rename binaries
+ren FlashDevelop\Bin\Debug\FlashDevelop.exe HaxeDevelop.exe
+ren FlashDevelop\Bin\Debug\FlashDevelop64.exe HaxeDevelop64.exe
+ren FlashDevelop\Bin\Debug\FlashDevelop.exe.config HaxeDevelop.exe.config
+ren FlashDevelop\Bin\Debug\FlashDevelop64.exe.config HaxeDevelop64.exe.config
+
+: Remove files after build
+del "FlashDevelop\Bin\Debug\Plugins\CodeAnalyzer.dll" /q
+
+:: Check for build errors
+if %errorlevel% neq 0 goto :error
+
+:: Create the installer
+makensis FlashDevelop\Installer\Installer.nsi
+
+:: Check for nsis errors
+if %errorlevel% neq 0 goto :error
+
+:: Create the archive
+7z a -tzip FlashDevelop\Installer\Binary\HaxeDevelop.zip .\FlashDevelop\Bin\Debug\* -xr!.empty
+
+:finish
+
+:: Revert distro changes with backup
+git stash save "Local CI Backup..."
+
+:: Done, Run FD
start FlashDevelop\Installer\Binary\FlashDevelop.exe
-exit
+exit 0
:error
+pause
exit -1
diff --git a/CI/deploy.ps1 b/CI/deploy.ps1
index c98cf1abbf..1c28c40d6b 100644
--- a/CI/deploy.ps1
+++ b/CI/deploy.ps1
@@ -13,6 +13,9 @@ Param (
$projectBuildNumber
)
+$fd = $false;
+$hd = $false;
+$fdpr = $false; # Unused at the moment
$login = $variables["SecureLogin"]
$pass = $variables["SecurePass"]
@@ -21,6 +24,11 @@ foreach($artifact in $artifacts.values)
Write-Output "Upload artifact: $($artifact.name)"
$ext = [System.IO.Path]::GetExtension($artifact.name)
$name = [System.IO.Path]::GetFileNameWithoutExtension($artifact.name)
+
+ IF ($name -like "FlashDevelopPR_*") { $fdpr = $true; }
+ ELSEIF ($name -like "FlashDevelop*") { $fd = $true; }
+ ELSEIF ($name -like "HaxeDevelop*") { $hd = $true; }
+
IF ($ext -eq ".xml")
{
# Upload appman.xml file
@@ -38,4 +46,11 @@ $date = Get-Date
$file = [System.IO.Path]::GetTempFileName()
$data = "Build: $projectVersion`r`nTime: " + $date.ToUniversalTime() + " GMT"
$data | Set-Content $file
-ncftpput.exe -u "$login" -p "$pass" -C ftp.flashdevelop.org "$file" "downloads/builds/FlashDevelop-$env:APPVEYOR_REPO_BRANCH.txt";
+IF ($fd)
+{
+ ncftpput.exe -u "$login" -p "$pass" -C ftp.flashdevelop.org "$file" "downloads/builds/FlashDevelop-$env:APPVEYOR_REPO_BRANCH.txt";
+}
+IF ($hd)
+{
+ ncftpput.exe -u "$login" -p "$pass" -C ftp.flashdevelop.org "$file" "downloads/builds/HaxeDevelop-$env:APPVEYOR_REPO_BRANCH.txt";
+}
\ No newline at end of file
diff --git a/CI/tests.ps1 b/CI/tests.ps1
new file mode 100644
index 0000000000..047c27f0db
--- /dev/null
+++ b/CI/tests.ps1
@@ -0,0 +1,57 @@
+# Runs the unit tests, and uploads them to the CI server
+
+Param (
+ $variables = @{},
+ $scriptPath,
+ $buildFolder,
+ $srcFolder,
+ $outFolder,
+ $tempFolder,
+ $projectName,
+ $projectVersion,
+ $projectBuildNumber
+)
+
+If ($env:HAXEPATH -eq $null)
+{
+ cinst.exe haxe --version 4.1.4 -y --no-progress
+ $env:HAXEPATH = [System.IO.Directory]::GetDirectories("C:\ProgramData\chocolatey\lib\haxe", "haxe_*")[0];
+ If ($env:HAXEPATH -eq $null)
+ {
+ Write-Output "HAXEPATH is invalid"
+ exit 1
+ }
+}
+
+If ((Get-Command "nunit3-console.exe" -ErrorAction SilentlyContinue) -ne $null)
+{
+ $path = [System.IO.Directory]::GetCurrentDirectory() + "\FlashDevelop\Bin\Debug"
+ $testFiles = [System.IO.Directory]::GetFiles($path, "*.Tests.dll")
+ IF ($testFiles.Count -eq 0)
+ {
+ Write-Output "No test assemblies found"
+ exit 1
+ }
+
+ cd $path
+ #nunit3-console.exe $testFiles --result=myresults.xml;format=AppVeyor
+ #nunit3-console.exe $testFiles --x86
+ nunit3-console.exe $testFiles
+
+ #It turns out it's not needed to upload the file
+ #if ((Test-Path env:\APPVEYOR_JOB_ID) -And (Test-Path TestResult.xml))
+ #{
+ # $wc = New-Object 'System.Net.WebClient'
+ # $wc.UploadFile("https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path .\TestResult.xml))
+ #}
+
+ if ($LASTEXITCODE -ne 0)
+ {
+ exit 1
+ }
+}
+ELSE
+{
+ Write-Output "NUnit runner not found"
+ exit 1
+}
\ No newline at end of file
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 0000000000..d0d8379463
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,208 @@
+# AppMan entries
+
+If you want to add your plugin, theme or extension to AppMan, you need to do a pull request to the `appman.xml` file adding a new entry inside the FD5 comments. Requirements for the offered plugins, themes or extensions are:
+
+* Code needs to be open source and reviewable in a public repository
+* The item needs to be packaged into a `.fdz` file and provide a MD5 checksum for verification
+* The `.fdz` needs to extract the files to the automated plugin directory: `$(BaseDir)/Plugins`
+
+# Coding style
+
+##### Use spaces instead of tabs with a width of 4
+
+```c#
+public bool IsMember()
+{
+ if (this.value > 2)
+ {
+ return false;
+ }
+ else return true;
+}
+```
+
+##### Naming should be in English and clear
+
+```c#
+private int memberProperty = 0;
+```
+
+##### Use camelCase for private members and uppercase for public properties, methods and types:
+
+```c#
+private int memberProperty = 0;
+
+public string MemberName = "MemberName";
+
+public bool IsMember()
+{
+ return true;
+}
+```
+
+##### Use types without explicit path:
+
+```c#
+private void OnFormActivate(object sender, /*System.*/EventArgs e)
+{
+ // Do something...
+}
+```
+
+##### Do not use extensive extra empty lines and keep the code clean, not like:
+
+```c#
+// Comment...
+private int MemberMethod(int value)
+{
+
+
+
+ // Comment for something...
+
+
+ if (value > 2))
+ {
+
+ //this.oldCode = 0;
+
+
+ // Random notes here
+
+
+
+ return -1;
+ }
+
+
+
+ // Something here too...
+ else return value;
+
+
+
+
+ //Little bit here too...
+}
+```
+
+##### Use brackets and parenthesis for easier readability:
+
+```c#
+if ((val1 > val2) && (val1 > val3))
+{
+ if (val2 > val3)
+ {
+ doThing();
+ }
+}
+```
+
+##### Do not nest expressions without brackets:
+
+```c#
+if (val1 > val2 && val1 > val3)
+
+ if (val2 > val3)
+
+ doThing();
+
+```
+
+##### Use can use one liners to shorten the code:
+
+```c#
+if (val1 > val2 && val1 > val3)
+{
+ if (val2 > val3) doThing();
+}
+```
+
+##### Use explicit types:
+
+```c#
+int myValue = 0;
+Point[] myPoints = new Point[]
+{
+ new Point(1, 1),
+ new Point(2, 2)
+}
+```
+
+##### Code example:
+
+```c#
+using System;
+
+namespace MyNameSpace
+{
+ class MyClass
+ {
+ // Comment here...
+ private int memberProperty = 0;
+ private int memberProperty2 = 1;
+ private int memberProperty3 = 2;
+
+ // Comment here...
+ public string MemberName = "MemberName";
+
+ // Comment here...
+ public static bool IsMemberProperty = false;
+
+ // Comment here...
+ public const int CONSTANT = 1;
+
+ ///
+ /// Comment here...
+ ///
+ public bool IsMember()
+ {
+ return true;
+ }
+
+ ///
+ /// Comment here...
+ ///
+ public void MemberMethod(int value)
+ {
+ int temp = CONSTANT;
+ if (value > 2)
+ {
+ this.memberProperty2 = temp;
+ this.memberProperty3 = temp;
+ }
+ else this.memberProperty3 = value;
+ }
+
+ ///
+ /// Comment here...
+ ///
+ private int MemberMethodEx(int value)
+ {
+ int temp = CONSTANT;
+ this.memberProperty3 = temp;
+ switch (value)
+ {
+ case 1: return 1;
+ case 2:
+ {
+ return -1;
+ }
+ default: return value;
+ }
+ }
+
+ ///
+ /// Comment here...
+ ///
+ private void OnFormActivate(object sender, EventArgs e)
+ {
+ this.MemberMethod(null, null);
+ }
+
+ }
+
+}
+```
+
+##### More generally, be consistent and keep the code clean!
diff --git a/Distros/HaxeDevelop/FlashDevelop/Bin/Debug/Docs/index.html b/Distros/HaxeDevelop/FlashDevelop/Bin/Debug/Docs/index.html
new file mode 100644
index 0000000000..40c76b8a41
--- /dev/null
+++ b/Distros/HaxeDevelop/FlashDevelop/Bin/Debug/Docs/index.html
@@ -0,0 +1,73 @@
+
+
+
+ HaxeDevelop
+
+
+
+
+
+
+
+
+
+
Description
+
HaxeDevelop is a highly customizable lightweight script editor with extended support for class
+ based languages. Altought the program is designed mostly for Haxe, other languages can
+ be implemented quite easily too. HaxeDevelop requires the Microsoft.NET 4.0 Framework. You can support us by
+ donating for the project via PayPal . Any donation, even 1$, is good for the project. Code contributions are also welcome.
+
You can find more info about HaxeDevelop from the project website haxedevelop.org .
+
+
HaxeDevelop is a custom distribution of FlashDevelop .
+
+
Used Icons
+
Current smooth HaxeDevelop icons are free icons downloaded from
+ famfamfam.com , visualfarm.com and fatcow.com .
+ The icons are released under Creative Commons Attribution 2.5 and 3 Licenses. Some of the used icons are modified from the original ones.
+
+
Used Tools
+
HaxeDevelop includes few third party tools by default. The listed tools are copyright of their respective owners.
+
+
+
Components
+
HaxeDevelop is programmed with C# and it includes misc. modified and unmodified components. DockPanel
+ Suite is used for docking windows and ScintillaNET wrapper is used for providing the Scintilla editor control for C#.
+ The listed components are copyright of their respective owners.
+
+
+
Licence
+
Copyright (c) 2018 Haxe Foundation - HaxeDevelop.org
+
Portions copyright Mika Palmu, Philippe Elsass and all helpful contributors.
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
+ documentation files (the "Software"), to deal in the Software without restriction, including without limitation
+ the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
+ to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
The above copyright notice and this permission notice shall be included in all copies or portions of the Software.
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
+ TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+
+
+
+
+
diff --git a/Distros/HaxeDevelop/FlashDevelop/Bin/Debug/Docs/styles.css b/Distros/HaxeDevelop/FlashDevelop/Bin/Debug/Docs/styles.css
new file mode 100644
index 0000000000..f858f058a1
--- /dev/null
+++ b/Distros/HaxeDevelop/FlashDevelop/Bin/Debug/Docs/styles.css
@@ -0,0 +1,65 @@
+body, html
+{
+ font-size:14px;
+ font-family:"Segoe UI", "Trebuchet MS", Georgia, Arial, sans-serif;
+ padding:0;
+ margin:0;
+}
+h4
+{
+ font-size: 24px;
+}
+ul
+{
+ margin: 0px;
+ padding: 0px;
+ margin-left: 3px;
+}
+a
+{
+ color:#257fc2;
+ text-decoration:none;
+}
+
+a:hover
+{
+ color:#257fc2;
+ text-decoration:underline;
+}
+#header
+{
+ width: 100%;
+ text-align:center;
+ background:#257fc2 url('../StartPage/images/pattern.png') center top;
+ margin:0;
+}
+#header h3
+{
+ color: #eea21a;
+}
+#header h3 img
+{
+ margin-right: 5px;
+ margin-bottom: -3px;
+}
+.innerContent
+{
+ padding: 20px;
+}
+#content
+{
+ width: 100%;
+}
+#content ul
+{
+ padding: 5px;
+ padding-bottom: 0px;
+ padding-left: 15px;
+}
+#footer
+{
+ width: 100%;
+ border-top: 1px dotted grey;
+ padding-top: 11px;
+ margin-top: 11px;
+}
diff --git a/Distros/HaxeDevelop/FlashDevelop/Bin/Debug/StartPage/images/haxedevelop.gif b/Distros/HaxeDevelop/FlashDevelop/Bin/Debug/StartPage/images/haxedevelop.gif
new file mode 100644
index 0000000000..81189df9a9
Binary files /dev/null and b/Distros/HaxeDevelop/FlashDevelop/Bin/Debug/StartPage/images/haxedevelop.gif differ
diff --git a/Distros/HaxeDevelop/FlashDevelop/Bin/Debug/StartPage/images/pattern.png b/Distros/HaxeDevelop/FlashDevelop/Bin/Debug/StartPage/images/pattern.png
new file mode 100644
index 0000000000..ff5ee01a4f
Binary files /dev/null and b/Distros/HaxeDevelop/FlashDevelop/Bin/Debug/StartPage/images/pattern.png differ
diff --git a/Distros/HaxeDevelop/FlashDevelop/Bin/Debug/StartPage/index.html b/Distros/HaxeDevelop/FlashDevelop/Bin/Debug/StartPage/index.html
new file mode 100644
index 0000000000..a8c2d25d1c
--- /dev/null
+++ b/Distros/HaxeDevelop/FlashDevelop/Bin/Debug/StartPage/index.html
@@ -0,0 +1,71 @@
+
+
+
+ Start Page
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Distros/HaxeDevelop/FlashDevelop/Bin/Debug/StartPage/javascript/startpage.js b/Distros/HaxeDevelop/FlashDevelop/Bin/Debug/StartPage/javascript/startpage.js
new file mode 100644
index 0000000000..686ad54df1
--- /dev/null
+++ b/Distros/HaxeDevelop/FlashDevelop/Bin/Debug/StartPage/javascript/startpage.js
@@ -0,0 +1,197 @@
+/**
+* Templates used by the start page.
+*/
+var rssFeedItemTemplate = "";
+var projectItemTemplate = "{0} ";
+var tooltipTextTemplate = "{0}" + getLocaleString("tooltipTextType") + " {1}" + getLocaleString("tooltipTextCreated") + " {2}" + getLocaleString("tooltipTextModified") + " {3}";
+var versionAvailableTemplate = "{0}: " + getLocaleString("downloadVersionHere") + " ";
+var versionOutOfDateTemplate = "" + getLocaleString("yourVersionIsOutOfDate") + "
";
+var versionNotAvailableTemplate = "" + getLocaleString("versionInfoNotAvailable") + "
";
+
+/**
+* Parses XML document from string.
+*/
+function parseXmlDocument(xml)
+{
+ var parser = new ActiveXObject("Microsoft.XMLDOM");
+ parser.async = "false";
+ parser.loadXML(xml);
+ return parser;
+}
+
+/**
+* Downloads text document from url.
+*/
+function loadTextDocument(url, callback)
+{
+ var loader = new ActiveXObject("Microsoft.XMLHTTP");
+ loader.onreadystatechange = function()
+ {
+ if (loader.readyState == 4)
+ {
+ callback(loader.responseText, loader.status);
+ }
+ };
+ loader.open("GET", url, true);
+ loader.send(null);
+}
+
+/**
+* Parses the recent project xml document.
+*/
+function handleProjectXml(xml)
+{
+ var html = "";
+ var projects = new Array();
+ var nodes = xml.getElementsByTagName("RecentProject");
+ if (nodes.length === 0) html = getLocaleString("recentProjectsNotFound");
+ for (var i = 0; i < nodes.length; i++)
+ {
+ var name = getNodeText(nodes[i].getElementsByTagName("Name"));
+ var type = getNodeText(nodes[i].getElementsByTagName("Type"));
+ var path = getNodeText(nodes[i].getElementsByTagName("Path")).replace(/\\/g, "\\\\");
+ var created = getNodeText(nodes[i].getElementsByTagName("Created"));
+ var modified = getNodeText(nodes[i].getElementsByTagName("Modified"));
+ var typeDesc = getProjectType(type); // Description of project file type...
+ html += formatString(projectItemTemplate, name, addSlashes(path), typeDesc);
+ }
+ var element = document.getElementById("projectsContent");
+ element.innerHTML = "";
+}
+
+function addSlashes(s)
+{
+ return s.split("'").join("\\'");
+}
+
+/**
+* Parses the rss feed xml document.
+*/
+function handleRssFeedXml(text, status)
+{
+ var html = "";
+ var xml = parseXmlDocument(text);
+ if (status == 200)
+ {
+ var items = new Array();
+ var xmlItems = xml.getElementsByTagName("item");
+ var xmlTitle = getNodeText(xml.getElementsByTagName("title"));
+ document.getElementById("rssTitle").innerHTML = xmlTitle;
+ for (var i = 0; i < xmlItems.length; i++)
+ {
+ var title = getNodeText(xmlItems[i].getElementsByTagName("title"));
+ var link = getNodeText(xmlItems[i].getElementsByTagName("link")).replace(/\\/g, "\\\\");
+ var desc = getNodeText(xmlItems[i].getElementsByTagName("description"));
+ html += formatString(rssFeedItemTemplate, title, link, desc);
+ //if (i != xmlItems.length - 1) html += " ";
+ }
+ }
+ else
+ {
+ html = getLocaleString("rssFeedNotAvailable");
+ }
+ var element = document.getElementById("rssContent");
+ element.innerHTML = html;
+}
+
+/**
+* Safe text extraction
+*/
+function getNodeText(nodes)
+{
+ if (nodes == null) return ""; //"#ERR#1";
+ if (nodes.length == 0) return ""; //"#ERR#2";
+ if (nodes[0].firstChild == null) return ""; //"#ERR#3";
+ return nodes[0].firstChild.nodeValue;
+}
+
+/**
+* Handles the downloaded version info.
+*/
+function handleVersionInfo(text, status)
+{
+ var html = "";
+ if (status == 200)
+ {
+ var info = text.split(/[\r\n]+/g);
+ var version = decodeURIComponent(getUrlParameter("v"));
+ html = formatString(versionAvailableTemplate, info[0], info[1]);
+ if (version && ((info[0] < version) - (version < info[0])) == -1)
+ {
+ html += formatString(versionOutOfDateTemplate, version);
+ }
+ }
+ else html = versionNotAvailableTemplate;
+ var element = document.getElementById("versionContent");
+ element.innerHTML = html;
+}
+
+/**
+* Gets the localized text for the id.
+*/
+function getLocaleString(id)
+{
+ var lang = getUrlParameter("l") || "en_US";
+ return locale[lang + "." + id] || id;
+}
+
+/**
+* Gets the type of the project file.
+*/
+function getProjectType(extension)
+{
+ switch (extension)
+ {
+ case ".fdp" : return getLocaleString("projectTypeFDP");
+ case ".as2proj" : return getLocaleString("projectTypeAS2");
+ case ".as3proj" : return getLocaleString("projectTypeAS3");
+ case ".fdproj" : return getLocaleString("projectTypeGeneric");
+ case ".hxproj" : return getLocaleString("projectTypeHaxe");
+ case ".lsproj" : return getLocaleString("projectTypeLoom");
+ default : return getLocaleString("projectTypeUnknown");
+ }
+}
+
+/**
+* Gets the value of the specified url parameter.
+*/
+function getUrlParameter(id)
+{
+ id = id.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
+ var regex = new RegExp("[?&]" + id + "=([^]*)");
+ var results = regex.exec(unescape(window.location.href));
+ if (results == null) return "";
+ else return results[1];
+}
+
+/**
+* Formats the string with the specified arguments.
+*/
+function formatString(text)
+{
+ var result = text;
+ for (var i = 1; i < arguments.length; i++)
+ {
+ var pattern = "{" + (i - 1) + "}";
+ while (result.indexOf(pattern) >= 0)
+ {
+ result = result.replace(pattern, arguments[i]);
+ }
+ }
+ return result;
+}
+
+/**
+* Handles the data sent by FlashDevelop.
+*/
+function handleXmlData(projectXml, rssUrl)
+{
+ if (rssUrl != null)
+ {
+ var hdUrl = "https://haxedevelop.org/latest.txt";
+ loadTextDocument(hdUrl, handleVersionInfo);
+ loadTextDocument(rssUrl, handleRssFeedXml);
+ }
+ var xml = parseXmlDocument(projectXml);
+ handleProjectXml(xml);
+}
diff --git a/Distros/HaxeDevelop/FlashDevelop/Bin/Debug/StartPage/styles.css b/Distros/HaxeDevelop/FlashDevelop/Bin/Debug/StartPage/styles.css
new file mode 100644
index 0000000000..290883eea3
--- /dev/null
+++ b/Distros/HaxeDevelop/FlashDevelop/Bin/Debug/StartPage/styles.css
@@ -0,0 +1,239 @@
+html,body
+{
+ width:100%;
+ height:100%;
+}
+
+body
+{
+ background:#257fc2 url(images/pattern.png) center top;
+ font-size:14px;
+ font-family:"Segoe UI", "Trebuchet MS", Georgia, Arial, sans-serif;
+ color:#fff;
+ box-shadow:inset 0 0 50px rgba(0,0,0,0.35);
+ margin:0;
+ padding:0;
+}
+
+.clearfix:after {
+ visibility: hidden;
+ display: block;
+ font-size: 0;
+ content: " ";
+ clear: both;
+ height: 0;
+}
+
+* html .clearfix { zoom: 1; } /* IE6 */
+*:first-child+html .clearfix { zoom: 1; } /* IE7 */
+
+h1,h2,h3
+{
+ border-bottom:1px dashed rgba(255,255,255,.5);
+ font-weight:400;
+ padding:10px;
+ margin:0 0 0 0;
+}
+
+#header
+{
+ text-align:center;
+}
+
+#links
+{
+ background:#333;
+ padding:10px;
+ text-align:right;
+}
+
+#links a
+{
+ color:#fff;
+ font:normal 14px "Segoe UI", arial, sans-serif;
+ margin-right:5px;
+}
+
+#news
+{
+ background:#fbfbfb;
+ color:#333;
+}
+
+.button
+{
+ font-size:14px;
+ display:inline-block;
+ margin-right:5px;
+ margin-bottom:5px;
+ border-radius:3px;
+ text-decoration:none;
+ padding:7px 7px;
+}
+#projects .button {
+ width:48%;
+}
+
+#version .button {
+ width:99%;
+}
+
+img,a img
+{
+ border:none;
+ outline:none;
+}
+
+a
+{
+ color:#ff9;
+ text-decoration:none;
+ display:inline-block;
+}
+
+a:hover
+{
+ color:#ee6;
+ text-decoration:underline;
+}
+
+div#tooltip
+{
+ top:0;
+ left:0;
+ z-index:2;
+ visibility:hidden;
+ position:absolute;
+ background-color:#333;
+ border:1px solid #999;
+ padding:4px 7px 3px;
+ color:#fff;
+ font-size:14px;
+}
+
+table#holder
+{
+ text-align:left;
+ position:absolute;
+ width:100%;
+ top:115px;
+ padding:1px;
+}
+
+td.holderSpacer
+{
+ width:15px;
+}
+
+td.smallWindowHolder
+{
+ width:280px;
+}
+
+div#tasksContent
+{
+ padding-bottom:10px;
+ padding-left:5px;
+}
+
+#projectsContent li
+{
+ background:#257fc2 url(images/iconProject.gif) no-repeat 9px center;
+ display:block;
+ padding: 5px 5px 5px 32px;
+ margin-bottom:2px;
+ border:1px solid #7db3db;
+ border-radius:3px;
+ cursor:pointer;
+}
+#projectsContent li:hover {
+ background-color:#333;
+ border:1px solid #b2d1e8;
+}
+
+#rssContent li
+{
+ margin:0;
+ padding:0;
+}
+
+.rssItemTitle
+{
+ display:block;
+}
+
+.rssItemContent
+{
+ color:#111;
+}
+
+.rssItemContent a
+{
+ font-weight:700;
+}
+
+#rssContent a
+{
+ color:#257fc2;
+ text-decoration:none;
+}
+
+#rssContent a:hover
+{
+ color:#257fc2;
+ text-decoration:underline;
+}
+
+
+#social a:hover img
+{
+ opacity:.8;
+}
+
+.greyedOut
+{
+ color:#ccc;
+}
+
+.alertRed
+{
+ color:red;
+}
+
+.section-gray
+{
+ background:#141419;
+ background:#257fc2 url(images/pattern.png) center top;
+}
+
+#header
+{
+ width:33%;
+}
+
+#projects
+{
+ width:33%;
+}
+
+#projectslist
+{
+ width:33%;
+}
+
+#projectslist, #projects, #header
+{
+ float:left;
+}
+
+.innerContent
+{
+ padding:20px 10px 20px 20px;
+}
+
+div#projectsContent ul,li,div#rssContent ul,li
+{
+ list-style-type:none;
+ margin:0;
+ padding:0;
+}
\ No newline at end of file
diff --git a/Distros/HaxeDevelop/FlashDevelop/Bin/Debug/Tools/appman/Config.xml b/Distros/HaxeDevelop/FlashDevelop/Bin/Debug/Tools/appman/Config.xml
new file mode 100644
index 0000000000..d21e43be5f
--- /dev/null
+++ b/Distros/HaxeDevelop/FlashDevelop/Bin/Debug/Tools/appman/Config.xml
@@ -0,0 +1,19 @@
+
+
+
+ HaxeDevelop
+
+ FD5,HD5,Haxelib
+
+ $(BaseDir)\Apps
+
+ http://www.flashdevelop.org/appman.xml
+
+ http://www.flashdevelop.org/wikidocs/
+
+ $(BaseDir)
+
+ $(BaseDir)\Data\AppMan
+
+ en_US
+
\ No newline at end of file
diff --git a/Distros/HaxeDevelop/FlashDevelop/Bin/Debug/Tools/winres/winres.exe b/Distros/HaxeDevelop/FlashDevelop/Bin/Debug/Tools/winres/winres.exe
new file mode 100755
index 0000000000..21f3476540
Binary files /dev/null and b/Distros/HaxeDevelop/FlashDevelop/Bin/Debug/Tools/winres/winres.exe differ
diff --git a/Distros/HaxeDevelop/FlashDevelop/Installer/Config.nsh b/Distros/HaxeDevelop/FlashDevelop/Installer/Config.nsh
new file mode 100644
index 0000000000..2f2f8b634e
--- /dev/null
+++ b/Distros/HaxeDevelop/FlashDevelop/Installer/Config.nsh
@@ -0,0 +1,7 @@
+; Define distro config
+!define DIST_NAME "HaxeDevelop"
+!define DIST_COMP "HaxeDevelop.org"
+!define DIST_COPY "HaxeDevelop.org 2005-2018"
+!define DIST_README "http://haxedevelop.org"
+!define DIST_COMMUNITY "https://haxedevelop.org/blog/"
+!define DIST_DOCS "https://haxedevelop.org";
diff --git a/Distros/HaxeDevelop/FlashDevelop/Installer/Graphics/Banner.bmp b/Distros/HaxeDevelop/FlashDevelop/Installer/Graphics/Banner.bmp
new file mode 100644
index 0000000000..9c56ddcbb2
Binary files /dev/null and b/Distros/HaxeDevelop/FlashDevelop/Installer/Graphics/Banner.bmp differ
diff --git a/Distros/HaxeDevelop/FlashDevelop/Installer/Graphics/Wizard.bmp b/Distros/HaxeDevelop/FlashDevelop/Installer/Graphics/Wizard.bmp
new file mode 100644
index 0000000000..1c0bb2dd15
Binary files /dev/null and b/Distros/HaxeDevelop/FlashDevelop/Installer/Graphics/Wizard.bmp differ
diff --git a/Distros/HaxeDevelop/FlashDevelop/Resources/AboutDialog.jpg b/Distros/HaxeDevelop/FlashDevelop/Resources/AboutDialog.jpg
new file mode 100644
index 0000000000..04ed513e42
Binary files /dev/null and b/Distros/HaxeDevelop/FlashDevelop/Resources/AboutDialog.jpg differ
diff --git a/Distros/HaxeDevelop/FlashDevelop/Resources/FlashDevelopIcon.ico b/Distros/HaxeDevelop/FlashDevelop/Resources/FlashDevelopIcon.ico
new file mode 100644
index 0000000000..d019c1e5c8
Binary files /dev/null and b/Distros/HaxeDevelop/FlashDevelop/Resources/FlashDevelopIcon.ico differ
diff --git a/Distros/HaxeDevelop/PluginCore/PluginCore/DistroConfig.cs b/Distros/HaxeDevelop/PluginCore/PluginCore/DistroConfig.cs
new file mode 100644
index 0000000000..5cd871dd5e
--- /dev/null
+++ b/Distros/HaxeDevelop/PluginCore/PluginCore/DistroConfig.cs
@@ -0,0 +1,20 @@
+using System;
+
+namespace PluginCore
+{
+ public class DistroConfig
+ {
+ public const string DISTRIBUTION_NAME = "HaxeDevelop";
+ public const string DISTRIBUTION_DESC = "HaxeDevelop is an open source script editor.";
+ public const string DISTRIBUTION_HOME = "https://haxedevelop.org/";
+ public const string DISTRIBUTION_HELP = "https://haxedevelop.org/system-requirements.html";
+ public const string DISTRIBUTION_VERSION = "https://haxedevelop.org/latest.txt";
+ public const string DISTRIBUTION_ABOUT = "HaxeDevelop logo, domain and the name are copyright of Haxe Foundation.\r\nHaxeDevelop is a custom distribution of FlashDevelop.\r\nDevelopment: Mika Palmu, Philippe Elsass and all helpful contributors.";
+ public const string DISTRIBUTION_COPYRIGHT = "HaxeDevelop.org 2015-2020";
+ public const string DISTRIBUTION_COMPANY = "HaxeDevelop.org";
+ public const string DISTRIBUTION_RSS = "https://haxedevelop.org/rss.xml";
+ public const string DISTRIBUTION_EXT = "hx";
+ public const string DISTRIBUTION_DEV_VERSION = "https://flashdevelop.org/downloads/builds/HaxeDevelop-development.txt";
+ public const string DISTRIBUTION_DEV_BUILD = "https://flashdevelop.org/downloads/builds/HaxeDevelop-development.exe";
+ }
+}
\ No newline at end of file
diff --git a/Distros/README.md b/Distros/README.md
new file mode 100644
index 0000000000..5287a78ecd
--- /dev/null
+++ b/Distros/README.md
@@ -0,0 +1,7 @@
+# FlashDevelop distros
+
+## Haxedevelop
+
+HaxeDevelop a custom distribution of FlashDevelop where editor configuration is focussed on [Haxe](https://haxe.org/).
+
+* More info:
diff --git a/External/3rdParty/Aga-1.7/Aga.Controls/Aga.Controls.csproj b/External/3rdParty/Aga-1.7/Aga.Controls/Aga.Controls.csproj
index 971dd42090..de5b13bbf6 100644
--- a/External/3rdParty/Aga-1.7/Aga.Controls/Aga.Controls.csproj
+++ b/External/3rdParty/Aga-1.7/Aga.Controls/Aga.Controls.csproj
@@ -1,10 +1,8 @@
-
+
Debug
AnyCPU
- 9.0.30729
- 2.0
{E73BB233-D88B-44A7-A98F-D71EE158381D}
Library
Properties
@@ -22,10 +20,14 @@
key.snk
- 3.5
- v2.0
+ net48
+ true
+ false
+ false
+ false
+
true
@@ -237,12 +239,4 @@
-
-
\ No newline at end of file
diff --git a/External/3rdParty/Aga-1.7/Aga.Controls/Properties/Resources.Designer.cs b/External/3rdParty/Aga-1.7/Aga.Controls/Properties/Resources.Designer.cs
index 948b9545c0..cbfdbd0b10 100644
--- a/External/3rdParty/Aga-1.7/Aga.Controls/Properties/Resources.Designer.cs
+++ b/External/3rdParty/Aga-1.7/Aga.Controls/Properties/Resources.Designer.cs
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
//
// This code was generated by a tool.
-// Runtime Version:4.0.30319.1
+// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -60,6 +60,9 @@ internal Resources() {
}
}
+ ///
+ /// Looks up a localized resource of type System.Drawing.Bitmap.
+ ///
internal static System.Drawing.Bitmap check {
get {
object obj = ResourceManager.GetObject("check", resourceCulture);
@@ -67,6 +70,9 @@ internal static System.Drawing.Bitmap check {
}
}
+ ///
+ /// Looks up a localized resource of type System.Byte[].
+ ///
internal static byte[] DVSplit {
get {
object obj = ResourceManager.GetObject("DVSplit", resourceCulture);
@@ -74,6 +80,9 @@ internal static byte[] DVSplit {
}
}
+ ///
+ /// Looks up a localized resource of type System.Drawing.Bitmap.
+ ///
internal static System.Drawing.Bitmap Folder {
get {
object obj = ResourceManager.GetObject("Folder", resourceCulture);
@@ -81,6 +90,9 @@ internal static System.Drawing.Bitmap Folder {
}
}
+ ///
+ /// Looks up a localized resource of type System.Drawing.Bitmap.
+ ///
internal static System.Drawing.Bitmap FolderClosed {
get {
object obj = ResourceManager.GetObject("FolderClosed", resourceCulture);
@@ -88,6 +100,9 @@ internal static System.Drawing.Bitmap FolderClosed {
}
}
+ ///
+ /// Looks up a localized resource of type System.Drawing.Bitmap.
+ ///
internal static System.Drawing.Bitmap Leaf {
get {
object obj = ResourceManager.GetObject("Leaf", resourceCulture);
@@ -95,6 +110,9 @@ internal static System.Drawing.Bitmap Leaf {
}
}
+ ///
+ /// Looks up a localized resource of type System.Byte[].
+ ///
internal static byte[] loading_icon {
get {
object obj = ResourceManager.GetObject("loading_icon", resourceCulture);
@@ -102,6 +120,9 @@ internal static byte[] loading_icon {
}
}
+ ///
+ /// Looks up a localized resource of type System.Drawing.Bitmap.
+ ///
internal static System.Drawing.Bitmap minus {
get {
object obj = ResourceManager.GetObject("minus", resourceCulture);
@@ -109,6 +130,9 @@ internal static System.Drawing.Bitmap minus {
}
}
+ ///
+ /// Looks up a localized resource of type System.Drawing.Bitmap.
+ ///
internal static System.Drawing.Bitmap plus {
get {
object obj = ResourceManager.GetObject("plus", resourceCulture);
@@ -116,6 +140,9 @@ internal static System.Drawing.Bitmap plus {
}
}
+ ///
+ /// Looks up a localized resource of type System.Drawing.Bitmap.
+ ///
internal static System.Drawing.Bitmap uncheck {
get {
object obj = ResourceManager.GetObject("uncheck", resourceCulture);
@@ -123,6 +150,9 @@ internal static System.Drawing.Bitmap uncheck {
}
}
+ ///
+ /// Looks up a localized resource of type System.Drawing.Bitmap.
+ ///
internal static System.Drawing.Bitmap unknown {
get {
object obj = ResourceManager.GetObject("unknown", resourceCulture);
diff --git a/External/3rdParty/Aga-1.7/Aga.Controls/Tree/Input/ReorderColumnState.cs b/External/3rdParty/Aga-1.7/Aga.Controls/Tree/Input/ReorderColumnState.cs
index 952227e974..0fc3bd2743 100644
--- a/External/3rdParty/Aga-1.7/Aga.Controls/Tree/Input/ReorderColumnState.cs
+++ b/External/3rdParty/Aga-1.7/Aga.Controls/Tree/Input/ReorderColumnState.cs
@@ -41,7 +41,7 @@ public ReorderColumnState(TreeViewAdv tree, TreeColumn column, Point initialMous
{
_location = new Point(initialMouseLocation.X + Tree.OffsetX, 0);
_dragOffset = tree.GetColumnX(column) - initialMouseLocation.X;
- _ghostImage = column.CreateGhostImage(new Rectangle(0, 0, column.Width, tree.ActualColumnHeaderHeight), tree.Font);
+ _ghostImage = column.CreateGhostImage(new Rectangle(0, 0, column.Width, tree.ActualColumnHeaderHeight), tree.Font, tree.ForeColor);
}
public override void KeyDown(KeyEventArgs args)
diff --git a/External/3rdParty/Aga-1.7/Aga.Controls/Tree/TreeColumn.cs b/External/3rdParty/Aga-1.7/Aga.Controls/Tree/TreeColumn.cs
index d1cb728b15..713b5e4d38 100644
--- a/External/3rdParty/Aga-1.7/Aga.Controls/Tree/TreeColumn.cs
+++ b/External/3rdParty/Aga-1.7/Aga.Controls/Tree/TreeColumn.cs
@@ -288,23 +288,22 @@ private static void CreateRenderers()
}
}
- internal Bitmap CreateGhostImage(Rectangle bounds, Font font)
+ internal Bitmap CreateGhostImage(Rectangle bounds, Font font, Color color)
{
Bitmap b = new Bitmap(bounds.Width, bounds.Height, PixelFormat.Format32bppArgb);
Graphics gr = Graphics.FromImage(b);
gr.FillRectangle(SystemBrushes.ControlDark, bounds);
- DrawContent(gr, bounds, font);
+ DrawContent(gr, bounds, font, color);
BitmapHelper.SetAlphaChanelValue(b, 150);
return b;
}
- internal void Draw(Graphics gr, Rectangle bounds, Font font, bool pressed, bool hot)
+ internal void Draw(Graphics gr, Rectangle bounds, Font font, bool pressed, bool hot, Color color)
{
- DrawBackground(gr, bounds, pressed, hot);
- DrawContent(gr, bounds, font);
+ DrawContent(gr, bounds, font, color);
}
- private void DrawContent(Graphics gr, Rectangle bounds, Font font)
+ private void DrawContent(Graphics gr, Rectangle bounds, Font font, Color color)
{
Rectangle innerBounds = new Rectangle(bounds.X + HeaderLeftMargin, bounds.Y,
bounds.Width - HeaderLeftMargin - HeaderRightMargin,
@@ -331,9 +330,9 @@ private void DrawContent(Graphics gr, Rectangle bounds, Font font)
}
if (textSize.Width < maxTextSize.Width)
- TextRenderer.DrawText(gr, Header, font, innerBounds, SystemColors.ControlText, _baseHeaderFlags | TextFormatFlags.Left);
+ TextRenderer.DrawText(gr, Header, font, innerBounds, color, _baseHeaderFlags | TextFormatFlags.Left);
else
- TextRenderer.DrawText(gr, Header, font, innerBounds, SystemColors.ControlText, _headerFlags);
+ TextRenderer.DrawText(gr, Header, font, innerBounds, color, _headerFlags);
}
private void DrawSortMark(Graphics gr, Rectangle bounds, int x)
@@ -391,11 +390,20 @@ internal static void DrawBackground(Graphics gr, Rectangle bounds, bool pressed,
}
}
- #endregion
+ internal static void DrawCustomBackground(Graphics gr, Color back, Color fore, Rectangle bounds, bool pressed, bool hot)
+ {
+ gr.FillRectangle(new SolidBrush(back), bounds);
+ Pen p1 = new Pen(fore);
+ gr.DrawLine(p1, bounds.X, bounds.Y - 1, bounds.Right, bounds.Y - 1);
+ gr.DrawLine(p1, bounds.Right - 1, bounds.Y + 3, bounds.Right - 1, bounds.Bottom - 4);
+ gr.DrawLine(p1, bounds.X, bounds.Bottom, bounds.Right, bounds.Bottom);
+ }
+
+ #endregion
- #region Events
+ #region Events
- public event EventHandler HeaderChanged;
+ public event EventHandler HeaderChanged;
private void OnHeaderChanged()
{
if (HeaderChanged != null)
diff --git a/External/3rdParty/Aga-1.7/Aga.Controls/Tree/TreeViewAdv.Draw.cs b/External/3rdParty/Aga-1.7/Aga.Controls/Tree/TreeViewAdv.Draw.cs
index a4709dc26d..9a1007f9e5 100644
--- a/External/3rdParty/Aga-1.7/Aga.Controls/Tree/TreeViewAdv.Draw.cs
+++ b/External/3rdParty/Aga-1.7/Aga.Controls/Tree/TreeViewAdv.Draw.cs
@@ -40,7 +40,8 @@ public void AutoSizeColumn(TreeColumn column)
private void CreatePens()
{
CreateLinePen();
- CreateMarkPen();
+ CreateMarkPen();
+ CreateLine2Pen();
}
private void CreateMarkPen()
@@ -61,6 +62,11 @@ private void CreateLinePen()
_linePen.DashStyle = DashStyle.Dot;
}
+ private void CreateLine2Pen()
+ {
+ _line2Pen = new Pen(_lineColor);
+ }
+
protected override void OnPaintBackground(PaintEventArgs pevent)
{
if (this.BackgroundPaintMode == Tree.BackgroundPaintMode.Gradiant)
@@ -90,7 +96,7 @@ protected override void OnPaint(PaintEventArgs e)
if (UseColumns)
{
- DrawColumnHeaders(e.Graphics);
+ DrawColumnHeaders(e.Graphics, this.ColumnHeaderBackColor, this.ColumnHeaderBorderColor, this.ColumnHeaderTextColor);
y += ActualColumnHeaderHeight;
if (Columns.Count == 0 || e.ClipRectangle.Height + e.ClipRectangle.Top <= y)
return;
@@ -169,7 +175,7 @@ private void DrawRow(PaintEventArgs e, ref DrawContext context, int row, Rectang
}
if ((GridLineStyle & GridLineStyle.Horizontal) == GridLineStyle.Horizontal)
- e.Graphics.DrawLine(SystemPens.InactiveBorder, 0, rowRect.Bottom, e.Graphics.ClipBounds.Right, rowRect.Bottom);
+ e.Graphics.DrawLine(_line2Pen, 0, rowRect.Bottom, e.Graphics.ClipBounds.Right, rowRect.Bottom);
if (ShowLines)
DrawLines(e.Graphics, node, rowRect);
@@ -185,18 +191,21 @@ private void DrawVerticalGridLines(Graphics gr, int y)
if (c.IsVisible)
{
x += c.Width;
- gr.DrawLine(SystemPens.InactiveBorder, x - 1, y, x - 1, gr.ClipBounds.Bottom);
+ gr.DrawLine(_line2Pen, x - 1, y, x - 1, gr.ClipBounds.Bottom);
}
}
}
- private void DrawColumnHeaders(Graphics gr)
+ private void DrawColumnHeaders(Graphics gr, Color back, Color fore, Color text)
{
PerformanceAnalyzer.Start("DrawColumnHeaders");
ReorderColumnState reorder = Input as ReorderColumnState;
int x = 0;
- TreeColumn.DrawBackground(gr, new Rectangle(0, 0, ClientRectangle.Width + 2, ActualColumnHeaderHeight - 1), false, false);
- gr.TranslateTransform(-OffsetX, 0);
+
+ if (this.CustomDrawHeaders) TreeColumn.DrawCustomBackground(gr, back, fore, new Rectangle(0, 0, ClientRectangle.Width + 2, ActualColumnHeaderHeight - 1), false, false);
+ else TreeColumn.DrawBackground(gr, new Rectangle(0, 0, ClientRectangle.Width + 2, ActualColumnHeaderHeight - 1), false, false);
+
+ gr.TranslateTransform(-OffsetX, 0);
foreach (TreeColumn c in Columns)
{
if (c.IsVisible)
@@ -206,7 +215,12 @@ private void DrawColumnHeaders(Graphics gr)
Rectangle rect = new Rectangle(x, 0, c.Width, ActualColumnHeaderHeight - 1);
gr.SetClip(rect);
bool pressed = ((Input is ClickColumnState || reorder != null) && ((Input as ColumnState).Column == c));
- c.Draw(gr, rect, Font, pressed, _hotColumn == c);
+
+ if (this.CustomDrawHeaders) TreeColumn.DrawCustomBackground(gr, back, fore, rect, pressed, _hotColumn == c);
+ else TreeColumn.DrawBackground(gr, rect, pressed, _hotColumn == c);
+
+ c.Draw(gr, rect, Font, pressed, _hotColumn == c, text);
+
gr.ResetClip();
if (reorder != null && reorder.DropColumn == c)
diff --git a/External/3rdParty/Aga-1.7/Aga.Controls/Tree/TreeViewAdv.Properties.cs b/External/3rdParty/Aga-1.7/Aga.Controls/Tree/TreeViewAdv.Properties.cs
index 149231458e..1dfb349a8c 100644
--- a/External/3rdParty/Aga-1.7/Aga.Controls/Tree/TreeViewAdv.Properties.cs
+++ b/External/3rdParty/Aga-1.7/Aga.Controls/Tree/TreeViewAdv.Properties.cs
@@ -13,8 +13,9 @@ namespace Aga.Controls.Tree
public partial class TreeViewAdv
{
private Cursor _innerCursor = null;
+ public bool CustomDrawHeaders = false;
- public override Cursor Cursor
+ public override Cursor Cursor
{
get
{
@@ -657,7 +658,43 @@ public int Indent
}
}
- private Color _lineColor = SystemColors.ControlDark;
+ private Color _columnTextColor = SystemColors.ControlText;
+ [Category("Behavior")]
+ public Color ColumnHeaderTextColor
+ {
+ get { return _columnTextColor; }
+ set
+ {
+ _columnTextColor = value;
+ UpdateView();
+ }
+ }
+
+ private Color _columnBackColor = SystemColors.Control;
+ [Category("Behavior")]
+ public Color ColumnHeaderBackColor
+ {
+ get { return _columnBackColor; }
+ set
+ {
+ _columnBackColor = value;
+ UpdateView();
+ }
+ }
+
+ private Color _columnBorderColor = SystemColors.ActiveBorder;
+ [Category("Behavior")]
+ public Color ColumnHeaderBorderColor
+ {
+ get { return _columnBorderColor; }
+ set
+ {
+ _columnBorderColor = value;
+ UpdateView();
+ }
+ }
+
+ private Color _lineColor = SystemColors.ControlDark;
[Category("Behavior")]
public Color LineColor
{
@@ -670,7 +707,20 @@ public Color LineColor
}
}
- private Color _dragDropMarkColor = Color.Black;
+ private Color _lineColor2 = SystemColors.ControlDark;
+ [Category("Behavior")]
+ public Color LineColor2
+ {
+ get { return _lineColor2; }
+ set
+ {
+ _lineColor2 = value;
+ CreateLine2Pen();
+ UpdateView();
+ }
+ }
+
+ private Color _dragDropMarkColor = Color.Black;
[Category("Behavior")]
public Color DragDropMarkColor
{
diff --git a/External/3rdParty/Aga-1.7/Aga.Controls/Tree/TreeViewAdv.cs b/External/3rdParty/Aga-1.7/Aga.Controls/Tree/TreeViewAdv.cs
index c9a6dfb0a3..40748e6026 100644
--- a/External/3rdParty/Aga-1.7/Aga.Controls/Tree/TreeViewAdv.cs
+++ b/External/3rdParty/Aga-1.7/Aga.Controls/Tree/TreeViewAdv.cs
@@ -29,7 +29,8 @@ public partial class TreeViewAdv : Control
private const int DividerCorrectionGap = -2;
private Pen _linePen;
- private Pen _markPen;
+ private Pen _line2Pen;
+ private Pen _markPen;
private bool _suspendUpdate;
private bool _needFullUpdate;
private bool _fireSelectionEvent;
@@ -491,7 +492,8 @@ protected override void Dispose(bool disposing)
if (_dragBitmap != null) _dragBitmap.Dispose();
if (_dragTimer != null) _dragTimer.Dispose();
if (_linePen != null) _linePen.Dispose();
- if (_markPen != null) _markPen.Dispose();
+ if (_line2Pen != null) _linePen.Dispose();
+ if (_markPen != null) _markPen.Dispose();
}
base.Dispose(disposing);
}
diff --git a/External/3rdParty/Aga-1.7/TreeViewAdv.sln b/External/3rdParty/Aga-1.7/TreeViewAdv.sln
index aab1dbd6ce..6e653ae427 100644
--- a/External/3rdParty/Aga-1.7/TreeViewAdv.sln
+++ b/External/3rdParty/Aga-1.7/TreeViewAdv.sln
@@ -1,6 +1,8 @@
-Microsoft Visual Studio Solution File, Format Version 10.00
-# Visual Studio 2008
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 14
+VisualStudioVersion = 14.0.23107.0
+MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Aga.Controls", "Aga.Controls\Aga.Controls.csproj", "{E73BB233-D88B-44A7-A98F-D71EE158381D}"
EndProject
Global
diff --git a/External/3rdParty/Duplicate/Duplicate.csproj b/External/3rdParty/Duplicate/Duplicate.csproj
index 8ac191a7aa..38a487b43e 100644
--- a/External/3rdParty/Duplicate/Duplicate.csproj
+++ b/External/3rdParty/Duplicate/Duplicate.csproj
@@ -3,8 +3,6 @@
Debug
AnyCPU
- 9.0.30729
- 2.0
{7AF50A69-26D3-400B-9DFF-96CB36E1A871}
Library
Properties
@@ -14,8 +12,11 @@
- 2.0
- v2.0
+ net48
+ true
+ false
+ false
+ false
@@ -50,14 +51,6 @@
TRACE
true
-
-
False
diff --git a/External/3rdParty/Scintilla/additional_keywords.patch b/External/3rdParty/Scintilla/additional_keywords.patch
index fbf1381ab0..afa80d85ad 100644
--- a/External/3rdParty/Scintilla/additional_keywords.patch
+++ b/External/3rdParty/Scintilla/additional_keywords.patch
@@ -1,65 +1,65 @@
-diff -r 1092d3d24959 include/SciLexer.h
---- a/include/SciLexer.h Tue Jan 15 09:51:15 2013 +1100
-+++ b/include/SciLexer.h Wed Feb 06 22:13:27 2013 +0100
-@@ -161,6 +161,9 @@
- #define SCE_C_TRIPLEVERBATIM 21
- #define SCE_C_HASHQUOTEDSTRING 22
- #define SCE_C_PREPROCESSORCOMMENT 23
-+#define SCE_C_WORD3 24
-+#define SCE_C_WORD4 25
-+#define SCE_C_WORD5 26
+diff --git a/include/SciLexer.h b/include/SciLexer.h
+--- a/include/SciLexer.h
++++ b/include/SciLexer.h
+@@ -177,6 +177,9 @@
+ #define SCE_C_USERLITERAL 25
+ #define SCE_C_TASKMARKER 26
+ #define SCE_C_ESCAPESEQUENCE 27
++#define SCE_C_WORD3 100
++#define SCE_C_WORD4 101
++#define SCE_C_WORD5 102
#define SCE_D_DEFAULT 0
#define SCE_D_COMMENT 1
#define SCE_D_COMMENTLINE 2
-diff -r 1092d3d24959 lexers/LexCPP.cxx
---- a/lexers/LexCPP.cxx Tue Jan 15 09:51:15 2013 +1100
-+++ b/lexers/LexCPP.cxx Wed Feb 06 22:13:27 2013 +0100
-@@ -247,6 +247,9 @@
- "Documentation comment keywords",
+diff --git a/lexers/LexCPP.cxx b/lexers/LexCPP.cxx
+--- a/lexers/LexCPP.cxx
++++ b/lexers/LexCPP.cxx
+@@ -353,6 +353,9 @@
"Global classes and typedefs",
"Preprocessor definitions",
+ "Task marker and error marker keywords",
+ "Extended(1) keywords and identifiers",
+ "Extended(2) keywords and identifiers",
+ "Extended(3) keywords and identifiers",
0,
};
-@@ -323,6 +326,9 @@
+@@ -443,6 +446,9 @@
WordList keywords2;
WordList keywords3;
WordList keywords4;
-+ WordList keywords5;
-+ WordList keywords6;
-+ WordList keywords7;
++ WordList keywords5;
++ WordList keywords6;
++ WordList keywords7;
WordList ppDefinitions;
- std::map preprocessorDefinitionsStart;
- OptionsCPP options;
-@@ -411,6 +417,15 @@
- case 4:
+ WordList markerList;
+ struct SymbolValue {
+@@ -587,6 +593,15 @@
wordListN = &ppDefinitions;
break;
-+ case 5:
-+ wordListN = &keywords5;
-+ break;
-+ case 6:
-+ wordListN = &keywords6;
-+ break;
-+ case 7:
-+ wordListN = &keywords7;
-+ break;
+ case 5:
++ wordListN = &keywords5;
++ break;
++ case 6:
++ wordListN = &keywords6;
++ break;
++ case 7:
++ wordListN = &keywords7;
++ break;
++ case 8:
+ wordListN = &markerList;
+ break;
}
- int firstModification = -1;
- if (wordListN) {
-@@ -605,6 +620,12 @@
+@@ -809,6 +824,12 @@
sc.ChangeState(SCE_C_WORD2|activitySet);
} else if (keywords4.InList(s)) {
sc.ChangeState(SCE_C_GLOBALCLASS|activitySet);
+ } else if (keywords5.InList(s)) {
-+ sc.ChangeState(SCE_C_WORD3|activitySet);
-+ } else if (keywords6.InList(s)) {
-+ sc.ChangeState(SCE_C_WORD4|activitySet);
-+ } else if (keywords7.InList(s)) {
-+ sc.ChangeState(SCE_C_WORD5|activitySet);
- }
- const bool literalString = sc.ch == '\"';
- if (literalString || sc.ch == '\'') {
++ sc.ChangeState(SCE_C_WORD3|activitySet);
++ } else if (keywords6.InList(s)) {
++ sc.ChangeState(SCE_C_WORD4|activitySet);
++ } else if (keywords7.InList(s)) {
++ sc.ChangeState(SCE_C_WORD5|activitySet);
+ } else {
+ int subStyle = classifierIdentifiers.ValueFor(s);
+ if (subStyle >= 0) {
diff --git a/External/3rdParty/Trace/Resources/en_US.resX b/External/3rdParty/Trace/Resources/en_US.resx
similarity index 100%
rename from External/3rdParty/Trace/Resources/en_US.resX
rename to External/3rdParty/Trace/Resources/en_US.resx
diff --git a/External/3rdParty/Trace/Trace.csproj b/External/3rdParty/Trace/Trace.csproj
index 1ea23c58a1..831f7aa5a3 100644
--- a/External/3rdParty/Trace/Trace.csproj
+++ b/External/3rdParty/Trace/Trace.csproj
@@ -3,8 +3,6 @@
Debug
AnyCPU
- 9.0.30729
- 2.0
{78101C01-E186-4954-B1DD-DEBB7905FAD8}
Library
Properties
@@ -14,8 +12,11 @@
- 2.0
- v2.0
+ net48
+ true
+ false
+ false
+ false
@@ -65,14 +66,6 @@
TRACE
true
-
-
False
@@ -98,7 +91,7 @@
-
+
Designer
diff --git a/External/Archive/FlashDebugger/FlashDebugger.csproj b/External/Archive/FlashDebugger/FlashDebugger.csproj
index ae664a224a..27731fd483 100644
--- a/External/Archive/FlashDebugger/FlashDebugger.csproj
+++ b/External/Archive/FlashDebugger/FlashDebugger.csproj
@@ -3,8 +3,6 @@
Debug
AnyCPU
- 9.0.30729
- 2.0
{194B58C9-9D2B-4D5E-9256-773FD3222582}
Library
Properties
@@ -14,8 +12,11 @@
- 2.0
- v2.0
+ net48
+ true
+ false
+ false
+ false
@@ -49,14 +50,6 @@
TRACE
true
-
-
False
@@ -400,7 +393,7 @@
-
+
Designer
diff --git a/External/Archive/FlashDebugger/FlexSDK/FlashDbg/FlashDbg.resX b/External/Archive/FlashDebugger/FlexSDK/FlashDbg/FlashDbg.resx
similarity index 100%
rename from External/Archive/FlashDebugger/FlexSDK/FlashDbg/FlashDbg.resX
rename to External/Archive/FlashDebugger/FlexSDK/FlashDbg/FlashDbg.resx
diff --git a/External/Archive/FlashDebugger/FlexSDK/SwfUtils/flash/swf/NotUsed/TagEncoder.cs b/External/Archive/FlashDebugger/FlexSDK/SwfUtils/flash/swf/NotUsed/TagEncoder.cs
index f73290ca23..61fa2ef8cb 100644
--- a/External/Archive/FlashDebugger/FlexSDK/SwfUtils/flash/swf/NotUsed/TagEncoder.cs
+++ b/External/Archive/FlashDebugger/FlexSDK/SwfUtils/flash/swf/NotUsed/TagEncoder.cs
@@ -1,2314 +1,2314 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// ADOBE SYSTEMS INCORPORATED
-// Copyright 2003-2007 Adobe Systems Incorporated
-// All Rights Reserved.
-//
-// NOTICE: Adobe permits you to use, modify, and distribute this file
-// in accordance with the terms of the license agreement accompanying it.
-//
-////////////////////////////////////////////////////////////////////////////////
-using System;
-using flash.swf.tags;
-using ButtonCondAction = flash.swf.types.ButtonCondAction;
-using ButtonRecord = flash.swf.types.ButtonRecord;
-using CXForm = flash.swf.types.CXForm;
-using CXFormWithAlpha = flash.swf.types.CXFormWithAlpha;
-using CurvedEdgeRecord = flash.swf.types.CurvedEdgeRecord;
-using EdgeRecord = flash.swf.types.EdgeRecord;
-using FillStyle = flash.swf.types.FillStyle;
-using GlyphEntry = flash.swf.types.GlyphEntry;
-using GradRecord = flash.swf.types.GradRecord;
-using ImportRecord = flash.swf.types.ImportRecord;
-using KerningRecord = flash.swf.types.KerningRecord;
-using LineStyle = flash.swf.types.LineStyle;
-using MD5 = flash.swf.types.MD5;
-using Matrix = flash.swf.types.Matrix;
-using MorphFillStyle = flash.swf.types.MorphFillStyle;
-using MorphGradRecord = flash.swf.types.MorphGradRecord;
-using MorphLineStyle = flash.swf.types.MorphLineStyle;
-using Rect = flash.swf.types.Rect;
-using Shape = flash.swf.types.Shape;
-using ShapeRecord = flash.swf.types.ShapeRecord;
-using ShapeWithStyle = flash.swf.types.ShapeWithStyle;
-using SoundInfo = flash.swf.types.SoundInfo;
-using StraightEdgeRecord = flash.swf.types.StraightEdgeRecord;
-using StyleChangeRecord = flash.swf.types.StyleChangeRecord;
-using TextRecord = flash.swf.types.TextRecord;
-using Filter = flash.swf.types.Filter;
-using DropShadowFilter = flash.swf.types.DropShadowFilter;
-using BlurFilter = flash.swf.types.BlurFilter;
-using ColorMatrixFilter = flash.swf.types.ColorMatrixFilter;
-using GlowFilter = flash.swf.types.GlowFilter;
-using ConvolutionFilter = flash.swf.types.ConvolutionFilter;
-using BevelFilter = flash.swf.types.BevelFilter;
-using GradientGlowFilter = flash.swf.types.GradientGlowFilter;
-using GradientBevelFilter = flash.swf.types.GradientBevelFilter;
-using Gradient = flash.swf.types.Gradient;
-using FocalGradient = flash.swf.types.FocalGradient;
-namespace flash.swf
-{
-
- public class TagEncoder:TagHandler, TagValues
- {
- virtual public int Pos
- {
- get
- {
- return writer.Pos;
- }
-
- }
- virtual protected internal int SwfVersion
- {
- get
- {
- return header_Renamed_Field.version;
- }
-
- }
- virtual protected internal int FrameRate
- {
- get
- {
- return header_Renamed_Field.rate;
- }
-
- }
- virtual public Dictionary EncoderDictionary
- {
- set
- {
- assert((this.dict == null) || (this.dict.ids.Count == 0));
- this.dict = value;
- }
-
- }
- virtual public Dictionary Dictionary
- {
- get
- {
- return dict;
- }
-
- }
- virtual public bool Debug
- {
- get
- {
- return debug != null;
- }
-
- }
- virtual public int Width
- {
- get
- {
- return width / 20;
- }
-
- }
- virtual public int Height
- {
- get
- {
- return height / 20;
- }
-
- }
- virtual public System.String MainDebugScript
- {
- set
- {
- debug.MainDebugScript = value;
- }
-
- }
- override public SetBackgroundColor BackgroundColor
- {
- set
- {
- encodeTagHeader(value.code, 3, false);
- encodeRGB(value.color, writer);
- }
-
- }
- override public SetTabIndex TabIndex
- {
- set
- {
- tagw.writeUI16(value.depth);
- tagw.writeUI16(value.index);
- encodeTag(value);
- }
-
- }
- // changed from private to protected to support Flash Authoring - jkamerer 2007.07.30
- protected internal SwfEncoder writer;
- private SwfEncoder tagw;
- private int width;
- private int height;
- private int frames;
- private int framecountPos;
- private DebugEncoder debug;
- private Header header_Renamed_Field;
-
- protected internal Dictionary dict;
- private int uuidOffset;
-
- public TagEncoder()
- {
- dict = new Dictionary();
- }
-
- public TagEncoder(Dictionary dict)
- {
- this.dict = dict;
- }
-
- public override void productInfo(ProductInfo tag)
- {
- tagw.write32(tag.Product);
- tagw.write32(tag.Edition);
- tagw.write(new sbyte[]{tag.MajorVersion, tag.MinorVersion});
- tagw.write64(tag.Build);
- tagw.write64(tag.CompileDate);
- encodeTag(tag);
- }
-
- public override void fileAttributes(FileAttributes tag)
- {
- tagw.writeUBits(0, 3);
- tagw.writeBit(tag.hasMetadata);
- tagw.writeBit(tag.actionScript3);
- tagw.writeBit(tag.suppressCrossDomainCaching);
- tagw.writeBit(tag.swfRelativeUrls);
- tagw.writeBit(tag.useNetwork);
- tagw.writeUBits(0, 24);
- encodeTag(tag);
- }
-
- public override void metadata(Metadata tag)
- {
- tagw.writeString(tag.xml);
- encodeTag(tag);
- }
-
- protected internal virtual SwfEncoder createEncoder(int swfVersion)
- {
- return new SwfEncoder(swfVersion);
- }
-
- public override void header(Header header)
- {
- // get some header properties we need to know
- int swfVersion = header.version;
- this.header_Renamed_Field = header;
- this.writer = createEncoder(swfVersion);
- this.tagw = createEncoder(swfVersion);
- width = header.size.Width;
- height = header.size.Height;
- frames = 0;
-
- // write the header
- writer.writeUI8(header.compressed?'C':'F');
- writer.writeUI8('W');
- writer.writeUI8('S');
- writer.writeUI8(header.version);
- writer.write32((int) header.length);
- if (header.compressed)
- {
- writer.markComp();
- }
- encodeRect(header.size, writer);
- writer.writeUI8(header.rate >> 8);
- writer.writeUI8(header.rate & 255);
- framecountPos = writer.Pos;
- writer.writeUI16(header.framecount);
- }
-
- public override void finish()
- {
- // write end marker
- writer.writeUI16(0);
-
- // update the length
- writer.write32at(4, writer.Pos);
-
- // update the frame count
- writer.writeUI16at(framecountPos, frames);
-
- if (debug != null)
- {
- // compute a crc and use it for the debug id. that way it
- // is wholly dependent on the bytes in the SWF and not some
- // outside value. If any of the bytes are different,
- // then the UUID will be different.
- sbyte[] md5 = MD5.getDigest(writer.ByteArray, writer.Length);
- writer.writeAt(uuidOffset, md5);
- debug.updateUUID(md5);
- }
- }
-
- public virtual void writeTo(System.IO.Stream out_Renamed)
- {
- writer.WriteTo(out_Renamed);
- }
-
-
- public virtual void writeDebugTo(System.IO.Stream out_Renamed)
- {
- debug.writeTo(out_Renamed);
- }
-
- public virtual void encodeRect(Rect r, SwfEncoder w)
- {
- int nBits = r.nbits();
- w.writeUBits(nBits, 5);
- w.writeSBits(r.xMin, nBits);
- w.writeSBits(r.xMax, nBits);
- w.writeSBits(r.yMin, nBits);
- w.writeSBits(r.yMax, nBits);
- w.flushBits();
- }
-
- public override void debugID(DebugID tag)
- {
- encodeTagHeader(tag.code, tag.uuid.bytes.Length, false);
- uuidOffset = writer.Pos;
- writer.write(tag.uuid.bytes);
-
- debug = new DebugEncoder();
- debug.header(SwfVersion);
- debug.uuid(tag.uuid);
- }
-
- private void encodeTag(Tag tag)
- {
- try
- {
- tagw.compress();
- encodeTagHeader(tag.code, tagw.Pos, isLongHeader(tag));
- tagw.WriteTo(writer);
- tagw.reset();
- }
- catch (System.IO.IOException e)
- {
- assert(false);
- }
- }
-
- private bool isLongHeader(Tag t)
- {
- switch (t.code)
- {
-
- // [preilly] In the player code, ScriptThread::DefineBits() assumes all DefineBits
- // tags use a long header. See "ch->data = AttachData(pos-8);". If the player
- // also supported a short header, it would use "pos-4".
- case flash.swf.TagValues_Fields.stagDefineBits:
- case flash.swf.TagValues_Fields.stagDefineBitsJPEG2:
- case flash.swf.TagValues_Fields.stagDefineBitsJPEG3:
- case flash.swf.TagValues_Fields.stagDefineBitsLossless:
- case flash.swf.TagValues_Fields.stagDefineBitsLossless2:
- return true;
-
- // [ed] the FlashPaper codebase also indicates that stagSoundStreamBlock must use
- // a long format header. todo - verify by looking at the player code.
-
- case flash.swf.TagValues_Fields.stagSoundStreamBlock:
- return true;
-
- // [edsmith] these tags have code in them. When we're writing a SWD, we use long headers
- // so we can predict SWF offsets correctly when writing SWD line/offset records.
-
- case flash.swf.TagValues_Fields.stagDefineButton:
- case flash.swf.TagValues_Fields.stagDefineButton2:
- case flash.swf.TagValues_Fields.stagDefineSprite:
- case flash.swf.TagValues_Fields.stagDoInitAction:
- case flash.swf.TagValues_Fields.stagDoAction:
- return Debug;
-
-
- case flash.swf.TagValues_Fields.stagPlaceObject2:
- return Debug && ((PlaceObject) t).hasClipAction();
-
- // all other tags will use short/long headers depending on their length
-
- default:
- return false;
-
- }
- }
-
- private void encodeTagHeader(int code, int length, bool longHeader)
- {
- if (longHeader || length >= 63)
- {
- writer.writeUI16((code << 6) | 63);
- writer.write32(length);
- }
- else
- {
- writer.writeUI16((code << 6) | length);
- }
- }
-
- public override void defineScalingGrid(DefineScalingGrid tag)
- {
- int idref = dict.getId(tag.scalingTarget);
- tagw.writeUI16(idref);
- encodeRect(tag.rect, tagw);
- encodeTag(tag);
- }
-
- public override void defineBinaryData(DefineBinaryData tag)
- {
- encodeTagHeader(tag.code, 6 + tag.data.Length, false);
- int id = dict.add(tag);
- writer.writeUI16(id);
- writer.write32(tag.reserved);
- writer.write(tag.data);
- }
-
- public override void defineBits(DefineBits tag)
- {
- encodeTagHeader(tag.code, 2 + tag.data.Length, true);
- int id = dict.add(tag);
- writer.writeUI16(id);
- writer.write(tag.data);
- }
-
- public override void defineBitsJPEG2(DefineBits tag)
- {
- defineBits(tag);
- }
-
- public override void defineBitsJPEG3(DefineBitsJPEG3 tag)
- {
- int id = dict.add(tag);
- tagw.writeUI16(id);
- tagw.write32(tag.data.Length);
- tagw.write(tag.data);
- tagw.markComp();
- tagw.write(tag.alphaData);
- encodeTag(tag);
- }
-
- public override void defineBitsLossless(DefineBitsLossless tag)
- {
- int id = dict.add(tag);
- tagw.writeUI16(id);
- tagw.writeUI8(tag.format);
- tagw.writeUI16(tag.width);
- tagw.writeUI16(tag.height);
- switch (tag.format)
- {
-
- case 3:
- tagw.writeUI8(tag.colorData.Length - 1);
- tagw.markComp();
- encodeColorMapData(tag.colorData, tag.data, tagw);
- break;
-
- case 4:
- case 5:
- tagw.markComp();
- encodeBitmapData(tag.data, tagw);
- break;
- }
- encodeTag(tag);
- }
-
- private void encodeBitmapData(sbyte[] data, SwfEncoder w)
- {
- w.write(data);
- }
-
- private void encodeColorMapData(int[] colorData, sbyte[] pixelData, SwfEncoder w)
- {
- for (int i = 0; i < colorData.Length; i++)
- {
- encodeRGB(colorData[i], w);
- }
- w.write(pixelData);
- }
-
- /// as 0x00RRGGBB
- ///
- ///
- ///
- private void encodeRGB(int rgb, SwfEncoder w)
- {
- w.writeUI8(SupportClass.URShift(rgb, 16)); // red. we don't mask this because if rgb has an Alpha value, something's wrong
- w.writeUI8((SupportClass.URShift(rgb, 8)) & 255);
- w.writeUI8(rgb & 255); // blue
- }
-
- public override void defineBitsLossless2(DefineBitsLossless tag)
- {
- int id = dict.add(tag);
- tagw.writeUI16(id);
- tagw.writeUI8(tag.format);
- tagw.writeUI16(tag.width);
- tagw.writeUI16(tag.height);
- switch (tag.format)
- {
-
- case 3:
- tagw.writeUI8(tag.colorData.Length - 1);
- tagw.markComp();
- encodeAlphaColorMapData(tag.colorData, tag.data, tagw);
- break;
-
- case 4:
- case 5:
- tagw.markComp();
- encodeBitmapData(tag.data, tagw);
- break;
- }
- encodeTag(tag);
- }
-
- private void encodeAlphaColorMapData(int[] colorData, sbyte[] pixelData, SwfEncoder w)
- {
- for (int i = 0; i < colorData.Length; i++)
- {
- encodeRGBA(colorData[i], w);
- }
- w.write(pixelData);
- }
-
- /// as 0xAARRGGBB
- ///
- ///
- ///
- private void encodeRGBA(int rgba, SwfEncoder w)
- {
- w.writeUI8((SupportClass.URShift(rgba, 16)) & 255); // red
- w.writeUI8((SupportClass.URShift(rgba, 8)) & 255); // green
- w.writeUI8(rgba & 255); // blue
- w.writeUI8(SupportClass.URShift(rgba, 24)); // alpha
- }
-
- public override void defineButton(DefineButton tag)
- {
- int id = dict.add(tag);
- tagw.writeUI16(id);
-
- if (Debug)
- {
- debug.adjust = writer.Pos + 6;
- }
-
- for (int i = 0; i < tag.buttonRecords.Length; i++)
- {
- encodeButtonRecord(tag.buttonRecords[i], tagw, tag.code);
- }
- tagw.writeUI8(0); // no more button records
-
- // assume there is only one condition we will handle
- new ActionEncoder(tagw, debug).encode(tag.condActions[0].actionList);
- tagw.writeUI8(0); // write action end flag, must be zero
- encodeTag(tag);
-
- if (Debug)
- {
- debug.adjust = 0;
- }
- }
-
- private void encodeButtonRecord(ButtonRecord record, SwfEncoder w, int defineButton)
- {
- if (defineButton == flash.swf.TagValues_Fields.stagDefineButton2)
- {
- w.writeUBits(0, 2);
- w.writeBit(record.blendMode != - 1);
- w.writeBit(record.filters != null);
- }
- else
- {
- w.writeUBits(0, 4);
- }
- w.writeBit(record.hitTest);
- w.writeBit(record.down);
- w.writeBit(record.over);
- w.writeBit(record.up);
-
- w.writeUI16(dict.getId(record.characterRef));
- w.writeUI16(record.placeDepth);
- encodeMatrix(record.placeMatrix, w);
-
- if (defineButton == flash.swf.TagValues_Fields.stagDefineButton2)
- {
- encodeCxforma(record.colorTransform, w);
- if (record.filters != null)
- {
- this.encodeFilterList(record.filters, w);
- }
- if (record.blendMode != - 1)
- {
- w.writeUI8(record.blendMode);
- }
- }
- }
-
- private void encodeCxforma(CXFormWithAlpha cxforma, SwfEncoder w)
- {
- w.writeBit(cxforma.hasAdd);
- w.writeBit(cxforma.hasMult);
-
- int nbits = cxforma.nbits();
- w.writeUBits(nbits, 4);
-
- if (cxforma.hasMult)
- {
- w.writeSBits(cxforma.redMultTerm, nbits);
- w.writeSBits(cxforma.greenMultTerm, nbits);
- w.writeSBits(cxforma.blueMultTerm, nbits);
- w.writeSBits(cxforma.alphaMultTerm, nbits);
- }
-
- if (cxforma.hasAdd)
- {
- w.writeSBits(cxforma.redAddTerm, nbits);
- w.writeSBits(cxforma.greenAddTerm, nbits);
- w.writeSBits(cxforma.blueAddTerm, nbits);
- w.writeSBits(cxforma.alphaAddTerm, nbits);
- }
-
- w.flushBits();
- }
-
- private void encodeMatrix(Matrix matrix, SwfEncoder w)
- {
- w.writeBit(matrix.hasScale);
- if (matrix.hasScale)
- {
- int nScaleBits = matrix.nScaleBits();
- w.writeUBits(nScaleBits, 5);
- w.writeSBits(matrix.scaleX, nScaleBits);
- w.writeSBits(matrix.scaleY, nScaleBits);
- }
-
- w.writeBit(matrix.hasRotate);
- if (matrix.hasRotate)
- {
- int nRotateBits = matrix.nRotateBits();
- w.writeUBits(nRotateBits, 5);
- w.writeSBits(matrix.rotateSkew0, nRotateBits);
- w.writeSBits(matrix.rotateSkew1, nRotateBits);
- }
-
- int nTranslateBits = matrix.nTranslateBits();
- w.writeUBits(nTranslateBits, 5);
- w.writeSBits(matrix.translateX, nTranslateBits);
- w.writeSBits(matrix.translateY, nTranslateBits);
-
- w.flushBits();
- }
-
- public override void defineButton2(DefineButton tag)
- {
- if (Debug)
- {
- debug.adjust = writer.Pos + 6;
- }
-
- int id = dict.add(tag);
- tagw.writeUI16(id);
- tagw.writeUBits(0, 7); // reserved
- tagw.writeBit(tag.trackAsMenu);
- int offsetPos = tagw.Pos;
- tagw.writeUI16(0); // actionOffset
-
- for (int i = 0; i < tag.buttonRecords.Length; i++)
- {
- encodeButtonRecord(tag.buttonRecords[i], tagw, tag.code);
- }
-
- tagw.writeUI8(0); // charEndFlag
-
- if (tag.condActions.Length > 0)
- {
- tagw.writeUI16at(offsetPos, tagw.Pos - offsetPos);
-
- for (int i = 0; i < tag.condActions.Length; i++)
- {
- bool isLast = i + 1 == tag.condActions.Length;
- encodeButtonCondAction(tag.condActions[i], tagw, isLast);
- }
- }
- encodeTag(tag);
-
- if (Debug)
- {
- debug.adjust = 0;
- }
- }
-
- private void encodeButtonCondAction(ButtonCondAction condAction, SwfEncoder w, bool last)
- {
- int pos = w.Pos;
- w.writeUI16(0);
-
- w.writeUBits(condAction.keyPress, 7);
- w.writeBit(condAction.overDownToIdle);
-
- w.writeBit(condAction.idleToOverDown);
- w.writeBit(condAction.outDownToIdle);
- w.writeBit(condAction.outDownToOverDown);
- w.writeBit(condAction.overDownToOutDown);
- w.writeBit(condAction.overDownToOverUp);
- w.writeBit(condAction.overUpToOverDown);
- w.writeBit(condAction.overUpToIdle);
- w.writeBit(condAction.idleToOverUp);
-
- new ActionEncoder(w, debug).encode(condAction.actionList);
- w.writeUI8(0); // end action byte
-
- if (!last)
- {
- w.writeUI16at(pos, w.Pos - pos);
- }
- }
-
- public override void defineButtonCxform(DefineButtonCxform tag)
- {
- int idref = dict.getId(tag.button);
- tagw.writeUI16(idref);
- encodeCxform(tag.colorTransform, tagw);
- encodeTag(tag);
- }
-
- private void encodeCxform(CXForm cxform, SwfEncoder w)
- {
-
- w.writeBit(cxform.hasAdd);
- w.writeBit(cxform.hasMult);
-
- int nbits = cxform.nbits();
- w.writeUBits(nbits, 4);
-
- if (cxform.hasMult)
- {
- w.writeSBits(cxform.redMultTerm, nbits);
- w.writeSBits(cxform.greenMultTerm, nbits);
- w.writeSBits(cxform.blueMultTerm, nbits);
- }
-
- if (cxform.hasAdd)
- {
- w.writeSBits(cxform.redAddTerm, nbits);
- w.writeSBits(cxform.greenAddTerm, nbits);
- w.writeSBits(cxform.blueAddTerm, nbits);
- }
-
- w.flushBits();
- }
-
- public override void defineButtonSound(DefineButtonSound tag)
- {
- int idref = dict.getId(tag.button);
- tagw.writeUI16(idref);
- if (tag.sound0 != null)
- {
- tagw.writeUI16(dict.getId(tag.sound0));
- encodeSoundInfo(tag.info0, tagw);
- }
- else
- {
- tagw.writeUI16(0);
- }
- if (tag.sound1 != null)
- {
- tagw.writeUI16(dict.getId(tag.sound1));
- encodeSoundInfo(tag.info1, tagw);
- }
- else
- {
- tagw.writeUI16(0);
- }
- if (tag.sound2 != null)
- {
- tagw.writeUI16(dict.getId(tag.sound2));
- encodeSoundInfo(tag.info2, tagw);
- }
- else
- {
- tagw.writeUI16(0);
- }
- if (tag.sound3 != null)
- {
- tagw.writeUI16(dict.getId(tag.sound3));
- encodeSoundInfo(tag.info3, tagw);
- }
- else
- {
- tagw.writeUI16(0);
- }
- encodeTag(tag);
- }
-
- private void encodeSoundInfo(SoundInfo info, SwfEncoder w)
- {
- w.writeUBits(0, 2); // reserved
- w.writeBit(info.syncStop);
- w.writeBit(info.syncNoMultiple);
- w.writeBit(info.records != null);
- w.writeBit(info.loopCount != SoundInfo.UNINITIALIZED);
- w.writeBit(info.outPoint != SoundInfo.UNINITIALIZED);
- w.writeBit(info.inPoint != SoundInfo.UNINITIALIZED);
-
- if (info.inPoint != SoundInfo.UNINITIALIZED)
- {
- w.write32((int) info.inPoint);
- }
- if (info.outPoint != SoundInfo.UNINITIALIZED)
- {
- w.write32((int) info.outPoint);
- }
- if (info.loopCount != SoundInfo.UNINITIALIZED)
- {
- w.writeUI16(info.loopCount);
- }
- if (info.records != null)
- {
- w.writeUI8(info.records.Length);
- for (int k = 0; k < info.records.Length; k++)
- {
- w.write64(info.records[k]);
- }
- }
- }
-
- public override void defineEditText(DefineEditText tag)
- {
- int id = dict.add(tag);
- tagw.writeUI16(id);
- encodeRect(tag.bounds, tagw);
-
- tagw.writeBit(tag.hasText);
- tagw.writeBit(tag.wordWrap);
- tagw.writeBit(tag.multiline);
- tagw.writeBit(tag.password);
- tagw.writeBit(tag.readOnly);
- tagw.writeBit(tag.hasTextColor);
- tagw.writeBit(tag.hasMaxLength);
- tagw.writeBit(tag.hasFont);
-
- tagw.writeBit(false); // reserved
- tagw.writeBit(tag.autoSize);
- tagw.writeBit(tag.hasLayout);
- tagw.writeBit(tag.noSelect);
- tagw.writeBit(tag.border);
- tagw.writeBit(tag.wasStatic);
- tagw.writeBit(tag.html);
- tagw.writeBit(tag.useOutlines);
-
- tagw.flushBits();
-
- if (tag.hasFont)
- {
- int idref = dict.getId(tag.font);
- tagw.writeUI16(idref);
- tagw.writeUI16(tag.height);
- }
-
- if (tag.hasTextColor)
- {
- encodeRGBA(tag.color, tagw);
- }
-
- if (tag.hasMaxLength)
- {
- tagw.writeUI16(tag.maxLength);
- }
-
- if (tag.hasLayout)
- {
- tagw.writeUI8(tag.align);
- tagw.writeUI16(tag.leftMargin);
- tagw.writeUI16(tag.rightMargin);
- tagw.writeUI16(tag.ident);
- tagw.writeSI16(tag.leading); // see errata, leading is signed
- }
-
- tagw.writeString(tag.varName);
- if (tag.hasText)
- {
- tagw.writeString(tag.initialText);
- }
- encodeTag(tag);
- }
-
- public override void defineFont(DefineFont1 tag)
- {
- int id = dict.add(tag);
- tagw.writeUI16(id);
-
- int count = tag.glyphShapeTable.Length;
-
- int offsetPos = tagw.Pos;
-
- // write offset placeholders
- for (int i = 0; i < count; i++)
- {
- tagw.writeUI16(0);
- }
-
- // now write glyphs and update the encoded offset table
- for (int i = 0; i < count; i++)
- {
- tagw.writeUI16at(offsetPos + 2 * i, tagw.Pos - offsetPos);
- encodeShape(tag.glyphShapeTable[i], tagw, flash.swf.TagValues_Fields.stagDefineShape3, 1, 0);
- }
-
- encodeTag(tag);
- }
-
- public virtual void encodeShape(Shape s, SwfEncoder w, int shape, int nFillStyles, int nLineStyles)
- {
- int[] numFillBits = new int[]{SwfEncoder.minBits(nFillStyles, 0)};
- int[] numLineBits = new int[]{SwfEncoder.minBits(nLineStyles, 0)};
-
- w.writeUBits(numFillBits[0], 4);
- w.writeUBits(numLineBits[0], 4);
-
- System.Collections.IEnumerator it = s.shapeRecords.GetEnumerator();
- //UPGRADE_TODO: Method 'java.util.Iterator.hasNext' was converted to 'System.Collections.IEnumerator.MoveNext' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratorhasNext'"
- while (it.MoveNext())
- {
- //UPGRADE_TODO: Method 'java.util.Iterator.next' was converted to 'System.Collections.IEnumerator.Current' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratornext'"
- ShapeRecord record = (ShapeRecord) it.Current;
- if (record is StyleChangeRecord)
- {
- // style change
- w.writeBit(false);
- StyleChangeRecord change = (StyleChangeRecord) record;
- encodeStyleChangeRecord(w, change, numFillBits, numLineBits, shape);
- }
- else
- {
- // edge
- w.writeBit(true);
- EdgeRecord e = (EdgeRecord) record;
- bool straight = e is StraightEdgeRecord;
- w.writeBit(straight);
- int nbits = straight?calcBits((StraightEdgeRecord) e):calcBits((CurvedEdgeRecord) e);
- if (nbits < 2)
- nbits = 2;
- w.writeUBits(nbits - 2, 4);
- if (straight)
- {
- // line
- StraightEdgeRecord line = (StraightEdgeRecord) e;
- encodeStraightEdgeRecord(line, w, nbits);
- }
- else
- {
- // curve
- CurvedEdgeRecord curve = (CurvedEdgeRecord) e;
- w.writeSBits(curve.controlDeltaX, nbits);
- w.writeSBits(curve.controlDeltaY, nbits);
- w.writeSBits(curve.anchorDeltaX, nbits);
- w.writeSBits(curve.anchorDeltaY, nbits);
- }
- }
- }
-
- // endshaperecord
- w.writeUBits(0, 6);
-
- w.flushBits();
- }
-
- private int calcBits(StraightEdgeRecord edge)
- {
- return SwfEncoder.minBits(SwfEncoder.maxNum(edge.deltaX, edge.deltaY, 0, 0), 1);
- }
-
- private int calcBits(CurvedEdgeRecord edge)
- {
- return SwfEncoder.minBits(SwfEncoder.maxNum(edge.controlDeltaX, edge.controlDeltaY, edge.anchorDeltaX, edge.anchorDeltaY), 1);
- }
-
- private void encodeStraightEdgeRecord(StraightEdgeRecord line, SwfEncoder w, int nbits)
- {
- if (line.deltaX == 0)
- {
- w.writeUBits(1, 2); // vertical line
- w.writeSBits(line.deltaY, nbits);
- }
- else if (line.deltaY == 0)
- {
- w.writeUBits(0, 2); // horizontal line
- w.writeSBits(line.deltaX, nbits);
- }
- else
- {
- w.writeBit(true); // general line
- w.writeSBits(line.deltaX, nbits);
- w.writeSBits(line.deltaY, nbits);
- }
- }
-
- private void encodeStyleChangeRecord(SwfEncoder w, StyleChangeRecord s, int[] numFillBits, int[] numLineBits, int shape)
- {
- w.writeBit(s.stateNewStyles);
- w.writeBit(s.stateLineStyle);
- w.writeBit(s.stateFillStyle1);
- w.writeBit(s.stateFillStyle0);
- w.writeBit(s.stateMoveTo);
-
- if (s.stateMoveTo)
- {
- int moveBits = s.nMoveBits();
- w.writeUBits(moveBits, 5);
- w.writeSBits(s.moveDeltaX, moveBits);
- w.writeSBits(s.moveDeltaY, moveBits);
- }
-
- if (s.stateFillStyle0)
- {
- w.writeUBits(s.fillstyle0, numFillBits[0]);
- }
-
- if (s.stateFillStyle1)
- {
- w.writeUBits(s.fillstyle1, numFillBits[0]);
- }
-
- if (s.stateLineStyle)
- {
- w.writeUBits(s.linestyle, numLineBits[0]);
- }
-
- if (s.stateNewStyles)
- {
- w.flushBits();
-
- encodeFillstyles(s.fillstyles, w, shape);
- encodeLinestyles(s.linestyles, w, shape);
-
- numFillBits[0] = SwfEncoder.minBits(s.fillstyles.Count, 0);
- numLineBits[0] = SwfEncoder.minBits(s.linestyles.Count, 0);
- w.writeUBits(numFillBits[0], 4);
- w.writeUBits(numLineBits[0], 4);
- }
- }
-
- private void encodeLinestyles(System.Collections.ArrayList linestyles, SwfEncoder w, int shape)
- {
- int count = linestyles.Count;
- if (count > 0xFF)
- {
- w.writeUI8(0xFF);
- w.writeUI16(count);
- }
- else
- {
- w.writeUI8(count);
- }
-
- for (int i = 0; i < count; i++)
- {
- encodeLineStyle((LineStyle) linestyles[i], w, shape);
- }
- }
-
- private void encodeLineStyle(LineStyle lineStyle, SwfEncoder w, int shape)
- {
- w.writeUI16(lineStyle.width);
-
- if (shape == flash.swf.TagValues_Fields.stagDefineShape6)
- {
- w.writeUI16(lineStyle.flags);
- if (lineStyle.hasMiterJoint())
- w.writeUI16(lineStyle.miterLimit);
- }
-
- if (shape == flash.swf.TagValues_Fields.stagDefineShape6 && lineStyle.hasFillStyle())
- {
- encodeFillStyle(lineStyle.fillStyle, w, shape);
- }
- else if ((shape == flash.swf.TagValues_Fields.stagDefineShape3) || (shape == flash.swf.TagValues_Fields.stagDefineShape6))
- {
- encodeRGBA(lineStyle.color, w);
- }
- else
- {
- encodeRGB(lineStyle.color, w);
- }
- }
-
- private void encodeFillstyles(System.Collections.ArrayList fillstyles, SwfEncoder w, int shape)
- {
- int count = fillstyles.Count;
- if (count >= 0xFF)
- {
- w.writeUI8(0xFF);
- w.writeUI16(count);
- }
- else
- {
- w.writeUI8(count);
- }
-
- System.Collections.IEnumerator it = fillstyles.GetEnumerator();
- //UPGRADE_TODO: Method 'java.util.Iterator.hasNext' was converted to 'System.Collections.IEnumerator.MoveNext' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratorhasNext'"
- while (it.MoveNext())
- {
- //UPGRADE_TODO: Method 'java.util.Iterator.next' was converted to 'System.Collections.IEnumerator.Current' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratornext'"
- FillStyle style = (FillStyle) it.Current;
- encodeFillStyle(style, w, shape);
- }
- }
-
- private void encodeFillStyle(FillStyle style, SwfEncoder w, int shape)
- {
- w.writeUI8(style.type);
- switch (style.type)
- {
-
- case FillStyle.FILL_SOLID: // 0x00
- if ((shape == flash.swf.TagValues_Fields.stagDefineShape3) || (shape == flash.swf.TagValues_Fields.stagDefineShape6))
- encodeRGBA(style.color, w);
- else
- encodeRGB(style.color, w);
- break;
-
- case FillStyle.FILL_GRADIENT:
- // 0x10 linear gradient fill
- case FillStyle.FILL_RADIAL_GRADIENT:
- // 0x12 radial gradient fill
- case FillStyle.FILL_FOCAL_RADIAL_GRADIENT: // 0x13 focal radial gradient fill
- encodeMatrix(style.matrix, w);
- encodeGradient(style.gradient, w, shape);
- break;
-
- case FillStyle.FILL_BITS:
- // 0x40 tiled bitmap fill
- case (FillStyle.FILL_BITS | FillStyle.FILL_BITS_CLIP):
- // 0x41 clipped bitmap fill
- case (FillStyle.FILL_BITS | FillStyle.FILL_BITS_NOSMOOTH):
- // 0x42 tiled non-smoothed fill
- case (FillStyle.FILL_BITS | FillStyle.FILL_BITS_CLIP | FillStyle.FILL_BITS_NOSMOOTH): // 0x43 clipped non-smoothed fill
- w.writeUI16(dict.getId(style.bitmap));
- encodeMatrix(style.matrix, w);
- break;
- }
- }
-
- private void encodeGradient(Gradient gradient, SwfEncoder w, int shape)
- {
- w.writeUBits(gradient.spreadMode, 2);
- w.writeUBits(gradient.interpolationMode, 2);
- w.writeUBits(gradient.records.Length, 4);
- for (int i = 0; i < gradient.records.Length; i++)
- {
- encodeGradRecord(gradient.records[i], w, shape);
- }
- if (gradient is FocalGradient)
- {
- w.writeFixed8(((FocalGradient) gradient).focalPoint);
- }
- }
-
- private void encodeGradRecord(GradRecord record, SwfEncoder w, int shape)
- {
- w.writeUI8(record.ratio);
- if ((shape == flash.swf.TagValues_Fields.stagDefineShape3) || (shape == flash.swf.TagValues_Fields.stagDefineShape6))
- encodeRGBA(record.color, w);
- else
- encodeRGB(record.color, w);
- }
-
- public override void defineFont2(DefineFont2 tag)
- {
- int id = dict.add(tag);
- tagw.writeUI16(id);
- int startPos = tagw.Pos;
- bool again;
-
- if (tag.code == flash.swf.TagValues_Fields.stagDefineFont3)
- {
- tag.wideCodes = true;
- }
-
- if (!tag.wideCodes)
- {
- for (int i = 0; i < tag.codeTable.Length; i++)
- {
- if (tag.codeTable[i] > 255)
- {
- tag.wideCodes = true;
- break;
- }
- }
- }
-
- //UPGRADE_NOTE: Label 'loop' was moved. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1014'"
- do
- {
- again = false;
- tagw.writeBit(tag.hasLayout);
- tagw.writeBit(tag.shiftJIS);
- tagw.writeBit(tag.smallText);
- tagw.writeBit(tag.ansi);
- tagw.writeBit(tag.wideOffsets);
- tagw.writeBit(tag.wideCodes);
- tagw.writeBit(tag.italic);
- tagw.writeBit(tag.bold);
- tagw.flushBits();
-
- tagw.writeUI8(tag.langCode);
-
- tagw.writeLengthString(tag.fontName);
- int count = tag.glyphShapeTable.Length;
-
- tagw.writeUI16(count);
- int offsetPos = tagw.Pos;
-
- // save space for the offset table
- if (tag.wideOffsets)
- {
- for (int i = 0; i < count; i++)
- {
- tagw.write32(0);
- }
- }
- else
- {
- for (int i = 0; i < count; i++)
- {
- tagw.writeUI16(0);
- }
- }
-
- //PJF: write placeholder for codeTableOffset, this will be changed after shapes encoded
- if (count > 0)
- {
- if (tag.wideOffsets)
- {
- tagw.write32(0);
- }
- else
- {
- tagw.writeUI16(0);
- }
- }
-
- for (int i = 0; i < count; i++)
- {
- // save offset to this glyph
- int offset = tagw.Pos - offsetPos;
- if (!tag.wideOffsets && offset > 65535)
- {
- again = true;
- tag.wideOffsets = true;
- tagw.Pos = startPos;
- //UPGRADE_NOTE: Labeled continue statement was changed to a goto statement. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1015'"
- goto loop;
- }
- if (tag.wideOffsets)
- tagw.write32at(offsetPos + 4 * i, offset);
- else
- tagw.writeUI16at(offsetPos + 2 * i, offset);
-
- encodeShape(tag.glyphShapeTable[i], tagw, flash.swf.TagValues_Fields.stagDefineShape3, 1, 0);
- }
-
- // update codeTableOffset
- int offset2 = tagw.Pos - offsetPos;
- if (!tag.wideOffsets && offset2 > 65535)
- {
- again = true;
- tag.wideOffsets = true;
- tagw.Pos = startPos;
- //UPGRADE_NOTE: Labeled continue statement was changed to a goto statement. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1015'"
- goto loop;
- }
- if (tag.wideOffsets)
- {
- tagw.write32at(offsetPos + 4 * count, offset2);
- }
- else
- {
- tagw.writeUI16at(offsetPos + 2 * count, offset2);
- }
-
- // now write the codetable
-
- if (tag.wideCodes)
- {
- for (int i = 0; i < tag.codeTable.Length; i++)
- {
- tagw.writeUI16(tag.codeTable[i]);
- }
- }
- else
- {
- for (int i = 0; i < tag.codeTable.Length; i++)
- {
- tagw.writeUI8(tag.codeTable[i]);
- }
- }
-
- if (tag.hasLayout)
- {
- tagw.writeSI16(tag.ascent);
- tagw.writeSI16(tag.descent);
- tagw.writeSI16(tag.leading);
-
- for (int i = 0; i < tag.advanceTable.Length; i++)
- {
- tagw.writeSI16(tag.advanceTable[i]);
- }
-
- for (int i = 0; i < tag.boundsTable.Length; i++)
- {
- encodeRect(tag.boundsTable[i], tagw);
- }
-
- tagw.writeUI16(tag.kerningTable.Length);
-
- for (int i = 0; i < tag.kerningTable.Length; i++)
- {
- if (!tag.wideCodes && ((tag.kerningTable[i].code1 > 255) || (tag.kerningTable[i].code2 > 255)))
- {
- again = true;
- tag.wideCodes = true;
- tagw.Pos = startPos;
- //UPGRADE_NOTE: Labeled continue statement was changed to a goto statement. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1015'"
- goto loop;
- }
-
- encodeKerningRecord(tag.kerningTable[i], tagw, tag.wideCodes);
- }
- }
- //UPGRADE_NOTE: Label 'loop' was moved. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1014'"
-loop: ;
- }
- while (again);
-
- encodeTag(tag);
- }
-
- public override void defineFont3(DefineFont3 tag)
- {
- defineFont2(tag);
- }
-
- public override void defineFont4(DefineFont4 tag)
- {
- int id = dict.add(tag);
- tagw.writeUI16(id);
-
- tagw.writeUBits(0, 5); // reserved
- tagw.writeBit(tag.hasFontData);
- //tagw.writeBit(tag.smallText);
- tagw.writeBit(tag.italic);
- tagw.writeBit(tag.bold);
- tagw.flushBits();
-
- //tagw.writeUI8(tag.langCode);
- tagw.writeString(tag.fontName);
- if (tag.hasFontData)
- {
- tagw.write(tag.data);
- }
-
- encodeTag(tag);
- }
-
- public override void defineFontAlignZones(DefineFontAlignZones tag)
- {
- int fontID = dict.getId(tag.font);
- tagw.writeUI16(fontID);
- tagw.writeUBits(tag.csmTableHint, 2);
- tagw.writeUBits(0, 6); // reserved
- for (int i = 0; i < tag.zoneTable.Length; i++)
- {
- ZoneRecord record = tag.zoneTable[i];
- tagw.writeUI8(record.numZoneData);
- for (int j = 0; j < record.numZoneData; j++)
- {
- tagw.write32((int) record.zoneData[j]);
- }
- tagw.writeUI8(record.zoneMask);
- }
- encodeTag(tag);
- }
-
- public override void csmTextSettings(CSMTextSettings tag)
- {
- int textID = 0;
- if (tag.textReference != null)
- {
- textID = dict.getId(tag.textReference);
- }
- tagw.writeUI16(textID);
- tagw.writeUBits(tag.styleFlagsUseSaffron, 2);
- tagw.writeUBits(tag.gridFitType, 3);
- tagw.writeUBits(0, 3); // reserved
- // FIXME: thickness/sharpness should be written out as 32 bit IEEE Single Precision format in little Endian
- tagw.writeUBits((int) tag.thickness, 32);
- tagw.writeUBits((int) tag.sharpness, 32);
- tagw.writeUBits(0, 8); //reserved
-
- encodeTag(tag);
- }
-
- public override void defineFontName(DefineFontName tag)
- {
- int fontID = dict.getId(tag.font);
- tagw.writeUI16(fontID);
- if (tag.fontName != null)
- {
- tagw.writeString(tag.fontName);
- }
- else
- {
- tagw.writeString("");
- }
- if (tag.copyright != null)
- {
- tagw.writeString(tag.copyright);
- }
- else
- {
- tagw.writeString("");
- }
-
- encodeTag(tag);
- }
-
- private void encodeKerningRecord(KerningRecord kerningRecord, SwfEncoder w, bool wideCodes)
- {
- if (wideCodes)
- {
- w.writeUI16(kerningRecord.code1);
- w.writeUI16(kerningRecord.code2);
- }
- else
- {
- w.writeUI8(kerningRecord.code1);
- w.writeUI8(kerningRecord.code2);
- }
- w.writeUI16(kerningRecord.adjustment);
- }
-
- public override void defineFontInfo(DefineFontInfo tag)
- {
- int idref = dict.getId(tag.font);
- tagw.writeUI16(idref);
-
- tagw.writeLengthString(tag.name);
-
- tagw.writeUBits(0, 3); // reserved
- tagw.writeBit(tag.shiftJIS);
- tagw.writeBit(tag.ansi);
- tagw.writeBit(tag.italic);
- tagw.writeBit(tag.bold);
-
- if (tag.code == flash.swf.TagValues_Fields.stagDefineFontInfo2)
- {
- tagw.writeBit(tag.wideCodes = true);
- tagw.writeUI8(tag.langCode);
- }
- else
- {
- if (!tag.wideCodes)
- {
- for (int i = 0; i < tag.codeTable.Length; i++)
- {
- if (tag.codeTable[i] > 255)
- {
- tag.wideCodes = true;
- break;
- }
- }
- }
- tagw.writeBit(tag.wideCodes);
- }
-
- if (tag.wideCodes)
- {
- for (int i = 0; i < tag.codeTable.Length; i++)
- tagw.writeUI16(tag.codeTable[i]);
- }
- else
- {
- for (int i = 0; i < tag.codeTable.Length; i++)
- tagw.writeUI8(tag.codeTable[i]);
- }
- encodeTag(tag);
- }
-
- public override void defineFontInfo2(DefineFontInfo tag)
- {
- defineFontInfo(tag);
- }
-
- public override void defineMorphShape(DefineMorphShape tag)
- {
- defineMorphShape2(tag);
- }
-
- public override void defineMorphShape2(DefineMorphShape tag)
- {
- int id = dict.add(tag);
- tagw.writeUI16(id);
- encodeRect(tag.startBounds, tagw);
- encodeRect(tag.endBounds, tagw);
- if (tag.code == flash.swf.TagValues_Fields.stagDefineMorphShape2)
- {
- encodeRect(tag.startEdgeBounds, tagw);
- encodeRect(tag.endEdgeBounds, tagw);
- tagw.writeUBits(tag.reserved, 6);
- tagw.writeUBits(tag.usesNonScalingStrokes?1:0, 1);
- tagw.writeUBits(tag.usesScalingStrokes?1:0, 1);
- }
- tagw.write32(0);
- int pos = tagw.Pos;
- encodeMorphFillstyles(tag.fillStyles, tagw, tag.code);
- encodeMorphLinestyles(tag.lineStyles, tagw, tag.code);
- encodeShape(tag.startEdges, tagw, flash.swf.TagValues_Fields.stagDefineShape3, tag.fillStyles.Length, tag.lineStyles.Length);
- tagw.write32at(pos - 4, tagw.Pos - pos);
- // end shape contains only edges, no style information
- encodeShape(tag.endEdges, tagw, flash.swf.TagValues_Fields.stagDefineShape3, 0, 0);
- encodeTag(tag);
- }
-
- private void encodeMorphFillstyles(MorphFillStyle[] fillStyles, SwfEncoder w, int code)
- {
- int count = fillStyles.Length;
- if (count >= 0xFF)
- {
- w.writeUI8(0xFF);
- w.writeUI16(count);
- }
- else
- {
- w.writeUI8(count);
- }
-
- for (int i = 0; i < count; i++)
- {
- encodeMorphFillstyle(fillStyles[i], w, code);
- }
- }
-
- private void encodeMorphFillstyle(MorphFillStyle style, SwfEncoder w, int code)
- {
- w.writeUI8(style.type);
- switch (style.type)
- {
-
- case FillStyle.FILL_SOLID: // 0x00
- encodeRGBA(style.startColor, w);
- encodeRGBA(style.endColor, w);
- break;
-
- case FillStyle.FILL_GRADIENT:
- // 0x10 linear gradient fill
- case FillStyle.FILL_RADIAL_GRADIENT:
- // 0x12 radial gradient fill
- case FillStyle.FILL_FOCAL_RADIAL_GRADIENT: // 0x13 focal radial gradient fill
- encodeMatrix(style.startGradientMatrix, w);
- encodeMatrix(style.endGradientMatrix, w);
- encodeMorphGradient(style.gradRecords, w);
- if (style.type == FillStyle.FILL_FOCAL_RADIAL_GRADIENT && code == flash.swf.TagValues_Fields.stagDefineMorphShape2)
- {
- w.writeSI16(style.ratio1);
- w.writeSI16(style.ratio2);
- }
- break;
-
- case FillStyle.FILL_BITS:
- // 0x40 tiled bitmap fill
- case (FillStyle.FILL_BITS | FillStyle.FILL_BITS_CLIP):
- // 0x41 clipped bitmap fill
- case (FillStyle.FILL_BITS | FillStyle.FILL_BITS_NOSMOOTH):
- // 0x42 tiled non-smoothed fill
- case (FillStyle.FILL_BITS | FillStyle.FILL_BITS_CLIP | FillStyle.FILL_BITS_NOSMOOTH): // 0x43 clipped non-smoothed fill
- w.writeUI16(dict.getId(style.bitmap));
- encodeMatrix(style.startBitmapMatrix, w);
- encodeMatrix(style.endBitmapMatrix, w);
- break;
-
- default:
- assert(false);
- //throw new IOException("unrecognized fill style type: " + style.type);
- break;
-
- }
- }
-
- private void encodeMorphGradient(MorphGradRecord[] gradRecords, SwfEncoder w)
- {
- w.writeUI8(gradRecords.Length);
- for (int i = 0; i < gradRecords.Length; i++)
- {
- MorphGradRecord record = gradRecords[i];
- w.writeUI8(record.startRatio);
- encodeRGBA(record.startColor, w);
- w.writeUI8(record.endRatio);
- encodeRGBA(record.endColor, w);
- }
- }
-
- private void encodeMorphLinestyles(MorphLineStyle[] lineStyles, SwfEncoder w, int code)
- {
- if (lineStyles.Length >= 0xFF)
- {
- w.writeUI8(0xFF);
- w.writeUI16(lineStyles.Length);
- }
- else
- {
- w.writeUI8(lineStyles.Length);
- }
-
- for (int i = 0; i < lineStyles.Length; i++)
- {
- MorphLineStyle style = lineStyles[i];
- w.writeUI16(style.startWidth);
- w.writeUI16(style.endWidth);
- if (code == flash.swf.TagValues_Fields.stagDefineMorphShape2)
- {
- w.writeUBits(style.startCapsStyle, 2);
- w.writeUBits(style.jointStyle, 2);
- w.writeBit(style.hasFill);
- w.writeBit(style.noHScale);
- w.writeBit(style.noVScale);
- w.writeBit(style.pixelHinting);
- w.writeUBits(0, 5); // reserved
- w.writeBit(style.noClose);
- w.writeUBits(style.endCapsStyle, 2);
- if (style.jointStyle == 2)
- {
- w.writeUI16(style.miterLimit);
- }
- }
- if (!style.hasFill)
- {
- encodeRGBA(style.startColor, w);
- encodeRGBA(style.endColor, w);
- }
- if (style.hasFill)
- {
- encodeMorphFillstyle(style.fillType, w, code);
- }
- }
- }
-
- public override void defineShape(DefineShape tag)
- {
- int id = dict.add(tag);
- tagw.writeUI16(id);
- encodeRect(tag.bounds, tagw);
- if (tag.code == flash.swf.TagValues_Fields.stagDefineShape6)
- {
- encodeRect(tag.edgeBounds, tagw);
- tagw.writeUBits(0, 6);
- tagw.writeBit(tag.usesNonScalingStrokes);
- tagw.writeBit(tag.usesScalingStrokes);
- }
- encodeShapeWithStyle(tag.shapeWithStyle, tagw, tag.code);
- encodeTag(tag);
- }
-
- private void encodeShapeWithStyle(ShapeWithStyle shapeWithStyle, SwfEncoder w, int shape)
- {
- encodeFillstyles(shapeWithStyle.fillstyles, w, shape);
- encodeLinestyles(shapeWithStyle.linestyles, w, shape);
-
- encodeShape(shapeWithStyle, w, shape, shapeWithStyle.fillstyles.Count, shapeWithStyle.linestyles.Count);
- }
-
- public override void defineShape2(DefineShape tag)
- {
- defineShape(tag);
- }
-
- public override void defineShape3(DefineShape tag)
- {
- defineShape(tag);
- }
-
- public override void defineShape6(DefineShape tag)
- {
- defineShape(tag);
- }
-
- public override void defineSound(DefineSound tag)
- {
- int id = dict.add(tag);
- tagw.writeUI16(id);
- tagw.writeUBits(tag.format, 4);
- tagw.writeUBits(tag.rate, 2);
- tagw.writeUBits(tag.size, 1);
- tagw.writeUBits(tag.type, 1);
- tagw.write32((int) tag.sampleCount);
- tagw.write(tag.data);
- encodeTag(tag);
- }
-
- public override void defineSprite(DefineSprite tag)
- {
- int id = dict.add(tag);
- tagw.writeUI16(id);
- tagw.writeUI16(tag.framecount);
-
- if (Debug)
- {
- debug.adjust = writer.Pos + 6;
- }
-
- // save frame count
- int oldFrames = frames;
- frames = 0;
-
- // save the movie writer, and push a new writer
- SwfEncoder oldWriter = writer;
- writer = tagw;
- tagw = createEncoder(SwfVersion);
-
- // write sprite tags
- System.Collections.IList tags = tag.tagList.tags;
- int size = tags.Count;
- for (int i = 0; i < size; i++)
- {
- Tag t = (Tag) tags[i];
- if (!(t is DefineTag))
- t.visit(this);
- }
-
- // terminate with end marker
- writer.writeUI16(0);
-
- // update frame count
- writer.writeUI16at(2, frames);
-
- // restore writers
- tagw = writer;
- writer = oldWriter;
- frames = oldFrames;
-
- if (Debug)
- {
- debug.adjust = 0;
- }
-
- encodeTag(tag);
- }
-
- public override void defineText(DefineText tag)
- {
- encodeDefineText(tag, tagw, tag.code);
- encodeTag(tag);
- }
-
- private void encodeDefineText(DefineText tag, SwfEncoder w, int type)
- {
- int id = dict.add(tag);
- w.writeUI16(id);
- encodeRect(tag.bounds, w);
- encodeMatrix(tag.matrix, w);
- int length = tag.records.Count;
-
- // compute necessary bit width
- int glyphBits = 0;
- int advanceBits = 0;
- for (int i = 0; i < length; i++)
- {
- TextRecord tr = (TextRecord) tag.records[i];
-
- for (int j = 0; j < tr.entries.Length; j++)
- {
- GlyphEntry entry = tr.entries[j];
-
- while (entry.Index > (1 << glyphBits))
- glyphBits++;
- while (System.Math.Abs(entry.advance) > (1 << advanceBits))
- advanceBits++;
- }
- }
-
- // increment to get from bit index to bit count.
- ++glyphBits;
- ++advanceBits;
-
- w.writeUI8(glyphBits);
- w.writeUI8(++advanceBits); // add one extra bit because advances are signed
-
- for (int i = 0; i < length; i++)
- {
- TextRecord record = (TextRecord) tag.records[i];
- encodeTextRecord(record, w, type, glyphBits, advanceBits);
- }
-
- w.writeUI8(0);
- }
-
- private void encodeFilterList(System.Collections.IList filters, SwfEncoder w)
- {
- int count = filters.Count;
- w.writeUI8(count);
- //UPGRADE_TODO: Method 'java.util.Iterator.hasNext' was converted to 'System.Collections.IEnumerator.MoveNext' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratorhasNext'"
- for (System.Collections.IEnumerator it = filters.GetEnumerator(); it.MoveNext(); )
- {
- //UPGRADE_TODO: Method 'java.util.Iterator.next' was converted to 'System.Collections.IEnumerator.Current' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratornext'"
- Filter f = (Filter) it.Current;
- w.writeUI8(f.getID());
- // I've never quite understood why the serialization code isn't in the tags themselves..
- switch (f.getID())
- {
-
- case DropShadowFilter.ID: encodeDropShadowFilter(w, (DropShadowFilter) f); break;
-
- case BlurFilter.ID: encodeBlurFilter(w, (BlurFilter) f); break;
-
- case ConvolutionFilter.ID: encodeConvolutionFilter(w, (ConvolutionFilter) f); break;
-
- case GlowFilter.ID: encodeGlowFilter(w, (GlowFilter) f); break;
-
- case BevelFilter.ID: encodeBevelFilter(w, (BevelFilter) f); break;
-
- case ColorMatrixFilter.ID: encodeColorMatrixFilter(w, (ColorMatrixFilter) f); break;
-
- case GradientGlowFilter.ID: encodeGradientGlowFilter(w, (GradientGlowFilter) f); break;
-
- case GradientBevelFilter.ID: encodeGradientBevelFilter(w, (GradientBevelFilter) f); break;
- }
- }
- }
-
- private void encodeDropShadowFilter(SwfEncoder w, DropShadowFilter f)
- {
- encodeRGBA(f.color, w);
- w.write32(f.blurX);
- w.write32(f.blurY);
- w.write32(f.angle);
- w.write32(f.distance);
- w.writeUI16(f.strength);
- w.writeUI8(f.flags);
- }
-
- private void encodeBlurFilter(SwfEncoder w, BlurFilter f)
- {
- w.write32(f.blurX);
- w.write32(f.blurY);
- w.writeUI8(f.passes);
- }
- private void encodeColorMatrixFilter(SwfEncoder w, ColorMatrixFilter f)
- {
- for (int i = 0; i < 20; ++i)
- {
- w.writeFloat(f.values[i]);
- }
- }
- private void encodeConvolutionFilter(SwfEncoder w, ConvolutionFilter f)
- {
- w.writeUI8(f.matrixX);
- w.writeUI8(f.matrixY);
- w.writeFloat(f.divisor);
- w.writeFloat(f.bias);
- for (int i = 0; i < f.matrix.Length; ++i)
- w.writeFloat(f.matrix[i]);
- w.writeUI8(f.flags);
- }
- private void encodeGlowFilter(SwfEncoder w, GlowFilter f)
- {
- encodeRGBA(f.color, w);
- w.write32(f.blurX);
- w.write32(f.blurY);
- w.writeUI16(f.strength);
- w.writeUI8(f.flags);
- }
- private void encodeBevelFilter(SwfEncoder w, BevelFilter f)
- {
- encodeRGBA(f.shadowColor, w);
- encodeRGBA(f.highlightColor, w);
- w.write32(f.blurX);
- w.write32(f.blurY);
- w.write32(f.angle);
- w.write32(f.distance);
- w.writeUI16(f.strength);
- w.writeUI8(f.flags);
- }
-
- private void encodeGradientGlowFilter(SwfEncoder w, GradientGlowFilter f)
- {
- w.writeUI8(f.numcolors);
- for (int i = 0; i < f.numcolors; ++i)
- encodeRGBA(f.gradientColors[i], w);
- for (int i = 0; i < f.numcolors; ++i)
- w.writeUI8(f.gradientRatio[i]);
- //w.write32( f.color );
- w.write32(f.blurX);
- w.write32(f.blurY);
- w.write32(f.angle);
- w.write32(f.distance);
- w.writeUI16(f.strength);
- w.writeUI8(f.flags);
- }
- private void encodeGradientBevelFilter(SwfEncoder w, GradientBevelFilter f)
- {
- w.writeUI8(f.numcolors);
- for (int i = 0; i < f.numcolors; ++i)
- encodeRGBA(f.gradientColors[i], w);
- for (int i = 0; i < f.numcolors; ++i)
- w.writeUI8(f.gradientRatio[i]);
-
- // w.write32( f.shadowColor );
- // w.write32( f.highlightColor );
- w.write32(f.blurX);
- w.write32(f.blurY);
- w.write32(f.angle);
- w.write32(f.distance);
- w.writeUI16(f.strength);
- w.writeUI8(f.flags);
- }
-
- private void encodeTextRecord(TextRecord record, SwfEncoder w, int type, int glyphBits, int advanceBits)
- {
- w.writeUI8(record.flags);
-
- if (record.hasFont())
- {
- w.writeUI16(dict.getId(record.font));
- }
-
- if (record.hasColor())
- {
- if (type == flash.swf.TagValues_Fields.stagDefineText2)
- encodeRGBA(record.color, w);
- else
- encodeRGB(record.color, w);
- }
-
- if (record.hasX())
- {
- w.writeSI16(record.xOffset);
- }
-
- if (record.hasY())
- {
- w.writeSI16(record.yOffset);
- }
-
- if (record.hasHeight())
- {
- w.writeUI16(record.height);
- }
-
- w.writeUI8(record.entries.Length);
-
- for (int i = 0; i < record.entries.Length; i++)
- {
- w.writeUBits(record.entries[i].Index, glyphBits);
- w.writeSBits(record.entries[i].advance, advanceBits);
- }
- w.flushBits();
- }
-
- public override void defineText2(DefineText tag)
- {
- defineText(tag);
- }
-
- public override void defineVideoStream(DefineVideoStream tag)
- {
- int id = dict.add(tag);
- tagw.writeUI16(id);
- tagw.writeUI16(tag.numFrames);
- tagw.writeUI16(tag.width);
- tagw.writeUI16(tag.height);
-
- tagw.writeUBits(0, 4); // reserved
- tagw.writeUBits(tag.deblocking, 3);
- tagw.writeBit(tag.smoothing);
-
- tagw.writeUI8(tag.codecID);
- encodeTag(tag);
- }
-
- public override void doAction(DoAction tag)
- {
- int adjust = 0;
- if (Debug)
- {
- adjust = writer.Pos + 6;
- debug.adjust += adjust;
- }
-
- new ActionEncoder(tagw, debug).encode(tag.actionList);
- tagw.writeUI8(0);
- encodeTag(tag);
-
- if (Debug)
- {
- debug.adjust -= adjust;
- }
- }
-
- public override void doInitAction(DoInitAction tag)
- {
- int adjust = 0;
- if (Debug)
- {
- adjust = writer.Pos + 6;
- debug.adjust += adjust;
- }
-
- int idref = dict.getId(tag.sprite);
- tagw.writeUI16(idref);
- new ActionEncoder(tagw, debug).encode(tag.actionList);
- tagw.writeUI8(0);
- encodeTag(tag);
-
- if (Debug)
- {
- debug.adjust -= adjust;
- }
- }
-
- public override void enableDebugger(EnableDebugger tag)
- {
- tagw.writeString(tag.password);
- encodeTag(tag);
- }
-
- public override void enableDebugger2(EnableDebugger tag)
- {
- // This corresponds to the constant used in the player,
- // core/splay.cpp, in ScriptThread::EnableDebugger().
- tagw.writeUI16(0x1975);
- tagw.writeString(tag.password);
- encodeTag(tag);
- }
-
- public override void exportAssets(ExportAssets tag)
- {
- tagw.writeUI16(tag.exports.Count);
- System.Collections.IEnumerator it = tag.exports.GetEnumerator();
- //UPGRADE_TODO: Method 'java.util.Iterator.hasNext' was converted to 'System.Collections.IEnumerator.MoveNext' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratorhasNext'"
- while (it.MoveNext())
- {
- //UPGRADE_TODO: Method 'java.util.Iterator.next' was converted to 'System.Collections.IEnumerator.Current' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratornext'"
- DefineTag ref_Renamed = (DefineTag) it.Current;
- int idref = dict.getId(ref_Renamed);
- tagw.writeUI16(idref);
- assert(ref_Renamed.name != null); // exported symbols must have names
- tagw.writeString(ref_Renamed.name);
- dict.addName(ref_Renamed, ref_Renamed.name);
- }
- encodeTag(tag);
- }
-
- public override void symbolClass(SymbolClass tag)
- {
- tagw.writeUI16(tag.class2tag.Count + (tag.topLevelClass != null?1:0));
- //UPGRADE_TODO: Method 'java.util.Map.entrySet' was converted to 'SupportClass.HashSetSupport' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilMapentrySet'"
- System.Collections.IEnumerator it = new SupportClass.HashSetSupport(tag.class2tag).GetEnumerator();
- //UPGRADE_TODO: Method 'java.util.Iterator.hasNext' was converted to 'System.Collections.IEnumerator.MoveNext' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratorhasNext'"
- while (it.MoveNext())
- {
- //UPGRADE_TODO: Method 'java.util.Iterator.next' was converted to 'System.Collections.IEnumerator.Current' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratornext'"
- System.Collections.DictionaryEntry e = (System.Collections.DictionaryEntry) it.Current;
- System.String name = (System.String) e.Key;
- DefineTag ref_Renamed = (DefineTag) e.Value;
-
- int idref = dict.getId(ref_Renamed);
- tagw.writeUI16(idref);
- tagw.writeString(name);
- }
- if (tag.topLevelClass != null)
- {
- tagw.writeUI16(0);
- tagw.writeString(tag.topLevelClass);
- }
- encodeTag(tag);
- }
-
- public override void frameLabel(FrameLabel tag)
- {
- tagw.writeString(tag.label);
- if (tag.anchor && SwfVersion >= 6)
- {
- tagw.writeUI8(1);
- }
- encodeTag(tag);
- }
-
- public override void importAssets(ImportAssets tag)
- {
- tagw.writeString(tag.url);
- if (tag.code == flash.swf.TagValues_Fields.stagImportAssets2)
- {
- tagw.writeUI8(tag.downloadNow?1:0);
- tagw.writeUI8(tag.SHA1 != null?1:0);
- if (tag.SHA1 != null)
- {
- tagw.write(tag.SHA1);
- }
- }
- tagw.writeUI16(tag.importRecords.Count);
- System.Collections.IEnumerator it = tag.importRecords.GetEnumerator();
- //UPGRADE_TODO: Method 'java.util.Iterator.hasNext' was converted to 'System.Collections.IEnumerator.MoveNext' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratorhasNext'"
- while (it.MoveNext())
- {
- //UPGRADE_TODO: Method 'java.util.Iterator.next' was converted to 'System.Collections.IEnumerator.Current' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratornext'"
- ImportRecord record = (ImportRecord) it.Current;
- int id = dict.add(record);
- tagw.writeUI16(id);
- tagw.writeString(record.name);
- }
- encodeTag(tag);
- }
-
- public override void importAssets2(ImportAssets tag)
- {
- importAssets(tag);
- }
-
- public override void jpegTables(GenericTag tag)
- {
- encodeTagHeader(tag.code, tag.data.Length, false);
- writer.write(tag.data);
- }
-
- public override void placeObject(PlaceObject tag)
- {
- int idref = dict.getId(tag.ref_Renamed);
- tagw.writeUI16(idref);
- tagw.writeUI16(tag.depth);
- encodeMatrix(tag.matrix, tagw);
- if (tag.colorTransform != null)
- {
- encodeCxform(tag.colorTransform, tagw);
- }
- encodeTag(tag);
- }
-
- public override void placeObject2(PlaceObject tag)
- {
- placeObject23(tag);
- }
-
- public override void placeObject3(PlaceObject tag)
- {
- placeObject23(tag);
- }
-
- public virtual void placeObject23(PlaceObject tag)
- {
- tagw.writeUI8(tag.flags);
- if (tag.code == flash.swf.TagValues_Fields.stagPlaceObject3)
- {
- tagw.writeUI8(tag.flags2);
- }
- tagw.writeUI16(tag.depth);
- if (tag.hasClassName())
- {
- tagw.writeString(tag.className);
- }
- if (tag.hasCharID())
- {
- int idref = dict.getId(tag.ref_Renamed);
- tagw.writeUI16(idref);
- }
- if (tag.hasMatrix())
- {
- encodeMatrix(tag.matrix, tagw);
- }
- if (tag.hasCxform())
- {
- // ed 5/22/03 the SWF 6 file format spec says this should be a CXFORM, but
- // the spec is wrong. the player expects a CXFORMA.
- encodeCxforma(((CXFormWithAlpha) tag.colorTransform), tagw);
- }
- if (tag.hasRatio())
- {
- tagw.writeUI16(tag.ratio);
- }
- if (tag.hasName())
- {
- tagw.writeString(tag.name);
- }
- if (tag.hasClipDepth())
- {
- tagw.writeUI16(tag.clipDepth);
- }
- if (tag.code == flash.swf.TagValues_Fields.stagPlaceObject3)
- {
- if (tag.hasFilterList())
- {
- encodeFilterList(tag.filters, tagw);
- }
- if (tag.hasBlendMode())
- {
- tagw.writeUI8(tag.blendMode);
- }
- }
- if (tag.hasClipAction())
- {
- int adjust = 0;
- if (Debug)
- {
- adjust = writer.Pos + 6;
- debug.adjust += adjust;
- }
- new ActionEncoder(tagw, debug).encodeClipActions(tag.clipActions);
- if (Debug)
- {
- debug.adjust -= adjust;
- }
- }
- encodeTag(tag);
- }
-
- public override void protect(GenericTag tag)
- {
- if (tag.data != null)
- {
- encodeTagHeader(tag.code, tag.data.Length, false);
- writer.write(tag.data);
- }
- else
- {
- encodeTagHeader(tag.code, 0, false);
- }
- }
-
- public override void removeObject(RemoveObject tag)
- {
- encodeTagHeader(tag.code, 4, false);
- int idref = dict.getId(tag.ref_Renamed);
- writer.writeUI16(idref);
- writer.writeUI16(tag.depth);
- }
-
- public override void removeObject2(RemoveObject tag)
- {
- encodeTagHeader(tag.code, 2, false);
- writer.writeUI16(tag.depth);
- }
-
- public override void showFrame(ShowFrame tag)
- {
- encodeTagHeader(tag.code, 0, false);
- frames++;
- }
-
- public override void soundStreamBlock(GenericTag tag)
- {
- encodeTagHeader(tag.code, tag.data.Length, false);
- writer.write(tag.data);
- }
-
- public override void soundStreamHead(SoundStreamHead tag)
- {
- int length = 4;
-
- // we need to add two bytes for an extra SI16 (latencySeek)
- if (tag.compression == SoundStreamHead.sndCompressMP3)
- {
- length += 2;
- }
-
- encodeTagHeader(tag.code, length, false);
-
- // 1 byte
- writer.writeUBits(0, 4); // reserved
- writer.writeUBits(tag.playbackRate, 2);
- writer.writeUBits(tag.playbackSize, 1);
- writer.writeUBits(tag.playbackType, 1);
-
- // 1 byte
- writer.writeUBits(tag.compression, 4);
- writer.writeUBits(tag.streamRate, 2);
- writer.writeUBits(tag.streamSize, 1);
- writer.writeUBits(tag.streamType, 1);
-
- // 2 bytes
- writer.writeUI16(tag.streamSampleCount);
-
- if (tag.compression == SoundStreamHead.sndCompressMP3)
- {
- // 2 bytes
- writer.writeSI16(tag.latencySeek);
- }
- }
-
- public override void soundStreamHead2(SoundStreamHead tag)
- {
- soundStreamHead(tag);
- }
-
- public override void startSound(StartSound tag)
- {
- int idref = dict.getId(tag.sound);
- tagw.writeUI16(idref);
- encodeSoundInfo(tag.soundInfo, tagw);
- encodeTag(tag);
- }
-
- public override void videoFrame(VideoFrame tag)
- {
- encodeTagHeader(tag.code, 4 + tag.videoData.Length, false);
- int idref = dict.getId(tag.stream);
- writer.writeUI16(idref);
- writer.writeUI16(tag.frameNum);
- writer.write(tag.videoData);
- }
-
- public override void defineSceneAndFrameLabelData(DefineSceneAndFrameLabelData tag)
- {
- encodeTagHeader(tag.code, tag.data.Length, false);
- writer.write(tag.data);
- }
-
- public override void doABC(DoABC tag)
- {
- if (tag.code == flash.swf.TagValues_Fields.stagDoABC2)
- {
- encodeTagHeader(tag.code, 4 + tag.name.Length + 1 + tag.abc.Length, false);
- writer.write32(tag.flag);
- writer.writeString(tag.name);
- }
- else
- {
- encodeTagHeader(tag.code, tag.abc.Length, false);
- }
-
- writer.write(tag.abc);
- }
-
- public override void unknown(GenericTag tag)
- {
- encodeTagHeader(tag.code, tag.data.Length, false);
- writer.write(tag.data);
- }
-
- public virtual sbyte[] toByteArray()
- {
- //TODO this could be improved, tricky bit is that writeTo is not trivial
- // and has the side effect of compressing (meaning the writer.size()
- // may be larger than necessary)
- System.IO.MemoryStream out_Renamed = new System.IO.MemoryStream(writer.Length);
- writeTo(out_Renamed);
- return SupportClass.ToSByteArray(out_Renamed.ToArray());
- }
-
- public override void scriptLimits(ScriptLimits tag)
- {
- tagw.writeUI16(tag.scriptRecursionLimit);
- tagw.writeUI16(tag.scriptTimeLimit);
- encodeTag(tag);
- }
- }
+////////////////////////////////////////////////////////////////////////////////
+//
+// ADOBE SYSTEMS INCORPORATED
+// Copyright 2003-2007 Adobe Systems Incorporated
+// All Rights Reserved.
+//
+// NOTICE: Adobe permits you to use, modify, and distribute this file
+// in accordance with the terms of the license agreement accompanying it.
+//
+////////////////////////////////////////////////////////////////////////////////
+using System;
+using flash.swf.tags;
+using ButtonCondAction = flash.swf.types.ButtonCondAction;
+using ButtonRecord = flash.swf.types.ButtonRecord;
+using CXForm = flash.swf.types.CXForm;
+using CXFormWithAlpha = flash.swf.types.CXFormWithAlpha;
+using CurvedEdgeRecord = flash.swf.types.CurvedEdgeRecord;
+using EdgeRecord = flash.swf.types.EdgeRecord;
+using FillStyle = flash.swf.types.FillStyle;
+using GlyphEntry = flash.swf.types.GlyphEntry;
+using GradRecord = flash.swf.types.GradRecord;
+using ImportRecord = flash.swf.types.ImportRecord;
+using KerningRecord = flash.swf.types.KerningRecord;
+using LineStyle = flash.swf.types.LineStyle;
+using MD5 = flash.swf.types.MD5;
+using Matrix = flash.swf.types.Matrix;
+using MorphFillStyle = flash.swf.types.MorphFillStyle;
+using MorphGradRecord = flash.swf.types.MorphGradRecord;
+using MorphLineStyle = flash.swf.types.MorphLineStyle;
+using Rect = flash.swf.types.Rect;
+using Shape = flash.swf.types.Shape;
+using ShapeRecord = flash.swf.types.ShapeRecord;
+using ShapeWithStyle = flash.swf.types.ShapeWithStyle;
+using SoundInfo = flash.swf.types.SoundInfo;
+using StraightEdgeRecord = flash.swf.types.StraightEdgeRecord;
+using StyleChangeRecord = flash.swf.types.StyleChangeRecord;
+using TextRecord = flash.swf.types.TextRecord;
+using Filter = flash.swf.types.Filter;
+using DropShadowFilter = flash.swf.types.DropShadowFilter;
+using BlurFilter = flash.swf.types.BlurFilter;
+using ColorMatrixFilter = flash.swf.types.ColorMatrixFilter;
+using GlowFilter = flash.swf.types.GlowFilter;
+using ConvolutionFilter = flash.swf.types.ConvolutionFilter;
+using BevelFilter = flash.swf.types.BevelFilter;
+using GradientGlowFilter = flash.swf.types.GradientGlowFilter;
+using GradientBevelFilter = flash.swf.types.GradientBevelFilter;
+using Gradient = flash.swf.types.Gradient;
+using FocalGradient = flash.swf.types.FocalGradient;
+namespace flash.swf
+{
+
+ public class TagEncoder:TagHandler, TagValues
+ {
+ virtual public int Pos
+ {
+ get
+ {
+ return writer.Pos;
+ }
+
+ }
+ virtual protected internal int SwfVersion
+ {
+ get
+ {
+ return header_Renamed_Field.version;
+ }
+
+ }
+ virtual protected internal int FrameRate
+ {
+ get
+ {
+ return header_Renamed_Field.rate;
+ }
+
+ }
+ virtual public Dictionary EncoderDictionary
+ {
+ set
+ {
+ assert((this.dict == null) || (this.dict.ids.Count == 0));
+ this.dict = value;
+ }
+
+ }
+ virtual public Dictionary Dictionary
+ {
+ get
+ {
+ return dict;
+ }
+
+ }
+ virtual public bool Debug
+ {
+ get
+ {
+ return debug != null;
+ }
+
+ }
+ virtual public int Width
+ {
+ get
+ {
+ return width / 20;
+ }
+
+ }
+ virtual public int Height
+ {
+ get
+ {
+ return height / 20;
+ }
+
+ }
+ virtual public System.String MainDebugScript
+ {
+ set
+ {
+ debug.MainDebugScript = value;
+ }
+
+ }
+ override public SetBackgroundColor BackgroundColor
+ {
+ set
+ {
+ encodeTagHeader(value.code, 3, false);
+ encodeRGB(value.color, writer);
+ }
+
+ }
+ override public SetTabIndex TabIndex
+ {
+ set
+ {
+ tagw.writeUI16(value.depth);
+ tagw.writeUI16(value.index);
+ encodeTag(value);
+ }
+
+ }
+ // changed from private to protected to support Flash Authoring - jkamerer 2007.07.30
+ protected internal SwfEncoder writer;
+ private SwfEncoder tagw;
+ private int width;
+ private int height;
+ private int frames;
+ private int framecountPos;
+ private DebugEncoder debug;
+ private Header header_Renamed_Field;
+
+ protected internal Dictionary dict;
+ private int uuidOffset;
+
+ public TagEncoder()
+ {
+ dict = new Dictionary();
+ }
+
+ public TagEncoder(Dictionary dict)
+ {
+ this.dict = dict;
+ }
+
+ public override void productInfo(ProductInfo tag)
+ {
+ tagw.write32(tag.Product);
+ tagw.write32(tag.Edition);
+ tagw.write(new sbyte[]{tag.MajorVersion, tag.MinorVersion});
+ tagw.write64(tag.Build);
+ tagw.write64(tag.CompileDate);
+ encodeTag(tag);
+ }
+
+ public override void fileAttributes(FileAttributes tag)
+ {
+ tagw.writeUBits(0, 3);
+ tagw.writeBit(tag.hasMetadata);
+ tagw.writeBit(tag.actionScript3);
+ tagw.writeBit(tag.suppressCrossDomainCaching);
+ tagw.writeBit(tag.swfRelativeUrls);
+ tagw.writeBit(tag.useNetwork);
+ tagw.writeUBits(0, 24);
+ encodeTag(tag);
+ }
+
+ public override void metadata(Metadata tag)
+ {
+ tagw.writeString(tag.xml);
+ encodeTag(tag);
+ }
+
+ protected internal virtual SwfEncoder createEncoder(int swfVersion)
+ {
+ return new SwfEncoder(swfVersion);
+ }
+
+ public override void header(Header header)
+ {
+ // get some header properties we need to know
+ int swfVersion = header.version;
+ this.header_Renamed_Field = header;
+ this.writer = createEncoder(swfVersion);
+ this.tagw = createEncoder(swfVersion);
+ width = header.size.Width;
+ height = header.size.Height;
+ frames = 0;
+
+ // write the header
+ writer.writeUI8(header.compressed?'C':'F');
+ writer.writeUI8('W');
+ writer.writeUI8('S');
+ writer.writeUI8(header.version);
+ writer.write32((int) header.length);
+ if (header.compressed)
+ {
+ writer.markComp();
+ }
+ encodeRect(header.size, writer);
+ writer.writeUI8(header.rate >> 8);
+ writer.writeUI8(header.rate & 255);
+ framecountPos = writer.Pos;
+ writer.writeUI16(header.framecount);
+ }
+
+ public override void finish()
+ {
+ // write end marker
+ writer.writeUI16(0);
+
+ // update the length
+ writer.write32at(4, writer.Pos);
+
+ // update the frame count
+ writer.writeUI16at(framecountPos, frames);
+
+ if (debug != null)
+ {
+ // compute a crc and use it for the debug id. that way it
+ // is wholly dependent on the bytes in the SWF and not some
+ // outside value. If any of the bytes are different,
+ // then the UUID will be different.
+ sbyte[] md5 = MD5.getDigest(writer.ByteArray, writer.Length);
+ writer.writeAt(uuidOffset, md5);
+ debug.updateUUID(md5);
+ }
+ }
+
+ public virtual void writeTo(System.IO.Stream out_Renamed)
+ {
+ writer.WriteTo(out_Renamed);
+ }
+
+
+ public virtual void writeDebugTo(System.IO.Stream out_Renamed)
+ {
+ debug.writeTo(out_Renamed);
+ }
+
+ public virtual void encodeRect(Rect r, SwfEncoder w)
+ {
+ int nBits = r.nbits();
+ w.writeUBits(nBits, 5);
+ w.writeSBits(r.xMin, nBits);
+ w.writeSBits(r.xMax, nBits);
+ w.writeSBits(r.yMin, nBits);
+ w.writeSBits(r.yMax, nBits);
+ w.flushBits();
+ }
+
+ public override void debugID(DebugID tag)
+ {
+ encodeTagHeader(tag.code, tag.uuid.bytes.Length, false);
+ uuidOffset = writer.Pos;
+ writer.write(tag.uuid.bytes);
+
+ debug = new DebugEncoder();
+ debug.header(SwfVersion);
+ debug.uuid(tag.uuid);
+ }
+
+ private void encodeTag(Tag tag)
+ {
+ try
+ {
+ tagw.compress();
+ encodeTagHeader(tag.code, tagw.Pos, isLongHeader(tag));
+ tagw.WriteTo(writer);
+ tagw.reset();
+ }
+ catch (System.IO.IOException e)
+ {
+ assert(false);
+ }
+ }
+
+ private bool isLongHeader(Tag t)
+ {
+ switch (t.code)
+ {
+
+ // [preilly] In the player code, ScriptThread::DefineBits() assumes all DefineBits
+ // tags use a long header. See "ch->data = AttachData(pos-8);". If the player
+ // also supported a short header, it would use "pos-4".
+ case flash.swf.TagValues_Fields.stagDefineBits:
+ case flash.swf.TagValues_Fields.stagDefineBitsJPEG2:
+ case flash.swf.TagValues_Fields.stagDefineBitsJPEG3:
+ case flash.swf.TagValues_Fields.stagDefineBitsLossless:
+ case flash.swf.TagValues_Fields.stagDefineBitsLossless2:
+ return true;
+
+ // [ed] the FlashPaper codebase also indicates that stagSoundStreamBlock must use
+ // a long format header. todo - verify by looking at the player code.
+
+ case flash.swf.TagValues_Fields.stagSoundStreamBlock:
+ return true;
+
+ // [edsmith] these tags have code in them. When we're writing a SWD, we use long headers
+ // so we can predict SWF offsets correctly when writing SWD line/offset records.
+
+ case flash.swf.TagValues_Fields.stagDefineButton:
+ case flash.swf.TagValues_Fields.stagDefineButton2:
+ case flash.swf.TagValues_Fields.stagDefineSprite:
+ case flash.swf.TagValues_Fields.stagDoInitAction:
+ case flash.swf.TagValues_Fields.stagDoAction:
+ return Debug;
+
+
+ case flash.swf.TagValues_Fields.stagPlaceObject2:
+ return Debug && ((PlaceObject) t).hasClipAction();
+
+ // all other tags will use short/long headers depending on their length
+
+ default:
+ return false;
+
+ }
+ }
+
+ private void encodeTagHeader(int code, int length, bool longHeader)
+ {
+ if (longHeader || length >= 63)
+ {
+ writer.writeUI16((code << 6) | 63);
+ writer.write32(length);
+ }
+ else
+ {
+ writer.writeUI16((code << 6) | length);
+ }
+ }
+
+ public override void defineScalingGrid(DefineScalingGrid tag)
+ {
+ int idref = dict.getId(tag.scalingTarget);
+ tagw.writeUI16(idref);
+ encodeRect(tag.rect, tagw);
+ encodeTag(tag);
+ }
+
+ public override void defineBinaryData(DefineBinaryData tag)
+ {
+ encodeTagHeader(tag.code, 6 + tag.data.Length, false);
+ int id = dict.add(tag);
+ writer.writeUI16(id);
+ writer.write32(tag.reserved);
+ writer.write(tag.data);
+ }
+
+ public override void defineBits(DefineBits tag)
+ {
+ encodeTagHeader(tag.code, 2 + tag.data.Length, true);
+ int id = dict.add(tag);
+ writer.writeUI16(id);
+ writer.write(tag.data);
+ }
+
+ public override void defineBitsJPEG2(DefineBits tag)
+ {
+ defineBits(tag);
+ }
+
+ public override void defineBitsJPEG3(DefineBitsJPEG3 tag)
+ {
+ int id = dict.add(tag);
+ tagw.writeUI16(id);
+ tagw.write32(tag.data.Length);
+ tagw.write(tag.data);
+ tagw.markComp();
+ tagw.write(tag.alphaData);
+ encodeTag(tag);
+ }
+
+ public override void defineBitsLossless(DefineBitsLossless tag)
+ {
+ int id = dict.add(tag);
+ tagw.writeUI16(id);
+ tagw.writeUI8(tag.format);
+ tagw.writeUI16(tag.width);
+ tagw.writeUI16(tag.height);
+ switch (tag.format)
+ {
+
+ case 3:
+ tagw.writeUI8(tag.colorData.Length - 1);
+ tagw.markComp();
+ encodeColorMapData(tag.colorData, tag.data, tagw);
+ break;
+
+ case 4:
+ case 5:
+ tagw.markComp();
+ encodeBitmapData(tag.data, tagw);
+ break;
+ }
+ encodeTag(tag);
+ }
+
+ private void encodeBitmapData(sbyte[] data, SwfEncoder w)
+ {
+ w.write(data);
+ }
+
+ private void encodeColorMapData(int[] colorData, sbyte[] pixelData, SwfEncoder w)
+ {
+ for (int i = 0; i < colorData.Length; i++)
+ {
+ encodeRGB(colorData[i], w);
+ }
+ w.write(pixelData);
+ }
+
+ /// as 0x00RRGGBB
+ ///
+ ///
+ ///
+ private void encodeRGB(int rgb, SwfEncoder w)
+ {
+ w.writeUI8(SupportClass.URShift(rgb, 16)); // red. we don't mask this because if rgb has an Alpha value, something's wrong
+ w.writeUI8((SupportClass.URShift(rgb, 8)) & 255);
+ w.writeUI8(rgb & 255); // blue
+ }
+
+ public override void defineBitsLossless2(DefineBitsLossless tag)
+ {
+ int id = dict.add(tag);
+ tagw.writeUI16(id);
+ tagw.writeUI8(tag.format);
+ tagw.writeUI16(tag.width);
+ tagw.writeUI16(tag.height);
+ switch (tag.format)
+ {
+
+ case 3:
+ tagw.writeUI8(tag.colorData.Length - 1);
+ tagw.markComp();
+ encodeAlphaColorMapData(tag.colorData, tag.data, tagw);
+ break;
+
+ case 4:
+ case 5:
+ tagw.markComp();
+ encodeBitmapData(tag.data, tagw);
+ break;
+ }
+ encodeTag(tag);
+ }
+
+ private void encodeAlphaColorMapData(int[] colorData, sbyte[] pixelData, SwfEncoder w)
+ {
+ for (int i = 0; i < colorData.Length; i++)
+ {
+ encodeRGBA(colorData[i], w);
+ }
+ w.write(pixelData);
+ }
+
+ /// as 0xAARRGGBB
+ ///
+ ///
+ ///
+ private void encodeRGBA(int rgba, SwfEncoder w)
+ {
+ w.writeUI8((SupportClass.URShift(rgba, 16)) & 255); // red
+ w.writeUI8((SupportClass.URShift(rgba, 8)) & 255); // green
+ w.writeUI8(rgba & 255); // blue
+ w.writeUI8(SupportClass.URShift(rgba, 24)); // alpha
+ }
+
+ public override void defineButton(DefineButton tag)
+ {
+ int id = dict.add(tag);
+ tagw.writeUI16(id);
+
+ if (Debug)
+ {
+ debug.adjust = writer.Pos + 6;
+ }
+
+ for (int i = 0; i < tag.buttonRecords.Length; i++)
+ {
+ encodeButtonRecord(tag.buttonRecords[i], tagw, tag.code);
+ }
+ tagw.writeUI8(0); // no more button records
+
+ // assume there is only one condition we will handle
+ new ActionEncoder(tagw, debug).encode(tag.condActions[0].actionList);
+ tagw.writeUI8(0); // write action end flag, must be zero
+ encodeTag(tag);
+
+ if (Debug)
+ {
+ debug.adjust = 0;
+ }
+ }
+
+ private void encodeButtonRecord(ButtonRecord record, SwfEncoder w, int defineButton)
+ {
+ if (defineButton == flash.swf.TagValues_Fields.stagDefineButton2)
+ {
+ w.writeUBits(0, 2);
+ w.writeBit(record.blendMode != - 1);
+ w.writeBit(record.filters != null);
+ }
+ else
+ {
+ w.writeUBits(0, 4);
+ }
+ w.writeBit(record.hitTest);
+ w.writeBit(record.down);
+ w.writeBit(record.over);
+ w.writeBit(record.up);
+
+ w.writeUI16(dict.getId(record.characterRef));
+ w.writeUI16(record.placeDepth);
+ encodeMatrix(record.placeMatrix, w);
+
+ if (defineButton == flash.swf.TagValues_Fields.stagDefineButton2)
+ {
+ encodeCxforma(record.colorTransform, w);
+ if (record.filters != null)
+ {
+ this.encodeFilterList(record.filters, w);
+ }
+ if (record.blendMode != - 1)
+ {
+ w.writeUI8(record.blendMode);
+ }
+ }
+ }
+
+ private void encodeCxforma(CXFormWithAlpha cxforma, SwfEncoder w)
+ {
+ w.writeBit(cxforma.hasAdd);
+ w.writeBit(cxforma.hasMult);
+
+ int nbits = cxforma.nbits();
+ w.writeUBits(nbits, 4);
+
+ if (cxforma.hasMult)
+ {
+ w.writeSBits(cxforma.redMultTerm, nbits);
+ w.writeSBits(cxforma.greenMultTerm, nbits);
+ w.writeSBits(cxforma.blueMultTerm, nbits);
+ w.writeSBits(cxforma.alphaMultTerm, nbits);
+ }
+
+ if (cxforma.hasAdd)
+ {
+ w.writeSBits(cxforma.redAddTerm, nbits);
+ w.writeSBits(cxforma.greenAddTerm, nbits);
+ w.writeSBits(cxforma.blueAddTerm, nbits);
+ w.writeSBits(cxforma.alphaAddTerm, nbits);
+ }
+
+ w.flushBits();
+ }
+
+ private void encodeMatrix(Matrix matrix, SwfEncoder w)
+ {
+ w.writeBit(matrix.hasScale);
+ if (matrix.hasScale)
+ {
+ int nScaleBits = matrix.nScaleBits();
+ w.writeUBits(nScaleBits, 5);
+ w.writeSBits(matrix.scaleX, nScaleBits);
+ w.writeSBits(matrix.scaleY, nScaleBits);
+ }
+
+ w.writeBit(matrix.hasRotate);
+ if (matrix.hasRotate)
+ {
+ int nRotateBits = matrix.nRotateBits();
+ w.writeUBits(nRotateBits, 5);
+ w.writeSBits(matrix.rotateSkew0, nRotateBits);
+ w.writeSBits(matrix.rotateSkew1, nRotateBits);
+ }
+
+ int nTranslateBits = matrix.nTranslateBits();
+ w.writeUBits(nTranslateBits, 5);
+ w.writeSBits(matrix.translateX, nTranslateBits);
+ w.writeSBits(matrix.translateY, nTranslateBits);
+
+ w.flushBits();
+ }
+
+ public override void defineButton2(DefineButton tag)
+ {
+ if (Debug)
+ {
+ debug.adjust = writer.Pos + 6;
+ }
+
+ int id = dict.add(tag);
+ tagw.writeUI16(id);
+ tagw.writeUBits(0, 7); // reserved
+ tagw.writeBit(tag.trackAsMenu);
+ int offsetPos = tagw.Pos;
+ tagw.writeUI16(0); // actionOffset
+
+ for (int i = 0; i < tag.buttonRecords.Length; i++)
+ {
+ encodeButtonRecord(tag.buttonRecords[i], tagw, tag.code);
+ }
+
+ tagw.writeUI8(0); // charEndFlag
+
+ if (tag.condActions.Length > 0)
+ {
+ tagw.writeUI16at(offsetPos, tagw.Pos - offsetPos);
+
+ for (int i = 0; i < tag.condActions.Length; i++)
+ {
+ bool isLast = i + 1 == tag.condActions.Length;
+ encodeButtonCondAction(tag.condActions[i], tagw, isLast);
+ }
+ }
+ encodeTag(tag);
+
+ if (Debug)
+ {
+ debug.adjust = 0;
+ }
+ }
+
+ private void encodeButtonCondAction(ButtonCondAction condAction, SwfEncoder w, bool last)
+ {
+ int pos = w.Pos;
+ w.writeUI16(0);
+
+ w.writeUBits(condAction.keyPress, 7);
+ w.writeBit(condAction.overDownToIdle);
+
+ w.writeBit(condAction.idleToOverDown);
+ w.writeBit(condAction.outDownToIdle);
+ w.writeBit(condAction.outDownToOverDown);
+ w.writeBit(condAction.overDownToOutDown);
+ w.writeBit(condAction.overDownToOverUp);
+ w.writeBit(condAction.overUpToOverDown);
+ w.writeBit(condAction.overUpToIdle);
+ w.writeBit(condAction.idleToOverUp);
+
+ new ActionEncoder(w, debug).encode(condAction.actionList);
+ w.writeUI8(0); // end action byte
+
+ if (!last)
+ {
+ w.writeUI16at(pos, w.Pos - pos);
+ }
+ }
+
+ public override void defineButtonCxform(DefineButtonCxform tag)
+ {
+ int idref = dict.getId(tag.button);
+ tagw.writeUI16(idref);
+ encodeCxform(tag.colorTransform, tagw);
+ encodeTag(tag);
+ }
+
+ private void encodeCxform(CXForm cxform, SwfEncoder w)
+ {
+
+ w.writeBit(cxform.hasAdd);
+ w.writeBit(cxform.hasMult);
+
+ int nbits = cxform.nbits();
+ w.writeUBits(nbits, 4);
+
+ if (cxform.hasMult)
+ {
+ w.writeSBits(cxform.redMultTerm, nbits);
+ w.writeSBits(cxform.greenMultTerm, nbits);
+ w.writeSBits(cxform.blueMultTerm, nbits);
+ }
+
+ if (cxform.hasAdd)
+ {
+ w.writeSBits(cxform.redAddTerm, nbits);
+ w.writeSBits(cxform.greenAddTerm, nbits);
+ w.writeSBits(cxform.blueAddTerm, nbits);
+ }
+
+ w.flushBits();
+ }
+
+ public override void defineButtonSound(DefineButtonSound tag)
+ {
+ int idref = dict.getId(tag.button);
+ tagw.writeUI16(idref);
+ if (tag.sound0 != null)
+ {
+ tagw.writeUI16(dict.getId(tag.sound0));
+ encodeSoundInfo(tag.info0, tagw);
+ }
+ else
+ {
+ tagw.writeUI16(0);
+ }
+ if (tag.sound1 != null)
+ {
+ tagw.writeUI16(dict.getId(tag.sound1));
+ encodeSoundInfo(tag.info1, tagw);
+ }
+ else
+ {
+ tagw.writeUI16(0);
+ }
+ if (tag.sound2 != null)
+ {
+ tagw.writeUI16(dict.getId(tag.sound2));
+ encodeSoundInfo(tag.info2, tagw);
+ }
+ else
+ {
+ tagw.writeUI16(0);
+ }
+ if (tag.sound3 != null)
+ {
+ tagw.writeUI16(dict.getId(tag.sound3));
+ encodeSoundInfo(tag.info3, tagw);
+ }
+ else
+ {
+ tagw.writeUI16(0);
+ }
+ encodeTag(tag);
+ }
+
+ private void encodeSoundInfo(SoundInfo info, SwfEncoder w)
+ {
+ w.writeUBits(0, 2); // reserved
+ w.writeBit(info.syncStop);
+ w.writeBit(info.syncNoMultiple);
+ w.writeBit(info.records != null);
+ w.writeBit(info.loopCount != SoundInfo.UNINITIALIZED);
+ w.writeBit(info.outPoint != SoundInfo.UNINITIALIZED);
+ w.writeBit(info.inPoint != SoundInfo.UNINITIALIZED);
+
+ if (info.inPoint != SoundInfo.UNINITIALIZED)
+ {
+ w.write32((int) info.inPoint);
+ }
+ if (info.outPoint != SoundInfo.UNINITIALIZED)
+ {
+ w.write32((int) info.outPoint);
+ }
+ if (info.loopCount != SoundInfo.UNINITIALIZED)
+ {
+ w.writeUI16(info.loopCount);
+ }
+ if (info.records != null)
+ {
+ w.writeUI8(info.records.Length);
+ for (int k = 0; k < info.records.Length; k++)
+ {
+ w.write64(info.records[k]);
+ }
+ }
+ }
+
+ public override void defineEditText(DefineEditText tag)
+ {
+ int id = dict.add(tag);
+ tagw.writeUI16(id);
+ encodeRect(tag.bounds, tagw);
+
+ tagw.writeBit(tag.hasText);
+ tagw.writeBit(tag.wordWrap);
+ tagw.writeBit(tag.multiline);
+ tagw.writeBit(tag.password);
+ tagw.writeBit(tag.readOnly);
+ tagw.writeBit(tag.hasTextColor);
+ tagw.writeBit(tag.hasMaxLength);
+ tagw.writeBit(tag.hasFont);
+
+ tagw.writeBit(false); // reserved
+ tagw.writeBit(tag.autoSize);
+ tagw.writeBit(tag.hasLayout);
+ tagw.writeBit(tag.noSelect);
+ tagw.writeBit(tag.border);
+ tagw.writeBit(tag.wasStatic);
+ tagw.writeBit(tag.html);
+ tagw.writeBit(tag.useOutlines);
+
+ tagw.flushBits();
+
+ if (tag.hasFont)
+ {
+ int idref = dict.getId(tag.font);
+ tagw.writeUI16(idref);
+ tagw.writeUI16(tag.height);
+ }
+
+ if (tag.hasTextColor)
+ {
+ encodeRGBA(tag.color, tagw);
+ }
+
+ if (tag.hasMaxLength)
+ {
+ tagw.writeUI16(tag.maxLength);
+ }
+
+ if (tag.hasLayout)
+ {
+ tagw.writeUI8(tag.align);
+ tagw.writeUI16(tag.leftMargin);
+ tagw.writeUI16(tag.rightMargin);
+ tagw.writeUI16(tag.ident);
+ tagw.writeSI16(tag.leading); // see errata, leading is signed
+ }
+
+ tagw.writeString(tag.varName);
+ if (tag.hasText)
+ {
+ tagw.writeString(tag.initialText);
+ }
+ encodeTag(tag);
+ }
+
+ public override void defineFont(DefineFont1 tag)
+ {
+ int id = dict.add(tag);
+ tagw.writeUI16(id);
+
+ int count = tag.glyphShapeTable.Length;
+
+ int offsetPos = tagw.Pos;
+
+ // write offset placeholders
+ for (int i = 0; i < count; i++)
+ {
+ tagw.writeUI16(0);
+ }
+
+ // now write glyphs and update the encoded offset table
+ for (int i = 0; i < count; i++)
+ {
+ tagw.writeUI16at(offsetPos + 2 * i, tagw.Pos - offsetPos);
+ encodeShape(tag.glyphShapeTable[i], tagw, flash.swf.TagValues_Fields.stagDefineShape3, 1, 0);
+ }
+
+ encodeTag(tag);
+ }
+
+ public virtual void encodeShape(Shape s, SwfEncoder w, int shape, int nFillStyles, int nLineStyles)
+ {
+ int[] numFillBits = new int[]{SwfEncoder.minBits(nFillStyles, 0)};
+ int[] numLineBits = new int[]{SwfEncoder.minBits(nLineStyles, 0)};
+
+ w.writeUBits(numFillBits[0], 4);
+ w.writeUBits(numLineBits[0], 4);
+
+ System.Collections.IEnumerator it = s.shapeRecords.GetEnumerator();
+ //UPGRADE_TODO: Method 'java.util.Iterator.hasNext' was converted to 'System.Collections.IEnumerator.MoveNext' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratorhasNext'"
+ while (it.MoveNext())
+ {
+ //UPGRADE_TODO: Method 'java.util.Iterator.next' was converted to 'System.Collections.IEnumerator.Current' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratornext'"
+ ShapeRecord record = (ShapeRecord) it.Current;
+ if (record is StyleChangeRecord)
+ {
+ // style change
+ w.writeBit(false);
+ StyleChangeRecord change = (StyleChangeRecord) record;
+ encodeStyleChangeRecord(w, change, numFillBits, numLineBits, shape);
+ }
+ else
+ {
+ // edge
+ w.writeBit(true);
+ EdgeRecord e = (EdgeRecord) record;
+ bool straight = e is StraightEdgeRecord;
+ w.writeBit(straight);
+ int nbits = straight?calcBits((StraightEdgeRecord) e):calcBits((CurvedEdgeRecord) e);
+ if (nbits < 2)
+ nbits = 2;
+ w.writeUBits(nbits - 2, 4);
+ if (straight)
+ {
+ // line
+ StraightEdgeRecord line = (StraightEdgeRecord) e;
+ encodeStraightEdgeRecord(line, w, nbits);
+ }
+ else
+ {
+ // curve
+ CurvedEdgeRecord curve = (CurvedEdgeRecord) e;
+ w.writeSBits(curve.controlDeltaX, nbits);
+ w.writeSBits(curve.controlDeltaY, nbits);
+ w.writeSBits(curve.anchorDeltaX, nbits);
+ w.writeSBits(curve.anchorDeltaY, nbits);
+ }
+ }
+ }
+
+ // endshaperecord
+ w.writeUBits(0, 6);
+
+ w.flushBits();
+ }
+
+ private int calcBits(StraightEdgeRecord edge)
+ {
+ return SwfEncoder.minBits(SwfEncoder.maxNum(edge.deltaX, edge.deltaY, 0, 0), 1);
+ }
+
+ private int calcBits(CurvedEdgeRecord edge)
+ {
+ return SwfEncoder.minBits(SwfEncoder.maxNum(edge.controlDeltaX, edge.controlDeltaY, edge.anchorDeltaX, edge.anchorDeltaY), 1);
+ }
+
+ private void encodeStraightEdgeRecord(StraightEdgeRecord line, SwfEncoder w, int nbits)
+ {
+ if (line.deltaX == 0)
+ {
+ w.writeUBits(1, 2); // vertical line
+ w.writeSBits(line.deltaY, nbits);
+ }
+ else if (line.deltaY == 0)
+ {
+ w.writeUBits(0, 2); // horizontal line
+ w.writeSBits(line.deltaX, nbits);
+ }
+ else
+ {
+ w.writeBit(true); // general line
+ w.writeSBits(line.deltaX, nbits);
+ w.writeSBits(line.deltaY, nbits);
+ }
+ }
+
+ private void encodeStyleChangeRecord(SwfEncoder w, StyleChangeRecord s, int[] numFillBits, int[] numLineBits, int shape)
+ {
+ w.writeBit(s.stateNewStyles);
+ w.writeBit(s.stateLineStyle);
+ w.writeBit(s.stateFillStyle1);
+ w.writeBit(s.stateFillStyle0);
+ w.writeBit(s.stateMoveTo);
+
+ if (s.stateMoveTo)
+ {
+ int moveBits = s.nMoveBits();
+ w.writeUBits(moveBits, 5);
+ w.writeSBits(s.moveDeltaX, moveBits);
+ w.writeSBits(s.moveDeltaY, moveBits);
+ }
+
+ if (s.stateFillStyle0)
+ {
+ w.writeUBits(s.fillstyle0, numFillBits[0]);
+ }
+
+ if (s.stateFillStyle1)
+ {
+ w.writeUBits(s.fillstyle1, numFillBits[0]);
+ }
+
+ if (s.stateLineStyle)
+ {
+ w.writeUBits(s.linestyle, numLineBits[0]);
+ }
+
+ if (s.stateNewStyles)
+ {
+ w.flushBits();
+
+ encodeFillstyles(s.fillstyles, w, shape);
+ encodeLinestyles(s.linestyles, w, shape);
+
+ numFillBits[0] = SwfEncoder.minBits(s.fillstyles.Count, 0);
+ numLineBits[0] = SwfEncoder.minBits(s.linestyles.Count, 0);
+ w.writeUBits(numFillBits[0], 4);
+ w.writeUBits(numLineBits[0], 4);
+ }
+ }
+
+ private void encodeLinestyles(System.Collections.ArrayList linestyles, SwfEncoder w, int shape)
+ {
+ int count = linestyles.Count;
+ if (count > 0xFF)
+ {
+ w.writeUI8(0xFF);
+ w.writeUI16(count);
+ }
+ else
+ {
+ w.writeUI8(count);
+ }
+
+ for (int i = 0; i < count; i++)
+ {
+ encodeLineStyle((LineStyle) linestyles[i], w, shape);
+ }
+ }
+
+ private void encodeLineStyle(LineStyle lineStyle, SwfEncoder w, int shape)
+ {
+ w.writeUI16(lineStyle.width);
+
+ if (shape == flash.swf.TagValues_Fields.stagDefineShape6)
+ {
+ w.writeUI16(lineStyle.flags);
+ if (lineStyle.hasMiterJoint())
+ w.writeUI16(lineStyle.miterLimit);
+ }
+
+ if (shape == flash.swf.TagValues_Fields.stagDefineShape6 && lineStyle.hasFillStyle())
+ {
+ encodeFillStyle(lineStyle.fillStyle, w, shape);
+ }
+ else if ((shape == flash.swf.TagValues_Fields.stagDefineShape3) || (shape == flash.swf.TagValues_Fields.stagDefineShape6))
+ {
+ encodeRGBA(lineStyle.color, w);
+ }
+ else
+ {
+ encodeRGB(lineStyle.color, w);
+ }
+ }
+
+ private void encodeFillstyles(System.Collections.ArrayList fillstyles, SwfEncoder w, int shape)
+ {
+ int count = fillstyles.Count;
+ if (count >= 0xFF)
+ {
+ w.writeUI8(0xFF);
+ w.writeUI16(count);
+ }
+ else
+ {
+ w.writeUI8(count);
+ }
+
+ System.Collections.IEnumerator it = fillstyles.GetEnumerator();
+ //UPGRADE_TODO: Method 'java.util.Iterator.hasNext' was converted to 'System.Collections.IEnumerator.MoveNext' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratorhasNext'"
+ while (it.MoveNext())
+ {
+ //UPGRADE_TODO: Method 'java.util.Iterator.next' was converted to 'System.Collections.IEnumerator.Current' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratornext'"
+ FillStyle style = (FillStyle) it.Current;
+ encodeFillStyle(style, w, shape);
+ }
+ }
+
+ private void encodeFillStyle(FillStyle style, SwfEncoder w, int shape)
+ {
+ w.writeUI8(style.type);
+ switch (style.type)
+ {
+
+ case FillStyle.FILL_SOLID: // 0x00
+ if ((shape == flash.swf.TagValues_Fields.stagDefineShape3) || (shape == flash.swf.TagValues_Fields.stagDefineShape6))
+ encodeRGBA(style.color, w);
+ else
+ encodeRGB(style.color, w);
+ break;
+
+ case FillStyle.FILL_GRADIENT:
+ // 0x10 linear gradient fill
+ case FillStyle.FILL_RADIAL_GRADIENT:
+ // 0x12 radial gradient fill
+ case FillStyle.FILL_FOCAL_RADIAL_GRADIENT: // 0x13 focal radial gradient fill
+ encodeMatrix(style.matrix, w);
+ encodeGradient(style.gradient, w, shape);
+ break;
+
+ case FillStyle.FILL_BITS:
+ // 0x40 tiled bitmap fill
+ case (FillStyle.FILL_BITS | FillStyle.FILL_BITS_CLIP):
+ // 0x41 clipped bitmap fill
+ case (FillStyle.FILL_BITS | FillStyle.FILL_BITS_NOSMOOTH):
+ // 0x42 tiled non-smoothed fill
+ case (FillStyle.FILL_BITS | FillStyle.FILL_BITS_CLIP | FillStyle.FILL_BITS_NOSMOOTH): // 0x43 clipped non-smoothed fill
+ w.writeUI16(dict.getId(style.bitmap));
+ encodeMatrix(style.matrix, w);
+ break;
+ }
+ }
+
+ private void encodeGradient(Gradient gradient, SwfEncoder w, int shape)
+ {
+ w.writeUBits(gradient.spreadMode, 2);
+ w.writeUBits(gradient.interpolationMode, 2);
+ w.writeUBits(gradient.records.Length, 4);
+ for (int i = 0; i < gradient.records.Length; i++)
+ {
+ encodeGradRecord(gradient.records[i], w, shape);
+ }
+ if (gradient is FocalGradient)
+ {
+ w.writeFixed8(((FocalGradient) gradient).focalPoint);
+ }
+ }
+
+ private void encodeGradRecord(GradRecord record, SwfEncoder w, int shape)
+ {
+ w.writeUI8(record.ratio);
+ if ((shape == flash.swf.TagValues_Fields.stagDefineShape3) || (shape == flash.swf.TagValues_Fields.stagDefineShape6))
+ encodeRGBA(record.color, w);
+ else
+ encodeRGB(record.color, w);
+ }
+
+ public override void defineFont2(DefineFont2 tag)
+ {
+ int id = dict.add(tag);
+ tagw.writeUI16(id);
+ int startPos = tagw.Pos;
+ bool again;
+
+ if (tag.code == flash.swf.TagValues_Fields.stagDefineFont3)
+ {
+ tag.wideCodes = true;
+ }
+
+ if (!tag.wideCodes)
+ {
+ for (int i = 0; i < tag.codeTable.Length; i++)
+ {
+ if (tag.codeTable[i] > 255)
+ {
+ tag.wideCodes = true;
+ break;
+ }
+ }
+ }
+
+ //UPGRADE_NOTE: Label 'loop' was moved. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1014'"
+ do
+ {
+ again = false;
+ tagw.writeBit(tag.hasLayout);
+ tagw.writeBit(tag.shiftJIS);
+ tagw.writeBit(tag.smallText);
+ tagw.writeBit(tag.ansi);
+ tagw.writeBit(tag.wideOffsets);
+ tagw.writeBit(tag.wideCodes);
+ tagw.writeBit(tag.italic);
+ tagw.writeBit(tag.bold);
+ tagw.flushBits();
+
+ tagw.writeUI8(tag.langCode);
+
+ tagw.writeLengthString(tag.fontName);
+ int count = tag.glyphShapeTable.Length;
+
+ tagw.writeUI16(count);
+ int offsetPos = tagw.Pos;
+
+ // save space for the offset table
+ if (tag.wideOffsets)
+ {
+ for (int i = 0; i < count; i++)
+ {
+ tagw.write32(0);
+ }
+ }
+ else
+ {
+ for (int i = 0; i < count; i++)
+ {
+ tagw.writeUI16(0);
+ }
+ }
+
+ //PJF: write placeholder for codeTableOffset, this will be changed after shapes encoded
+ if (count > 0)
+ {
+ if (tag.wideOffsets)
+ {
+ tagw.write32(0);
+ }
+ else
+ {
+ tagw.writeUI16(0);
+ }
+ }
+
+ for (int i = 0; i < count; i++)
+ {
+ // save offset to this glyph
+ int offset = tagw.Pos - offsetPos;
+ if (!tag.wideOffsets && offset > 65535)
+ {
+ again = true;
+ tag.wideOffsets = true;
+ tagw.Pos = startPos;
+ //UPGRADE_NOTE: Labeled continue statement was changed to a goto statement. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1015'"
+ goto loop;
+ }
+ if (tag.wideOffsets)
+ tagw.write32at(offsetPos + 4 * i, offset);
+ else
+ tagw.writeUI16at(offsetPos + 2 * i, offset);
+
+ encodeShape(tag.glyphShapeTable[i], tagw, flash.swf.TagValues_Fields.stagDefineShape3, 1, 0);
+ }
+
+ // update codeTableOffset
+ int offset2 = tagw.Pos - offsetPos;
+ if (!tag.wideOffsets && offset2 > 65535)
+ {
+ again = true;
+ tag.wideOffsets = true;
+ tagw.Pos = startPos;
+ //UPGRADE_NOTE: Labeled continue statement was changed to a goto statement. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1015'"
+ goto loop;
+ }
+ if (tag.wideOffsets)
+ {
+ tagw.write32at(offsetPos + 4 * count, offset2);
+ }
+ else
+ {
+ tagw.writeUI16at(offsetPos + 2 * count, offset2);
+ }
+
+ // now write the codetable
+
+ if (tag.wideCodes)
+ {
+ for (int i = 0; i < tag.codeTable.Length; i++)
+ {
+ tagw.writeUI16(tag.codeTable[i]);
+ }
+ }
+ else
+ {
+ for (int i = 0; i < tag.codeTable.Length; i++)
+ {
+ tagw.writeUI8(tag.codeTable[i]);
+ }
+ }
+
+ if (tag.hasLayout)
+ {
+ tagw.writeSI16(tag.ascent);
+ tagw.writeSI16(tag.descent);
+ tagw.writeSI16(tag.leading);
+
+ for (int i = 0; i < tag.advanceTable.Length; i++)
+ {
+ tagw.writeSI16(tag.advanceTable[i]);
+ }
+
+ for (int i = 0; i < tag.boundsTable.Length; i++)
+ {
+ encodeRect(tag.boundsTable[i], tagw);
+ }
+
+ tagw.writeUI16(tag.kerningTable.Length);
+
+ for (int i = 0; i < tag.kerningTable.Length; i++)
+ {
+ if (!tag.wideCodes && ((tag.kerningTable[i].code1 > 255) || (tag.kerningTable[i].code2 > 255)))
+ {
+ again = true;
+ tag.wideCodes = true;
+ tagw.Pos = startPos;
+ //UPGRADE_NOTE: Labeled continue statement was changed to a goto statement. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1015'"
+ goto loop;
+ }
+
+ encodeKerningRecord(tag.kerningTable[i], tagw, tag.wideCodes);
+ }
+ }
+ //UPGRADE_NOTE: Label 'loop' was moved. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1014'"
+loop: ;
+ }
+ while (again);
+
+ encodeTag(tag);
+ }
+
+ public override void defineFont3(DefineFont3 tag)
+ {
+ defineFont2(tag);
+ }
+
+ public override void defineFont4(DefineFont4 tag)
+ {
+ int id = dict.add(tag);
+ tagw.writeUI16(id);
+
+ tagw.writeUBits(0, 5); // reserved
+ tagw.writeBit(tag.hasFontData);
+ //tagw.writeBit(tag.smallText);
+ tagw.writeBit(tag.italic);
+ tagw.writeBit(tag.bold);
+ tagw.flushBits();
+
+ //tagw.writeUI8(tag.langCode);
+ tagw.writeString(tag.fontName);
+ if (tag.hasFontData)
+ {
+ tagw.write(tag.data);
+ }
+
+ encodeTag(tag);
+ }
+
+ public override void defineFontAlignZones(DefineFontAlignZones tag)
+ {
+ int fontID = dict.getId(tag.font);
+ tagw.writeUI16(fontID);
+ tagw.writeUBits(tag.csmTableHint, 2);
+ tagw.writeUBits(0, 6); // reserved
+ for (int i = 0; i < tag.zoneTable.Length; i++)
+ {
+ ZoneRecord record = tag.zoneTable[i];
+ tagw.writeUI8(record.numZoneData);
+ for (int j = 0; j < record.numZoneData; j++)
+ {
+ tagw.write32((int) record.zoneData[j]);
+ }
+ tagw.writeUI8(record.zoneMask);
+ }
+ encodeTag(tag);
+ }
+
+ public override void csmTextSettings(CSMTextSettings tag)
+ {
+ int textID = 0;
+ if (tag.textReference != null)
+ {
+ textID = dict.getId(tag.textReference);
+ }
+ tagw.writeUI16(textID);
+ tagw.writeUBits(tag.styleFlagsUseSaffron, 2);
+ tagw.writeUBits(tag.gridFitType, 3);
+ tagw.writeUBits(0, 3); // reserved
+ // FIXME: thickness/sharpness should be written out as 32 bit IEEE Single Precision format in little Endian
+ tagw.writeUBits((int) tag.thickness, 32);
+ tagw.writeUBits((int) tag.sharpness, 32);
+ tagw.writeUBits(0, 8); //reserved
+
+ encodeTag(tag);
+ }
+
+ public override void defineFontName(DefineFontName tag)
+ {
+ int fontID = dict.getId(tag.font);
+ tagw.writeUI16(fontID);
+ if (tag.fontName != null)
+ {
+ tagw.writeString(tag.fontName);
+ }
+ else
+ {
+ tagw.writeString("");
+ }
+ if (tag.copyright != null)
+ {
+ tagw.writeString(tag.copyright);
+ }
+ else
+ {
+ tagw.writeString("");
+ }
+
+ encodeTag(tag);
+ }
+
+ private void encodeKerningRecord(KerningRecord kerningRecord, SwfEncoder w, bool wideCodes)
+ {
+ if (wideCodes)
+ {
+ w.writeUI16(kerningRecord.code1);
+ w.writeUI16(kerningRecord.code2);
+ }
+ else
+ {
+ w.writeUI8(kerningRecord.code1);
+ w.writeUI8(kerningRecord.code2);
+ }
+ w.writeUI16(kerningRecord.adjustment);
+ }
+
+ public override void defineFontInfo(DefineFontInfo tag)
+ {
+ int idref = dict.getId(tag.font);
+ tagw.writeUI16(idref);
+
+ tagw.writeLengthString(tag.name);
+
+ tagw.writeUBits(0, 3); // reserved
+ tagw.writeBit(tag.shiftJIS);
+ tagw.writeBit(tag.ansi);
+ tagw.writeBit(tag.italic);
+ tagw.writeBit(tag.bold);
+
+ if (tag.code == flash.swf.TagValues_Fields.stagDefineFontInfo2)
+ {
+ tagw.writeBit(tag.wideCodes = true);
+ tagw.writeUI8(tag.langCode);
+ }
+ else
+ {
+ if (!tag.wideCodes)
+ {
+ for (int i = 0; i < tag.codeTable.Length; i++)
+ {
+ if (tag.codeTable[i] > 255)
+ {
+ tag.wideCodes = true;
+ break;
+ }
+ }
+ }
+ tagw.writeBit(tag.wideCodes);
+ }
+
+ if (tag.wideCodes)
+ {
+ for (int i = 0; i < tag.codeTable.Length; i++)
+ tagw.writeUI16(tag.codeTable[i]);
+ }
+ else
+ {
+ for (int i = 0; i < tag.codeTable.Length; i++)
+ tagw.writeUI8(tag.codeTable[i]);
+ }
+ encodeTag(tag);
+ }
+
+ public override void defineFontInfo2(DefineFontInfo tag)
+ {
+ defineFontInfo(tag);
+ }
+
+ public override void defineMorphShape(DefineMorphShape tag)
+ {
+ defineMorphShape2(tag);
+ }
+
+ public override void defineMorphShape2(DefineMorphShape tag)
+ {
+ int id = dict.add(tag);
+ tagw.writeUI16(id);
+ encodeRect(tag.startBounds, tagw);
+ encodeRect(tag.endBounds, tagw);
+ if (tag.code == flash.swf.TagValues_Fields.stagDefineMorphShape2)
+ {
+ encodeRect(tag.startEdgeBounds, tagw);
+ encodeRect(tag.endEdgeBounds, tagw);
+ tagw.writeUBits(tag.reserved, 6);
+ tagw.writeUBits(tag.usesNonScalingStrokes?1:0, 1);
+ tagw.writeUBits(tag.usesScalingStrokes?1:0, 1);
+ }
+ tagw.write32(0);
+ int pos = tagw.Pos;
+ encodeMorphFillstyles(tag.fillStyles, tagw, tag.code);
+ encodeMorphLinestyles(tag.lineStyles, tagw, tag.code);
+ encodeShape(tag.startEdges, tagw, flash.swf.TagValues_Fields.stagDefineShape3, tag.fillStyles.Length, tag.lineStyles.Length);
+ tagw.write32at(pos - 4, tagw.Pos - pos);
+ // end shape contains only edges, no style information
+ encodeShape(tag.endEdges, tagw, flash.swf.TagValues_Fields.stagDefineShape3, 0, 0);
+ encodeTag(tag);
+ }
+
+ private void encodeMorphFillstyles(MorphFillStyle[] fillStyles, SwfEncoder w, int code)
+ {
+ int count = fillStyles.Length;
+ if (count >= 0xFF)
+ {
+ w.writeUI8(0xFF);
+ w.writeUI16(count);
+ }
+ else
+ {
+ w.writeUI8(count);
+ }
+
+ for (int i = 0; i < count; i++)
+ {
+ encodeMorphFillstyle(fillStyles[i], w, code);
+ }
+ }
+
+ private void encodeMorphFillstyle(MorphFillStyle style, SwfEncoder w, int code)
+ {
+ w.writeUI8(style.type);
+ switch (style.type)
+ {
+
+ case FillStyle.FILL_SOLID: // 0x00
+ encodeRGBA(style.startColor, w);
+ encodeRGBA(style.endColor, w);
+ break;
+
+ case FillStyle.FILL_GRADIENT:
+ // 0x10 linear gradient fill
+ case FillStyle.FILL_RADIAL_GRADIENT:
+ // 0x12 radial gradient fill
+ case FillStyle.FILL_FOCAL_RADIAL_GRADIENT: // 0x13 focal radial gradient fill
+ encodeMatrix(style.startGradientMatrix, w);
+ encodeMatrix(style.endGradientMatrix, w);
+ encodeMorphGradient(style.gradRecords, w);
+ if (style.type == FillStyle.FILL_FOCAL_RADIAL_GRADIENT && code == flash.swf.TagValues_Fields.stagDefineMorphShape2)
+ {
+ w.writeSI16(style.ratio1);
+ w.writeSI16(style.ratio2);
+ }
+ break;
+
+ case FillStyle.FILL_BITS:
+ // 0x40 tiled bitmap fill
+ case (FillStyle.FILL_BITS | FillStyle.FILL_BITS_CLIP):
+ // 0x41 clipped bitmap fill
+ case (FillStyle.FILL_BITS | FillStyle.FILL_BITS_NOSMOOTH):
+ // 0x42 tiled non-smoothed fill
+ case (FillStyle.FILL_BITS | FillStyle.FILL_BITS_CLIP | FillStyle.FILL_BITS_NOSMOOTH): // 0x43 clipped non-smoothed fill
+ w.writeUI16(dict.getId(style.bitmap));
+ encodeMatrix(style.startBitmapMatrix, w);
+ encodeMatrix(style.endBitmapMatrix, w);
+ break;
+
+ default:
+ assert(false);
+ //throw new IOException("unrecognized fill style type: " + style.type);
+ break;
+
+ }
+ }
+
+ private void encodeMorphGradient(MorphGradRecord[] gradRecords, SwfEncoder w)
+ {
+ w.writeUI8(gradRecords.Length);
+ for (int i = 0; i < gradRecords.Length; i++)
+ {
+ MorphGradRecord record = gradRecords[i];
+ w.writeUI8(record.startRatio);
+ encodeRGBA(record.startColor, w);
+ w.writeUI8(record.endRatio);
+ encodeRGBA(record.endColor, w);
+ }
+ }
+
+ private void encodeMorphLinestyles(MorphLineStyle[] lineStyles, SwfEncoder w, int code)
+ {
+ if (lineStyles.Length >= 0xFF)
+ {
+ w.writeUI8(0xFF);
+ w.writeUI16(lineStyles.Length);
+ }
+ else
+ {
+ w.writeUI8(lineStyles.Length);
+ }
+
+ for (int i = 0; i < lineStyles.Length; i++)
+ {
+ MorphLineStyle style = lineStyles[i];
+ w.writeUI16(style.startWidth);
+ w.writeUI16(style.endWidth);
+ if (code == flash.swf.TagValues_Fields.stagDefineMorphShape2)
+ {
+ w.writeUBits(style.startCapsStyle, 2);
+ w.writeUBits(style.jointStyle, 2);
+ w.writeBit(style.hasFill);
+ w.writeBit(style.noHScale);
+ w.writeBit(style.noVScale);
+ w.writeBit(style.pixelHinting);
+ w.writeUBits(0, 5); // reserved
+ w.writeBit(style.noClose);
+ w.writeUBits(style.endCapsStyle, 2);
+ if (style.jointStyle == 2)
+ {
+ w.writeUI16(style.miterLimit);
+ }
+ }
+ if (!style.hasFill)
+ {
+ encodeRGBA(style.startColor, w);
+ encodeRGBA(style.endColor, w);
+ }
+ if (style.hasFill)
+ {
+ encodeMorphFillstyle(style.fillType, w, code);
+ }
+ }
+ }
+
+ public override void defineShape(DefineShape tag)
+ {
+ int id = dict.add(tag);
+ tagw.writeUI16(id);
+ encodeRect(tag.bounds, tagw);
+ if (tag.code == flash.swf.TagValues_Fields.stagDefineShape6)
+ {
+ encodeRect(tag.edgeBounds, tagw);
+ tagw.writeUBits(0, 6);
+ tagw.writeBit(tag.usesNonScalingStrokes);
+ tagw.writeBit(tag.usesScalingStrokes);
+ }
+ encodeShapeWithStyle(tag.shapeWithStyle, tagw, tag.code);
+ encodeTag(tag);
+ }
+
+ private void encodeShapeWithStyle(ShapeWithStyle shapeWithStyle, SwfEncoder w, int shape)
+ {
+ encodeFillstyles(shapeWithStyle.fillstyles, w, shape);
+ encodeLinestyles(shapeWithStyle.linestyles, w, shape);
+
+ encodeShape(shapeWithStyle, w, shape, shapeWithStyle.fillstyles.Count, shapeWithStyle.linestyles.Count);
+ }
+
+ public override void defineShape2(DefineShape tag)
+ {
+ defineShape(tag);
+ }
+
+ public override void defineShape3(DefineShape tag)
+ {
+ defineShape(tag);
+ }
+
+ public override void defineShape6(DefineShape tag)
+ {
+ defineShape(tag);
+ }
+
+ public override void defineSound(DefineSound tag)
+ {
+ int id = dict.add(tag);
+ tagw.writeUI16(id);
+ tagw.writeUBits(tag.format, 4);
+ tagw.writeUBits(tag.rate, 2);
+ tagw.writeUBits(tag.size, 1);
+ tagw.writeUBits(tag.type, 1);
+ tagw.write32((int) tag.sampleCount);
+ tagw.write(tag.data);
+ encodeTag(tag);
+ }
+
+ public override void defineSprite(DefineSprite tag)
+ {
+ int id = dict.add(tag);
+ tagw.writeUI16(id);
+ tagw.writeUI16(tag.framecount);
+
+ if (Debug)
+ {
+ debug.adjust = writer.Pos + 6;
+ }
+
+ // save frame count
+ int oldFrames = frames;
+ frames = 0;
+
+ // save the movie writer, and push a new writer
+ SwfEncoder oldWriter = writer;
+ writer = tagw;
+ tagw = createEncoder(SwfVersion);
+
+ // write sprite tags
+ System.Collections.IList tags = tag.tagList.tags;
+ int size = tags.Count;
+ for (int i = 0; i < size; i++)
+ {
+ Tag t = (Tag) tags[i];
+ if (!(t is DefineTag))
+ t.visit(this);
+ }
+
+ // terminate with end marker
+ writer.writeUI16(0);
+
+ // update frame count
+ writer.writeUI16at(2, frames);
+
+ // restore writers
+ tagw = writer;
+ writer = oldWriter;
+ frames = oldFrames;
+
+ if (Debug)
+ {
+ debug.adjust = 0;
+ }
+
+ encodeTag(tag);
+ }
+
+ public override void defineText(DefineText tag)
+ {
+ encodeDefineText(tag, tagw, tag.code);
+ encodeTag(tag);
+ }
+
+ private void encodeDefineText(DefineText tag, SwfEncoder w, int type)
+ {
+ int id = dict.add(tag);
+ w.writeUI16(id);
+ encodeRect(tag.bounds, w);
+ encodeMatrix(tag.matrix, w);
+ int length = tag.records.Count;
+
+ // compute necessary bit width
+ int glyphBits = 0;
+ int advanceBits = 0;
+ for (int i = 0; i < length; i++)
+ {
+ TextRecord tr = (TextRecord) tag.records[i];
+
+ for (int j = 0; j < tr.entries.Length; j++)
+ {
+ GlyphEntry entry = tr.entries[j];
+
+ while (entry.Index > (1 << glyphBits))
+ glyphBits++;
+ while (System.Math.Abs(entry.advance) > (1 << advanceBits))
+ advanceBits++;
+ }
+ }
+
+ // increment to get from bit index to bit count.
+ ++glyphBits;
+ ++advanceBits;
+
+ w.writeUI8(glyphBits);
+ w.writeUI8(++advanceBits); // add one extra bit because advances are signed
+
+ for (int i = 0; i < length; i++)
+ {
+ TextRecord record = (TextRecord) tag.records[i];
+ encodeTextRecord(record, w, type, glyphBits, advanceBits);
+ }
+
+ w.writeUI8(0);
+ }
+
+ private void encodeFilterList(System.Collections.IList filters, SwfEncoder w)
+ {
+ int count = filters.Count;
+ w.writeUI8(count);
+ //UPGRADE_TODO: Method 'java.util.Iterator.hasNext' was converted to 'System.Collections.IEnumerator.MoveNext' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratorhasNext'"
+ for (System.Collections.IEnumerator it = filters.GetEnumerator(); it.MoveNext(); )
+ {
+ //UPGRADE_TODO: Method 'java.util.Iterator.next' was converted to 'System.Collections.IEnumerator.Current' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratornext'"
+ Filter f = (Filter) it.Current;
+ w.writeUI8(f.getID());
+ // I've never quite understood why the serialization code isn't in the tags themselves..
+ switch (f.getID())
+ {
+
+ case DropShadowFilter.ID: encodeDropShadowFilter(w, (DropShadowFilter) f); break;
+
+ case BlurFilter.ID: encodeBlurFilter(w, (BlurFilter) f); break;
+
+ case ConvolutionFilter.ID: encodeConvolutionFilter(w, (ConvolutionFilter) f); break;
+
+ case GlowFilter.ID: encodeGlowFilter(w, (GlowFilter) f); break;
+
+ case BevelFilter.ID: encodeBevelFilter(w, (BevelFilter) f); break;
+
+ case ColorMatrixFilter.ID: encodeColorMatrixFilter(w, (ColorMatrixFilter) f); break;
+
+ case GradientGlowFilter.ID: encodeGradientGlowFilter(w, (GradientGlowFilter) f); break;
+
+ case GradientBevelFilter.ID: encodeGradientBevelFilter(w, (GradientBevelFilter) f); break;
+ }
+ }
+ }
+
+ private void encodeDropShadowFilter(SwfEncoder w, DropShadowFilter f)
+ {
+ encodeRGBA(f.color, w);
+ w.write32(f.blurX);
+ w.write32(f.blurY);
+ w.write32(f.angle);
+ w.write32(f.distance);
+ w.writeUI16(f.strength);
+ w.writeUI8(f.flags);
+ }
+
+ private void encodeBlurFilter(SwfEncoder w, BlurFilter f)
+ {
+ w.write32(f.blurX);
+ w.write32(f.blurY);
+ w.writeUI8(f.passes);
+ }
+ private void encodeColorMatrixFilter(SwfEncoder w, ColorMatrixFilter f)
+ {
+ for (int i = 0; i < 20; ++i)
+ {
+ w.writeFloat(f.values[i]);
+ }
+ }
+ private void encodeConvolutionFilter(SwfEncoder w, ConvolutionFilter f)
+ {
+ w.writeUI8(f.matrixX);
+ w.writeUI8(f.matrixY);
+ w.writeFloat(f.divisor);
+ w.writeFloat(f.bias);
+ for (int i = 0; i < f.matrix.Length; ++i)
+ w.writeFloat(f.matrix[i]);
+ w.writeUI8(f.flags);
+ }
+ private void encodeGlowFilter(SwfEncoder w, GlowFilter f)
+ {
+ encodeRGBA(f.color, w);
+ w.write32(f.blurX);
+ w.write32(f.blurY);
+ w.writeUI16(f.strength);
+ w.writeUI8(f.flags);
+ }
+ private void encodeBevelFilter(SwfEncoder w, BevelFilter f)
+ {
+ encodeRGBA(f.shadowColor, w);
+ encodeRGBA(f.highlightColor, w);
+ w.write32(f.blurX);
+ w.write32(f.blurY);
+ w.write32(f.angle);
+ w.write32(f.distance);
+ w.writeUI16(f.strength);
+ w.writeUI8(f.flags);
+ }
+
+ private void encodeGradientGlowFilter(SwfEncoder w, GradientGlowFilter f)
+ {
+ w.writeUI8(f.numcolors);
+ for (int i = 0; i < f.numcolors; ++i)
+ encodeRGBA(f.gradientColors[i], w);
+ for (int i = 0; i < f.numcolors; ++i)
+ w.writeUI8(f.gradientRatio[i]);
+ //w.write32( f.color );
+ w.write32(f.blurX);
+ w.write32(f.blurY);
+ w.write32(f.angle);
+ w.write32(f.distance);
+ w.writeUI16(f.strength);
+ w.writeUI8(f.flags);
+ }
+ private void encodeGradientBevelFilter(SwfEncoder w, GradientBevelFilter f)
+ {
+ w.writeUI8(f.numcolors);
+ for (int i = 0; i < f.numcolors; ++i)
+ encodeRGBA(f.gradientColors[i], w);
+ for (int i = 0; i < f.numcolors; ++i)
+ w.writeUI8(f.gradientRatio[i]);
+
+ // w.write32( f.shadowColor );
+ // w.write32( f.highlightColor );
+ w.write32(f.blurX);
+ w.write32(f.blurY);
+ w.write32(f.angle);
+ w.write32(f.distance);
+ w.writeUI16(f.strength);
+ w.writeUI8(f.flags);
+ }
+
+ private void encodeTextRecord(TextRecord record, SwfEncoder w, int type, int glyphBits, int advanceBits)
+ {
+ w.writeUI8(record.flags);
+
+ if (record.hasFont())
+ {
+ w.writeUI16(dict.getId(record.font));
+ }
+
+ if (record.hasColor())
+ {
+ if (type == flash.swf.TagValues_Fields.stagDefineText2)
+ encodeRGBA(record.color, w);
+ else
+ encodeRGB(record.color, w);
+ }
+
+ if (record.hasX())
+ {
+ w.writeSI16(record.xOffset);
+ }
+
+ if (record.hasY())
+ {
+ w.writeSI16(record.yOffset);
+ }
+
+ if (record.hasHeight())
+ {
+ w.writeUI16(record.height);
+ }
+
+ w.writeUI8(record.entries.Length);
+
+ for (int i = 0; i < record.entries.Length; i++)
+ {
+ w.writeUBits(record.entries[i].Index, glyphBits);
+ w.writeSBits(record.entries[i].advance, advanceBits);
+ }
+ w.flushBits();
+ }
+
+ public override void defineText2(DefineText tag)
+ {
+ defineText(tag);
+ }
+
+ public override void defineVideoStream(DefineVideoStream tag)
+ {
+ int id = dict.add(tag);
+ tagw.writeUI16(id);
+ tagw.writeUI16(tag.numFrames);
+ tagw.writeUI16(tag.width);
+ tagw.writeUI16(tag.height);
+
+ tagw.writeUBits(0, 4); // reserved
+ tagw.writeUBits(tag.deblocking, 3);
+ tagw.writeBit(tag.smoothing);
+
+ tagw.writeUI8(tag.codecID);
+ encodeTag(tag);
+ }
+
+ public override void doAction(DoAction tag)
+ {
+ int adjust = 0;
+ if (Debug)
+ {
+ adjust = writer.Pos + 6;
+ debug.adjust += adjust;
+ }
+
+ new ActionEncoder(tagw, debug).encode(tag.actionList);
+ tagw.writeUI8(0);
+ encodeTag(tag);
+
+ if (Debug)
+ {
+ debug.adjust -= adjust;
+ }
+ }
+
+ public override void doInitAction(DoInitAction tag)
+ {
+ int adjust = 0;
+ if (Debug)
+ {
+ adjust = writer.Pos + 6;
+ debug.adjust += adjust;
+ }
+
+ int idref = dict.getId(tag.sprite);
+ tagw.writeUI16(idref);
+ new ActionEncoder(tagw, debug).encode(tag.actionList);
+ tagw.writeUI8(0);
+ encodeTag(tag);
+
+ if (Debug)
+ {
+ debug.adjust -= adjust;
+ }
+ }
+
+ public override void enableDebugger(EnableDebugger tag)
+ {
+ tagw.writeString(tag.password);
+ encodeTag(tag);
+ }
+
+ public override void enableDebugger2(EnableDebugger tag)
+ {
+ // This corresponds to the constant used in the player,
+ // core/splay.cpp, in ScriptThread::EnableDebugger().
+ tagw.writeUI16(0x1975);
+ tagw.writeString(tag.password);
+ encodeTag(tag);
+ }
+
+ public override void exportAssets(ExportAssets tag)
+ {
+ tagw.writeUI16(tag.exports.Count);
+ System.Collections.IEnumerator it = tag.exports.GetEnumerator();
+ //UPGRADE_TODO: Method 'java.util.Iterator.hasNext' was converted to 'System.Collections.IEnumerator.MoveNext' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratorhasNext'"
+ while (it.MoveNext())
+ {
+ //UPGRADE_TODO: Method 'java.util.Iterator.next' was converted to 'System.Collections.IEnumerator.Current' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratornext'"
+ DefineTag ref_Renamed = (DefineTag) it.Current;
+ int idref = dict.getId(ref_Renamed);
+ tagw.writeUI16(idref);
+ assert(ref_Renamed.name != null); // exported symbols must have names
+ tagw.writeString(ref_Renamed.name);
+ dict.addName(ref_Renamed, ref_Renamed.name);
+ }
+ encodeTag(tag);
+ }
+
+ public override void symbolClass(SymbolClass tag)
+ {
+ tagw.writeUI16(tag.class2tag.Count + (tag.topLevelClass != null?1:0));
+ //UPGRADE_TODO: Method 'java.util.Map.entrySet' was converted to 'SupportClass.HashSetSupport' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilMapentrySet'"
+ System.Collections.IEnumerator it = new SupportClass.HashSetSupport(tag.class2tag).GetEnumerator();
+ //UPGRADE_TODO: Method 'java.util.Iterator.hasNext' was converted to 'System.Collections.IEnumerator.MoveNext' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratorhasNext'"
+ while (it.MoveNext())
+ {
+ //UPGRADE_TODO: Method 'java.util.Iterator.next' was converted to 'System.Collections.IEnumerator.Current' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratornext'"
+ System.Collections.DictionaryEntry e = (System.Collections.DictionaryEntry) it.Current;
+ System.String name = (System.String) e.Key;
+ DefineTag ref_Renamed = (DefineTag) e.Value;
+
+ int idref = dict.getId(ref_Renamed);
+ tagw.writeUI16(idref);
+ tagw.writeString(name);
+ }
+ if (tag.topLevelClass != null)
+ {
+ tagw.writeUI16(0);
+ tagw.writeString(tag.topLevelClass);
+ }
+ encodeTag(tag);
+ }
+
+ public override void frameLabel(FrameLabel tag)
+ {
+ tagw.writeString(tag.label);
+ if (tag.anchor && SwfVersion >= 6)
+ {
+ tagw.writeUI8(1);
+ }
+ encodeTag(tag);
+ }
+
+ public override void importAssets(ImportAssets tag)
+ {
+ tagw.writeString(tag.url);
+ if (tag.code == flash.swf.TagValues_Fields.stagImportAssets2)
+ {
+ tagw.writeUI8(tag.downloadNow?1:0);
+ tagw.writeUI8(tag.SHA1 != null?1:0);
+ if (tag.SHA1 != null)
+ {
+ tagw.write(tag.SHA1);
+ }
+ }
+ tagw.writeUI16(tag.importRecords.Count);
+ System.Collections.IEnumerator it = tag.importRecords.GetEnumerator();
+ //UPGRADE_TODO: Method 'java.util.Iterator.hasNext' was converted to 'System.Collections.IEnumerator.MoveNext' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratorhasNext'"
+ while (it.MoveNext())
+ {
+ //UPGRADE_TODO: Method 'java.util.Iterator.next' was converted to 'System.Collections.IEnumerator.Current' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratornext'"
+ ImportRecord record = (ImportRecord) it.Current;
+ int id = dict.add(record);
+ tagw.writeUI16(id);
+ tagw.writeString(record.name);
+ }
+ encodeTag(tag);
+ }
+
+ public override void importAssets2(ImportAssets tag)
+ {
+ importAssets(tag);
+ }
+
+ public override void jpegTables(GenericTag tag)
+ {
+ encodeTagHeader(tag.code, tag.data.Length, false);
+ writer.write(tag.data);
+ }
+
+ public override void placeObject(PlaceObject tag)
+ {
+ int idref = dict.getId(tag.ref_Renamed);
+ tagw.writeUI16(idref);
+ tagw.writeUI16(tag.depth);
+ encodeMatrix(tag.matrix, tagw);
+ if (tag.colorTransform != null)
+ {
+ encodeCxform(tag.colorTransform, tagw);
+ }
+ encodeTag(tag);
+ }
+
+ public override void placeObject2(PlaceObject tag)
+ {
+ placeObject23(tag);
+ }
+
+ public override void placeObject3(PlaceObject tag)
+ {
+ placeObject23(tag);
+ }
+
+ public virtual void placeObject23(PlaceObject tag)
+ {
+ tagw.writeUI8(tag.flags);
+ if (tag.code == flash.swf.TagValues_Fields.stagPlaceObject3)
+ {
+ tagw.writeUI8(tag.flags2);
+ }
+ tagw.writeUI16(tag.depth);
+ if (tag.hasClassName())
+ {
+ tagw.writeString(tag.className);
+ }
+ if (tag.hasCharID())
+ {
+ int idref = dict.getId(tag.ref_Renamed);
+ tagw.writeUI16(idref);
+ }
+ if (tag.hasMatrix())
+ {
+ encodeMatrix(tag.matrix, tagw);
+ }
+ if (tag.hasCxform())
+ {
+ // ed 5/22/03 the SWF 6 file format spec says this should be a CXFORM, but
+ // the spec is wrong. the player expects a CXFORMA.
+ encodeCxforma(((CXFormWithAlpha) tag.colorTransform), tagw);
+ }
+ if (tag.hasRatio())
+ {
+ tagw.writeUI16(tag.ratio);
+ }
+ if (tag.hasName())
+ {
+ tagw.writeString(tag.name);
+ }
+ if (tag.hasClipDepth())
+ {
+ tagw.writeUI16(tag.clipDepth);
+ }
+ if (tag.code == flash.swf.TagValues_Fields.stagPlaceObject3)
+ {
+ if (tag.hasFilterList())
+ {
+ encodeFilterList(tag.filters, tagw);
+ }
+ if (tag.hasBlendMode())
+ {
+ tagw.writeUI8(tag.blendMode);
+ }
+ }
+ if (tag.hasClipAction())
+ {
+ int adjust = 0;
+ if (Debug)
+ {
+ adjust = writer.Pos + 6;
+ debug.adjust += adjust;
+ }
+ new ActionEncoder(tagw, debug).encodeClipActions(tag.clipActions);
+ if (Debug)
+ {
+ debug.adjust -= adjust;
+ }
+ }
+ encodeTag(tag);
+ }
+
+ public override void protect(GenericTag tag)
+ {
+ if (tag.data != null)
+ {
+ encodeTagHeader(tag.code, tag.data.Length, false);
+ writer.write(tag.data);
+ }
+ else
+ {
+ encodeTagHeader(tag.code, 0, false);
+ }
+ }
+
+ public override void removeObject(RemoveObject tag)
+ {
+ encodeTagHeader(tag.code, 4, false);
+ int idref = dict.getId(tag.ref_Renamed);
+ writer.writeUI16(idref);
+ writer.writeUI16(tag.depth);
+ }
+
+ public override void removeObject2(RemoveObject tag)
+ {
+ encodeTagHeader(tag.code, 2, false);
+ writer.writeUI16(tag.depth);
+ }
+
+ public override void showFrame(ShowFrame tag)
+ {
+ encodeTagHeader(tag.code, 0, false);
+ frames++;
+ }
+
+ public override void soundStreamBlock(GenericTag tag)
+ {
+ encodeTagHeader(tag.code, tag.data.Length, false);
+ writer.write(tag.data);
+ }
+
+ public override void soundStreamHead(SoundStreamHead tag)
+ {
+ int length = 4;
+
+ // we need to add two bytes for an extra SI16 (latencySeek)
+ if (tag.compression == SoundStreamHead.sndCompressMP3)
+ {
+ length += 2;
+ }
+
+ encodeTagHeader(tag.code, length, false);
+
+ // 1 byte
+ writer.writeUBits(0, 4); // reserved
+ writer.writeUBits(tag.playbackRate, 2);
+ writer.writeUBits(tag.playbackSize, 1);
+ writer.writeUBits(tag.playbackType, 1);
+
+ // 1 byte
+ writer.writeUBits(tag.compression, 4);
+ writer.writeUBits(tag.streamRate, 2);
+ writer.writeUBits(tag.streamSize, 1);
+ writer.writeUBits(tag.streamType, 1);
+
+ // 2 bytes
+ writer.writeUI16(tag.streamSampleCount);
+
+ if (tag.compression == SoundStreamHead.sndCompressMP3)
+ {
+ // 2 bytes
+ writer.writeSI16(tag.latencySeek);
+ }
+ }
+
+ public override void soundStreamHead2(SoundStreamHead tag)
+ {
+ soundStreamHead(tag);
+ }
+
+ public override void startSound(StartSound tag)
+ {
+ int idref = dict.getId(tag.sound);
+ tagw.writeUI16(idref);
+ encodeSoundInfo(tag.soundInfo, tagw);
+ encodeTag(tag);
+ }
+
+ public override void videoFrame(VideoFrame tag)
+ {
+ encodeTagHeader(tag.code, 4 + tag.videoData.Length, false);
+ int idref = dict.getId(tag.stream);
+ writer.writeUI16(idref);
+ writer.writeUI16(tag.frameNum);
+ writer.write(tag.videoData);
+ }
+
+ public override void defineSceneAndFrameLabelData(DefineSceneAndFrameLabelData tag)
+ {
+ encodeTagHeader(tag.code, tag.data.Length, false);
+ writer.write(tag.data);
+ }
+
+ public override void doABC(DoABC tag)
+ {
+ if (tag.code == flash.swf.TagValues_Fields.stagDoABC2)
+ {
+ encodeTagHeader(tag.code, 4 + tag.name.Length + 1 + tag.abc.Length, false);
+ writer.write32(tag.flag);
+ writer.writeString(tag.name);
+ }
+ else
+ {
+ encodeTagHeader(tag.code, tag.abc.Length, false);
+ }
+
+ writer.write(tag.abc);
+ }
+
+ public override void unknown(GenericTag tag)
+ {
+ encodeTagHeader(tag.code, tag.data.Length, false);
+ writer.write(tag.data);
+ }
+
+ public virtual sbyte[] toByteArray()
+ {
+ //TODO this could be improved, tricky bit is that writeTo is not trivial
+ // and has the side effect of compressing (meaning the writer.size()
+ // may be larger than necessary)
+ System.IO.MemoryStream out_Renamed = new System.IO.MemoryStream(writer.Length);
+ writeTo(out_Renamed);
+ return SupportClass.ToSByteArray(out_Renamed.ToArray());
+ }
+
+ public override void scriptLimits(ScriptLimits tag)
+ {
+ tagw.writeUI16(tag.scriptRecursionLimit);
+ tagw.writeUI16(tag.scriptTimeLimit);
+ encodeTag(tag);
+ }
+ }
}
\ No newline at end of file
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/110 ActionScript 3 - Flash IDE Project/Project.as3proj b/External/Extensions/AS3Templates/$(BaseDir)/Projects/110 ActionScript 3 - Flash IDE Project/Project.as3proj
new file mode 100644
index 0000000000..71f47c7559
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/110 ActionScript 3 - Flash IDE Project/Project.as3proj
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/110 ActionScript 3 - Flash IDE Project/Project.png b/External/Extensions/AS3Templates/$(BaseDir)/Projects/110 ActionScript 3 - Flash IDE Project/Project.png
new file mode 100644
index 0000000000..d1c3fe6222
Binary files /dev/null and b/External/Extensions/AS3Templates/$(BaseDir)/Projects/110 ActionScript 3 - Flash IDE Project/Project.png differ
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/110 ActionScript 3 - Flash IDE Project/Project.txt b/External/Extensions/AS3Templates/$(BaseDir)/Projects/110 ActionScript 3 - Flash IDE Project/Project.txt
new file mode 100644
index 0000000000..645e307742
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/110 ActionScript 3 - Flash IDE Project/Project.txt
@@ -0,0 +1 @@
+An empty project written in ActionScript 3 with compilation using the Flash IDE
\ No newline at end of file
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/120 ActionScript 3 - AS3 Project/Project.as3proj b/External/Extensions/AS3Templates/$(BaseDir)/Projects/120 ActionScript 3 - AS3 Project/Project.as3proj
new file mode 100644
index 0000000000..e8ed942628
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/120 ActionScript 3 - AS3 Project/Project.as3proj
@@ -0,0 +1,58 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/120 ActionScript 3 - AS3 Project/Project.png b/External/Extensions/AS3Templates/$(BaseDir)/Projects/120 ActionScript 3 - AS3 Project/Project.png
new file mode 100644
index 0000000000..bf1262c6e8
Binary files /dev/null and b/External/Extensions/AS3Templates/$(BaseDir)/Projects/120 ActionScript 3 - AS3 Project/Project.png differ
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/120 ActionScript 3 - AS3 Project/Project.txt b/External/Extensions/AS3Templates/$(BaseDir)/Projects/120 ActionScript 3 - AS3 Project/Project.txt
new file mode 100644
index 0000000000..a6eb1f267c
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/120 ActionScript 3 - AS3 Project/Project.txt
@@ -0,0 +1 @@
+A project written in ActionScript 3 for the Flash 9+ Player
\ No newline at end of file
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/120 ActionScript 3 - AS3 Project/bin/expressInstall.swf b/External/Extensions/AS3Templates/$(BaseDir)/Projects/120 ActionScript 3 - AS3 Project/bin/expressInstall.swf
new file mode 100644
index 0000000000..86958bf3a7
Binary files /dev/null and b/External/Extensions/AS3Templates/$(BaseDir)/Projects/120 ActionScript 3 - AS3 Project/bin/expressInstall.swf differ
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/120 ActionScript 3 - AS3 Project/bin/index.html.template b/External/Extensions/AS3Templates/$(BaseDir)/Projects/120 ActionScript 3 - AS3 Project/bin/index.html.template
new file mode 100644
index 0000000000..d07510f497
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/120 ActionScript 3 - AS3 Project/bin/index.html.template
@@ -0,0 +1,40 @@
+
+
+
+
+ $(ProjectName)
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/120 ActionScript 3 - AS3 Project/bin/js/swfobject.js b/External/Extensions/AS3Templates/$(BaseDir)/Projects/120 ActionScript 3 - AS3 Project/bin/js/swfobject.js
new file mode 100644
index 0000000000..8eafe9dd83
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/120 ActionScript 3 - AS3 Project/bin/js/swfobject.js
@@ -0,0 +1,4 @@
+/* SWFObject v2.2
+ is released under the MIT License
+*/
+var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y0){for(var af=0;af0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad '}}aa.outerHTML='"+af+" ";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/130 ActionScript 3 - AS3 Project with Preloader/Project.png b/External/Extensions/AS3Templates/$(BaseDir)/Projects/130 ActionScript 3 - AS3 Project with Preloader/Project.png
new file mode 100644
index 0000000000..08c1d7238c
Binary files /dev/null and b/External/Extensions/AS3Templates/$(BaseDir)/Projects/130 ActionScript 3 - AS3 Project with Preloader/Project.png differ
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/130 ActionScript 3 - AS3 Project with Preloader/Project.txt b/External/Extensions/AS3Templates/$(BaseDir)/Projects/130 ActionScript 3 - AS3 Project with Preloader/Project.txt
new file mode 100644
index 0000000000..82ae7b6d46
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/130 ActionScript 3 - AS3 Project with Preloader/Project.txt
@@ -0,0 +1 @@
+A project written in ActionScript 3 for the Flash 9+ Player - optimized with a preloader
\ No newline at end of file
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/130 ActionScript 3 - AS3 Project with Preloader/bin/expressInstall.swf b/External/Extensions/AS3Templates/$(BaseDir)/Projects/130 ActionScript 3 - AS3 Project with Preloader/bin/expressInstall.swf
new file mode 100644
index 0000000000..86958bf3a7
Binary files /dev/null and b/External/Extensions/AS3Templates/$(BaseDir)/Projects/130 ActionScript 3 - AS3 Project with Preloader/bin/expressInstall.swf differ
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/130 ActionScript 3 - AS3 Project with Preloader/bin/index.html.template b/External/Extensions/AS3Templates/$(BaseDir)/Projects/130 ActionScript 3 - AS3 Project with Preloader/bin/index.html.template
new file mode 100644
index 0000000000..d07510f497
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/130 ActionScript 3 - AS3 Project with Preloader/bin/index.html.template
@@ -0,0 +1,40 @@
+
+
+
+
+ $(ProjectName)
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/130 ActionScript 3 - AS3 Project with Preloader/bin/js/swfobject.js b/External/Extensions/AS3Templates/$(BaseDir)/Projects/130 ActionScript 3 - AS3 Project with Preloader/bin/js/swfobject.js
new file mode 100644
index 0000000000..8eafe9dd83
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/130 ActionScript 3 - AS3 Project with Preloader/bin/js/swfobject.js
@@ -0,0 +1,4 @@
+/* SWFObject v2.2
+ is released under the MIT License
+*/
+var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y0){for(var af=0;af0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad '}}aa.outerHTML='"+af+" ";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ build.bat "$(CompilerPath)"
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/135 ActionScript 3 - AS3 Library SWC/Project.png b/External/Extensions/AS3Templates/$(BaseDir)/Projects/135 ActionScript 3 - AS3 Library SWC/Project.png
new file mode 100644
index 0000000000..bf1262c6e8
Binary files /dev/null and b/External/Extensions/AS3Templates/$(BaseDir)/Projects/135 ActionScript 3 - AS3 Library SWC/Project.png differ
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/135 ActionScript 3 - AS3 Library SWC/Project.txt b/External/Extensions/AS3Templates/$(BaseDir)/Projects/135 ActionScript 3 - AS3 Library SWC/Project.txt
new file mode 100644
index 0000000000..41d7c6a41e
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/135 ActionScript 3 - AS3 Library SWC/Project.txt
@@ -0,0 +1 @@
+An ActionScript 3 library (SWC) project to compile with an 'ant' script.
\ No newline at end of file
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/135 ActionScript 3 - AS3 Library SWC/build.bat b/External/Extensions/AS3Templates/$(BaseDir)/Projects/135 ActionScript 3 - AS3 Library SWC/build.bat
new file mode 100644
index 0000000000..223f8d56d4
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/135 ActionScript 3 - AS3 Library SWC/build.bat
@@ -0,0 +1,8 @@
+@echo off
+
+:: set environment
+if not "%~1"=="" set FLEX_HOME=%~1
+
+:: build
+echo build with %FLEX_HOME%
+ant
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/135 ActionScript 3 - AS3 Library SWC/build.xml.template b/External/Extensions/AS3Templates/$(BaseDir)/Projects/135 ActionScript 3 - AS3 Library SWC/build.xml.template
new file mode 100644
index 0000000000..c279f53bcc
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/135 ActionScript 3 - AS3 Library SWC/build.xml.template
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/135 ActionScript 3 - AS3 Library SWC/lib/.empty b/External/Extensions/AS3Templates/$(BaseDir)/Projects/135 ActionScript 3 - AS3 Library SWC/lib/.empty
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/135 ActionScript 3 - AS3 Library SWC/src/$(PackagePath)/$(ProjectID).as.template b/External/Extensions/AS3Templates/$(BaseDir)/Projects/135 ActionScript 3 - AS3 Library SWC/src/$(PackagePath)/$(ProjectID).as.template
new file mode 100644
index 0000000000..5da7c3a3b7
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/135 ActionScript 3 - AS3 Library SWC/src/$(PackagePath)/$(ProjectID).as.template
@@ -0,0 +1,15 @@
+package $(PackageName)$(CSLB){
+
+ /**
+ $(CBI)* ...
+ $(CBI)* @author $(DefaultUser)
+ $(CBI)*/
+ public class $(ProjectID) {
+
+ public function $(ProjectID)() $(CSLB){
+
+ }
+
+ }
+
+}
\ No newline at end of file
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/140 ActionScript 3 - Flex 3 Project/Project.as3proj b/External/Extensions/AS3Templates/$(BaseDir)/Projects/140 ActionScript 3 - Flex 3 Project/Project.as3proj
new file mode 100644
index 0000000000..12669b4be5
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/140 ActionScript 3 - Flex 3 Project/Project.as3proj
@@ -0,0 +1,81 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/140 ActionScript 3 - Flex 3 Project/Project.png b/External/Extensions/AS3Templates/$(BaseDir)/Projects/140 ActionScript 3 - Flex 3 Project/Project.png
new file mode 100644
index 0000000000..8dc30ca1af
Binary files /dev/null and b/External/Extensions/AS3Templates/$(BaseDir)/Projects/140 ActionScript 3 - Flex 3 Project/Project.png differ
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/140 ActionScript 3 - Flex 3 Project/Project.txt b/External/Extensions/AS3Templates/$(BaseDir)/Projects/140 ActionScript 3 - Flex 3 Project/Project.txt
new file mode 100644
index 0000000000..35a213b47d
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/140 ActionScript 3 - Flex 3 Project/Project.txt
@@ -0,0 +1 @@
+An ActionScript 3 project that uses MXML and the Flex 3 Framework
\ No newline at end of file
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/140 ActionScript 3 - Flex 3 Project/bin/expressInstall.swf b/External/Extensions/AS3Templates/$(BaseDir)/Projects/140 ActionScript 3 - Flex 3 Project/bin/expressInstall.swf
new file mode 100644
index 0000000000..86958bf3a7
Binary files /dev/null and b/External/Extensions/AS3Templates/$(BaseDir)/Projects/140 ActionScript 3 - Flex 3 Project/bin/expressInstall.swf differ
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/140 ActionScript 3 - Flex 3 Project/bin/index.html.template b/External/Extensions/AS3Templates/$(BaseDir)/Projects/140 ActionScript 3 - Flex 3 Project/bin/index.html.template
new file mode 100644
index 0000000000..d07510f497
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/140 ActionScript 3 - Flex 3 Project/bin/index.html.template
@@ -0,0 +1,40 @@
+
+
+
+
+ $(ProjectName)
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/140 ActionScript 3 - Flex 3 Project/bin/js/swfobject.js b/External/Extensions/AS3Templates/$(BaseDir)/Projects/140 ActionScript 3 - Flex 3 Project/bin/js/swfobject.js
new file mode 100644
index 0000000000..8eafe9dd83
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/140 ActionScript 3 - Flex 3 Project/bin/js/swfobject.js
@@ -0,0 +1,4 @@
+/* SWFObject v2.2
+ is released under the MIT License
+*/
+var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y0){for(var af=0;af0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad '}}aa.outerHTML='"+af+" ";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab
+
+
+
\ No newline at end of file
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/150 ActionScript 3 - Flex 4 Project/Project.as3proj b/External/Extensions/AS3Templates/$(BaseDir)/Projects/150 ActionScript 3 - Flex 4 Project/Project.as3proj
new file mode 100644
index 0000000000..a963c6b5b3
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/150 ActionScript 3 - Flex 4 Project/Project.as3proj
@@ -0,0 +1,82 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/150 ActionScript 3 - Flex 4 Project/Project.png b/External/Extensions/AS3Templates/$(BaseDir)/Projects/150 ActionScript 3 - Flex 4 Project/Project.png
new file mode 100644
index 0000000000..33031dea06
Binary files /dev/null and b/External/Extensions/AS3Templates/$(BaseDir)/Projects/150 ActionScript 3 - Flex 4 Project/Project.png differ
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/150 ActionScript 3 - Flex 4 Project/Project.txt b/External/Extensions/AS3Templates/$(BaseDir)/Projects/150 ActionScript 3 - Flex 4 Project/Project.txt
new file mode 100644
index 0000000000..30a7e620b5
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/150 ActionScript 3 - Flex 4 Project/Project.txt
@@ -0,0 +1 @@
+An ActionScript 3 project that uses MXML and the Flex 4 Framework
\ No newline at end of file
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/150 ActionScript 3 - Flex 4 Project/bin/expressInstall.swf b/External/Extensions/AS3Templates/$(BaseDir)/Projects/150 ActionScript 3 - Flex 4 Project/bin/expressInstall.swf
new file mode 100644
index 0000000000..86958bf3a7
Binary files /dev/null and b/External/Extensions/AS3Templates/$(BaseDir)/Projects/150 ActionScript 3 - Flex 4 Project/bin/expressInstall.swf differ
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/150 ActionScript 3 - Flex 4 Project/bin/index.html.template b/External/Extensions/AS3Templates/$(BaseDir)/Projects/150 ActionScript 3 - Flex 4 Project/bin/index.html.template
new file mode 100644
index 0000000000..d07510f497
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/150 ActionScript 3 - Flex 4 Project/bin/index.html.template
@@ -0,0 +1,40 @@
+
+
+
+
+ $(ProjectName)
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/150 ActionScript 3 - Flex 4 Project/bin/js/swfobject.js b/External/Extensions/AS3Templates/$(BaseDir)/Projects/150 ActionScript 3 - Flex 4 Project/bin/js/swfobject.js
new file mode 100644
index 0000000000..8eafe9dd83
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/150 ActionScript 3 - Flex 4 Project/bin/js/swfobject.js
@@ -0,0 +1,4 @@
+/* SWFObject v2.2
+ is released under the MIT License
+*/
+var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y0){for(var af=0;af0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad '}}aa.outerHTML='"+af+" ";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/160 ActionScript 3 - AIR AS3 Projector/AIR_readme.txt b/External/Extensions/AS3Templates/$(BaseDir)/Projects/160 ActionScript 3 - AIR AS3 Projector/AIR_readme.txt
new file mode 100644
index 0000000000..75d1a6acdb
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/160 ActionScript 3 - AIR AS3 Projector/AIR_readme.txt
@@ -0,0 +1,20 @@
+AIR for desktop instructions
+
+1. Configuration
+
+ - edit 'bat\SetupSDK.bat' for the path to Flex SDK (defaults should be ok)
+
+
+2. Creating a self-signed certificate:
+
+ - run 'bat\CreateCertificate.bat' to generate your self-signed certificate,
+
+ (!) wait a minute before packaging.
+
+
+3. Run/debug from FlashDevelop as usual (build F8, build&run F5 or Ctrl+Enter)
+
+
+4. Packaging for release:
+
+ - run 'bat\PackageApp.bat' to only create the AIR setup
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/160 ActionScript 3 - AIR AS3 Projector/Project.as3proj b/External/Extensions/AS3Templates/$(BaseDir)/Projects/160 ActionScript 3 - AIR AS3 Projector/Project.as3proj
new file mode 100644
index 0000000000..27c6e874ac
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/160 ActionScript 3 - AIR AS3 Projector/Project.as3proj
@@ -0,0 +1,78 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/160 ActionScript 3 - AIR AS3 Projector/Project.png b/External/Extensions/AS3Templates/$(BaseDir)/Projects/160 ActionScript 3 - AIR AS3 Projector/Project.png
new file mode 100644
index 0000000000..5cad22b601
Binary files /dev/null and b/External/Extensions/AS3Templates/$(BaseDir)/Projects/160 ActionScript 3 - AIR AS3 Projector/Project.png differ
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/160 ActionScript 3 - AIR AS3 Projector/Project.txt b/External/Extensions/AS3Templates/$(BaseDir)/Projects/160 ActionScript 3 - AIR AS3 Projector/Project.txt
new file mode 100644
index 0000000000..242a035de9
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/160 ActionScript 3 - AIR AS3 Projector/Project.txt
@@ -0,0 +1 @@
+An AIR projector written in ActionScript 3
\ No newline at end of file
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/160 ActionScript 3 - AIR AS3 Projector/application.xml.template b/External/Extensions/AS3Templates/$(BaseDir)/Projects/160 ActionScript 3 - AIR AS3 Projector/application.xml.template
new file mode 100644
index 0000000000..24c7106b31
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/160 ActionScript 3 - AIR AS3 Projector/application.xml.template
@@ -0,0 +1,27 @@
+
+
+
+ $(PACKAGEDOT)$(PROJECTID)
+ 1.0
+ $(PROJECTID)
+
+ $(PROJECTNAME)
+
+
+
+
+ $(PROJECTNAME)
+ $(PROJECTID).swf
+ standard
+ false
+ true
+ true
+ true
+ true
+
+
+
+
\ No newline at end of file
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/160 ActionScript 3 - AIR AS3 Projector/bat/CreateCertificate.bat b/External/Extensions/AS3Templates/$(BaseDir)/Projects/160 ActionScript 3 - AIR AS3 Projector/bat/CreateCertificate.bat
new file mode 100644
index 0000000000..f9a51a57f9
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/160 ActionScript 3 - AIR AS3 Projector/bat/CreateCertificate.bat
@@ -0,0 +1,34 @@
+@echo off
+
+:: Set working dir
+cd %~dp0 & cd ..
+
+set PAUSE_ERRORS=1
+call bat\SetupSDK.bat
+call bat\SetupApp.bat
+
+:: Generate
+echo.
+echo Generating a self-signed certificate...
+call adt -certificate -cn %CERT_NAME% 2048-RSA %CERT_FILE% %CERT_PASS%
+if errorlevel 1 goto failed
+
+:succeed
+echo.
+echo Certificate created: %CERT_FILE% with password "%CERT_PASS%"
+echo.
+if "%CERT_PASS%" == "fd" echo Note: You did not change the default password
+echo.
+echo HINTS:
+echo - you only need to generate this certificate once,
+echo - wait a minute before using this certificate to package your AIR application.
+echo.
+goto end
+
+:failed
+echo.
+echo Certificate creation FAILED.
+echo.
+
+:end
+pause
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/160 ActionScript 3 - AIR AS3 Projector/bat/PackageApp.bat b/External/Extensions/AS3Templates/$(BaseDir)/Projects/160 ActionScript 3 - AIR AS3 Projector/bat/PackageApp.bat
new file mode 100644
index 0000000000..59aed98b63
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/160 ActionScript 3 - AIR AS3 Projector/bat/PackageApp.bat
@@ -0,0 +1,15 @@
+@echo off
+
+:: Set working dir
+cd %~dp0 & cd ..
+
+set PAUSE_ERRORS=1
+call bat\SetupSDK.bat
+call bat\SetupApp.bat
+
+set AIR_TARGET=
+::set AIR_TARGET=-captive-runtime
+set OPTIONS=-tsa none
+call bat\Packager.bat
+
+pause
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/160 ActionScript 3 - AIR AS3 Projector/bat/Packager.bat b/External/Extensions/AS3Templates/$(BaseDir)/Projects/160 ActionScript 3 - AIR AS3 Projector/bat/Packager.bat
new file mode 100644
index 0000000000..03a520e1a7
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/160 ActionScript 3 - AIR AS3 Projector/bat/Packager.bat
@@ -0,0 +1,39 @@
+@echo off
+
+:: Set working dir
+cd %~dp0 & cd ..
+
+if not exist %CERT_FILE% goto certificate
+
+:: AIR output
+if not exist %AIR_PATH% md %AIR_PATH%
+set OUTPUT=%AIR_PATH%\%AIR_NAME%%AIR_TARGET%.air
+
+:: Package
+echo.
+echo Packaging %AIR_NAME%%AIR_TARGET%.air using certificate %CERT_FILE%...
+call adt -package %OPTIONS% %SIGNING_OPTIONS% %OUTPUT% %APP_XML% %FILE_OR_DIR%
+if errorlevel 1 goto failed
+goto end
+
+:certificate
+echo.
+echo Certificate not found: %CERT_FILE%
+echo.
+echo Troubleshooting:
+echo - generate a default certificate using 'bat\CreateCertificate.bat'
+echo.
+if %PAUSE_ERRORS%==1 pause
+exit
+
+:failed
+echo AIR setup creation FAILED.
+echo.
+echo Troubleshooting:
+echo - verify AIR SDK target version in %APP_XML%
+echo.
+if %PAUSE_ERRORS%==1 pause
+exit
+
+:end
+echo.
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/160 ActionScript 3 - AIR AS3 Projector/bat/RunApp.bat b/External/Extensions/AS3Templates/$(BaseDir)/Projects/160 ActionScript 3 - AIR AS3 Projector/bat/RunApp.bat
new file mode 100644
index 0000000000..5b00357b4f
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/160 ActionScript 3 - AIR AS3 Projector/bat/RunApp.bat
@@ -0,0 +1,21 @@
+@echo off
+
+:: Set working dir
+cd %~dp0 & cd ..
+
+set PAUSE_ERRORS=1
+call bat\SetupSDK.bat
+call bat\SetupApp.bat
+
+echo.
+echo Starting AIR Debug Launcher...
+echo.
+
+adl "%APP_XML%" "%APP_DIR%"
+if errorlevel 1 goto error
+goto end
+
+:error
+pause
+
+:end
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/160 ActionScript 3 - AIR AS3 Projector/bat/SetupApp.bat.template b/External/Extensions/AS3Templates/$(BaseDir)/Projects/160 ActionScript 3 - AIR AS3 Projector/bat/SetupApp.bat.template
new file mode 100644
index 0000000000..afe57569cc
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/160 ActionScript 3 - AIR AS3 Projector/bat/SetupApp.bat.template
@@ -0,0 +1,47 @@
+:: Set working dir
+cd %~dp0 & cd ..
+
+:user_configuration
+
+:: About AIR application packaging
+:: http://livedocs.adobe.com/flex/3/html/help.html?content=CommandLineTools_5.html#1035959
+:: http://livedocs.adobe.com/flex/3/html/distributing_apps_4.html#1037515
+
+:: NOTICE: all paths are relative to project root
+
+:: Your certificate information
+set CERT_NAME="$(PROJECTNAME)"
+set CERT_PASS=fd
+set CERT_FILE="bat\$(PROJECTID).p12"
+set SIGNING_OPTIONS=-storetype pkcs12 -keystore %CERT_FILE% -storepass %CERT_PASS%
+
+:: Application descriptor
+set APP_XML=application.xml
+
+:: Files to package
+set APP_DIR=bin
+set FILE_OR_DIR=-C %APP_DIR% .
+
+:: Your application ID (must match of Application descriptor) and remove spaces
+for /f "tokens=3 delims=<>" %%a in ('findstr /R /C:"^[ ]*" %APP_XML%') do set APP_ID=%%a
+set APP_ID=%APP_ID: =%
+
+:: Output
+set AIR_PATH=air
+set AIR_NAME=$(PROJECTID)
+
+:validation
+findstr /C:"%APP_ID% " "%APP_XML%" > NUL
+if errorlevel 1 goto badid
+goto end
+
+:badid
+echo.
+echo ERROR:
+echo Application ID in 'bat\SetupApp.bat' (APP_ID)
+echo does NOT match Application descriptor '%APP_XML%' (id)
+echo.
+if %PAUSE_ERRORS%==1 pause
+exit
+
+:end
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/160 ActionScript 3 - AIR AS3 Projector/bat/SetupSDK.bat.template b/External/Extensions/AS3Templates/$(BaseDir)/Projects/160 ActionScript 3 - AIR AS3 Projector/bat/SetupSDK.bat.template
new file mode 100644
index 0000000000..55942b9136
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/160 ActionScript 3 - AIR AS3 Projector/bat/SetupSDK.bat.template
@@ -0,0 +1,26 @@
+:: Set working dir
+cd %~dp0 & cd ..
+
+:user_configuration
+
+:: Static path to Flex SDK
+set FLEX_SDK=$(FlexSDK)
+
+:: Use FD supplied SDK path if executed from FD
+if exist "%FD_CUR_SDK%" set FLEX_SDK=%FD_CUR_SDK%
+
+:validation
+if not exist "%FLEX_SDK%\bin" goto flexsdk
+goto succeed
+
+:flexsdk
+echo.
+echo ERROR: incorrect path to Flex SDK in 'bat\SetupSDK.bat'
+echo.
+echo Looking for: %FLEX_SDK%\bin
+echo.
+if %PAUSE_ERRORS%==1 pause
+exit
+
+:succeed
+set PATH=%FLEX_SDK%\bin;%PATH%
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/160 ActionScript 3 - AIR AS3 Projector/bin/.empty b/External/Extensions/AS3Templates/$(BaseDir)/Projects/160 ActionScript 3 - AIR AS3 Projector/bin/.empty
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/160 ActionScript 3 - AIR AS3 Projector/src/$(PackagePath)/Main.as.template b/External/Extensions/AS3Templates/$(BaseDir)/Projects/160 ActionScript 3 - AIR AS3 Projector/src/$(PackagePath)/Main.as.template
new file mode 100644
index 0000000000..3d011abc2c
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/160 ActionScript 3 - AIR AS3 Projector/src/$(PackagePath)/Main.as.template
@@ -0,0 +1,16 @@
+package $(PackageName)$(CSLB){
+ import flash.display.Sprite;
+
+ /**
+ $(CBI)* ...
+ $(CBI)* @author $(DefaultUser)
+ $(CBI)*/
+ public class Main extends Sprite $(CSLB){
+
+ public function Main() $(CSLB){
+
+ }
+
+ }
+
+}
\ No newline at end of file
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/170 ActionScript 3 - AIR Flex 3 Projector/AIR_readme.txt b/External/Extensions/AS3Templates/$(BaseDir)/Projects/170 ActionScript 3 - AIR Flex 3 Projector/AIR_readme.txt
new file mode 100644
index 0000000000..75d1a6acdb
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/170 ActionScript 3 - AIR Flex 3 Projector/AIR_readme.txt
@@ -0,0 +1,20 @@
+AIR for desktop instructions
+
+1. Configuration
+
+ - edit 'bat\SetupSDK.bat' for the path to Flex SDK (defaults should be ok)
+
+
+2. Creating a self-signed certificate:
+
+ - run 'bat\CreateCertificate.bat' to generate your self-signed certificate,
+
+ (!) wait a minute before packaging.
+
+
+3. Run/debug from FlashDevelop as usual (build F8, build&run F5 or Ctrl+Enter)
+
+
+4. Packaging for release:
+
+ - run 'bat\PackageApp.bat' to only create the AIR setup
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/170 ActionScript 3 - AIR Flex 3 Projector/Project.as3proj b/External/Extensions/AS3Templates/$(BaseDir)/Projects/170 ActionScript 3 - AIR Flex 3 Projector/Project.as3proj
new file mode 100644
index 0000000000..8f00e65ec1
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/170 ActionScript 3 - AIR Flex 3 Projector/Project.as3proj
@@ -0,0 +1,83 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/170 ActionScript 3 - AIR Flex 3 Projector/Project.png b/External/Extensions/AS3Templates/$(BaseDir)/Projects/170 ActionScript 3 - AIR Flex 3 Projector/Project.png
new file mode 100644
index 0000000000..5cad22b601
Binary files /dev/null and b/External/Extensions/AS3Templates/$(BaseDir)/Projects/170 ActionScript 3 - AIR Flex 3 Projector/Project.png differ
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/170 ActionScript 3 - AIR Flex 3 Projector/Project.txt b/External/Extensions/AS3Templates/$(BaseDir)/Projects/170 ActionScript 3 - AIR Flex 3 Projector/Project.txt
new file mode 100644
index 0000000000..aa90493fb8
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/170 ActionScript 3 - AIR Flex 3 Projector/Project.txt
@@ -0,0 +1 @@
+An AIR projector that uses MXML and the Flex 3 Framework
\ No newline at end of file
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/170 ActionScript 3 - AIR Flex 3 Projector/application.xml.template b/External/Extensions/AS3Templates/$(BaseDir)/Projects/170 ActionScript 3 - AIR Flex 3 Projector/application.xml.template
new file mode 100644
index 0000000000..8f56518ea0
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/170 ActionScript 3 - AIR Flex 3 Projector/application.xml.template
@@ -0,0 +1,27 @@
+
+
+
+ $(PACKAGEDOT)$(PROJECTID)
+ 1.0
+ $(PROJECTID)
+
+ $(PROJECTNAME)
+
+
+
+
+ $(PROJECTNAME)
+ $(PROJECTID).swf
+ standard
+ false
+ true
+ true
+ true
+ true
+
+
+
+
\ No newline at end of file
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/170 ActionScript 3 - AIR Flex 3 Projector/bat/CreateCertificate.bat b/External/Extensions/AS3Templates/$(BaseDir)/Projects/170 ActionScript 3 - AIR Flex 3 Projector/bat/CreateCertificate.bat
new file mode 100644
index 0000000000..f9a51a57f9
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/170 ActionScript 3 - AIR Flex 3 Projector/bat/CreateCertificate.bat
@@ -0,0 +1,34 @@
+@echo off
+
+:: Set working dir
+cd %~dp0 & cd ..
+
+set PAUSE_ERRORS=1
+call bat\SetupSDK.bat
+call bat\SetupApp.bat
+
+:: Generate
+echo.
+echo Generating a self-signed certificate...
+call adt -certificate -cn %CERT_NAME% 2048-RSA %CERT_FILE% %CERT_PASS%
+if errorlevel 1 goto failed
+
+:succeed
+echo.
+echo Certificate created: %CERT_FILE% with password "%CERT_PASS%"
+echo.
+if "%CERT_PASS%" == "fd" echo Note: You did not change the default password
+echo.
+echo HINTS:
+echo - you only need to generate this certificate once,
+echo - wait a minute before using this certificate to package your AIR application.
+echo.
+goto end
+
+:failed
+echo.
+echo Certificate creation FAILED.
+echo.
+
+:end
+pause
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/170 ActionScript 3 - AIR Flex 3 Projector/bat/PackageApp.bat b/External/Extensions/AS3Templates/$(BaseDir)/Projects/170 ActionScript 3 - AIR Flex 3 Projector/bat/PackageApp.bat
new file mode 100644
index 0000000000..59aed98b63
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/170 ActionScript 3 - AIR Flex 3 Projector/bat/PackageApp.bat
@@ -0,0 +1,15 @@
+@echo off
+
+:: Set working dir
+cd %~dp0 & cd ..
+
+set PAUSE_ERRORS=1
+call bat\SetupSDK.bat
+call bat\SetupApp.bat
+
+set AIR_TARGET=
+::set AIR_TARGET=-captive-runtime
+set OPTIONS=-tsa none
+call bat\Packager.bat
+
+pause
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/170 ActionScript 3 - AIR Flex 3 Projector/bat/Packager.bat b/External/Extensions/AS3Templates/$(BaseDir)/Projects/170 ActionScript 3 - AIR Flex 3 Projector/bat/Packager.bat
new file mode 100644
index 0000000000..03a520e1a7
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/170 ActionScript 3 - AIR Flex 3 Projector/bat/Packager.bat
@@ -0,0 +1,39 @@
+@echo off
+
+:: Set working dir
+cd %~dp0 & cd ..
+
+if not exist %CERT_FILE% goto certificate
+
+:: AIR output
+if not exist %AIR_PATH% md %AIR_PATH%
+set OUTPUT=%AIR_PATH%\%AIR_NAME%%AIR_TARGET%.air
+
+:: Package
+echo.
+echo Packaging %AIR_NAME%%AIR_TARGET%.air using certificate %CERT_FILE%...
+call adt -package %OPTIONS% %SIGNING_OPTIONS% %OUTPUT% %APP_XML% %FILE_OR_DIR%
+if errorlevel 1 goto failed
+goto end
+
+:certificate
+echo.
+echo Certificate not found: %CERT_FILE%
+echo.
+echo Troubleshooting:
+echo - generate a default certificate using 'bat\CreateCertificate.bat'
+echo.
+if %PAUSE_ERRORS%==1 pause
+exit
+
+:failed
+echo AIR setup creation FAILED.
+echo.
+echo Troubleshooting:
+echo - verify AIR SDK target version in %APP_XML%
+echo.
+if %PAUSE_ERRORS%==1 pause
+exit
+
+:end
+echo.
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/170 ActionScript 3 - AIR Flex 3 Projector/bat/RunApp.bat b/External/Extensions/AS3Templates/$(BaseDir)/Projects/170 ActionScript 3 - AIR Flex 3 Projector/bat/RunApp.bat
new file mode 100644
index 0000000000..5b00357b4f
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/170 ActionScript 3 - AIR Flex 3 Projector/bat/RunApp.bat
@@ -0,0 +1,21 @@
+@echo off
+
+:: Set working dir
+cd %~dp0 & cd ..
+
+set PAUSE_ERRORS=1
+call bat\SetupSDK.bat
+call bat\SetupApp.bat
+
+echo.
+echo Starting AIR Debug Launcher...
+echo.
+
+adl "%APP_XML%" "%APP_DIR%"
+if errorlevel 1 goto error
+goto end
+
+:error
+pause
+
+:end
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/170 ActionScript 3 - AIR Flex 3 Projector/bat/SetupApp.bat.template b/External/Extensions/AS3Templates/$(BaseDir)/Projects/170 ActionScript 3 - AIR Flex 3 Projector/bat/SetupApp.bat.template
new file mode 100644
index 0000000000..afe57569cc
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/170 ActionScript 3 - AIR Flex 3 Projector/bat/SetupApp.bat.template
@@ -0,0 +1,47 @@
+:: Set working dir
+cd %~dp0 & cd ..
+
+:user_configuration
+
+:: About AIR application packaging
+:: http://livedocs.adobe.com/flex/3/html/help.html?content=CommandLineTools_5.html#1035959
+:: http://livedocs.adobe.com/flex/3/html/distributing_apps_4.html#1037515
+
+:: NOTICE: all paths are relative to project root
+
+:: Your certificate information
+set CERT_NAME="$(PROJECTNAME)"
+set CERT_PASS=fd
+set CERT_FILE="bat\$(PROJECTID).p12"
+set SIGNING_OPTIONS=-storetype pkcs12 -keystore %CERT_FILE% -storepass %CERT_PASS%
+
+:: Application descriptor
+set APP_XML=application.xml
+
+:: Files to package
+set APP_DIR=bin
+set FILE_OR_DIR=-C %APP_DIR% .
+
+:: Your application ID (must match of Application descriptor) and remove spaces
+for /f "tokens=3 delims=<>" %%a in ('findstr /R /C:"^[ ]*" %APP_XML%') do set APP_ID=%%a
+set APP_ID=%APP_ID: =%
+
+:: Output
+set AIR_PATH=air
+set AIR_NAME=$(PROJECTID)
+
+:validation
+findstr /C:"%APP_ID% " "%APP_XML%" > NUL
+if errorlevel 1 goto badid
+goto end
+
+:badid
+echo.
+echo ERROR:
+echo Application ID in 'bat\SetupApp.bat' (APP_ID)
+echo does NOT match Application descriptor '%APP_XML%' (id)
+echo.
+if %PAUSE_ERRORS%==1 pause
+exit
+
+:end
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/170 ActionScript 3 - AIR Flex 3 Projector/bat/SetupSDK.bat.template b/External/Extensions/AS3Templates/$(BaseDir)/Projects/170 ActionScript 3 - AIR Flex 3 Projector/bat/SetupSDK.bat.template
new file mode 100644
index 0000000000..55942b9136
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/170 ActionScript 3 - AIR Flex 3 Projector/bat/SetupSDK.bat.template
@@ -0,0 +1,26 @@
+:: Set working dir
+cd %~dp0 & cd ..
+
+:user_configuration
+
+:: Static path to Flex SDK
+set FLEX_SDK=$(FlexSDK)
+
+:: Use FD supplied SDK path if executed from FD
+if exist "%FD_CUR_SDK%" set FLEX_SDK=%FD_CUR_SDK%
+
+:validation
+if not exist "%FLEX_SDK%\bin" goto flexsdk
+goto succeed
+
+:flexsdk
+echo.
+echo ERROR: incorrect path to Flex SDK in 'bat\SetupSDK.bat'
+echo.
+echo Looking for: %FLEX_SDK%\bin
+echo.
+if %PAUSE_ERRORS%==1 pause
+exit
+
+:succeed
+set PATH=%FLEX_SDK%\bin;%PATH%
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/170 ActionScript 3 - AIR Flex 3 Projector/bin/.empty b/External/Extensions/AS3Templates/$(BaseDir)/Projects/170 ActionScript 3 - AIR Flex 3 Projector/bin/.empty
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/170 ActionScript 3 - AIR Flex 3 Projector/src/$(PackagePath)/Main.mxml b/External/Extensions/AS3Templates/$(BaseDir)/Projects/170 ActionScript 3 - AIR Flex 3 Projector/src/$(PackagePath)/Main.mxml
new file mode 100644
index 0000000000..38f80a3fc9
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/170 ActionScript 3 - AIR Flex 3 Projector/src/$(PackagePath)/Main.mxml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/180 ActionScript 3 - AIR Flex 4 Projector/AIR_readme.txt b/External/Extensions/AS3Templates/$(BaseDir)/Projects/180 ActionScript 3 - AIR Flex 4 Projector/AIR_readme.txt
new file mode 100644
index 0000000000..75d1a6acdb
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/180 ActionScript 3 - AIR Flex 4 Projector/AIR_readme.txt
@@ -0,0 +1,20 @@
+AIR for desktop instructions
+
+1. Configuration
+
+ - edit 'bat\SetupSDK.bat' for the path to Flex SDK (defaults should be ok)
+
+
+2. Creating a self-signed certificate:
+
+ - run 'bat\CreateCertificate.bat' to generate your self-signed certificate,
+
+ (!) wait a minute before packaging.
+
+
+3. Run/debug from FlashDevelop as usual (build F8, build&run F5 or Ctrl+Enter)
+
+
+4. Packaging for release:
+
+ - run 'bat\PackageApp.bat' to only create the AIR setup
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/180 ActionScript 3 - AIR Flex 4 Projector/Project.as3proj b/External/Extensions/AS3Templates/$(BaseDir)/Projects/180 ActionScript 3 - AIR Flex 4 Projector/Project.as3proj
new file mode 100644
index 0000000000..72242b4dd2
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/180 ActionScript 3 - AIR Flex 4 Projector/Project.as3proj
@@ -0,0 +1,83 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/180 ActionScript 3 - AIR Flex 4 Projector/Project.png b/External/Extensions/AS3Templates/$(BaseDir)/Projects/180 ActionScript 3 - AIR Flex 4 Projector/Project.png
new file mode 100644
index 0000000000..5cad22b601
Binary files /dev/null and b/External/Extensions/AS3Templates/$(BaseDir)/Projects/180 ActionScript 3 - AIR Flex 4 Projector/Project.png differ
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/180 ActionScript 3 - AIR Flex 4 Projector/Project.txt b/External/Extensions/AS3Templates/$(BaseDir)/Projects/180 ActionScript 3 - AIR Flex 4 Projector/Project.txt
new file mode 100644
index 0000000000..48c6e87f13
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/180 ActionScript 3 - AIR Flex 4 Projector/Project.txt
@@ -0,0 +1 @@
+An AIR projector that uses MXML and the Flex 4 Framework
\ No newline at end of file
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/180 ActionScript 3 - AIR Flex 4 Projector/application.xml.template b/External/Extensions/AS3Templates/$(BaseDir)/Projects/180 ActionScript 3 - AIR Flex 4 Projector/application.xml.template
new file mode 100644
index 0000000000..25f8745565
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/180 ActionScript 3 - AIR Flex 4 Projector/application.xml.template
@@ -0,0 +1,27 @@
+
+
+
+ $(PACKAGEDOT)$(PROJECTID)
+ 1.0
+ $(PROJECTID)
+
+ $(PROJECTNAME)
+
+
+
+
+ $(PROJECTNAME)
+ $(PROJECTID).swf
+ standard
+ false
+ true
+ true
+ true
+ true
+
+
+
+
\ No newline at end of file
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/180 ActionScript 3 - AIR Flex 4 Projector/bat/CreateCertificate.bat b/External/Extensions/AS3Templates/$(BaseDir)/Projects/180 ActionScript 3 - AIR Flex 4 Projector/bat/CreateCertificate.bat
new file mode 100644
index 0000000000..f9a51a57f9
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/180 ActionScript 3 - AIR Flex 4 Projector/bat/CreateCertificate.bat
@@ -0,0 +1,34 @@
+@echo off
+
+:: Set working dir
+cd %~dp0 & cd ..
+
+set PAUSE_ERRORS=1
+call bat\SetupSDK.bat
+call bat\SetupApp.bat
+
+:: Generate
+echo.
+echo Generating a self-signed certificate...
+call adt -certificate -cn %CERT_NAME% 2048-RSA %CERT_FILE% %CERT_PASS%
+if errorlevel 1 goto failed
+
+:succeed
+echo.
+echo Certificate created: %CERT_FILE% with password "%CERT_PASS%"
+echo.
+if "%CERT_PASS%" == "fd" echo Note: You did not change the default password
+echo.
+echo HINTS:
+echo - you only need to generate this certificate once,
+echo - wait a minute before using this certificate to package your AIR application.
+echo.
+goto end
+
+:failed
+echo.
+echo Certificate creation FAILED.
+echo.
+
+:end
+pause
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/180 ActionScript 3 - AIR Flex 4 Projector/bat/PackageApp.bat b/External/Extensions/AS3Templates/$(BaseDir)/Projects/180 ActionScript 3 - AIR Flex 4 Projector/bat/PackageApp.bat
new file mode 100644
index 0000000000..59aed98b63
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/180 ActionScript 3 - AIR Flex 4 Projector/bat/PackageApp.bat
@@ -0,0 +1,15 @@
+@echo off
+
+:: Set working dir
+cd %~dp0 & cd ..
+
+set PAUSE_ERRORS=1
+call bat\SetupSDK.bat
+call bat\SetupApp.bat
+
+set AIR_TARGET=
+::set AIR_TARGET=-captive-runtime
+set OPTIONS=-tsa none
+call bat\Packager.bat
+
+pause
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/180 ActionScript 3 - AIR Flex 4 Projector/bat/Packager.bat b/External/Extensions/AS3Templates/$(BaseDir)/Projects/180 ActionScript 3 - AIR Flex 4 Projector/bat/Packager.bat
new file mode 100644
index 0000000000..03a520e1a7
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/180 ActionScript 3 - AIR Flex 4 Projector/bat/Packager.bat
@@ -0,0 +1,39 @@
+@echo off
+
+:: Set working dir
+cd %~dp0 & cd ..
+
+if not exist %CERT_FILE% goto certificate
+
+:: AIR output
+if not exist %AIR_PATH% md %AIR_PATH%
+set OUTPUT=%AIR_PATH%\%AIR_NAME%%AIR_TARGET%.air
+
+:: Package
+echo.
+echo Packaging %AIR_NAME%%AIR_TARGET%.air using certificate %CERT_FILE%...
+call adt -package %OPTIONS% %SIGNING_OPTIONS% %OUTPUT% %APP_XML% %FILE_OR_DIR%
+if errorlevel 1 goto failed
+goto end
+
+:certificate
+echo.
+echo Certificate not found: %CERT_FILE%
+echo.
+echo Troubleshooting:
+echo - generate a default certificate using 'bat\CreateCertificate.bat'
+echo.
+if %PAUSE_ERRORS%==1 pause
+exit
+
+:failed
+echo AIR setup creation FAILED.
+echo.
+echo Troubleshooting:
+echo - verify AIR SDK target version in %APP_XML%
+echo.
+if %PAUSE_ERRORS%==1 pause
+exit
+
+:end
+echo.
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/180 ActionScript 3 - AIR Flex 4 Projector/bat/RunApp.bat b/External/Extensions/AS3Templates/$(BaseDir)/Projects/180 ActionScript 3 - AIR Flex 4 Projector/bat/RunApp.bat
new file mode 100644
index 0000000000..5b00357b4f
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/180 ActionScript 3 - AIR Flex 4 Projector/bat/RunApp.bat
@@ -0,0 +1,21 @@
+@echo off
+
+:: Set working dir
+cd %~dp0 & cd ..
+
+set PAUSE_ERRORS=1
+call bat\SetupSDK.bat
+call bat\SetupApp.bat
+
+echo.
+echo Starting AIR Debug Launcher...
+echo.
+
+adl "%APP_XML%" "%APP_DIR%"
+if errorlevel 1 goto error
+goto end
+
+:error
+pause
+
+:end
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/180 ActionScript 3 - AIR Flex 4 Projector/bat/SetupApp.bat.template b/External/Extensions/AS3Templates/$(BaseDir)/Projects/180 ActionScript 3 - AIR Flex 4 Projector/bat/SetupApp.bat.template
new file mode 100644
index 0000000000..afe57569cc
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/180 ActionScript 3 - AIR Flex 4 Projector/bat/SetupApp.bat.template
@@ -0,0 +1,47 @@
+:: Set working dir
+cd %~dp0 & cd ..
+
+:user_configuration
+
+:: About AIR application packaging
+:: http://livedocs.adobe.com/flex/3/html/help.html?content=CommandLineTools_5.html#1035959
+:: http://livedocs.adobe.com/flex/3/html/distributing_apps_4.html#1037515
+
+:: NOTICE: all paths are relative to project root
+
+:: Your certificate information
+set CERT_NAME="$(PROJECTNAME)"
+set CERT_PASS=fd
+set CERT_FILE="bat\$(PROJECTID).p12"
+set SIGNING_OPTIONS=-storetype pkcs12 -keystore %CERT_FILE% -storepass %CERT_PASS%
+
+:: Application descriptor
+set APP_XML=application.xml
+
+:: Files to package
+set APP_DIR=bin
+set FILE_OR_DIR=-C %APP_DIR% .
+
+:: Your application ID (must match of Application descriptor) and remove spaces
+for /f "tokens=3 delims=<>" %%a in ('findstr /R /C:"^[ ]*" %APP_XML%') do set APP_ID=%%a
+set APP_ID=%APP_ID: =%
+
+:: Output
+set AIR_PATH=air
+set AIR_NAME=$(PROJECTID)
+
+:validation
+findstr /C:"%APP_ID% " "%APP_XML%" > NUL
+if errorlevel 1 goto badid
+goto end
+
+:badid
+echo.
+echo ERROR:
+echo Application ID in 'bat\SetupApp.bat' (APP_ID)
+echo does NOT match Application descriptor '%APP_XML%' (id)
+echo.
+if %PAUSE_ERRORS%==1 pause
+exit
+
+:end
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/180 ActionScript 3 - AIR Flex 4 Projector/bat/SetupSDK.bat.template b/External/Extensions/AS3Templates/$(BaseDir)/Projects/180 ActionScript 3 - AIR Flex 4 Projector/bat/SetupSDK.bat.template
new file mode 100644
index 0000000000..55942b9136
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/180 ActionScript 3 - AIR Flex 4 Projector/bat/SetupSDK.bat.template
@@ -0,0 +1,26 @@
+:: Set working dir
+cd %~dp0 & cd ..
+
+:user_configuration
+
+:: Static path to Flex SDK
+set FLEX_SDK=$(FlexSDK)
+
+:: Use FD supplied SDK path if executed from FD
+if exist "%FD_CUR_SDK%" set FLEX_SDK=%FD_CUR_SDK%
+
+:validation
+if not exist "%FLEX_SDK%\bin" goto flexsdk
+goto succeed
+
+:flexsdk
+echo.
+echo ERROR: incorrect path to Flex SDK in 'bat\SetupSDK.bat'
+echo.
+echo Looking for: %FLEX_SDK%\bin
+echo.
+if %PAUSE_ERRORS%==1 pause
+exit
+
+:succeed
+set PATH=%FLEX_SDK%\bin;%PATH%
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/180 ActionScript 3 - AIR Flex 4 Projector/bin/.empty b/External/Extensions/AS3Templates/$(BaseDir)/Projects/180 ActionScript 3 - AIR Flex 4 Projector/bin/.empty
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/180 ActionScript 3 - AIR Flex 4 Projector/src/$(PackagePath)/Main.mxml b/External/Extensions/AS3Templates/$(BaseDir)/Projects/180 ActionScript 3 - AIR Flex 4 Projector/src/$(PackagePath)/Main.mxml
new file mode 100644
index 0000000000..b1a0a9c28c
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/180 ActionScript 3 - AIR Flex 4 Projector/src/$(PackagePath)/Main.mxml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/AIR_Android_readme.txt b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/AIR_Android_readme.txt
new file mode 100644
index 0000000000..3a50c8cc03
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/AIR_Android_readme.txt
@@ -0,0 +1,48 @@
+AIR for Android instructions
+
+1. Configuration:
+
+ - edit 'bat\SetupSDK.bat' for paths to Flex SDK and Android SDK (defaults should be ok)
+
+ - install your device's USB drivers:
+ http://developer.android.com/sdk/oem-usb.html
+ - enable "USB debugging" on your Android device:
+ Parameters > Applications > Development > USB Debugging
+
+
+2. Creating a self-signed certificate:
+
+ - run 'bat\CreateCertificate.bat' to generate your self-signed certificate,
+
+ (!) wait a minute before packaging.
+
+
+3. Build from FlashDevelop as usual (F8)
+
+
+4. Run/debug the application on the desktop as usual (F5 or Ctrl+Enter)
+
+
+5. Install AIR runtime on your device:
+
+ - run 'bat\InstallAirRuntime.bat'
+
+
+6. Running/debugging the application on the device:
+
+ 6.a. Build/Debug directly on device
+ - edit 'bat\RunApp.bat' and change the run target 'goto desktop' by 'goto android-debug'
+ - build & run as usual (Ctrl+Enter or F5) to package, install & run the application on your device
+
+ 6.b. Debug occasionally on device
+ - Debug-build from FlashDevelop (F8)
+ - run 'bat\PackageApp.bat' to package and install a debug version of the application
+ - start FlashDevelop debugger: Debug > Start Remote Session
+ - start the application on device
+ - the application should connect to FlashDevelop interactive debugger as usual
+
+
+7. Packaging for release:
+
+ - Release-build from FlashDevelop (F8)
+ - run 'bat\PackageApp.bat' and select Android/normal target
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/AIR_iOS_readme.txt b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/AIR_iOS_readme.txt
new file mode 100644
index 0000000000..02d430c7fa
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/AIR_iOS_readme.txt
@@ -0,0 +1,75 @@
+AIR for iOS instructions
+
+1. Configuration:
+
+ - edit 'bat\SetupSDK.bat' for path to Flex SDK (defaults should be ok)
+
+3. Build from FlashDevelop as usual (F8)
+
+4. Run/debug the application on the desktop as usual (F5 or Ctrl+Enter)
+
+5. Configure for iOS packaging in 'bat\SetupApp.bat':
+
+ Take a deep breath, pay the Apple tax and read extra carefully this tutorial:
+ - http://www.codeandvisual.com/2011/exporting-for-iphone-using-air-27-and-flashdevelop-part-three-generating-developer-certificates-provisioning-profiles-and-p12-files/
+
+ Now this is how to create the p12 key entirely on Windows (steps 1. to 8.):
+ - http://connorullmann.com/2011/04/air-2-6-and-ios/
+
+ Then for each project you'll have to go to on Apple's iOS Provisioning Portal:
+ - create a new App ID with: name of the project and ID indicated in 'application.xml',
+ - create a new Provisioning Profile: select App ID & registered devices that will be allowed to install the app.
+
+ Once you have obtained a .p12 and .mobileprovision file from Apple's Provisioning Portal:
+ - save a copy of your .p12 and .mobileprovision certificates in the 'cert\' folder in your FlashDevelop project.
+ (make sure to keep an extra copy of these 2 files in a safe place)
+
+ Finally edit 'bat\SetupApp.bat' and complete the following lines:
+
+ - IOS_DEV_CERT_FILE: path to your iOS developer 'p12' key ('cert\' folder, if you have followed the instructions above)
+ - IOS_DEV_CERT_PASS: developer certificate's password
+ if you don't set it, remove "-storepass %IOS_DEV_CERT_PASS%" from the IOS_SIGNING_OPTIONS,
+ you'll be prompted to type it when packaging.
+ - IOS_PROVISION: path to the project's Provisioning Profile file
+
+ For example:
+
+ set IOS_DIST_CERT_FILE=cert\iphone_dev.p12
+ set IOS_DEV_CERT_FILE=cert\iphone_dev.p12
+ set IOS_DEV_CERT_PASS=YourPassword
+ set IOS_PROVISION=cert\YourFileName.mobileprovision
+
+
+6. Running/debugging the application on the device:
+
+ Note: if are testing your application for performance, always package for release (see step 7.)
+
+ 6.a. Build/Debug on device
+ - edit 'bat\RunApp.bat' and change the run target 'goto desktop' by 'goto ios-debug'
+ - build as usual (Ctrl+Enter or F5) to package
+ - you'll still have to manually upload & run the app on the device
+ - the application should connect to FlashDevelop interactive debugger as usual
+
+ 6.b. Debug occasionally on device
+ - Debug-build from FlashDevelop (F8)
+ - run 'bat\PackageApp.bat' to package and install a debug version of the application
+ - start FlashDevelop debugger: Debug > Start Remote Session
+ - start the application on device
+ - the application should connect to FlashDevelop interactive debugger as usual
+
+
+7. Packaging for release:
+
+ - edit 'bat\SetupApp.bat' to add the path to your "distribution" certificate (IOS_DIST_CERT_FILE)
+ Note: you can package ad-hoc IPAs using your developer certificate.
+
+ - Release-build from FlashDevelop (F8)
+ - run 'bat\PackageApp.bat' and select
+ either iOS/"ad-hoc" for installation on test devices
+ or iOS/App Store for upload in the iOS App Store.
+
+Tips:
+- iFunBox: iTunes replacement; installs app faster even if app version doesn't change,
+- TestFlightApp: ad-hoc distribution service http://testflightapp.com
+- HockeyKit: self hosted ad-hoc distribution https://github.com/TheRealKerni/HockeyKit
+- Manual ad-hoc distribution: http://samvermette.com/71
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/Project.as3proj b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/Project.as3proj
new file mode 100644
index 0000000000..c36ebd068d
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/Project.as3proj
@@ -0,0 +1,78 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/Project.png b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/Project.png
new file mode 100644
index 0000000000..bd84420d38
Binary files /dev/null and b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/Project.png differ
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/Project.txt b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/Project.txt
new file mode 100644
index 0000000000..5fa873d1c2
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/Project.txt
@@ -0,0 +1 @@
+An AIR mobile app written in ActionScript 3
\ No newline at end of file
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/application.xml.template b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/application.xml.template
new file mode 100644
index 0000000000..21d8a8f3ad
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/application.xml.template
@@ -0,0 +1,85 @@
+
+
+
+ air.$(PACKAGEDOT)$(PROJECTID)
+ 0.1
+ mobileDevice
+ $(PROJECTID)
+
+ $(PROJECTNAME)
+
+
+
+
+
+
+
+
+
+
+ ]]>
+
+
+ UIStatusBarStyle
+ UIStatusBarStyleBlackOpaque
+ UIRequiresPersistentWiFi
+ NO
+ UIPrerenderedIcon
+
+ UIApplicationExitsOnSuspend
+
+
+ UIDeviceFamily
+
+
+ 1
+
+
+
+
+ ]]>
+ high
+
+
+
+ $(PROJECTNAME)
+ $(PROJECTID).swf
+ true
+ true
+
+
+ direct
+
+
+
+
+ icons/icon_48.png
+ icons/icon_57.png
+ icons/icon_72.png
+ icons/icon_76.png
+ icons/icon_96.png
+ icons/icon_114.png
+ icons/icon_120.png
+ icons/icon_144.png
+ icons/icon_152.png
+
+
+
+
+
\ No newline at end of file
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/bat/CreateCertificate.bat b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/bat/CreateCertificate.bat
new file mode 100644
index 0000000000..d2808914b9
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/bat/CreateCertificate.bat
@@ -0,0 +1,34 @@
+@echo off
+
+:: Set working dir
+cd %~dp0 & cd ..
+
+set PAUSE_ERRORS=1
+call bat\SetupSDK.bat
+call bat\SetupApp.bat
+
+:: Generate
+echo.
+echo Generating a self-signed certificate for Android packaging
+call adt -certificate -validityPeriod 25 -cn %AND_CERT_NAME% 2048-RSA "%AND_CERT_FILE%" %AND_CERT_PASS%
+if errorlevel 1 goto failed
+
+:succeed
+echo.
+echo Certificate created: %AND_CERT_FILE% with password "%AND_CERT_PASS%"
+echo.
+if "%AND_CERT_PASS%" == "fd" echo Note: you did not change the default password
+echo.
+echo HINTS:
+echo - you only need to generate this certificate once,
+echo - wait a minute before using this certificate to package your AIR application.
+echo.
+goto end
+
+:failed
+echo.
+echo Certificate creation FAILED.
+echo.
+
+:end
+pause
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/bat/InstallAirRuntime.bat b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/bat/InstallAirRuntime.bat
new file mode 100644
index 0000000000..7e9e16f470
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/bat/InstallAirRuntime.bat
@@ -0,0 +1,31 @@
+@echo off
+
+:: Set working dir
+cd %~dp0 & cd ..
+
+set PAUSE_ERRORS=1
+call bat\SetupSDK.bat
+
+:: AIR runtime installer
+set AIR_INSTALLER=%FLEX_SDK%\runtimes\air\android\device\runtime.apk
+
+:: Install
+adb devices
+echo.
+echo Installing AIR runtime on current device:
+echo %AIR_INSTALLER%
+echo.
+adb install "%AIR_INSTALLER%"
+echo.
+if errorlevel 1 goto failed
+goto end
+
+:failed
+echo Troubleshooting:
+echo - one, and only one, Android device should be connected
+echo - verify 'bat\SetupSDK.bat'
+echo.
+goto end
+
+:end
+pause
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/bat/PackageApp.bat b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/bat/PackageApp.bat
new file mode 100644
index 0000000000..e9dc50ecd1
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/bat/PackageApp.bat
@@ -0,0 +1,87 @@
+@echo off
+
+:: Set working dir
+cd %~dp0 & cd ..
+
+set PAUSE_ERRORS=1
+call bat\SetupSDK.bat
+call bat\SetupApp.bat
+
+:menu
+echo.
+echo Package for target
+echo.
+echo Android:
+echo.
+echo [1] normal (apk)
+echo [2] debug (apk-debug)
+echo [3] captive (apk-captive-runtime)
+echo.
+echo iOS:
+echo.
+echo [4] fast test (ipa-test-interpreter)
+echo [5] fast debug (ipa-debug-interpreter)
+echo [6] slow test (ipa-test)
+echo [7] slow debug (ipa-debug)
+echo [8] "ad-hoc" (ipa-ad-hoc)
+echo [9] App Store (ipa-app-store)
+echo.
+
+:choice
+set /P C=[Choice]:
+echo.
+
+set PLATFORM=android
+set OPTIONS=
+if %C% GTR 3 set PLATFORM=ios
+if %C% GTR 7 set PLATFORM=ios-dist
+
+if "%C%"=="1" set TARGET=
+if "%C%"=="2" set TARGET=-debug
+if "%C%"=="2" set OPTIONS=-connect %DEBUG_IP%
+if "%C%"=="3" set TARGET=-captive-runtime
+
+if "%C%"=="4" set TARGET=-test-interpreter
+if "%C%"=="5" set TARGET=-debug-interpreter
+if "%C%"=="5" set OPTIONS=-connect %DEBUG_IP%
+if "%C%"=="6" set TARGET=-test
+if "%C%"=="7" set TARGET=-debug
+if "%C%"=="7" set OPTIONS=-connect %DEBUG_IP%
+if "%C%"=="8" set TARGET=-ad-hoc
+if "%C%"=="9" set TARGET=-app-store
+
+call bat\Packager.bat
+
+if "%PLATFORM%"=="android" goto android-package
+
+:ios-package
+if "%AUTO_INSTALL_IOS%" == "yes" goto ios-install
+echo Now manually install and start application on device
+echo.
+goto end
+
+:ios-install
+echo Installing application for testing on iOS (%DEBUG_IP%)
+echo.
+call adt -installApp -platform ios -package "%OUTPUT%"
+if errorlevel 1 goto installfail
+
+echo Now manually start application on device
+echo.
+goto end
+
+:android-package
+adb devices
+echo.
+echo Installing %OUTPUT% on the device...
+echo.
+adb -d install -r "%OUTPUT%"
+if errorlevel 1 goto installfail
+goto end
+
+:installfail
+echo.
+echo Installing the app on the device failed
+
+:end
+pause
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/bat/Packager.bat b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/bat/Packager.bat
new file mode 100644
index 0000000000..2c005b0034
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/bat/Packager.bat
@@ -0,0 +1,76 @@
+@echo off
+
+:: Set working dir
+cd %~dp0 & cd ..
+
+if "%PLATFORM%"=="android" goto android-config
+if "%PLATFORM%"=="ios" goto ios-config
+if "%PLATFORM%"=="ios-dist" goto ios-dist-config
+goto start
+
+:android-config
+set CERT_FILE=%AND_CERT_FILE%
+set SIGNING_OPTIONS=%AND_SIGNING_OPTIONS%
+set ICONS=%AND_ICONS%
+set DIST_EXT=apk
+set TYPE=apk
+goto start
+
+:ios-config
+set CERT_FILE=%IOS_DEV_CERT_FILE%
+set SIGNING_OPTIONS=%IOS_DEV_SIGNING_OPTIONS%
+set ICONS=%IOS_ICONS%
+set DIST_EXT=ipa
+set TYPE=ipa
+goto start
+:: Set working dir
+cd %~dp0 & cd ..
+
+:ios-dist-config
+set CERT_FILE=%IOS_DIST_CERT_FILE%
+set SIGNING_OPTIONS=%IOS_DIST_SIGNING_OPTIONS%
+set ICONS=%IOS_ICONS%
+set DIST_EXT=ipa
+set TYPE=ipa
+goto start
+
+:start
+if not exist "%CERT_FILE%" goto certificate
+:: Output file
+set FILE_OR_DIR=%FILE_OR_DIR% -C "%ICONS%" .
+if not exist "%DIST_PATH%" md "%DIST_PATH%"
+set OUTPUT=%DIST_PATH%\%DIST_NAME%%TARGET%.%DIST_EXT%
+:: Package
+echo Packaging: %OUTPUT%
+echo using certificate: %CERT_FILE%...
+echo.
+call adt -package -target %TYPE%%TARGET% %OPTIONS% %SIGNING_OPTIONS% "%OUTPUT%" "%APP_XML%" %FILE_OR_DIR%
+echo.
+if errorlevel 1 goto failed
+goto end
+
+:certificate
+echo Certificate not found: %CERT_FILE%
+echo.
+echo Android:
+echo - generate a default certificate using 'bat\CreateCertificate.bat'
+echo or configure a specific certificate in 'bat\SetupApp.bat'.
+echo.
+echo iOS:
+echo - configure your developer key and project's Provisioning Profile
+echo in 'bat\SetupApp.bat'.
+echo.
+if %PAUSE_ERRORS%==1 pause
+exit
+
+:failed
+echo APK setup creation FAILED.
+echo.
+echo Troubleshooting:
+echo - verify AIR SDK target version in %APP_XML%
+echo.
+if %PAUSE_ERRORS%==1 pause
+exit
+
+:end
+
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/bat/RunApp.bat b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/bat/RunApp.bat
new file mode 100644
index 0000000000..9a06a2115e
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/bat/RunApp.bat
@@ -0,0 +1,112 @@
+@echo off
+
+:: Set working dir
+cd %~dp0 & cd ..
+
+set PAUSE_ERRORS=1
+call bat\SetupSDK.bat
+call bat\SetupApp.bat
+
+:target
+goto desktop
+::goto android-debug
+::goto android-test
+set INTERPRETER=-interpreter
+::goto ios-debug
+::goto ios-test
+
+:desktop
+:: http://help.adobe.com/en_US/air/build/WSfffb011ac560372f-6fa6d7e0128cca93d31-8000.html
+
+set SCREEN_SIZE=NexusOne
+::set SCREEN_SIZE=iPhoneRetina
+
+:desktop-run
+echo.
+echo Starting AIR Debug Launcher with screen size '%SCREEN_SIZE%'
+echo.
+echo (hint: edit 'Run.bat' to test on device or change screen size)
+echo.
+adl -screensize %SCREEN_SIZE% "%APP_XML%" "%APP_DIR%"
+if errorlevel 1 goto end
+goto endNoPause
+
+:ios-debug
+echo.
+echo Packaging application for debugging on iOS %INTERPRETER%
+if "%INTERPRETER%" == "" echo (this will take a while)
+echo.
+set TARGET=-debug%INTERPRETER%
+set OPTIONS=-connect %DEBUG_IP%
+goto ios-package
+
+:ios-test
+echo.
+echo Packaging application for testing on iOS %INTERPRETER%
+if "%INTERPRETER%" == "" echo (this will take a while)
+echo.
+set TARGET=-test%INTERPRETER%
+set OPTIONS=
+goto ios-package
+
+:ios-package
+set PLATFORM=ios
+call bat\Packager.bat
+
+if "%AUTO_INSTALL_IOS%" == "yes" goto ios-install
+echo Now manually install and start application on device
+echo.
+goto end
+
+:ios-install
+echo Installing application for testing on iOS (%DEBUG_IP%)
+echo.
+call adt -installApp -platform ios -package "%OUTPUT%"
+if errorlevel 1 goto installfail
+
+echo Now manually start application on device
+echo.
+goto end
+
+:android-debug
+echo.
+echo Packaging and installing application for debugging on Android (%DEBUG_IP%)
+echo.
+set TARGET=-debug
+set OPTIONS=-connect %DEBUG_IP%
+goto android-package
+
+:android-test
+echo.
+echo Packaging and Installing application for testing on Android (%DEBUG_IP%)
+echo.
+set TARGET=
+set OPTIONS=
+goto android-package
+
+:android-package
+set PLATFORM=android
+call bat\Packager.bat
+
+adb devices
+echo.
+echo Installing %OUTPUT% on the device...
+echo.
+adb -d install -r "%OUTPUT%"
+if errorlevel 1 goto installfail
+
+echo.
+echo Starting application on the device for debugging...
+echo.
+adb shell am start -n air.%APP_ID%/.AppEntry
+exit
+
+:installfail
+echo.
+echo Installing the app on the device failed
+
+:end
+pause
+
+:endNoPause
+
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/bat/SetupApp.bat.template b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/bat/SetupApp.bat.template
new file mode 100644
index 0000000000..344a238091
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/bat/SetupApp.bat.template
@@ -0,0 +1,59 @@
+:: Set working dir
+cd %~dp0 & cd ..
+
+:user_configuration
+
+:: About AIR application packaging
+:: http://help.adobe.com/en_US/air/build/WS5b3ccc516d4fbf351e63e3d118666ade46-7fd9.html
+
+:: NOTICE: all paths are relative to project root
+
+:: Android packaging
+set AND_CERT_NAME="$(PROJECTNAME)"
+set AND_CERT_PASS=fd
+set AND_CERT_FILE=cert\$(PROJECTID).p12
+set AND_ICONS=icons/android
+
+set AND_SIGNING_OPTIONS=-storetype pkcs12 -keystore "%AND_CERT_FILE%" -storepass %AND_CERT_PASS%
+
+:: iOS packaging
+set IOS_DIST_CERT_FILE=
+set IOS_DEV_CERT_FILE=
+set IOS_DEV_CERT_PASS=
+set IOS_PROVISION=cert\$(PROJECTID).mobileprovision
+set IOS_ICONS=icons/ios
+
+set IOS_DEV_SIGNING_OPTIONS=-storetype pkcs12 -keystore "%IOS_DEV_CERT_FILE%" -storepass %IOS_DEV_CERT_PASS% -provisioning-profile %IOS_PROVISION%
+set IOS_DIST_SIGNING_OPTIONS=-storetype pkcs12 -keystore "%IOS_DIST_CERT_FILE%" -provisioning-profile %IOS_PROVISION%
+
+:: Application descriptor
+set APP_XML=application.xml
+
+:: Files to package
+set APP_DIR=bin
+set FILE_OR_DIR=-C %APP_DIR% .
+
+:: Your application ID (must match of Application descriptor) and remove spaces
+for /f "tokens=3 delims=<>" %%a in ('findstr /R /C:"^[ ]*" %APP_XML%') do set APP_ID=%%a
+set APP_ID=%APP_ID: =%
+
+:: Output packages
+set DIST_PATH=dist
+set DIST_NAME=$(PROJECTID)
+
+:: Debugging using a custom IP
+set DEBUG_IP=
+
+:validation
+findstr /C:"%APP_ID% " "%APP_XML%" > NUL
+if errorlevel 1 goto badid
+goto end
+
+:badid
+echo.
+echo ERROR:
+echo Application ID in 'bat\SetupApp.bat' (APP_ID)
+echo does NOT match Application descriptor '%APP_XML%' (id)
+echo.
+
+:end
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/bat/SetupSDK.bat.template b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/bat/SetupSDK.bat.template
new file mode 100644
index 0000000000..049596bcd5
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/bat/SetupSDK.bat.template
@@ -0,0 +1,42 @@
+:: Set working dir
+cd %~dp0 & cd ..
+
+:user_configuration
+
+:: Static path to Flex SDK
+set FLEX_SDK=$(FlexSDK)
+
+:: Use FD supplied SDK path if executed from FD
+if exist "%FD_CUR_SDK%" set FLEX_SDK=%FD_CUR_SDK%
+
+set AUTO_INSTALL_IOS=yes
+
+:: Path to Android SDK
+set ANDROID_SDK="%FLEX_SDK%\lib\android\bin"
+
+:validation
+if not exist "%FLEX_SDK%\bin" goto flexsdk
+if not exist "%ANDROID_SDK%" goto androidsdk
+goto succeed
+
+:flexsdk
+echo.
+echo ERROR: incorrect path to Flex SDK in 'bat\SetupSDK.bat'
+echo.
+echo Looking for: %FLEX_SDK%\bin
+echo.
+if %PAUSE_ERRORS%==1 pause
+exit
+
+:androidsdk
+echo.
+echo ERROR: incorrect path to Android SDK in 'bat\SetupSDK.bat'
+echo.
+echo Looking for: %ANDROID_SDK%\platform-tools
+echo.
+if %PAUSE_ERRORS%==1 pause
+exit
+
+:succeed
+set PATH=%FLEX_SDK%\bin;%PATH%
+set PATH=%PATH%;%ANDROID_SDK%
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/bin/.empty b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/bin/.empty
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/cert/.empty b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/cert/.empty
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/android/icons/icon_114.png b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/android/icons/icon_114.png
new file mode 100644
index 0000000000..5fa6290732
Binary files /dev/null and b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/android/icons/icon_114.png differ
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/android/icons/icon_120.png b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/android/icons/icon_120.png
new file mode 100644
index 0000000000..89b32b51ee
Binary files /dev/null and b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/android/icons/icon_120.png differ
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/android/icons/icon_144.png b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/android/icons/icon_144.png
new file mode 100644
index 0000000000..7a951f96ef
Binary files /dev/null and b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/android/icons/icon_144.png differ
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/android/icons/icon_152.png b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/android/icons/icon_152.png
new file mode 100644
index 0000000000..5112cae675
Binary files /dev/null and b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/android/icons/icon_152.png differ
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/android/icons/icon_192.png b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/android/icons/icon_192.png
new file mode 100644
index 0000000000..f4728d262d
Binary files /dev/null and b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/android/icons/icon_192.png differ
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/android/icons/icon_48.png b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/android/icons/icon_48.png
new file mode 100644
index 0000000000..41fde440a2
Binary files /dev/null and b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/android/icons/icon_48.png differ
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/android/icons/icon_57.png b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/android/icons/icon_57.png
new file mode 100644
index 0000000000..c1e5b2b97b
Binary files /dev/null and b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/android/icons/icon_57.png differ
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/android/icons/icon_72.png b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/android/icons/icon_72.png
new file mode 100644
index 0000000000..3f884a977e
Binary files /dev/null and b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/android/icons/icon_72.png differ
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/android/icons/icon_76.png b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/android/icons/icon_76.png
new file mode 100644
index 0000000000..5f5dc25b25
Binary files /dev/null and b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/android/icons/icon_76.png differ
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/android/icons/icon_96.png b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/android/icons/icon_96.png
new file mode 100644
index 0000000000..4bac47c0a1
Binary files /dev/null and b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/android/icons/icon_96.png differ
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/ios/Default-568h@2x.png b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/ios/Default-568h@2x.png
new file mode 100644
index 0000000000..a8c9bba5f5
Binary files /dev/null and b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/ios/Default-568h@2x.png differ
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/ios/Default-Landscape.png b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/ios/Default-Landscape.png
new file mode 100644
index 0000000000..5047b30cb0
Binary files /dev/null and b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/ios/Default-Landscape.png differ
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/ios/Default-Portrait.png b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/ios/Default-Portrait.png
new file mode 100644
index 0000000000..ec4faa2845
Binary files /dev/null and b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/ios/Default-Portrait.png differ
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/ios/Default.png b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/ios/Default.png
new file mode 100644
index 0000000000..2b7b4be337
Binary files /dev/null and b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/ios/Default.png differ
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/ios/Default@2x.png b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/ios/Default@2x.png
new file mode 100644
index 0000000000..45a5563bae
Binary files /dev/null and b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/ios/Default@2x.png differ
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/ios/icons/icon_114.png b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/ios/icons/icon_114.png
new file mode 100644
index 0000000000..5fa6290732
Binary files /dev/null and b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/ios/icons/icon_114.png differ
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/ios/icons/icon_120.png b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/ios/icons/icon_120.png
new file mode 100644
index 0000000000..89b32b51ee
Binary files /dev/null and b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/ios/icons/icon_120.png differ
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/ios/icons/icon_144.png b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/ios/icons/icon_144.png
new file mode 100644
index 0000000000..7a951f96ef
Binary files /dev/null and b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/ios/icons/icon_144.png differ
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/ios/icons/icon_152.png b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/ios/icons/icon_152.png
new file mode 100644
index 0000000000..5112cae675
Binary files /dev/null and b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/ios/icons/icon_152.png differ
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/ios/icons/icon_192.png b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/ios/icons/icon_192.png
new file mode 100644
index 0000000000..a177bd46d8
Binary files /dev/null and b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/ios/icons/icon_192.png differ
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/ios/icons/icon_48.png b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/ios/icons/icon_48.png
new file mode 100644
index 0000000000..41fde440a2
Binary files /dev/null and b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/ios/icons/icon_48.png differ
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/ios/icons/icon_512.png b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/ios/icons/icon_512.png
new file mode 100644
index 0000000000..5f9e4c7d53
Binary files /dev/null and b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/ios/icons/icon_512.png differ
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/ios/icons/icon_57.png b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/ios/icons/icon_57.png
new file mode 100644
index 0000000000..c1e5b2b97b
Binary files /dev/null and b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/ios/icons/icon_57.png differ
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/ios/icons/icon_72.png b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/ios/icons/icon_72.png
new file mode 100644
index 0000000000..3f884a977e
Binary files /dev/null and b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/ios/icons/icon_72.png differ
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/ios/icons/icon_76.png b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/ios/icons/icon_76.png
new file mode 100644
index 0000000000..5f5dc25b25
Binary files /dev/null and b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/ios/icons/icon_76.png differ
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/ios/icons/icon_96.png b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/ios/icons/icon_96.png
new file mode 100644
index 0000000000..4bac47c0a1
Binary files /dev/null and b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/icons/ios/icons/icon_96.png differ
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/src/$(PackagePath)/Main.as.template b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/src/$(PackagePath)/Main.as.template
new file mode 100644
index 0000000000..69d1444a31
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/190 ActionScript 3 - AIR Mobile AS3 App/src/$(PackagePath)/Main.as.template
@@ -0,0 +1,35 @@
+package $(PackageName)$(CSLB){
+ import flash.desktop.NativeApplication;
+ import flash.events.Event;
+ import flash.display.Sprite;
+ import flash.display.StageAlign;
+ import flash.display.StageScaleMode;
+ import flash.ui.Multitouch;
+ import flash.ui.MultitouchInputMode;
+
+ /**
+ $(CBI)* ...
+ $(CBI)* @author $(DefaultUser)
+ $(CBI)*/
+ public class Main extends Sprite $(CSLB){
+
+ public function Main() $(CSLB){
+ stage.scaleMode = StageScaleMode.NO_SCALE;
+ stage.align = StageAlign.TOP_LEFT;
+ stage.addEventListener(Event.DEACTIVATE, deactivate);
+
+ // touch or gesture?
+ Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;
+
+ // Entry point
+ // New to AIR? Please read *carefully* the readme.txt files!
+ }
+
+ private function deactivate(e:Event):void $(CSLB){
+ // make sure the app behaves well (or exits) when in background
+ //NativeApplication.nativeApplication.exit();
+ }
+
+ }
+
+}
\ No newline at end of file
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/AIR_Android_readme.txt b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/AIR_Android_readme.txt
new file mode 100644
index 0000000000..3a50c8cc03
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/AIR_Android_readme.txt
@@ -0,0 +1,48 @@
+AIR for Android instructions
+
+1. Configuration:
+
+ - edit 'bat\SetupSDK.bat' for paths to Flex SDK and Android SDK (defaults should be ok)
+
+ - install your device's USB drivers:
+ http://developer.android.com/sdk/oem-usb.html
+ - enable "USB debugging" on your Android device:
+ Parameters > Applications > Development > USB Debugging
+
+
+2. Creating a self-signed certificate:
+
+ - run 'bat\CreateCertificate.bat' to generate your self-signed certificate,
+
+ (!) wait a minute before packaging.
+
+
+3. Build from FlashDevelop as usual (F8)
+
+
+4. Run/debug the application on the desktop as usual (F5 or Ctrl+Enter)
+
+
+5. Install AIR runtime on your device:
+
+ - run 'bat\InstallAirRuntime.bat'
+
+
+6. Running/debugging the application on the device:
+
+ 6.a. Build/Debug directly on device
+ - edit 'bat\RunApp.bat' and change the run target 'goto desktop' by 'goto android-debug'
+ - build & run as usual (Ctrl+Enter or F5) to package, install & run the application on your device
+
+ 6.b. Debug occasionally on device
+ - Debug-build from FlashDevelop (F8)
+ - run 'bat\PackageApp.bat' to package and install a debug version of the application
+ - start FlashDevelop debugger: Debug > Start Remote Session
+ - start the application on device
+ - the application should connect to FlashDevelop interactive debugger as usual
+
+
+7. Packaging for release:
+
+ - Release-build from FlashDevelop (F8)
+ - run 'bat\PackageApp.bat' and select Android/normal target
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/AIR_iOS_readme.txt b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/AIR_iOS_readme.txt
new file mode 100644
index 0000000000..2749617db4
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/AIR_iOS_readme.txt
@@ -0,0 +1,82 @@
+AIR for iOS instructions
+
+1. Configuration:
+
+ - edit 'bat\SetupSDK.bat' for path to Flex SDK (defaults should be ok)
+
+
+3. Build from FlashDevelop as usual (F8)
+
+
+4. Run/debug the application on the desktop as usual (F5 or Ctrl+Enter)
+
+
+5. Configure for iOS packaging in 'bat\SetupApp.bat':
+
+ Take a deep breath, pay the Apple tax and read extra carefully this tutorial:
+ - http://www.codeandvisual.com/2011/exporting-for-iphone-using-air-27-and-flashdevelop-part-three-generating-developer-certificates-provisioning-profiles-and-p12-files/
+
+ Now this is how to create the p12 key entirely on Windows:
+ - http://blog.nngafook.com/2012/06/ios-certificate-process/
+
+ And later to sign the application for the App Store publication:
+ - http://blog.nngafook.com/2013/03/packaging-and-submitting-your-app-to-apple-on-windows-kind-of/
+
+ Then for each project you'll have to go to on Apple's iOS Provisioning Portal:
+ - create a new App ID with: name of the project and ID indicated in 'application.xml',
+ - create a new Provisioning Profile: select App ID & registered devices that will be allowed to install the app.
+
+ Once you have obtained a .p12 and .mobileprovision file from Apple's Provisioning Portal:
+ - save a copy of your .p12 and .mobileprovision certificates in the 'cert\' folder in your FlashDevelop project.
+ (make sure to keep an extra copy of these 2 files in a safe place)
+
+ Finally edit 'bat\SetupApp.bat' and complete the following lines:
+
+ - IOS_DEV_CERT_FILE: path to your iOS developer 'p12' key ('cert\' folder, if you have followed the instructions above)
+ - IOS_DEV_CERT_PASS: developer certificate's password
+ if you don't set it, remove "-storepass %IOS_DEV_CERT_PASS%" from the IOS_SIGNING_OPTIONS,
+ you'll be prompted to type it when packaging.
+ - IOS_PROVISION: path to the project's Provisioning Profile file
+
+ For example:
+
+ set IOS_DIST_CERT_FILE=cert\iphone_dev.p12
+ set IOS_DEV_CERT_FILE=cert\iphone_dev.p12
+ set IOS_DEV_CERT_PASS=YourPassword
+ set IOS_PROVISION=cert\YourFileName.mobileprovision
+
+
+6. Running/debugging the application on the device:
+
+ Note: if are testing your application for performance, always package for release (see step 7.)
+
+ 6.a. Build/Debug on device
+ - edit 'bat\RunApp.bat' and change the run target 'goto desktop' by 'goto ios-debug'
+ - build as usual (Ctrl+Enter or F5) to package
+ - you'll still have to manually upload & run the app on the device
+ - the application should connect to FlashDevelop interactive debugger as usual
+
+ 6.b. Debug occasionally on device
+ - Debug-build from FlashDevelop (F8)
+ - run 'bat\PackageApp.bat' to package and install a debug version of the application
+ - start FlashDevelop debugger: Debug > Start Remote Session
+ - start the application on device
+ - the application should connect to FlashDevelop interactive debugger as usual
+
+
+7. Packaging for release:
+
+ - edit in 'bat\SetupApp.bat' to add your "distribution" certificate (IOS_DIST_CERT_FILE)
+ Note: you can package ad-hoc IPAs using your developer certificate.
+
+ - Release-build from FlashDevelop (F8)
+ - run 'bat\PackageApp.bat' and select
+ either iOS/"ad-hoc" for installation on test devices
+ or iOS/App Store for upload in the iOS App Store.
+
+Tips:
+- iFunBox: iTunes replacement; installs app faster even if app version doesn't change,
+- TestFlightApp: ad-hoc distribution service http://testflightapp.com
+- HockeyKit: self hosted ad-hoc distribution https://github.com/TheRealKerni/HockeyKit
+- Manual ad-hoc distribution: http://samvermette.com/71
+
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/Project.as3proj b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/Project.as3proj
new file mode 100644
index 0000000000..28261c4442
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/Project.as3proj
@@ -0,0 +1,82 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/Project.png b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/Project.png
new file mode 100644
index 0000000000..bd84420d38
Binary files /dev/null and b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/Project.png differ
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/Project.txt b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/Project.txt
new file mode 100644
index 0000000000..c582302989
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/Project.txt
@@ -0,0 +1 @@
+An AIR mobile app written in ActionScript 3 using the Flex framework
\ No newline at end of file
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/application.xml.template b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/application.xml.template
new file mode 100644
index 0000000000..21a8986457
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/application.xml.template
@@ -0,0 +1,84 @@
+
+
+
+ air.$(PACKAGEDOT)$(PROJECTID)
+ 0.1
+ mobileDevice
+ $(PROJECTID)
+
+ $(PROJECTNAME)
+
+
+
+
+
+
+
+
+
+
+ ]]>
+
+
+ UIStatusBarStyle
+ UIStatusBarStyleBlackOpaque
+ UIRequiresPersistentWiFi
+ NO
+ UIPrerenderedIcon
+
+ UIApplicationExitsOnSuspend
+
+
+ UIDeviceFamily
+
+
+ 1
+
+
+
+
+ ]]>
+ high
+
+
+
+ $(PROJECTNAME)
+ $(PROJECTID).swf
+ true
+ true
+
+
+ direct
+
+
+
+ icons/icon_48.png
+ icons/icon_57.png
+ icons/icon_72.png
+ icons/icon_76.png
+ icons/icon_96.png
+ icons/icon_114.png
+ icons/icon_120.png
+ icons/icon_144.png
+ icons/icon_152.png
+
+
+
+
+
\ No newline at end of file
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/bat/CreateCertificate.bat b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/bat/CreateCertificate.bat
new file mode 100644
index 0000000000..3b3f27e3b0
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/bat/CreateCertificate.bat
@@ -0,0 +1,34 @@
+@echo off
+
+:: Set working dir
+cd %~dp0 & cd ..
+
+set PAUSE_ERRORS=1
+call bat\SetupSDK.bat
+call bat\SetupApp.bat
+
+:: Generate
+echo.
+echo Generating a self-signed certificate for Android packaging
+call adt -certificate -validityPeriod 25 -cn %AND_CERT_NAME% 2048-RSA "%AND_CERT_FILE%" %AND_CERT_PASS%
+if errorlevel 1 goto failed
+
+:succeed
+echo.
+echo Certificate created: %AND_CERT_FILE% with password "%AND_CERT_PASS%"
+echo.
+if "%AND_CERT_PASS%" == "fd" echo Note: You did not change the default password
+echo.
+echo HINTS:
+echo - you only need to generate this certificate once,
+echo - wait a minute before using this certificate to package your AIR application.
+echo.
+goto end
+
+:failed
+echo.
+echo Certificate creation FAILED.
+echo.
+
+:end
+pause
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/bat/InstallAirRuntime.bat b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/bat/InstallAirRuntime.bat
new file mode 100644
index 0000000000..7e9e16f470
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/bat/InstallAirRuntime.bat
@@ -0,0 +1,31 @@
+@echo off
+
+:: Set working dir
+cd %~dp0 & cd ..
+
+set PAUSE_ERRORS=1
+call bat\SetupSDK.bat
+
+:: AIR runtime installer
+set AIR_INSTALLER=%FLEX_SDK%\runtimes\air\android\device\runtime.apk
+
+:: Install
+adb devices
+echo.
+echo Installing AIR runtime on current device:
+echo %AIR_INSTALLER%
+echo.
+adb install "%AIR_INSTALLER%"
+echo.
+if errorlevel 1 goto failed
+goto end
+
+:failed
+echo Troubleshooting:
+echo - one, and only one, Android device should be connected
+echo - verify 'bat\SetupSDK.bat'
+echo.
+goto end
+
+:end
+pause
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/bat/PackageApp.bat b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/bat/PackageApp.bat
new file mode 100644
index 0000000000..e9dc50ecd1
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/bat/PackageApp.bat
@@ -0,0 +1,87 @@
+@echo off
+
+:: Set working dir
+cd %~dp0 & cd ..
+
+set PAUSE_ERRORS=1
+call bat\SetupSDK.bat
+call bat\SetupApp.bat
+
+:menu
+echo.
+echo Package for target
+echo.
+echo Android:
+echo.
+echo [1] normal (apk)
+echo [2] debug (apk-debug)
+echo [3] captive (apk-captive-runtime)
+echo.
+echo iOS:
+echo.
+echo [4] fast test (ipa-test-interpreter)
+echo [5] fast debug (ipa-debug-interpreter)
+echo [6] slow test (ipa-test)
+echo [7] slow debug (ipa-debug)
+echo [8] "ad-hoc" (ipa-ad-hoc)
+echo [9] App Store (ipa-app-store)
+echo.
+
+:choice
+set /P C=[Choice]:
+echo.
+
+set PLATFORM=android
+set OPTIONS=
+if %C% GTR 3 set PLATFORM=ios
+if %C% GTR 7 set PLATFORM=ios-dist
+
+if "%C%"=="1" set TARGET=
+if "%C%"=="2" set TARGET=-debug
+if "%C%"=="2" set OPTIONS=-connect %DEBUG_IP%
+if "%C%"=="3" set TARGET=-captive-runtime
+
+if "%C%"=="4" set TARGET=-test-interpreter
+if "%C%"=="5" set TARGET=-debug-interpreter
+if "%C%"=="5" set OPTIONS=-connect %DEBUG_IP%
+if "%C%"=="6" set TARGET=-test
+if "%C%"=="7" set TARGET=-debug
+if "%C%"=="7" set OPTIONS=-connect %DEBUG_IP%
+if "%C%"=="8" set TARGET=-ad-hoc
+if "%C%"=="9" set TARGET=-app-store
+
+call bat\Packager.bat
+
+if "%PLATFORM%"=="android" goto android-package
+
+:ios-package
+if "%AUTO_INSTALL_IOS%" == "yes" goto ios-install
+echo Now manually install and start application on device
+echo.
+goto end
+
+:ios-install
+echo Installing application for testing on iOS (%DEBUG_IP%)
+echo.
+call adt -installApp -platform ios -package "%OUTPUT%"
+if errorlevel 1 goto installfail
+
+echo Now manually start application on device
+echo.
+goto end
+
+:android-package
+adb devices
+echo.
+echo Installing %OUTPUT% on the device...
+echo.
+adb -d install -r "%OUTPUT%"
+if errorlevel 1 goto installfail
+goto end
+
+:installfail
+echo.
+echo Installing the app on the device failed
+
+:end
+pause
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/bat/Packager.bat b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/bat/Packager.bat
new file mode 100644
index 0000000000..6b96b0cc84
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/bat/Packager.bat
@@ -0,0 +1,75 @@
+@echo off
+
+:: Set working dir
+cd %~dp0 & cd ..
+
+if "%PLATFORM%"=="android" goto android-config
+if "%PLATFORM%"=="ios" goto ios-config
+if "%PLATFORM%"=="ios-dist" goto ios-dist-config
+goto start
+
+:android-config
+set CERT_FILE=%AND_CERT_FILE%
+set SIGNING_OPTIONS=%AND_SIGNING_OPTIONS%
+set ICONS=%AND_ICONS%
+set DIST_EXT=apk
+set TYPE=apk
+goto start
+
+:ios-config
+set CERT_FILE=%IOS_DEV_CERT_FILE%
+set SIGNING_OPTIONS=%IOS_DEV_SIGNING_OPTIONS%
+set ICONS=%IOS_ICONS%
+set DIST_EXT=ipa
+set TYPE=ipa
+goto start
+:: Set working dir
+cd %~dp0 & cd ..
+
+:ios-dist-config
+set CERT_FILE=%IOS_DIST_CERT_FILE%
+set SIGNING_OPTIONS=%IOS_DIST_SIGNING_OPTIONS%
+set ICONS=%IOS_ICONS%
+set DIST_EXT=ipa
+set TYPE=ipa
+goto start
+
+:start
+if not exist "%CERT_FILE%" goto certificate
+:: Output file
+set FILE_OR_DIR=%FILE_OR_DIR% -C "%ICONS%" .
+if not exist "%DIST_PATH%" md "%DIST_PATH%"
+set OUTPUT=%DIST_PATH%\%DIST_NAME%%TARGET%.%DIST_EXT%
+:: Package
+echo Packaging: %OUTPUT%
+echo using certificate: %CERT_FILE%...
+echo.
+call adt -package -target %TYPE%%TARGET% %OPTIONS% %SIGNING_OPTIONS% "%OUTPUT%" "%APP_XML%" %FILE_OR_DIR%
+echo.
+if errorlevel 1 goto failed
+goto end
+
+:certificate
+echo Certificate not found: %CERT_FILE%
+echo.
+echo Android:
+echo - generate a default certificate using 'bat\CreateCertificate.bat'
+echo or configure a specific certificate in 'bat\SetupApp.bat'.
+echo.
+echo iOS:
+echo - configure your developer key and project's Provisioning Profile
+echo in 'bat\SetupApp.bat'.
+echo.
+if %PAUSE_ERRORS%==1 pause
+exit
+
+:failed
+echo APK setup creation FAILED.
+echo.
+echo Troubleshooting:
+echo - verify AIR SDK target version in %APP_XML%
+echo.
+if %PAUSE_ERRORS%==1 pause
+exit
+
+:end
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/bat/RunApp.bat b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/bat/RunApp.bat
new file mode 100644
index 0000000000..c621e41e79
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/bat/RunApp.bat
@@ -0,0 +1,112 @@
+@echo off
+
+:: Set working dir
+cd %~dp0 & cd ..
+
+set PAUSE_ERRORS=1
+call bat\SetupSDK.bat
+call bat\SetupApp.bat
+
+:target
+goto desktop
+::goto android-debug
+::goto android-test
+set INTERPRETER=-interpreter
+::goto ios-debug
+::goto ios-test
+
+:desktop
+:: http://help.adobe.com/en_US/air/build/WSfffb011ac560372f-6fa6d7e0128cca93d31-8000.html
+
+set SCREEN_SIZE=NexusOne
+::set SCREEN_SIZE=iPhoneRetina
+
+:desktop-run
+echo.
+echo Starting AIR Debug Launcher with screen size '%SCREEN_SIZE%'
+echo.
+echo (hint: edit 'bat\RunApp.bat' to test on device or change screen size)
+echo.
+adl -screensize %SCREEN_SIZE% "%APP_XML%" "%APP_DIR%"
+if errorlevel 1 goto end
+goto endNoPause
+
+:ios-debug
+echo.
+echo Packaging application for debugging on iOS %INTERPRETER%
+if "%INTERPRETER%" == "" echo (this will take a while)
+echo.
+set TARGET=-debug%INTERPRETER%
+set OPTIONS=-connect %DEBUG_IP%
+goto ios-package
+
+:ios-test
+echo.
+echo Packaging application for testing on iOS %INTERPRETER%
+if "%INTERPRETER%" == "" echo (this will take a while)
+echo.
+set TARGET=-test%INTERPRETER%
+set OPTIONS=
+goto ios-package
+
+:ios-package
+set PLATFORM=ios
+call bat\Packager.bat
+
+if "%AUTO_INSTALL_IOS%" == "yes" goto ios-install
+echo Now manually install and start application on device
+echo.
+goto end
+
+:ios-install
+echo Installing application for testing on iOS (%DEBUG_IP%)
+echo.
+call adt -installApp -platform ios -package "%OUTPUT%"
+if errorlevel 1 goto installfail
+
+echo Now manually start application on device
+echo.
+goto end
+
+:android-debug
+echo.
+echo Packaging and installing application for debugging on Android (%DEBUG_IP%)
+echo.
+set TARGET=-debug
+set OPTIONS=-connect %DEBUG_IP%
+goto android-package
+
+:android-test
+echo.
+echo Packaging and Installing application for testing on Android (%DEBUG_IP%)
+echo.
+set TARGET=
+set OPTIONS=
+goto android-package
+
+:android-package
+set PLATFORM=android
+call bat\Packager.bat
+
+adb devices
+echo.
+echo Installing %OUTPUT% on the device...
+echo.
+adb -d install -r "%OUTPUT%"
+if errorlevel 1 goto installfail
+
+echo.
+echo Starting application on the device for debugging...
+echo.
+adb shell am start -n air.%APP_ID%/.AppEntry
+exit
+
+:installfail
+echo.
+echo Installing the app on the device failed
+
+:end
+pause
+
+:endNoPause
+
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/bat/SetupApp.bat.template b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/bat/SetupApp.bat.template
new file mode 100644
index 0000000000..344a238091
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/bat/SetupApp.bat.template
@@ -0,0 +1,59 @@
+:: Set working dir
+cd %~dp0 & cd ..
+
+:user_configuration
+
+:: About AIR application packaging
+:: http://help.adobe.com/en_US/air/build/WS5b3ccc516d4fbf351e63e3d118666ade46-7fd9.html
+
+:: NOTICE: all paths are relative to project root
+
+:: Android packaging
+set AND_CERT_NAME="$(PROJECTNAME)"
+set AND_CERT_PASS=fd
+set AND_CERT_FILE=cert\$(PROJECTID).p12
+set AND_ICONS=icons/android
+
+set AND_SIGNING_OPTIONS=-storetype pkcs12 -keystore "%AND_CERT_FILE%" -storepass %AND_CERT_PASS%
+
+:: iOS packaging
+set IOS_DIST_CERT_FILE=
+set IOS_DEV_CERT_FILE=
+set IOS_DEV_CERT_PASS=
+set IOS_PROVISION=cert\$(PROJECTID).mobileprovision
+set IOS_ICONS=icons/ios
+
+set IOS_DEV_SIGNING_OPTIONS=-storetype pkcs12 -keystore "%IOS_DEV_CERT_FILE%" -storepass %IOS_DEV_CERT_PASS% -provisioning-profile %IOS_PROVISION%
+set IOS_DIST_SIGNING_OPTIONS=-storetype pkcs12 -keystore "%IOS_DIST_CERT_FILE%" -provisioning-profile %IOS_PROVISION%
+
+:: Application descriptor
+set APP_XML=application.xml
+
+:: Files to package
+set APP_DIR=bin
+set FILE_OR_DIR=-C %APP_DIR% .
+
+:: Your application ID (must match of Application descriptor) and remove spaces
+for /f "tokens=3 delims=<>" %%a in ('findstr /R /C:"^[ ]*" %APP_XML%') do set APP_ID=%%a
+set APP_ID=%APP_ID: =%
+
+:: Output packages
+set DIST_PATH=dist
+set DIST_NAME=$(PROJECTID)
+
+:: Debugging using a custom IP
+set DEBUG_IP=
+
+:validation
+findstr /C:"%APP_ID% " "%APP_XML%" > NUL
+if errorlevel 1 goto badid
+goto end
+
+:badid
+echo.
+echo ERROR:
+echo Application ID in 'bat\SetupApp.bat' (APP_ID)
+echo does NOT match Application descriptor '%APP_XML%' (id)
+echo.
+
+:end
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/bat/SetupSDK.bat.template b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/bat/SetupSDK.bat.template
new file mode 100644
index 0000000000..5e305dcfeb
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/bat/SetupSDK.bat.template
@@ -0,0 +1,42 @@
+:: Set working dir
+cd %~dp0 & cd ..
+
+:user_configuration
+
+:: Static path to Flex SDK
+set FLEX_SDK=$(FlexSDK)
+
+:: Use FD supplied SDK path if executed from FD
+if exist "%FD_CUR_SDK%" set FLEX_SDK=%FD_CUR_SDK%
+
+set AUTO_INSTALL_IOS=yes
+
+:: Path to Android SDK
+set ANDROID_SDK=$(AppDir)\Tools\android
+
+:validation
+if not exist "%FLEX_SDK%\bin" goto flexsdk
+if not exist "%ANDROID_SDK%\platform-tools" goto androidsdk
+goto succeed
+
+:flexsdk
+echo.
+echo ERROR: incorrect path to Flex SDK in 'bat\SetupSDK.bat'
+echo.
+echo Looking for: %FLEX_SDK%\bin
+echo.
+if %PAUSE_ERRORS%==1 pause
+exit
+
+:androidsdk
+echo.
+echo ERROR: incorrect path to Android SDK in 'bat\SetupSDK.bat'
+echo.
+echo Looking for: %ANDROID_SDK%\platform-tools
+echo.
+if %PAUSE_ERRORS%==1 pause
+exit
+
+:succeed
+set PATH=%FLEX_SDK%\bin;%PATH%
+set PATH=%PATH%;%ANDROID_SDK%\platform-tools
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/bin/.empty b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/bin/.empty
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/cert/.empty b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/cert/.empty
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/android/icons/icon_114.png b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/android/icons/icon_114.png
new file mode 100644
index 0000000000..5fa6290732
Binary files /dev/null and b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/android/icons/icon_114.png differ
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/android/icons/icon_120.png b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/android/icons/icon_120.png
new file mode 100644
index 0000000000..89b32b51ee
Binary files /dev/null and b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/android/icons/icon_120.png differ
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/android/icons/icon_144.png b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/android/icons/icon_144.png
new file mode 100644
index 0000000000..7a951f96ef
Binary files /dev/null and b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/android/icons/icon_144.png differ
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/android/icons/icon_152.png b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/android/icons/icon_152.png
new file mode 100644
index 0000000000..5112cae675
Binary files /dev/null and b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/android/icons/icon_152.png differ
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/android/icons/icon_192.png b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/android/icons/icon_192.png
new file mode 100644
index 0000000000..f4728d262d
Binary files /dev/null and b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/android/icons/icon_192.png differ
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/android/icons/icon_48.png b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/android/icons/icon_48.png
new file mode 100644
index 0000000000..41fde440a2
Binary files /dev/null and b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/android/icons/icon_48.png differ
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/android/icons/icon_57.png b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/android/icons/icon_57.png
new file mode 100644
index 0000000000..c1e5b2b97b
Binary files /dev/null and b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/android/icons/icon_57.png differ
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/android/icons/icon_72.png b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/android/icons/icon_72.png
new file mode 100644
index 0000000000..3f884a977e
Binary files /dev/null and b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/android/icons/icon_72.png differ
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/android/icons/icon_76.png b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/android/icons/icon_76.png
new file mode 100644
index 0000000000..5f5dc25b25
Binary files /dev/null and b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/android/icons/icon_76.png differ
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/android/icons/icon_96.png b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/android/icons/icon_96.png
new file mode 100644
index 0000000000..4bac47c0a1
Binary files /dev/null and b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/android/icons/icon_96.png differ
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/ios/Default-568h@2x.png b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/ios/Default-568h@2x.png
new file mode 100644
index 0000000000..a8c9bba5f5
Binary files /dev/null and b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/ios/Default-568h@2x.png differ
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/ios/Default-Landscape.png b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/ios/Default-Landscape.png
new file mode 100644
index 0000000000..5047b30cb0
Binary files /dev/null and b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/ios/Default-Landscape.png differ
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/ios/Default-Portrait.png b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/ios/Default-Portrait.png
new file mode 100644
index 0000000000..ec4faa2845
Binary files /dev/null and b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/ios/Default-Portrait.png differ
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/ios/Default.png b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/ios/Default.png
new file mode 100644
index 0000000000..2b7b4be337
Binary files /dev/null and b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/ios/Default.png differ
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/ios/Default@2x.png b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/ios/Default@2x.png
new file mode 100644
index 0000000000..45a5563bae
Binary files /dev/null and b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/ios/Default@2x.png differ
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/ios/icons/icon_114.png b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/ios/icons/icon_114.png
new file mode 100644
index 0000000000..5fa6290732
Binary files /dev/null and b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/ios/icons/icon_114.png differ
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/ios/icons/icon_120.png b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/ios/icons/icon_120.png
new file mode 100644
index 0000000000..89b32b51ee
Binary files /dev/null and b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/ios/icons/icon_120.png differ
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/ios/icons/icon_144.png b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/ios/icons/icon_144.png
new file mode 100644
index 0000000000..7a951f96ef
Binary files /dev/null and b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/ios/icons/icon_144.png differ
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/ios/icons/icon_152.png b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/ios/icons/icon_152.png
new file mode 100644
index 0000000000..5112cae675
Binary files /dev/null and b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/ios/icons/icon_152.png differ
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/ios/icons/icon_192.png b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/ios/icons/icon_192.png
new file mode 100644
index 0000000000..a177bd46d8
Binary files /dev/null and b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/ios/icons/icon_192.png differ
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/ios/icons/icon_48.png b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/ios/icons/icon_48.png
new file mode 100644
index 0000000000..41fde440a2
Binary files /dev/null and b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/ios/icons/icon_48.png differ
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/ios/icons/icon_512.png b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/ios/icons/icon_512.png
new file mode 100644
index 0000000000..5f9e4c7d53
Binary files /dev/null and b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/ios/icons/icon_512.png differ
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/ios/icons/icon_57.png b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/ios/icons/icon_57.png
new file mode 100644
index 0000000000..c1e5b2b97b
Binary files /dev/null and b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/ios/icons/icon_57.png differ
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/ios/icons/icon_72.png b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/ios/icons/icon_72.png
new file mode 100644
index 0000000000..3f884a977e
Binary files /dev/null and b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/ios/icons/icon_72.png differ
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/ios/icons/icon_76.png b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/ios/icons/icon_76.png
new file mode 100644
index 0000000000..5f5dc25b25
Binary files /dev/null and b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/ios/icons/icon_76.png differ
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/ios/icons/icon_96.png b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/ios/icons/icon_96.png
new file mode 100644
index 0000000000..4bac47c0a1
Binary files /dev/null and b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/icons/ios/icons/icon_96.png differ
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/src/$(PackagePath)/Main.mxml.template b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/src/$(PackagePath)/Main.mxml.template
new file mode 100644
index 0000000000..cc93a3a8cf
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/src/$(PackagePath)/Main.mxml.template
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/src/$(PackagePath)/views/HomeView.mxml b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/src/$(PackagePath)/views/HomeView.mxml
new file mode 100644
index 0000000000..977d37fe72
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/195 ActionScript 3 - AIR Mobile Flex App/src/$(PackagePath)/views/HomeView.mxml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/200 ActionScript 3 - Empty Project/Project.as3proj b/External/Extensions/AS3Templates/$(BaseDir)/Projects/200 ActionScript 3 - Empty Project/Project.as3proj
new file mode 100644
index 0000000000..1392f127d4
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/200 ActionScript 3 - Empty Project/Project.as3proj
@@ -0,0 +1,57 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/200 ActionScript 3 - Empty Project/Project.png b/External/Extensions/AS3Templates/$(BaseDir)/Projects/200 ActionScript 3 - Empty Project/Project.png
new file mode 100644
index 0000000000..3e703a61be
Binary files /dev/null and b/External/Extensions/AS3Templates/$(BaseDir)/Projects/200 ActionScript 3 - Empty Project/Project.png differ
diff --git a/External/Extensions/AS3Templates/$(BaseDir)/Projects/200 ActionScript 3 - Empty Project/Project.txt b/External/Extensions/AS3Templates/$(BaseDir)/Projects/200 ActionScript 3 - Empty Project/Project.txt
new file mode 100644
index 0000000000..12611f0d22
--- /dev/null
+++ b/External/Extensions/AS3Templates/$(BaseDir)/Projects/200 ActionScript 3 - Empty Project/Project.txt
@@ -0,0 +1 @@
+An empty project written in ActionScript 3 for Flash 9+ Player
\ No newline at end of file
diff --git a/External/Extensions/AS3Templates/AS3Templates-1.00.fdz b/External/Extensions/AS3Templates/AS3Templates-1.00.fdz
new file mode 100644
index 0000000000..db5ba08a44
Binary files /dev/null and b/External/Extensions/AS3Templates/AS3Templates-1.00.fdz differ
diff --git a/External/Extensions/AzothExtension/$(AppDir)/Tools/azoth/azoth.exe b/External/Extensions/AzothExtension/$(AppDir)/Tools/azoth/azoth.exe
old mode 100644
new mode 100755
diff --git a/External/Extensions/LoomExtension/$(BaseDir)/Plugins/LoomContext.dll b/External/Extensions/LoomExtension/$(BaseDir)/Plugins/LoomContext.dll
new file mode 100755
index 0000000000..47ef4a592d
Binary files /dev/null and b/External/Extensions/LoomExtension/$(BaseDir)/Plugins/LoomContext.dll differ
diff --git a/FlashDevelop/Bin/Debug/Projects/520 Other - Loom App/Project.lsproj b/External/Extensions/LoomExtension/$(BaseDir)/Projects/520 Other - Loom App/Project.lsproj
similarity index 100%
rename from FlashDevelop/Bin/Debug/Projects/520 Other - Loom App/Project.lsproj
rename to External/Extensions/LoomExtension/$(BaseDir)/Projects/520 Other - Loom App/Project.lsproj
diff --git a/FlashDevelop/Bin/Debug/Projects/520 Other - Loom App/Project.png b/External/Extensions/LoomExtension/$(BaseDir)/Projects/520 Other - Loom App/Project.png
similarity index 100%
rename from FlashDevelop/Bin/Debug/Projects/520 Other - Loom App/Project.png
rename to External/Extensions/LoomExtension/$(BaseDir)/Projects/520 Other - Loom App/Project.png
diff --git a/FlashDevelop/Bin/Debug/Projects/520 Other - Loom App/Project.txt b/External/Extensions/LoomExtension/$(BaseDir)/Projects/520 Other - Loom App/Project.txt
similarity index 100%
rename from FlashDevelop/Bin/Debug/Projects/520 Other - Loom App/Project.txt
rename to External/Extensions/LoomExtension/$(BaseDir)/Projects/520 Other - Loom App/Project.txt
diff --git a/FlashDevelop/Bin/Debug/Snippets/loom/boundaries/AccessorsMethods.fds b/External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/boundaries/AccessorsMethods.fds
similarity index 100%
rename from FlashDevelop/Bin/Debug/Snippets/loom/boundaries/AccessorsMethods.fds
rename to External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/boundaries/AccessorsMethods.fds
diff --git a/FlashDevelop/Bin/Debug/Snippets/loom/boundaries/EventHandlers.fds b/External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/boundaries/EventHandlers.fds
similarity index 100%
rename from FlashDevelop/Bin/Debug/Snippets/loom/boundaries/EventHandlers.fds
rename to External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/boundaries/EventHandlers.fds
diff --git a/FlashDevelop/Bin/Debug/Snippets/loom/boundaries/PrivateMethods.fds b/External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/boundaries/PrivateMethods.fds
similarity index 100%
rename from FlashDevelop/Bin/Debug/Snippets/loom/boundaries/PrivateMethods.fds
rename to External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/boundaries/PrivateMethods.fds
diff --git a/FlashDevelop/Bin/Debug/Snippets/loom/boundaries/PublicMethods.fds b/External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/boundaries/PublicMethods.fds
similarity index 100%
rename from FlashDevelop/Bin/Debug/Snippets/loom/boundaries/PublicMethods.fds
rename to External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/boundaries/PublicMethods.fds
diff --git a/FlashDevelop/Bin/Debug/Snippets/loom/boundaries/StaticMethods.fds b/External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/boundaries/StaticMethods.fds
similarity index 100%
rename from FlashDevelop/Bin/Debug/Snippets/loom/boundaries/StaticMethods.fds
rename to External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/boundaries/StaticMethods.fds
diff --git a/FlashDevelop/Bin/Debug/Snippets/loom/case.fds b/External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/case.fds
similarity index 100%
rename from FlashDevelop/Bin/Debug/Snippets/loom/case.fds
rename to External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/case.fds
diff --git a/FlashDevelop/Bin/Debug/Snippets/loom/catch.fds b/External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/catch.fds
similarity index 100%
rename from FlashDevelop/Bin/Debug/Snippets/loom/catch.fds
rename to External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/catch.fds
diff --git a/FlashDevelop/Bin/Debug/Snippets/loom/class.fds b/External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/class.fds
similarity index 100%
rename from FlashDevelop/Bin/Debug/Snippets/loom/class.fds
rename to External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/class.fds
diff --git a/FlashDevelop/Bin/Debug/Snippets/loom/do.fds b/External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/do.fds
similarity index 100%
rename from FlashDevelop/Bin/Debug/Snippets/loom/do.fds
rename to External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/do.fds
diff --git a/FlashDevelop/Bin/Debug/Snippets/loom/each.fds b/External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/each.fds
similarity index 100%
rename from FlashDevelop/Bin/Debug/Snippets/loom/each.fds
rename to External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/each.fds
diff --git a/FlashDevelop/Bin/Debug/Snippets/loom/else.fds b/External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/else.fds
similarity index 100%
rename from FlashDevelop/Bin/Debug/Snippets/loom/else.fds
rename to External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/else.fds
diff --git a/FlashDevelop/Bin/Debug/Snippets/loom/elseif.fds b/External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/elseif.fds
similarity index 100%
rename from FlashDevelop/Bin/Debug/Snippets/loom/elseif.fds
rename to External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/elseif.fds
diff --git a/FlashDevelop/Bin/Debug/Snippets/loom/finally.fds b/External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/finally.fds
similarity index 100%
rename from FlashDevelop/Bin/Debug/Snippets/loom/finally.fds
rename to External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/finally.fds
diff --git a/FlashDevelop/Bin/Debug/Snippets/loom/for.fds b/External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/for.fds
similarity index 100%
rename from FlashDevelop/Bin/Debug/Snippets/loom/for.fds
rename to External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/for.fds
diff --git a/FlashDevelop/Bin/Debug/Snippets/loom/foreach.fds b/External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/foreach.fds
similarity index 100%
rename from FlashDevelop/Bin/Debug/Snippets/loom/foreach.fds
rename to External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/foreach.fds
diff --git a/FlashDevelop/Bin/Debug/Snippets/loom/forin.fds b/External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/forin.fds
similarity index 100%
rename from FlashDevelop/Bin/Debug/Snippets/loom/forin.fds
rename to External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/forin.fds
diff --git a/FlashDevelop/Bin/Debug/Snippets/loom/function.fds b/External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/function.fds
similarity index 100%
rename from FlashDevelop/Bin/Debug/Snippets/loom/function.fds
rename to External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/function.fds
diff --git a/FlashDevelop/Bin/Debug/Snippets/loom/generators/AssignVariable.fds b/External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/generators/AssignVariable.fds
similarity index 100%
rename from FlashDevelop/Bin/Debug/Snippets/loom/generators/AssignVariable.fds
rename to External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/generators/AssignVariable.fds
diff --git a/FlashDevelop/Bin/Debug/Snippets/loom/generators/CallFunction.fds b/External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/generators/CallFunction.fds
similarity index 100%
rename from FlashDevelop/Bin/Debug/Snippets/loom/generators/CallFunction.fds
rename to External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/generators/CallFunction.fds
diff --git a/FlashDevelop/Bin/Debug/Snippets/loom/generators/Constant.fds b/External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/generators/Constant.fds
similarity index 100%
rename from FlashDevelop/Bin/Debug/Snippets/loom/generators/Constant.fds
rename to External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/generators/Constant.fds
diff --git a/FlashDevelop/Bin/Debug/Snippets/loom/generators/Constructor.fds b/External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/generators/Constructor.fds
similarity index 100%
rename from FlashDevelop/Bin/Debug/Snippets/loom/generators/Constructor.fds
rename to External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/generators/Constructor.fds
diff --git a/FlashDevelop/Bin/Debug/Snippets/loom/generators/Delegate.fds b/External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/generators/Delegate.fds
similarity index 100%
rename from FlashDevelop/Bin/Debug/Snippets/loom/generators/Delegate.fds
rename to External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/generators/Delegate.fds
diff --git a/FlashDevelop/Bin/Debug/Snippets/loom/generators/DelegateMethodsHeader.fds b/External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/generators/DelegateMethodsHeader.fds
similarity index 100%
rename from FlashDevelop/Bin/Debug/Snippets/loom/generators/DelegateMethodsHeader.fds
rename to External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/generators/DelegateMethodsHeader.fds
diff --git a/FlashDevelop/Bin/Debug/Snippets/loom/generators/EventHandler.fds b/External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/generators/EventHandler.fds
similarity index 100%
rename from FlashDevelop/Bin/Debug/Snippets/loom/generators/EventHandler.fds
rename to External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/generators/EventHandler.fds
diff --git a/FlashDevelop/Bin/Debug/Snippets/loom/generators/EventMetatag.fds b/External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/generators/EventMetatag.fds
similarity index 100%
rename from FlashDevelop/Bin/Debug/Snippets/loom/generators/EventMetatag.fds
rename to External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/generators/EventMetatag.fds
diff --git a/FlashDevelop/Bin/Debug/Snippets/loom/generators/FieldFromParameter.fds b/External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/generators/FieldFromParameter.fds
similarity index 100%
rename from FlashDevelop/Bin/Debug/Snippets/loom/generators/FieldFromParameter.fds
rename to External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/generators/FieldFromParameter.fds
diff --git a/FlashDevelop/Bin/Debug/Snippets/loom/generators/Function.fds b/External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/generators/Function.fds
similarity index 100%
rename from FlashDevelop/Bin/Debug/Snippets/loom/generators/Function.fds
rename to External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/generators/Function.fds
diff --git a/FlashDevelop/Bin/Debug/Snippets/loom/generators/FunctionParameter.fds b/External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/generators/FunctionParameter.fds
similarity index 100%
rename from FlashDevelop/Bin/Debug/Snippets/loom/generators/FunctionParameter.fds
rename to External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/generators/FunctionParameter.fds
diff --git a/FlashDevelop/Bin/Debug/Snippets/loom/generators/Getter.fds b/External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/generators/Getter.fds
similarity index 100%
rename from FlashDevelop/Bin/Debug/Snippets/loom/generators/Getter.fds
rename to External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/generators/Getter.fds
diff --git a/FlashDevelop/Bin/Debug/Snippets/loom/generators/IFunction.fds b/External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/generators/IFunction.fds
similarity index 100%
rename from FlashDevelop/Bin/Debug/Snippets/loom/generators/IFunction.fds
rename to External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/generators/IFunction.fds
diff --git a/FlashDevelop/Bin/Debug/Snippets/loom/generators/IGetter.fds b/External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/generators/IGetter.fds
similarity index 100%
rename from FlashDevelop/Bin/Debug/Snippets/loom/generators/IGetter.fds
rename to External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/generators/IGetter.fds
diff --git a/FlashDevelop/Bin/Debug/Snippets/loom/generators/ISetter.fds b/External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/generators/ISetter.fds
similarity index 100%
rename from FlashDevelop/Bin/Debug/Snippets/loom/generators/ISetter.fds
rename to External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/generators/ISetter.fds
diff --git a/FlashDevelop/Bin/Debug/Snippets/loom/generators/ImplementHeader.fds b/External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/generators/ImplementHeader.fds
similarity index 100%
rename from FlashDevelop/Bin/Debug/Snippets/loom/generators/ImplementHeader.fds
rename to External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/generators/ImplementHeader.fds
diff --git a/FlashDevelop/Bin/Debug/Snippets/loom/generators/MethodDeclaration.fds b/External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/generators/MethodDeclaration.fds
similarity index 100%
rename from FlashDevelop/Bin/Debug/Snippets/loom/generators/MethodDeclaration.fds
rename to External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/generators/MethodDeclaration.fds
diff --git a/FlashDevelop/Bin/Debug/Snippets/loom/generators/MethodOverride.fds b/External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/generators/MethodOverride.fds
similarity index 100%
rename from FlashDevelop/Bin/Debug/Snippets/loom/generators/MethodOverride.fds
rename to External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/generators/MethodOverride.fds
diff --git a/FlashDevelop/Bin/Debug/Snippets/loom/generators/Setter.fds b/External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/generators/Setter.fds
similarity index 100%
rename from FlashDevelop/Bin/Debug/Snippets/loom/generators/Setter.fds
rename to External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/generators/Setter.fds
diff --git a/FlashDevelop/Bin/Debug/Snippets/loom/generators/ToString.fds b/External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/generators/ToString.fds
similarity index 100%
rename from FlashDevelop/Bin/Debug/Snippets/loom/generators/ToString.fds
rename to External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/generators/ToString.fds
diff --git a/FlashDevelop/Bin/Debug/Snippets/loom/generators/Variable.fds b/External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/generators/Variable.fds
similarity index 100%
rename from FlashDevelop/Bin/Debug/Snippets/loom/generators/Variable.fds
rename to External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/generators/Variable.fds
diff --git a/FlashDevelop/Bin/Debug/Snippets/loom/get.fds b/External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/get.fds
similarity index 100%
rename from FlashDevelop/Bin/Debug/Snippets/loom/get.fds
rename to External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/get.fds
diff --git a/FlashDevelop/Bin/Debug/Snippets/loom/if.fds b/External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/if.fds
similarity index 100%
rename from FlashDevelop/Bin/Debug/Snippets/loom/if.fds
rename to External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/if.fds
diff --git a/FlashDevelop/Bin/Debug/Snippets/loom/region.fds b/External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/region.fds
similarity index 100%
rename from FlashDevelop/Bin/Debug/Snippets/loom/region.fds
rename to External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/region.fds
diff --git a/FlashDevelop/Bin/Debug/Snippets/loom/set.fds b/External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/set.fds
similarity index 100%
rename from FlashDevelop/Bin/Debug/Snippets/loom/set.fds
rename to External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/set.fds
diff --git a/FlashDevelop/Bin/Debug/Snippets/loom/surround/().fds b/External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/surround/().fds
similarity index 100%
rename from FlashDevelop/Bin/Debug/Snippets/loom/surround/().fds
rename to External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/surround/().fds
diff --git a/FlashDevelop/Bin/Debug/Snippets/loom/surround/do..while.fds b/External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/surround/do..while.fds
similarity index 100%
rename from FlashDevelop/Bin/Debug/Snippets/loom/surround/do..while.fds
rename to External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/surround/do..while.fds
diff --git a/FlashDevelop/Bin/Debug/Snippets/loom/surround/for..each.fds b/External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/surround/for..each.fds
similarity index 100%
rename from FlashDevelop/Bin/Debug/Snippets/loom/surround/for..each.fds
rename to External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/surround/for..each.fds
diff --git a/FlashDevelop/Bin/Debug/Snippets/loom/surround/for..in.fds b/External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/surround/for..in.fds
similarity index 100%
rename from FlashDevelop/Bin/Debug/Snippets/loom/surround/for..in.fds
rename to External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/surround/for..in.fds
diff --git a/FlashDevelop/Bin/Debug/Snippets/loom/surround/for.fds b/External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/surround/for.fds
similarity index 100%
rename from FlashDevelop/Bin/Debug/Snippets/loom/surround/for.fds
rename to External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/surround/for.fds
diff --git a/FlashDevelop/Bin/Debug/Snippets/loom/surround/if.fds b/External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/surround/if.fds
similarity index 100%
rename from FlashDevelop/Bin/Debug/Snippets/loom/surround/if.fds
rename to External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/surround/if.fds
diff --git a/FlashDevelop/Bin/Debug/Snippets/loom/surround/try..catch.fds b/External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/surround/try..catch.fds
similarity index 100%
rename from FlashDevelop/Bin/Debug/Snippets/loom/surround/try..catch.fds
rename to External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/surround/try..catch.fds
diff --git a/FlashDevelop/Bin/Debug/Snippets/loom/surround/while.fds b/External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/surround/while.fds
similarity index 100%
rename from FlashDevelop/Bin/Debug/Snippets/loom/surround/while.fds
rename to External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/surround/while.fds
diff --git a/FlashDevelop/Bin/Debug/Snippets/loom/switch.fds b/External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/switch.fds
similarity index 100%
rename from FlashDevelop/Bin/Debug/Snippets/loom/switch.fds
rename to External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/switch.fds
diff --git a/FlashDevelop/Bin/Debug/Snippets/loom/try.fds b/External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/try.fds
similarity index 100%
rename from FlashDevelop/Bin/Debug/Snippets/loom/try.fds
rename to External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/try.fds
diff --git a/FlashDevelop/Bin/Debug/Snippets/loom/while.fds b/External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/while.fds
similarity index 100%
rename from FlashDevelop/Bin/Debug/Snippets/loom/while.fds
rename to External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/while.fds
diff --git a/FlashDevelop/Bin/Debug/Snippets/loom/with.fds b/External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/with.fds
similarity index 100%
rename from FlashDevelop/Bin/Debug/Snippets/loom/with.fds
rename to External/Extensions/LoomExtension/$(BaseDir)/Snippets/loom/with.fds
diff --git a/FlashDevelop/Bin/Debug/Templates/ProjectFiles/LoomProject/Class.ls.fdt b/External/Extensions/LoomExtension/$(BaseDir)/Templates/ProjectFiles/LoomProject/Class.ls.fdt
similarity index 100%
rename from FlashDevelop/Bin/Debug/Templates/ProjectFiles/LoomProject/Class.ls.fdt
rename to External/Extensions/LoomExtension/$(BaseDir)/Templates/ProjectFiles/LoomProject/Class.ls.fdt
diff --git a/FlashDevelop/Bin/Debug/Templates/ProjectFiles/LoomProject/Class.ls.fdt.wizard b/External/Extensions/LoomExtension/$(BaseDir)/Templates/ProjectFiles/LoomProject/Class.ls.fdt.wizard
similarity index 100%
rename from FlashDevelop/Bin/Debug/Templates/ProjectFiles/LoomProject/Class.ls.fdt.wizard
rename to External/Extensions/LoomExtension/$(BaseDir)/Templates/ProjectFiles/LoomProject/Class.ls.fdt.wizard
diff --git a/FlashDevelop/Bin/Debug/Templates/ProjectFiles/LoomProject/Interface.ls.fdt b/External/Extensions/LoomExtension/$(BaseDir)/Templates/ProjectFiles/LoomProject/Interface.ls.fdt
similarity index 100%
rename from FlashDevelop/Bin/Debug/Templates/ProjectFiles/LoomProject/Interface.ls.fdt
rename to External/Extensions/LoomExtension/$(BaseDir)/Templates/ProjectFiles/LoomProject/Interface.ls.fdt
diff --git a/External/Extensions/LoomExtension/LoomContext-1.00.fdz b/External/Extensions/LoomExtension/LoomContext-1.00.fdz
new file mode 100644
index 0000000000..049727aea8
Binary files /dev/null and b/External/Extensions/LoomExtension/LoomContext-1.00.fdz differ
diff --git a/External/Extensions/Unity3DExtension/$(BaseDir)/Plugins/UnityContext.dll b/External/Extensions/Unity3DExtension/$(BaseDir)/Plugins/UnityContext.dll
old mode 100644
new mode 100755
diff --git a/External/Plugins/AS2Context/AS2Context.csproj b/External/Plugins/AS2Context/AS2Context.csproj
index 9f7a98ad9e..f057d414b4 100644
--- a/External/Plugins/AS2Context/AS2Context.csproj
+++ b/External/Plugins/AS2Context/AS2Context.csproj
@@ -1,118 +1,85 @@
-
-
- Debug
- AnyCPU
- 9.0.21022
- 2.0
- {74AD0487-CEF9-43FE-9283-BC6F79539ADE}
- Library
- Properties
- AS2Context
- AS2Context
-
-
-
-
- 3.5
-
-
- v3.5
-
- publish\
- true
- Disk
- false
- Foreground
- 7
- Days
- false
- false
- true
- 0
- 1.0.0.%2a
- false
- false
- true
-
-
- true
- full
- false
- ..\..\..\FlashDevelop\Bin\Debug\Plugins\
- DEBUG;TRACE
- prompt
- 4
-
-
- pdbonly
- true
- ..\..\..\FlashDevelop\Bin\Debug\Plugins\
- TRACE
- prompt
- 4
-
-
- x86
- ..\..\..\FlashDevelop\Bin\Debug\Plugins\
-
-
- x86
- ..\..\..\FlashDevelop\Bin\Debug\Plugins\
- TRACE
- true
-
-
-
-
-
-
-
-
-
-
-
- {61885F70-B4DC-4B44-852D-5D6D03F2A734}
- PluginCore
- False
-
-
- {4EBF2653-9654-4E40-880E-0046B3D6210E}
- ASCompletion
- False
-
-
-
-
-
-
-
-
-
- False
- Microsoft .NET Framework 4 %28x86 and x64%29
- true
-
-
- False
- .NET Framework 3.5 SP1 Client Profile
- false
-
-
- False
- .NET Framework 3.5 SP1
- false
-
-
- False
- Windows Installer 3.1
- true
-
-
+
+
+
+ Debug
+ AnyCPU
+ {74AD0487-CEF9-43FE-9283-BC6F79539ADE}
+ Library
+ Properties
+ AS2Context
+ AS2Context
+ net48
+ true
+ false
+ false
+ false
+ x64;x86;AnyCPU
+
+
+ true
+ full
+ false
+ ..\..\..\FlashDevelop\Bin\Debug\Plugins\
+ DEBUG;TRACE
+ prompt
+ 4
+ 9
+
+
+ none
+ true
+ ..\..\..\FlashDevelop\Bin\Debug\Plugins\
+ TRACE
+ prompt
+ 4
+ 9
+
+
+ x86
+ ..\..\..\FlashDevelop\Bin\Debug\Plugins\
+ DEBUG;TRACE
+ 9
+
+
+ x86
+ ..\..\..\FlashDevelop\Bin\Debug\Plugins\
+ TRACE
+ true
+ 9
+
+
+ true
+ ..\..\..\FlashDevelop\Bin\Debug\Plugins\
+ DEBUG;TRACE
+ full
+ x64
+ 9
+ prompt
+
+
+ ..\..\..\FlashDevelop\Bin\Debug\Plugins\
+ TRACE
+ true
+ x64
+ 9
+ prompt
+
+
+
+
+
+
+
+
+ {61885F70-B4DC-4B44-852D-5D6D03F2A734}
+ PluginCore
+ False
+
+
+ {4EBF2653-9654-4E40-880E-0046B3D6210E}
+ ASCompletion
+ False
+
+
\ No newline at end of file
diff --git a/External/Plugins/AS2Context/AS2Settings.cs b/External/Plugins/AS2Context/AS2Settings.cs
index e3db509435..78739653e4 100644
--- a/External/Plugins/AS2Context/AS2Settings.cs
+++ b/External/Plugins/AS2Context/AS2Settings.cs
@@ -27,8 +27,8 @@ public class AS2Settings : IContextSettings
[LocalizedCategory("ASCompletion.Category.Documentation"), LocalizedDescription("ASCompletion.Description.DocumentationCommandLine"), DefaultValue(DEFAULT_DOC_COMMAND)]
public string DocumentationCommandLine
{
- get { return documentationCommandLine; }
- set { documentationCommandLine = value; }
+ get => documentationCommandLine;
+ set => documentationCommandLine = value;
}
#endregion
@@ -69,7 +69,7 @@ public string DocumentationCommandLine
const bool DEFAULT_FIXPACKAGEAUTOMATICALLY = true;
protected bool checkSyntaxOnSave = DEFAULT_CHECKSYNTAX;
- private bool lazyClasspathExploration = DEFAULT_LAZYMODE;
+ bool lazyClasspathExploration = DEFAULT_LAZYMODE;
protected bool completionListAllTypes = DEFAULT_LISTALL;
protected bool completionShowQualifiedTypes = DEFAULT_QUALIFY;
protected bool completionEnabled = DEFAULT_COMPLETIONENABLED;
@@ -80,42 +80,30 @@ public string DocumentationCommandLine
protected InstalledSDK[] installedSDKs = null;
[Browsable(false)]
- public string LanguageId
- {
- get { return "AS2"; }
- }
+ public string LanguageId => "AS2";
[Browsable(false)]
- public string DefaultExtension
- {
- get { return ".as"; }
- }
+ public string DefaultExtension => ".as";
[Browsable(false)]
- public string CheckSyntaxRunning
- {
- get { return TextHelper.GetString("Info.MTASCRunning"); }
- }
+ public string CheckSyntaxRunning => TextHelper.GetString("Info.MTASCRunning");
[Browsable(false)]
- public string CheckSyntaxDone
- {
- get { return TextHelper.GetString("Info.MTASCDone"); }
- }
+ public string CheckSyntaxDone => TextHelper.GetString("Info.MTASCDone");
[DisplayName("Check Syntax On Save")]
[LocalizedCategory("ASCompletion.Category.Common"), LocalizedDescription("ASCompletion.Description.CheckSyntaxOnSave"), DefaultValue(DEFAULT_CHECKSYNTAX)]
public bool CheckSyntaxOnSave
{
- get { return checkSyntaxOnSave; }
- set { checkSyntaxOnSave = value; }
+ get => checkSyntaxOnSave;
+ set => checkSyntaxOnSave = value;
}
[DisplayName("User Classpath")]
[LocalizedCategory("ASCompletion.Category.Common"), LocalizedDescription("ASCompletion.Description.UserClasspath")]
public string[] UserClasspath
{
- get { return userClasspath; }
+ get => userClasspath;
set
{
userClasspath = value;
@@ -127,7 +115,7 @@ public string[] UserClasspath
[LocalizedCategory("ASCompletion.Category.Language"), LocalizedDescription("AS2Context.Description.MtascPath")]
public InstalledSDK[] InstalledSDKs
{
- get { return installedSDKs; }
+ get => installedSDKs;
set
{
installedSDKs = value;
@@ -137,9 +125,7 @@ public InstalledSDK[] InstalledSDKs
public InstalledSDK GetDefaultSDK()
{
- if (installedSDKs == null || installedSDKs.Length == 0)
- return InstalledSDK.INVALID_SDK;
-
+ if (installedSDKs.IsNullOrEmpty()) return InstalledSDK.INVALID_SDK;
foreach (InstalledSDK sdk in installedSDKs)
if (sdk.IsValid) return sdk;
return InstalledSDK.INVALID_SDK;
@@ -149,16 +135,16 @@ public InstalledSDK GetDefaultSDK()
[LocalizedCategory("ASCompletion.Category.Common"), LocalizedDescription("ASCompletion.Description.CompletionEnabled"), DefaultValue(DEFAULT_COMPLETIONENABLED)]
public bool CompletionEnabled
{
- get { return completionEnabled; }
- set { completionEnabled = value; }
+ get => completionEnabled;
+ set => completionEnabled = value;
}
[DisplayName("Generate Imports")]
[LocalizedCategory("ASCompletion.Category.Common"), LocalizedDescription("ASCompletion.Description.GenerateImports"), DefaultValue(DEFAULT_GENERATEIMPORTS)]
public bool GenerateImports
{
- get { return generateImports; }
- set { generateImports = value; }
+ get => generateImports;
+ set => generateImports = value;
}
///
@@ -168,8 +154,8 @@ public bool GenerateImports
[LocalizedCategory("ASCompletion.Category.Common"), LocalizedDescription("ASCompletion.Description.CompletionListAllTypes"), DefaultValue(DEFAULT_LISTALL)]
public bool CompletionListAllTypes
{
- get { return completionListAllTypes; }
- set { completionListAllTypes = value; }
+ get => completionListAllTypes;
+ set => completionListAllTypes = value;
}
///
@@ -179,8 +165,8 @@ public bool CompletionListAllTypes
[LocalizedCategory("ASCompletion.Category.Common"), LocalizedDescription("ASCompletion.Description.CompletionShowQualifiedTypes"), DefaultValue(DEFAULT_QUALIFY)]
public bool CompletionShowQualifiedTypes
{
- get { return completionShowQualifiedTypes; }
- set { completionShowQualifiedTypes = value; }
+ get => completionShowQualifiedTypes;
+ set => completionShowQualifiedTypes = value;
}
///
@@ -190,24 +176,24 @@ public bool CompletionShowQualifiedTypes
[LocalizedCategory("ASCompletion.Category.Common"), LocalizedDescription("ASCompletion.Description.LazyClasspathExploration"), DefaultValue(DEFAULT_LAZYMODE)]
public bool LazyClasspathExploration
{
- get { return lazyClasspathExploration; }
- set { lazyClasspathExploration = value; }
+ get => lazyClasspathExploration;
+ set => lazyClasspathExploration = value;
}
[DisplayName("Play After Build")]
[LocalizedCategory("ASCompletion.Category.Common"), LocalizedDescription("ASCompletion.Description.PlayAfterBuild"), DefaultValue(DEFAULT_PLAY)]
public bool PlayAfterBuild
{
- get { return playAfterBuild; }
- set { playAfterBuild = value; }
+ get => playAfterBuild;
+ set => playAfterBuild = value;
}
[DisplayName("Fix Package Automatically")]
[LocalizedCategory("ASCompletion.Category.Common"), LocalizedDescription("ASCompletion.Description.FixPackageAutomatically"), DefaultValue(DEFAULT_FIXPACKAGEAUTOMATICALLY)]
public bool FixPackageAutomatically
{
- get { return fixPackageAutomatically; }
- set { fixPackageAutomatically = value; }
+ get => fixPackageAutomatically;
+ set => fixPackageAutomatically = value;
}
#endregion
@@ -218,16 +204,16 @@ public bool FixPackageAutomatically
const int DEFAULT_FLASHVERSION = 9; // Flash CS3 has a specific FP9 support for AS2
const string DEFAULT_MTASCCHECKPARAMS = "-mx -wimp";
- private int flashVersion = 9;
- private string mmClassPath;
- private bool useMtascIntrinsic = DEFAULT_USEMTASC;
- private string mtascCheckParameters = DEFAULT_MTASCCHECKPARAMS;
+ int flashVersion = 9;
+ string mmClassPath;
+ bool useMtascIntrinsic = DEFAULT_USEMTASC;
+ string mtascCheckParameters = DEFAULT_MTASCCHECKPARAMS;
[DisplayName("Use MTASC Intrinsics")]
[LocalizedCategory("ASCompletion.Category.Language"), LocalizedDescription("AS2Context.Description.UseMtascIntrinsic"), DefaultValue(DEFAULT_USEMTASC)]
public bool UseMtascIntrinsic
{
- get { return useMtascIntrinsic; }
+ get => useMtascIntrinsic;
set
{
useMtascIntrinsic = value;
@@ -239,8 +225,8 @@ public bool UseMtascIntrinsic
[LocalizedCategory("ASCompletion.Category.Language"), LocalizedDescription("AS2Context.Description.MtascCheckParameters"), DefaultValue(DEFAULT_MTASCCHECKPARAMS)]
public string MtascCheckParameters
{
- get { return mtascCheckParameters; }
- set { mtascCheckParameters = value; }
+ get => mtascCheckParameters;
+ set => mtascCheckParameters = value;
}
[DisplayName("Flash IDE Classpath")]
@@ -248,7 +234,7 @@ public string MtascCheckParameters
[Editor(typeof(VistaFolderNameEditor), typeof(UITypeEditor))]
public string MMClassPath
{
- get { return mmClassPath; }
+ get => mmClassPath;
set {
if (value == mmClassPath) return;
mmClassPath = value;
@@ -260,7 +246,7 @@ public string MMClassPath
[LocalizedCategory("ASCompletion.Category.Language"), LocalizedDescription("AS2Context.Description.DefaultFlashVersion"), DefaultValue(DEFAULT_FLASHVERSION)]
public int DefaultFlashVersion
{
- get { return flashVersion; }
+ get => flashVersion;
set {
if (value == flashVersion) return;
if (value >= 6 && value <= 9)
@@ -274,9 +260,9 @@ public int DefaultFlashVersion
#endregion
[Browsable(false)]
- private void FireChanged()
- {
- if (OnClasspathChanged != null) OnClasspathChanged();
- }
+ void FireChanged() => OnClasspathChanged?.Invoke();
+
+ [Browsable(false)]
+ public string AddSpaceAfter { get; set; }
}
}
diff --git a/External/Plugins/AS2Context/Context.cs b/External/Plugins/AS2Context/Context.cs
index 164132efd7..16782d10c2 100644
--- a/External/Plugins/AS2Context/Context.cs
+++ b/External/Plugins/AS2Context/Context.cs
@@ -15,22 +15,22 @@
namespace AS2Context
{
///
- /// Actionscript2 context
+ /// ActionScript2 context
///
public class Context: ASContext
{
#region regular_expressions_definitions
- static readonly protected Regex re_CMD_BuildCommand =
+ protected static readonly Regex re_CMD_BuildCommand =
new Regex("@mtasc[\\s]+(?.*)", RegexOptions.Compiled | RegexOptions.Multiline);
- static readonly protected Regex re_SplitParams =
+ protected static readonly Regex re_SplitParams =
new Regex("[\\s](?\\-[A-z]+)", RegexOptions.Compiled | RegexOptions.Singleline);
- static protected readonly Regex re_level =
+ protected static readonly Regex re_level =
new Regex("^_level[0-9]+$", RegexOptions.Compiled | RegexOptions.Singleline);
- static protected readonly Regex re_token =
+ protected static readonly Regex re_token =
new Regex("^[a-z$_][a-z0-9$_]*$", RegexOptions.IgnoreCase | RegexOptions.Compiled);
- static protected readonly Regex re_package =
+ protected static readonly Regex re_package =
new Regex("^[a-z$_][a-z0-9$_.]*$", RegexOptions.IgnoreCase | RegexOptions.Compiled);
- static protected readonly Regex re_lastDot =
+ protected static readonly Regex re_lastDot =
new Regex("\\.[^<]", RegexOptions.RightToLeft | RegexOptions.Compiled);
#endregion
@@ -39,12 +39,12 @@ public class Context: ASContext
protected bool hasLevels = true;
protected string docType;
- private AS2Settings as2settings;
+ readonly AS2Settings as2settings;
public override IContextSettings Settings
{
- get { return settings; }
- set { settings = value; }
+ get => settings;
+ set => settings = value;
}
///
@@ -94,22 +94,19 @@ public Context(AS2Settings initSettings)
features.methodModifierDefault = Visibility.Public;
// keywords
+ features.ClassKey = "class";
+ features.InterfaceKey = "interface";
+ features.ExtendsKey = "extends";
+ features.ImplementsKey = "implements";
features.dot = ".";
features.voidKey = "Void";
features.objectKey = "Object";
features.booleanKey = "Boolean";
features.numberKey = "Number";
+ features.stringKey = "String";
features.arrayKey = "Array";
+ features.dynamicKey = "*";
features.importKey = "import";
- features.typesPreKeys = new string[] { "import", "new", "instanceof", "extends", "implements" };
- features.codeKeywords = new string[] {
- "var", "function", "new", "delete", "instanceof", "return", "break", "continue",
- "if", "else", "for", "in", "while", "do", "switch", "case", "default", "with",
- "null", "undefined", "true", "false", "try", "catch", "finally", "throw"
- };
- features.accessKeywords = new string[] { "override", "public", "private", "intrinsic", "static" };
- features.declKeywords = new string[] { "var", "function" };
- features.typesKeywords = new string[] { "import", "class", "interface" };
features.varKey = "var";
features.functionKey = "function";
features.getKey = "get";
@@ -119,9 +116,19 @@ public Context(AS2Settings initSettings)
features.publicKey = "public";
features.privateKey = "private";
features.intrinsicKey = "intrinsic";
-
+ features.ReturnKey = "return";
+ features.typesPreKeys = new[] { "import", "new", "instanceof", "extends", "implements" };
+ features.codeKeywords = new[] {
+ "var", "function", "new", "delete", "instanceof", "return", "break", "continue",
+ "if", "else", "for", "in", "while", "do", "switch", "case", "default", "with",
+ "null", "undefined", "true", "false", "try", "catch", "finally", "throw"
+ };
+ features.accessKeywords = new[] { "override", "public", "private", "intrinsic", "static" };
+ features.declKeywords = new[] { "var", "function" };
+ features.typesKeywords = new[] { "import", "class", "interface" };
features.functionArguments = new MemberModel("arguments", "FunctionArguments", FlagType.Variable | FlagType.LocalVar, 0);
-
+ features.ArithmeticOperators = new HashSet { '+', '-', '*', '/' };
+ features.IncrementDecrementOperators = new[] {"++", "--"};
/* INITIALIZATION */
settings = initSettings;
@@ -131,20 +138,19 @@ public Context(AS2Settings initSettings)
#region classpath management
///
- /// Classpathes & classes cache initialisation
+ /// Classpathes & classes cache initialization
///
public override void BuildClassPath()
{
ReleaseClasspath();
started = true;
- if (as2settings == null) throw new Exception("BuildClassPath() must be overridden");
- if (contextSetup == null)
+ if (as2settings is null) throw new Exception("BuildClassPath() must be overridden");
+ contextSetup ??= new ContextSetupInfos
{
- contextSetup = new ContextSetupInfos();
- contextSetup.Lang = settings.LanguageId;
- contextSetup.Platform = "Flash Player";
- contextSetup.Version = as2settings.DefaultFlashVersion + ".0";
- }
+ Lang = settings.LanguageId,
+ Platform = "Flash Player",
+ Version = as2settings.DefaultFlashVersion + ".0"
+ };
// external version definition
platform = contextSetup.Platform;
@@ -158,14 +164,13 @@ public override void BuildClassPath()
classPath = new List();
// MTASC
- string mtascPath = PluginBase.CurrentProject != null
+ var mtascPath = PluginBase.CurrentProject != null
? PluginBase.CurrentProject.CurrentSDK
: PathHelper.ResolvePath(as2settings.GetDefaultSDK().Path);
if (Path.GetExtension(mtascPath) != "") mtascPath = Path.GetDirectoryName(mtascPath);
string path;
- if ((as2settings.UseMtascIntrinsic || String.IsNullOrEmpty(as2settings.MMClassPath))
- && !String.IsNullOrEmpty(mtascPath) && Directory.Exists(mtascPath))
+ if ((as2settings.UseMtascIntrinsic || string.IsNullOrEmpty(as2settings.MMClassPath)) && Directory.Exists(mtascPath))
{
try
{
@@ -186,7 +191,7 @@ public override void BuildClassPath()
catch {}
}
// Macromedia/Adobe
- if (!String.IsNullOrEmpty(as2settings.MMClassPath) && Directory.Exists(as2settings.MMClassPath))
+ if (Directory.Exists(as2settings.MMClassPath))
{
if (classPath.Count == 0)
{
@@ -204,30 +209,30 @@ public override void BuildClassPath()
if (Directory.Exists(path))
{
PathModel aPath = new PathModel(path, this);
- ManualExploration(aPath, new string[] { "aso", "FP7", "FP8", "FP9" });
+ ManualExploration(aPath, new[] { "aso", "FP7", "FP8", "FP9" });
AddPath(aPath);
}
}
}
// add external pathes
- List initCP = classPath;
+ var initCP = classPath;
classPath = new List();
if (contextSetup.Classpath != null)
{
- foreach (string cpath in contextSetup.Classpath)
+ foreach (var cpath in contextSetup.Classpath)
AddPath(cpath.Trim());
}
// add library
AddPath(Path.Combine(PathHelper.LibraryDir, "AS2/classes"));
// add user pathes from settings
- if (settings.UserClasspath != null && settings.UserClasspath.Length > 0)
+ if (!settings.UserClasspath.IsNullOrEmpty())
{
- foreach(string cpath in settings.UserClasspath) AddPath(cpath.Trim());
+ foreach(var cpath in settings.UserClasspath) AddPath(cpath.Trim());
}
// add initial pathes
- foreach(PathModel mpath in initCP) AddPath(mpath);
+ foreach(var mpath in initCP) AddPath(mpath);
// parse top-level elements
InitTopLevelElements();
@@ -248,14 +253,13 @@ public override void BuildClassPath()
///
public override void RemoveClassCompilerCache()
{
- if (as2settings == null) return;
+ if (as2settings is null) return;
- ClassModel pClass = cFile.GetPublicClass();
- if (as2settings.MMClassPath == null || pClass.IsVoid())
- return;
- string package = (cFile.Package.Length > 0) ? cFile.Package + "." : "";
- string packagePath = dirSeparator + package.Replace('.', dirSeparatorChar);
- string file = Path.Combine(as2settings.MMClassPath, "aso") + packagePath + package + pClass.Name + ".aso";
+ var pClass = cFile.GetPublicClass();
+ if (as2settings.MMClassPath is null || pClass.IsVoid()) return;
+ var package = (cFile.Package.Length > 0) ? cFile.Package + "." : "";
+ var packagePath = dirSeparator + package.Replace('.', dirSeparatorChar);
+ var file = Path.Combine(as2settings.MMClassPath, "aso") + packagePath + package + pClass.Name + ".aso";
try
{
if (File.Exists(file)) File.Delete(file);
@@ -270,11 +274,8 @@ public override ClassModel CurrentClass
{
get
{
- if (cFile == FileModel.Ignore)
- {
- return ClassModel.VoidClass;
- }
- if (cClass == null)
+ if (cFile == FileModel.Ignore) return ClassModel.VoidClass;
+ if (cClass is null)
{
cClass = ClassModel.VoidClass;
cFile.OutOfDate = true;
@@ -282,10 +283,7 @@ public override ClassModel CurrentClass
// update class
if (cFile.OutOfDate)
{
- if (cFile.FileName.Length > 0)
- {
- UpdateCurrentFile(true);
- }
+ if (cFile.FileName.Length > 0) UpdateCurrentFile(true);
// update "this" and "super" special vars
UpdateTopLevelElements();
}
@@ -302,14 +300,13 @@ public override ClassModel CurrentClass
/// Completion visibility
public override Visibility TypesAffinity(ClassModel inClass, ClassModel withClass)
{
- if (inClass == null || withClass == null) return Visibility.Public;
+ if (inClass is null || withClass is null) return Visibility.Public;
// inheritance affinity
- ClassModel tmp = inClass;
- while (!tmp.IsVoid())
+ var type = inClass;
+ while (!type.IsVoid())
{
- if (tmp.Type == withClass.Type)
- return Visibility.Public | Visibility.Private;
- tmp = tmp.Extends;
+ if (type.Type == withClass.Type) return Visibility.Public | Visibility.Private;
+ type = type.Extends;
}
// public only
return Visibility.Public;
@@ -323,8 +320,9 @@ public override Visibility TypesAffinity(ClassModel inClass, ClassModel withClas
/// Inherited type
public override string DefaultInheritance(string package, string classname)
{
- if (package.Length == 0 && classname == features.objectKey) return features.voidKey;
- else return features.objectKey;
+ return package.Length == 0 && classname == features.objectKey
+ ? features.voidKey
+ : features.objectKey;
}
///
@@ -334,51 +332,47 @@ public override string DefaultInheritance(string package, string classname)
/// Response structure
public override void ResolveTopLevelElement(string token, ASResult result)
{
- if (topLevel != null && topLevel.Members.Count > 0)
+ if (topLevel is null || topLevel.Members.Count == 0) return;
+ // current class
+ var inClass = Context.CurrentClass;
+ if (token == "this")
{
- // current class
- ClassModel inClass = Context.CurrentClass;
- if (token == "this")
+ result.Member = topLevel.Members.Search("this");
+ if (inClass.IsVoid()) inClass = Context.ResolveType(result.Member.Type, null);
+ result.Type = inClass;
+ result.InFile = Context.CurrentModel;
+ result.RelClass = Context.CurrentClass;
+ return;
+ }
+ if (token == "super")
+ {
+ if (inClass.IsVoid())
{
- result.Member = topLevel.Members.Search("this", 0, 0);
- if (inClass.IsVoid())
- inClass = Context.ResolveType(result.Member.Type, null);
- result.Type = inClass;
- result.InFile = Context.CurrentModel;
- return;
+ var thisMember = topLevel.Members.Search("this");
+ inClass = Context.ResolveType(thisMember.Type, null);
}
- else if (token == "super")
+ inClass.ResolveExtends();
+ var extends = inClass.Extends;
+ if (!extends.IsVoid())
{
- if (inClass.IsVoid())
- {
- MemberModel thisMember = topLevel.Members.Search("this", 0, 0);
- inClass = Context.ResolveType(thisMember.Type, null);
- }
- inClass.ResolveExtends();
- ClassModel extends = inClass.Extends;
- if (!extends.IsVoid())
- {
- result.Member = topLevel.Members.Search("super", 0, 0);
- result.Type = extends;
- result.InFile = extends.InFile;
- return;
- }
+ result.Member = topLevel.Members.Search("super");
+ result.Type = extends;
+ result.InFile = extends.InFile;
+ result.RelClass = Context.CurrentClass;
+ return;
}
+ }
- // other top-level elements
- ASComplete.FindMember(token, topLevel, result, 0, 0);
- if (!result.IsNull()) return;
+ // other top-level elements
+ ASComplete.FindMember(token, topLevel, result, 0, 0);
+ if (!result.IsNull()) return;
- // special _levelN
- if (hasLevels && token.StartsWith("_") && re_level.IsMatch(token))
- {
- result.Member = new MemberModel();
- result.Member.Name = token;
- result.Member.Flags = FlagType.Variable;
- result.Member.Type = "MovieClip";
- result.Type = ResolveType("MovieClip", null);
- result.InFile = topLevel;
- }
+ // special _levelN
+ if (hasLevels && token.StartsWith('_') && re_level.IsMatch(token))
+ {
+ result.Member = new MemberModel {Name = token, Flags = FlagType.Variable, Type = "MovieClip"};
+ result.Type = ResolveType("MovieClip", null);
+ result.InFile = topLevel;
}
}
@@ -389,15 +383,13 @@ public override void ResolveTopLevelElement(string token, ASResult result)
/// Current file
public override MemberList ResolveImports(FileModel inFile)
{
- if (inFile == cFile && completionCache.Imports != null)
- return completionCache.Imports;
-
- MemberList imports = new MemberList();
- if (inFile == null) return imports;
+ if (inFile == cFile && completionCache.Imports != null) return completionCache.Imports;
+ var imports = new MemberList();
+ if (inFile is null) return imports;
bool filterImports = (inFile == cFile) && inFile.Classes.Count > 1;
int lineMin = (filterImports && inPrivateSection) ? inFile.PrivateSectionIndex : 0;
int lineMax = (filterImports && inPrivateSection) ? int.MaxValue : inFile.PrivateSectionIndex;
- foreach (MemberModel item in inFile.Imports)
+ foreach (var item in inFile.Imports)
{
if (filterImports && (item.LineFrom < lineMin || item.LineFrom > lineMax)) continue;
if (item.Name != "*")
@@ -405,18 +397,18 @@ public override MemberList ResolveImports(FileModel inFile)
if (settings.LazyClasspathExploration) imports.Add(item);
else
{
- ClassModel type = ResolveType(item.Type, null);
+ var type = ResolveType(item.Type, null);
if (!type.IsVoid()) imports.Add(type);
else
{
// package-level declarations
- int p = item.Type.LastIndexOf('.');
- if (p < 0) continue;
- string package = item.Type.Substring(0, p);
- string token = item.Type.Substring(p+1);
- FileModel pack = ResolvePackage(package, false);
- if (pack == null) continue;
- MemberModel member = pack.Members.Search(token, 0, 0);
+ var p = item.Type.LastIndexOf('.');
+ if (p == -1) continue;
+ var package = item.Type.Substring(0, p);
+ var token = item.Type.Substring(p+1);
+ var pack = ResolvePackage(package, false);
+ if (pack is null) continue;
+ var member = pack.Members.Search(token);
if (member != null) imports.Add(member);
}
}
@@ -424,14 +416,11 @@ public override MemberList ResolveImports(FileModel inFile)
else
{
// classes matching wildcard
- FileModel matches = ResolvePackage(item.Type.Substring(0, item.Type.Length - 2), false);
-
+ var matches = ResolvePackage(item.Type.Substring(0, item.Type.Length - 2), false);
if (matches != null)
{
- foreach (MemberModel import in matches.Imports)
- imports.Add(import);
- foreach (MemberModel member in matches.Members)
- imports.Add(member);
+ imports.Add(matches.Imports);
+ imports.Add(matches.Members);
}
}
}
@@ -448,20 +437,17 @@ public override MemberList ResolveImports(FileModel inFile)
/// Position in the file
public override bool IsImported(MemberModel member, int atLine)
{
- FileModel cFile = Context.CurrentModel;
- string fullName = member.Type;
- string name = member.Name;
- int lineMin = (Context.InPrivateSection) ? cFile.PrivateSectionIndex : 0;
- int lineMax = atLine;
+ if (member == ClassModel.VoidClass) return false;
+ var cFile = Context.CurrentModel;
+ var fullName = member.Type;
+ var name = member.Name;
+ var lineMin = (Context.InPrivateSection) ? cFile.PrivateSectionIndex : 0;
+ var lineMax = atLine;
foreach (MemberModel import in cFile.Imports)
{
- if (import.LineFrom >= lineMin && import.LineFrom <= lineMax && import.Name == name)
- {
- if (import.Type != fullName) throw new Exception("Ambiguous Type");
- return true;
- }
- else if (import.Name == "*" && import.Type.Replace("*", name) == fullName)
+ if (import.LineFrom >= lineMin && import.LineFrom <= lineMax && import.Name == name && import.Type == fullName)
return true;
+ if (import.Name == "*" && import.Type.Replace("*", name) == fullName) return true;
}
return false;
}
@@ -470,20 +456,19 @@ public override bool IsImported(MemberModel member, int atLine)
/// Retrieves a class model from its name
///
/// Class (short or full) name
- /// Current file
+ /// Current file
/// A parsed class or an empty ClassModel if the class is not found
public override ClassModel ResolveType(string cname, FileModel inFile)
{
// unknown type
- if (string.IsNullOrEmpty(cname) || cname == features.voidKey || classPath == null)
+ if (string.IsNullOrEmpty(cname) || cname == features.voidKey || classPath is null)
return ClassModel.VoidClass;
// typed array
- if (cname.IndexOf('@') > 0)
- return ResolveTypeIndex(cname, inFile);
+ if (cname.Contains('@')) return ResolveTypeIndex(cname, inFile);
- string package = "";
- Match m = re_lastDot.Match(cname);
+ var package = "";
+ var m = re_lastDot.Match(cname);
if (m.Success)
{
package = cname.Substring(0, m.Index);
@@ -494,7 +479,7 @@ public override ClassModel ResolveType(string cname, FileModel inFile)
if (inFile != null && inFile.Classes.Count > 0)
{
foreach (ClassModel aClass in inFile.Classes)
- if (aClass.Name == cname && (package == "" || package == inFile.Package))
+ if (aClass.Name == cname && (package.Length == 0 || package == inFile.Package))
return aClass;
}
@@ -502,7 +487,7 @@ public override ClassModel ResolveType(string cname, FileModel inFile)
string inPackage = (features.hasPackages && inFile != null) ? inFile.Package : "";
// search in imported classes
- if (package == "" && inFile != null)
+ if (package.Length == 0 && inFile != null)
{
foreach (MemberModel import in inFile.Imports)
{
@@ -512,22 +497,22 @@ public override ClassModel ResolveType(string cname, FileModel inFile)
package = import.Type.Substring(0, import.Type.Length - cname.Length - 1);
break;
}
- else if (features.hasImportsWildcard)
+ if (features.hasImportsWildcard)
{
if (import.Name == "*" && import.Type.Length > 2)
{
// try wildcards
- string testPackage = import.Type.Substring(0, import.Type.Length - 2);
+ var testPackage = import.Type.Substring(0, import.Type.Length - 2);
if (settings.LazyClasspathExploration)
{
- ClassModel testClass = GetModel(testPackage, cname, inPackage);
+ var testClass = GetModel(testPackage, cname, inPackage);
if (!testClass.IsVoid()) return testClass;
}
else
{
- FileModel pack = ResolvePackage(testPackage, false);
- if (pack == null) continue;
- MemberModel found = pack.Imports.Search(cname, 0, 0);
+ var pack = ResolvePackage(testPackage, false);
+ if (pack is null) continue;
+ var found = pack.Imports.Search(cname);
if (found != null) return ResolveType(found.Type, null);
}
}
@@ -536,14 +521,14 @@ public override ClassModel ResolveType(string cname, FileModel inFile)
{
if (settings.LazyClasspathExploration)
{
- ClassModel testClass = GetModel(import.Type, cname, inPackage);
+ var testClass = GetModel(import.Type, cname, inPackage);
if (!testClass.IsVoid()) return testClass;
}
else
{
- FileModel pack = ResolvePackage(import.Type, false);
- if (pack == null) continue;
- MemberModel found = pack.Imports.Search(cname, 0, 0);
+ var pack = ResolvePackage(import.Type, false);
+ if (pack is null) continue;
+ var found = pack.Imports.Search(cname);
if (found != null) return ResolveType(found.Type, null);
}
}
@@ -554,10 +539,35 @@ public override ClassModel ResolveType(string cname, FileModel inFile)
return GetModel(package, cname, inPackage);
}
+ public override ClassModel ResolveToken(string token, FileModel inFile)
+ {
+ var tokenLength = token?.Length ?? 0;
+ if (tokenLength > 0)
+ {
+ if (token == "true" || token == "false") return ResolveType(features.booleanKey, inFile);
+ var first = token[0];
+ if (char.IsDigit(token, 0)
+ // for example: -1, +1
+ || (tokenLength > 1 && (first == '-' || first == '+') && char.IsDigit(token, 1))
+ // for example: --1, ++1
+ || (tokenLength > 2 && ((first == '-' && token[1] == '-') || (first == '+' && token[1] == '+')) && char.IsDigit(token, 2)))
+ {
+ if (features.IntegerKey is null) return ResolveType(features.numberKey, inFile);
+ if (token.Contains('.') || token.Contains('e')) return ResolveType(features.numberKey, inFile);
+ return ResolveType(features.IntegerKey, inFile);
+ }
+ var last = token[tokenLength - 1];
+ if (first == '{' && last == '}') return ResolveType(features.objectKey, inFile);
+ if (first == '[' && last == ']') return ResolveType(features.arrayKey, inFile);
+ if (tokenLength > 1 && (first == '"' || first == '\'') && last == first) return ResolveType(features.stringKey, inFile);
+ }
+ return base.ResolveToken(token, inFile);
+ }
+
protected ClassModel ResolveTypeIndex(string cname, FileModel inFile)
{
int p = cname.IndexOf('@');
- if (p < 0) return ClassModel.VoidClass;
+ if (p == -1) return ClassModel.VoidClass;
string indexType = cname.Substring(p + 1);
string baseType = cname.Substring(0, p);
@@ -567,22 +577,22 @@ protected ClassModel ResolveTypeIndex(string cname, FileModel inFile)
ClassModel indexClass = ResolveType(indexType, inFile);
- if (baseType == "Object" || baseType == "Dynamic")
+ if (baseType == inFile.Context.Features.dynamicKey)
{
- if (!indexClass.IsVoid()) return indexClass;
- return MakeCustomObjectClass(originalClass, indexType);
+ return !indexClass.IsVoid()
+ ? indexClass
+ : MakeCustomObjectClass(originalClass, indexType);
}
if (indexClass.IsVoid()) return originalClass;
indexType = indexClass.QualifiedName;
- FileModel aFile = originalClass.InFile;
+ var aFile = originalClass.InFile;
// is the type already cloned?
- foreach (ClassModel otherClass in aFile.Classes)
+ foreach (var otherClass in aFile.Classes)
if (otherClass.IndexType == indexType) return otherClass;
// clone the type
- ClassModel aClass = originalClass.Clone() as ClassModel;
-
+ var aClass = originalClass.Clone();
aClass.Name = baseType + "@" + indexType;
aClass.IndexType = indexType;
@@ -594,19 +604,18 @@ protected ClassModel ResolveTypeIndex(string cname, FileModel inFile)
}
// replace 'Object' and '*' by the index type
else
- foreach (MemberModel member in aClass.Members)
- {
- if (member.Type == features.objectKey || member.Type == "*") member.Type = indexType;
- if (member.Parameters != null)
+ foreach (var member in aClass.Members)
{
- foreach (MemberModel param in member.Parameters)
+ if (member.Type == features.objectKey || member.Type == "*") member.Type = indexType;
+ if (member.Parameters != null)
{
- if (param.Name == "value"
- && (param.Type == features.objectKey || param.Type == "*"))
- param.Type = indexType;
+ foreach (var param in member.Parameters)
+ {
+ if (param.Name == "value" && (param.Type == features.objectKey || param.Type == "*"))
+ param.Type = indexType;
+ }
}
}
- }
aFile.Classes.Add(aClass);
return aClass;
@@ -614,21 +623,24 @@ protected ClassModel ResolveTypeIndex(string cname, FileModel inFile)
protected ClassModel MakeCustomObjectClass(ClassModel objectClass, string indexType)
{
- foreach (ClassModel c in objectClass.InFile.Classes)
- if (c.IndexType == indexType) return c;
-
- ClassModel aClass = new ClassModel();
- aClass.Flags = objectClass.Flags;
- aClass.Access = objectClass.Access;
- aClass.ExtendsType = "";
- aClass.Name = objectClass.QualifiedName + "@" + indexType;
- aClass.IndexType = indexType;
- aClass.InFile = objectClass.InFile;
+ foreach (var c in objectClass.InFile.Classes)
+ if (c.IndexType == indexType)
+ return c;
+
+ var aClass = new ClassModel
+ {
+ Flags = objectClass.Flags,
+ Access = objectClass.Access,
+ ExtendsType = "",
+ Name = objectClass.QualifiedName + "@" + indexType,
+ IndexType = indexType,
+ InFile = objectClass.InFile
+ };
- FlagType flags = FlagType.Dynamic | FlagType.Variable | FlagType.AutomaticVar;
- foreach (string prop in indexType.Split(','))
+ const FlagType flags = FlagType.Dynamic | FlagType.Variable | FlagType.AutomaticVar;
+ foreach (var prop in indexType.Split(','))
{
- MemberModel member = new MemberModel(prop, "", flags, Visibility.Public);
+ var member = new MemberModel(prop, "", flags, Visibility.Public);
aClass.Members.Add(member);
}
objectClass.InFile.Classes.Add(aClass);
@@ -642,16 +654,16 @@ protected ClassModel MakeCustomObjectClass(ClassModel objectClass, string indexT
/// Class name
/// Package reference for resolution
///
- public override ClassModel GetModel(string package, string cname, string inPackage)
+ public override ClassModel GetModel(string package, string cname, string? inPackage)
{
if (!settings.LazyClasspathExploration)
{
bool testSamePackage = package.Length == 0 && features.hasPackages;
bool testModule = package.Length > 0 && features.hasModules;
- foreach (PathModel aPath in classPath)
+ foreach (var aPath in classPath)
if (aPath.IsValid && !aPath.Updating)
{
- ClassModel found = LookupClass(package, cname, inPackage, testSamePackage, testModule, aPath);
+ var found = LookupClass(package, cname, inPackage, testSamePackage, testModule, aPath);
if (found != null) return found;
}
if (classPath.Count > 0 && classPath[0].IsTemporaryPath)
@@ -667,8 +679,7 @@ public override ClassModel GetModel(string package, string cname, string inPacka
model = LocateClassFile(classPath[0], fileName);
}
catch { }
- if (model != null) return model;
- else return ClassModel.VoidClass;
+ return model ?? ClassModel.VoidClass;
}
}
else
@@ -679,68 +690,76 @@ public override ClassModel GetModel(string package, string cname, string inPacka
foreach (PathModel aPath in classPath) if (aPath.IsValid && !aPath.Updating)
{
- ClassModel model = LocateClassFile(aPath, fileName);
+ var model = LocateClassFile(aPath, fileName);
if (model != null) return model;
}
}
return ClassModel.VoidClass;
}
- private ClassModel LookupClass(string package, string cname, string inPackage, bool testSamePackage, bool testModule, PathModel aPath)
+ ClassModel LookupClass(string package, string cname, string? inPackage, bool testSamePackage, bool testModule, PathModel aPath)
{
- bool matchParentPackage = testSamePackage && features.hasFriendlyParentPackages;
-
- ClassModel found = null;
- int pLen = inPackage.Length;
-
- aPath.ForeachFile((aFile) =>
+ ClassModel result = null;
+ inPackage ??= string.Empty;
+ var matchParentPackage = testSamePackage && features.hasFriendlyParentPackages;
+ var pLen = inPackage.Length;
+ aPath.ForeachFile(aFile =>
{
- string pkg = aFile.Package;
+ var count = aFile.Classes.Count;
+ if (count == 0) return true;
+ var pkg = aFile.Package;
// qualified path
- if (pkg == package && aFile.Classes.Count > 0)
+ if (pkg == package)
{
- foreach (ClassModel aClass in aFile.Classes)
+ for (var i = 0; i < count; i++)
+ {
+ var aClass = aFile.Classes[i];
if (aClass.Name == cname && (pkg == "" || aFile.Module == "" || aFile.Module == aClass.Name))
{
- found = aClass;
+ result = aClass;
return false;
}
+ }
}
- else if (testModule && aFile.FullPackage == package && aFile.Classes.Count > 0)
+ else if (testModule && aFile.FullPackage == package)
{
- foreach (ClassModel aClass in aFile.Classes)
+ for (var i = 0; i < count; i++)
+ {
+ var aClass = aFile.Classes[i];
if (aClass.Name == cname)
{
- found = aClass;
+ result = aClass;
return false;
}
+ }
}
// in the same (or parent) package
- else if (testSamePackage)
+ else if (testSamePackage && (pkg == inPackage || (matchParentPackage && pkg.Length < pLen && inPackage.StartsWithOrdinal(pkg + "."))))
{
- if (inPackage == pkg || (matchParentPackage && pkg.Length < pLen && inPackage.StartsWith(pkg + ".")))
- foreach (ClassModel aClass in aFile.Classes)
- if (aClass.Name == cname /*&& (aFile.Module == "" || aFile.Module == aClass.Name)*/)
- {
- found = aClass;
- return false;
- }
+ for (var i = 0; i < count; i++)
+ {
+ var aClass = aFile.Classes[i];
+ if (aClass.Name == cname)
+ {
+ result = aClass;
+ return false;
+ }
+ }
}
return true;
});
- return found;
+ return result;
}
- private ClassModel LocateClassFile(PathModel aPath, string fileName)
+ ClassModel LocateClassFile(PathModel aPath, string fileName)
{
if (!aPath.IsValid) return null;
try
{
string path = Path.Combine(aPath.Path, fileName);
// cached file
- if (aPath.HasFile(path))
+ if (aPath.TryGetFile(path, out var nFile))
{
- FileModel nFile = aPath.GetFile(path);
if (nFile.Context != this)
{
// not associated with this context -> refresh
@@ -750,9 +769,9 @@ private ClassModel LocateClassFile(PathModel aPath, string fileName)
return nFile.GetPublicClass();
}
// non-cached existing file
- else if (File.Exists(path))
+ if (File.Exists(path))
{
- FileModel nFile = GetFileModel(path);
+ nFile = GetFileModel(path);
if (nFile != null)
{
aPath.AddFile(nFile);
@@ -780,110 +799,104 @@ public override void CheckModel(bool onFileOpen)
base.CheckModel(onFileOpen);
return;
}
- string prevPackage = (onFileOpen) ? null : cFile.Package;
- string prevCname = (onFileOpen) ? null : cFile.GetPublicClass().Name;
+ string prevPackage = null;
+ string prevCname = null;
+ if(onFileOpen)
+ {
+ prevPackage = cFile.Package;
+ prevCname = cFile.GetPublicClass().Name;
+ }
// refresh model
base.CheckModel(onFileOpen);
if (!MessageBar.Locked && features.checkFileName && cFile.Version > 1)
{
- string package = cFile.Package;
- ClassModel pClass = cFile.GetPublicClass();
- if (package.Length > 0)
+ var package = cFile.Package;
+ var pClass = cFile.GetPublicClass();
+ var pathname = package.Replace('.', Path.DirectorySeparatorChar);
+ var fullpath = Path.GetDirectoryName(cFile.FileName);
+ if (package.Length == 0 || !fullpath.EndsWithOrdinal(pathname))
{
- string pathname = package.Replace('.', Path.DirectorySeparatorChar);
- string fullpath = Path.GetDirectoryName(cFile.FileName);
- if (!fullpath.EndsWith(pathname))
+ if (settings.FixPackageAutomatically && PluginBase.MainForm.CurrentDocument?.SciControl is { } sci)
{
- if (settings.FixPackageAutomatically && CurSciControl != null)
+ var packagePattern = cFile.Context.Settings.LanguageId == "AS2"
+ ? new Regex("class\\s+(" + cFile.Package.Replace(".", "\\.") + "\\." + pClass.Name + ')')
+ : new Regex("package\\s+(" + cFile.Package.Replace(".", "\\.") + ')');
+
+ var regexPackageLine = "";
+ var pos = -1;
+ var txt = "";
+ var p = 0;
+ var counter = sci.Length;
+ while (p < counter)
{
- bool isAs2 = cFile.Context.Settings.LanguageId == "AS2";
-
- int pos = -1;
-
- string txt = "";
- string regexPackageLine = "";
-
- int counter = CurSciControl.Length;
- int p = 0;
- Regex packagePattern = null;
- if (isAs2)
+ var c = (char) sci.CharAt(p++);
+ txt += c;
+ if (txt.Length > 5 && c <= 32)
{
- packagePattern = new Regex("class\\s+(" + cFile.Package.Replace(".", "\\.") + "\\." + pClass.Name + ')');
- }
- else
- {
- packagePattern = new Regex("package\\s+(" + cFile.Package.Replace(".", "\\.") + ')');
- }
- while (p < counter)
- {
- char c = (char)CurSciControl.CharAt(p++);
- txt += c;
- if (txt.Length > 5 && c <= 32)
+ var m = packagePattern.Match(txt);
+ if (m.Success)
{
- Match m = packagePattern.Match(txt);
- if (m.Success)
- {
- pos = m.Groups[1].Index;
- regexPackageLine = m.Value;
- break;
- }
+ pos = m.Groups[1].Index;
+ regexPackageLine = m.Value;
+ break;
}
}
+ }
- if (regexPackageLine.Length > 0 && pos > -1)
+ if (regexPackageLine.Length > 0 && pos > -1)
+ {
+ var orgid = "Info.PackageDontMatchFilePath";
+ var classpaths = Context.Classpath;
+ if (classpaths != null)
{
- string orgid = "Info.PackageDontMatchFilePath";
- List classpaths = Context.Classpath;
- if (classpaths != null)
+ string correctPath = null;
+ foreach (var pm in classpaths)
{
- string correctPath = null;
- foreach (PathModel pm in classpaths)
+ if (fullpath.Contains(pm.Path) && fullpath.Length > pm.Path.Length)
{
- if (fullpath.IndexOf(pm.Path) > -1 && fullpath.Length > pm.Path.Length)
- {
- correctPath = fullpath.Substring(pm.Path.Length + 1);
- }
- else if (fullpath.ToLower() == pm.Path.ToLower())
- {
- correctPath = ""; // We are in root, no package..
- }
+ correctPath = fullpath.Substring(pm.Path.Length + 1);
}
- if (correctPath != null)
+ else if (fullpath.ToLower() == pm.Path.ToLower())
{
- correctPath = correctPath.Replace(Path.DirectorySeparatorChar, '.');
- CurSciControl.SetSel(pos, pos + cFile.Package.Length);
- CurSciControl.ReplaceSel(correctPath);
- orgid = "Info.PackageDidntMatchFilePath";
+ correctPath = ""; // We are in root, no package..
}
}
- string org = TextHelper.GetString(orgid);
- string msg = String.Format(org, package) + "\n" + cFile.FileName;
- MessageBar.ShowWarning(msg);
+ if (correctPath == "" && package.Length == 0) return;
+ if (correctPath != null)
+ {
+ correctPath = correctPath.Replace(Path.DirectorySeparatorChar, '.');
+ sci.SetSel(pos, pos + cFile.Package.Length);
+ sci.ReplaceSel(correctPath);
+ orgid = "Info.PackageDidntMatchFilePath";
+ }
}
-
- }
- else
- {
- string org = TextHelper.GetString("Info.PackageDontMatchFilePath");
- string msg = String.Format(org, package) + "\n" + cFile.FileName;
+ var org = TextHelper.GetString(orgid);
+ var msg = string.Format(org, package) + "\n" + cFile.FileName;
MessageBar.ShowWarning(msg);
}
- return;
}
- else MessageBar.HideWarning();
+ else
+ {
+ var org = TextHelper.GetString("Info.PackageDontMatchFilePath");
+ var msg = string.Format(org, package) + "\n" + cFile.FileName;
+ MessageBar.ShowWarning(msg);
+ }
+ return;
}
+
+ MessageBar.HideWarning();
if (!pClass.IsVoid())
{
string cname = pClass.Name;
if (prevPackage != package || prevCname != cname)
{
- if (package.Length > 0) cname = package + "." + cname;
- string filename = cname.Replace('.', Path.DirectorySeparatorChar) + Path.GetExtension(cFile.FileName);
- if (!cFile.FileName.ToUpper().EndsWith(filename.ToUpper()))
+ cname = package + "." + cname;
+ var filename = cname.Replace('.', Path.DirectorySeparatorChar) + Path.GetExtension(cFile.FileName);
+ if (!cFile.FileName.ToUpper().EndsWithOrdinal(filename.ToUpper()))
{
string org = TextHelper.GetString("Info.TypeDontMatchFileName");
- string msg = String.Format(org, cname) + "\n" + cFile.FileName;
+ string msg = string.Format(org, cname) + "\n" + cFile.FileName;
MessageBar.ShowWarning(msg);
}
else MessageBar.HideWarning();
@@ -892,24 +905,22 @@ public override void CheckModel(bool onFileOpen)
}
}
-
///
/// Update Flash intrinsic known vars
///
protected override void UpdateTopLevelElements()
{
- MemberModel special;
- special = topLevel.Members.Search("this", 0, 0);
+ var special = topLevel.Members.Search("this");
if (special != null)
{
if (!cClass.IsVoid()) special.Type = cClass.QualifiedName;
else special.Type = (cFile.Version > 1) ? features.voidKey : docType;
}
- special = topLevel.Members.Search("super", 0, 0);
+ special = topLevel.Members.Search("super");
if (special != null)
{
cClass.ResolveExtends();
- ClassModel extends = cClass.Extends;
+ var extends = cClass.Extends;
if (!extends.IsVoid()) special.Type = extends.QualifiedName;
else special.Type = (cFile.Version > 1) ? features.voidKey : features.objectKey;
}
@@ -920,22 +931,25 @@ protected override void UpdateTopLevelElements()
///
protected override void InitTopLevelElements()
{
- string filename = "toplevel.as";
+ var filename = "toplevel.as";
topLevel = new FileModel(filename);
// search top-level declaration
- foreach(PathModel aPath in classPath)
- if (File.Exists(Path.Combine(aPath.Path, filename)))
+ foreach (var aPath in classPath)
{
- filename = Path.Combine(aPath.Path, filename);
- topLevel = GetCachedFileModel(filename);
- break;
+ var path = Path.Combine(aPath.Path, filename);
+ if (File.Exists(path))
+ {
+ filename = path;
+ topLevel = GetCachedFileModel(filename);
+ break;
+ }
}
if (File.Exists(filename))
{
// MTASC toplevel-style declaration:
- ClassModel tlClass = topLevel.GetPublicClass();
+ var tlClass = topLevel.GetPublicClass();
if (!tlClass.IsVoid())
{
topLevel.Members = tlClass.Members;
@@ -944,23 +958,14 @@ protected override void InitTopLevelElements()
}
}
// not found
- else
- {
- //ErrorHandler.ShowInfo("Top-level elements class not found. Please check your Program Settings.");
- }
- if (topLevel.Members.Search("_root", 0, 0) == null)
- topLevel.Members.Add(new MemberModel("_root", docType, FlagType.Variable, Visibility.Public));
- if (topLevel.Members.Search("_global", 0, 0) == null)
- topLevel.Members.Add(new MemberModel("_global", features.objectKey, FlagType.Variable, Visibility.Public));
- if (topLevel.Members.Search("this", 0, 0) == null)
- topLevel.Members.Add(new MemberModel("this", "", FlagType.Variable, Visibility.Public));
- if (topLevel.Members.Search("super", 0, 0) == null)
- topLevel.Members.Add(new MemberModel("super", "", FlagType.Variable, Visibility.Public));
- if (topLevel.Members.Search(features.voidKey, 0, 0) == null)
- topLevel.Members.Add(new MemberModel(features.voidKey, "", FlagType.Class | FlagType.Intrinsic, Visibility.Public));
+ if (!topLevel.Members.Contains("_root")) topLevel.Members.Add(new MemberModel("_root", docType, FlagType.Variable, Visibility.Public));
+ if (!topLevel.Members.Contains("_global")) topLevel.Members.Add(new MemberModel("_global", features.objectKey, FlagType.Variable, Visibility.Public));
+ if (!topLevel.Members.Contains("this")) topLevel.Members.Add(new MemberModel("this", string.Empty, FlagType.Variable, Visibility.Public));
+ if (!topLevel.Members.Contains("super")) topLevel.Members.Add(new MemberModel("super", string.Empty, FlagType.Variable, Visibility.Public));
+ if (!topLevel.Members.Contains(features.voidKey)) topLevel.Members.Add(new MemberModel(features.voidKey, string.Empty, FlagType.Class | FlagType.Intrinsic, Visibility.Public));
topLevel.Members.Sort();
- foreach (MemberModel member in topLevel.Members)
+ foreach (var member in topLevel.Members)
member.Flags |= FlagType.Intrinsic;
}
@@ -972,72 +977,73 @@ protected override void InitTopLevelElements()
/// Package folders and types
public override FileModel ResolvePackage(string name, bool lazyMode)
{
- if (name == null) name = "";
+ if (name is null) name = "";
else if (!re_package.IsMatch(name)) return null;
-
- FileModel pModel = new FileModel();
- pModel.Package = name;
- pModel.OutOfDate = false;
-
- string packagePath = name.Replace('.', dirSeparatorChar);
- foreach (PathModel aPath in classPath) if (aPath.IsValid && !aPath.Updating)
- {
- // explore file system
- if (lazyMode || settings.LazyClasspathExploration || aPath.IsTemporaryPath)
+ var pModel = new FileModel {Package = name, OutOfDate = false};
+ var packagePath = name.Replace('.', dirSeparatorChar);
+ foreach (PathModel aPath in classPath)
+ if (aPath.IsValid && !aPath.Updating)
{
- string path = Path.Combine(aPath.Path, packagePath);
- if (aPath.IsValid && Directory.Exists(path))
+ // explore file system
+ if (lazyMode || settings.LazyClasspathExploration || aPath.IsTemporaryPath)
{
- try
- {
- PopulatePackageEntries(name, path, pModel.Imports);
- PopulateClassesEntries(name, path, pModel.Imports);
- }
- catch (Exception ex)
+ var path = Path.Combine(aPath.Path, packagePath);
+ if (Directory.Exists(path))
{
- ErrorManager.ShowError(ex);
+ try
+ {
+ PopulatePackageEntries(name, path, pModel.Imports);
+ PopulateClassesEntries(name, path, pModel.Imports);
+ }
+ catch (Exception ex)
+ {
+ ErrorManager.ShowError(ex);
+ }
}
}
- }
- // explore parsed models
- else
- {
- string prevPackage = null;
- string packagePrefix = name.Length > 0 ? name + "." : "";
- int nameLen = name.Length + 1;
- aPath.ForeachFile((model) =>
+ // explore parsed models
+ else
{
- if (!model.HasPackage)
- return true; // skip
- string package = model.Package;
- if (package == name)
+ string prevPackage = null;
+ string packagePrefix = name.Length > 0 ? name + "." : "";
+ int nameLen = name.Length + 1;
+ aPath.ForeachFile((model) =>
{
- foreach (ClassModel type in model.Classes)
+ if (!model.HasPackage)
+ return true; // skip
+ string package = model.Package;
+ if (package == name)
{
- if (type.IndexType != null) continue;
- MemberModel item = type.ToMemberModel();
- if (type.Access != Visibility.Private)
- pModel.Imports.Add(item);
+ var count = model.Classes.Count;
+ for (var i = 0; i < count; i++)
+ {
+ var type = model.Classes[i];
+ if (type.IndexType != null) continue;
+ if (type.Access != Visibility.Private)
+ pModel.Imports.Add(type.ToMemberModel());
+ }
+ count = model.Members.Count;
+ for (var i = 0; i < count; i++)
+ {
+ pModel.Members.Add(model.Members[i].Clone());
+ }
}
- foreach (MemberModel member in model.Members)
- pModel.Members.Add(member.Clone() as MemberModel);
- }
- else if (package != prevPackage
- && (package.Length > name.Length && package.StartsWith(packagePrefix))) // imports
- {
- prevPackage = package;
- if (nameLen > 1) package = package.Substring(nameLen);
- int p = package.IndexOf('.');
- if (p > 0) package = package.Substring(0, p);
- if (pModel.Imports.Search(package, 0, 0) == null) // sub packages
+ else if (package != prevPackage
+ && (package.Length > name.Length && package.StartsWithOrdinal(packagePrefix))) // imports
{
- pModel.Imports.Add(new MemberModel(package, package, FlagType.Package, Visibility.Public));
+ prevPackage = package;
+ if (nameLen > 1) package = package.Substring(nameLen);
+ int p = package.IndexOf('.');
+ if (p > 0) package = package.Substring(0, p);
+ if (!pModel.Imports.Contains(package)) // sub packages
+ {
+ pModel.Imports.Add(new MemberModel(package, package, FlagType.Package, Visibility.Public));
+ }
}
- }
- return true;
- });
+ return true;
+ });
+ }
}
- }
// result
if (pModel.Imports.Count > 0 || pModel.Members.Count > 0)
@@ -1045,10 +1051,10 @@ public override FileModel ResolvePackage(string name, bool lazyMode)
pModel.Imports.Sort();
return pModel;
}
- else return null;
+ return null;
}
- private void PopulateClassesEntries(string package, string path, MemberList memberList)
+ void PopulateClassesEntries(string package, string path, MemberList memberList)
{
string[] fileEntries = null;
try
@@ -1056,24 +1062,22 @@ private void PopulateClassesEntries(string package, string path, MemberList memb
fileEntries = Directory.GetFiles(path, "*" + settings.DefaultExtension);
}
catch { }
- if (fileEntries == null) return;
- string mname;
- string type;
- FlagType flag = FlagType.Class | ((package == null) ? FlagType.Intrinsic : 0);
+ if (fileEntries is null) return;
+ var flag = FlagType.Class | (package is null ? FlagType.Intrinsic : 0);
foreach (string entry in fileEntries)
{
- mname = GetLastStringToken(entry, dirSeparator);
- mname = mname.Substring(0, mname.LastIndexOf("."));
- if (mname.Length > 0 && memberList.Search(mname, 0, 0) == null && re_token.IsMatch(mname))
+ var mname = GetLastStringToken(entry, dirSeparator);
+ mname = mname.Substring(0, mname.LastIndexOf('.'));
+ if (mname.Length > 0 && !memberList.Contains(mname) && re_token.IsMatch(mname))
{
- type = mname;
+ var type = mname;
if (package.Length > 0) type = package + "." + mname;
memberList.Add(new MemberModel(mname, type, flag, Visibility.Public));
}
}
}
- private void PopulatePackageEntries(string package, string path, MemberList memberList)
+ static void PopulatePackageEntries(string package, string path, MemberList memberList)
{
string[] dirEntries = null;
try
@@ -1081,16 +1085,14 @@ private void PopulatePackageEntries(string package, string path, MemberList memb
dirEntries = Directory.GetDirectories(path);
}
catch { }
- if (dirEntries == null) return;
+ if (dirEntries is null) return;
- string mname;
- string type;
foreach (string entry in dirEntries)
{
- mname = GetLastStringToken(entry, dirSeparator);
- if (mname.Length > 0 && memberList.Search(mname, 0, 0) == null && re_token.IsMatch(mname))
+ var mname = GetLastStringToken(entry, dirSeparator);
+ if (mname.Length > 0 && !memberList.Contains(mname) && re_token.IsMatch(mname))
{
- type = mname;
+ var type = mname;
if (package.Length > 0) type = package + "." + mname;
memberList.Add(new MemberModel(mname, type, FlagType.Package, Visibility.Public));
}
@@ -1103,12 +1105,9 @@ private void PopulatePackageEntries(string package, string path, MemberList memb
///
public override MemberList GetTopLevelElements()
{
- if (topLevel != null)
- {
- if (topLevel.OutOfDate) InitTopLevelElements();
- return topLevel.Members;
- }
- else return new MemberList();
+ if (topLevel is null) return new MemberList();
+ if (topLevel.OutOfDate) InitTopLevelElements();
+ return topLevel.Members;
}
///
@@ -1118,86 +1117,77 @@ public override MemberList GetTopLevelElements()
public override MemberList GetVisibleExternalElements()
{
if (!IsFileValid) return new MemberList();
-
- if (completionCache.IsDirty)
+ if (!completionCache.IsDirty) return completionCache.Elements;
+ var elements = new MemberList();
+ // root types & packages
+ var baseElements = ResolvePackage(null, false);
+ if (baseElements != null)
{
- MemberList elements = new MemberList();
- // root types & packages
- FileModel baseElements = ResolvePackage(null, false);
- if (baseElements != null)
- {
- elements.Add(baseElements.Imports);
- elements.Add(baseElements.Members);
- }
- elements.Add(new MemberModel(features.voidKey, features.voidKey, FlagType.Class | FlagType.Intrinsic, 0));
+ elements.Add(baseElements.Imports);
+ elements.Add(baseElements.Members);
+ }
+ elements.Add(new MemberModel(features.voidKey, features.voidKey, FlagType.Class | FlagType.Intrinsic, 0));
- //bool qualify = Settings.CompletionShowQualifiedTypes && settings.GenerateImports;
-
- // other classes in same package
- if (features.hasPackages && cFile.Package != "")
+ // other classes in same package
+ if (features.hasPackages && cFile.Package != "")
+ {
+ var packageElements = ResolvePackage(cFile.Package, false);
+ if (packageElements != null)
{
- FileModel packageElements = ResolvePackage(cFile.Package, false);
- if (packageElements != null)
+ foreach (var member in packageElements.Imports)
{
- foreach (MemberModel member in packageElements.Imports)
+ if (member.Flags != FlagType.Package)
{
- if (member.Flags != FlagType.Package)
- {
- //if (qualify) member.Name = member.Type;
- elements.Add(member);
- }
- }
- foreach (MemberModel member in packageElements.Members)
- {
- string pkg = member.InFile.Package;
- //if (qualify && pkg != "") member.Name = pkg + "." + member.Name;
- member.Type = pkg != "" ? pkg + "." + member.Name : member.Name;
elements.Add(member);
}
}
+ foreach (var member in packageElements.Members)
+ {
+ var pkg = member.InFile.Package;
+ member.Type = pkg != "" ? pkg + "." + member.Name : member.Name;
+ elements.Add(member);
+ }
}
- // other classes in same file
- if (cFile.PrivateSectionIndex > 0)
+ }
+ // other classes in same file
+ if (cFile.PrivateSectionIndex > 0)
+ {
+ if (inPrivateSection && cFile.Classes.Count > 1)
{
- if (inPrivateSection && cFile.Classes.Count > 1)
+ var mainClass = cFile.GetPublicClass();
+ if (!mainClass.IsVoid())
{
- ClassModel mainClass = cFile.GetPublicClass();
- if (!mainClass.IsVoid())
- {
- MemberModel toRemove = elements.Search(mainClass.Name, 0, 0);
- if (toRemove != null && toRemove.Type == mainClass.QualifiedName)
- elements.Remove(toRemove);
- }
+ var toRemove = elements.Search(mainClass.Name);
+ if (toRemove != null && toRemove.Type == mainClass.QualifiedName)
+ elements.Remove(toRemove);
}
+ }
- MemberModel member;
- foreach (ClassModel aClass in cFile.Classes)
+ foreach (var aClass in cFile.Classes)
+ {
+ if (features.hasMultipleDefs || aClass.Access == Visibility.Private)
{
- if (features.hasMultipleDefs || aClass.Access == Visibility.Private)
- {
- member = aClass.ToMemberModel();
- elements.Add(member);
- }
+ elements.Add(aClass.ToMemberModel());
}
}
+ }
- // imports
- elements.Add(ResolveImports(CurrentModel));
+ // imports
+ elements.Add(ResolveImports(CurrentModel));
- // in cache
- elements.Sort();
- completionCache = new CompletionCache(this, elements);
+ // in cache
+ elements.Sort();
+ completionCache = new CompletionCache(this, elements);
- // known classes colorization
- if (!CommonSettings.DisableKnownTypesColoring && !settings.LazyClasspathExploration && CurSciControl != null)
+ // known classes colorization
+ if (!CommonSettings.DisableKnownTypesColoring && !settings.LazyClasspathExploration && PluginBase.MainForm.CurrentDocument?.SciControl is { } sci)
+ {
+ try
{
- try
- {
- CurSciControl.KeyWords(1, completionCache.Keywords); // additional-keywords index = 1
- CurSciControl.Colourise(0, -1); // re-colorize the editor
- }
- catch (AccessViolationException){} // catch memory errors
- }
+ sci.KeyWords(1, completionCache.Keywords); // additional-keywords index = 1
+ sci.Colourise(0, -1); // re-colorize the editor
+ }
+ catch (AccessViolationException){} // catch memory errors
}
return completionCache.Elements;
}
@@ -1212,56 +1202,50 @@ public override MemberList GetAllProjectClasses()
if (!completionCache.IsDirty && completionCache.AllTypes != null)
return completionCache.AllTypes;
- MemberList fullList = new MemberList();
- ClassModel aClass;
- MemberModel item;
+ var result = new MemberList();
// public classes
- foreach (PathModel aPath in classPath) if (aPath.IsValid && !aPath.Updating)
- {
- aPath.ForeachFile((aFile) =>
+ foreach (var aPath in classPath)
+ if (aPath.IsValid && !aPath.Updating)
{
- aClass = aFile.GetPublicClass();
- if (!aClass.IsVoid() && aClass.IndexType == null && aClass.Access == Visibility.Public)
+ aPath.ForeachFile(aFile =>
{
- item = aClass.ToMemberModel();
- item.Name = item.Type;
- fullList.Add(item);
- }
- return true;
- });
- }
+ var aClass = aFile.GetPublicClass();
+ if (!aClass.IsVoid() && aClass.IndexType is null && aClass.Access == Visibility.Public)
+ {
+ var item = aClass.ToMemberModel();
+ item.Name = item.Type;
+ result.Add(item);
+ }
+ return true;
+ });
+ }
// void
- fullList.Add(new MemberModel(features.voidKey, features.voidKey, FlagType.Class | FlagType.Intrinsic, 0));
+ result.Add(new MemberModel(features.voidKey, features.voidKey, FlagType.Class | FlagType.Intrinsic, 0));
// in cache
- fullList.Sort();
- completionCache.AllTypes = fullList;
- return fullList;
+ result.Sort();
+ completionCache.AllTypes = result;
+ return result;
}
+
+ public override string GetDefaultValue(string type) => "undefined";
#endregion
#region command line compiler
- override public bool CanBuild
- {
- get { return cFile != null && cFile != FileModel.Ignore; }
- }
+ public override bool CanBuild => cFile != null && cFile != FileModel.Ignore;
///
/// Retrieve the context's default compiler path
///
- public override string GetCompilerPath()
- {
- if (as2settings != null) return as2settings.GetDefaultSDK().Path;
- else return null;
- }
+ public override string GetCompilerPath() => as2settings?.GetDefaultSDK().Path;
///
/// Check current file's syntax
///
public override void CheckSyntax()
{
- if (as2settings == null)
+ if (as2settings is null)
{
ErrorManager.ShowInfo(TextHelper.GetString("Info.FeatureMissing"));
return;
@@ -1273,26 +1257,25 @@ public override void CheckSyntax()
///
/// Run MTASC compiler in the current class's base folder with current classpath
///
- /// Additional comiler switches
+ /// Additional compiler switches
public override void RunCMD(string append)
{
- if (as2settings == null)
+ if (as2settings is null)
{
ErrorManager.ShowInfo(TextHelper.GetString("Info.FeatureMissing"));
return;
}
- if (!IsFileValid || !File.Exists(CurrentFile))
- return;
+ if (!IsFileValid || !File.Exists(CurrentFile)) return;
if (CurrentModel.Version != 2)
{
MessageBar.ShowWarning(TextHelper.GetString("Info.InvalidClass"));
return;
}
- string mtascPath = PluginBase.CurrentProject != null
- ? PluginBase.CurrentProject.CurrentSDK
- : PathHelper.ResolvePath(as2settings.GetDefaultSDK().Path);
+ var mtascPath = PluginBase.CurrentProject != null
+ ? PluginBase.CurrentProject.CurrentSDK
+ : PathHelper.ResolvePath(as2settings.GetDefaultSDK().Path);
if (!Directory.Exists(mtascPath) && !File.Exists(mtascPath))
{
@@ -1305,31 +1288,28 @@ public override void RunCMD(string append)
try
{
// save modified files if needed
- if (outputFile != null) MainForm.CallCommand("SaveAllModified", null);
- else MainForm.CallCommand("SaveAllModified", ".as");
-
+ PluginBase.MainForm.CallCommand("SaveAllModified", outputFile != null ? null : ".as");
+
// prepare command
string command = mtascPath;
if (Path.GetExtension(command) == "") command = Path.Combine(command, "mtasc.exe");
else mtascPath = Path.GetDirectoryName(mtascPath);
command += ";\"" + CurrentFile + "\"";
- if (append == null || append.IndexOf("-swf-version") < 0)
- command += " -version "+majorVersion;
+ if (append is null || !append.Contains("-swf-version")) command += " -version "+majorVersion;
// classpathes
- foreach(PathModel aPath in classPath)
- if (aPath.Path != temporaryPath
- && !aPath.Path.StartsWith(mtascPath, StringComparison.OrdinalIgnoreCase))
- command += " -cp \"" + aPath.Path.TrimEnd('\\') + "\"";
+ foreach(var aPath in classPath)
+ if (aPath.Path != temporaryPath
+ && !aPath.Path.StartsWith(mtascPath, StringComparison.OrdinalIgnoreCase))
+ command += " -cp \"" + aPath.Path.TrimEnd('\\') + "\"";
// run
- string filePath = NormalizePath(cFile.BasePath);
- if (PluginBase.CurrentProject != null)
- filePath = Path.GetDirectoryName(PluginBase.CurrentProject.ProjectPath);
- string workDir = MainForm.WorkingDirectory;
- MainForm.WorkingDirectory = filePath;
- MainForm.CallCommand("RunProcessCaptured", command+" "+append);
- MainForm.WorkingDirectory = workDir;
+ var filePath = NormalizePath(cFile.BasePath);
+ if (PluginBase.CurrentProject != null) filePath = Path.GetDirectoryName(PluginBase.CurrentProject.ProjectPath);
+ var workDir = PluginBase.MainForm.WorkingDirectory;
+ PluginBase.MainForm.WorkingDirectory = filePath;
+ PluginBase.MainForm.CallCommand("RunProcessCaptured", command+" "+append);
+ PluginBase.MainForm.WorkingDirectory = workDir;
}
catch (Exception ex)
{
@@ -1342,26 +1322,22 @@ public override void RunCMD(string append)
///
public override bool BuildCMD(bool failSilently)
{
- if (as2settings == null)
+ if (as2settings is null)
{
ErrorManager.ShowInfo(TextHelper.GetString("Info.FeatureMissing"));
return false;
}
- if (!File.Exists(CurrentFile))
- return false;
+ if (!File.Exists(CurrentFile)) return false;
// check if @mtasc is defined
Match mCmd = null;
- ClassModel cClass = cFile.GetPublicClass();
+ var cClass = cFile.GetPublicClass();
if (IsFileValid && cClass.Comments != null)
mCmd = re_CMD_BuildCommand.Match(cClass.Comments);
- if (CurrentModel.Version != 2 || mCmd == null || !mCmd.Success)
+ if (CurrentModel.Version != 2 || mCmd is null || !mCmd.Success)
{
- if (!failSilently)
- {
- MessageBar.ShowWarning(TextHelper.GetString("Info.InvalidForQuickBuild"));
- }
+ if (!failSilently) MessageBar.ShowWarning(TextHelper.GetString("Info.InvalidForQuickBuild"));
return false;
}
@@ -1370,11 +1346,10 @@ public override bool BuildCMD(bool failSilently)
try
{
command = Regex.Replace(command, "[\\r\\n]\\s*\\*", "", RegexOptions.Singleline);
- command = " " + MainForm.ProcessArgString(command) + " ";
+ command = " " + PluginBase.MainForm.ProcessArgString(command) + " ";
if (string.IsNullOrEmpty(command))
{
- if (!failSilently)
- throw new Exception(TextHelper.GetString("Info.InvalidQuickBuildCommand"));
+ if (!failSilently) throw new Exception(TextHelper.GetString("Info.InvalidQuickBuildCommand"));
return false;
}
outputFile = null;
@@ -1382,18 +1357,17 @@ public override bool BuildCMD(bool failSilently)
trustFileWanted = false;
// get SWF url
- MatchCollection mPar = re_SplitParams.Matches(command + "-eof");
- int mPlayIndex = -1;
- bool noPlay = false;
+ var mPar = re_SplitParams.Matches(command + "-eof");
+ var mPlayIndex = -1;
+ var noPlay = false;
if (mPar.Count > 0)
{
- string op;
for (int i = 0; i < mPar.Count; i++)
{
- op = mPar[i].Groups["switch"].Value;
+ var op = mPar[i].Groups["switch"].Value;
int start = mPar[i].Index + mPar[i].Length;
int end = (mPar.Count > i + 1) ? mPar[i + 1].Index : start;
- if ((op == "-swf") && (outputFile == null) && (mPlayIndex < 0))
+ if ((op == "-swf") && (outputFile is null) && (mPlayIndex < 0))
{
if (end > start)
outputFile = command.Substring(start, end - start).Trim();
@@ -1429,24 +1403,21 @@ public override bool BuildCMD(bool failSilently)
}
}
}
- if (outputFile.Length == 0) outputFile = null;
+ if (outputFile.IsNullOrEmpty()) outputFile = null;
// cleaning custom switches
if (mPlayIndex >= 0)
{
command = command.Substring(0, mPar[mPlayIndex].Index) + command.Substring(mPar[mPlayIndex + 1].Index);
}
- if (trustFileWanted)
- {
- command = command.Replace("-trust", "");
- }
+ if (trustFileWanted) command = command.Replace("-trust", "");
if (noPlay || !settings.PlayAfterBuild)
{
command = command.Replace("-noplay", "");
outputFile = null;
runAfterBuild = false;
}
- else runAfterBuild = (outputFile != null);
+ else runAfterBuild = outputFile != null;
// fixing output path
if (runAfterBuild)
@@ -1475,4 +1446,4 @@ public override bool BuildCMD(bool failSilently)
}
#endregion
}
-}
+}
\ No newline at end of file
diff --git a/External/Plugins/AS2Context/PluginMain.cs b/External/Plugins/AS2Context/PluginMain.cs
index 875029f90b..0e600c71a2 100644
--- a/External/Plugins/AS2Context/PluginMain.cs
+++ b/External/Plugins/AS2Context/PluginMain.cs
@@ -15,73 +15,47 @@ namespace AS2Context
{
public class PluginMain : IPlugin, InstalledSDKOwner
{
- private String pluginName = "AS2Context";
- private String pluginGuid = "1f387fab-421b-42ac-a985-72a03534f731";
- private String pluginHelp = "www.flashdevelop.org/community/";
- private String pluginDesc = "ActionScript 2 context for the ASCompletion engine.";
- private String pluginAuth = "FlashDevelop Team";
- private AS2Settings settingObject;
- private Context contextInstance;
- private String settingFilename;
+ AS2Settings settingObject;
+ Context contextInstance;
+ string settingFilename;
#region Required Properties
///
/// Api level of the plugin
///
- public Int32 Api
- {
- get { return 1; }
- }
+ public int Api => 1;
///
/// Name of the plugin
///
- public String Name
- {
- get { return this.pluginName; }
- }
+ public string Name { get; } = nameof(AS2Context);
///
/// GUID of the plugin
///
- public String Guid
- {
- get { return this.pluginGuid; }
- }
+ public string Guid { get; } = "1f387fab-421b-42ac-a985-72a03534f731";
///
/// Author of the plugin
///
- public String Author
- {
- get { return this.pluginAuth; }
- }
+ public string Author { get; } = "FlashDevelop Team";
///
/// Description of the plugin
///
- public String Description
- {
- get { return this.pluginDesc; }
- }
+ public string Description { get; set; } = "ActionScript 2 context for the ASCompletion engine.";
///
/// Web address for help
///
- public String Help
- {
- get { return this.pluginHelp; }
- }
+ public string Help { get; } = "https://www.flashdevelop.org/community/";
///
/// Object that contains the settings
///
[Browsable(false)]
- public Object Settings
- {
- get { return this.settingObject; }
- }
+ public object Settings => settingObject;
#endregion
@@ -92,23 +66,20 @@ public Object Settings
///
public void Initialize()
{
- this.InitBasics();
- this.LoadSettings();
- this.AddEventHandlers();
+ InitBasics();
+ LoadSettings();
+ AddEventHandlers();
}
///
/// Disposes the plugin
///
- public void Dispose()
- {
- this.SaveSettings();
- }
+ public void Dispose() => SaveSettings();
///
/// Handles the incoming events
///
- public void HandleEvent(Object sender, NotifyEvent e, HandlingPriority priority)
+ public void HandleEvent(object sender, NotifyEvent e, HandlingPriority priority)
{
switch (e.Type)
{
@@ -130,70 +101,58 @@ public void HandleEvent(Object sender, NotifyEvent e, HandlingPriority priority)
///
public void InitBasics()
{
- String dataPath = Path.Combine(PathHelper.DataDir, "AS2Context");
- if (!Directory.Exists(dataPath)) Directory.CreateDirectory(dataPath);
- this.settingFilename = Path.Combine(dataPath, "Settings.fdb");
- this.pluginDesc = TextHelper.GetString("Info.Description");
+ var path = Path.Combine(PathHelper.DataDir, nameof(AS2Context));
+ if (!Directory.Exists(path)) Directory.CreateDirectory(path);
+ settingFilename = Path.Combine(path, "Settings.fdb");
+ Description = TextHelper.GetString("Info.Description");
}
///
/// Adds the required event handlers
///
- public void AddEventHandlers()
- {
- EventManager.AddEventHandler(this, EventType.UIStarted);
- }
+ public void AddEventHandlers() => EventManager.AddEventHandler(this, EventType.UIStarted);
///
/// Loads the plugin settings
///
public void LoadSettings()
{
- this.settingObject = new AS2Settings();
- if (!File.Exists(this.settingFilename)) this.SaveSettings();
+ settingObject = new AS2Settings();
+ if (!File.Exists(settingFilename)) SaveSettings();
else
{
- Object obj = ObjectSerializer.Deserialize(this.settingFilename, this.settingObject);
- this.settingObject = (AS2Settings)obj;
+ settingObject = ObjectSerializer.Deserialize(settingFilename, settingObject);
if (settingObject.InstalledSDKs != null)
- foreach (InstalledSDK sdk in settingObject.InstalledSDKs)
+ foreach (var sdk in settingObject.InstalledSDKs)
sdk.Owner = this;
}
- if (this.settingObject.MMClassPath == null) this.settingObject.MMClassPath = FindMMClassPath();
- if (this.settingObject.UserClasspath == null)
- {
- if (this.settingObject.MMClassPath != null) this.settingObject.UserClasspath = new String[] { this.settingObject.MMClassPath };
- else this.settingObject.UserClasspath = new String[] {};
- }
+ settingObject.MMClassPath ??= FindMMClassPath();
+ settingObject.UserClasspath ??= settingObject.MMClassPath != null
+ ? new[] {settingObject.MMClassPath}
+ : Array.Empty();
}
///
/// Fix some settings values when the context has been created
///
- private void ValidateSettings()
+ void ValidateSettings()
{
- if (settingObject.InstalledSDKs == null || settingObject.InstalledSDKs.Length == 0)
+ if (settingObject.InstalledSDKs.IsNullOrEmpty())
{
- List allSdks = new List();
- string includedSDK = "Tools\\mtasc";
+ var allSdks = new List();
+ var includedSDK = "Tools\\mtasc";
if (Directory.Exists(PathHelper.ResolvePath(includedSDK)))
{
- InstalledSDK sdk = new InstalledSDK(this);
- sdk.Path = includedSDK;
- allSdks.Add(sdk);
+ allSdks.Add(new InstalledSDK(this) {Path = includedSDK});
}
- string appManDir = Path.Combine(PathHelper.BaseDir, @"Data\AppMan\Archive\mtasc");
+ var appManDir = Path.Combine(PathHelper.BaseDir, @"Data\AppMan\Archive\mtasc");
if (Directory.Exists(appManDir))
{
- string[] versionDirs = Directory.GetDirectories(appManDir);
- foreach (string versionDir in versionDirs)
+ var versionDirs = Directory.GetDirectories(appManDir);
+ foreach (var versionDir in versionDirs)
{
- if (Directory.Exists(versionDir))
- {
- InstalledSDK sdk = new InstalledSDK(this);
- sdk.Path = versionDir;
- allSdks.Add(sdk);
- }
+ if (!Directory.Exists(versionDir)) continue;
+ allSdks.Add(new InstalledSDK(this) {Path = versionDir});
}
}
settingObject.InstalledSDKs = allSdks.ToArray();
@@ -211,18 +170,12 @@ private void ValidateSettings()
///
/// Update the classpath if an important setting has changed
///
- private void SettingObjectOnClasspathChanged()
- {
- if (contextInstance != null) contextInstance.BuildClassPath();
- }
+ void SettingObjectOnClasspathChanged() => contextInstance?.BuildClassPath();
///
/// Saves the plugin settings
///
- public void SaveSettings()
- {
- ObjectSerializer.Serialize(this.settingFilename, this.settingObject);
- }
+ public void SaveSettings() => ObjectSerializer.Serialize(settingFilename, settingObject);
#endregion
@@ -232,16 +185,15 @@ public bool ValidateSDK(InstalledSDK sdk)
{
sdk.Owner = this;
- IProject project = PluginBase.CurrentProject;
- string path = sdk.Path;
- if (project != null)
- path = PathHelper.ResolvePath(path, Path.GetDirectoryName(project.ProjectPath));
- else
- path = PathHelper.ResolvePath(path);
+ var project = PluginBase.CurrentProject;
+ var path = sdk.Path;
+ path = project != null
+ ? PathHelper.ResolvePath(path, Path.GetDirectoryName(project.ProjectPath))
+ : PathHelper.ResolvePath(path);
try
{
- if (path == null || (!Directory.Exists(path) && !File.Exists(path)))
+ if (!Directory.Exists(path) && !File.Exists(path))
{
ErrorManager.ShowInfo("Path not found:\n" + sdk.Path);
return false;
@@ -254,18 +206,18 @@ public bool ValidateSDK(InstalledSDK sdk)
}
if (!Directory.Exists(path)) path = Path.GetDirectoryName(path);
- string descriptor = Path.Combine(path, "changes.txt");
+ var descriptor = Path.Combine(path, "changes.txt");
if (File.Exists(descriptor))
{
- string raw = File.ReadAllText(descriptor);
- Match mVer = Regex.Match(raw, "[0-9\\-]+\\s*:\\s*([0-9.]+)");
+ var text = File.ReadAllText(descriptor);
+ var mVer = Regex.Match(text, "[0-9\\-]+\\s*:\\s*([0-9.]+)");
if (mVer.Success)
{
sdk.Version = mVer.Groups[1].Value;
- sdk.Name = "MTASC " + sdk.Version;
+ sdk.Name = $"MTASC {sdk.Version}";
return true;
}
- else ErrorManager.ShowInfo("Invalid changes.txt file:\n" + descriptor);
+ ErrorManager.ShowInfo("Invalid changes.txt file:\n" + descriptor);
}
else ErrorManager.ShowInfo("No changes.txt found:\n" + descriptor);
return false;
@@ -276,7 +228,7 @@ public bool ValidateSDK(InstalledSDK sdk)
#region Macromedia/Adobe Flash IDE
// locations in Application Data
- static readonly private string[] MACROMEDIA_VERSIONS = {
+ static readonly string[] MACROMEDIA_VERSIONS = {
"\\Adobe\\Flash CS5\\",
"\\Adobe\\Flash CS4\\",
"\\Adobe\\Flash CS3\\",
@@ -287,7 +239,7 @@ public bool ValidateSDK(InstalledSDK sdk)
///
/// Explore the possible locations for the Macromedia Flash IDE classpath
///
- static private string FindMMClassPath()
+ static string FindMMClassPath()
{
bool found = false;
string deflang = CultureInfo.CurrentUICulture.Name;
@@ -306,7 +258,7 @@ static private string FindMMClassPath()
// look for other languages
else if (Directory.Exists(cp))
{
- string[] dirs = Directory.GetDirectories(cp);
+ var dirs = Directory.GetDirectories(cp);
foreach (string dir in dirs)
{
if (Directory.Exists(dir + "\\Configuration\\Classes\\"))
@@ -319,12 +271,8 @@ static private string FindMMClassPath()
}
if (found) break;
}
- if (found) return cp;
- else return null;
+ return found ? cp : null;
}
#endregion
-
}
-
-}
-
+}
\ No newline at end of file
diff --git a/External/Plugins/AS2Context/Properties/AssemblyInfo.cs b/External/Plugins/AS2Context/Properties/AssemblyInfo.cs
index be6905b884..1bef6c04ea 100644
--- a/External/Plugins/AS2Context/Properties/AssemblyInfo.cs
+++ b/External/Plugins/AS2Context/Properties/AssemblyInfo.cs
@@ -4,7 +4,7 @@
// Information about this assembly is defined by the following attributes.
// Change them to the information which is associated with the assembly you compile.
[assembly: AssemblyTitle("AS2Context")]
-[assembly: AssemblyDescription("AS2Context Plugin For ASCompletion In " + DistroConfig.DISTRIBUTION_NAME)]
+[assembly: AssemblyDescription("AS2 Context Plugin For ASCompletion In " + DistroConfig.DISTRIBUTION_NAME)]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany(DistroConfig.DISTRIBUTION_COMPANY)]
[assembly: AssemblyProduct("AS2Context")]
diff --git a/External/Plugins/AS3Context/AS3Context.csproj b/External/Plugins/AS3Context/AS3Context.csproj
index 587d80d04f..f73ae9a4b6 100644
--- a/External/Plugins/AS3Context/AS3Context.csproj
+++ b/External/Plugins/AS3Context/AS3Context.csproj
@@ -1,179 +1,146 @@
-
-
- Debug
- AnyCPU
- 9.0.30729
- 2.0
- {0263E5F6-D5B2-4118-B12E-87F9A74DE8AF}
- Library
- Properties
- AS3Context
- AS3Context
-
-
-
-
- 3.5
-
-
- v3.5
-
- publish\
- true
- Disk
- false
- Foreground
- 7
- Days
- false
- false
- true
- 0
- 1.0.0.%2a
- false
- false
- true
-
-
- true
- full
- false
- ..\..\..\FlashDevelop\Bin\Debug\Plugins\
- DEBUG;TRACE
- prompt
- 4
-
-
- pdbonly
- true
- ..\..\..\FlashDevelop\Bin\Debug\Plugins\
- TRACE
- prompt
- 4
-
-
- x86
- ..\..\..\FlashDevelop\Bin\Debug\Plugins\
-
-
- x86
- ..\..\..\FlashDevelop\Bin\Debug\Plugins\
- TRACE
- true
-
-
-
-
-
-
-
-
-
-
-
-
-
- Component
-
-
-
-
- UserControl
-
-
- ProfilerUI.cs
-
-
- Component
-
-
- Component
-
-
-
-
-
-
-
-
- False
- ..\..\..\FlashDevelop\Bin\Debug\Aga.dll
- False
-
-
- False
- ..\..\..\FlashDevelop\Bin\Debug\SwfOp.dll
- False
-
-
-
-
-
-
-
-
- {61885F70-B4DC-4B44-852D-5D6D03F2A734}
- PluginCore
- False
-
-
- {74AD0487-CEF9-43FE-9283-BC6F79539ADE}
- AS2Context
- False
-
-
- {4EBF2653-9654-4E40-880E-0046B3D6210E}
- ASCompletion
- False
-
-
- {D6AAF434-F4DF-4376-863D-109A8762CECA}
- FlashConnect
- False
-
-
- {78101C01-E186-4954-B1DD-DEBB7905FAD8}
- ProjectManager
- False
-
-
- {556F43A0-C288-471A-8CD8-A787FC7ACA34}
- XMLCompletion
-
-
-
-
-
-
-
-
-
-
- False
- Microsoft .NET Framework 4 %28x86 and x64%29
- true
-
-
- False
- .NET Framework 3.5 SP1 Client Profile
- false
-
-
- False
- .NET Framework 3.5 SP1
- false
-
-
- False
- Windows Installer 3.1
- true
-
-
+
+
+
+ Debug
+ AnyCPU
+ {0263E5F6-D5B2-4118-B12E-87F9A74DE8AF}
+ Library
+ Properties
+ AS3Context
+ AS3Context
+ net48
+ true
+ false
+ false
+ false
+ false
+ x64;x86;AnyCPU
+
+
+ true
+ full
+ false
+ ..\..\..\FlashDevelop\Bin\Debug\Plugins\
+ DEBUG;TRACE
+ prompt
+ 4
+ 9
+
+
+ none
+ true
+ ..\..\..\FlashDevelop\Bin\Debug\Plugins\
+ TRACE
+ prompt
+ 4
+ 9
+
+
+ x86
+ ..\..\..\FlashDevelop\Bin\Debug\Plugins\
+ DEBUG;TRACE
+ 9
+
+
+ x86
+ ..\..\..\FlashDevelop\Bin\Debug\Plugins\
+ TRACE
+ true
+ 9
+
+
+ true
+ ..\..\..\FlashDevelop\Bin\Debug\Plugins\
+ DEBUG;TRACE
+ full
+ x64
+ 9
+ prompt
+
+
+ ..\..\..\FlashDevelop\Bin\Debug\Plugins\
+ TRACE
+ true
+ x64
+ 9
+ prompt
+
+
+
+
+
+
+
+
+
+
+
+
+
+ UserControl
+
+
+ ProfilerUI.cs
+
+
+ Component
+
+
+
+
+
+
+
+
+ False
+ ..\..\..\FlashDevelop\Bin\Debug\Aga.dll
+ False
+
+
+ False
+ ..\..\..\FlashDevelop\Bin\Debug\SwfOp.dll
+ False
+
+
+
+
+
+
+
+
+ {61885F70-B4DC-4B44-852D-5D6D03F2A734}
+ PluginCore
+ False
+
+
+ {74AD0487-CEF9-43FE-9283-BC6F79539ADE}
+ AS2Context
+ False
+
+
+ {4EBF2653-9654-4E40-880E-0046B3D6210E}
+ ASCompletion
+ False
+
+
+ {D6AAF434-F4DF-4376-863D-109A8762CECA}
+ FlashConnect
+ False
+
+
+ {78101C01-E186-4954-B1DD-DEBB7905FAD8}
+ ProjectManager
+ False
+
+
+ {556F43A0-C288-471A-8CD8-A787FC7ACA34}
+ XMLCompletion
+ False
+
+
+
+
+
+
\ No newline at end of file
diff --git a/External/Plugins/AS3Context/AS3Settings.cs b/External/Plugins/AS3Context/AS3Settings.cs
index 5bf40464bf..8324303e08 100644
--- a/External/Plugins/AS3Context/AS3Settings.cs
+++ b/External/Plugins/AS3Context/AS3Settings.cs
@@ -31,8 +31,8 @@ public class AS3Settings : IContextSettings
[LocalizedCategory("ASCompletion.Category.Documentation"), LocalizedDescription("ASCompletion.Description.DocumentationCommandLine"), DefaultValue(DEFAULT_DOC_COMMAND)]
public string DocumentationCommandLine
{
- get { return documentationCommandLine; }
- set { documentationCommandLine = value; }
+ get => documentationCommandLine;
+ set => documentationCommandLine = value;
}
#endregion
@@ -57,46 +57,34 @@ public string DocumentationCommandLine
protected bool generateImports = DEFAULT_GENERATEIMPORTS;
protected bool playAfterBuild = DEFAULT_PLAY;
protected bool fixPackageAutomatically = DEFAULT_FIXPACKAGEAUTOMATICALLY;
- protected string[] userClasspath = null;
- protected InstalledSDK[] installedSDKs = null;
+ protected string[] userClasspath;
+ protected InstalledSDK[] installedSDKs;
[Browsable(false)]
- public string LanguageId
- {
- get { return "AS3"; }
- }
+ public string LanguageId => "AS3";
[Browsable(false)]
- public string DefaultExtension
- {
- get { return ".as"; }
- }
+ public string DefaultExtension => ".as";
[Browsable(false)]
- public string CheckSyntaxRunning
- {
- get { return TextHelper.GetString("Info.MxmlcRunning"); }
- }
+ public string CheckSyntaxRunning => TextHelper.GetString("Info.MxmlcRunning");
[Browsable(false)]
- public string CheckSyntaxDone
- {
- get { return TextHelper.GetString("Info.MxmlcDone"); }
- }
+ public string CheckSyntaxDone => TextHelper.GetString("Info.MxmlcDone");
[DisplayName("Check Syntax On Save")]
[LocalizedCategory("ASCompletion.Category.Common"), LocalizedDescription("ASCompletion.Description.CheckSyntaxOnSave"), DefaultValue(DEFAULT_CHECKSYNTAX)]
public bool CheckSyntaxOnSave
{
- get { return checkSyntaxOnSave; }
- set { checkSyntaxOnSave = value; }
+ get => checkSyntaxOnSave;
+ set => checkSyntaxOnSave = value;
}
[DisplayName("User Classpath")]
[LocalizedCategory("ASCompletion.Category.Common"), LocalizedDescription("ASCompletion.Description.UserClasspath"), DefaultValue(DEFAULT_AS3LIBRARY)]
public string[] UserClasspath
{
- get { return userClasspath; }
+ get => userClasspath;
set
{
userClasspath = value;
@@ -108,20 +96,18 @@ public string[] UserClasspath
[LocalizedCategory("ASCompletion.Category.Language"), LocalizedDescription("AS3Context.Description.FlexSDK")]
public InstalledSDK[] InstalledSDKs
{
- get { return installedSDKs; }
+ get => installedSDKs;
set
{
installedSDKs = value;
FireChanged();
- if (OnInstalledSDKsChanged != null) OnInstalledSDKsChanged();
+ OnInstalledSDKsChanged?.Invoke();
}
}
public InstalledSDK GetDefaultSDK()
{
- if (installedSDKs == null || installedSDKs.Length == 0)
- return InstalledSDK.INVALID_SDK;
-
+ if (installedSDKs.IsNullOrEmpty()) return InstalledSDK.INVALID_SDK;
foreach (InstalledSDK sdk in installedSDKs)
if (sdk.IsValid) return sdk;
return InstalledSDK.INVALID_SDK;
@@ -131,56 +117,56 @@ public InstalledSDK GetDefaultSDK()
[LocalizedCategory("ASCompletion.Category.Common"), LocalizedDescription("ASCompletion.Description.CompletionEnabled"), DefaultValue(DEFAULT_COMPLETIONENABLED)]
public bool CompletionEnabled
{
- get { return completionEnabled; }
- set { completionEnabled = value; }
+ get => completionEnabled;
+ set => completionEnabled = value;
}
[DisplayName("Generate Imports")]
[LocalizedCategory("ASCompletion.Category.Common"), LocalizedDescription("ASCompletion.Description.GenerateImports"), DefaultValue(DEFAULT_GENERATEIMPORTS)]
public bool GenerateImports
{
- get { return generateImports; }
- set { generateImports = value; }
+ get => generateImports;
+ set => generateImports = value;
}
[DisplayName("List All Types In Completion")]
[LocalizedCategory("ASCompletion.Category.Common"), LocalizedDescription("ASCompletion.Description.CompletionListAllTypes"), DefaultValue(DEFAULT_LISTALL)]
public bool CompletionListAllTypes
{
- get { return completionListAllTypes; }
- set { completionListAllTypes = value; }
+ get => completionListAllTypes;
+ set => completionListAllTypes = value;
}
[DisplayName("Show Qualified Types In Completion")]
[LocalizedCategory("ASCompletion.Category.Common"), LocalizedDescription("ASCompletion.Description.CompletionShowQualifiedTypes"), DefaultValue(DEFAULT_QUALIFY)]
public bool CompletionShowQualifiedTypes
{
- get { return completionShowQualifiedTypes; }
- set { completionShowQualifiedTypes = value; }
+ get => completionShowQualifiedTypes;
+ set => completionShowQualifiedTypes = value;
}
[DisplayName("Lazy Classpath Exploration")]
[LocalizedCategory("ASCompletion.Category.Common"), LocalizedDescription("ASCompletion.Description.LazyClasspathExploration"), DefaultValue(DEFAULT_LAZYMODE)]
public bool LazyClasspathExploration
{
- get { return lazyClasspathExploration; }
- set { lazyClasspathExploration = value; }
+ get => lazyClasspathExploration;
+ set => lazyClasspathExploration = value;
}
[DisplayName("Play After Build")]
[LocalizedCategory("ASCompletion.Category.Common"), LocalizedDescription("ASCompletion.Description.PlayAfterBuild"), DefaultValue(DEFAULT_PLAY)]
public bool PlayAfterBuild
{
- get { return playAfterBuild; }
- set { playAfterBuild = value; }
+ get => playAfterBuild;
+ set => playAfterBuild = value;
}
[DisplayName("Fix Package Automatically")]
[LocalizedCategory("ASCompletion.Category.Common"), LocalizedDescription("ASCompletion.Description.FixPackageAutomatically"), DefaultValue(DEFAULT_FIXPACKAGEAUTOMATICALLY)]
public bool FixPackageAutomatically
{
- get { return fixPackageAutomatically; }
- set { fixPackageAutomatically = value; }
+ get => fixPackageAutomatically;
+ set => fixPackageAutomatically = value;
}
#endregion
@@ -189,15 +175,15 @@ public bool FixPackageAutomatically
const string DEFAULT_FLASHVERSION = "14.0";
- private string flashVersion = DEFAULT_FLASHVERSION;
- private string as3ClassPath;
- private string[] as3FileTypes;
+ string flashVersion = DEFAULT_FLASHVERSION;
+ string as3ClassPath;
+ string[] as3FileTypes;
[DisplayName("Default Flash Version")]
[LocalizedCategory("ASCompletion.Category.Language"), LocalizedDescription("AS3Context.Description.DefaultFlashVersion"), DefaultValue(DEFAULT_FLASHVERSION)]
public string DefaultFlashVersion
{
- get { return flashVersion ?? DEFAULT_FLASHVERSION; }
+ get => flashVersion ?? DEFAULT_FLASHVERSION;
set
{
if (value == flashVersion) return;
@@ -211,7 +197,7 @@ public string DefaultFlashVersion
[Editor(typeof(VistaFolderNameEditor), typeof(UITypeEditor))]
public string AS3ClassPath
{
- get { return as3ClassPath; }
+ get => as3ClassPath;
set
{
if (value == as3ClassPath) return;
@@ -224,7 +210,7 @@ public string AS3ClassPath
[LocalizedCategory("ASCompletion.Category.Language"), LocalizedDescription("AS3Context.Description.AS3FileTypes")]
public string[] AS3FileTypes
{
- get { return as3FileTypes; }
+ get => as3FileTypes;
set
{
if (value == as3FileTypes) return;
@@ -237,23 +223,23 @@ public string[] AS3FileTypes
#region Profiler settings
const int DEFAULT_PROFILER_TIMEOUT = 30;
- private int profilerTimeout;
- private string[] customProfilers;
+ int profilerTimeout;
+ string[] customProfilers;
[DisplayName("Profiler Timeout")]
[LocalizedCategory("AS3Context.Category.Profiler"), LocalizedDescription("AS3Context.Description.ProfilerTimeout"), DefaultValue(DEFAULT_PROFILER_TIMEOUT)]
public int ProfilerTimeout
{
- get { return profilerTimeout; }
- set { profilerTimeout = Math.Max(5, value); }
+ get => profilerTimeout;
+ set => profilerTimeout = Math.Max(5, value);
}
[DisplayName("Custom Profilers")]
[LocalizedCategory("AS3Context.Category.Profiler"), LocalizedDescription("AS3Context.Description.CustomProfilers")]
public string[] CustomProfilers
{
- get { return customProfilers; }
- set { customProfilers = value; }
+ get => customProfilers;
+ set => customProfilers = value;
}
#endregion
@@ -263,39 +249,39 @@ public string[] CustomProfilers
const bool DEFAULT_VERBOSEFDB = false;
const bool DEFAULT_DISABLELIVECHECKING = false;
- private bool disableFDB;
- private bool verboseFDB;
- private bool disableLiveChecking;
+ bool disableFDB;
+ bool verboseFDB;
+ bool disableLiveChecking;
[DisplayName("Disable Flex Debugger Hosting")]
[LocalizedCategory("ASCompletion.Category.Language"), LocalizedDescription("ASCompletion.Description.DisableFDB"), DefaultValue(DEFAULT_DISABLEFDB)]
public bool DisableFDB
{
- get { return disableFDB; }
- set { disableFDB = value; }
+ get => disableFDB;
+ set => disableFDB = value;
}
[DisplayName("Verbose Flex Debugger Output")]
[LocalizedCategory("ASCompletion.Category.Language"), LocalizedDescription("ASCompletion.Description.VerboseFDB"), DefaultValue(DEFAULT_VERBOSEFDB)]
public bool VerboseFDB
{
- get { return verboseFDB; }
- set { verboseFDB = value; }
+ get => verboseFDB;
+ set => verboseFDB = value;
}
[DisplayName("Disable Live Syntax Checking")]
[LocalizedCategory("ASCompletion.Category.Language"), LocalizedDescription("ASCompletion.Description.DisableLiveSyntaxChecking"), DefaultValue(DEFAULT_DISABLELIVECHECKING)]
public bool DisableLiveChecking
{
- get { return disableLiveChecking; }
- set { disableLiveChecking = value; }
+ get => disableLiveChecking;
+ set => disableLiveChecking = value;
}
#endregion
- private void FireChanged()
- {
- if (OnClasspathChanged != null) OnClasspathChanged();
- }
+ void FireChanged() => OnClasspathChanged?.Invoke();
+
+ [Browsable(false)]
+ public string AddSpaceAfter { get; set; }
}
}
diff --git a/External/Plugins/AS3Context/AbcConverter.cs b/External/Plugins/AS3Context/AbcConverter.cs
index 4ef22ee043..fedca48311 100644
--- a/External/Plugins/AS3Context/AbcConverter.cs
+++ b/External/Plugins/AS3Context/AbcConverter.cs
@@ -7,6 +7,7 @@
using System.Xml;
using ASCompletion.Context;
using ASCompletion.Model;
+using PluginCore;
using SwfOp;
using SwfOp.Data;
@@ -16,34 +17,24 @@ namespace AS3Context
public class AbcConverter
{
- static public List ExcludedASDocs = getDefaultExcludedASDocs();
+ public static List ExcludedASDocs = new() {"helpid", "keyword"};
- static public Regex reSafeChars = new Regex("[*\\:" + Regex.Escape(new String(Path.GetInvalidPathChars())) + "]", RegexOptions.Compiled);
- static private Regex reDocFile = new Regex("[/\\\\]([-_.$a-z0-9]+)\\.xml", RegexOptions.IgnoreCase | RegexOptions.Compiled);
+ public static Regex reSafeChars = new Regex("[*\\:" + Regex.Escape(new string(Path.GetInvalidPathChars())) + "]", RegexOptions.Compiled);
+ static readonly Regex reDocFile = new Regex("[/\\\\]([-_.$a-z0-9]+)\\.xml", RegexOptions.IgnoreCase | RegexOptions.Compiled);
- static public Dictionary> Docs = new Dictionary>();
+ public static Dictionary> Docs = new Dictionary>();
- private static Dictionary genericTypes;
- private static Dictionary imports;
- private static Dictionary conflicts;
- private static bool inSWF;
- private static Dictionary thisDocs;
- private static string docPath;
-
- ///
- private static List getDefaultExcludedASDocs()
- {
- List list = new List();
- list.Add("helpid");
- list.Add("keyword");
- return list;
- }
+ static Dictionary genericTypes;
+ static Dictionary imports;
+ static Dictionary conflicts;
+ static bool inSWF;
+ static Dictionary thisDocs;
+ static string docPath;
///
/// Extract documentation from XML included in ASDocs-enriched SWCs
///
- ///
- private static void ParseDocumentation(ContentParser parser)
+ static void ParseDocumentation(ContentParser parser)
{
if (parser.Catalog != null)
{
@@ -53,25 +44,21 @@ private static void ParseDocumentation(ContentParser parser)
if (parser.Docs.Count > 0)
foreach (string docFile in parser.Docs.Keys)
{
- if (docFile.EndsWith(".dita.xml"))
+ if (docFile.EndsWithOrdinal(".dita.xml"))
continue;
try
{
- Match m = reDocFile.Match(docFile);
+ var m = reDocFile.Match(docFile);
if (!m.Success) continue;
- string package = m.Groups[1].Value;
- Dictionary packageDocs = Docs.ContainsKey(package)
- ? Docs[package]
- : new Dictionary();
-
- byte[] rawDoc = parser.Docs[docFile];
- ASDocsReader dr = new ASDocsReader(rawDoc);
- dr.ExcludedASDocs = ExcludedASDocs;
+ var package = m.Groups[1].Value;
+ if (!Docs.TryGetValue(package, out var packageDocs))
+ packageDocs = new Dictionary();
+ var rawDoc = parser.Docs[docFile];
+ var dr = new ASDocsReader(rawDoc) {ExcludedASDocs = ExcludedASDocs};
dr.Parse(packageDocs);
-
Docs[package] = packageDocs;
}
- catch (Exception)
+ catch
{
}
}
@@ -80,7 +67,7 @@ private static void ParseDocumentation(ContentParser parser)
///
/// Create virtual FileModel objects from Abc bytecode
///
- ///
+ ///
///
///
public static void Convert(ContentParser parser, PathModel path, IASContext context)
@@ -91,10 +78,12 @@ public static void Convert(ContentParser parser, PathModel path, IASContext cont
ParseDocumentation(parser);
// extract models
- Dictionary models = new Dictionary();
- FileModel privateClasses = new FileModel(Path.Combine(path.Path, "__Private.as"));
- privateClasses.Version = 3;
- privateClasses.Package = "private";
+ var models = new Dictionary();
+ var privateClasses = new FileModel(Path.Combine(path.Path, "__Private.as"))
+ {
+ Version = 3,
+ Package = "private"
+ };
genericTypes = new Dictionary();
imports = new Dictionary();
conflicts = new Dictionary();
@@ -105,8 +94,7 @@ public static void Convert(ContentParser parser, PathModel path, IASContext cont
foreach (Traits trait in abc.classes)
{
Traits instance = trait.itraits;
- if (instance == null)
- continue;
+ if (instance is null) continue;
imports.Clear();
conflicts.Clear();
@@ -115,13 +103,11 @@ public static void Convert(ContentParser parser, PathModel path, IASContext cont
model.Package = reSafeChars.Replace(instance.name.uri, "_");
model.HasPackage = true;
string filename = reSafeChars.Replace(trait.name.ToString(), "_").TrimEnd('$');
- filename = Path.Combine(model.Package.Replace('.', Path.DirectorySeparatorChar), filename);
- model.FileName = Path.Combine(path.Path, filename);
+ model.FileName = Path.Combine(path.Path, model.Package.Replace('.', Path.DirectorySeparatorChar), filename);
model.Version = 3;
ClassModel type = new ClassModel();
- model.Classes = new List();
- model.Classes.Add(type);
+ model.Classes = new List {type};
type.InFile = model;
type.Type = instance.name.ToTypeString();
@@ -145,20 +131,19 @@ public static void Convert(ContentParser parser, PathModel path, IASContext cont
if (thisDocs != null)
{
docPath = (model.Package.Length > 0 ? model.Package + ":" : "globalClassifier:") + type.Name;
- if (thisDocs.ContainsKey(docPath))
+ if (thisDocs.TryGetValue(docPath, out var doc))
{
- ASDocItem doc = thisDocs[docPath];
- applyASDoc(doc, type);
- if (doc.Meta != null) model.MetaDatas = doc.Meta;
+ ApplyASDoc(doc, type);
+ if (doc.Meta != null) type.MetaDatas = doc.Meta;
}
if (model.Package.Length == 0) docPath = type.Name;
}
- if (instance.baseName.uri == model.Package)
- type.ExtendsType = ImportType(instance.baseName.localName);
- else type.ExtendsType = ImportType(instance.baseName);
+ type.ExtendsType = instance.baseName.uri == model.Package
+ ? ImportType(instance.baseName.localName)
+ : ImportType(instance.baseName);
- if (instance.interfaces != null && instance.interfaces.Length > 0)
+ if (!instance.interfaces.IsNullOrEmpty())
{
type.Implements = new List();
foreach (QName name in instance.interfaces)
@@ -177,22 +162,22 @@ public static void Convert(ContentParser parser, PathModel path, IASContext cont
type.Access = Visibility.Private;
type.Namespace = "private";
string genType = type.Name;
- if (type.Name.IndexOf("$") > 0)
+ if (type.Name.IndexOf('$') > 0)
{
string[] itype = type.Name.Split('$');
genType = itype[0];
type.Name = itype[0] + "$" + itype[1];
type.IndexType = itype[1];
}
- if (genericTypes.ContainsKey(genType))
+ if (genericTypes.TryGetValue(genType, out var inFile))
{
model.Classes.Clear();
- type.InFile = genericTypes[genType];
+ type.InFile = inFile;
genericTypes[genType].Classes.Add(type);
}
else genericTypes[genType] = model;
}
- else if (type.Name.StartsWith("_") && string.IsNullOrEmpty(model.Package))
+ else if (type.Name.StartsWith('_') && string.IsNullOrEmpty(model.Package))
{
type.Access = Visibility.Private;
type.Namespace = "private";
@@ -210,7 +195,7 @@ public static void Convert(ContentParser parser, PathModel path, IASContext cont
{
// TODO properly support interface multiple inheritance
type.ExtendsType = null;
- if (type.Implements != null && type.Implements.Count > 0)
+ if (!type.Implements.IsNullOrEmpty())
{
type.ExtendsType = type.Implements[0];
type.Implements.RemoveAt(0);
@@ -239,8 +224,6 @@ public static void Convert(ContentParser parser, PathModel path, IASContext cont
type.Members.Merge(result);
type.Constructor = ctor.Name;
}
- result = null;
- temp = null;
}
else type.Constructor = type.Name;
@@ -258,37 +241,31 @@ public static void Convert(ContentParser parser, PathModel path, IASContext cont
}
// packages
- if (abc.scripts == null)
- continue;
- foreach (Traits trait in abc.scripts)
+ if (abc.scripts is null) continue;
+ foreach (var trait in abc.scripts)
{
FileModel model = null;
- foreach (MemberInfo info in trait.members)
+ foreach (var info in trait.members)
{
- if (info.kind == TraitMember.Class)
- continue;
-
- MemberModel member = GetMember(info, 0);
- if (member == null) continue;
-
- if (model == null || model.Package != info.name.uri)
+ if (info.kind == TraitMember.Class) continue;
+ var member = GetMember(info, 0);
+ if (member is null) continue;
+ if (model is null || model.Package != info.name.uri)
{
AddImports(model, imports);
-
- string package = info.name.uri ?? "";
- string filename = package.Length > 0 ? "package.as" : "toplevel.as";
- filename = Path.Combine(package.Replace('.', Path.DirectorySeparatorChar), filename);
- filename = Path.Combine(path.Path, filename);
- if (models.ContainsKey(filename))
- model = models[filename];
- else
+ var package = info.name.uri ?? "";
+ var filename = package.Length > 0 ? "package.as" : "toplevel.as";
+ filename = Path.Combine(path.Path, package.Replace('.', Path.DirectorySeparatorChar), filename);
+ if (!models.TryGetValue(filename, out model))
{
- model = new FileModel("");
- model.Context = context;
- model.Package = package;
- model.HasPackage = true;
- model.FileName = filename;
- model.Version = 3;
+ model = new FileModel
+ {
+ Context = context,
+ Package = package,
+ HasPackage = true,
+ FileName = filename,
+ Version = 3
+ };
models[filename] = model;
}
}
@@ -298,20 +275,17 @@ public static void Convert(ContentParser parser, PathModel path, IASContext cont
{
docPath = "globalOperation:" + (model.Package.Length > 0 ? model.Package + ":" : "")
+ member.Name;
- if (member.Access == Visibility.Public && !String.IsNullOrEmpty(member.Namespace)
+ if (member.Access == Visibility.Public && !string.IsNullOrEmpty(member.Namespace)
&& member.Namespace != "public")
docPath += member.Namespace + ":";
if ((member.Flags & FlagType.Setter) > 0) docPath += ":set";
else if ((member.Flags & FlagType.Getter) > 0) docPath += ":get";
-
- if (thisDocs.ContainsKey(docPath)) applyASDoc(thisDocs[docPath], member);
+ if (thisDocs.TryGetValue(docPath, out var doc)) ApplyASDoc(doc, member);
}
-
member.InFile = model;
member.IsPackageLevel = true;
model.Members.Add(member);
}
-
AddImports(model, imports);
}
}
@@ -338,99 +312,82 @@ public static void Convert(ContentParser parser, PathModel path, IASContext cont
///
/// old name: setDoc()
///
- private static void applyASDoc(ASDocItem doc, MemberModel model)
+ static void ApplyASDoc(ASDocItem doc, MemberModel model)
{
model.Comments = doc.LongDesc;
-
- if (doc.IsFinal)
- model.Flags |= FlagType.Final;
-
- if (doc.IsDynamic && (model is ClassModel))
- model.Flags |= FlagType.Dynamic;
-
- if (doc.Value != null)
- model.Value = doc.Value;
-
+ if (doc.IsFinal) model.Flags |= FlagType.Final;
+ if (doc.IsDynamic && model is ClassModel) model.Flags |= FlagType.Dynamic;
+ if (doc.Value != null) model.Value = doc.Value;
// TODO Extract features in comments
- applyTypeComment(doc, model);
- applyTypeCommentToParams(doc, model);
+ ApplyTypeComment(doc, model);
+ ApplyTypeCommentToParams(doc, model);
}
- private static void applyTypeComment(ASDocItem doc, MemberModel model)
+ static void ApplyTypeComment(ASDocItem doc, MemberModel model)
{
- if (doc == null || model ==null)
- return;
-
+ if (doc is null || model is null) return;
ASFileParserUtils.ParseTypeDefinitionInto(doc.ApiType, model, true, true);
}
- private static void applyTypeCommentToParams(ASDocItem doc, MemberModel model)
+ static void ApplyTypeCommentToParams(ASDocItem doc, MemberModel model)
{
- if (doc == null || model == null || model.Parameters == null)
- return;
-
- foreach (MemberModel param in model.Parameters)
- if (doc.ParamTypes != null && doc.ParamTypes.ContainsKey(param.Name))
- ASFileParserUtils.ParseTypeDefinitionInto(doc.ParamTypes[param.Name], param, true, true);
+ if (doc is null || model?.Parameters is null) return;
+ foreach (var param in model.Parameters)
+ if (doc.ParamTypes != null && doc.ParamTypes.TryGetValue(param.Name, out var typeDefinition))
+ ASFileParserUtils.ParseTypeDefinitionInto(typeDefinition, param, true, true);
}
- private static void CustomFixes(string path, Dictionary models)
+ static void CustomFixes(string path, IDictionary models)
{
- string file = Path.GetFileName(path);
- if (file == "playerglobal.swc" || file == "airglobal.swc")
+ var file = Path.GetFileName(path);
+ if (file != "playerglobal.swc" && file != "airglobal.swc") return;
+ var mathPath = Path.Combine(path, "Math");
+ if (models.TryGetValue(mathPath, out var model))
{
- string mathPath = Path.Combine(path, "Math");
- if (models.ContainsKey(mathPath))
+ var @class = model.GetPublicClass();
+ foreach (var member in @class.Members)
{
- ClassModel mathModel = models[mathPath].GetPublicClass();
- foreach (MemberModel member in mathModel.Members)
+ if (!member.Parameters.IsNullOrEmpty() && member.Parameters[0].Name == "x")
{
- if (member.Parameters != null && member.Parameters.Count > 0 && member.Parameters[0].Name == "x")
+ string n = member.Name;
+ if (member.Parameters.Count > 1)
{
- string n = member.Name;
- if (member.Parameters.Count > 1)
- {
- if (n == "atan2") member.Parameters.Reverse();
- else if (n == "min" || n == "max") { member.Parameters[0].Name = "val1"; member.Parameters[1].Name = "val2"; }
- else if (n == "pow") { member.Parameters[0].Name = "base"; member.Parameters[1].Name = "pow"; }
- }
- else if (n == "sin" || n == "cos" || n == "tan") member.Parameters[0].Name = "angleRadians";
- else member.Parameters[0].Name = "val";
+ if (n == "atan2") member.Parameters.Reverse();
+ else if (n == "min" || n == "max") { member.Parameters[0].Name = "val1"; member.Parameters[1].Name = "val2"; }
+ else if (n == "pow") { member.Parameters[0].Name = "base"; member.Parameters[1].Name = "pow"; }
}
+ else if (n == "sin" || n == "cos" || n == "tan") member.Parameters[0].Name = "angleRadians";
+ else member.Parameters[0].Name = "val";
}
}
- string objPath = Path.Combine(path, "Object");
- if (models.ContainsKey(objPath))
+ }
+ var objPath = Path.Combine(path, "Object");
+ if (models.TryGetValue(objPath, out model))
+ {
+ var @class = model.GetPublicClass();
+ if (!@class.Members.Contains("prototype"))
{
- ClassModel objModel = models[objPath].GetPublicClass();
- if (objModel.Members.Search("prototype", 0, 0) == null)
- {
- MemberModel proto = new MemberModel("prototype", "Object", FlagType.Dynamic | FlagType.Variable, Visibility.Public);
- objModel.Members.Add(proto);
- }
+ @class.Members.Add(new MemberModel("prototype", "Object", FlagType.Dynamic | FlagType.Variable, Visibility.Public));
}
}
}
- private static void AddImports(FileModel model, Dictionary imports)
+ static void AddImports(FileModel model, Dictionary imports)
{
- if (model != null)
- {
- foreach (string import in imports.Keys)
- model.Imports.Add(new MemberModel(imports[import], import, FlagType.Import, 0));
-
- imports.Clear();
- }
+ if (model is null) return;
+ foreach (var pair in imports)
+ model.Imports.Add(new MemberModel(pair.Value, pair.Key, FlagType.Import, 0));
+ imports.Clear();
}
- private static Dictionary GetDocs(string package)
+ static Dictionary GetDocs(string package)
{
- string docPackage = package == "" ? "__Global__" : package;
- if (Docs.ContainsKey(docPackage)) return Docs[docPackage];
- else return null;
+ var docPackage = package == "" ? "__Global__" : package;
+ Docs.TryGetValue(docPackage, out var result);
+ return result;
}
- private static MemberList GetMembers(List abcMembers, FlagType baseFlags, QName instName)
+ static MemberList GetMembers(IEnumerable abcMembers, FlagType baseFlags, QName instName)
{
MemberList list = new MemberList();
string package = instName.uri;
@@ -439,16 +396,13 @@ private static MemberList GetMembers(List abcMembers, FlagType baseF
foreach (MemberInfo info in abcMembers)
{
MemberModel member = GetMember(info, baseFlags);
- if (member == null) continue;
+ if (member is null) continue;
string uri = info.name.uri ?? "";
if (uri.Length > 0)
{
- if (uri == "private" || package == "private")
- {
- continue;
- }
- else if (uri == protect)
+ if (uri == "private" || package == "private") continue;
+ if (uri == protect)
{
member.Access = Visibility.Protected;
member.Namespace = "protected";
@@ -491,15 +445,16 @@ private static MemberList GetMembers(List abcMembers, FlagType baseF
return list;
}
- private static MemberModel GetMember(MemberInfo info, FlagType baseFlags)
+ static MemberModel GetMember(MemberInfo info, FlagType baseFlags)
{
- MemberModel member = new MemberModel();
- member.Name = info.name.localName;
- member.Flags = baseFlags;
- member.Access = Visibility.Public;
- member.Namespace = "public";
-
- if (info.metadata != null && info.metadata.Count > 0)
+ var member = new MemberModel
+ {
+ Name = info.name.localName,
+ Flags = baseFlags,
+ Access = Visibility.Public,
+ Namespace = "public"
+ };
+ if (!info.metadata.IsNullOrEmpty())
{
var metadatas = member.MetaDatas;
foreach (var metaInfo in info.metadata)
@@ -517,39 +472,37 @@ private static MemberModel GetMember(MemberInfo info, FlagType baseFlags)
}
meta.RawParams = rawParams.ToString();
- if (metadatas == null) metadatas = new List(info.metadata.Count);
+ metadatas ??= new List(info.metadata.Count);
metadatas.Add(meta);
}
member.MetaDatas = metadatas;
}
- if (info is SlotInfo)
+ if (info is SlotInfo slot)
{
- SlotInfo slot = info as SlotInfo;
member.Flags |= FlagType.Variable;
if (slot.kind == TraitMember.Const) member.Flags |= FlagType.Constant;
- if (slot.value is Namespace)
+ if (slot.value is Namespace ns)
{
member.Flags |= FlagType.Namespace;
- member.Value = '"' + (slot.value as Namespace).uri + '"';
+ member.Value = '"' + ns.uri + '"';
}
member.Type = ImportType(slot.type);
}
- else if (info is MethodInfo)
+ else if (info is MethodInfo method)
{
- switch (info.kind)
+ member.Flags |= method.kind switch
{
- case TraitMember.Setter: member.Flags |= FlagType.Setter; break;
- case TraitMember.Getter: member.Flags |= FlagType.Getter; break;
- default: member.Flags |= FlagType.Function; break;
- }
- MethodInfo method = info as MethodInfo;
+ TraitMember.Setter => FlagType.Setter,
+ TraitMember.Getter => FlagType.Getter,
+ _ => FlagType.Function,
+ };
QName type = method.returnType;
member.Type = ImportType(type);
member.Parameters = new List();
int n = method.paramTypes.Length;
- int defaultValues = (method.optionalValues != null) ? n - method.optionalValues.Length : n;
+ int defaultValues = n - method.optionalValues?.Length ?? n;
for (int i = 0; i < n; i++)
{
MemberModel param = new MemberModel();
@@ -569,47 +522,37 @@ private static MemberModel GetMember(MemberInfo info, FlagType baseFlags)
member.Parameters.Add(param);
}
}
- else
- {
- member = null;
- }
-
+ else member = null;
return member;
}
- private static void GetMemberDoc(MemberModel member)
+ static void GetMemberDoc(MemberModel member)
{
string dPath = docPath + ":";
- if (member.Access == Visibility.Public && !String.IsNullOrEmpty(member.Namespace)
+ if (member.Access == Visibility.Public && !string.IsNullOrEmpty(member.Namespace)
&& member.Namespace != "public")
dPath += member.Namespace + ":";
dPath += member.Name;
if ((member.Flags & FlagType.Getter) > 0) dPath += ":get";
else if ((member.Flags & FlagType.Setter) > 0) dPath += ":set";
-
- if (thisDocs.ContainsKey(dPath)) applyASDoc(thisDocs[dPath], member);
+ if (thisDocs.TryGetValue(dPath, out var doc)) ApplyASDoc(doc, member);
}
- private static string ImportType(QName type)
- {
- if (type == null) return "*";
- else return ImportType(type.ToTypeString());
- }
+ static string ImportType(QName type) => type is null ? "*" : ImportType(type.ToTypeString());
- private static string ImportType(string qname)
+ static string ImportType(string qname)
{
- if (qname == null) return "*";
+ if (qname is null) return "*";
int p = qname.LastIndexOf('.');
int q = qname.LastIndexOf('<');
if (q > 0)
{
p = qname.IndexOf('>', q);
if (p <= q) return qname;
- else
- return qname.Substring(0, q + 1) + ImportType(qname.Substring(q + 1, p - q - 1)) + qname.Substring(p);
+ return qname.Substring(0, q + 1) + ImportType(qname.Substring(q + 1, p - q - 1)) + qname.Substring(p);
}
if (p < 0) return qname;
- if (imports.ContainsKey(qname)) return imports[qname];
+ if (imports.TryGetValue(qname, out var import)) return import;
string cname = qname.Substring(p + 1);
if (!conflicts.ContainsKey(cname)) conflicts.Add(cname, qname);
else if (conflicts[cname] != qname)
@@ -618,13 +561,16 @@ private static string ImportType(string qname)
return cname;
}
- private static void SetDefaultValue(MemberModel member, object value)
+ static void SetDefaultValue(MemberModel member, object value)
{
- if (value == null) member.Value = "null";
- else if (value is string && value.ToString() != "undefined") member.Value = '"' + value.ToString() + '"';
- else if (value is bool) member.Value = value.ToString().ToLower();
- else if (value is double) member.Value = ((double)value).ToString(CultureInfo.InvariantCulture.NumberFormat);
- else member.Value = value.ToString();
+ member.Value = value switch
+ {
+ null => "null",
+ string _ when value.ToString() != "undefined" => '"' + value.ToString() + '"',
+ bool _ => value.ToString().ToLower(),
+ double d => d.ToString(CultureInfo.InvariantCulture.NumberFormat),
+ _ => value.ToString(),
+ };
}
}
@@ -634,16 +580,16 @@ private static void SetDefaultValue(MemberModel member, object value)
public class ASDocItem
{
- public bool IsFinal = false;
- public bool IsDynamic = false;
- public bool IsStatic = false;
+ public bool IsFinal;
+ public bool IsDynamic;
+ public bool IsStatic;
- public string ShortDesc = null;
- public string LongDesc = null;
- public string Returns = null;
- public string Value = null;
- public string ApiType = null;
- public string DeclType = null;
+ public string ShortDesc;
+ public string LongDesc;
+ public string Returns;
+ public string Value;
+ public string ApiType;
+ public string DeclType;
public List Meta;
public Dictionary Params = new Dictionary();
@@ -657,8 +603,8 @@ public class ASDocItem
class ASDocsReader : XmlTextReader
{
- public List ExcludedASDocs = null;
- private Dictionary docs;
+ public List ExcludedASDocs;
+ Dictionary docs;
public ASDocsReader(byte[] raw)
@@ -684,26 +630,19 @@ public void Parse(Dictionary packageDocs)
// PRIMARY
//---------------------------
- private void ReadDeclaration(string declType)
+ void ReadDeclaration(string declType)
{
- if (IsEmptyElement)
- return;
-
- if (this.ExcludedASDocs == null)
- this.ExcludedASDocs = new List();
-
- ASDocItem doc = new ASDocItem();
- doc.DeclType = declType;
-
- string id = GetAttribute("id");
-
+ if (IsEmptyElement) return;
+ ExcludedASDocs ??= new List();
+ var doc = new ASDocItem {DeclType = declType};
+ var id = GetAttribute("id");
if (id != null)
{
// type doubled in doc: "flash.utils:IDataOutput:flash.utils:IDataOutput:writeDouble"
int colon = id.IndexOf(':') + 1;
if (colon > 0)
{
- int dup = id.IndexOf(id.Substring(0, colon), colon);
+ int dup = id.IndexOfOrdinal(id.Substring(0, colon), colon);
if (dup > 0) id = id.Substring(dup);
}
doc.ApiType = id;
@@ -719,30 +658,27 @@ private void ReadDeclaration(string declType)
if (id != null)
{
- if (doc.ApiType == "String" && doc.Value != null && !doc.Value.StartsWith("\""))
+ if (doc.ApiType == "String" && doc.Value != null && !doc.Value.StartsWith('"'))
doc.Value = "\"" + doc.Value + "\"";
- if (doc.LongDesc == null)
- doc.LongDesc = "";
+ doc.LongDesc ??= "";
- if (doc.ShortDesc == null)
- doc.ShortDesc = doc.LongDesc;
- else
- doc.LongDesc = doc.LongDesc.Trim();
+ if (doc.ShortDesc is null) doc.ShortDesc = doc.LongDesc;
+ else doc.LongDesc = doc.LongDesc.Trim();
if (doc.LongDesc.Length == 0 && doc.ShortDesc.Length > 0)
doc.LongDesc = doc.ShortDesc;
- if (!this.ExcludedASDocs.Contains("param") && doc.Params != null)
+ if (!ExcludedASDocs.Contains("param") && doc.Params != null)
foreach (string name in doc.Params.Keys)
doc.LongDesc += "\n@param\t" + name + "\t" + doc.Params[name].Trim();
- if (!this.ExcludedASDocs.Contains("return") && doc.Returns != null)
+ if (!ExcludedASDocs.Contains("return") && doc.Returns != null)
doc.LongDesc += "\n@return\t" + doc.Returns.Trim();
if (doc.ExtraAsDocs != null)
- foreach (KeyValuePair extraASDoc in doc.ExtraAsDocs)
- if (!this.ExcludedASDocs.Contains(extraASDoc.Key))
+ foreach (var extraASDoc in doc.ExtraAsDocs)
+ if (!ExcludedASDocs.Contains(extraASDoc.Key))
doc.LongDesc += "\n@" + extraASDoc.Key + "\t" + extraASDoc.Value;
// keep definitions including either documentation or static values
@@ -752,16 +688,13 @@ private void ReadDeclaration(string declType)
}
}
- private void ProcessDeclarationNodes(ASDocItem doc)
+ void ProcessDeclarationNodes(ASDocItem doc)
{
- if (NodeType != XmlNodeType.Element)
- return;
-
+ if (NodeType != XmlNodeType.Element) return;
switch (Name)
{
case "apiName": break; // TODO validate event name
case "apiInheritDoc": break; // TODO link inherited doc?
-
case "apiDetail":
case "related-links": SkipContents(); break;
@@ -805,7 +738,7 @@ private void ProcessDeclarationNodes(ASDocItem doc)
// COMMONS
//---------------------------
- private void SkipContents()
+ void SkipContents()
{
if (IsEmptyElement)
return;
@@ -816,7 +749,7 @@ private void SkipContents()
Read();
}
- private string ReadValue()
+ string ReadValue()
{
if (IsEmptyElement)
{
@@ -830,11 +763,10 @@ private string ReadValue()
string prefix = "";
string postfix = "";
string eon = Name;
- string lcName; // name in lower case
ReadStartElement();
while (Name != eon)
{
- lcName = Name.ToLower();
+ var lcName = Name.ToLower(); // name in lower case
if (lcName == "codeblock" || lcName == "listing")
{
if (NodeType == XmlNodeType.Element)
@@ -874,7 +806,7 @@ private string ReadValue()
// apiClassifierDetail
//---------------------------
- private void ReadApiClassifierDetail(ASDocItem doc)
+ void ReadApiClassifierDetail(ASDocItem doc)
{
doc.LongDesc = "";
@@ -893,23 +825,23 @@ private void ReadApiClassifierDetail(ASDocItem doc)
break;
case "apiDesc":
- doc.LongDesc += this.ReadInnerXml() +"\n";
+ doc.LongDesc += ReadInnerXml() +"\n";
// Read();
break;
case "example":
- doc.LongDesc += "\nEXAMPLE: \n\n" + this.ReadInnerXml() +"\n";
+ doc.LongDesc += "\nEXAMPLE: \n\n" + ReadInnerXml() +"\n";
// Read();
break;
default:
- this.ReadInnerXml();
+ ReadInnerXml();
break;
}
}
}
- private void ReadApiClassifierDef(ASDocItem doc)
+ void ReadApiClassifierDef(ASDocItem doc)
{
if (IsEmptyElement)
return;
@@ -953,7 +885,7 @@ private void ReadApiClassifierDef(ASDocItem doc)
/// ---
///
///
- private void ReadProlog(ASDocItem doc)
+ void ReadProlog(ASDocItem doc)
{
if (IsEmptyElement)
return;
@@ -971,7 +903,7 @@ private void ReadProlog(ASDocItem doc)
}
}
- private void ReadPrologMetadata(ASDocItem doc)
+ void ReadPrologMetadata(ASDocItem doc)
{
if (IsEmptyElement)
return;
@@ -984,22 +916,23 @@ private void ReadPrologMetadata(ASDocItem doc)
ReadPrologMetadataApiVersion(doc);
else if (Name == "styles")
ReadPrologMetadataStyles(doc);
+ else if (Name == "DefaultProperty")
+ ReadPrologMetadataDefaultProperty(doc);
Read();
}
}
- private void ReadPrologMetadataApiVersion(ASDocItem doc)
+ void ReadPrologMetadataApiVersion(ASDocItem doc)
{
if (IsEmptyElement)
return;
- string asdocKey;
- string asdocVal;
-
string eon = Name;
ReadStartElement();
while (Name != eon)
{
+ string asdocVal;
+ string asdocKey;
if (Name == "apiLanguage")
{
string sVers = GetAttribute("version");
@@ -1036,7 +969,7 @@ private void ReadPrologMetadataApiVersion(ASDocItem doc)
}
}
- private void ReadPrologMetadataStyles(ASDocItem doc)
+ void ReadPrologMetadataStyles(ASDocItem doc)
{
if (IsEmptyElement)
return;
@@ -1051,19 +984,33 @@ private void ReadPrologMetadataStyles(ASDocItem doc)
}
}
- private void ReadPrologCustoms(ASDocItem doc, string terminationNode)
+ void ReadPrologMetadataDefaultProperty(ASDocItem doc)
+ {
+ ASMetaData meta = new ASMetaData("DefaultProperty");
+ meta.Kind = ASMetaKind.DefaultProperty;
+ meta.Comments = "";
+
+ meta.Params = new Dictionary();
+
+ string defValue = GetAttribute("name");
+ meta.Params["default"] = defValue;
+
+ meta.RawParams = $"\"{defValue}\"";
+
+ doc.Meta ??= new List();
+ doc.Meta.Add(meta);
+ }
+
+ void ReadPrologCustoms(ASDocItem doc, string terminationNode)
{
if (IsEmptyElement)
return;
- string asdocKey;
- string asdocVal;
-
string eon = terminationNode;
ReadStartElement();
while (!(Name == eon && NodeType == XmlNodeType.EndElement))
{
- asdocKey = this.Name;
+ var asdocKey = Name;
/*
if (asdocKey == "maelexample")
@@ -1074,7 +1021,7 @@ private void ReadPrologCustoms(ASDocItem doc, string terminationNode)
else
{
*/
- asdocVal = this.ReadInnerXml();
+ var asdocVal = ReadInnerXml();
// }
doc.ExtraAsDocs.Add(new KeyValuePair(asdocKey, asdocVal));
@@ -1086,27 +1033,17 @@ private void ReadPrologCustoms(ASDocItem doc, string terminationNode)
// apiType
//---------------------------
- private void ReadApiType(ASDocItem doc)
- {
- SetApiType(doc, GetAttribute("value"));
- }
-
- private void ReadApiTypeAsClassifier(ASDocItem doc)
- {
- SetApiType(doc, ReadValue());
- }
-
- private void SetApiType(ASDocItem doc, string apiType)
- {
- doc.ApiType = apiType == "any" ? "*" : apiType;
- }
+ void ReadApiType(ASDocItem doc) => SetApiType(doc, GetAttribute("value"));
+ void ReadApiTypeAsClassifier(ASDocItem doc) => SetApiType(doc, ReadValue());
+ static void SetApiType(ASDocItem doc, string apiType) => doc.ApiType = apiType == "any" ? "*" : apiType;
+
//---------------------------
// apiOperationDetail
//---------------------------
- private void ReadParamDesc(ASDocItem doc)
+ void ReadParamDesc(ASDocItem doc)
{
if (IsEmptyElement)
return;
@@ -1149,7 +1086,7 @@ private void ReadParamDesc(ASDocItem doc)
}
}
- private void ReadReturnsDesc(ASDocItem doc)
+ void ReadReturnsDesc(ASDocItem doc)
{
if (IsEmptyElement)
return;
@@ -1158,7 +1095,7 @@ private void ReadReturnsDesc(ASDocItem doc)
ReadStartElement();
while (Name != eon)
{
- switch (this.Name)
+ switch (Name)
{
case "apiDesc":
doc.Returns = ReadValue();
@@ -1182,14 +1119,13 @@ private void ReadReturnsDesc(ASDocItem doc)
// apiException
//---------------------------
- private void ReadApiException(ASDocItem doc)
+ void ReadApiException(ASDocItem doc)
{
if (IsEmptyElement)
return;
string apiDesc = "";
string apiItemName = "";
- string apiOperationClassifier = "";
string eon = Name;
ReadStartElement();
@@ -1206,7 +1142,7 @@ private void ReadApiException(ASDocItem doc)
break;
case "apiOperationClassifier":
- apiOperationClassifier = ReadValue();
+ ReadValue();
break;
}
Read();
@@ -1220,24 +1156,21 @@ private void ReadApiException(ASDocItem doc)
// Meta tags
//---------------------------
- private void ReadExcludeMeta(ASDocItem doc)
+ void ReadExcludeMeta(ASDocItem doc)
{
if (!HasAttributes) return;
- ASMetaData meta = new ASMetaData("Style");
- meta.Kind = ASMetaKind.Exclude;
+ ASMetaData meta = new ASMetaData("Style") {Kind = ASMetaKind.Exclude};
string sKind = GetAttribute("kind");
string sName = GetAttribute("name");
- if (doc.Meta == null) doc.Meta = new List();
- meta.Params = new Dictionary();
- meta.Params["kind"] = sKind;
- meta.Params["name"] = sName;
- meta.RawParams = String.Format("kind=\"{0}\", name=\"{1}\"", sKind, sName);
+ doc.Meta ??= new List();
+ meta.Params = new Dictionary {["kind"] = sKind, ["name"] = sName};
+ meta.RawParams = $"kind=\"{sKind}\", name=\"{sName}\"";
doc.Meta.Add(meta);
}
- private void ReadStyleMeta(ASDocItem doc)
+ void ReadStyleMeta(ASDocItem doc)
{
if (IsEmptyElement || !HasAttributes) return;
@@ -1265,12 +1198,10 @@ private void ReadStyleMeta(ASDocItem doc)
Read();
}
- if (doc.Meta == null) doc.Meta = new List();
+ doc.Meta ??= new List();
if (sDefault != null) meta.Comments = meta.Comments.Trim() + "\n@default\t" + sDefault;
- meta.Params = new Dictionary();
- meta.Params["name"] = sName;
- meta.Params["type"] = sType;
- meta.RawParams = String.Format("name=\"{0}\", type=\"{1}\"", sName, sType);
+ meta.Params = new Dictionary {["name"] = sName, ["type"] = sType};
+ meta.RawParams = $"name=\"{sName}\", type=\"{sType}\"";
if (sInherit != null)
{
meta.Params["inherit"] = sInherit;
@@ -1284,7 +1215,7 @@ private void ReadStyleMeta(ASDocItem doc)
doc.Meta.Add(meta);
}
- private void ReadEventMeta(ASDocItem doc)
+ void ReadEventMeta(ASDocItem doc)
{
if (IsEmptyElement) return;
@@ -1311,13 +1242,11 @@ private void ReadEventMeta(ASDocItem doc)
Read();
}
- if (doc.Meta == null) doc.Meta = new List();
- meta.Params = new Dictionary();
- meta.Params["name"] = eName;
- meta.Params["type"] = eType;
+ doc.Meta ??= new List();
+ meta.Params = new Dictionary {["name"] = eName, ["type"] = eType};
if (eFullType != null)
meta.Comments = meta.Comments.Trim() + "\n@eventType\t" + eFullType.Replace(':', '.');
- meta.RawParams = String.Format("name=\"{0}\", type=\"{1}\"", eName, eType);
+ meta.RawParams = $"name=\"{eName}\", type=\"{eType}\"";
doc.Meta.Add(meta);
}
}
diff --git a/External/Plugins/AS3Context/Compiler/FdbWrapper.cs b/External/Plugins/AS3Context/Compiler/FdbWrapper.cs
index 99d78c6dad..84e22c343c 100644
--- a/External/Plugins/AS3Context/Compiler/FdbWrapper.cs
+++ b/External/Plugins/AS3Context/Compiler/FdbWrapper.cs
@@ -21,17 +21,18 @@ public class FdbWrapper
public void Run(string projectPath, string flexSDKPath)
{
flexSDKPath = PathHelper.ResolvePath(flexSDKPath, projectPath);
- if (flexSDKPath != null && Directory.Exists(flexSDKPath))
+ if (Directory.Exists(flexSDKPath))
{
if (flexSDKPath.EndsWith("bin", StringComparison.OrdinalIgnoreCase))
flexSDKPath = Path.GetDirectoryName(flexSDKPath);
}
else return;
- Dictionary jvmConfig = JvmConfigHelper.ReadConfig(flexSDKPath);
-
- if (process == null || process.HasExited)
+ if (process is null || process.HasExited)
+ {
+ var jvmConfig = JvmConfigHelper.ReadConfig(flexSDKPath);
Initialize(flexSDKPath, jvmConfig, projectPath);
+ }
}
public void PushCommand(string cmd)
@@ -64,7 +65,7 @@ bool Initialize(string flexSDKPath, Dictionary jvmConfig, string
{
cmdQueue = new Queue();
- string fdbPath = Path.Combine(flexSDKPath, "lib\\fdb.jar");
+ var fdbPath = Path.Combine(flexSDKPath, "lib\\fdb.jar");
if (!File.Exists(fdbPath)) fdbPath = Path.Combine(flexSDKPath, "lib\\legacy\\fdb.jar");
if (!File.Exists(fdbPath))
{
@@ -102,7 +103,7 @@ void process_Exited(object sender, EventArgs e)
{
keepAlive = false;
Cleanup();
- if (OnOutput != null) OnOutput("[FDB halted]");
+ OnOutput?.Invoke("[FDB halted]");
}
public void Cleanup()
@@ -111,7 +112,7 @@ public void Cleanup()
if (process != null && !process.HasExited && keepAlive)
{
keepAlive = false;
- if (OnOutput != null) OnOutput("[Shutting down FDB]");
+ OnOutput?.Invoke("[Shutting down FDB]");
try
{
if (!process.HasExited) process.Kill();
@@ -146,13 +147,13 @@ void FdbRun()
running = true;
WriteToPrompt("run");
Thread.Sleep(200);
- if (OnStarted != null) OnStarted(null);
+ OnStarted?.Invoke(null);
}
// send commands queue
else if (cmdQueue.Count > 0) WriteToPrompt(cmdQueue.Dequeue());
// default behavior
else if (connected) WriteToPrompt("continue");
- else if (!connected)
+ else
{
connectedEvent.WaitOne(250, false);
connectedEvent.Reset();
@@ -161,7 +162,7 @@ void FdbRun()
}
if (process != null && !process.HasExited)
{
- if (OnOutput != null) OnOutput("[Shutting down FDB]");
+ OnOutput?.Invoke("[Shutting down FDB]");
try
{
if (!process.HasExited) process.Kill();
@@ -175,16 +176,15 @@ void ReadErrors()
while (keepAlive && !process.StandardError.EndOfStream)
{
string line = process.StandardError.ReadLine();
- if (OnError != null) OnError(line);
+ OnError?.Invoke(line);
}
}
void WriteToPrompt(string line)
{
interactive = false;
- if (process != null)
- process.StandardInput.WriteLine(line);
- if (OnOutput != null) OnOutput("(fdb) "+line);
+ process?.StandardInput.WriteLine(line);
+ OnOutput?.Invoke("(fdb) "+line);
}
///
@@ -199,14 +199,12 @@ void ReadUntilPrompt()
void ReadUntilToken(string token)
{
- StringBuilder output = new StringBuilder();
- Queue queue = new Queue();
-
- bool keepProcessing = true;
+ var output = new StringBuilder();
+ var queue = new Queue();
+ var keepProcessing = true;
while (keepProcessing && keepAlive)
{
- if (process == null || process.HasExited)
- keepProcessing = false;
+ if (process is null || process.HasExited) keepProcessing = false;
else
{
char c = (char)process.StandardOutput.Read();
@@ -233,12 +231,12 @@ void ReadUntilToken(string token)
#region Understanding
- static Regex reTrace = new Regex(@"^?\[trace\]", RegexOptions.Compiled);
- static Regex reFault = new Regex(@"^(\[Fault\]|Fault,) ", RegexOptions.Compiled);
- static Regex reLoad = new Regex(@"^\[SWF\] ", RegexOptions.Compiled);
- static Regex reUnload = new Regex(@"^\[UnloadSWF\] ", RegexOptions.Compiled);
- static Regex reDisconnect = new Regex(@"^Player session terminated", RegexOptions.Compiled);
- static Regex reContinue = new Regex(@"'continue'", RegexOptions.Compiled);
+ static readonly Regex reTrace = new Regex(@"^?\[trace\]", RegexOptions.Compiled);
+ static readonly Regex reFault = new Regex(@"^(\[Fault\]|Fault,) ", RegexOptions.Compiled);
+ static readonly Regex reLoad = new Regex(@"^\[SWF\] ", RegexOptions.Compiled);
+ static readonly Regex reUnload = new Regex(@"^\[UnloadSWF\] ", RegexOptions.Compiled);
+ static readonly Regex reDisconnect = new Regex(@"^Player session terminated", RegexOptions.Compiled);
+ static readonly Regex reContinue = new Regex(@"'continue'", RegexOptions.Compiled);
void MatchLine(string line)
{
@@ -253,11 +251,11 @@ void MatchLine(string line)
// [trace] Hello World!
else if (reTrace.IsMatch(line))
{
- if (OnTrace != null)
+ if (OnTrace is { } onTrace)
{
- string trace = line.Substring(line.IndexOf(']') + 1);
- if (trace.Length > 0 && Char.IsWhiteSpace(trace[0])) OnTrace(trace.Substring(1));
- else OnTrace(trace);
+ var trace = line.Substring(line.IndexOf(']') + 1);
+ if (trace.Length > 0 && char.IsWhiteSpace(trace[0])) onTrace(trace.Substring(1));
+ else onTrace(trace);
return;
}
}
@@ -266,9 +264,9 @@ void MatchLine(string line)
// 20
else if (reFault.IsMatch(line))
{
- if (OnError != null)
+ if (OnError is { } onError)
{
- OnError(line);
+ onError(line);
return;
}
}
@@ -290,7 +288,7 @@ void MatchLine(string line)
keepAlive = false;
}
- if (OnOutput != null) OnOutput(line);
+ OnOutput?.Invoke(line);
}
#endregion
}
diff --git a/External/Plugins/AS3Context/Compiler/FlexDebugger.cs b/External/Plugins/AS3Context/Compiler/FlexDebugger.cs
index ce758a30f7..4f237848b3 100644
--- a/External/Plugins/AS3Context/Compiler/FlexDebugger.cs
+++ b/External/Plugins/AS3Context/Compiler/FlexDebugger.cs
@@ -1,4 +1,3 @@
-using System.Windows.Forms;
using PluginCore;
using PluginCore.Localization;
using PluginCore.Managers;
@@ -14,14 +13,14 @@ public static bool Start(string projectPath, string flex2Path, DataEvent message
if (ignoreMessage) return false;
try
{
- if (debugger != null) debugger.Cleanup();
+ debugger?.Cleanup();
startMessage = message;
debugger = new FdbWrapper();
- debugger.OnStarted += new LineEvent(debugger_OnStarted);
- debugger.OnTrace += new LineEvent(debugger_OnTrace);
- debugger.OnError += new LineEvent(debugger_OnError);
+ debugger.OnStarted += debugger_OnStarted;
+ debugger.OnTrace += debugger_OnTrace;
+ debugger.OnError += debugger_OnError;
if (PluginMain.Settings.VerboseFDB)
- debugger.OnOutput += new LineEvent(debugger_OnOutput);
+ debugger.OnOutput += debugger_OnOutput;
debugger.Run(projectPath, flex2Path);
TraceManager.AddAsync(TextHelper.GetString("Info.CapturingTracesWithFDB"));
return true;
@@ -46,15 +45,14 @@ public static void Stop()
#endregion
- static private bool ignoreMessage;
- static private FdbWrapper debugger;
- static private DataEvent startMessage;
+ static bool ignoreMessage;
+ static FdbWrapper debugger;
+ static DataEvent startMessage;
static void debugger_OnStarted(string line)
{
- if (startMessage == null)
- return;
- PluginBase.RunAsync((MethodInvoker)delegate
+ if (startMessage is null) return;
+ PluginBase.RunAsync(delegate
{
// send message again
ignoreMessage = true;
@@ -64,19 +62,10 @@ static void debugger_OnStarted(string line)
});
}
- static void debugger_OnError(string line)
- {
- TraceManager.AddAsync(line, 3);
- }
+ static void debugger_OnError(string line) => TraceManager.AddAsync(line, 3);
- static void debugger_OnOutput(string line)
- {
- TraceManager.AddAsync(line, 1);
- }
+ static void debugger_OnOutput(string line) => TraceManager.AddAsync(line, 1);
- static void debugger_OnTrace(string line)
- {
- TraceManager.AddAsync(line, 1);
- }
+ static void debugger_OnTrace(string line) => TraceManager.AddAsync(line, 1);
}
}
diff --git a/External/Plugins/AS3Context/Compiler/FlexShells.cs b/External/Plugins/AS3Context/Compiler/FlexShells.cs
index 0c0f7b2bff..58c8e7527c 100644
--- a/External/Plugins/AS3Context/Compiler/FlexShells.cs
+++ b/External/Plugins/AS3Context/Compiler/FlexShells.cs
@@ -24,12 +24,12 @@ namespace AS3Context.Compiler
///
public class FlexShells
{
- static public event SyntaxErrorHandler SyntaxError;
+ public static event SyntaxErrorHandler SyntaxError;
- static readonly public Regex re_SplitParams =
+ public static readonly Regex re_SplitParams =
new Regex("[\\s](?[-+][A-z0-9\\-\\.]+)", RegexOptions.Compiled | RegexOptions.Singleline);
- static private readonly string[] PATH_SWITCHES = {
+ static readonly string[] PATH_SWITCHES = {
"-compiler.context-root","-context-root",
"-compiler.defaults-css-url","-defaults-css-url",
"-compiler.external-library-path","-external-library-path","-el",
@@ -43,78 +43,59 @@ public class FlexShells
"-link-report","-load-config","-load-externs","-size-report",
"-output","-o","-runtime-shared-libraries","-rsl",
"-namespace","-compiler.namespaces.namespace"};
-
- static private string ascPath;
- static private string mxmlcPath;
- static private string flexShellsJar = "Flex4Shells.jar";
- static private string flexShellsPath;
- static private bool running;
- static private bool silentChecking;
- static private string checkedSDK;
- static private bool isFlex4SDK;
- static private string currentSDK;
-
- static private string CheckResource(string resName, string fileName)
+
+ static string ascPath;
+ static string mxmlcPath;
+ static readonly string flexShellsJar = "Flex4Shells.jar";
+ static string flexShellsPath;
+ static bool running;
+ static bool silentChecking;
+ static string checkedSDK;
+ static bool isFlex4SDK;
+ static string currentSDK;
+
+ static string CheckResource(string resName, string fileName)
{
- string path = Path.Combine(PathHelper.DataDir, "AS3Context");
- string fullPath = Path.Combine(path, fileName);
- if (!File.Exists(fullPath))
+ var fullPath = Path.Combine(PathHelper.DataDir, "AS3Context", fileName);
+ if (File.Exists(fullPath)) return fullPath;
+ var id = "AS3Context.Resources." + resName;
+ var assembly = Assembly.GetExecutingAssembly();
+ using var br = new BinaryReader(assembly.GetManifestResourceStream(id));
+ using var bw = File.Create(fullPath);
+ var buffer = br.ReadBytes(1024);
+ while (buffer.Length > 0)
{
- string id = "AS3Context.Resources." + resName;
- Assembly assembly = Assembly.GetExecutingAssembly();
- using (BinaryReader br = new BinaryReader(assembly.GetManifestResourceStream(id)))
- {
- using (FileStream bw = File.Create(fullPath))
- {
- byte[] buffer = br.ReadBytes(1024);
- while (buffer.Length > 0)
- {
- bw.Write(buffer, 0, buffer.Length);
- buffer = br.ReadBytes(1024);
- }
- bw.Close();
- }
- br.Close();
- }
+ bw.Write(buffer, 0, buffer.Length);
+ buffer = br.ReadBytes(1024);
}
+ bw.Close();
+ br.Close();
return fullPath;
}
- static public FlexShells Instance
- {
- get {
- if (instance == null) instance = new FlexShells();
- return instance;
- }
- }
-
- static private FlexShells instance;
+ public static FlexShells Instance => instance ??= new FlexShells();
- private FlexShells()
+ static FlexShells instance;
+
+ FlexShells()
{
}
- private ProcessRunner ascRunner;
- private ProcessRunner mxmlcRunner;
- private string builtSWF;
- private bool debugMode;
- private Dictionary jvmConfig;
+ ProcessRunner ascRunner;
+ ProcessRunner mxmlcRunner;
+ string builtSWF;
+ bool debugMode;
+ Dictionary jvmConfig;
- public void CheckAS3(string filename, string flexPath)
- {
- CheckAS3(filename, flexPath, null);
- }
+ public void CheckAS3(string filename, string flexPath) => CheckAS3(filename, flexPath, null);
public void CheckAS3(string filename, string flexPath, string src)
{
if (running) return;
// let other plugins preprocess source/handle checking
- Hashtable data = new Hashtable();
- data["filename"] = filename;
- data["src"] = src;
- data["ext"] = Path.GetExtension(filename);
- DataEvent de = new DataEvent(EventType.Command, "AS3Context.CheckSyntax", data);
+ var data = new Hashtable {["filename"] = filename, ["src"] = src, ["ext"] = Path.GetExtension(filename)};
+ var de = new DataEvent(EventType.Command, "AS3Context.CheckSyntax", data);
EventManager.DispatchEvent(this, de);
if (de.Handled) return;
@@ -124,29 +105,27 @@ public void CheckAS3(string filename, string flexPath, string src)
return;
string basePath = null;
- if (PluginBase.CurrentProject != null)
- basePath = Path.GetDirectoryName(PluginBase.CurrentProject.ProjectPath);
+ if (PluginBase.CurrentProject != null) basePath = Path.GetDirectoryName(PluginBase.CurrentProject.ProjectPath);
flexPath = PathHelper.ResolvePath(flexPath, basePath);
// asc.jar in FlexSDK
if (flexPath != null && Directory.Exists(Path.Combine(flexPath, "lib")))
ascPath = Path.Combine(flexPath, "lib\\asc.jar");
// included asc.jar
- if (ascPath == null || !File.Exists(ascPath))
- ascPath = PathHelper.ResolvePath(Path.Combine(PathHelper.ToolDir, "flexlibs/lib/asc.jar"));
-
- if (ascPath == null)
+ if (!File.Exists(ascPath)) ascPath = PathHelper.ResolvePath(Path.Combine(PathHelper.ToolDir, "flexlibs/lib/asc.jar"));
+ if (ascPath is null)
{
if (src != null) return; // silent checking
- DialogResult result = MessageBox.Show(TextHelper.GetString("Info.SetFlex2OrCS3Path"), TextHelper.GetString("Title.ConfigurationRequired"), MessageBoxButtons.YesNoCancel);
- if (result == DialogResult.Yes)
+ var result = MessageBox.Show(TextHelper.GetString("Info.SetFlex2OrCS3Path"), TextHelper.GetString("Title.ConfigurationRequired"), MessageBoxButtons.YesNoCancel);
+ switch (result)
{
- IASContext context = ASContext.GetLanguageContext("as3");
- if (context == null) return;
- PluginBase.MainForm.ShowSettingsDialog("AS3Context", "SDK");
- }
- else if (result == DialogResult.No)
- {
- PluginBase.MainForm.ShowSettingsDialog("ASCompletion", "Flash");
+ case DialogResult.Yes:
+ var context = ASContext.GetLanguageContext("as3");
+ if (context is null) return;
+ PluginBase.MainForm.ShowSettingsDialog("AS3Context", "SDK");
+ break;
+ case DialogResult.No:
+ PluginBase.MainForm.ShowSettingsDialog("ASCompletion", "Flash");
+ break;
}
return;
}
@@ -164,12 +143,10 @@ public void CheckAS3(string filename, string flexPath, string src)
try
{
running = true;
- if (src == null) EventManager.DispatchEvent(this, new NotifyEvent(EventType.ProcessStart));
- if (ascRunner == null || !ascRunner.IsRunning || currentSDK != flexPath)
- StartAscRunner(flexPath);
-
+ if (src is null) EventManager.DispatchEvent(this, new NotifyEvent(EventType.ProcessStart));
+ if (ascRunner is null || !ascRunner.IsRunning || currentSDK != flexPath) StartAscRunner(flexPath);
notificationSent = false;
- if (src == null)
+ if (src is null)
{
silentChecking = false;
//TraceManager.Add("Checking: " + filename, -1);
@@ -195,23 +172,17 @@ public void RunMxmlc(string cmd, string flexPath)
{
if (running) return;
string basePath = null;
- if (PluginBase.CurrentProject != null)
- basePath = Path.GetDirectoryName(PluginBase.CurrentProject.ProjectPath);
+ if (PluginBase.CurrentProject != null) basePath = Path.GetDirectoryName(PluginBase.CurrentProject.ProjectPath);
flexPath = PathHelper.ResolvePath(flexPath, basePath);
- if (flexPath != null && Directory.Exists(flexPath))
- {
- mxmlcPath = Path.Combine(Path.Combine(flexPath, "lib"), "mxmlc.jar");
- }
- if (mxmlcPath == null || !File.Exists(mxmlcPath))
+ if (Directory.Exists(flexPath)) mxmlcPath = Path.Combine(flexPath, "lib", "mxmlc.jar");
+ if (!File.Exists(mxmlcPath))
{
- DialogResult result = MessageBox.Show(TextHelper.GetString("Info.OpenCompilerSettings"), TextHelper.GetString("Title.ConfigurationRequired"), MessageBoxButtons.OKCancel);
- if (result == DialogResult.OK)
- {
- IASContext context = ASContext.GetLanguageContext("as3");
- if (context == null) return;
- PluginBase.MainForm.ShowSettingsDialog("AS3Context", "SDK");
- }
+ var result = MessageBox.Show(TextHelper.GetString("Info.OpenCompilerSettings"), TextHelper.GetString("Title.ConfigurationRequired"), MessageBoxButtons.OKCancel);
+ if (result != DialogResult.OK) return;
+ var context = ASContext.GetLanguageContext("as3");
+ if (context is null) return;
+ PluginBase.MainForm.ShowSettingsDialog("AS3Context", "SDK");
return;
}
@@ -229,7 +200,7 @@ public void RunMxmlc(string cmd, string flexPath)
running = true;
EventManager.DispatchEvent(this, new NotifyEvent(EventType.ProcessStart));
- if (mxmlcRunner == null || !mxmlcRunner.IsRunning || currentSDK != flexPath)
+ if (mxmlcRunner is null || !mxmlcRunner.IsRunning || currentSDK != flexPath)
StartMxmlcRunner(flexPath);
//cmd = mainForm.ProcessArgString(cmd);
@@ -261,30 +232,27 @@ public void QuickBuild(FileModel theFile, string flex2Path, bool requireTag, boo
}
// command
debugMode = false;
- bool hasOutput = false;
- string cmd = "";
- Match mCmd = Regex.Match(PluginBase.MainForm.CurrentDocument.SciControl.Text, "\\s@mxmlc\\s(?.*)");
+ var hasOutput = false;
+ var cmd = "";
+ var mCmd = Regex.Match(PluginBase.MainForm.CurrentDocument?.SciControl.Text, "\\s@mxmlc\\s(?.*)");
if (mCmd.Success)
{
try
{
-
// cleanup tag
- string tag = mCmd.Groups["cmd"].Value;
- if (tag.IndexOf("-->") > 0) tag = tag.Substring(0, tag.IndexOf("-->"));
- if (tag.IndexOf("]]>") > 0) tag = tag.Substring(0, tag.IndexOf("]]>"));
+ var tag = mCmd.Groups["cmd"].Value;
+ if (tag.IndexOfOrdinal("-->") > 0) tag = tag.Substring(0, tag.IndexOfOrdinal("-->"));
+ if (tag.IndexOfOrdinal("]]>") > 0) tag = tag.Substring(0, tag.IndexOfOrdinal("]]>"));
tag = " " + tag.Trim() + " --";
// split
- MatchCollection mPar = re_SplitParams.Matches(tag);
+ var mPar = re_SplitParams.Matches(tag);
if (mPar.Count > 0)
{
cmd = "";
- string op;
- string arg;
for (int i = 0; i < mPar.Count; i++)
{
- op = mPar[i].Groups["switch"].Value;
+ var op = mPar[i].Groups["switch"].Value;
if (op == "--") break;
if (op == "-noplay")
{
@@ -298,8 +266,8 @@ public void QuickBuild(FileModel theFile, string flex2Path, bool requireTag, boo
if (end > start)
{
string concat = ";";
- arg = tag.Substring(start, end - start).Trim();
- if (arg.StartsWith("+=") || arg.StartsWith("="))
+ var arg = tag.Substring(start, end - start).Trim();
+ if (arg.StartsWithOrdinal("+=") || arg.StartsWith('='))
{
concat = arg.Substring(0, arg.IndexOf('=') + 1);
arg = arg.Substring(concat.Length);
@@ -309,7 +277,7 @@ public void QuickBuild(FileModel theFile, string flex2Path, bool requireTag, boo
{
if (pswitch == op)
{
- if (op.EndsWith("namespace"))
+ if (op.EndsWithOrdinal("namespace"))
{
int sp = arg.IndexOf(' ');
if (sp > 0)
@@ -320,10 +288,10 @@ public void QuickBuild(FileModel theFile, string flex2Path, bool requireTag, boo
}
isPath = true;
// remove quotes
- if (arg.StartsWith("\"") && arg.EndsWith("\""))
+ if (arg.StartsWith('\"') && arg.EndsWith('\"'))
arg = arg.Substring(1, arg.Length - 2);
- if (!arg.StartsWith("\\") && !Path.IsPathRooted(arg))
+ if (!arg.StartsWith('\\') && !Path.IsPathRooted(arg))
arg = Path.Combine(buildPath, arg);
}
}
@@ -332,7 +300,7 @@ public void QuickBuild(FileModel theFile, string flex2Path, bool requireTag, boo
builtSWF = arg;
hasOutput = true;
}
- if (!isPath) arg = arg.Replace(" ", ";");
+ if (!isPath) arg = arg.Replace(' ', ';');
cmd += op + concat + arg + ";";
}
else cmd += op + ";";
@@ -347,13 +315,13 @@ public void QuickBuild(FileModel theFile, string flex2Path, bool requireTag, boo
else if (requireTag) return;
// Flex4 static linking
- if (isFlex4SDK && cmd.IndexOf("-static-link-runtime-shared-libraries") < 0)
+ if (isFlex4SDK && !cmd.Contains("-static-link-runtime-shared-libraries"))
cmd += ";-static-link-runtime-shared-libraries=true";
// add current class sourcepath and global classpaths
cmd += ";-sp+=" + theFile.BasePath;
- if (Context.Context.Settings.UserClasspath != null)
- foreach (string cp in Context.Context.Settings.UserClasspath)
+ if (ASContext.Context.Settings.UserClasspath != null)
+ foreach (string cp in ASContext.Context.Settings.UserClasspath)
cmd += ";-sp+=" + cp;
// add output filename
if (!hasOutput)
@@ -373,7 +341,7 @@ public void QuickBuild(FileModel theFile, string flex2Path, bool requireTag, boo
Environment.CurrentDirectory = currentPath;
}
- private void CheckIsFlex4SDK(string flexPath)
+ void CheckIsFlex4SDK(string flexPath)
{
if (checkedSDK == flexPath) return;
checkedSDK = flexPath;
@@ -382,7 +350,7 @@ private void CheckIsFlex4SDK(string flexPath)
if (File.Exists(flexDesc))
{
string src = File.ReadAllText(flexDesc);
- isFlex4SDK = src.IndexOf("4") > 0;
+ isFlex4SDK = src.IndexOfOrdinal("4") > 0;
}
else isFlex4SDK = false;
}
@@ -417,7 +385,7 @@ public void Stop()
///
/// Start background process
///
- private void StartAscRunner(string flexPath)
+ void StartAscRunner(string flexPath)
{
currentSDK = flexPath;
if (ascRunner != null && ascRunner.IsRunning) ascRunner.KillProcess();
@@ -440,7 +408,7 @@ private void StartAscRunner(string flexPath)
///
/// Start background process
///
- private void StartMxmlcRunner(string flexPath)
+ void StartMxmlcRunner(string flexPath)
{
currentSDK = flexPath;
if (mxmlcRunner != null && mxmlcRunner.IsRunning) mxmlcRunner.KillProcess();
@@ -467,13 +435,13 @@ private void StartMxmlcRunner(string flexPath)
#region process output capture
- private int errorState;
- private string errorDesc;
- private bool notificationSent;
+ int errorState;
+ string errorDesc;
+ bool notificationSent;
- private void ascRunner_Error(object sender, string line)
+ void ascRunner_Error(object sender, string line)
{
- if (line.StartsWith("[Compiler] Error"))
+ if (line.StartsWithOrdinal("[Compiler] Error"))
{
errorState = 1;
errorDesc = line.Substring(10);
@@ -481,10 +449,10 @@ private void ascRunner_Error(object sender, string line)
else if (errorState == 1)
{
line = line.Trim();
- Match mErr = Regex.Match(line, @"(?[^,]+), Ln (?[0-9]+), Col (? [0-9]+)");
+ var mErr = Regex.Match(line, @"(?[^,]+), Ln (?[0-9]+), Col (? [0-9]+)");
if (mErr.Success)
{
- string filename = mErr.Groups["file"].Value;
+ var filename = mErr.Groups["file"].Value;
try
{
if (File.Exists(filename))
@@ -493,50 +461,48 @@ private void ascRunner_Error(object sender, string line)
}
}
catch {}
- errorDesc = String.Format("{0}:{1}: col: {2}: {3}", filename, mErr.Groups["line"].Value, mErr.Groups["col"].Value, errorDesc);
+ errorDesc = $"{filename}:{mErr.Groups["line"].Value}: col: {mErr.Groups["col"].Value}: {errorDesc}";
ascRunner_OutputError(sender, errorDesc);
}
errorState++;
}
else if (errorState > 0)
{
- if (line.IndexOf("error found") > 0) errorState = 0;
+ if (line.IndexOfOrdinal("error found") > 0) errorState = 0;
}
else if (line.Trim().Length > 0) ascRunner_OutputError(sender, line);
}
-
- private void ascRunner_OutputError(object sender, string line)
+
+ void ascRunner_OutputError(object sender, string line)
{
- if (line == null) return;
- PluginBase.RunAsync((MethodInvoker)delegate
+ if (line is null) return;
+ PluginBase.RunAsync(delegate
{
- if (line.StartsWith("Exception "))
+ if (line.StartsWithOrdinal("Exception "))
{
TraceManager.AddAsync(line, -3);
return;
}
if (silentChecking)
{
- if (SyntaxError != null) SyntaxError(line);
+ SyntaxError?.Invoke(line);
return;
}
TraceManager.Add(line, -3);
- if (!notificationSent)
- {
- notificationSent = true;
- TraceManager.Add("Done(1)", -2);
- EventManager.DispatchEvent(this, new TextEvent(EventType.ProcessEnd, "Done(1)"));
- ASContext.SetStatusText(TextHelper.GetString("Info.AscDone"));
- EventManager.DispatchEvent(this, new DataEvent(EventType.Command, "ResultsPanel.ShowResults", null));
- }
+ if (notificationSent) return;
+ notificationSent = true;
+ TraceManager.Add("Done(1)", -2);
+ EventManager.DispatchEvent(this, new TextEvent(EventType.ProcessEnd, "Done(1)"));
+ ASContext.SetStatusText(TextHelper.GetString("Info.AscDone"));
+ EventManager.DispatchEvent(this, new DataEvent(EventType.Command, "ResultsPanel.ShowResults", null));
});
}
- private void ascRunner_Output(object sender, string line)
+ void ascRunner_Output(object sender, string line)
{
- if (line.StartsWith("(ash)"))
+ if (line.StartsWithOrdinal("(ash)"))
{
- if (line.IndexOf("Done") > 0)
+ if (line.IndexOfOrdinal("Done") > 0)
{
running = false;
if (!silentChecking && !notificationSent)
@@ -551,21 +517,21 @@ private void ascRunner_Output(object sender, string line)
if (!silentChecking) TraceManager.AddAsync(line, 0);
}
- private void ascRunner_End()
+ static void ascRunner_End()
{
TraceManager.AddAsync("Done(0)", -2);
}
-
- private void mxmlcRunner_Error(object sender, string line)
+
+ static void mxmlcRunner_Error(object sender, string line)
{
TraceManager.AddAsync(line, -3);
}
- private void mxmlcRunner_Output(object sender, string line)
+ void mxmlcRunner_Output(object sender, string line)
{
- PluginBase.RunAsync((MethodInvoker)delegate
+ PluginBase.RunAsync(delegate
{
- if (!notificationSent && line.StartsWith("Done("))
+ if (!notificationSent && line.StartsWithOrdinal("Done("))
{
running = false;
TraceManager.Add(line, -2);
@@ -581,10 +547,10 @@ private void mxmlcRunner_Output(object sender, string line)
else TraceManager.Add(line, 0);
});
}
-
- private void RunAfterBuild()
+
+ void RunAfterBuild()
{
- if (builtSWF == null || !File.Exists(builtSWF))
+ if (!File.Exists(builtSWF))
{
debugMode = false;
return;
diff --git a/External/Plugins/AS3Context/Completion/CodeComplete.cs b/External/Plugins/AS3Context/Completion/CodeComplete.cs
new file mode 100644
index 0000000000..af864d440f
--- /dev/null
+++ b/External/Plugins/AS3Context/Completion/CodeComplete.cs
@@ -0,0 +1,176 @@
+using System.Collections.Generic;
+using System.Linq;
+using ASCompletion.Completion;
+using ASCompletion.Context;
+using ASCompletion.Model;
+using PluginCore;
+using ScintillaNet;
+
+namespace AS3Context.Completion
+{
+ class CodeComplete : ASComplete
+ {
+ ///
+ protected override ASResult EvalExpression(string expression, ASExpr context, FileModel inFile, ClassModel inClass, bool complete, bool asFunction, bool filterVisibility)
+ {
+ if (!string.IsNullOrEmpty(expression))
+ {
+ var ctx = ASContext.Context;
+ var features = ctx.Features;
+ // for example: 1.0., 5e-324.
+ if (char.IsDigit(expression, 0)
+ // for example: -1.
+ || (expression.Length > 1 && expression[0] == '-' && char.IsDigit(expression, 1))
+ // for example: --1.
+ || (expression.Length > 2 && expression[0] == '-' && expression[1] == '-' &&
+ char.IsDigit(expression, 2)))
+ {
+ int p;
+ var pe2 = -1;
+ if (expression.Contains("e-", out var pe1) || expression.Contains("e+", out pe2))
+ {
+ p = expression.IndexOf('.');
+ if (p == -1) p = expression.Length - 1;
+ else if (p < pe1 || p < pe2)
+ {
+ var p2 = expression.IndexOf('.', p + 1);
+ p = p2 != -1 ? p2 : expression.Length - 1;
+ }
+ }
+ else
+ {
+ p = expression.IndexOf('.');
+ if (p == expression.Length - 1) p = -1;
+ else if (p != -1)
+ {
+ // for example: 1.0.
+ if (char.IsDigit(expression[p + 1]))
+ {
+ var p2 = expression.IndexOf('.', p + 1);
+ p = p2 != -1 ? p2 : expression.Length - 1;
+ }
+ // for example: -1.valueOf().
+ else p = -1;
+ }
+ }
+
+ if (p != -1)
+ {
+ expression = "Number.#." + expression.Substring(p + 1);
+ return base.EvalExpression(expression, context, inFile, inClass, complete, asFunction,
+ filterVisibility);
+ }
+ }
+
+ if (context.SubExpressions != null)
+ {
+ var count = context.SubExpressions.Count - 1;
+ // transform #2~.#1~.#0~ to #2~.[].[]
+ for (var i = 0; i <= count; i++)
+ {
+ var subExpression = context.SubExpressions[i];
+ if (subExpression.Length < 2 || subExpression[0] != '[') continue;
+ // for example: [].
+ if (expression[0] == '#' && i == count)
+ {
+ var type = ResolveType(features.arrayKey, inFile);
+ if (type.IsVoid()) break;
+ expression = type.Name + ".#" + expression.Substring(("#" + i + "~").Length);
+ context.SubExpressions.RemoveAt(i);
+ return base.EvalExpression(expression, context, inFile, inClass, complete, asFunction,
+ filterVisibility);
+ }
+
+ expression = expression.Replace(">.#" + i + "~", ">" + subExpression);
+ expression = expression.Replace(".#" + i + "~", "." + subExpression);
+ }
+ }
+
+ if (expression.Length > 1 && expression[0] is { } c && (c == '"' || c == '\''))
+ {
+ var type = ResolveType(features.stringKey, inFile);
+ // for example: ""|, ''|
+ if (context.SubExpressions is null) expression = type.Name + ".#.";
+ // for example: ""., ''.
+ else
+ {
+ var pattern = c + ".#" + (context.SubExpressions.Count - 1) + "~";
+ var startIndex = expression.IndexOfOrdinal(pattern) + pattern.Length;
+ expression = type.Name + ".#" + expression.Substring(startIndex);
+ }
+ }
+ // for example: new [].
+ else if (expression.Contains(">.[")) expression = expression.Replace(">.[", ">[");
+ // transform Vector. to Vector
+ else if (expression.Contains(".<")) expression = expression.Replace(".<", "<");
+ // for example: /pattern/.
+ else if (expression.StartsWithOrdinal("#RegExp")) expression = expression.Substring(1);
+ else if (!context.SubExpressions.IsNullOrEmpty())
+ {
+ var expr = context.SubExpressions.Last();
+ // for example: (v as T)., (v is Complete)., ...
+ if (expr.Length >= 8 /*"(v as T)".Length*/ && expr[0] == '(')
+ {
+ var type = ctx.ResolveToken(expr, inFile);
+ if (!type.IsVoid())
+ {
+ expression = type.Name + ".#" +
+ expression.Substring(("#" + (context.SubExpressions.Count - 1) + "~").Length);
+ context.SubExpressions.RemoveAt(context.SubExpressions.Count - 1);
+ if (context.SubExpressions.Count == 0) context.SubExpressions = null;
+ }
+ }
+ }
+ }
+
+ return base.EvalExpression(expression, context, inFile, inClass, complete, asFunction, filterVisibility);
+ }
+
+ ///
+ protected override bool HandleNewCompletion(ScintillaControl sci, string tail, bool autoHide, string keyword, List list)
+ {
+ if (keyword == "new") list.RemoveAll(it => it is MemberItem {Member: { } member} && (member.Flags & FlagType.Interface) != 0);
+ return base.HandleNewCompletion(sci, tail, autoHide, keyword, list);
+ }
+
+ ///
+ protected override bool IsAvailableForToolTip(ScintillaControl sci, int position)
+ {
+ return base.IsAvailableForToolTip(sci, position)
+ || (sci.GetWordFromPosition(position) is { } word
+ && (word == "as" || word == "is" || word == "instanceof" || word == "typeof" || word == "delete"));
+ }
+
+ ///
+ protected override string GetToolTipTextEx(ASResult expr)
+ {
+ if (expr.Member is null && expr.Context?.Value is {} s)
+ {
+ switch (s)
+ {
+ // for example: variable as$(EntryPoint) Type
+ case "as":
+ expr.Member = Context.StubAsExpression;
+ break;
+ // for example: variable is$(EntryPoint) Type
+ case "is":
+ expr.Member = Context.StubIsExpression;
+ break;
+ // for example: variable instanceof$(EntryPoint) function
+ case "instanceof":
+ expr.Member = Context.StubInstanceOfExpression;
+ break;
+ // for example: typeof(EntryPoint) expression
+ case "typeof":
+ expr.Member = Context.StubTypeOfExpression;
+ break;
+ // for example: delete$(EntryPoint) reference
+ case "delete":
+ expr.Member = Context.StubDeleteExpression;
+ break;
+ }
+ }
+ return base.GetToolTipTextEx(expr);
+ }
+ }
+}
\ No newline at end of file
diff --git a/External/Plugins/AS3Context/Context.cs b/External/Plugins/AS3Context/Context.cs
index 90842c9f7b..46ea4ca287 100644
--- a/External/Plugins/AS3Context/Context.cs
+++ b/External/Plugins/AS3Context/Context.cs
@@ -17,28 +17,129 @@
using ScintillaNet.Enums;
using SwfOp;
using Timer = System.Timers.Timer;
+using AS3Context.Completion;
namespace AS3Context
{
public class Context : AS2Context.Context
{
- static readonly protected Regex re_genericType =
+ protected static readonly Regex re_genericType =
new Regex("(?[^<]+)\\.<(?.+)>$", RegexOptions.Compiled | RegexOptions.IgnoreCase);
// C:\path\to\Main.as$raw$:31: col: 1: Error #1084: Syntax error: expecting rightbrace before end of program.
- static readonly protected Regex re_syntaxError =
+ protected static readonly Regex re_syntaxError =
new Regex("(?.*)\\$raw\\$:(?[0-9]+): col: (? [0-9]+):(?.*)", RegexOptions.Compiled);
- static readonly protected Regex re_customAPI =
+ protected static readonly Regex re_customAPI =
new Regex("[/\\\\](playerglobal|airglobal|builtin)\\.swc", RegexOptions.Compiled | RegexOptions.IgnoreCase);
+ internal static readonly MemberModel StubAsExpression = new MemberModel("as operator", null, FlagType.Declaration, 0)
+ {
+ Comments = "\r\t * Usage " +
+ "\r\t * expression as datatype" +
+ "\r\t * " +
+ "\r\t * Language Version: ActionScript 3.0" +
+ "\r\t * Runtime Versions: Flash Player 9" +
+ "\r\t * " +
+ "\r\t * Evaluates whether an expression specified by the first operand is a member of the data type specified by the second operand." +
+ "\r\t * If the first operand is a member of the data type, the result is the first operand. Otherwise, the result is the value null ." +
+ "\r\t * " +
+ "\r\t * The expression used for the second operand must evaluate to a data type." +
+ "\r\t * " +
+ "\r\t * Operands " +
+ "\r\t * expression :* The value to check against the data type specified." +
+ "\r\t * datatype :Class The data type used to evaluate the expression operand. The special * type, which means untyped, cannot be used." +
+ "\r\t * " +
+ "\r\t * Result " +
+ "\r\t * Object The result is expression if expression is a member of the data type specified in datatype. Otherwise, the result is the value null."
+ };
+
+ internal static readonly MemberModel StubIsExpression = new MemberModel("is operator", null, FlagType.Declaration, 0)
+ {
+ Comments = "\r\t * Usage " +
+ "\r\t * expression is datatype" +
+ "\r\t * " +
+ "\r\t * Language Version: ActionScript 3.0" +
+ "\r\t * Runtime Versions: Flash Player 9" +
+ "\r\t * " +
+ "\r\t * Evaluates whether an object is compatible with a specific data type, class, or interface. Use the is operator instead of the instanceof operator for type comparisons. You can also use the is operator to check whether an object implements an interface." +
+ "\r\t * " +
+ "\r\t * Result " +
+ "\r\t * Boolean A value of true if expression1 is compatible with the data type, class, or interface specified in expression2, and false otherwise."
+ };
+
+ internal static readonly MemberModel StubInstanceOfExpression = new MemberModel("instaceof operator", null, FlagType.Declaration, 0)
+ {
+ Comments = "\r\t * Usage " +
+ "\r\t * expression instanceof function" +
+ "\r\t * " +
+ "\r\t * Language Version: ActionScript 3.0" +
+ "\r\t * Runtime Versions: Flash Player 9" +
+ "\r\t * " +
+ "\r\t * Evaluates whether an expression's prototype chain includes the prototype object for function. The instanceof operator is included for backward compatibility with ECMAScript edition 3, and may be useful for advanced programmers who choose to use prototype-based inheritance with constructor functions instead of classes." +
+ "\r\t * " +
+ "\r\t * To check whether an object is a member of a specific data type, use the is operator." +
+ "\r\t * " +
+ "\r\t * When used with classes, the instanceof operator is similar to the is operator because a class's prototype chain includes all of its superclasses. Interfaces, however, are not included on prototype chains, so the instanceof operator always results in false when used with interfaces, whereas the is operator results in true if an object belongs to a class that implements the specified interface." +
+ "\r\t * " +
+ "\r\t * Note: The ActionScript is operator is the equivalent of the Java instanceof operator." +
+ "\r\t * " +
+ "\r\t * Operands " +
+ "\r\t * expression :Object The object that contains the prototype chain to evaluate." +
+ "\r\t * function :Object A function object (or class)." +
+ "\r\t * " +
+ "\r\t * Result " +
+ "\r\t * Boolean Returns true if the prototype chain of expression includes the prototype object for function , and false otherwise."
+ };
+
+ internal static readonly MemberModel StubTypeOfExpression = new MemberModel("typeof operator", null, FlagType.Declaration, 0)
+ {
+ Comments = "\r\t * Usage " +
+ "\r\t * typeof expression" +
+ "\r\t * " +
+ "\r\t * Language Version: ActionScript 3.0" +
+ "\r\t * Runtime Versions: Flash Player 9" +
+ "\r\t * " +
+ "\r\t * Evaluates expression and returns a string specifying the expression's data type. The result is limited to six possible string values: boolean , function , number , object , string , and xml . If you apply this operator to an instance of a user-defined class, the result is the string object . The typeof operator is included for backward compatibility. Use the is operator to check type compatibility." +
+ "\r\t * " +
+ "\r\t * Operands " +
+ "\r\t * expression :Object An object to evaluate." +
+ "\r\t * " +
+ "\r\t * Result " +
+ "\r\t * String A string representation of the type of expression . The following table shows the results of the typeof operator on each type of expression."
+ };
+
+ internal static readonly MemberModel StubDeleteExpression = new MemberModel("delete operator", null, FlagType.Declaration, 0)
+ {
+ Comments = "\r\t * Usage " +
+ "\r\t * delete reference" +
+ "\r\t * " +
+ "\r\t * Language Version: ActionScript 3.0" +
+ "\r\t * Runtime Versions: Flash Player 9" +
+ "\r\t * " +
+ "\r\t * Destroys the object property specified by reference; the result is true if the property does not exist after the operation completes, and false otherwise. The delete operator returns true if it is called on a nonexistent property or a dynamic property not defined in a class." +
+ "\r\t * " +
+ "\r\t * The delete operator can fail and return false if the reference parameter cannot be deleted. You cannot delete fixed properties or variables that are declared with the var statement. A fixed property is a variable or method defined in a class definition." +
+ "\r\t * " +
+ "\r\t * The delete operator cannot be used to destroy a property of a class, unless that class is a dynamic class added at runtime. Properties of sealed classes cannot be destroyed using delete . Set the property to null instead." +
+ "\r\t * " +
+ "\r\t * Note: You cannot delete an object, but you can make an object eligible for garbage collection by removing all references to the object. The most common reference to an object is a variable that points to it. You can remove such a reference by setting the variable to null . The garbage collector removes any object that has no references." +
+ "\r\t * " +
+ "\r\t * Operands " +
+ "\r\t * reference :* The name of the property to eliminate." +
+ "\r\t * " +
+ "\r\t * Result " +
+ "\r\t * Boolean The value true if the deletion succeeded and false if it failed."
+ };
+
#region initialization
- private AS3Settings as3settings;
- private bool hasAIRSupport;
- private bool hasMobileSupport;
- private MxmlFilterContext mxmlFilterContext; // extract inlined AS3 ranges & MXML tags
- private Timer timerCheck;
- private string fileWithSquiggles;
+
+ readonly AS3Settings as3settings;
+ bool hasAIRSupport;
+ bool hasMobileSupport;
+ MxmlFilterContext mxmlFilterContext; // extract inlined AS3 ranges & MXML tags
+ readonly Timer timerCheck;
+ string fileWithSquiggles;
protected bool mxmlEnabled;
///
@@ -84,7 +185,7 @@ public Context(AS3Settings initSettings)
features.checkFileName = true;
// allowed declarations access modifiers
- Visibility all = Visibility.Public | Visibility.Internal | Visibility.Protected | Visibility.Private;
+ const Visibility all = Visibility.Public | Visibility.Internal | Visibility.Protected | Visibility.Private;
features.classModifiers = all;
features.varModifiers = all;
features.constModifiers = all;
@@ -96,24 +197,21 @@ public Context(AS3Settings initSettings)
features.methodModifierDefault = Visibility.Internal;
// keywords
+ features.ClassKey = "class";
+ features.InterfaceKey = "interface";
+ features.PackageKey = "package";
+ features.ExtendsKey = "extends";
+ features.ImplementsKey = "implements";
features.dot = ".";
features.voidKey = "void";
features.objectKey = "Object";
features.booleanKey = "Boolean";
features.numberKey = "Number";
+ features.IntegerKey = "int";
+ features.stringKey = "String";
features.arrayKey = "Array";
+ features.dynamicKey = "*";
features.importKey = "import";
- features.typesPreKeys = new string[] { "import", "new", "typeof", "is", "as", "extends", "implements" };
- features.codeKeywords = new string[] {
- "var", "function", "const", "new", "delete", "typeof", "is", "as", "return",
- "break", "continue", "if", "else", "for", "each", "in", "while", "do", "switch", "case", "default", "with",
- "null", "true", "false", "try", "catch", "finally", "throw", "use", "namespace"
- };
- features.accessKeywords = new string[] {
- "extern", "dynamic", "final", "public", "private", "protected", "internal", "static", "override"
- };
- features.declKeywords = new string[] { "var", "function", "const", "namespace", "get", "set" };
- features.typesKeywords = new string[] { "import", "class", "interface" };
features.varKey = "var";
features.constKey = "const";
features.functionKey = "function";
@@ -128,37 +226,56 @@ public Context(AS3Settings initSettings)
features.privateKey = "private";
features.intrinsicKey = "extern";
features.namespaceKey = "namespace";
-
- /* INITIALIZATION */
+ features.ThisKey = "this";
+ features.BaseKey = "super";
+ features.ReturnKey = "return";
+ features.typesPreKeys = new[] { features.importKey, "new", "typeof", "instanceof", "is", "as", features.ExtendsKey, features.ImplementsKey };
+ features.codeKeywords = new[] {
+ "var", "function", "const", "new", "delete", "typeof", "is", "as", features.ReturnKey,
+ "break", "continue", "if", "else", "for", "each", "in", "while", "do", "switch", "case", "default", "with",
+ "null", "true", "false", "try", "catch", "finally", "throw", "use", "namespace", "instanceof",
+ };
+ features.accessKeywords = new[] {"native", "dynamic", "final", "public", "private", "protected", "internal", "static", "override"};
+ features.declKeywords = new[] {features.varKey, features.functionKey, features.constKey, features.namespaceKey, features.getKey, features.setKey};
+ features.typesKeywords = new[] {features.importKey, features.ClassKey, features.InterfaceKey};
+ features.ArithmeticOperators = new HashSet {'+', '-', '*', '/', '%'};
+ features.IncrementDecrementOperators = new[] {"++", "--"};
+ features.BitwiseOperators = new[] {"~", "&", "|", "^", "<<", ">>", ">>>"};
+ features.BooleanOperators = new[] {"<", ">", "&&", "||", "!=", "==", "!==", "===", "!"};
+ features.TernaryOperators = new[] {"?", ":"};
+ features.Literals = new HashSet {"int", "uint"};
+ features.OperatorKeywords = new HashSet
+ {
+ "case",
+ "in",
+ "throw",
+ "typeof",
+ "delete",
+ };
settings = initSettings;
- //BuildClassPath(); // defered to first use
+ CodeComplete = new CodeComplete();
// live syntax checking
- timerCheck = new Timer(500);
- timerCheck.SynchronizingObject = PluginBase.MainForm as Form;
- timerCheck.AutoReset = false;
- timerCheck.Elapsed += new ElapsedEventHandler(timerCheck_Elapsed);
- FlexShells.SyntaxError += new SyntaxErrorHandler(FlexShell_SyntaxError);
+ timerCheck = new Timer(500) {SynchronizingObject = PluginBase.MainForm as Form, AutoReset = false};
+ timerCheck.Elapsed += timerCheck_Elapsed;
+ FlexShells.SyntaxError += FlexShell_SyntaxError;
}
#endregion
#region classpath management
///
- /// Classpathes & classes cache initialisation
+ /// Classpathes & classes cache initialization
///
public override void BuildClassPath()
{
ReleaseClasspath();
started = true;
- if (as3settings == null) throw new Exception("BuildClassPath() must be overridden");
- if (contextSetup == null)
+ if (as3settings is null) throw new Exception("BuildClassPath() must be overridden");
+ contextSetup ??= new ContextSetupInfos
{
- contextSetup = new ContextSetupInfos();
- contextSetup.Lang = settings.LanguageId;
- contextSetup.Platform = "Flash Player";
- contextSetup.Version = as3settings.DefaultFlashVersion;
- }
+ Lang = settings.LanguageId, Platform = "Flash Player", Version = as3settings.DefaultFlashVersion
+ };
// external version definition
platform = contextSetup.Platform;
@@ -168,8 +285,9 @@ public override void BuildClassPath()
hasAIRSupport = platform == "AIR" || platform == "AIR Mobile";
hasMobileSupport = platform == "AIR Mobile";
- string cpCheck = contextSetup.Classpath != null ?
- String.Join(";", contextSetup.Classpath).Replace('\\', '/') : "";
+ var cpCheck = contextSetup.Classpath != null
+ ? string.Join(";", contextSetup.Classpath).Replace('\\', '/')
+ : "";
// check if CP contains a custom playerglobal.swc
bool hasCustomAPI = re_customAPI.IsMatch(cpCheck);
@@ -187,22 +305,21 @@ public override void BuildClassPath()
: as3settings.GetDefaultSDK().Path;
char S = Path.DirectorySeparatorChar;
- if (compiler == null)
- compiler = Path.Combine(PathHelper.ToolDir, "flexlibs");
+ compiler ??= Path.Combine(PathHelper.ToolDir, "flexlibs");
string frameworks = compiler + S + "frameworks";
string sdkLibs = frameworks + S + "libs";
- string sdkLocales = frameworks + S + "locale" + S + PluginBase.MainForm.Settings.LocaleVersion;
+ string sdkLocales = frameworks + S + "locale" + S + PluginBase.Settings.LocaleVersion;
string fallbackLibs = PathHelper.ResolvePath(PathHelper.ToolDir + S + "flexlibs" + S + "frameworks" + S + "libs");
string fallbackLocale = PathHelper.ResolvePath(PathHelper.ToolDir + S + "flexlibs" + S + "frameworks" + S + "locale" + S + "en_US");
List addLibs = new List();
List addLocales = new List();
- if (!Directory.Exists(sdkLibs) && !sdkLibs.StartsWith("$")) // fallback
+ if (!Directory.Exists(sdkLibs) && !sdkLibs.StartsWith('$')) // fallback
{
sdkLibs = PathHelper.ResolvePath(PathHelper.ToolDir + S + "flexlibs" + S + "frameworks" + S + "libs" + S + "player");
}
- if (majorVersion > 0 && !String.IsNullOrEmpty(sdkLibs) && Directory.Exists(sdkLibs))
+ if (majorVersion > 0 && Directory.Exists(sdkLibs))
{
// core API SWC
if (!hasCustomAPI)
@@ -214,16 +331,16 @@ public override void BuildClassPath()
}
else
{
- bool swcPresent = false;
- string playerglobal = MatchPlayerGlobalExact(majorVersion, minorVersion, sdkLibs);
+ var swcPresent = false;
+ var playerglobal = MatchPlayerGlobalExact(majorVersion, minorVersion, sdkLibs);
if (playerglobal != null) swcPresent = true;
else playerglobal = MatchPlayerGlobalExact(majorVersion, minorVersion, fallbackLibs);
- if (playerglobal == null) playerglobal = MatchPlayerGlobalAny(ref majorVersion, ref minorVersion, fallbackLibs);
- if (playerglobal == null) playerglobal = MatchPlayerGlobalAny(ref majorVersion, ref minorVersion, sdkLibs);
+ playerglobal ??= MatchPlayerGlobalAny(ref majorVersion, ref minorVersion, fallbackLibs)
+ ?? MatchPlayerGlobalAny(ref majorVersion, ref minorVersion, sdkLibs);
if (playerglobal != null)
{
// add missing SWC in new SDKs
- if (!swcPresent && sdkLibs.IndexOf(S + "flexlibs") < 0 && Directory.Exists(compiler))
+ if (!swcPresent && !sdkLibs.Contains(S + "flexlibs") && Directory.Exists(compiler))
{
string swcDir = sdkLibs + S + "player" + S;
if (!Directory.Exists(swcDir + "9") && !Directory.Exists(swcDir + "10"))
@@ -257,35 +374,35 @@ public override void BuildClassPath()
// Flex framework
if (cpCheck.IndexOf("Library/AS3/frameworks/Flex", StringComparison.OrdinalIgnoreCase) >= 0)
- {
- bool isFlexJS = cpCheck.IndexOf("Library/AS3/frameworks/FlexJS", StringComparison.OrdinalIgnoreCase) >= 0;
-
- if (!isFlexJS)
- {
- addLibs.Add("framework.swc");
- addLibs.Add("mx/mx.swc");
- addLibs.Add("rpc.swc");
- addLibs.Add("datavisualization.swc");
- addLibs.Add("flash-integration.swc");
- addLocales.Add("framework_rb.swc");
- addLocales.Add("mx_rb.swc");
- addLocales.Add("rpc_rb.swc");
- addLocales.Add("datavisualization_rb.swc");
- addLocales.Add("flash-integration_rb.swc");
+ {
+ bool isFlexJS = cpCheck.IndexOf("Library/AS3/frameworks/FlexJS", StringComparison.OrdinalIgnoreCase) >= 0;
+
+ if (!isFlexJS)
+ {
+ addLibs.Add("framework.swc");
+ addLibs.Add("mx/mx.swc");
+ addLibs.Add("rpc.swc");
+ addLibs.Add("datavisualization.swc");
+ addLibs.Add("flash-integration.swc");
+ addLocales.Add("framework_rb.swc");
+ addLocales.Add("mx_rb.swc");
+ addLocales.Add("rpc_rb.swc");
+ addLocales.Add("datavisualization_rb.swc");
+ addLocales.Add("flash-integration_rb.swc");
}
if (hasAIRSupport)
{
addLibs.Add("air" + S + "airframework.swc");
addLocales.Add("airframework_rb.swc");
- }
-
- if (isFlexJS)
- {
- string flexJsLibs = frameworks + S + "as" + S + "libs";
- addLibs.Add(flexJsLibs + S + "FlexJSUI.swc");
- //addLibs.Add(flexJsLibs + S + "FlexJSJX.swc");
- MxmlFilter.AddManifest("http://ns.adobe.com/mxml/2009", as3Fmk + S + "FlexJS" + S + "manifest.xml");
+ }
+
+ if (isFlexJS)
+ {
+ string flexJsLibs = frameworks + S + "as" + S + "libs";
+ addLibs.Add(flexJsLibs + S + "FlexJSUI.swc");
+ //addLibs.Add(flexJsLibs + S + "FlexJSJX.swc");
+ MxmlFilter.AddManifest("http://ns.adobe.com/mxml/2009", as3Fmk + S + "FlexJS" + S + "manifest.xml");
}
else if (cpCheck.IndexOf("Library/AS3/frameworks/Flex4", StringComparison.OrdinalIgnoreCase) >= 0)
{
@@ -332,23 +449,14 @@ public override void BuildClassPath()
}
// intrinsics (deprecated, excepted for FP10 Vector.)
- string fp9cp = as3settings.AS3ClassPath + S + "FP9";
- AddPath(PathHelper.ResolvePath(fp9cp));
- if (majorVersion > 9)
- {
- for (int i = 10; i <= majorVersion; i++)
- {
- string fp10cp = as3settings.AS3ClassPath + S + "FP" + i;
- AddPath(PathHelper.ResolvePath(fp10cp));
- for (int j = 1; j <= minorVersion; j++)
- {
- string fp101cp = as3settings.AS3ClassPath + S + "FP" + majorVersion + "." + minorVersion;
- AddPath(PathHelper.ResolvePath(fp101cp));
- }
- }
+ // add from the highest version number (FP11 > FP10 > FP9)
+ string fp = as3settings.AS3ClassPath + S + "FP";
+ for (int i = majorVersion; i >= 9; i--)
+ {
+ AddPath(PathHelper.ResolvePath(fp + i));
}
- // add external pathes
+ // add external paths
List initCP = classPath;
classPath = new List();
if (contextSetup.Classpath != null)
@@ -359,20 +467,20 @@ public override void BuildClassPath()
// add library
AddPath(PathHelper.LibraryDir + S + "AS3" + S + "classes");
- // add user pathes from settings
- if (settings.UserClasspath != null && settings.UserClasspath.Length > 0)
+ // add user paths from settings
+ if (!settings.UserClasspath.IsNullOrEmpty())
{
foreach (string cpath in settings.UserClasspath) AddPath(cpath.Trim());
}
- // add initial pathes
+ // add initial paths
foreach (PathModel mpath in initCP) AddPath(mpath);
// parse top-level elements
InitTopLevelElements();
if (cFile != null) UpdateTopLevelElements();
- // add current temporaty path
+ // add current temporary path
if (temporaryPath != null)
{
string tempPath = temporaryPath;
@@ -385,7 +493,7 @@ public override void BuildClassPath()
///
/// Find any playerglobal.swc
///
- private string MatchPlayerGlobalAny(ref int majorVersion, ref int minorVersion, string sdkLibs)
+ string MatchPlayerGlobalAny(ref int majorVersion, ref int minorVersion, string sdkLibs)
{
char S = Path.DirectorySeparatorChar;
string libPlayer = sdkLibs + S + "player";
@@ -402,7 +510,7 @@ private string MatchPlayerGlobalAny(ref int majorVersion, ref int minorVersion,
if (Directory.Exists(libPlayer + S + majorVersion))
playerglobal = "player" + S + majorVersion + S + "playerglobal.swc";
- if (playerglobal == null && majorVersion > 9)
+ if (playerglobal is null && majorVersion > 9)
{
int tempMajor = majorVersion - 1;
int tempMinor = 9;
@@ -421,7 +529,7 @@ private string MatchPlayerGlobalAny(ref int majorVersion, ref int minorVersion,
///
/// Find version-matching playerglobal.swc
///
- private string MatchPlayerGlobalExact(int majorVersion, int minorVersion, string sdkLibs)
+ string MatchPlayerGlobalExact(int majorVersion, int minorVersion, string sdkLibs)
{
string playerglobal = null;
char S = Path.DirectorySeparatorChar;
@@ -438,25 +546,22 @@ private string MatchPlayerGlobalExact(int majorVersion, int minorVersion, string
///
public override string[] GetExplorerMask()
{
- string[] mask = as3settings.AS3FileTypes;
- if (mask == null || mask.Length == 0 || (mask.Length == 1 && mask[1] == ""))
+ var mask = as3settings.AS3FileTypes;
+ if (mask.IsNullOrEmpty() || (mask.Length == 1 && mask[0] == ""))
{
- as3settings.AS3FileTypes = mask = new string[] { "*.as", "*.mxml" };
+ as3settings.AS3FileTypes = mask = new[] { "*.as", "*.mxml" };
return mask;
}
- else
+ var patterns = new List();
+ foreach (var it in mask)
{
- List patterns = new List();
- for (int i = 0; i < mask.Length; i++)
- {
- string m = mask[i];
- if (string.IsNullOrEmpty(m)) continue;
- if (m[1] != '.' && m[0] != '.') m = '.' + m;
- if (m[0] != '*') m = '*' + m;
- patterns.Add(m);
- }
- return patterns.ToArray();
+ string m = it;
+ if (string.IsNullOrEmpty(m)) continue;
+ if (m[1] != '.' && m[0] != '.') m = '.' + m;
+ if (m[0] != '*') m = '*' + m;
+ patterns.Add(m);
}
+ return patterns.ToArray();
}
///
@@ -509,30 +614,29 @@ public override void ExploreVirtualPath(PathModel path)
public override void RemoveClassCompilerCache()
{
// not implemented - is there any?
- }
-
- ///
- /// Create a new file model without parsing file
- ///
- /// Full path
- /// File model
- public override FileModel CreateFileModel(string fileName)
- {
- if (string.IsNullOrEmpty(fileName) || !File.Exists(fileName))
- return new FileModel(fileName);
-
- fileName = PathHelper.GetLongPathName(fileName);
- if (mxmlEnabled && fileName.EndsWith(".mxml", StringComparison.OrdinalIgnoreCase))
- {
- FileModel nFile = new FileModel(fileName);
- nFile.Context = this;
- nFile.HasFiltering = true;
- return nFile;
- }
- else return base.CreateFileModel(fileName);
}
- private void GuessPackage(string fileName, FileModel nFile)
+ ///
+ /// Create a new file model without parsing file
+ ///
+ /// Full path
+ /// File model
+ public override FileModel CreateFileModel(string fileName)
+ {
+ if (!File.Exists(fileName)) return new FileModel(fileName);
+ fileName = PathHelper.GetLongPathName(fileName);
+ if (mxmlEnabled && fileName.EndsWith(".mxml", StringComparison.OrdinalIgnoreCase))
+ {
+ FileModel nFile = new FileModel(fileName);
+ nFile.Context = this;
+ nFile.HasFiltering = true;
+ return nFile;
+ }
+
+ return base.CreateFileModel(fileName);
+ }
+
+ void GuessPackage(string fileName, FileModel nFile)
{
foreach(PathModel aPath in classPath)
if (fileName.StartsWith(aPath.Path, StringComparison.OrdinalIgnoreCase))
@@ -545,15 +649,6 @@ private void GuessPackage(string fileName, FileModel nFile)
}
}
- ///
- /// Build the file DOM
- ///
- /// File path
- protected override void GetCurrentFileModel(string fileName)
- {
- base.GetCurrentFileModel(fileName);
- }
-
///
/// Refresh the file model
///
@@ -572,16 +667,6 @@ public override void UpdateCurrentFile(bool updateUI)
}
}
- ///
- /// Update the class/member context for the given line number.
- /// Be carefull to restore the context after calling it with a custom line number
- ///
- ///
- public override void UpdateContext(int line)
- {
- base.UpdateContext(line);
- }
-
///
/// Called if a FileModel needs filtering
/// - define inline AS3 ranges
@@ -612,8 +697,9 @@ public override void FilterSource(FileModel model)
internal void OnFileOperation(NotifyEvent e)
{
timerCheck.Stop();
- foreach (ITabbedDocument doc in PluginBase.MainForm.Documents)
- if (doc.FileName == fileWithSquiggles) ClearSquiggles(doc.SciControl);
+ foreach (var doc in PluginBase.MainForm.Documents)
+ if (doc.SciControl is { } sci && sci.FileName == fileWithSquiggles)
+ ClearSquiggles(sci);
}
public override void TrackTextChange(ScintillaControl sender, int position, int length, int linesAdded)
@@ -626,42 +712,38 @@ public override void TrackTextChange(ScintillaControl sender, int position, int
}
}
- private void timerCheck_Elapsed(object sender, ElapsedEventArgs e)
- {
- BackgroundSyntaxCheck();
- }
+ void timerCheck_Elapsed(object sender, ElapsedEventArgs e) => BackgroundSyntaxCheck();
///
/// Checking syntax of current file
///
- private void BackgroundSyntaxCheck()
+ void BackgroundSyntaxCheck()
{
if (!IsFileValid) return;
- ScintillaControl sci = CurSciControl;
- if (sci == null) return;
+ var sci = PluginBase.MainForm.CurrentDocument?.SciControl;
+ if (sci is null) return;
ClearSquiggles(sci);
- string src = CurSciControl.Text;
- string sdk = PluginBase.CurrentProject != null && PluginBase.CurrentProject.Language == "as3"
+ var sdk = PluginBase.CurrentProject != null && PluginBase.CurrentProject.Language == "as3"
? PluginBase.CurrentProject.CurrentSDK
: as3settings.GetDefaultSDK().Path;
- FlexShells.Instance.CheckAS3(CurrentFile, sdk, src);
- }
-
- private void AddSquiggles(ScintillaControl sci, int line, int start, int end)
- {
- if (sci == null) return;
- fileWithSquiggles = CurrentFile;
- int position = sci.PositionFromLine(line) + start;
- sci.AddHighlight(2, (int)IndicatorStyle.Squiggle, 0x000000ff, position, end - start);
+ FlexShells.Instance.CheckAS3(CurrentFile, sdk, sci.Text);
+ }
+
+ void AddSquiggles(ScintillaControl sci, int line, int start, int end)
+ {
+ if (sci is null) return;
+ fileWithSquiggles = CurrentFile;
+ int position = sci.PositionFromLine(line) + start;
+ sci.AddHighlight(2, (int)IndicatorStyle.Squiggle, 0x000000ff, position, end - start);
}
- private void ClearSquiggles(ScintillaControl sci)
+ void ClearSquiggles(ScintillaControl sci)
{
- if (sci == null) return;
+ if (sci is null) return;
try
- {
+ {
sci.RemoveHighlights(2);
}
finally
@@ -670,26 +752,25 @@ private void ClearSquiggles(ScintillaControl sci)
}
}
- private void FlexShell_SyntaxError(string error)
+ void FlexShell_SyntaxError(string error)
{
if (!IsFileValid) return;
- Match m = re_syntaxError.Match(error);
+ var document = PluginBase.MainForm.CurrentDocument;
+ if (document is null || !document.IsEditable) return;
+ var m = re_syntaxError.Match(error);
if (!m.Success) return;
- ITabbedDocument document = PluginBase.MainForm.CurrentDocument;
- if (document == null || !document.IsEditable) return;
-
- ScintillaControl sci = document.SplitSci1;
- ScintillaControl sci2 = document.SplitSci2;
+ var sci1 = document.SplitSci1;
+ var sci2 = document.SplitSci2;
if (m.Groups["filename"].Value != CurrentFile) return;
try
{
int line = int.Parse(m.Groups["line"].Value) - 1;
- if (sci.LineCount < line) return;
- int start = MBSafeColumn(sci, line, int.Parse(m.Groups["col"].Value) - 1);
- if (line == sci.LineCount && start == 0 && line > 0) start = -1;
- AddSquiggles(sci, line, start, start + 1);
+ if (sci1.LineCount < line) return;
+ int start = MBSafeColumn(sci1, line, int.Parse(m.Groups["col"].Value) - 1);
+ if (line == sci1.LineCount && start == 0 && line > 0) start = -1;
+ AddSquiggles(sci1, line, start, start + 1);
AddSquiggles(sci2, line, start, start + 1);
}
catch { }
@@ -698,9 +779,9 @@ private void FlexShell_SyntaxError(string error)
///
/// Convert multibyte column to byte length
///
- private int MBSafeColumn(ScintillaControl sci, int line, int length)
+ static int MBSafeColumn(ScintillaControl sci, int line, int length)
{
- String text = sci.GetLine(line) ?? "";
+ var text = sci.GetLine(line) ?? "";
length = Math.Min(length, text.Length);
return sci.MBSafeTextLength(text.Substring(0, length));
}
@@ -717,27 +798,27 @@ private int MBSafeColumn(ScintillaControl sci, int line, int length)
/// Completion visibility
public override Visibility TypesAffinity(ClassModel inClass, ClassModel withClass)
{
- if (inClass == null || withClass == null) return Visibility.Public;
+ if (inClass is null || withClass is null) return Visibility.Public;
// same file
if (inClass.InFile == withClass.InFile)
return Visibility.Public | Visibility.Internal | Visibility.Protected | Visibility.Private;
// same package
- Visibility acc = Visibility.Public;
- if (inClass.InFile.Package == withClass.InFile.Package) acc |= Visibility.Internal;
+ var result = Visibility.Public;
+ if (inClass.InFile.Package == withClass.InFile.Package) result |= Visibility.Internal;
// inheritance affinity
- ClassModel tmp = inClass;
+ var tmp = inClass;
while (!tmp.IsVoid())
{
if (tmp.Type == withClass.Type)
{
- acc |= Visibility.Protected;
+ result |= Visibility.Protected;
break;
}
tmp = tmp.Extends;
}
- return acc;
+ return result;
}
///
@@ -750,49 +831,49 @@ public override MemberList GetAllProjectClasses()
if (!completionCache.IsDirty && completionCache.AllTypes != null)
return completionCache.AllTypes;
- MemberList fullList = new MemberList();
+ var fullList = new MemberList();
ClassModel aClass;
MemberModel item;
// public & internal classes
- string package = CurrentModel.Package;
- foreach (PathModel aPath in classPath) if (aPath.IsValid && !aPath.Updating)
- {
- aPath.ForeachFile((aFile) =>
+ string package = CurrentModel?.Package;
+ foreach (var aPath in classPath)
+ if (aPath.IsValid && !aPath.Updating)
{
- if (!aFile.HasPackage)
- return true; // skip
-
- aClass = aFile.GetPublicClass();
- if (!aClass.IsVoid() && aClass.IndexType == null)
+ aPath.ForeachFile((aFile) =>
{
- if (aClass.Access == Visibility.Public
- || (aClass.Access == Visibility.Internal && aFile.Package == package))
+ if (!aFile.HasPackage)
+ return true; // skip
+
+ aClass = aFile.GetPublicClass();
+ if (!aClass.IsVoid() && aClass.IndexType is null)
{
- item = aClass.ToMemberModel();
- item.Name = item.Type;
- fullList.Add(item);
+ if (aClass.Access == Visibility.Public
+ || (aClass.Access == Visibility.Internal && aFile.Package == package))
+ {
+ item = aClass.ToMemberModel();
+ item.Name = item.Type;
+ fullList.Add(item);
+ }
}
- }
- if (aFile.Package.Length > 0 && aFile.Members.Count > 0)
- {
- foreach (MemberModel member in aFile.Members)
+ if (aFile.Package.Length > 0 && aFile.Members.Count > 0)
{
- item = member.Clone() as MemberModel;
- item.Name = aFile.Package + "." + item.Name;
- fullList.Add(item);
+ foreach (var member in aFile.Members)
+ {
+ item = member.Clone();
+ item.Name = aFile.Package + "." + item.Name;
+ fullList.Add(item);
+ }
}
- }
- else if (aFile.Members.Count > 0)
- {
- foreach (MemberModel member in aFile.Members)
+ else if (aFile.Members.Count > 0)
{
- item = member.Clone() as MemberModel;
- fullList.Add(item);
+ foreach (var member in aFile.Members)
+ {
+ fullList.Add(member.Clone());
+ }
}
- }
- return true;
- });
- }
+ return true;
+ });
+ }
// void
fullList.Add(new MemberModel(features.voidKey, features.voidKey, FlagType.Class | FlagType.Intrinsic, 0));
// private classes
@@ -806,56 +887,41 @@ public override MemberList GetAllProjectClasses()
public override bool OnCompletionInsert(ScintillaControl sci, int position, string text, char trigger)
{
- if (text == "Vector")
+ if (text != "Vector") return text.StartsWithOrdinal("Vector.<");
+ string insert = null;
+ var line = sci.GetLine(sci.LineFromPosition(position));
+ var m = Regex.Match(line, @"\s*=\s*new");
+ if (m.Success)
{
- string insert = null;
- string line = sci.GetLine(sci.LineFromPosition(position));
- Match m = Regex.Match(line, @"\svar\s+(?.+)\s*:\s*Vector\.<(?.+)(?=(>\s*=))");
- if (m.Success)
- {
- insert = String.Format(".<{0}>", m.Groups["indextype"].Value);
- }
- else
- {
- m = Regex.Match(line, @"\s*=\s*new");
- if (m.Success)
- {
- ASResult result = ASComplete.GetExpressionType(sci, sci.PositionFromLine(sci.LineFromPosition(position)) + m.Index);
- if (result != null && !result.IsNull() && result.Member != null && result.Member.Type != null)
- {
- m = Regex.Match(result.Member.Type, @"(?<=<).+(?=>)");
- if (m.Success)
- {
- insert = String.Format(".<{0}>", m.Value);
- }
- }
- }
- if (insert == null)
- {
- if (trigger == '.' || trigger == '(') return true;
- insert = ".<>";
- sci.InsertText(position + text.Length, insert);
- sci.CurrentPos = position + text.Length + 2;
- sci.SetSel(sci.CurrentPos, sci.CurrentPos);
- ASComplete.HandleAllClassesCompletion(sci, "", false, true);
- return true;
- }
- }
- if (trigger == '.')
- {
- sci.InsertText(position + text.Length, insert.Substring(1));
- sci.CurrentPos = position + text.Length;
- }
- else
+ var result = ASComplete.GetExpressionType(sci, sci.PositionFromLine(sci.LineFromPosition(position)) + m.Index);
+ if (result != null && !result.IsNull() && result.Member?.Type != null)
{
- sci.InsertText(position + text.Length, insert);
- sci.CurrentPos = position + text.Length + insert.Length;
+ m = Regex.Match(result.Member.Type, @"(?<=<).+(?=>)");
+ if (m.Success) insert = $".<{m.Value}>";
}
+ }
+ if (insert is null)
+ {
+ if (trigger == '.' || trigger == '(') return true;
+ insert = ".<>";
+ sci.InsertText(position + text.Length, insert);
+ sci.CurrentPos = position + text.Length + 2;
sci.SetSel(sci.CurrentPos, sci.CurrentPos);
+ ASComplete.HandleAllClassesCompletion(sci, "", false, true);
return true;
}
-
- return false;
+ if (trigger == '.')
+ {
+ sci.InsertText(position + text.Length, insert.Substring(1));
+ sci.CurrentPos = position + text.Length;
+ }
+ else
+ {
+ sci.InsertText(position + text.Length, insert);
+ sci.CurrentPos = position + text.Length + insert.Length;
+ }
+ sci.SetSel(sci.CurrentPos, sci.CurrentPos);
+ return true;
}
///
@@ -867,74 +933,142 @@ public override bool OnCompletionInsert(ScintillaControl sci, int position, stri
/// Position in the file
public override bool IsImported(MemberModel member, int atLine)
{
- FileModel cFile = Context.CurrentModel;
- // same package is auto-imported
- string package = member.Type.Length > member.Name.Length
+ if (member == ClassModel.VoidClass) return false;
+ var package = member.InFile?.Package;
+ if (string.IsNullOrEmpty(package)) package = null;
+ package ??= member.Type.Length > member.Name.Length
? member.Type.Substring(0, member.Type.Length - member.Name.Length - 1)
- : "";
- if (package == cFile.Package) return true;
- return base.IsImported(member, atLine);
+ : string.Empty;
+ if (package == "globalClassifier") return true;
+ // same package is auto-imported
+ return package == Context.CurrentModel.Package || base.IsImported(member, atLine);
}
///
/// Retrieves a class model from its name
///
/// Class (short or full) name
- /// Current file
+ /// Current file
/// A parsed class or an empty ClassModel if the class is not found
public override ClassModel ResolveType(string cname, FileModel inFile)
{
// handle generic types
- if (cname != null && cname.IndexOf('<') > 0)
+ if (!string.IsNullOrEmpty(cname))
{
- Match genType = re_genericType.Match(cname);
- if (genType.Success)
- return ResolveGenericType(genType.Groups["gen"].Value, genType.Groups["type"].Value, inFile);
- else return ClassModel.VoidClass;
+ var index = cname.IndexOf('<');
+ if (index != -1)
+ {
+ if (index == 0)
+ {
+ // transform [] to Vector.
+ cname = Regex.Replace(cname, @">\[.*", ">");
+ cname = "Vector." + cname;
+ }
+ // transform Vector to Vector.
+ if (cname.Contains("Vector<")) cname = cname.Replace("Vector<", "Vector.<");
+ var genType = re_genericType.Match(cname);
+ return genType.Success
+ ? ResolveGenericType(genType.Groups["gen"].Value, genType.Groups["type"].Value, inFile)
+ : ClassModel.VoidClass;
+ }
}
return base.ResolveType(cname, inFile);
}
+ static readonly Regex re_asExpr = new Regex(@"\((?.+)\s(?as)\s+(?\w+)\)");
+ static readonly Regex re_isExpr = new Regex(@"\((?.+)\s(?is)\s+(?\w+)\)");
+
+ public override ClassModel ResolveToken(string token, FileModel inFile)
+ {
+ var tokenLength = token?.Length ?? 0;
+ if (tokenLength > 0)
+ {
+ if (token.StartsWithOrdinal("0x")) return ResolveType("uint", inFile);
+ var first = token[0];
+ if (first == '<' && tokenLength >= 3 && token[tokenLength - 2] == '/' && token[tokenLength - 1] == '>') return ResolveType("XML", inFile);
+ if (first == '(' && token[token.Length - 1] == ')')
+ {
+ if (re_isExpr.IsMatch(token)) return ResolveType(features.booleanKey, inFile);
+ var m = re_asExpr.Match(token);
+ if (m.Success) return ResolveType(m.Groups["rv"].Value.Trim(), inFile);
+ }
+ if (char.IsLetter(first))
+ {
+ var index = token.IndexOf(' ');
+ if (index != -1)
+ {
+ var word = token.Substring(0, index);
+ if (word == "new")
+ {
+ var dot = ' ';
+ var parCount = 0;
+ for (var i = 0; i < tokenLength; i++)
+ {
+ var c = token[i];
+ if (c == '(') parCount++;
+ else if (c == ')')
+ {
+ parCount--;
+ if (parCount == 0) dot = '.';
+ }
+ else if (dot != ' ' && c == dot) return ClassModel.VoidClass;
+ }
+ token = token.Substring(index + 1);
+ if (token[token.Length - 1] == ')') token = Regex.Replace(token, @"\(.*", string.Empty);
+ return ResolveType(token, inFile);
+ }
+ }
+ }
+ }
+ return base.ResolveToken(token, inFile);
+ }
+
///
/// Retrieve/build typed copies of generic types
///
- private ClassModel ResolveGenericType(string baseType, string indexType, FileModel inFile)
+ ClassModel ResolveGenericType(string baseType, string indexType, FileModel inFile)
{
- ClassModel originalClass = base.ResolveType(baseType, inFile);
+ var originalClass = base.ResolveType(baseType, inFile);
if (originalClass.IsVoid()) return originalClass;
+ if (indexType == "*")
+ {
+ originalClass.IndexType = "*";
+ return originalClass;
+ }
- ClassModel indexClass = ResolveType(indexType, inFile);
+ var indexClass = ResolveType(indexType, inFile);
if (indexClass.IsVoid()) return originalClass;
indexType = indexClass.QualifiedName;
FileModel aFile = originalClass.InFile;
// is the type already cloned?
- foreach (ClassModel otherClass in aFile.Classes)
+ foreach (var otherClass in aFile.Classes)
if (otherClass.IndexType == indexType) return otherClass;
// clone the type
- ClassModel aClass = originalClass.Clone() as ClassModel;
-
+ var aClass = originalClass.Clone();
aClass.Name = baseType + ".<" + indexType + ">";
aClass.IndexType = indexType;
string typed = "<" + indexType + ">";
- foreach (MemberModel member in aClass.Members)
+ foreach (var member in aClass.Members)
{
if (member.Name == baseType) member.Name = baseType.Replace("", typed);
- if (member.Type != null && member.Type.IndexOf('T') >= 0)
+ if (member.Type != null && member.Type.Contains('T'))
{
- if (member.Type == "T") member.Type = indexType;
- else member.Type = member.Type.Replace("", typed);
+ member.Type = member.Type == "T"
+ ? indexType
+ : member.Type.Replace("", typed);
}
if (member.Parameters != null)
{
- foreach (MemberModel param in member.Parameters)
+ foreach (var param in member.Parameters)
{
- if (param.Type != null && param.Type.IndexOf('T') >= 0)
+ if (param.Type != null && param.Type.Contains('T'))
{
- if (param.Type == "T") param.Type = indexType;
- else param.Type = param.Type.Replace("", typed);
+ param.Type = param.Type == "T"
+ ? indexType
+ : param.Type.Replace("", typed);
}
}
}
@@ -946,19 +1080,20 @@ private ClassModel ResolveGenericType(string baseType, string indexType, FileMod
protected MemberList GetPrivateClasses()
{
- MemberList list = new MemberList();
+ var list = new MemberList();
// private classes
- foreach(ClassModel model in cFile.Classes)
- if (model.Access == Visibility.Private)
- {
- MemberModel item = model.ToMemberModel();
- item.Type = item.Name;
- item.Access = Visibility.Private;
- list.Add(item);
- }
+ if (cFile != null)
+ foreach (var model in cFile.Classes)
+ if (model.Access == Visibility.Private)
+ {
+ var item = model.ToMemberModel();
+ item.Type = item.Name;
+ item.Access = Visibility.Private;
+ list.Add(item);
+ }
// 'Class' members
if (cClass != null)
- foreach (MemberModel member in cClass.Members)
+ foreach (var member in cClass.Members)
if (member.Type == "Class") list.Add(member);
return list;
}
@@ -968,18 +1103,60 @@ protected MemberList GetPrivateClasses()
///
protected override void InitTopLevelElements()
{
- string filename = "toplevel.as";
+ const string filename = "toplevel.as";
topLevel = new FileModel(filename);
-
- if (topLevel.Members.Search("this", 0, 0) == null)
- topLevel.Members.Add(new MemberModel("this", "", FlagType.Variable | FlagType.Intrinsic, Visibility.Public));
- if (topLevel.Members.Search("super", 0, 0) == null)
- topLevel.Members.Add(new MemberModel("super", "", FlagType.Variable | FlagType.Intrinsic, Visibility.Public));
- if (topLevel.Members.Search(features.voidKey, 0, 0) == null)
- topLevel.Members.Add(new MemberModel(features.voidKey, "", FlagType.Intrinsic, Visibility.Public));
+ if (!topLevel.Members.Contains(features.ThisKey)) topLevel.Members.Add(new MemberModel(features.ThisKey, string.Empty, FlagType.Variable | FlagType.Intrinsic, Visibility.Public));
+ if (!topLevel.Members.Contains(features.BaseKey)) topLevel.Members.Add(new MemberModel(features.BaseKey, string.Empty, FlagType.Variable | FlagType.Intrinsic, Visibility.Public));
+ if (!topLevel.Members.Contains(features.voidKey)) topLevel.Members.Add(new MemberModel(features.voidKey, string.Empty, FlagType.Intrinsic, Visibility.Public));
topLevel.Members.Sort();
}
+ public override string GetDefaultValue(string type)
+ {
+ if (string.IsNullOrEmpty(type) || type == features.voidKey) return null;
+ if (type == features.dynamicKey) return "undefined";
+ return type switch
+ {
+ "int" => "0",
+ "uint" => "0",
+ "Number" => "NaN",
+ "Boolean" => "false",
+ _ => "null",
+ };
+ }
+
+ public override IEnumerable DecomposeTypes(IEnumerable types)
+ {
+ var characterClass = ScintillaControl.Configuration.GetLanguage("as3").characterclass.Characters;
+ var result = new HashSet();
+ foreach (var type in types)
+ {
+ if (string.IsNullOrEmpty(type)) result.Add("*");
+ else if (type.Contains("<"))
+ {
+ var length = type.Length;
+ var pos = 0;
+ for (var i = 0; i < length; i++)
+ {
+ var c = type[i];
+ if (c == '.' || characterClass.Contains(c)) continue;
+ if (c == '<')
+ {
+ result.Add(type.Substring(pos, i - pos - 1));
+ pos = i + 1;
+ }
+ else if (c == '>')
+ {
+ result.Add(type.Substring(pos, i - pos));
+ break;
+ }
+ }
+ }
+ else result.Add(type);
+ }
+ return result;
+ }
+
#endregion
#region Command line compiler
@@ -987,25 +1164,19 @@ protected override void InitTopLevelElements()
///
/// Retrieve the context's default compiler path
///
- public override string GetCompilerPath()
- {
- return as3settings.GetDefaultSDK().Path ?? "Tools\\flexsdk";
- }
+ public override string GetCompilerPath() => as3settings.GetDefaultSDK().Path ?? "Tools\\flexsdk";
///
/// Check current file's syntax
///
public override void CheckSyntax()
{
- if (IsFileValid && cFile.InlinedIn == null)
- {
- PluginBase.MainForm.CallCommand("Save", null);
-
- string sdk = PluginBase.CurrentProject != null
- ? PluginBase.CurrentProject.CurrentSDK
- : PathHelper.ResolvePath(as3settings.GetDefaultSDK().Path);
- FlexShells.Instance.CheckAS3(cFile.FileName, sdk);
- }
+ if (!IsFileValid || cFile.InlinedIn != null) return;
+ PluginBase.MainForm.CallCommand("Save", null);
+ var sdk = PluginBase.CurrentProject != null
+ ? PluginBase.CurrentProject.CurrentSDK
+ : PathHelper.ResolvePath(as3settings.GetDefaultSDK().Path);
+ FlexShells.Instance.CheckAS3(cFile.FileName, sdk);
}
///
@@ -1019,15 +1190,11 @@ public override void RunCMD(string append)
MessageBar.ShowWarning(TextHelper.GetString("Info.InvalidClass"));
return;
}
-
- string command = (append ?? "") + " -- " + CurrentFile;
+ var command = (append ?? "") + " -- " + CurrentFile;
FlexShells.Instance.RunMxmlc(command, as3settings.GetDefaultSDK().Path);
}
- private bool IsCompilationTarget()
- {
- return (!MainForm.CurrentDocument.IsUntitled && CurrentModel.Version >= 3);
- }
+ bool IsCompilationTarget() => (!PluginBase.MainForm.CurrentDocument.IsUntitled && CurrentModel.Version >= 3);
///
/// Calls RunCMD with additional parameters taken from the classes @mxmlc doc tag
@@ -1039,15 +1206,108 @@ public override bool BuildCMD(bool failSilently)
MessageBar.ShowWarning(TextHelper.GetString("Info.InvalidClass"));
return false;
}
-
- MainForm.CallCommand("SaveAllModified", null);
-
- string sdk = PluginBase.CurrentProject != null
+ PluginBase.MainForm.CallCommand("SaveAllModified", null);
+ var sdk = PluginBase.CurrentProject != null
? PluginBase.CurrentProject.CurrentSDK
: as3settings.GetDefaultSDK().Path;
FlexShells.Instance.QuickBuild(CurrentModel, sdk, failSilently, as3settings.PlayAfterBuild);
return true;
}
#endregion
+
+ #region Custom behavior of Scintilla
+
+ ///
+ public override void OnBraceMatch(ScintillaControl sci)
+ {
+ if (!sci.IsBraceMatching || sci.SelTextSize != 0) return;
+ var position = sci.CurrentPos - 1;
+ var character = (char) sci.CharAt(position);
+ if (character != '<' && character != '>')
+ {
+ position = sci.CurrentPos;
+ character = (char) sci.CharAt(position);
+ }
+ if (character == '<' || character == '>')
+ {
+ if (!sci.PositionIsOnComment(position))
+ {
+ var bracePosStart = position;
+ var bracePosEnd = BraceMatch(sci, position);
+ if (bracePosEnd != -1) sci.BraceHighlight(bracePosStart, bracePosEnd);
+ if (sci.UseHighlightGuides)
+ {
+ var line = sci.LineFromPosition(position);
+ sci.HighlightGuide = sci.GetLineIndentation(line);
+ }
+ }
+ else
+ {
+ sci.BraceHighlight(-1, -1);
+ sci.HighlightGuide = 0;
+ }
+ }
+ }
+
+ ///
+ /// Find the position of a matching '<' and '>' or INVALID_POSITION if no match.
+ ///
+ protected internal int BraceMatch(ScintillaControl sci, int position)
+ {
+ if (sci.PositionIsOnComment(position) || sci.PositionIsInString(position)) return -1;
+ var language = ScintillaControl.Configuration.GetLanguage(sci.ConfigurationLanguage);
+ if (language is null) return -1;
+ var characters = language.characterclass.Characters;
+ var sub = 0;
+ switch (sci.CharAt(position))
+ {
+ case '<':
+ var length = sci.TextLength;
+ while (position < length)
+ {
+ position++;
+ if (sci.PositionIsOnComment(position)) continue;
+ var c = sci.CharAt(position);
+ if (c == ' ') continue;
+ if (c == '<') sub++;
+ else if (c == '>')
+ {
+ sub--;
+ if (sub < 0) return position;
+ }
+ else if (c != '.'
+ // Vector>
+ && !characters.Contains((char) c))
+ {
+ return -1;
+ }
+ }
+ break;
+ case '>':
+ while (position >= 0)
+ {
+ position--;
+ if (sci.PositionIsOnComment(position)) continue;
+ var c = sci.CharAt(position);
+ if (c == ' ') continue;
+ if (c == '>') sub++;
+ else if (c == '<')
+ {
+ sub--;
+ if (sub < 0) return position;
+ }
+ else if (c != '.'
+ // Vector>
+ && !characters.Contains((char) c))
+ {
+ return -1;
+ }
+ }
+ break;
+ }
+ return -1;
+ }
+
+ #endregion
}
-}
+}
\ No newline at end of file
diff --git a/External/Plugins/AS3Context/Controls/ObjectRefsGrid.cs b/External/Plugins/AS3Context/Controls/ObjectRefsGrid.cs
index aeec8fad67..d834aa5127 100644
--- a/External/Plugins/AS3Context/Controls/ObjectRefsGrid.cs
+++ b/External/Plugins/AS3Context/Controls/ObjectRefsGrid.cs
@@ -1,22 +1,20 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using Aga.Controls.Tree;
+using Aga.Controls.Tree;
using Aga.Controls.Tree.NodeControls;
using PluginCore;
using PluginCore.Helpers;
+using System.Drawing;
namespace AS3Context.Controls
{
public class ObjectRefsGrid:TreeViewAdv
{
- NodeTextBox methodTB;
- NodeTextBox fileTB;
- NodeTextBox lineTB;
+ readonly NodeTextBox methodTB;
+ readonly NodeTextBox fileTB;
+ readonly NodeTextBox lineTB;
public ObjectRefsGrid()
{
- BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+ BorderStyle = System.Windows.Forms.BorderStyle.None;
Dock = System.Windows.Forms.DockStyle.Fill;
GridLineStyle = GridLineStyle.HorizontalAndVertical;
Font = PluginBase.Settings.DefaultFont;
@@ -46,15 +44,25 @@ public ObjectRefsGrid()
NodeControls.Add(methodTB);
NodeControls.Add(fileTB);
NodeControls.Add(lineTB);
+
+ this.CustomDrawHeaders = PluginBase.MainForm.GetThemeColor("ColumnHeader.BorderColor") != Color.Empty;
+ this.ColumnHeaderBackColor = PluginBase.MainForm.GetThemeColor("ColumnHeader.BackColor", SystemColors.Control);
+ this.ColumnHeaderTextColor = PluginBase.MainForm.GetThemeColor("ColumnHeader.TextColor", SystemColors.ControlText);
+ this.ColumnHeaderBorderColor = PluginBase.MainForm.GetThemeColor("ColumnHeader.BorderColor", SystemColors.ActiveBorder);
+ this.LineColor = PluginBase.MainForm.GetThemeColor("DataTreeControl.LineColor", SystemColors.ActiveBorder);
+ this.LineColor2 = PluginBase.MainForm.GetThemeColor("DataTreeControl.LineColor", SystemColors.ActiveBorder);
+ this.DragDropMarkColor = PluginBase.MainForm.GetThemeColor("DataTreeControl.ForeColor", SystemColors.WindowText);
+ this.ForeColor = PluginBase.MainForm.GetThemeColor("TreeViewAdv.ForeColor", SystemColors.ControlText);
+ this.BackColor = PluginBase.MainForm.GetThemeColor("TreeViewAdv.BackColor", SystemColors.Control);
}
}
public class ObjectRefsNode : Node
{
- string method;
- string path;
- string file;
- string line;
+ readonly string method;
+ readonly string path;
+ readonly string file;
+ readonly string line;
public ObjectRefsNode(string method, string file, string line)
{
@@ -66,22 +74,13 @@ public ObjectRefsNode(string method, string file, string line)
this.line = line;
}
- public String Method
- {
- get { return method; }
- }
- public String Path
- {
- get { return path; }
- }
- public String File
- {
- get { return file; }
- }
- public String Line
- {
- get { return line; }
- }
+ public string Method => method;
+
+ public string Path => path;
+
+ public string File => file;
+
+ public string Line => line;
}
public class ObjectRefsModel : TreeModel
diff --git a/External/Plugins/AS3Context/Controls/ProfilerLiveObjectsView.cs b/External/Plugins/AS3Context/Controls/ProfilerLiveObjectsView.cs
index 3bd7594e39..2229fbcfff 100644
--- a/External/Plugins/AS3Context/Controls/ProfilerLiveObjectsView.cs
+++ b/External/Plugins/AS3Context/Controls/ProfilerLiveObjectsView.cs
@@ -13,67 +13,62 @@ class ProfilerLiveObjectsView
{
public event ViewObjectEvent OnViewObject;
- ListViewXP listView;
- private Dictionary items;
- private Dictionary finished = new Dictionary();
- private TypeItemComparer comparer;
- private ToolStripMenuItem viewObjectsItem;
+ Dictionary items;
+ readonly TypeItemComparer comparer;
+ readonly ToolStripMenuItem viewObjectsItem;
- public ProfilerLiveObjectsView(ListViewXP view)
+ public ListView ListView { get; }
+
+ public ProfilerLiveObjectsView(ListView view)
{
// config
- listView = view;
+ ListView = view;
comparer = new TypeItemComparer();
comparer.SortColumn = TypeItem.COL_COUNT;
comparer.Sorting = SortOrder.Descending;
- listView.ListViewItemSorter = comparer;
- listView.ColumnClick += new ColumnClickEventHandler(listView_ColumnClick);
+ ListView.ListViewItemSorter = comparer;
+ ListView.ColumnClick += ListView_ColumnClick;
// action
viewObjectsItem = new ToolStripMenuItem(TextHelper.GetString("Label.ViewObjectsItem"));
- viewObjectsItem.Click += new EventHandler(onViewObjects);
+ viewObjectsItem.Click += OnViewObjects;
- listView.ContextMenuStrip = new ContextMenuStrip();
- listView.ContextMenuStrip.Font = PluginBase.Settings.DefaultFont;
- listView.ContextMenuStrip.Renderer = new DockPanelStripRenderer(false);
- listView.ContextMenuStrip.Items.Add(viewObjectsItem);
+ ListView.ContextMenuStrip = new ContextMenuStrip();
+ ListView.ContextMenuStrip.Font = PluginBase.Settings.DefaultFont;
+ ListView.ContextMenuStrip.Renderer = new DockPanelStripRenderer(false);
+ ListView.ContextMenuStrip.Items.Add(viewObjectsItem);
- listView.DoubleClick += new EventHandler(onViewObjects);
+ ListView.DoubleClick += OnViewObjects;
}
- void listView_ColumnClick(object sender, ColumnClickEventArgs e)
+ void ListView_ColumnClick(object sender, ColumnClickEventArgs e)
{
if (comparer.SortColumn == e.Column)
{
- if (comparer.Sorting == SortOrder.Ascending)
- comparer.Sorting = SortOrder.Descending;
- else comparer.Sorting = SortOrder.Ascending;
+ comparer.Sorting = comparer.Sorting == SortOrder.Ascending ? SortOrder.Descending : SortOrder.Ascending;
}
else
{
comparer.SortColumn = e.Column;
- if (e.Column >= 2)
- comparer.Sorting = SortOrder.Descending;
- else comparer.Sorting = SortOrder.Ascending;
+ comparer.Sorting = e.Column >= 2 ? SortOrder.Descending : SortOrder.Ascending;
}
- listView.Sort();
+ ListView.Sort();
}
- private void onViewObjects(object sender, EventArgs e)
+ void OnViewObjects(object sender, EventArgs e)
{
- if (listView.SelectedItems.Count == 1)
+ if (ListView.SelectedItems.Count == 1)
{
- if (OnViewObject != null)
- OnViewObject(listView.SelectedItems[0].Tag as TypeItem);
+ OnViewObject?.Invoke(ListView.SelectedItems[0].Tag as TypeItem);
}
}
public void Clear()
{
items = new Dictionary();
- listView.Items.Clear();
+ ListView.Items.Clear();
}
///
@@ -82,8 +77,7 @@ public void Clear()
///
public void UpdateTypeGrid(string[] lines)
{
- listView.SetExStyles();
- listView.BeginUpdate();
+ ListView.BeginUpdate();
foreach (TypeItem item in items.Values)
item.Zero();
@@ -97,44 +91,42 @@ public void UpdateTypeGrid(string[] lines)
{
item = new TypeItem(parts[3]);
items[parts[0]] = item;
- listView.Items.Add(item.ListItem);
+ ListView.Items.Add(item.ListItem);
}
else if (!items.ContainsKey(parts[0])) continue;
else item = items[parts[0]];
item.Update(parts[1], parts[2]);
}
- listView.Sort();
+ ListView.Sort();
}
finally
{
- listView.EndUpdate();
+ ListView.EndUpdate();
}
}
}
-
#region Model
- class TypeItemComparer : IComparer
+ class TypeItemComparer : IComparer, IComparer
{
- public int SortColumn = 0;
+ public int SortColumn;
public SortOrder Sorting;
- int IComparer.Compare(object x, object y)
- {
- TypeItem a = (TypeItem)((ListViewItem)x).Tag;
- TypeItem b = (TypeItem)((ListViewItem)y).Tag;
+ public int Compare(object x, object y) => Compare((ListViewItem) x, (ListViewItem) y);
- int comp;
- switch (SortColumn)
+ public int Compare(ListViewItem x, ListViewItem y)
+ {
+ var a = (TypeItem)x.Tag;
+ var b = (TypeItem)y.Tag;
+ var comp = SortColumn switch
{
- case TypeItem.COL_PKG: comp = a.Package.CompareTo(b.Package); break;
- case TypeItem.COL_MAX: comp = a.Maximum.CompareTo(b.Maximum); break;
- case TypeItem.COL_COUNT: comp = a.Count.CompareTo(b.Count); break;
- case TypeItem.COL_MEM: comp = a.Memory.CompareTo(b.Memory); break;
- default: comp = a.Name.CompareTo(b.Name); break;
- }
-
+ TypeItem.COL_PKG => a.Package.CompareTo(b.Package),
+ TypeItem.COL_MAX => a.Maximum.CompareTo(b.Maximum),
+ TypeItem.COL_COUNT => a.Count.CompareTo(b.Count),
+ TypeItem.COL_MEM => a.Memory.CompareTo(b.Memory),
+ _ => a.Name.CompareTo(b.Name),
+ };
return Sorting == SortOrder.Ascending ? comp : -comp;
}
}
@@ -159,15 +151,13 @@ class TypeItem
public TypeItem(string fullName)
{
QName = fullName;
- int p = fullName.IndexOf(':');
- if (p >= 0)
+ if (fullName.Contains(':', out var p))
{
Name = fullName.Substring(p + 2);
Package = fullName.Substring(0, p);
}
else Name = fullName;
- ListItem = new ListViewItem(Name);
- ListItem.Tag = this;
+ ListItem = new ListViewItem(Name) {Tag = this};
ListItem.SubItems.Add(new ListViewItem.ListViewSubItem(ListItem, Package));
ListItem.SubItems.Add(new ListViewItem.ListViewSubItem(ListItem, "0"));
ListItem.SubItems.Add(new ListViewItem.ListViewSubItem(ListItem, "0"));
@@ -201,4 +191,4 @@ public void Zero()
}
#endregion
-}
+}
\ No newline at end of file
diff --git a/External/Plugins/AS3Context/Controls/ProfilerMemView.cs b/External/Plugins/AS3Context/Controls/ProfilerMemView.cs
index 1609e020b9..4f1f17f5eb 100644
--- a/External/Plugins/AS3Context/Controls/ProfilerMemView.cs
+++ b/External/Plugins/AS3Context/Controls/ProfilerMemView.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Text;
using System.Windows.Forms;
using PluginCore.Localization;
using System.Drawing;
@@ -9,43 +8,41 @@ namespace AS3Context.Controls
{
class ProfilerMemView
{
- ToolStripLabel memLabel;
- Label statsLabel;
- ComboBox scaleCombo;
- const int MAX_WIDTH = 1000;
- const int MAX_HEIGHT = 400;
- private MemGraph graph;
-
- public ProfilerMemView(ToolStripLabel label, Label stats, ComboBox scale, TabPage memoryPage)
+ readonly ToolStripLabel memLabel;
+ readonly Label statsLabel;
+ readonly ComboBox scaleCombo;
+
+ public MemGraph Graph { get; }
+
+ public ProfilerMemView(ToolStripLabel label, Label stats, ComboBox scale, Control memoryPage)
{
- graph = new MemGraph();
- graph.Dock = DockStyle.Fill;
- memoryPage.Controls.Add(graph);
- graph.BringToFront();
+ Graph = new MemGraph {Dock = DockStyle.Fill};
+ memoryPage.Controls.Add(Graph);
+ Graph.BringToFront();
memLabel = label;
statsLabel = stats;
scaleCombo = scale;
scaleCombo.SelectedIndex = scaleCombo.Items.Count - 1;
- scaleCombo.SelectedIndexChanged += new EventHandler(scaleCombo_SelectedIndexChanged);
- graph.TimeScale = scaleCombo.SelectedIndex + 1;
+ scaleCombo.SelectedIndexChanged += scaleCombo_SelectedIndexChanged;
+ Graph.TimeScale = scaleCombo.SelectedIndex + 1;
Clear();
}
void scaleCombo_SelectedIndexChanged(object sender, EventArgs e)
{
- graph.TimeScale = scaleCombo.SelectedIndex + 1;
- graph.Invalidate();
+ Graph.TimeScale = scaleCombo.SelectedIndex + 1;
+ Graph.Invalidate();
}
public void Clear()
{
- graph.Values = new List();
- graph.MaxValue = 1;
- memLabel.Text = String.Format(TextHelper.GetString("Label.MemoryDisplay"), FormatMemory(0), FormatMemory(0));
- statsLabel.Text = String.Format(TextHelper.GetString("Label.MemoryStats"), "\n", FormatMemory(0), FormatMemory(0));
+ Graph.Values = new List();
+ Graph.MaxValue = 1;
+ memLabel.Text = string.Format(TextHelper.GetString("Label.MemoryDisplay"), FormatMemory(0), FormatMemory(0));
+ statsLabel.Text = string.Format(TextHelper.GetString("Label.MemoryStats"), "\n", FormatMemory(0), FormatMemory(0));
}
///
@@ -54,18 +51,17 @@ public void Clear()
///
public void UpdateStats(string[] info)
{
- int mem = 0;
- int.TryParse(info[1], out mem);
- graph.Values.Add((float)mem);
- if (mem > graph.MaxValue) graph.MaxValue = mem;
+ int.TryParse(info[1], out var mem);
+ Graph.Values.Add(mem);
+ if (mem > Graph.MaxValue) Graph.MaxValue = mem;
string raw = TextHelper.GetString("Label.MemoryDisplay");
- memLabel.Text = String.Format(raw, FormatMemory(mem), FormatMemory((int)graph.MaxValue));
+ memLabel.Text = string.Format(raw, FormatMemory(mem), FormatMemory((int)Graph.MaxValue));
raw = TextHelper.GetString("Label.MemoryStats");
- statsLabel.Text = String.Format(raw, "\n", FormatMemory(mem), FormatMemory((int)graph.MaxValue));
- graph.Invalidate();
+ statsLabel.Text = string.Format(raw, "\n", FormatMemory(mem), FormatMemory((int)Graph.MaxValue));
+ Graph.Invalidate();
}
- private string FormatMemory(int mem)
+ string FormatMemory(int mem)
{
double m = mem / 1024.0;
return (Math.Round(m * 10.0) / 10.0).ToString("N0");
@@ -77,13 +73,25 @@ class MemGraph : Control
public List Values = new List();
public float MaxValue = 1;
public int TimeScale = 4;
+ Color back;
+ Color rect;
+ Color norm;
+ Color peak;
+ Color cur;
public MemGraph()
{
- this.SetStyle(
- ControlStyles.UserPaint |
- ControlStyles.AllPaintingInWmPaint |
- ControlStyles.OptimizedDoubleBuffer, true);
+ SetStyle(ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer, true);
+ UpdateColors();
+ }
+
+ public void UpdateColors()
+ {
+ rect = PluginCore.PluginBase.MainForm.GetThemeColor("MemGraph.ForeColor", Color.Gray);
+ back = PluginCore.PluginBase.MainForm.GetThemeColor("MemGraph.BackColor", Color.White);
+ norm = PluginCore.PluginBase.MainForm.GetThemeColor("MemGraph.NormalColor", Color.LightGray);
+ peak = PluginCore.PluginBase.MainForm.GetThemeColor("MemGraph.PeakColor", Color.Red);
+ cur = PluginCore.PluginBase.MainForm.GetThemeColor("MemGraph.CurrentColor", Color.Blue);
}
protected override void OnPaint(PaintEventArgs pe)
@@ -91,8 +99,8 @@ protected override void OnPaint(PaintEventArgs pe)
Graphics g = pe.Graphics;
Rectangle r = pe.ClipRectangle;
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
- g.FillRectangle(Brushes.White, r);
- g.DrawRectangle(Pens.Gray, 0, 0, Width - 1, Height - 1);
+ g.FillRectangle(new SolidBrush(back), r);
+ g.DrawRectangle(new Pen(rect), 0, 0, Width - 1, Height - 1);
if (Width < 8 || Height < 8) return;
@@ -103,11 +111,10 @@ protected override void OnPaint(PaintEventArgs pe)
int diff = Math.Min(Width / TimeScale, n);
int x0 = Width - diff * TimeScale;
int i = Math.Max(0, n - diff);
- float h = (float)Height;
- Pen line;
+ float h = Height;
// peak
- line = new Pen(Brushes.LightGray, 1);
+ var line = new Pen(norm, 1);
float step = 25000000f;
while (step * 4 < MaxValue) step *= 2;
float top = step;
@@ -118,21 +125,22 @@ protected override void OnPaint(PaintEventArgs pe)
g.DrawLine(line, 1f, y, Width - 2, y);
top += step;
}
- line = new Pen(Brushes.Red, 1);
+ line = new Pen(peak, 1);
y = (float)Math.Round(h * 0.1f);
g.DrawLine(line, 0f, y, Width - 1, y);
// graph
- List points = new List();
+ var points = new List();
while (i < n)
{
points.Add(new PointF(x0, h * (1f - 0.9f * Values[i] / MaxValue)));
i++;
x0 += TimeScale;
}
- line = new Pen(Brushes.Blue, 2);
- line.LineJoin = System.Drawing.Drawing2D.LineJoin.Round;
+ line = new Pen(cur, 2) {LineJoin = System.Drawing.Drawing2D.LineJoin.Round};
g.DrawLines(line, points.ToArray());
}
+
}
+
}
diff --git a/External/Plugins/AS3Context/Controls/ProfilerObjectsView.cs b/External/Plugins/AS3Context/Controls/ProfilerObjectsView.cs
index 290fc48e1e..61fd012a61 100644
--- a/External/Plugins/AS3Context/Controls/ProfilerObjectsView.cs
+++ b/External/Plugins/AS3Context/Controls/ProfilerObjectsView.cs
@@ -4,78 +4,67 @@
using System.Windows.Forms;
using PluginCore;
using PluginCore.Localization;
-using ScintillaNet;
namespace AS3Context.Controls
{
class ProfilerObjectsView
{
- ObjectRefsGrid objectsGrid;
- Regex reStep = new Regex("([^\\[]+)\\[(.*):([0-9]+)\\]");
- ObjectRefsModel model = new ObjectRefsModel();
- ToolStripMenuItem openItem;
+ readonly Regex reStep = new Regex("([^\\[]+)\\[(.*):([0-9]+)\\]");
+ readonly ObjectRefsModel model = new ObjectRefsModel();
string fileToOpen;
int lineToOpen;
- Timer delayOpen;
+ readonly Timer delayOpen;
+
+ public ObjectRefsGrid ObjectsGrid { get; }
public ProfilerObjectsView(ObjectRefsGrid grid)
{
- objectsGrid = grid;
+ ObjectsGrid = grid;
delayOpen = new Timer();
delayOpen.Interval = 100;
- delayOpen.Tick += new EventHandler(delayOpen_Tick);
+ delayOpen.Tick += delayOpen_Tick;
// action
- openItem = new ToolStripMenuItem(TextHelper.GetString("Label.OpenMethodFile"));
- openItem.Click += new EventHandler(objectsGrid_Open);
+ var openItem = new ToolStripMenuItem(TextHelper.GetString("Label.OpenMethodFile"));
+ openItem.Click += objectsGrid_Open;
- objectsGrid.ContextMenuStrip = new ContextMenuStrip();
- objectsGrid.ContextMenuStrip.Font = PluginBase.Settings.DefaultFont;
- objectsGrid.ContextMenuStrip.Renderer = new DockPanelStripRenderer(false);
- objectsGrid.ContextMenuStrip.Items.Add(openItem);
- objectsGrid.DoubleClick += new EventHandler(objectsGrid_Open);
+ ObjectsGrid.ContextMenuStrip = new ContextMenuStrip();
+ ObjectsGrid.ContextMenuStrip.Font = PluginBase.Settings.DefaultFont;
+ ObjectsGrid.ContextMenuStrip.Renderer = new DockPanelStripRenderer(false);
+ ObjectsGrid.ContextMenuStrip.Items.Add(openItem);
+ ObjectsGrid.DoubleClick += objectsGrid_Open;
}
void delayOpen_Tick(object sender, EventArgs e)
{
delayOpen.Stop();
- if (fileToOpen != null)
+ if (fileToOpen is null) return;
+ if (File.Exists(fileToOpen))
{
- if (File.Exists(fileToOpen))
+ PluginBase.MainForm.OpenEditableDocument(fileToOpen, false);
+ if (PluginBase.MainForm.CurrentDocument is {IsEditable: true, SciControl: { } sci} doc
+ && doc.FileName.Equals(fileToOpen, StringComparison.OrdinalIgnoreCase))
{
- PluginBase.MainForm.OpenEditableDocument(fileToOpen, false);
- if (PluginBase.MainForm.CurrentDocument.IsEditable
- && PluginBase.MainForm.CurrentDocument.FileName.Equals(fileToOpen, StringComparison.OrdinalIgnoreCase))
- {
- ScintillaControl sci = PluginBase.MainForm.CurrentDocument.SciControl;
- int pos = sci.PositionFromLine(lineToOpen);
- sci.SetSel(pos, pos);
- sci.EnsureVisible(lineToOpen);
- }
+ var pos = sci.PositionFromLine(lineToOpen);
+ sci.SetSel(pos, pos);
+ sci.EnsureVisibleEnforcePolicy(lineToOpen);
}
- fileToOpen = null;
}
+ fileToOpen = null;
}
void objectsGrid_Open(object sender, EventArgs e)
{
- if (objectsGrid.SelectedNode != null)
+ if (ObjectsGrid.SelectedNode?.Tag is ObjectRefsNode node && node.Line.Length > 0)
{
- ObjectRefsNode node = objectsGrid.SelectedNode.Tag as ObjectRefsNode;
- if (node != null && node.Line.Length > 0)
- {
- fileToOpen = node.Path.Replace(';', Path.DirectorySeparatorChar);
- lineToOpen = int.Parse(node.Line) - 1;
- delayOpen.Start();
- }
+ fileToOpen = node.Path.Replace(';', Path.DirectorySeparatorChar);
+ lineToOpen = int.Parse(node.Line) - 1;
+ delayOpen.Start();
}
}
- public void Clear()
- {
- model.Root.Nodes.Clear();
- }
+ public void Clear() => model.Root.Nodes.Clear();
public void Display(string qname, string[] info)
{
@@ -102,7 +91,7 @@ public void Display(string qname, string[] info)
model.Root.Nodes.Add(node);
}
- objectsGrid.Model = model;
+ ObjectsGrid.Model = model;
}
}
}
diff --git a/External/Plugins/AS3Context/Controls/ProfilerUI.Designer.cs b/External/Plugins/AS3Context/Controls/ProfilerUI.Designer.cs
index 214edd588f..3c35cd20d9 100644
--- a/External/Plugins/AS3Context/Controls/ProfilerUI.Designer.cs
+++ b/External/Plugins/AS3Context/Controls/ProfilerUI.Designer.cs
@@ -29,14 +29,14 @@ protected override void Dispose(bool disposing)
private void InitializeComponent()
{
this.container = new System.Windows.Forms.Panel();
- this.tabControl = new System.Windows.Forms.TabControl();
+ this.tabControl = new System.Windows.Forms.TabControlEx();
this.memoryPage = new System.Windows.Forms.TabPage();
this.memStatsPanel = new System.Windows.Forms.Panel();
this.memStatsLabel = new System.Windows.Forms.Label();
this.memScaleLabel = new System.Windows.Forms.Label();
- this.memScaleCombo = new System.Windows.Forms.ComboBox();
+ this.memScaleCombo = new System.Windows.Forms.FlatCombo();
this.liveObjectsPage = new System.Windows.Forms.TabPage();
- this.listView = new AS3Context.Controls.ListViewXP();
+ this.listView = new System.Windows.Forms.ListViewEx();
this.typeColumn = new System.Windows.Forms.ColumnHeader();
this.pkgColumn = new System.Windows.Forms.ColumnHeader();
this.maxColumn = new System.Windows.Forms.ColumnHeader();
@@ -67,7 +67,7 @@ private void InitializeComponent()
this.container.Dock = System.Windows.Forms.DockStyle.Fill;
this.container.Location = new System.Drawing.Point(1, 26);
this.container.Name = "container";
- this.container.Padding = new System.Windows.Forms.Padding(3, 3, 2, 2);
+ this.container.Padding = new System.Windows.Forms.Padding(5, 6, 5, 6);
this.container.Size = new System.Drawing.Size(488, 338);
this.container.TabIndex = 0;
//
@@ -88,7 +88,7 @@ private void InitializeComponent()
this.memoryPage.Controls.Add(this.memStatsPanel);
this.memoryPage.Location = new System.Drawing.Point(4, 22);
this.memoryPage.Name = "memoryPage";
- this.memoryPage.Padding = new System.Windows.Forms.Padding(3);
+ this.memoryPage.Padding = new System.Windows.Forms.Padding(5);
this.memoryPage.Size = new System.Drawing.Size(475, 307);
this.memoryPage.TabIndex = 2;
this.memoryPage.Text = "Memory";
@@ -144,7 +144,7 @@ private void InitializeComponent()
this.liveObjectsPage.Controls.Add(this.listView);
this.liveObjectsPage.Location = new System.Drawing.Point(4, 22);
this.liveObjectsPage.Name = "liveObjectsPage";
- this.liveObjectsPage.Padding = new System.Windows.Forms.Padding(2, 3, 3, 2);
+ this.liveObjectsPage.Padding = new System.Windows.Forms.Padding(0);
this.liveObjectsPage.Size = new System.Drawing.Size(475, 307);
this.liveObjectsPage.TabIndex = 0;
this.liveObjectsPage.Text = "Live Objects Count";
@@ -152,7 +152,7 @@ private void InitializeComponent()
//
// listView
//
- this.listView.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+ this.listView.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.listView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.typeColumn,
this.pkgColumn,
@@ -201,7 +201,7 @@ private void InitializeComponent()
//
this.objectsPage.Location = new System.Drawing.Point(4, 22);
this.objectsPage.Name = "objectsPage";
- this.objectsPage.Padding = new System.Windows.Forms.Padding(2, 3, 3, 2);
+ this.objectsPage.Padding = new System.Windows.Forms.Padding(0);
this.objectsPage.Size = new System.Drawing.Size(475, 307);
this.objectsPage.TabIndex = 1;
this.objectsPage.Text = "Objects";
@@ -318,7 +318,7 @@ private void InitializeComponent()
#endregion
- private ListViewXP listView;
+ private System.Windows.Forms.ListView listView;
private System.Windows.Forms.Panel container;
private System.Windows.Forms.ToolStrip toolStrip;
private System.Windows.Forms.ToolStripLabel memLabel;
diff --git a/External/Plugins/AS3Context/Controls/ProfilerUI.cs b/External/Plugins/AS3Context/Controls/ProfilerUI.cs
index b218da507b..9628d14ff5 100644
--- a/External/Plugins/AS3Context/Controls/ProfilerUI.cs
+++ b/External/Plugins/AS3Context/Controls/ProfilerUI.cs
@@ -1,5 +1,4 @@
using System;
-using System.ComponentModel;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
@@ -11,52 +10,45 @@
using System.Net.Sockets;
using System.Text.RegularExpressions;
using System.Collections.Generic;
+using System.Linq;
using WeifenLuo.WinFormsUI.Docking;
namespace AS3Context.Controls
{
- public partial class ProfilerUI : DockPanelControl
+ public partial class ProfilerUI : DockPanelControl, IThemeHandler
{
- static private readonly Byte[] RESULT_OK = Encoding.Default.GetBytes("\0");
- static private readonly Byte[] RESULT_IGNORED = Encoding.Default.GetBytes("\0");
- static private readonly Byte[] RESULT_GC = Encoding.Default.GetBytes("\0");
+ static readonly byte[] RESULT_OK = Encoding.Default.GetBytes("\0");
+ static readonly byte[] RESULT_IGNORED = Encoding.Default.GetBytes("\0");
+ static readonly byte[] RESULT_GC = Encoding.Default.GetBytes("\0");
- static private ProfilerUI instance;
- static private bool gcWanted;
- static private byte[] snapshotWanted;
+ static ProfilerUI instance;
+ static bool gcWanted;
+ static byte[] snapshotWanted;
public DockContent PanelRef;
- private bool autoStart;
- private bool running;
- private string current;
- private List previous = new List();
- private ObjectRefsGrid objectRefsGrid;
- private ProfilerLiveObjectsView liveObjectsView;
- private ProfilerMemView memView;
- private ProfilerObjectsView objectRefsView;
- private Timer detectDisconnect;
- private List profilerItems;
- private string profilerItemsCheck;
- private string profilerSWF;
-
- public bool AutoStart
- {
- get { return autoStart; }
- }
+ bool running;
+ string current;
+ readonly List previous = new List();
+ readonly ObjectRefsGrid objectRefsGrid;
+ readonly ProfilerLiveObjectsView liveObjectsView;
+ readonly ProfilerMemView memView;
+ readonly ProfilerObjectsView objectRefsView;
+ readonly Timer detectDisconnect;
+ List profilerItems;
+ string profilerItemsCheck;
+ string profilerSWF;
+
+ public bool AutoStart { get; private set; }
public static void HandleFlashConnect(object sender, object data)
{
- Socket client = sender as Socket;
-
- if (instance == null || data == null || !instance.running)
+ var client = (Socket) sender;
+ if (instance is null || data is null || !instance.running)
{
if (client.Connected) client.Send(RESULT_IGNORED);
return;
}
-
instance.OnProfileData((string)data);
-
if (client.Connected) client.Send(RESULT_OK);
-
if (gcWanted)
{
if (client.Connected) client.Send(RESULT_GC);
@@ -92,7 +84,7 @@ public ProfilerUI()
if (PluginMain.Settings.ProfilerTimeout == 0) PluginMain.Settings.ProfilerTimeout = 30;
detectDisconnect = new Timer();
detectDisconnect.Interval = Math.Max(5, PluginMain.Settings.ProfilerTimeout) * 1000;
- detectDisconnect.Tick += new EventHandler(detectDisconnect_Tick);
+ detectDisconnect.Tick += detectDisconnect_Tick;
memView = new ProfilerMemView(memLabel, memStatsLabel, memScaleCombo, memoryPage);
@@ -100,14 +92,24 @@ public ProfilerUI()
column.Width = ScaleHelper.Scale(column.Width);
liveObjectsView = new ProfilerLiveObjectsView(listView);
- liveObjectsView.OnViewObject += new ViewObjectEvent(liveObjectsView_OnViewObject);
+ liveObjectsView.OnViewObject += liveObjectsView_OnViewObject;
objectRefsView = new ProfilerObjectsView(objectRefsGrid);
- configureProfilerChooser();
+ ConfigureProfilerChooser();
StopProfiling();
}
+ ///
+ /// Lets do some theming fixes
+ ///
+ public void AfterTheming()
+ {
+ this.memStatsPanel.BackColor = Color.Empty;
+ this.container.BackColor = PluginBase.MainForm.GetThemeColor("Form.BackColor", SystemColors.Control);
+ this.memView.Graph.UpdateColors();
+ }
+
void liveObjectsView_OnViewObject(TypeItem item)
{
snapshotWanted = Encoding.Default.GetBytes(" \0");
@@ -115,7 +117,7 @@ void liveObjectsView_OnViewObject(TypeItem item)
tabControl.SelectedTab = objectsPage;
}
- private void InitializeLocalization()
+ void InitializeLocalization()
{
this.labelTarget.Text = "";
this.autoButton.Text = TextHelper.GetString("Label.AutoStartProfilerOFF");
@@ -145,13 +147,13 @@ public void Cleanup()
SetProfilerCfg(false);
}
- private void runButton_Click(object sender, EventArgs e)
+ void runButton_Click(object sender, EventArgs e)
{
if (running) StopProfiling();
else StartProfiling();
}
- private void gcButton_Click(object sender, EventArgs e)
+ void gcButton_Click(object sender, EventArgs e)
{
if (running && current != null) gcWanted = true;
}
@@ -183,50 +185,48 @@ public void StartProfiling()
gcButton.Enabled = false;
if (!SetProfilerCfg(true)) StopProfiling();
- else if (autoStart)
+ else if (AutoStart)
{
detectDisconnect.Interval = 5000; // expecting connection before 5s
detectDisconnect.Start();
}
}
- private void autoButton_Click(object sender, EventArgs e)
+ void autoButton_Click(object sender, EventArgs e)
{
- autoStart = !autoStart;
- autoButton.Image = PluginBase.MainForm.FindImage(autoStart ? "510" : "514");
- autoButton.Text = TextHelper.GetString(autoStart ? "Label.AutoStartProfilerON" : "Label.AutoStartProfilerOFF");
+ AutoStart = !AutoStart;
+ autoButton.Image = PluginBase.MainForm.FindImage(AutoStart ? "510" : "514");
+ autoButton.Text = TextHelper.GetString(AutoStart ? "Label.AutoStartProfilerON" : "Label.AutoStartProfilerOFF");
}
#endregion
#region Profiler selector
- private void configureProfilerChooser()
+ void ConfigureProfilerChooser()
{
profilerChooser.Image = PluginBase.MainForm.FindImage("274");
- profilerChooser.DropDownOpening += new EventHandler(profilerChooser_DropDownOpening);
+ profilerChooser.DropDownOpening += ProfilerChooser_DropDownOpening;
profilerItems = new List();
defaultToolStripMenuItem.Checked = true;
- defaultToolStripMenuItem.Click += new EventHandler(changeProfiler_Click);
+ defaultToolStripMenuItem.Click += ChangeProfiler_Click;
profilerSWF = null; // default
- string active = Path.Combine(Path.Combine(PathHelper.DataDir, "AS3Context"), "activeProfiler.txt");
+ var active = Path.Combine(PathHelper.DataDir, "AS3Context", "activeProfiler.txt");
if (File.Exists(active))
{
- string src = File.ReadAllText(active).Trim();
- if (src.Length > 0 && File.Exists(src))
- profilerSWF = src;
+ var src = File.ReadAllText(active).Trim();
+ if (File.Exists(src)) profilerSWF = src;
}
}
- void profilerChooser_DropDownOpening(object sender, EventArgs e)
+ void ProfilerChooser_DropDownOpening(object sender, EventArgs e)
{
- string[] swfs = PluginMain.Settings.CustomProfilers;
- if (swfs == null || swfs.Length == 0) return;
+ var swfs = PluginMain.Settings.CustomProfilers;
+ if (swfs.IsNullOrEmpty()) return;
- string check = "";
- foreach(string swf in swfs) check += swf;
+ var check = swfs.Aggregate("", (current1, swf) => current1 + swf);
if (check == profilerItemsCheck) return;
profilerItemsCheck = check;
@@ -239,7 +239,7 @@ void profilerChooser_DropDownOpening(object sender, EventArgs e)
{
ToolStripMenuItem item = new ToolStripMenuItem(Path.GetFileNameWithoutExtension(swf));
item.Tag = swf;
- item.Click += new EventHandler(changeProfiler_Click);
+ item.Click += ChangeProfiler_Click;
profilerItems.Add(item);
}
}
@@ -247,24 +247,24 @@ void profilerChooser_DropDownOpening(object sender, EventArgs e)
profilerChooser.DropDownItems.AddRange(profilerItems.ToArray());
defaultToolStripMenuItem.Checked = false;
foreach (ToolStripMenuItem item in profilerItems)
- if (item.Tag as String == profilerSWF)
+ if (item.Tag as string == profilerSWF)
{
item.Checked = true;
break;
}
}
- void changeProfiler_Click(object sender, EventArgs e)
+ void ChangeProfiler_Click(object sender, EventArgs e)
{
- ToolStripMenuItem item = sender as ToolStripMenuItem;
- if (item == null || item.Checked) return;
+ var item = sender as ToolStripMenuItem;
+ if (item is null || item.Checked) return;
- foreach (ToolStripMenuItem it in profilerItems)
+ foreach (var it in profilerItems)
it.Checked = false;
item.Checked = true;
- profilerSWF = item.Tag as String;
+ profilerSWF = item.Tag as string;
- string active = Path.Combine(Path.Combine(PathHelper.DataDir, "AS3Context"), "activeProfiler.txt");
+ var active = Path.Combine(PathHelper.DataDir, "AS3Context", "activeProfiler.txt");
File.WriteAllText(active, profilerSWF ?? "");
}
@@ -318,14 +318,13 @@ internal bool OnProfileData(string data)
#region MM configuration
- private bool SetProfilerCfg(bool active)
+ bool SetProfilerCfg(bool active)
{
try
{
- String mmCfg = PathHelper.ResolveMMConfig();
+ var mmCfg = PathHelper.ResolveMMConfig();
if (!File.Exists(mmCfg)) CreateDefaultCfg(mmCfg);
-
- string src = File.ReadAllText(mmCfg).Trim();
+ var src = File.ReadAllText(mmCfg).Trim();
src = Regex.Replace(src, "PreloadSwf=.*", "").Trim();
if (active)
{
@@ -340,67 +339,59 @@ private bool SetProfilerCfg(bool active)
return true;
}
- private string AddDefaultProfiler()
+ static string AddDefaultProfiler()
{
string swfPath = ResolvePath(CheckResource("Profiler5.swf", "Profiler.swf"));
ASCompletion.Commands.CreateTrustFile.Run("FDProfiler.cfg", Path.GetDirectoryName(swfPath));
- FlashConnect.Settings settings = GetFlashConnectSettings();
+ var settings = GetFlashConnectSettings();
return "\r\nPreloadSwf=" + swfPath + "?host=" + settings.Host + "&port=" + settings.Port + "\r\n";
}
- private string AddCustomProfiler()
+ string AddCustomProfiler()
{
- string swfPath = ResolvePath(profilerSWF);
- if (swfPath == null) return null;
- ASCompletion.Commands.CreateTrustFile.Run("FDProfiler.cfg", Path.GetDirectoryName(swfPath));
- return "\r\nPreloadSwf=" + swfPath + "\r\n";
+ var path = ResolvePath(profilerSWF);
+ if (path is null) return null;
+ ASCompletion.Commands.CreateTrustFile.Run("FDProfiler.cfg", Path.GetDirectoryName(path));
+ return "\r\nPreloadSwf=" + path + "\r\n";
}
- private string ResolvePath(string path)
+ static string ResolvePath(string path)
{
- if (PluginBase.CurrentProject != null)
- return PathHelper.ResolvePath(path, Path.GetDirectoryName(PluginBase.CurrentProject.ProjectPath));
- else
- return PathHelper.ResolvePath(path);
+ return PluginBase.CurrentProject != null
+ ? PathHelper.ResolvePath(path, Path.GetDirectoryName(PluginBase.CurrentProject.ProjectPath))
+ : PathHelper.ResolvePath(path);
}
- private FlashConnect.Settings GetFlashConnectSettings()
+ static FlashConnect.Settings GetFlashConnectSettings()
{
- IPlugin flashConnect = PluginBase.MainForm.FindPlugin("425ae753-fdc2-4fdf-8277-c47c39c2e26b");
- return flashConnect != null ? (FlashConnect.Settings)flashConnect.Settings : new FlashConnect.Settings();
+ var plugin = PluginBase.MainForm.FindPlugin("425ae753-fdc2-4fdf-8277-c47c39c2e26b");
+ return plugin != null ? (FlashConnect.Settings)plugin.Settings : new FlashConnect.Settings();
}
- static private string CheckResource(string fileName, string resName)
+ static string CheckResource(string fileName, string resName)
{
- string path = Path.Combine(PathHelper.DataDir, "AS3Context");
- string fullPath = Path.Combine(path, fileName);
- if (!File.Exists(fullPath))
+ var fullPath = Path.Combine(PathHelper.DataDir, "AS3Context", fileName);
+ if (File.Exists(fullPath)) return fullPath;
+ var id = "AS3Context.Resources." + resName;
+ var assembly = System.Reflection.Assembly.GetExecutingAssembly();
+ using var br = new BinaryReader(assembly.GetManifestResourceStream(id));
+ using var bw = File.Create(fullPath);
+ var buffer = br.ReadBytes(1024);
+ while (buffer.Length > 0)
{
- string id = "AS3Context.Resources." + resName;
- System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
- using (BinaryReader br = new BinaryReader(assembly.GetManifestResourceStream(id)))
- {
- using (FileStream bw = File.Create(fullPath))
- {
- byte[] buffer = br.ReadBytes(1024);
- while (buffer.Length > 0)
- {
- bw.Write(buffer, 0, buffer.Length);
- buffer = br.ReadBytes(1024);
- }
- bw.Close();
- }
- br.Close();
- }
+ bw.Write(buffer, 0, buffer.Length);
+ buffer = br.ReadBytes(1024);
}
+ bw.Close();
+ br.Close();
return fullPath;
}
- private void CreateDefaultCfg(string mmCfg)
+ static void CreateDefaultCfg(string mmCfg)
{
try
{
- String contents = "PolicyFileLog=1\r\nPolicyFileLogAppend=0\r\nErrorReportingEnable=1\r\nTraceOutputFileEnable=1\r\n";
+ const string contents = "PolicyFileLog=1\r\nPolicyFileLogAppend=0\r\nErrorReportingEnable=1\r\nTraceOutputFileEnable=1\r\n";
FileHelper.WriteFile(mmCfg, contents, Encoding.UTF8);
}
catch (Exception ex)
@@ -412,7 +403,4 @@ private void CreateDefaultCfg(string mmCfg)
#endregion
}
-
-
-
-}
+}
\ No newline at end of file
diff --git a/External/Plugins/AS3Context/MxmlComplete.cs b/External/Plugins/AS3Context/MxmlComplete.cs
index e769a35ffa..0506b3edd4 100644
--- a/External/Plugins/AS3Context/MxmlComplete.cs
+++ b/External/Plugins/AS3Context/MxmlComplete.cs
@@ -12,22 +12,21 @@
using PluginCore;
using PluginCore.Controls;
using PluginCore.Helpers;
-using ScintillaNet;
using XMLCompletion;
namespace AS3Context
{
class MxmlComplete
{
- static public bool IsDirty;
- static public Context context;
- static public MxmlFilterContext mxmlContext;
+ public static bool IsDirty;
+ public static Context context;
+ public static MxmlFilterContext mxmlContext;
#region shortcuts
public static bool GotoDeclaration()
{
- ScintillaControl sci = PluginBase.MainForm.CurrentDocument.SciControl;
- if (sci == null) return false;
+ var sci = PluginBase.MainForm.CurrentDocument?.SciControl;
+ if (sci is null) return false;
if (sci.ConfigurationLanguage != "xml") return false;
int pos = sci.CurrentPos;
@@ -38,13 +37,11 @@ public static bool GotoDeclaration()
if (c <= 32 || c == '/' || c == '>') break;
pos ++;
}
- XMLContextTag ctag = XMLComplete.GetXMLContextTag(sci, pos);
- if (ctag.Name == null) return true;
+ var ctag = XMLComplete.GetXMLContextTag(sci, pos);
+ if (ctag.Name is null) return true;
string word = sci.GetWordFromPosition(sci.CurrentPos);
-
string type = ResolveType(mxmlContext, ctag.Name);
- ClassModel model = context.ResolveType(type, mxmlContext.model);
-
+ var model = context.ResolveType(type, mxmlContext.model);
if (model.IsVoid()) // try resolving tag as member of parent tag
{
parentTag = XMLComplete.GetParentTag(sci, ctag);
@@ -58,16 +55,14 @@ public static bool GotoDeclaration()
else return true;
}
- if (word != null && !ctag.Name.EndsWith(word))
+ if (word != null && !ctag.Name.EndsWithOrdinal(word))
{
- ASResult found = ResolveAttribute(model, word);
+ var found = ResolveAttribute(model, word);
ASComplete.OpenDocumentToDeclaration(sci, found);
}
else
{
- ASResult found = new ASResult();
- found.InFile = model.InFile;
- found.Type = model;
+ var found = new ASResult {InFile = model.InFile, Type = model};
ASComplete.OpenDocumentToDeclaration(sci, found);
}
return true;
@@ -75,21 +70,23 @@ public static bool GotoDeclaration()
#endregion
#region tag completion
- static private XMLContextTag tagContext;
- static private XMLContextTag parentTag;
- static private string tokenContext;
- static private string checksum;
- static private Dictionary> allTags;
+
+ static XMLContextTag tagContext;
+ static XMLContextTag parentTag;
+ static string tokenContext;
+ static string checksum;
+
+ static Dictionary> allTags;
//static private Regex reIncPath = new Regex("[\"']([^\"']+)", RegexOptions.Compiled);
- static private Regex reIncPath = new Regex("(\"|')([^\r\n]+)(\\1)", RegexOptions.Compiled);
- static private Dictionary includesCache = new Dictionary();
+ static readonly Regex reIncPath = new Regex("(\"|')([^\r\n]+)(\\1)", RegexOptions.Compiled);
+ static readonly Dictionary includesCache = new Dictionary();
///
/// Called
///
///
///
- static public bool HandleElement(object data)
+ public static bool HandleElement(object data)
{
if (!GetContext(data)) return false;
@@ -102,19 +99,19 @@ static public bool HandleElement(object data)
bool isContainer = AddParentAttributes(mix, excludes); // current tag attributes
if (isContainer) // container children tag
- foreach (string ns in mxmlContext.namespaces.Keys)
- {
- string uri = mxmlContext.namespaces[ns];
- if (ns != "*") mix.Add(new NamespaceItem(ns, uri));
-
- if (!allTags.ContainsKey(ns))
- continue;
- foreach (string tag in allTags[ns])
+ foreach (string ns in mxmlContext.namespaces.Keys)
{
- if (ns == "*") mix.Add(new HtmlTagItem(tag, tag));
- else mix.Add(new HtmlTagItem(tag, ns + ":" + tag, uri));
+ string uri = mxmlContext.namespaces[ns];
+ if (ns != "*") mix.Add(new NamespaceItem(ns, uri));
+
+ if (!allTags.ContainsKey(ns))
+ continue;
+ foreach (string tag in allTags[ns])
+ {
+ if (ns == "*") mix.Add(new HtmlTagItem(tag, tag));
+ else mix.Add(new HtmlTagItem(tag, ns + ":" + tag, uri));
+ }
}
- }
// cleanup and show list
mix.Sort(new MXMLListItemComparer());
@@ -135,7 +132,7 @@ static public bool HandleElement(object data)
return true;
}
- private static bool AddParentAttributes(List mix, List excludes)
+ static bool AddParentAttributes(List mix, List excludes)
{
bool isContainer = true;
if (parentTag.Name != null) // add parent tag members
@@ -147,8 +144,8 @@ private static bool AddParentAttributes(List mix, List mix, List mix = new List();
- List excludes = new List();
-
- bool isContainer = AddParentAttributes(mix, excludes); // current tag attributes
-
+ var ns = tagContext.Name.Substring(0, p);
+ if (!mxmlContext.namespaces.ContainsKey(ns)) return true;
+ var uri = mxmlContext.namespaces[ns];
+ var mix = new List();
+ var excludes = new List();
+ var isContainer = AddParentAttributes(mix, excludes); // current tag attributes
if (isContainer && allTags.ContainsKey(ns)) // container children tags
foreach (string tag in allTags[ns])
mix.Add(new HtmlTagItem(tag, ns + ":" + tag, uri));
// cleanup and show list
mix.Sort(new MXMLListItemComparer());
- List items = new List();
+ var items = new List();
string previous = null;
- foreach (ICompletionListItem item in mix)
+ foreach (var item in mix)
{
if (previous == item.Label) continue;
previous = item.Label;
@@ -198,31 +189,29 @@ static public bool HandleNamespace(object data)
return true;
}
- static public bool HandleElementClose(object data)
+ public static bool HandleElementClose(object data)
{
if (!GetContext(data)) return false;
-
if (tagContext.Closing) return false;
-
- string type = ResolveType(mxmlContext, tagContext.Name);
- ScintillaControl sci = PluginBase.MainForm.CurrentDocument.SciControl;
-
- if (type.StartsWith("mx.builtin.") || type.StartsWith("fx.builtin.")) // special tags
+ var sci = PluginBase.MainForm.CurrentDocument?.SciControl;
+ if (sci is null) return false;
+ var type = ResolveType(mxmlContext, tagContext.Name);
+ if (type.StartsWithOrdinal("mx.builtin.") || type.StartsWithOrdinal("fx.builtin.")) // special tags
{
- if (type.EndsWith(".Script"))
+ if (type.EndsWithOrdinal(".Script"))
{
string snip = "$(Boundary)\n\t\n" + tagContext.Name + ">";
SnippetHelper.InsertSnippetText(sci, sci.CurrentPos, snip);
return true;
}
- if (type.EndsWith(".Style"))
+ if (type.EndsWithOrdinal(".Style"))
{
string snip = "$(Boundary)";
foreach (string ns in mxmlContext.namespaces.Keys)
{
string uri = mxmlContext.namespaces[ns];
if (ns != "fx")
- snip += String.Format("\n\t@namespace {0} \"{1}\";", ns, uri);
+ snip += $"\n\t@namespace {ns} \"{uri}\";";
}
snip += "\n\t$(EntryPoint)\n" + tagContext.Name + ">";
SnippetHelper.InsertSnippetText(sci, sci.CurrentPos, snip);
@@ -232,31 +221,28 @@ static public bool HandleElementClose(object data)
return false;
}
- static public bool HandleAttribute(object data)
+ public static bool HandleAttribute(object data)
{
if (!GetContext(data)) return false;
-
- string type = ResolveType(mxmlContext, tagContext.Name);
- ClassModel tagClass = context.ResolveType(type, mxmlContext.model);
+ var type = ResolveType(mxmlContext, tagContext.Name);
+ var tagClass = context.ResolveType(type, mxmlContext.model);
if (tagClass.IsVoid()) return true;
tagClass.ResolveExtends();
-
- List mix = new List();
- List excludes = new List();
+ var mix = new List();
+ var excludes = new List();
GetTagAttributes(tagClass, mix, excludes, null);
// cleanup and show list
mix.Sort(new MXMLListItemComparer());
- List items = new List();
+ var items = new List();
string previous = null;
- foreach (ICompletionListItem item in mix)
+ foreach (var item in mix)
{
if (previous == item.Label) continue;
previous = item.Label;
if (excludes.Contains(previous)) continue;
items.Add(item);
}
-
if (items.Count == 0) return true;
if (!string.IsNullOrEmpty(tokenContext)) CompletionList.Show(items, false, tokenContext);
else CompletionList.Show(items, true);
@@ -264,17 +250,14 @@ static public bool HandleAttribute(object data)
return true;
}
- static public bool HandleAttributeValue(object data)
+ public static bool HandleAttributeValue(object data)
{
if (!GetContext(data)) return false;
-
- string type = ResolveType(mxmlContext, tagContext.Name);
- ClassModel tagClass = context.ResolveType(type, mxmlContext.model);
+ var type = ResolveType(mxmlContext, tagContext.Name);
+ var tagClass = context.ResolveType(type, mxmlContext.model);
if (tagClass.IsVoid()) return true;
tagClass.ResolveExtends();
-
- string currentAttribute;
- StringBuilder caBuilder = new StringBuilder();
+ var caBuilder = new StringBuilder();
bool possibleStartFound = false, startFound = false;
for (int i = tagContext.Tag.Length - 1; i >= 0; i--)
{
@@ -285,29 +268,28 @@ static public bool HandleAttributeValue(object data)
}
else if (startFound)
{
- if (Char.IsWhiteSpace(currChar))
+ if (char.IsWhiteSpace(currChar))
break;
caBuilder.Insert(0, currChar);
}
- else if (possibleStartFound && !Char.IsWhiteSpace(currChar))
+ else if (possibleStartFound && !char.IsWhiteSpace(currChar))
{
startFound = true;
caBuilder.Insert(0, currChar);
}
}
- currentAttribute = caBuilder.ToString();
+ var currentAttribute = caBuilder.ToString();
- List mix = GetTagAttributeValues(tagClass, null, currentAttribute);
-
- if (mix == null || mix.Count == 0) return true;
+ var mix = GetTagAttributeValues(tagClass, null, currentAttribute);
+ if (mix.IsNullOrEmpty()) return true;
// cleanup and show list
mix.Sort(new MXMLListItemComparer());
- List items = new List();
+ var items = new List();
string previous = null;
- foreach (ICompletionListItem item in mix)
+ foreach (var item in mix)
{
if (previous == item.Label) continue;
previous = item.Label;
@@ -321,13 +303,13 @@ static public bool HandleAttributeValue(object data)
return true;
}
- private static bool GetTagAttributes(ClassModel tagClass, List mix, List excludes, string ns)
+ static bool GetTagAttributes(ClassModel tagClass, ICollection mix, ICollection excludes, string ns)
{
- ClassModel curClass = mxmlContext.model.GetPublicClass();
- ClassModel tmpClass = tagClass;
- FlagType mask = FlagType.Variable | FlagType.Setter;
- Visibility acc = context.TypesAffinity(curClass, tmpClass);
- bool isContainer = false;
+ var curClass = mxmlContext.model.GetPublicClass();
+ var tmpClass = tagClass;
+ var mask = FlagType.Variable | FlagType.Setter;
+ var acc = context.TypesAffinity(curClass, tmpClass);
+ var isContainer = false;
if (tmpClass.InFile.Package != "mx.builtin" && tmpClass.InFile.Package != "fx.builtin")
mix.Add(new HtmlAttributeItem("id", "String", null, ns));
@@ -356,17 +338,15 @@ private static bool GetTagAttributes(ClassModel tagClass, List 0)
{
- if (member.Parameters != null && member.Parameters.Count > 0)
- mtype = member.Parameters[0].Type;
- else mtype = null;
+ mtype = !member.Parameters.IsNullOrEmpty() ? member.Parameters[0].Type : null;
}
mix.Add(new HtmlAttributeItem(member.Name, mtype, className, ns));
}
- ExploreMetadatas(tmpClass.InFile, mix, excludes, ns, tagClass == tmpClass);
+ ExploreMetadatas(tmpClass, mix, excludes, ns, tagClass == tmpClass);
tmpClass = tmpClass.Extends;
- if (tmpClass != null && tmpClass.InFile.Package == "" && tmpClass.Name == "Object")
+ if (tmpClass.InFile.Package == "" && tmpClass.Name == "Object")
break;
// members visibility
acc = context.TypesAffinity(curClass, tmpClass);
@@ -375,12 +355,12 @@ private static bool GetTagAttributes(ClassModel tagClass, List GetTagAttributeValues(ClassModel tagClass, string ns, string attribute)
+ static List GetTagAttributeValues(ClassModel tagClass, string ns, string attribute)
{
- ClassModel curClass = mxmlContext.model.GetPublicClass();
- ClassModel tmpClass = tagClass;
- FlagType mask = FlagType.Variable | FlagType.Setter | FlagType.Getter;
- Visibility acc = context.TypesAffinity(curClass, tmpClass);
+ var curClass = mxmlContext.model.GetPublicClass();
+ var tmpClass = tagClass;
+ var mask = FlagType.Variable | FlagType.Setter | FlagType.Getter;
+ var acc = context.TypesAffinity(curClass, tmpClass);
if (tmpClass.InFile.Package != "mx.builtin" && tmpClass.InFile.Package != "fx.builtin" && attribute == "id")
return null;
@@ -402,10 +382,7 @@ private static List GetTagAttributeValues(ClassModel tagCla
if ((member.Flags & FlagType.Setter) > 0)
{
- if (member.Parameters != null && member.Parameters.Count > 0)
- mtype = member.Parameters[0].Type;
- else mtype = null;
-
+ mtype = !member.Parameters.IsNullOrEmpty() ? member.Parameters[0].Type : null;
if (!hasGetterSetter)
{
hasGetterSetter = true;
@@ -414,7 +391,8 @@ private static List GetTagAttributeValues(ClassModel tagCla
}
return GetAutoCompletionValuesFromInspectable(mtype, metas);
}
- else if ((member.Flags & FlagType.Getter) > 0)
+
+ if ((member.Flags & FlagType.Getter) > 0)
{
if (!hasGetterSetter)
{
@@ -431,11 +409,11 @@ private static List GetTagAttributeValues(ClassModel tagCla
}
List retVal;
- if (GetAutoCompletionValuesFromMetaData(tmpClass.InFile, attribute, tagClass, tmpClass, out retVal))
+ if (GetAutoCompletionValuesFromMetaData(tmpClass, attribute, tagClass, tmpClass, out retVal))
return retVal;
tmpClass = tmpClass.Extends;
- if (tmpClass != null && tmpClass.InFile.Package == "" && tmpClass.Name == "Object")
+ if (tmpClass.InFile.Package == "" && tmpClass.Name == "Object")
break;
// members visibility
acc = context.TypesAffinity(curClass, tmpClass);
@@ -447,11 +425,9 @@ private static List GetTagAttributeValues(ClassModel tagCla
return null;
}
- private static List GetAutoCompletionValuesFromInspectable(string type, List metas)
+ static List GetAutoCompletionValuesFromInspectable(string type, List metas)
{
- if (metas == null || metas.Count == 0)
- return GetAutoCompletionValuesFromType(type);
-
+ if (metas.IsNullOrEmpty()) return GetAutoCompletionValuesFromType(type);
foreach (var meta in metas)
{
if (meta.Name != "Inspectable") continue;
@@ -463,7 +439,7 @@ private static List GetAutoCompletionValuesFromInspectable(
foreach (string value in enumValues.Split(','))
{
var tValue = value.Trim();
- if (tValue != string.Empty) retVal.Add(new HtmlAttributeItem(tValue));
+ if (tValue.Length != 0) retVal.Add(new HtmlAttributeItem(tValue));
}
if (retVal.Count > 0) return retVal;
@@ -473,46 +449,43 @@ private static List GetAutoCompletionValuesFromInspectable(
return GetAutoCompletionValuesFromType(type);
}
- private static bool GetAutoCompletionValuesFromMetaData(FileModel model, string attribute, ClassModel tagClass, ClassModel tmpClass, out List result)
+ static bool GetAutoCompletionValuesFromMetaData(ClassModel model, string attribute, ClassModel tagClass, ClassModel tmpClass, out List result)
{
- if (model != null && model.MetaDatas != null)
+ if (model?.MetaDatas != null)
{
foreach (ASMetaData meta in model.MetaDatas)
{
- string name = null;
- if (!meta.Params.TryGetValue("name", out name) || name != attribute) continue;
+ if (!meta.Params.TryGetValue("name", out var name) || name != attribute) continue;
string type = null;
switch (meta.Kind)
{
case ASMetaKind.Event:
- string eventType;
- if (!meta.Params.TryGetValue("type", out eventType)) eventType = "flash.events.Event";
+ if (!meta.Params.TryGetValue("type", out var eventType)) eventType = "flash.events.Event";
result = GetAutoCompletionValuesFromEventType(eventType);
return true;
case ASMetaKind.Style:
- string inherit;
- if (meta.Params != null && meta.Params.TryGetValue("inherit", out inherit) && inherit == "no" && tagClass != tmpClass)
+ if (meta.Params.TryGetValue("inherit", out var inherit) && inherit == "no" && tagClass != tmpClass)
continue;
- if (meta.Params != null) meta.Params.TryGetValue("type", out type);
+ meta.Params.TryGetValue("type", out type);
break;
case ASMetaKind.Effect:
- if (meta.Params != null) type = meta.Params["event"];
+ type = meta.Params["event"];
break;
case ASMetaKind.Exclude:
break;
- case ASMetaKind.Include: // Can this happen? if it happens I guess name == true will never be true? I don't know any test case
+ case ASMetaKind.Include: // TODO: Check this case...
Debug.Assert(false, "Please, check this case");
- FileModel incModel = ParseInclude(model, meta);
- return GetAutoCompletionValuesFromMetaData(incModel, attribute, tagClass, tmpClass, out result);
+ FileModel incModel = ParseInclude(model.InFile, meta);
+ return GetAutoCompletionValuesFromMetaData(incModel.GetPublicClass(), attribute, tagClass, tmpClass, out result);
}
- if (meta.Params != null && meta.Params.ContainsKey("enumeration"))
+ if (meta.Params.ContainsKey("enumeration"))
{
var retVal = new List();
foreach (string value in meta.Params["enumeration"].Split(','))
{
var tValue = value.Trim();
- if (tValue != string.Empty) retVal.Add(new HtmlAttributeItem(tValue));
+ if (tValue.Length != 0) retVal.Add(new HtmlAttributeItem(tValue));
}
result = retVal;
@@ -529,7 +502,7 @@ private static bool GetAutoCompletionValuesFromMetaData(FileModel model, string
return false;
}
- private static List GetAutoCompletionValuesFromEventType(string type)
+ static List GetAutoCompletionValuesFromEventType(string type)
{
ClassModel tmpClass = mxmlContext.model.GetPublicClass();
ClassModel eventClass = context.ResolveType(type, mxmlContext.model);
@@ -540,10 +513,10 @@ private static List GetAutoCompletionValuesFromEventType(st
List result = null;
var validTypes = new Dictionary();
- while (tmpClass != null && !tmpClass.IsVoid())
+ while (!tmpClass.IsVoid())
{
foreach (MemberModel member in tmpClass.Members)
- if ((member.Flags & FlagType.Function) > 0 && (member.Access & acc) > 0 && member.Parameters != null && member.Parameters.Count > 0)
+ if ((member.Flags & FlagType.Function) > 0 && (member.Access & acc) > 0 && !member.Parameters.IsNullOrEmpty())
{
bool validFunction = true;
var argType = member.Parameters[0].Type;
@@ -572,12 +545,12 @@ private static List GetAutoCompletionValuesFromEventType(st
if (!validFunction) continue;
- if (result == null) result = new List();
+ result ??= new List();
result.Add(new MxmlEventHandlerItem(member));
}
tmpClass = tmpClass.Extends;
- if (tmpClass != null && tmpClass.InFile.Package == "" && tmpClass.Name == "Object")
+ if (tmpClass.InFile.Package == "" && tmpClass.Name == "Object")
break;
// members visibility
// TODO: Take into account namespaces!
@@ -587,7 +560,7 @@ private static List GetAutoCompletionValuesFromEventType(st
return result;
}
- private static List GetAutoCompletionValuesFromType(string type)
+ static List GetAutoCompletionValuesFromType(string type)
{
if (type == "Boolean")
{
@@ -597,48 +570,44 @@ private static List