mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-17 01:41:17 -10:00
Compare commits
107
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
77769615db | ||
|
|
df7816daf4 | ||
|
|
5d03a6fe11 | ||
|
|
4a2a26ce69 | ||
|
|
c8cfa8f284 | ||
|
|
6f0bf73005 | ||
|
|
fdbba4a34e | ||
|
|
1278c2f35e | ||
|
|
8199a27e28 | ||
|
|
9b3e6f4700 | ||
|
|
8487188883 | ||
|
|
f2379f2d66 | ||
|
|
db04a05e04 | ||
|
|
d06686c425 | ||
|
|
2ff898859b | ||
|
|
b27b2d7f61 | ||
|
|
13fc6948f3 | ||
|
|
2517534847 | ||
|
|
c6890f410c | ||
|
|
b33fa1d00e | ||
|
|
8a687a4044 | ||
|
|
44703b3ecc | ||
|
|
0ac7105edd | ||
|
|
147ecc0ac3 | ||
|
|
e7b4669bc9 | ||
|
|
fc145be98c | ||
|
|
adebac056a | ||
|
|
f7f561703a | ||
|
|
b5b50eefe7 | ||
|
|
cec38fcfc8 | ||
|
|
0761b0ee55 | ||
|
|
0c45a74a96 | ||
|
|
d5f5f3762f | ||
|
|
f1bdf8a93d | ||
|
|
3fdc3c84b2 | ||
|
|
846a5d41ee | ||
|
|
c8b96661d3 | ||
|
|
db584480ff | ||
|
|
0686e1435b | ||
|
|
5ef6ad0ef7 | ||
|
|
36073a0c74 | ||
|
|
e65846bfd3 | ||
|
|
0011444f0b | ||
|
|
4c93e382f5 | ||
|
|
8b72dbb708 | ||
|
|
1e2d68b92c | ||
|
|
e55302cb08 | ||
|
|
ef8188a08d | ||
|
|
01be275ad7 | ||
|
|
f9e5a6d2b2 | ||
|
|
a979811c63 | ||
|
|
455cf7d3b1 | ||
|
|
2edccc52a7 | ||
|
|
2b0e9bfe7a | ||
|
|
d56ea8a520 | ||
|
|
4e15267c70 | ||
|
|
fe455fcb34 | ||
|
|
64bfc6c000 | ||
|
|
0fd24828b1 | ||
|
|
03e8e8e56f | ||
|
|
db8ee7ad92 | ||
|
|
a83bdec08e | ||
|
|
f323b29968 | ||
|
|
360e64d261 | ||
|
|
a1351981f6 | ||
|
|
2cc08cae73 | ||
|
|
0a51d89c42 | ||
|
|
f7df632ff0 | ||
|
|
694c3ef470 | ||
|
|
00cb738f63 | ||
|
|
1ff24a77be | ||
|
|
5f80ec8d77 | ||
|
|
1ae385b59e | ||
|
|
b61db514ab | ||
|
|
68a4b43536 | ||
|
|
a36cb75039 | ||
|
|
c721d4ce2a | ||
|
|
2c3a70016b | ||
|
|
cafdade424 | ||
|
|
43cfe8ecfe | ||
|
|
bcee9454e9 | ||
|
|
e283c45cc0 | ||
|
|
828af02bdf | ||
|
|
ff68a657fa | ||
|
|
eb6a6bae1e | ||
|
|
e8046e3848 | ||
|
|
ade2f9239a | ||
|
|
ac8a9a9eab | ||
|
|
12c92be908 | ||
|
|
b951ebb775 | ||
|
|
47262ff08a | ||
|
|
17a925ca25 | ||
|
|
a2bb316900 | ||
|
|
cbc3a80a27 | ||
|
|
2538b65b30 | ||
|
|
5d83bf4c65 | ||
|
|
37c475126d | ||
|
|
50d4fc360c | ||
|
|
159160da7b | ||
|
|
25b7c45431 | ||
|
|
3e0d18cb7b | ||
|
|
8228edb9a2 | ||
|
|
c823f329f1 | ||
|
|
bb4cd21233 | ||
|
|
7327c13535 | ||
|
|
7eb7a82f09 | ||
|
|
94ad23218f |
No files matched your search
+1
-3
@@ -20,10 +20,8 @@ m4/mono-output.m4 crlf=input
|
||||
*.sln crlf
|
||||
*.*proj* crlf
|
||||
|
||||
*.bat text eol=crlf
|
||||
*.cmd text eol=crlf
|
||||
|
||||
# don't do anything to line-endings. Let CRLFs/LFs go into the repo, and CRLF/LFs on checkout
|
||||
*.bat -crlf
|
||||
*.xml -crlf
|
||||
|
||||
# CRLF Handling
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ AM_CFLAGS = $(WERROR_CFLAGS)
|
||||
|
||||
SUBDIRS = @MONO_SUBDIRS@
|
||||
noinst_SUBDIRS = @MONO_NOINST_SUBDIRS@
|
||||
DIST_SUBDIRS = $(SUBDIRS) m4 netcore
|
||||
DIST_SUBDIRS = $(SUBDIRS) m4 netcore netcore/corerun
|
||||
|
||||
if !ENABLE_NETCORE
|
||||
|
||||
|
||||
+5
-14
@@ -104,10 +104,12 @@ if grep "^AM_PROG_LIBTOOL" configure.ac >/dev/null; then
|
||||
fi
|
||||
fi
|
||||
|
||||
# Parse parameters
|
||||
|
||||
#
|
||||
# Plug in the extension module
|
||||
#
|
||||
has_ext_mod=false
|
||||
ext_mod_args=''
|
||||
has_disable_boehm=false
|
||||
for PARAM; do
|
||||
if [[ $PARAM =~ "--enable-extension-module" ]] ; then
|
||||
has_ext_mod=true
|
||||
@@ -115,14 +117,8 @@ for PARAM; do
|
||||
ext_mod_args=`echo $PARAM | cut -d= -f2`
|
||||
fi
|
||||
fi
|
||||
if [[ $PARAM =~ "--disable-boehm" ]] ; then
|
||||
has_disable_boehm=true
|
||||
fi
|
||||
done
|
||||
|
||||
#
|
||||
# Plug in the extension module
|
||||
#
|
||||
if test x$has_ext_mod = xtrue; then
|
||||
pushd $top_srcdir../mono-extensions/scripts
|
||||
sh ./prepare-repo.sh $ext_mod_args || exit 1
|
||||
@@ -154,12 +150,7 @@ automake $am_opt ||
|
||||
echo "Running autoconf ..."
|
||||
autoconf || { echo "**Error**: autoconf failed."; exit 1; }
|
||||
|
||||
# Update all submodules recursively to ensure everything is checked out
|
||||
if test -e $srcdir/scripts/update_submodules.sh; then
|
||||
(cd $srcdir && scripts/update_submodules.sh)
|
||||
fi
|
||||
|
||||
if test x$has_disable_boehm = xfalse -a -d $srcdir/external/bdwgc; then
|
||||
if test -d $srcdir/external/bdwgc; then
|
||||
echo Running external/bdwgc/autogen.sh ...
|
||||
(cd $srcdir/external/bdwgc ; NOCONFIGURE=1 ./autogen.sh "$@")
|
||||
echo Done running external/bdwgc/autogen.sh ...
|
||||
|
||||
+28
-64
@@ -4,7 +4,7 @@
|
||||
# This line is parsed by tools besides autoconf, such as msvc/mono.winconfig.targets.
|
||||
# It should remain in the format they expect.
|
||||
#
|
||||
AC_INIT(mono, [6.13.0],
|
||||
AC_INIT(mono, [6.10.0],
|
||||
[https://github.com/mono/mono/issues/new])
|
||||
|
||||
AC_CONFIG_SRCDIR([Makefile.am])
|
||||
@@ -63,7 +63,7 @@ MONO_VERSION_BUILD=`echo $VERSION | cut -d . -f 3`
|
||||
# This line is parsed by tools besides autoconf, such as msvc/mono.winconfig.targets.
|
||||
# It should remain in the format they expect.
|
||||
#
|
||||
MONO_CORLIB_VERSION=1A5E0066-58DC-428A-B21C-0AD6CDAE2789
|
||||
MONO_CORLIB_VERSION=97b07b51-46d8-4084-b48e-77aa5c192654
|
||||
|
||||
#
|
||||
# Put a quoted #define in config.h.
|
||||
@@ -358,10 +358,6 @@ case "$host" in
|
||||
# https://bugzilla.novell.com/show_bug.cgi?id=504411
|
||||
disable_munmap=yes
|
||||
;;
|
||||
powerpc*-*-freebsd*)
|
||||
# https://bugzilla.novell.com/show_bug.cgi?id=504411
|
||||
disable_munmap=yes
|
||||
;;
|
||||
riscv*)
|
||||
support_boehm=no
|
||||
with_gc=sgen
|
||||
@@ -677,7 +673,7 @@ AC_PROG_LD_GNU
|
||||
AC_CHECK_HEADERS(sys/filio.h sys/sockio.h netdb.h utime.h sys/utime.h semaphore.h sys/un.h linux/rtc.h sys/syscall.h sys/mkdev.h sys/uio.h sys/param.h sys/sysctl.h libproc.h sys/prctl.h copyfile.h gnu/lib-names.h)
|
||||
AC_CHECK_HEADERS(sys/param.h sys/socket.h sys/ipc.h sys/utsname.h alloca.h ucontext.h pwd.h sys/select.h netinet/tcp.h netinet/in.h unistd.h sys/types.h link.h asm/sigcontext.h sys/inotify.h arpa/inet.h complex.h unwind.h)
|
||||
|
||||
# zlib/configure checks for unistd.h existence and defines HAVE_UNISTD_H on the compiler
|
||||
# zlib/configure checks for unistd.h existance and defines HAVE_UNISTD_H on the compiler
|
||||
# command line (not config.h) if it is present.
|
||||
AC_CHECK_HEADER(unistd.h,
|
||||
[HAVE_UNISTD_H=1
|
||||
@@ -1362,9 +1358,7 @@ MONO_LLVM_PATH_OPTION=llvm-path="`pwd`/llvm/usr/bin"
|
||||
|
||||
if test x$cross_compiling = xyes -o x$enable_mcs_build = xno; then
|
||||
DISABLE_MCS_DOCS_default=yes
|
||||
fi
|
||||
|
||||
if test x$with_runtime_preset = xnetcore; then
|
||||
elif test x$with_runtime_preset = xnetcore; then
|
||||
# Keep in sync with winconfig.h netcore configuration.
|
||||
DISABLE_MCS_DOCS_default=yes
|
||||
BTLS_SUPPORTED=no
|
||||
@@ -1758,7 +1752,7 @@ AM_CONDITIONAL(ENABLE_STATIC_GCC_LIBS, test "x$enable_static_gcc_libs" = "xyes")
|
||||
AC_ARG_ENABLE(minimal, [ --enable-minimal=LIST drop support for LIST subsystems.
|
||||
LIST is a comma-separated list from: aot, profiler, decimal, pinvoke, debug, appdomains, verifier, dllmap,
|
||||
reflection_emit, reflection_emit_save, large_code, logging, com, ssa, generics, attach, jit, interpreter, simd, soft_debug, perfcounters, normalization, desktop_loader, shared_perfcounters, remoting,
|
||||
security, lldb, mdb, assert_messages, cfgdir_config, cleanup, sgen_marksweep_conc, sgen_split_nursery, sgen_gc_bridge, sgen_debug_helpers, sockets, gac, threads.],
|
||||
security, lldb, mdb, assert_messages, cleanup, sgen_marksweep_conc, sgen_split_nursery, sgen_gc_bridge, sgen_debug_helpers, sockets, gac, threads.],
|
||||
[
|
||||
for feature in `echo "$enable_minimal" | sed -e "s/,/ /g"`; do
|
||||
eval "mono_feature_disable_$feature='yes'"
|
||||
@@ -1934,11 +1928,6 @@ if test "x$mono_feature_disable_assert_messages" = "xyes"; then
|
||||
AC_MSG_NOTICE([Disabled assertion messages.])
|
||||
fi
|
||||
|
||||
if test "x$mono_feature_disable_cfgdir_config" = "xyes"; then
|
||||
AC_DEFINE(DISABLE_CFGDIR_CONFIG, 1, [Disable config directories.])
|
||||
AC_MSG_NOTICE([Disabled config directories.])
|
||||
fi
|
||||
|
||||
if test "x$mono_feature_disable_cleanup" = "xyes"; then
|
||||
AC_DEFINE(DISABLE_CLEANUP, 1, [Disable runtime cleanup.])
|
||||
AC_MSG_NOTICE([Disabled runtime cleanup.])
|
||||
@@ -4480,28 +4469,13 @@ case "$host" in
|
||||
;;
|
||||
macppc-*-openbsd* | powerpc*-*-linux* | powerpc-*-openbsd* | \
|
||||
powerpc-*-sysv* | powerpc-*-darwin* | powerpc-*-netbsd* | \
|
||||
powerpc*-*-freebsd* | powerpc*-*-aix* | powerpc*-*-os400* )
|
||||
powerpc-*-freebsd* | powerpc*-*-aix* | powerpc*-*-os400* )
|
||||
if test "x$ac_cv_sizeof_void_p" = "x8"; then
|
||||
TARGET=POWERPC64;
|
||||
CPPFLAGS="$CPPFLAGS -D__mono_ppc__ -D__mono_ppc64__"
|
||||
# mono#18554 - be more robust in testing for -mminimal-toc
|
||||
AC_MSG_NOTICE([Checking for PowerPC ISA -mminimal-toc support])
|
||||
AX_CHECK_COMPILE_FLAG(
|
||||
[-mminimal-toc],
|
||||
[CFLAGS="$CFLAGS -mminimal-toc"],
|
||||
[CFLAGS="$CFLAGS"]
|
||||
)
|
||||
case "$host" in
|
||||
powerpc*-*-freebsd*)
|
||||
# We need to be aware if we are ELFv1 or v2 here
|
||||
AC_MSG_NOTICE([Checking FreeBSD ELF version])
|
||||
if ! ( echo | cc -dM -E - | awk '/_CALL_ELF/ {print $NF}'); then
|
||||
AC_DEFINE([POWERPC_ELF], 1, [PowerPC ELFv1])
|
||||
else
|
||||
AC_DEFINE([POWERPC_ELFV2], 1, [PowerPC ELFv2])
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
if ! (echo $CC | grep -q -- 'clang'); then
|
||||
CFLAGS="$CFLAGS -mminimal-toc"
|
||||
fi
|
||||
else
|
||||
TARGET=POWERPC;
|
||||
CPPFLAGS="$CPPFLAGS -D__mono_ppc__"
|
||||
@@ -4516,10 +4490,6 @@ case "$host" in
|
||||
BTLS_SUPPORTED=yes
|
||||
BTLS_PLATFORM=powerpc
|
||||
;;
|
||||
freebsd*)
|
||||
BTLS_SUPPORTED=yes
|
||||
BTLS_PLATFORM=powerpc
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
armv7k-*-darwin*)
|
||||
@@ -5055,23 +5025,21 @@ case "$host" in
|
||||
SQLITE3="libsqlite3.so"
|
||||
;;
|
||||
*-*-*linux*)
|
||||
if test "x$with_core" != "xonly"; then
|
||||
AC_PATH_X
|
||||
dlsearch_path=`(libtool --config ; echo eval echo \\$sys_lib_dlsearch_path_spec) | sh`
|
||||
AC_MSG_CHECKING(for the soname of libX11.so)
|
||||
for i in $x_libraries $dlsearch_path; do
|
||||
for r in 4 5 6; do
|
||||
if test -f $i/libX11.so.$r; then
|
||||
X11=libX11.so.$r
|
||||
AC_MSG_RESULT($X11)
|
||||
fi
|
||||
done
|
||||
AC_PATH_X
|
||||
dlsearch_path=`(libtool --config ; echo eval echo \\$sys_lib_dlsearch_path_spec) | sh`
|
||||
AC_MSG_CHECKING(for the soname of libX11.so)
|
||||
for i in $x_libraries $dlsearch_path; do
|
||||
for r in 4 5 6; do
|
||||
if test -f $i/libX11.so.$r; then
|
||||
X11=libX11.so.$r
|
||||
AC_MSG_RESULT($X11)
|
||||
fi
|
||||
done
|
||||
|
||||
if test "x$X11" = "xlibX11.so"; then
|
||||
AC_MSG_WARN([Could not find libX11.so. Do you have X.org or XFree86 installed? Assuming libX11.so.6...]);
|
||||
X11=libX11.so.6
|
||||
fi
|
||||
done
|
||||
|
||||
if test "x$X11" = "xlibX11.so"; then
|
||||
AC_MSG_WARN([Could not find libX11.so. Do you have X.org or XFree86 installed? Assuming libX11.so.6...]);
|
||||
X11=libX11.so.6
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
@@ -5186,12 +5154,8 @@ AC_SEARCH_LIBS(dlopen, dl)
|
||||
#
|
||||
export_link_flags=--export-dynamic
|
||||
case $host_os in
|
||||
mingw*|cygwin*)
|
||||
mingw*|cygwin*)
|
||||
export_link_flags=--export-all-symbols
|
||||
;;
|
||||
*-*-darwin*)
|
||||
export_link_flags=--export_dynamic
|
||||
;;
|
||||
esac
|
||||
AX_APPEND_LINK_FLAGS([-Wl,$export_link_flags -Wl,-Bsymbolic -bsymbolic -Wl,-z,now -Wl,-bind_at_load])
|
||||
|
||||
@@ -6099,8 +6063,8 @@ fi
|
||||
AC_SUBST(mono_runtime)
|
||||
AC_SUBST(mono_runtime_wrapper)
|
||||
|
||||
CSC_LOCATION=`cd $srcdir && pwd`/external/roslyn-binaries/Microsoft.Net.Compilers/3.5.0/csc.exe
|
||||
VBCS_LOCATION=`cd $srcdir && pwd`/external/roslyn-binaries/Microsoft.Net.Compilers/3.5.0/VBCSCompiler.exe
|
||||
CSC_LOCATION=`cd $srcdir && pwd`/external/roslyn-binaries/Microsoft.Net.Compilers/3.6.0/csc.exe
|
||||
VBCS_LOCATION=`cd $srcdir && pwd`/external/roslyn-binaries/Microsoft.Net.Compilers/3.6.0/VBCSCompiler.exe
|
||||
|
||||
if test $csc_compiler = mcs; then
|
||||
CSC=$mcs_topdir/class/lib/build/mcs.exe
|
||||
@@ -6291,7 +6255,7 @@ fi
|
||||
|
||||
# Top level Makefile.am subdirs
|
||||
if test "x$with_core" = "xonly"; then
|
||||
MONO_SUBDIRS="llvm mono"
|
||||
MONO_SUBDIRS="mk llvm mono"
|
||||
else
|
||||
if test "x$support_boehm" = "xyes" -a "x$libgc" = "xincluded"; then
|
||||
mono_subdirs_libgc=external/bdwgc
|
||||
@@ -6314,7 +6278,7 @@ else
|
||||
mono_subdirs_ikvm_native=ikvm-native
|
||||
fi
|
||||
|
||||
MONO_SUBDIRS="po $mono_subdirs_libgc llvm mono $mono_subdirs_ikvm_native $mono_subdirs_support data runtime scripts man samples $mono_subdirs_tools $mono_subdirs_docs msvc acceptance-tests"
|
||||
MONO_SUBDIRS="mk po $mono_subdirs_libgc llvm mono $mono_subdirs_ikvm_native $mono_subdirs_support data runtime scripts man samples $mono_subdirs_tools $mono_subdirs_docs msvc acceptance-tests"
|
||||
MONO_NOINST_SUBDIRS="$mono_subdirs_libgc"
|
||||
fi
|
||||
|
||||
|
||||
@@ -242,7 +242,7 @@ namespace HtmlAgilityPack
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks for existence of attribute with given name
|
||||
/// Checks for existance of attribute with given name
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
|
||||
@@ -15,13 +15,13 @@
|
||||
</Dependency>
|
||||
</ProductDependencies>
|
||||
<ToolsetDependencies>
|
||||
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="5.0.0-beta.20109.1">
|
||||
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="5.0.0-beta.19574.1">
|
||||
<Uri>https://github.com/dotnet/arcade</Uri>
|
||||
<Sha>b0e8d3944155f94f83deea8afe025debe369e69f</Sha>
|
||||
<Sha>87b59e17420bf0c3341edacbd8a6721e619afbac</Sha>
|
||||
</Dependency>
|
||||
<Dependency Name="Microsoft.DotNet.Helix.Sdk" Version="5.0.0-beta.20109.1">
|
||||
<Dependency Name="Microsoft.DotNet.Helix.Sdk" Version="5.0.0-beta.19574.1">
|
||||
<Uri>https://github.com/dotnet/arcade</Uri>
|
||||
<Sha>b0e8d3944155f94f83deea8afe025debe369e69f</Sha>
|
||||
<Sha>87b59e17420bf0c3341edacbd8a6721e619afbac</Sha>
|
||||
</Dependency>
|
||||
</ToolsetDependencies>
|
||||
</Dependencies>
|
||||
@@ -16,7 +16,7 @@
|
||||
# condition: eq(variables['Agent.OS'], 'Windows_NT')
|
||||
# inputs:
|
||||
# filePath: $(Build.SourcesDirectory)/eng/common/SetupNugetSources.ps1
|
||||
# arguments: -ConfigFile $(Build.SourcesDirectory)/NuGet.config -Password $Env:Token
|
||||
# arguments: -ConfigFile ${Env:BUILD_SOURCESDIRECTORY}/NuGet.config -Password $Env:Token
|
||||
# env:
|
||||
# Token: $(dn-bot-dnceng-artifact-feeds-rw)
|
||||
|
||||
@@ -94,48 +94,41 @@ function InsertMaestroPrivateFeedCredentials($Sources, $Creds, $Password) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!(Test-Path $ConfigFile -PathType Leaf)) {
|
||||
Write-PipelineTelemetryError -Category 'Build' -Message "Eng/common/SetupNugetSources.ps1 returned a non-zero exit code. Couldn't find the NuGet config file: $ConfigFile"
|
||||
ExitWithExitCode 1
|
||||
}
|
||||
|
||||
if (!$Password) {
|
||||
Write-PipelineTelemetryError -Category 'Build' -Message 'Eng/common/SetupNugetSources.ps1 returned a non-zero exit code. Please supply a valid PAT'
|
||||
try {
|
||||
if (!(Test-Path $ConfigFile -PathType Leaf)) {
|
||||
Write-PipelineTelemetryError -Category 'Build' -Message "Couldn't find the file NuGet config file: $ConfigFile"
|
||||
ExitWithExitCode 1
|
||||
}
|
||||
}
|
||||
|
||||
# Load NuGet.config
|
||||
$doc = New-Object System.Xml.XmlDocument
|
||||
$filename = (Get-Item $ConfigFile).FullName
|
||||
$doc.Load($filename)
|
||||
# Load NuGet.config
|
||||
$doc = New-Object System.Xml.XmlDocument
|
||||
$filename = (Get-Item $ConfigFile).FullName
|
||||
$doc.Load($filename)
|
||||
|
||||
# Get reference to <PackageSources> or create one if none exist already
|
||||
$sources = $doc.DocumentElement.SelectSingleNode("packageSources")
|
||||
if ($sources -eq $null) {
|
||||
$sources = $doc.CreateElement("packageSources")
|
||||
$doc.DocumentElement.AppendChild($sources) | Out-Null
|
||||
}
|
||||
# Get reference to <PackageSources> or create one if none exist already
|
||||
$sources = $doc.DocumentElement.SelectSingleNode("packageSources")
|
||||
if ($sources -eq $null) {
|
||||
$sources = $doc.CreateElement("packageSources")
|
||||
$doc.DocumentElement.AppendChild($sources) | Out-Null
|
||||
}
|
||||
|
||||
# Looks for a <PackageSourceCredentials> node. Create it if none is found.
|
||||
$creds = $doc.DocumentElement.SelectSingleNode("packageSourceCredentials")
|
||||
if ($creds -eq $null) {
|
||||
$creds = $doc.CreateElement("packageSourceCredentials")
|
||||
$doc.DocumentElement.AppendChild($creds) | Out-Null
|
||||
}
|
||||
# Looks for a <PackageSourceCredentials> node. Create it if none is found.
|
||||
$creds = $doc.DocumentElement.SelectSingleNode("packageSourceCredentials")
|
||||
if ($creds -eq $null) {
|
||||
$creds = $doc.CreateElement("packageSourceCredentials")
|
||||
$doc.DocumentElement.AppendChild($creds) | Out-Null
|
||||
}
|
||||
|
||||
# Insert credential nodes for Maestro's private feeds
|
||||
InsertMaestroPrivateFeedCredentials -Sources $sources -Creds $creds -Password $Password
|
||||
# Insert credential nodes for Maestro's private feeds
|
||||
InsertMaestroPrivateFeedCredentials -Sources $sources -Creds $creds -Password $Password
|
||||
|
||||
$dotnet3Source = $sources.SelectSingleNode("add[@key='dotnet3']")
|
||||
if ($dotnet3Source -ne $null) {
|
||||
AddPackageSource -Sources $sources -SourceName "dotnet3-internal" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3-internal/nuget/v2" -Creds $creds -Username "dn-bot" -Password $Password
|
||||
AddPackageSource -Sources $sources -SourceName "dotnet3-internal-transport" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3-internal-transport/nuget/v2" -Creds $creds -Username "dn-bot" -Password $Password
|
||||
}
|
||||
|
||||
$dotnet31Source = $sources.SelectSingleNode("add[@key='dotnet3.1']")
|
||||
if ($dotnet31Source -ne $null) {
|
||||
AddPackageSource -Sources $sources -SourceName "dotnet3.1-internal" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal/nuget/v2" -Creds $creds -Username "dn-bot" -Password $Password
|
||||
AddPackageSource -Sources $sources -SourceName "dotnet3.1-internal-transport" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal-transport/nuget/v2" -Creds $creds -Username "dn-bot" -Password $Password
|
||||
$doc.Save($filename)
|
||||
}
|
||||
catch {
|
||||
Write-Host $_.ScriptStackTrace
|
||||
Write-PipelineTelemetryError -Category 'InitializeToolset' -Message $_
|
||||
ExitWithExitCode 1
|
||||
}
|
||||
|
||||
$doc.Save($filename)
|
||||
@@ -17,7 +17,7 @@
|
||||
# displayName: Setup Private Feeds Credentials
|
||||
# inputs:
|
||||
# filePath: $(Build.SourcesDirectory)/eng/common/SetupNugetSources.sh
|
||||
# arguments: $(Build.SourcesDirectory)/NuGet.config $Token
|
||||
# arguments: $BUILD_SOURCESDIRECTORY/NuGet.config $Token
|
||||
# condition: ne(variables['Agent.OS'], 'Windows_NT')
|
||||
# env:
|
||||
# Token: $(dn-bot-dnceng-artifact-feeds-rw)
|
||||
@@ -42,12 +42,7 @@ scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
|
||||
. "$scriptroot/tools.sh"
|
||||
|
||||
if [ ! -f "$ConfigFile" ]; then
|
||||
Write-PipelineTelemetryError -Category 'Build' "Error: Eng/common/SetupNugetSources.sh returned a non-zero exit code. Couldn't find the NuGet config file: $ConfigFile"
|
||||
ExitWithExitCode 1
|
||||
fi
|
||||
|
||||
if [ -z "$CredToken" ]; then
|
||||
Write-PipelineTelemetryError -category 'Build' "Error: Eng/common/SetupNugetSources.sh returned a non-zero exit code. Please supply a valid PAT"
|
||||
Write-PipelineTelemetryError -Category 'Build' -Message "Couldn't find the file NuGet config file: $ConfigFile"
|
||||
ExitWithExitCode 1
|
||||
fi
|
||||
|
||||
@@ -57,7 +52,7 @@ if [[ `uname -s` == "Darwin" ]]; then
|
||||
fi
|
||||
|
||||
# Ensure there is a <packageSources>...</packageSources> section.
|
||||
grep -i "<packageSources>" $ConfigFile
|
||||
grep -i "<packageSources>" $ConfigFile
|
||||
if [ "$?" != "0" ]; then
|
||||
echo "Adding <packageSources>...</packageSources> section."
|
||||
ConfigNodeHeader="<configuration>"
|
||||
@@ -67,7 +62,7 @@ if [ "$?" != "0" ]; then
|
||||
fi
|
||||
|
||||
# Ensure there is a <packageSourceCredentials>...</packageSourceCredentials> section.
|
||||
grep -i "<packageSourceCredentials>" $ConfigFile
|
||||
grep -i "<packageSourceCredentials>" $ConfigFile
|
||||
if [ "$?" != "0" ]; then
|
||||
echo "Adding <packageSourceCredentials>...</packageSourceCredentials> section."
|
||||
|
||||
@@ -77,64 +72,37 @@ if [ "$?" != "0" ]; then
|
||||
sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourcesNodeFooter${NL}$PackageSourceCredentialsTemplate|" NuGet.config
|
||||
fi
|
||||
|
||||
PackageSources=()
|
||||
# Ensure dotnet3-internal and dotnet3-internal-transport is in the packageSources
|
||||
grep -i "<add key=\"dotnet3-internal\">" $ConfigFile
|
||||
if [ "$?" != "0" ]; then
|
||||
echo "Adding dotnet3-internal to the packageSources."
|
||||
|
||||
# Ensure dotnet3-internal and dotnet3-internal-transport are in the packageSources if the public dotnet3 feeds are present
|
||||
grep -i "<add key=\"dotnet3\"" $ConfigFile
|
||||
PackageSourcesNodeFooter="</packageSources>"
|
||||
PackageSourceTemplate="${TB}<add key=\"dotnet3-internal\" value=\"https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3-internal/nuget/v2\" />"
|
||||
|
||||
if [ "$?" == "0" ]; then
|
||||
grep -i "<add key=\"dotnet3-internal\">" $ConfigFile
|
||||
if [ "$?" != "0" ]; then
|
||||
echo "Adding dotnet3-internal to the packageSources."
|
||||
PackageSourcesNodeFooter="</packageSources>"
|
||||
PackageSourceTemplate="${TB}<add key=\"dotnet3-internal\" value=\"https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3-internal/nuget/v2\" />"
|
||||
|
||||
sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourceTemplate${NL}$PackageSourcesNodeFooter|" $ConfigFile
|
||||
fi
|
||||
PackageSources+=('dotnet3-internal')
|
||||
|
||||
grep -i "<add key=\"dotnet3-internal-transport\"" $ConfigFile
|
||||
if [ "$?" != "0" ]; then
|
||||
echo "Adding dotnet3-internal-transport to the packageSources."
|
||||
PackageSourcesNodeFooter="</packageSources>"
|
||||
PackageSourceTemplate="${TB}<add key=\"dotnet3-internal-transport\" value=\"https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3-internal-transport/nuget/v2\" />"
|
||||
|
||||
sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourceTemplate${NL}$PackageSourcesNodeFooter|" $ConfigFile
|
||||
fi
|
||||
PackageSources+=('dotnet3-internal-transport')
|
||||
sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourceTemplate${NL}$PackageSourcesNodeFooter|" NuGet.config
|
||||
fi
|
||||
|
||||
# Ensure dotnet3.1-internal and dotnet3.1-internal-transport are in the packageSources if the public dotnet3.1 feeds are present
|
||||
grep -i "<add key=\"dotnet3.1\"" $ConfigFile
|
||||
if [ "$?" == "0" ]; then
|
||||
grep -i "<add key=\"dotnet3.1-internal\"" $ConfigFile
|
||||
if [ "$?" != "0" ]; then
|
||||
echo "Adding dotnet3.1-internal to the packageSources."
|
||||
PackageSourcesNodeFooter="</packageSources>"
|
||||
PackageSourceTemplate="${TB}<add key=\"dotnet3.1-internal\" value=\"https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal/nuget/v2\" />"
|
||||
# Ensure dotnet3-internal and dotnet3-internal-transport is in the packageSources
|
||||
grep -i "<add key=\"dotnet3-internal-transport\">" $ConfigFile
|
||||
if [ "$?" != "0" ]; then
|
||||
echo "Adding dotnet3-internal-transport to the packageSources."
|
||||
|
||||
sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourceTemplate${NL}$PackageSourcesNodeFooter|" $ConfigFile
|
||||
fi
|
||||
PackageSources+=('dotnet3.1-internal')
|
||||
PackageSourcesNodeFooter="</packageSources>"
|
||||
PackageSourceTemplate="${TB}<add key=\"dotnet3-internal-transport\" value=\"https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3-internal-transport/nuget/v2\" />"
|
||||
|
||||
grep -i "<add key=\"dotnet3.1-internal-transport\">" $ConfigFile
|
||||
if [ "$?" != "0" ]; then
|
||||
echo "Adding dotnet3.1-internal-transport to the packageSources."
|
||||
PackageSourcesNodeFooter="</packageSources>"
|
||||
PackageSourceTemplate="${TB}<add key=\"dotnet3.1-internal-transport\" value=\"https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal-transport/nuget/v2\" />"
|
||||
|
||||
sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourceTemplate${NL}$PackageSourcesNodeFooter|" $ConfigFile
|
||||
fi
|
||||
PackageSources+=('dotnet3.1-internal-transport')
|
||||
sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourceTemplate${NL}$PackageSourcesNodeFooter|" NuGet.config
|
||||
fi
|
||||
|
||||
# I want things split line by line
|
||||
PrevIFS=$IFS
|
||||
IFS=$'\n'
|
||||
PackageSources+="$IFS"
|
||||
PackageSources+=$(grep -oh '"darc-int-[^"]*"' $ConfigFile | tr -d '"')
|
||||
PackageSources=$(grep -oh '"darc-int-[^"]*"' $ConfigFile | tr -d '"')
|
||||
IFS=$PrevIFS
|
||||
|
||||
PackageSources+=('dotnet3-internal')
|
||||
PackageSources+=('dotnet3-internal-transport')
|
||||
|
||||
for FeedName in ${PackageSources[@]} ; do
|
||||
# Check if there is no existing credential for this FeedName
|
||||
grep -i "<$FeedName>" $ConfigFile
|
||||
@@ -144,6 +112,6 @@ for FeedName in ${PackageSources[@]} ; do
|
||||
PackageSourceCredentialsNodeFooter="</packageSourceCredentials>"
|
||||
NewCredential="${TB}${TB}<$FeedName>${NL}<add key=\"Username\" value=\"dn-bot\" />${NL}<add key=\"ClearTextPassword\" value=\"$CredToken\" />${NL}</$FeedName>"
|
||||
|
||||
sed -i.bak "s|$PackageSourceCredentialsNodeFooter|$NewCredential${NL}$PackageSourceCredentialsNodeFooter|" $ConfigFile
|
||||
sed -i.bak "s|$PackageSourceCredentialsNodeFooter|$NewCredential${NL}$PackageSourceCredentialsNodeFooter|" NuGet.config
|
||||
fi
|
||||
done
|
||||
+13
-9
@@ -62,8 +62,6 @@ function Print-Usage() {
|
||||
Write-Host "The above arguments can be shortened as much as to be unambiguous (e.g. -co for configuration, -t for test, etc.)."
|
||||
}
|
||||
|
||||
. $PSScriptRoot\tools.ps1
|
||||
|
||||
function InitializeCustomToolset {
|
||||
if (-not $restore) {
|
||||
return
|
||||
@@ -114,15 +112,21 @@ function Build {
|
||||
@properties
|
||||
}
|
||||
|
||||
try {
|
||||
if ($clean) {
|
||||
if (Test-Path $ArtifactsDir) {
|
||||
Remove-Item -Recurse -Force $ArtifactsDir
|
||||
Write-Host 'Artifacts directory deleted.'
|
||||
}
|
||||
exit 0
|
||||
if ($clean) {
|
||||
if(Test-Path $ArtifactsDir) {
|
||||
Remove-Item -Recurse -Force $ArtifactsDir
|
||||
Write-Host 'Artifacts directory deleted.'
|
||||
}
|
||||
exit 0
|
||||
}
|
||||
|
||||
try {
|
||||
. $PSScriptRoot\tools.ps1
|
||||
If ((Test-Path variable:LastExitCode) -And ($LastExitCode -ne 0)) {
|
||||
Write-PipelineTelemetryError -Category 'InitializeToolset' -Message 'Eng/common/tools.ps1 returned a non-zero exit code.'
|
||||
ExitWithExitCode $LastExitCode
|
||||
}
|
||||
|
||||
if ($help -or (($null -ne $properties) -and ($properties.Contains('/help') -or $properties.Contains('/?')))) {
|
||||
Print-Usage
|
||||
exit 0
|
||||
|
||||
@@ -25,9 +25,8 @@ __UbuntuPackages="build-essential"
|
||||
__AlpinePackages="alpine-base"
|
||||
__AlpinePackages+=" build-base"
|
||||
__AlpinePackages+=" linux-headers"
|
||||
__AlpinePackagesEdgeTesting=" lldb-dev"
|
||||
__AlpinePackagesEdgeMain=" llvm9-libs"
|
||||
__AlpinePackagesEdgeMain+=" python3"
|
||||
__AlpinePackages+=" lldb-dev"
|
||||
__AlpinePackages+=" llvm-dev"
|
||||
|
||||
# symlinks fixer
|
||||
__UbuntuPackages+=" symlinks"
|
||||
@@ -200,23 +199,13 @@ if [[ "$__LinuxCodeName" == "alpine" ]]; then
|
||||
tar -xf $__ApkToolsDir/apk-tools-$__ApkToolsVersion-x86_64-linux.tar.gz -C $__ApkToolsDir
|
||||
mkdir -p $__RootfsDir/usr/bin
|
||||
cp -v /usr/bin/qemu-$__QEMUArch-static $__RootfsDir/usr/bin
|
||||
|
||||
$__ApkToolsDir/apk-tools-$__ApkToolsVersion/apk \
|
||||
-X http://dl-cdn.alpinelinux.org/alpine/v$__AlpineVersion/main \
|
||||
-X http://dl-cdn.alpinelinux.org/alpine/v$__AlpineVersion/community \
|
||||
-U --allow-untrusted --root $__RootfsDir --arch $__AlpineArch --initdb \
|
||||
add $__AlpinePackages
|
||||
|
||||
$__ApkToolsDir/apk-tools-$__ApkToolsVersion/apk \
|
||||
-X http://dl-cdn.alpinelinux.org/alpine/edge/testing \
|
||||
-X http://dl-cdn.alpinelinux.org/alpine/edge/main \
|
||||
-U --allow-untrusted --root $__RootfsDir --arch $__AlpineArch --initdb \
|
||||
add $__AlpinePackagesEdgeMain
|
||||
|
||||
$__ApkToolsDir/apk-tools-$__ApkToolsVersion/apk \
|
||||
-X http://dl-cdn.alpinelinux.org/alpine/edge/testing \
|
||||
-U --allow-untrusted --root $__RootfsDir --arch $__AlpineArch --initdb \
|
||||
add $__AlpinePackagesEdgeTesting
|
||||
|
||||
add $__AlpinePackages
|
||||
rm -r $__ApkToolsDir
|
||||
elif [[ -n $__LinuxCodeName ]]; then
|
||||
qemu-debootstrap --arch $__UbuntuArch $__LinuxCodeName $__RootfsDir $__UbuntuRepo
|
||||
|
||||
@@ -24,15 +24,13 @@ function InstallDarcCli ($darcVersion) {
|
||||
$darcVersion = $(Invoke-WebRequest -Uri $versionEndpoint -UseBasicParsing).Content
|
||||
}
|
||||
|
||||
$arcadeServicesSource = 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json'
|
||||
$arcadeServicesSource = 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json'
|
||||
|
||||
Write-Host "Installing Darc CLI version $darcVersion..."
|
||||
Write-Host 'You may need to restart your command window if this is the first dotnet tool you have installed.'
|
||||
if (-not $toolpath) {
|
||||
Write-Host "'$dotnet' tool install $darcCliPackageName --version $darcVersion --add-source '$arcadeServicesSource' -v $verbosity -g"
|
||||
& "$dotnet" tool install $darcCliPackageName --version $darcVersion --add-source "$arcadeServicesSource" -v $verbosity -g
|
||||
}else {
|
||||
Write-Host "'$dotnet' tool install $darcCliPackageName --version $darcVersion --add-source '$arcadeServicesSource' -v $verbosity -g --tool-path '$toolpath'"
|
||||
& "$dotnet" tool install $darcCliPackageName --version $darcVersion --add-source "$arcadeServicesSource" -v $verbosity --tool-path "$toolpath"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,12 +2,7 @@ param(
|
||||
[string] $token
|
||||
)
|
||||
|
||||
|
||||
. $PSScriptRoot\pipeline-logging-functions.ps1
|
||||
|
||||
# Write-PipelineSetVariable will no-op if a variable named $ci is not defined
|
||||
# Since this script is only ever called in AzDO builds, just universally set it
|
||||
$ci = $true
|
||||
|
||||
Write-PipelineSetVariable -Name 'VSS_NUGET_ACCESSTOKEN' -Value $token -IsMultiJobVariable $false
|
||||
Write-PipelineSetVariable -Name 'VSS_NUGET_URI_PREFIXES' -Value 'https://dnceng.pkgs.visualstudio.com/;https://pkgs.dev.azure.com/dnceng/;https://devdiv.pkgs.visualstudio.com/;https://pkgs.dev.azure.com/devdiv/' -IsMultiJobVariable $false
|
||||
Write-PipelineSetVariable -Name 'VSS_NUGET_ACCESSTOKEN' -Value $token
|
||||
Write-PipelineSetVariable -Name 'VSS_NUGET_URI_PREFIXES' -Value 'https://dnceng.pkgs.visualstudio.com/;https://pkgs.dev.azure.com/dnceng/;https://devdiv.pkgs.visualstudio.com/;https://pkgs.dev.azure.com/devdiv/'
|
||||
@@ -3,7 +3,7 @@ Param(
|
||||
[Parameter(Mandatory=$true)][string] $gitHubPat, # GitHub personal access token from https://github.com/settings/tokens (no auth scopes needed)
|
||||
[Parameter(Mandatory=$true)][string] $azdoPat, # Azure Dev Ops tokens from https://dev.azure.com/dnceng/_details/security/tokens (code read scope needed)
|
||||
[Parameter(Mandatory=$true)][string] $outputFolder, # Where the graphviz.txt file will be created
|
||||
[string] $darcVersion, # darc's version
|
||||
[string] $darcVersion = '1.1.0-beta.19175.6', # darc's version
|
||||
[string] $graphvizVersion = '2.38', # GraphViz version
|
||||
[switch] $includeToolset # Whether the graph should include toolset dependencies or not. i.e. arcade, optimization. For more about
|
||||
# toolset dependencies see https://github.com/dotnet/arcade/blob/master/Documentation/Darc.md#toolset-vs-product-dependencies
|
||||
|
||||
@@ -113,16 +113,14 @@ try {
|
||||
}
|
||||
$toolInstallationFailure = $true
|
||||
} else {
|
||||
# We cannot change this to Write-PipelineTelemetryError because of https://github.com/dotnet/arcade/issues/4482
|
||||
Write-Host $errMsg
|
||||
Write-PipelineTelemetryError -Category 'NativeToolsBootstrap' -Message $errMsg
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((Get-Variable 'toolInstallationFailure' -ErrorAction 'SilentlyContinue') -and $toolInstallationFailure) {
|
||||
# We cannot change this to Write-PipelineTelemetryError because of https://github.com/dotnet/arcade/issues/4482
|
||||
Write-Host 'Native tools bootstrap failed'
|
||||
Write-PipelineTelemetryError -Category 'NativeToolsBootstrap' -Message 'Native tools bootstrap failed'
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ try {
|
||||
Write-Error "There are multiple copies of $ToolName in $($ToolInstallDirectory): `n$(@($ToolFilePath | out-string))"
|
||||
exit 1
|
||||
} elseif (@($ToolFilePath).Length -Lt 1) {
|
||||
Write-Host "$ToolName was not found in $ToolFilePath."
|
||||
Write-Error "$ToolName was not found in $ToolFilePath."
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
||||
@@ -9,12 +9,12 @@ Param(
|
||||
[string] $Branch=$env:BUILD_SOURCEBRANCH,
|
||||
[string] $CommitSha=$env:BUILD_SOURCEVERSION,
|
||||
[string] $BuildNumber=$env:BUILD_BUILDNUMBER,
|
||||
[string] $RunCategories="Libraries Runtime",
|
||||
[string] $RunCategories="coreclr corefx",
|
||||
[string] $Csproj="src\benchmarks\micro\MicroBenchmarks.csproj",
|
||||
[string] $Kind="micro",
|
||||
[switch] $Internal,
|
||||
[switch] $Compare,
|
||||
[string] $Configurations="CompilationMode=$CompilationMode RunKind=$Kind"
|
||||
[string] $Configurations="CompilationMode=$CompilationMode"
|
||||
)
|
||||
|
||||
$RunFromPerformanceRepo = ($Repository -eq "dotnet/performance") -or ($Repository -eq "dotnet-performance")
|
||||
@@ -49,8 +49,7 @@ if ($Internal) {
|
||||
$HelixSourcePrefix = "official"
|
||||
}
|
||||
|
||||
# FIX ME: This is a workaround until we get this from the actual pipeline
|
||||
$CommonSetupArguments="--channel master --queue $Queue --build-number $BuildNumber --build-configs $Configurations --architecture $Architecture"
|
||||
$CommonSetupArguments="--frameworks $Framework --queue $Queue --build-number $BuildNumber --build-configs $Configurations"
|
||||
$SetupArguments = "--repository https://github.com/$Repository --branch $Branch --get-perf-hash --commit-sha $CommitSha $CommonSetupArguments"
|
||||
|
||||
if ($RunFromPerformanceRepo) {
|
||||
|
||||
@@ -13,9 +13,9 @@ build_number=$BUILD_BUILDNUMBER
|
||||
internal=false
|
||||
compare=false
|
||||
kind="micro"
|
||||
run_categories="Libraries Runtime"
|
||||
run_categories="coreclr corefx"
|
||||
csproj="src\benchmarks\micro\MicroBenchmarks.csproj"
|
||||
configurations="CompliationMode=$compilation_mode RunKind=$kind"
|
||||
configurations=
|
||||
run_from_perf_repo=false
|
||||
use_core_run=true
|
||||
use_baseline_core_run=true
|
||||
@@ -164,7 +164,7 @@ if [[ "$internal" == true ]]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
common_setup_arguments="--channel master --queue $queue --build-number $build_number --build-configs $configurations --architecture $architecture"
|
||||
common_setup_arguments="--frameworks $framework --queue $queue --build-number $build_number --build-configs $configurations"
|
||||
setup_arguments="--repository https://github.com/$repository --branch $branch --get-perf-hash --commit-sha $commit_sha $common_setup_arguments"
|
||||
|
||||
if [[ "$run_from_perf_repo" = true ]]; then
|
||||
|
||||
@@ -85,7 +85,7 @@ function Write-PipelineTaskError {
|
||||
[switch]$AsOutput,
|
||||
[bool]$IsMultiJobVariable=$true)
|
||||
|
||||
if((Test-Path variable:ci) -And $ci) {
|
||||
if(-Not (Test-Path variable:ci) -Or !$ci) {
|
||||
Write-LoggingCommand -Area 'task' -Event 'setvariable' -Data $Value -Properties @{
|
||||
'variable' = $Name
|
||||
'isSecret' = $Secret
|
||||
@@ -101,7 +101,7 @@ function Write-PipelineTaskError {
|
||||
[string]$Path,
|
||||
[switch]$AsOutput)
|
||||
|
||||
if((Test-Path variable:ci) -And $ci) {
|
||||
if(-Not (Test-Path variable:ci) -Or !$ci) {
|
||||
Write-LoggingCommand -Area 'task' -Event 'prependpath' -Data $Path -AsOutput:$AsOutput
|
||||
}
|
||||
}
|
||||
@@ -237,4 +237,4 @@ function Write-LogIssue {
|
||||
}
|
||||
|
||||
Write-Host $command -ForegroundColor $foregroundColor -BackgroundColor $backgroundColor
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -17,7 +17,7 @@ try {
|
||||
ExitWithExitCode 1
|
||||
}
|
||||
|
||||
# Get info about which channel(s) the build has already been promoted to
|
||||
# Get info about which channels the build has already been promoted to
|
||||
$buildInfo = Get-MaestroBuild -BuildId $BuildId
|
||||
|
||||
if (!$buildInfo) {
|
||||
@@ -1,5 +1,4 @@
|
||||
parameters:
|
||||
enable: 'false' # Whether the SDL validation job should execute or not
|
||||
overrideParameters: '' # Optional: to override values for parameters.
|
||||
additionalParameters: '' # Optional: parameters that need user specific values eg: '-SourceToolsList @("abc","def") -ArtifactToolsList @("ghi","jkl")'
|
||||
# There is some sort of bug (has been reported) in Azure DevOps where if this parameter is named
|
||||
@@ -17,15 +16,8 @@ jobs:
|
||||
- job: Run_SDL
|
||||
dependsOn: ${{ parameters.dependsOn }}
|
||||
displayName: Run SDL tool
|
||||
condition: eq( ${{ parameters.enable }}, 'true')
|
||||
variables:
|
||||
- group: DotNet-VSTS-Bot
|
||||
- name: AzDOProjectName
|
||||
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOProjectName'] ]
|
||||
- name: AzDOPipelineId
|
||||
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOPipelineId'] ]
|
||||
- name: AzDOBuildId
|
||||
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOBuildId'] ]
|
||||
pool:
|
||||
name: Hosted VS2017
|
||||
steps:
|
||||
@@ -36,22 +28,14 @@ jobs:
|
||||
- task: DownloadBuildArtifacts@0
|
||||
displayName: Download Build Artifacts
|
||||
inputs:
|
||||
buildType: specific
|
||||
buildVersionToDownload: specific
|
||||
project: $(AzDOProjectName)
|
||||
pipeline: $(AzDOPipelineId)
|
||||
buildId: $(AzDOBuildId)
|
||||
buildType: current
|
||||
artifactName: ${{ artifactName }}
|
||||
downloadPath: $(Build.ArtifactStagingDirectory)\artifacts
|
||||
- ${{ if eq(parameters.artifactNames, '') }}:
|
||||
- task: DownloadBuildArtifacts@0
|
||||
displayName: Download Build Artifacts
|
||||
inputs:
|
||||
buildType: specific
|
||||
buildVersionToDownload: specific
|
||||
project: $(AzDOProjectName)
|
||||
pipeline: $(AzDOPipelineId)
|
||||
buildId: $(AzDOBuildId)
|
||||
buildType: current
|
||||
downloadType: specific files
|
||||
itemPattern: "**"
|
||||
downloadPath: $(Build.ArtifactStagingDirectory)\artifacts
|
||||
|
||||
@@ -23,32 +23,23 @@ stages:
|
||||
- job: publish_symbols
|
||||
displayName: Symbol Publishing
|
||||
dependsOn: setupMaestroVars
|
||||
condition: or(contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', ${{ parameters.channelId }} )), eq(dependencies.setupMaestroVars.outputs['setReleaseVars.PromoteToMaestroChannelId'], ${{ parameters.channelId }}))
|
||||
condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', ${{ parameters.channelId }} ))
|
||||
variables:
|
||||
- group: DotNet-Symbol-Server-Pats
|
||||
- name: AzDOProjectName
|
||||
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOProjectName'] ]
|
||||
- name: AzDOPipelineId
|
||||
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOPipelineId'] ]
|
||||
- name: AzDOBuildId
|
||||
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOBuildId'] ]
|
||||
pool:
|
||||
vmImage: 'windows-2019'
|
||||
steps:
|
||||
- task: DownloadBuildArtifacts@0
|
||||
displayName: Download Build Assets
|
||||
continueOnError: true
|
||||
displayName: Download Blob Artifacts
|
||||
inputs:
|
||||
buildType: specific
|
||||
buildVersionToDownload: specific
|
||||
project: $(AzDOProjectName)
|
||||
pipeline: $(AzDOPipelineId)
|
||||
buildId: $(AzDOBuildId)
|
||||
downloadType: 'specific'
|
||||
itemPattern: |
|
||||
PdbArtifacts/**
|
||||
BlobArtifacts/**
|
||||
downloadPath: '$(Build.ArtifactStagingDirectory)'
|
||||
artifactName: 'BlobArtifacts'
|
||||
continueOnError: true
|
||||
|
||||
- task: DownloadBuildArtifacts@0
|
||||
displayName: Download PDB Artifacts
|
||||
inputs:
|
||||
artifactName: 'PDBArtifacts'
|
||||
continueOnError: true
|
||||
|
||||
# This is necessary whenever we want to publish/restore to an AzDO private feed
|
||||
# Since sdk-task.ps1 tries to restore packages we need to do this authentication here
|
||||
@@ -89,31 +80,28 @@ stages:
|
||||
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.BARBuildId'] ]
|
||||
- name: IsStableBuild
|
||||
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.IsStableBuild'] ]
|
||||
- name: AzDOProjectName
|
||||
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOProjectName'] ]
|
||||
- name: AzDOPipelineId
|
||||
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOPipelineId'] ]
|
||||
- name: AzDOBuildId
|
||||
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOBuildId'] ]
|
||||
condition: or(contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', ${{ parameters.channelId }} )), eq(dependencies.setupMaestroVars.outputs['setReleaseVars.PromoteToMaestroChannelId'], ${{ parameters.channelId }}))
|
||||
condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', ${{ parameters.channelId }}))
|
||||
pool:
|
||||
vmImage: 'windows-2019'
|
||||
steps:
|
||||
- task: DownloadBuildArtifacts@0
|
||||
displayName: Download Build Assets
|
||||
continueOnError: true
|
||||
displayName: Download Package Artifacts
|
||||
inputs:
|
||||
buildType: specific
|
||||
buildVersionToDownload: specific
|
||||
project: $(AzDOProjectName)
|
||||
pipeline: $(AzDOPipelineId)
|
||||
buildId: $(AzDOBuildId)
|
||||
downloadType: 'specific'
|
||||
itemPattern: |
|
||||
PackageArtifacts/**
|
||||
BlobArtifacts/**
|
||||
AssetManifests/**
|
||||
downloadPath: '$(Build.ArtifactStagingDirectory)'
|
||||
buildType: current
|
||||
artifactName: PackageArtifacts
|
||||
continueOnError: true
|
||||
|
||||
- task: DownloadBuildArtifacts@0
|
||||
displayName: Download Blob Artifacts
|
||||
inputs:
|
||||
buildType: current
|
||||
artifactName: BlobArtifacts
|
||||
continueOnError: true
|
||||
- task: DownloadBuildArtifacts@0
|
||||
displayName: Download Asset Manifests
|
||||
inputs:
|
||||
buildType: current
|
||||
artifactName: AssetManifests
|
||||
|
||||
- task: NuGetToolInstaller@1
|
||||
displayName: 'Install NuGet.exe'
|
||||
@@ -166,6 +154,6 @@ stages:
|
||||
StageLabel: '${{ parameters.stageName }}'
|
||||
JobLabel: 'AssetsPublishing'
|
||||
|
||||
- template: ../../steps/add-build-to-channel.yml
|
||||
- template: ../../steps/promote-build.yml
|
||||
parameters:
|
||||
ChannelId: ${{ parameters.channelId }}
|
||||
@@ -23,32 +23,23 @@ stages:
|
||||
- job: publish_symbols
|
||||
displayName: Symbol Publishing
|
||||
dependsOn: setupMaestroVars
|
||||
condition: or(contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', ${{ parameters.channelId }} )), eq(dependencies.setupMaestroVars.outputs['setReleaseVars.PromoteToMaestroChannelId'], ${{ parameters.channelId }}))
|
||||
condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', ${{ parameters.channelId }} ))
|
||||
variables:
|
||||
- group: DotNet-Symbol-Server-Pats
|
||||
- name: AzDOProjectName
|
||||
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOProjectName'] ]
|
||||
- name: AzDOPipelineId
|
||||
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOPipelineId'] ]
|
||||
- name: AzDOBuildId
|
||||
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOBuildId'] ]
|
||||
pool:
|
||||
vmImage: 'windows-2019'
|
||||
steps:
|
||||
- task: DownloadBuildArtifacts@0
|
||||
displayName: Download Build Assets
|
||||
continueOnError: true
|
||||
displayName: Download Blob Artifacts
|
||||
inputs:
|
||||
buildType: specific
|
||||
buildVersionToDownload: specific
|
||||
project: $(AzDOProjectName)
|
||||
pipeline: $(AzDOPipelineId)
|
||||
buildId: $(AzDOBuildId)
|
||||
downloadType: 'specific'
|
||||
itemPattern: |
|
||||
PdbArtifacts/**
|
||||
BlobArtifacts/**
|
||||
downloadPath: '$(Build.ArtifactStagingDirectory)'
|
||||
artifactName: 'BlobArtifacts'
|
||||
continueOnError: true
|
||||
|
||||
- task: DownloadBuildArtifacts@0
|
||||
displayName: Download PDB Artifacts
|
||||
inputs:
|
||||
artifactName: 'PDBArtifacts'
|
||||
continueOnError: true
|
||||
|
||||
# This is necessary whenever we want to publish/restore to an AzDO private feed
|
||||
# Since sdk-task.ps1 tries to restore packages we need to do this authentication here
|
||||
@@ -88,31 +79,29 @@ stages:
|
||||
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.BARBuildId'] ]
|
||||
- name: IsStableBuild
|
||||
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.IsStableBuild'] ]
|
||||
- name: AzDOProjectName
|
||||
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOProjectName'] ]
|
||||
- name: AzDOPipelineId
|
||||
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOPipelineId'] ]
|
||||
- name: AzDOBuildId
|
||||
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOBuildId'] ]
|
||||
condition: or(contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', ${{ parameters.channelId }} )), eq(dependencies.setupMaestroVars.outputs['setReleaseVars.PromoteToMaestroChannelId'], ${{ parameters.channelId }}))
|
||||
condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', ${{ parameters.channelId }}))
|
||||
pool:
|
||||
vmImage: 'windows-2019'
|
||||
steps:
|
||||
- task: DownloadBuildArtifacts@0
|
||||
displayName: Download Build Assets
|
||||
continueOnError: true
|
||||
displayName: Download Package Artifacts
|
||||
inputs:
|
||||
buildType: specific
|
||||
buildVersionToDownload: specific
|
||||
project: $(AzDOProjectName)
|
||||
pipeline: $(AzDOPipelineId)
|
||||
buildId: $(AzDOBuildId)
|
||||
downloadType: 'specific'
|
||||
itemPattern: |
|
||||
PackageArtifacts/**
|
||||
BlobArtifacts/**
|
||||
AssetManifests/**
|
||||
downloadPath: '$(Build.ArtifactStagingDirectory)'
|
||||
buildType: current
|
||||
artifactName: PackageArtifacts
|
||||
continueOnError: true
|
||||
|
||||
- task: DownloadBuildArtifacts@0
|
||||
displayName: Download Blob Artifacts
|
||||
inputs:
|
||||
buildType: current
|
||||
artifactName: BlobArtifacts
|
||||
continueOnError: true
|
||||
|
||||
- task: DownloadBuildArtifacts@0
|
||||
displayName: Download Asset Manifests
|
||||
inputs:
|
||||
buildType: current
|
||||
artifactName: AssetManifests
|
||||
|
||||
- task: NuGetToolInstaller@1
|
||||
displayName: 'Install NuGet.exe'
|
||||
@@ -165,6 +154,6 @@ stages:
|
||||
StageLabel: '${{ parameters.stageName }}'
|
||||
JobLabel: 'AssetsPublishing'
|
||||
|
||||
- template: ../../steps/add-build-to-channel.yml
|
||||
- template: ../../steps/promote-build.yml
|
||||
parameters:
|
||||
ChannelId: ${{ parameters.channelId }}
|
||||
@@ -49,10 +49,6 @@ variables:
|
||||
- name: NetCore_31_Blazor_Features_Channel_Id
|
||||
value: 531
|
||||
|
||||
# .NET Core Experimental
|
||||
- name: NetCore_Experimental_Channel_Id
|
||||
value: 562
|
||||
|
||||
# Whether the build is internal or not
|
||||
- name: IsInternalBuild
|
||||
value: ${{ and(ne(variables['System.TeamProject'], 'public'), contains(variables['Build.SourceBranch'], 'internal')) }}
|
||||
|
||||
@@ -26,136 +26,97 @@ stages:
|
||||
- stage: Validate
|
||||
dependsOn: ${{ parameters.validateDependsOn }}
|
||||
displayName: Validate
|
||||
variables:
|
||||
- template: common-variables.yml
|
||||
jobs:
|
||||
- template: setup-maestro-vars.yml
|
||||
- ${{ if eq(parameters.enableNugetValidation, 'true') }}:
|
||||
- job:
|
||||
displayName: NuGet Validation
|
||||
pool:
|
||||
vmImage: 'windows-2019'
|
||||
steps:
|
||||
- task: DownloadBuildArtifacts@0
|
||||
displayName: Download Package Artifacts
|
||||
inputs:
|
||||
buildType: current
|
||||
artifactName: PackageArtifacts
|
||||
|
||||
- job:
|
||||
displayName: NuGet Validation
|
||||
dependsOn: setupMaestroVars
|
||||
condition: eq( ${{ parameters.enableNugetValidation }}, 'true')
|
||||
pool:
|
||||
vmImage: 'windows-2019'
|
||||
variables:
|
||||
- name: AzDOProjectName
|
||||
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOProjectName'] ]
|
||||
- name: AzDOPipelineId
|
||||
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOPipelineId'] ]
|
||||
- name: AzDOBuildId
|
||||
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOBuildId'] ]
|
||||
steps:
|
||||
- task: DownloadBuildArtifacts@0
|
||||
displayName: Download Package Artifacts
|
||||
inputs:
|
||||
buildType: specific
|
||||
buildVersionToDownload: specific
|
||||
project: $(AzDOProjectName)
|
||||
pipeline: $(AzDOPipelineId)
|
||||
buildId: $(AzDOBuildId)
|
||||
artifactName: PackageArtifacts
|
||||
- task: PowerShell@2
|
||||
displayName: Validate
|
||||
inputs:
|
||||
filePath: $(Build.SourcesDirectory)/eng/common/post-build/nuget-validation.ps1
|
||||
arguments: -PackagesPath $(Build.ArtifactStagingDirectory)/PackageArtifacts/
|
||||
-ToolDestinationPath $(Agent.BuildDirectory)/Extract/
|
||||
|
||||
- task: PowerShell@2
|
||||
displayName: Validate
|
||||
inputs:
|
||||
filePath: $(Build.SourcesDirectory)/eng/common/post-build/nuget-validation.ps1
|
||||
arguments: -PackagesPath $(Build.ArtifactStagingDirectory)/PackageArtifacts/
|
||||
-ToolDestinationPath $(Agent.BuildDirectory)/Extract/
|
||||
- ${{ if eq(parameters.enableSigningValidation, 'true') }}:
|
||||
- job:
|
||||
displayName: Signing Validation
|
||||
variables:
|
||||
- template: common-variables.yml
|
||||
pool:
|
||||
vmImage: 'windows-2019'
|
||||
steps:
|
||||
- task: DownloadBuildArtifacts@0
|
||||
displayName: Download Package Artifacts
|
||||
inputs:
|
||||
buildType: current
|
||||
artifactName: PackageArtifacts
|
||||
|
||||
- job:
|
||||
displayName: Signing Validation
|
||||
dependsOn: setupMaestroVars
|
||||
condition: eq( ${{ parameters.enableSigningValidation }}, 'true')
|
||||
variables:
|
||||
- template: common-variables.yml
|
||||
- name: AzDOProjectName
|
||||
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOProjectName'] ]
|
||||
- name: AzDOPipelineId
|
||||
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOPipelineId'] ]
|
||||
- name: AzDOBuildId
|
||||
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOBuildId'] ]
|
||||
pool:
|
||||
vmImage: 'windows-2019'
|
||||
steps:
|
||||
- task: DownloadBuildArtifacts@0
|
||||
displayName: Download Package Artifacts
|
||||
inputs:
|
||||
buildType: specific
|
||||
buildVersionToDownload: specific
|
||||
project: $(AzDOProjectName)
|
||||
pipeline: $(AzDOPipelineId)
|
||||
buildId: $(AzDOBuildId)
|
||||
artifactName: PackageArtifacts
|
||||
# This is necessary whenever we want to publish/restore to an AzDO private feed
|
||||
# Since sdk-task.ps1 tries to restore packages we need to do this authentication here
|
||||
# otherwise it'll complain about accessing a private feed.
|
||||
- task: NuGetAuthenticate@0
|
||||
displayName: 'Authenticate to AzDO Feeds'
|
||||
|
||||
# This is necessary whenever we want to publish/restore to an AzDO private feed
|
||||
# Since sdk-task.ps1 tries to restore packages we need to do this authentication here
|
||||
# otherwise it'll complain about accessing a private feed.
|
||||
- task: NuGetAuthenticate@0
|
||||
displayName: 'Authenticate to AzDO Feeds'
|
||||
- task: PowerShell@2
|
||||
displayName: Enable cross-org publishing
|
||||
inputs:
|
||||
filePath: eng\common\enable-cross-org-publishing.ps1
|
||||
arguments: -token $(dn-bot-dnceng-artifact-feeds-rw)
|
||||
|
||||
- task: PowerShell@2
|
||||
displayName: Enable cross-org publishing
|
||||
inputs:
|
||||
filePath: eng\common\enable-cross-org-publishing.ps1
|
||||
arguments: -token $(dn-bot-dnceng-artifact-feeds-rw)
|
||||
- task: PowerShell@2
|
||||
displayName: Validate
|
||||
inputs:
|
||||
filePath: eng\common\sdk-task.ps1
|
||||
arguments: -task SigningValidation -restore -msbuildEngine dotnet
|
||||
/p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts'
|
||||
/p:SignCheckExclusionsFile='$(Build.SourcesDirectory)/eng/SignCheckExclusionsFile.txt'
|
||||
${{ parameters.signingValidationAdditionalParameters }}
|
||||
|
||||
- task: PowerShell@2
|
||||
displayName: Validate
|
||||
inputs:
|
||||
filePath: eng\common\sdk-task.ps1
|
||||
arguments: -task SigningValidation -restore -msbuildEngine dotnet
|
||||
/p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts'
|
||||
/p:SignCheckExclusionsFile='$(Build.SourcesDirectory)/eng/SignCheckExclusionsFile.txt'
|
||||
${{ parameters.signingValidationAdditionalParameters }}
|
||||
- template: ../steps/publish-logs.yml
|
||||
parameters:
|
||||
StageLabel: 'Validation'
|
||||
JobLabel: 'Signing'
|
||||
|
||||
- template: ../steps/publish-logs.yml
|
||||
parameters:
|
||||
StageLabel: 'Validation'
|
||||
JobLabel: 'Signing'
|
||||
- ${{ if eq(parameters.enableSourceLinkValidation, 'true') }}:
|
||||
- job:
|
||||
displayName: SourceLink Validation
|
||||
variables:
|
||||
- template: common-variables.yml
|
||||
pool:
|
||||
vmImage: 'windows-2019'
|
||||
steps:
|
||||
- task: DownloadBuildArtifacts@0
|
||||
displayName: Download Blob Artifacts
|
||||
inputs:
|
||||
buildType: current
|
||||
artifactName: BlobArtifacts
|
||||
|
||||
- job:
|
||||
displayName: SourceLink Validation
|
||||
dependsOn: setupMaestroVars
|
||||
condition: eq( ${{ parameters.enableSourceLinkValidation }}, 'true')
|
||||
variables:
|
||||
- template: common-variables.yml
|
||||
- name: AzDOProjectName
|
||||
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOProjectName'] ]
|
||||
- name: AzDOPipelineId
|
||||
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOPipelineId'] ]
|
||||
- name: AzDOBuildId
|
||||
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOBuildId'] ]
|
||||
pool:
|
||||
vmImage: 'windows-2019'
|
||||
steps:
|
||||
- task: DownloadBuildArtifacts@0
|
||||
displayName: Download Blob Artifacts
|
||||
inputs:
|
||||
buildType: specific
|
||||
buildVersionToDownload: specific
|
||||
project: $(AzDOProjectName)
|
||||
pipeline: $(AzDOPipelineId)
|
||||
buildId: $(AzDOBuildId)
|
||||
artifactName: BlobArtifacts
|
||||
- task: PowerShell@2
|
||||
displayName: Validate
|
||||
inputs:
|
||||
filePath: $(Build.SourcesDirectory)/eng/common/post-build/sourcelink-validation.ps1
|
||||
arguments: -InputPath $(Build.ArtifactStagingDirectory)/BlobArtifacts/
|
||||
-ExtractPath $(Agent.BuildDirectory)/Extract/
|
||||
-GHRepoName $(Build.Repository.Name)
|
||||
-GHCommit $(Build.SourceVersion)
|
||||
-SourcelinkCliVersion $(SourceLinkCLIVersion)
|
||||
continueOnError: true
|
||||
|
||||
- task: PowerShell@2
|
||||
displayName: Validate
|
||||
inputs:
|
||||
filePath: $(Build.SourcesDirectory)/eng/common/post-build/sourcelink-validation.ps1
|
||||
arguments: -InputPath $(Build.ArtifactStagingDirectory)/BlobArtifacts/
|
||||
-ExtractPath $(Agent.BuildDirectory)/Extract/
|
||||
-GHRepoName $(Build.Repository.Name)
|
||||
-GHCommit $(Build.SourceVersion)
|
||||
-SourcelinkCliVersion $(SourceLinkCLIVersion)
|
||||
continueOnError: true
|
||||
|
||||
- template: /eng/common/templates/job/execute-sdl.yml
|
||||
parameters:
|
||||
enable: ${{ parameters.SDLValidationParameters.enable }}
|
||||
dependsOn: setupMaestroVars
|
||||
additionalParameters: ${{ parameters.SDLValidationParameters.params }}
|
||||
continueOnError: ${{ parameters.SDLValidationParameters.continueOnError }}
|
||||
artifactNames: ${{ parameters.SDLValidationParameters.artifactNames }}
|
||||
- ${{ if eq(parameters.SDLValidationParameters.enable, 'true') }}:
|
||||
- template: /eng/common/templates/job/execute-sdl.yml
|
||||
parameters:
|
||||
additionalParameters: ${{ parameters.SDLValidationParameters.params }}
|
||||
continueOnError: ${{ parameters.SDLValidationParameters.continueOnError }}
|
||||
artifactNames: ${{ parameters.SDLValidationParameters.artifactNames }}
|
||||
|
||||
- template: \eng\common\templates\post-build\channels\generic-public-channel.yml
|
||||
parameters:
|
||||
@@ -246,43 +207,4 @@ stages:
|
||||
channelId: 551
|
||||
transportFeed: 'https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet-tools-internal/nuget/v3/index.json'
|
||||
shippingFeed: 'https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet-tools-internal/nuget/v3/index.json'
|
||||
symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet-tools-internal-symbols/nuget/v3/index.json'
|
||||
|
||||
- template: \eng\common\templates\post-build\channels\generic-public-channel.yml
|
||||
parameters:
|
||||
artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }}
|
||||
dependsOn: ${{ parameters.publishDependsOn }}
|
||||
publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }}
|
||||
symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }}
|
||||
stageName: 'NETCore_Experimental_Publishing'
|
||||
channelName: '.NET Core Experimental'
|
||||
channelId: 562
|
||||
transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-experimental/nuget/v3/index.json'
|
||||
shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-experimental/nuget/v3/index.json'
|
||||
symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-experimental-symbols/nuget/v3/index.json'
|
||||
|
||||
- template: \eng\common\templates\post-build\channels\generic-public-channel.yml
|
||||
parameters:
|
||||
artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }}
|
||||
dependsOn: ${{ parameters.publishDependsOn }}
|
||||
publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }}
|
||||
symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }}
|
||||
stageName: 'Net_Eng_Services_Int_Publish'
|
||||
channelName: '.NET Eng Services - Int'
|
||||
channelId: 678
|
||||
transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json'
|
||||
shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json'
|
||||
symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng-symbols/nuget/v3/index.json'
|
||||
|
||||
- template: \eng\common\templates\post-build\channels\generic-public-channel.yml
|
||||
parameters:
|
||||
artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }}
|
||||
dependsOn: ${{ parameters.publishDependsOn }}
|
||||
publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }}
|
||||
symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }}
|
||||
stageName: 'Net_Eng_Services_Prod_Publish'
|
||||
channelName: '.NET Eng Services - Prod'
|
||||
channelId: 679
|
||||
transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json'
|
||||
shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json'
|
||||
symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng-symbols/nuget/v3/index.json'
|
||||
symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet-tools-internal-symbols/nuget/v3/index.json'
|
||||
@@ -0,0 +1,25 @@
|
||||
parameters:
|
||||
ChannelId: 0
|
||||
|
||||
jobs:
|
||||
- job:
|
||||
displayName: Promote Build
|
||||
dependsOn: setupMaestroVars
|
||||
condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', ${{ parameters.ChannelId }}))
|
||||
variables:
|
||||
- name: BARBuildId
|
||||
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.BARBuildId'] ]
|
||||
- name: ChannelId
|
||||
value: ${{ parameters.ChannelId }}
|
||||
pool:
|
||||
vmImage: 'windows-2019'
|
||||
steps:
|
||||
- task: PowerShell@2
|
||||
displayName: Add Build to Channel
|
||||
inputs:
|
||||
filePath: $(Build.SourcesDirectory)/eng/common/post-build/promote-build.ps1
|
||||
arguments: -BuildId $(BARBuildId)
|
||||
-ChannelId $(ChannelId)
|
||||
-MaestroApiAccessToken $(MaestroApiAccessToken)
|
||||
-MaestroApiEndPoint $(MaestroApiEndPoint)
|
||||
-MaestroApiVersion $(MaestroApiVersion)
|
||||
@@ -1,12 +1,6 @@
|
||||
jobs:
|
||||
- job: setupMaestroVars
|
||||
displayName: Setup Maestro Vars
|
||||
variables:
|
||||
- template: common-variables.yml
|
||||
- name: BuildId
|
||||
value: $[ coalesce(variables.BARBuildId, 0) ]
|
||||
- name: PromoteToChannelId
|
||||
value: $[ coalesce(variables.PromoteToMaestroChannelId, 0) ]
|
||||
pool:
|
||||
vmImage: 'windows-2019'
|
||||
steps:
|
||||
@@ -14,7 +8,6 @@ jobs:
|
||||
|
||||
- task: DownloadBuildArtifacts@0
|
||||
displayName: Download Release Configs
|
||||
condition: eq(variables.PromoteToChannelId, 0)
|
||||
inputs:
|
||||
buildType: current
|
||||
artifactName: ReleaseConfigs
|
||||
@@ -26,50 +19,18 @@ jobs:
|
||||
targetType: inline
|
||||
script: |
|
||||
try {
|
||||
if ($Env:PromoteToChannelId -eq 0) {
|
||||
$Content = Get-Content $(Build.StagingDirectory)/ReleaseConfigs/ReleaseConfigs.txt
|
||||
$Content = Get-Content $(Build.StagingDirectory)/ReleaseConfigs/ReleaseConfigs.txt
|
||||
|
||||
$BarId = $Content | Select -Index 0
|
||||
$BarId = $Content | Select -Index 0
|
||||
|
||||
$Channels = ""
|
||||
$Content | Select -Index 1 | ForEach-Object { $Channels += "$_ ," }
|
||||
|
||||
$IsStableBuild = $Content | Select -Index 2
|
||||
$Channels = ""
|
||||
$Content | Select -Index 1 | ForEach-Object { $Channels += "$_ ," }
|
||||
|
||||
$AzureDevOpsProject = $Env:System_TeamProject
|
||||
$AzureDevOpsBuildDefinitionId = $Env:System_DefinitionId
|
||||
$AzureDevOpsBuildId = $Env:Build_BuildId
|
||||
$PromoteToMaestroChannelId = 0
|
||||
}
|
||||
else {
|
||||
$buildApiEndpoint = "${Env:MaestroApiEndPoint}/api/builds/${Env:BARBuildId}?api-version=${Env:MaestroApiVersion}"
|
||||
|
||||
$apiHeaders = New-Object 'System.Collections.Generic.Dictionary[[String],[String]]'
|
||||
$apiHeaders.Add('Accept', 'application/json')
|
||||
$apiHeaders.Add('Authorization',"Bearer ${Env:MAESTRO_API_TOKEN}")
|
||||
|
||||
$buildInfo = try { Invoke-WebRequest -Method Get -Uri $buildApiEndpoint -Headers $apiHeaders | ConvertFrom-Json } catch { Write-Host "Error: $_" }
|
||||
|
||||
$BarId = $Env:BARBuildId
|
||||
$Channels = 'None'
|
||||
|
||||
#TODO: Fix this once this issue is done: https://github.com/dotnet/arcade/issues/3834
|
||||
$IsStableBuild = 'False'
|
||||
|
||||
$AzureDevOpsProject = $buildInfo.azureDevOpsProject
|
||||
$AzureDevOpsBuildDefinitionId = $buildInfo.azureDevOpsBuildDefinitionId
|
||||
$AzureDevOpsBuildId = $buildInfo.azureDevOpsBuildId
|
||||
$PromoteToMaestroChannelId = $Env:PromoteToMaestroChannelId
|
||||
}
|
||||
$IsStableBuild = $Content | Select -Index 2
|
||||
|
||||
Write-Host "##vso[task.setvariable variable=BARBuildId;isOutput=true]$BarId"
|
||||
Write-Host "##vso[task.setvariable variable=InitialChannels;isOutput=true]$Channels"
|
||||
Write-Host "##vso[task.setvariable variable=IsStableBuild;isOutput=true]$IsStableBuild"
|
||||
|
||||
Write-Host "##vso[task.setvariable variable=AzDOProjectName;isOutput=true]$AzureDevOpsProject"
|
||||
Write-Host "##vso[task.setvariable variable=AzDOPipelineId;isOutput=true]$AzureDevOpsBuildDefinitionId"
|
||||
Write-Host "##vso[task.setvariable variable=AzDOBuildId;isOutput=true]$AzureDevOpsBuildId"
|
||||
Write-Host "##vso[task.setvariable variable=PromoteToMaestroChannelId;isOutput=true]$PromoteToMaestroChannelId"
|
||||
}
|
||||
catch {
|
||||
Write-Host $_
|
||||
@@ -77,5 +38,3 @@ jobs:
|
||||
Write-Host $_.ScriptStackTrace
|
||||
exit 1
|
||||
}
|
||||
env:
|
||||
MAESTRO_API_TOKEN: $(MaestroApiAccessToken)
|
||||
+2
-2
@@ -5,9 +5,9 @@ steps:
|
||||
- task: PowerShell@2
|
||||
displayName: Add Build to Channel
|
||||
inputs:
|
||||
filePath: $(Build.SourcesDirectory)/eng/common/post-build/add-build-to-channel.ps1
|
||||
filePath: $(Build.SourcesDirectory)/eng/common/post-build/promote-build.ps1
|
||||
arguments: -BuildId $(BARBuildId)
|
||||
-ChannelId ${{ parameters.ChannelId }}
|
||||
-MaestroApiAccessToken $(MaestroApiAccessToken)
|
||||
-MaestroApiEndPoint $(MaestroApiEndPoint)
|
||||
-MaestroApiVersion $(MaestroApiVersion)
|
||||
-MaestroApiVersion $(MaestroApiVersion)
|
||||
@@ -18,6 +18,6 @@ steps:
|
||||
inputs:
|
||||
PathtoPublish: '$(Build.SourcesDirectory)/PostBuildLogs'
|
||||
PublishLocation: Container
|
||||
ArtifactName: PostBuildLogs
|
||||
ArtifactName: PostBuilLogs
|
||||
continueOnError: true
|
||||
condition: always()
|
||||
+10
-63
@@ -98,10 +98,7 @@ function Exec-Process([string]$command, [string]$commandArgs) {
|
||||
}
|
||||
}
|
||||
|
||||
# createSdkLocationFile parameter enables a file being generated under the toolset directory
|
||||
# which writes the sdk's location into. This is only necessary for cmd --> powershell invocations
|
||||
# as dot sourcing isn't possible.
|
||||
function InitializeDotNetCli([bool]$install, [bool]$createSdkLocationFile) {
|
||||
function InitializeDotNetCli([bool]$install) {
|
||||
if (Test-Path variable:global:_DotNetInstallDir) {
|
||||
return $global:_DotNetInstallDir
|
||||
}
|
||||
@@ -151,24 +148,6 @@ function InitializeDotNetCli([bool]$install, [bool]$createSdkLocationFile) {
|
||||
$env:DOTNET_INSTALL_DIR = $dotnetRoot
|
||||
}
|
||||
|
||||
# Creates a temporary file under the toolset dir.
|
||||
# The following code block is protecting against concurrent access so that this function can
|
||||
# be called in parallel.
|
||||
if ($createSdkLocationFile) {
|
||||
do {
|
||||
$sdkCacheFileTemp = Join-Path $ToolsetDir $([System.IO.Path]::GetRandomFileName())
|
||||
}
|
||||
until (!(Test-Path $sdkCacheFileTemp))
|
||||
Set-Content -Path $sdkCacheFileTemp -Value $dotnetRoot
|
||||
|
||||
try {
|
||||
Rename-Item -Force -Path $sdkCacheFileTemp 'sdk.txt'
|
||||
} catch {
|
||||
# Somebody beat us
|
||||
Remove-Item -Path $sdkCacheFileTemp
|
||||
}
|
||||
}
|
||||
|
||||
# Add dotnet to PATH. This prevents any bare invocation of dotnet in custom
|
||||
# build steps from using anything other than what we've downloaded.
|
||||
# It also ensures that VS msbuild will use the downloaded sdk targets.
|
||||
@@ -188,33 +167,7 @@ function GetDotNetInstallScript([string] $dotnetRoot) {
|
||||
if (!(Test-Path $installScript)) {
|
||||
Create-Directory $dotnetRoot
|
||||
$ProgressPreference = 'SilentlyContinue' # Don't display the console progress UI - it's a huge perf hit
|
||||
|
||||
$maxRetries = 5
|
||||
$retries = 1
|
||||
|
||||
$uri = "https://dot.net/$dotnetInstallScriptVersion/dotnet-install.ps1"
|
||||
|
||||
while($true) {
|
||||
try {
|
||||
Write-Host "GET $uri"
|
||||
Invoke-WebRequest $uri -OutFile $installScript
|
||||
break
|
||||
}
|
||||
catch {
|
||||
Write-Host "Failed to download '$uri'"
|
||||
Write-Error $_.Exception.Message -ErrorAction Continue
|
||||
}
|
||||
|
||||
if (++$retries -le $maxRetries) {
|
||||
$delayInSeconds = [math]::Pow(2, $retries) - 1 # Exponential backoff
|
||||
Write-Host "Retrying. Waiting for $delayInSeconds seconds before next attempt ($retries of $maxRetries)."
|
||||
Start-Sleep -Seconds $delayInSeconds
|
||||
}
|
||||
else {
|
||||
throw "Unable to download file in $maxRetries attempts."
|
||||
}
|
||||
|
||||
}
|
||||
Invoke-WebRequest "https://dot.net/$dotnetInstallScriptVersion/dotnet-install.ps1" -OutFile $installScript
|
||||
}
|
||||
|
||||
return $installScript
|
||||
@@ -224,12 +177,12 @@ function InstallDotNetSdk([string] $dotnetRoot, [string] $version, [string] $arc
|
||||
InstallDotNet $dotnetRoot $version $architecture
|
||||
}
|
||||
|
||||
function InstallDotNet([string] $dotnetRoot,
|
||||
[string] $version,
|
||||
[string] $architecture = '',
|
||||
[string] $runtime = '',
|
||||
[bool] $skipNonVersionedFiles = $false,
|
||||
[string] $runtimeSourceFeed = '',
|
||||
function InstallDotNet([string] $dotnetRoot,
|
||||
[string] $version,
|
||||
[string] $architecture = '',
|
||||
[string] $runtime = '',
|
||||
[bool] $skipNonVersionedFiles = $false,
|
||||
[string] $runtimeSourceFeed = '',
|
||||
[string] $runtimeSourceFeedKey = '') {
|
||||
|
||||
$installScript = GetDotNetInstallScript $dotnetRoot
|
||||
@@ -263,10 +216,7 @@ function InstallDotNet([string] $dotnetRoot,
|
||||
}
|
||||
catch {
|
||||
Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "Failed to install dotnet runtime '$runtime' from custom location '$runtimeSourceFeed'."
|
||||
ExitWithExitCode 1
|
||||
}
|
||||
} else {
|
||||
ExitWithExitCode 1
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -297,7 +247,7 @@ function InitializeVisualStudioMSBuild([bool]$install, [object]$vsRequirements =
|
||||
if ($msbuildCmd -ne $null) {
|
||||
# Workaround for https://github.com/dotnet/roslyn/issues/35793
|
||||
# Due to this issue $msbuildCmd.Version returns 0.0.0.0 for msbuild.exe 16.2+
|
||||
$msbuildVersion = [Version]::new((Get-Item $msbuildCmd.Path).VersionInfo.ProductVersion.Split([char[]]@('-', '+'))[0])
|
||||
$msbuildVersion = [Version]::new((Get-Item $msbuildCmd.Path).VersionInfo.ProductVersion.Split(@('-', '+'))[0])
|
||||
|
||||
if ($msbuildVersion -ge $vsMinVersion) {
|
||||
return $global:_MSBuildExe = $msbuildCmd.Path
|
||||
@@ -325,10 +275,7 @@ function InitializeVisualStudioMSBuild([bool]$install, [object]$vsRequirements =
|
||||
$xcopyMSBuildVersion = "$vsMajorVersion.$($vsMinVersion.Minor).0-alpha"
|
||||
}
|
||||
|
||||
$vsInstallDir = $null
|
||||
if ($xcopyMSBuildVersion.Trim() -ine "none") {
|
||||
$vsInstallDir = InitializeXCopyMSBuild $xcopyMSBuildVersion $install
|
||||
}
|
||||
$vsInstallDir = InitializeXCopyMSBuild $xcopyMSBuildVersion $install
|
||||
if ($vsInstallDir -eq $null) {
|
||||
throw 'Unable to find Visual Studio that has required version and components installed'
|
||||
}
|
||||
|
||||
+8
-32
@@ -41,7 +41,7 @@ fi
|
||||
# Configures warning treatment in msbuild.
|
||||
warn_as_error=${warn_as_error:-true}
|
||||
|
||||
# True to attempt using .NET Core already that meets requirements specified in global.json
|
||||
# True to attempt using .NET Core already that meets requirements specified in global.json
|
||||
# installed on the machine instead of downloading one.
|
||||
use_installed_dotnet_cli=${use_installed_dotnet_cli:-true}
|
||||
|
||||
@@ -172,7 +172,7 @@ function InstallDotNetSdk {
|
||||
function InstallDotNet {
|
||||
local root=$1
|
||||
local version=$2
|
||||
|
||||
|
||||
GetDotNetInstallScript "$root"
|
||||
local install_script=$_GetDotNetInstallScript
|
||||
|
||||
@@ -211,35 +211,11 @@ function InstallDotNet {
|
||||
Write-PipelineTelemetryError -category 'InitializeToolset' "Failed to install dotnet SDK from custom location '$runtimeSourceFeed' (exit code '$exit_code')."
|
||||
ExitWithExitCode $exit_code
|
||||
}
|
||||
else
|
||||
ExitWithExitCode $exit_code
|
||||
fi
|
||||
fi
|
||||
}
|
||||
}
|
||||
|
||||
function with_retries {
|
||||
local maxRetries=5
|
||||
local retries=1
|
||||
echo "Trying to run '$@' for maximum of $maxRetries attempts."
|
||||
while [[ $((retries++)) -le $maxRetries ]]; do
|
||||
"$@"
|
||||
|
||||
if [[ $? == 0 ]]; then
|
||||
echo "Ran '$@' successfully."
|
||||
return 0
|
||||
fi
|
||||
|
||||
timeout=$((2**$retries-1))
|
||||
echo "Failed to execute '$@'. Waiting $timeout seconds before next attempt ($retries out of $maxRetries)." 1>&2
|
||||
sleep $timeout
|
||||
done
|
||||
|
||||
echo "Failed to execute '$@' for $maxRetries times." 1>&2
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
function GetDotNetInstallScript {
|
||||
local root=$1
|
||||
local install_script="$root/dotnet-install.sh"
|
||||
@@ -252,13 +228,13 @@ function GetDotNetInstallScript {
|
||||
|
||||
# Use curl if available, otherwise use wget
|
||||
if command -v curl > /dev/null; then
|
||||
with_retries curl "$install_script_url" -isSLv --retry 10 --create-dirs -o "$install_script" || {
|
||||
curl "$install_script_url" -sSL --retry 10 --create-dirs -o "$install_script" || {
|
||||
local exit_code=$?
|
||||
Write-PipelineTelemetryError -category 'InitializeToolset' "Failed to acquire dotnet install script (exit code '$exit_code')."
|
||||
ExitWithExitCode $exit_code
|
||||
}
|
||||
else
|
||||
with_retries wget -v -O "$install_script" "$install_script_url" || {
|
||||
else
|
||||
wget -q -O "$install_script" "$install_script_url" || {
|
||||
local exit_code=$?
|
||||
Write-PipelineTelemetryError -category 'InitializeToolset' "Failed to acquire dotnet install script (exit code '$exit_code')."
|
||||
ExitWithExitCode $exit_code
|
||||
@@ -273,11 +249,11 @@ function InitializeBuildTool {
|
||||
if [[ -n "${_InitializeBuildTool:-}" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
|
||||
InitializeDotNetCli $restore
|
||||
|
||||
# return values
|
||||
_InitializeBuildTool="$_InitializeDotNetCli/dotnet"
|
||||
_InitializeBuildTool="$_InitializeDotNetCli/dotnet"
|
||||
_InitializeBuildToolCommand="msbuild"
|
||||
_InitializeBuildToolFramework="netcoreapp2.1"
|
||||
}
|
||||
@@ -341,7 +317,7 @@ function InitializeToolset {
|
||||
if [[ "$binary_log" == true ]]; then
|
||||
bl="/bl:$log_dir/ToolsetRestore.binlog"
|
||||
fi
|
||||
|
||||
|
||||
echo '<Project Sdk="Microsoft.DotNet.Arcade.Sdk"/>' > "$proj"
|
||||
MSBuild-Core "$proj" $bl /t:__WriteToolsetLocation /clp:ErrorsOnly\;NoSummary /p:__ToolsetLocationOutputFile="$toolset_location_file"
|
||||
|
||||
|
||||
Vendored
+1
-1
Submodule external/api-snapshot updated: 5b8247e289...8ea1d663da.
Vendored
+1
-1
Submodule external/binary-reference-assemblies updated: e68046d510...20704e7005.
Vendored
+1
-1
Submodule external/bockbuild updated: 23374e3b63...f44d61c9bc.
Vendored
+1
-1
Submodule external/cecil updated: 8021f3fbe7...a6a7f5c0f4.
Vendored
+1
-1
Submodule external/corefx updated: 7c9e215892...033b184219.
Vendored
+1
-1
Submodule external/linker updated: 6e0105e0fc...4279148ff2.
Vendored
+1
-1
Submodule external/roslyn-binaries updated: 27c352d6ed...8867d9ad53.
+3
-3
@@ -1,9 +1,9 @@
|
||||
{
|
||||
"tools": {
|
||||
"dotnet": "5.0.100-alpha1-015772"
|
||||
"dotnet": "5.0.100-alpha1-014854"
|
||||
},
|
||||
"msbuild-sdks": {
|
||||
"Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20109.1",
|
||||
"Microsoft.DotNet.Helix.Sdk": "5.0.0-beta.20109.1"
|
||||
"Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19574.1",
|
||||
"Microsoft.DotNet.Helix.Sdk": "5.0.0-beta.19574.1"
|
||||
}
|
||||
}
|
||||
+97
-97
@@ -1,98 +1,98 @@
|
||||
:: Set up build environment and build LLVM using MSVC and msbuild targets in mono.sln.
|
||||
|
||||
:: Arguments:
|
||||
:: -------------------------------------------------------
|
||||
:: %1 Visual Studio target, build|clean, default build
|
||||
:: %2 Host CPU architecture, x86_64|i686, default x86_64
|
||||
:: %3 Visual Studio configuration, debug|release, default release
|
||||
:: %4 Mono MSVC source folder.
|
||||
:: %5 LLVM build directory.
|
||||
:: %6 LLVM install directory.
|
||||
:: %7 Additional arguments passed to msbuild, needs to be quoted if multiple.
|
||||
:: -------------------------------------------------------
|
||||
|
||||
@echo off
|
||||
setlocal
|
||||
|
||||
set BUILD_RESULT=1
|
||||
|
||||
:: Get path for current running script.
|
||||
set RUN_BUILD_LLVM_MSBUILD_SCRIPT_PATH=%~dp0
|
||||
|
||||
:: Configure all known build arguments.
|
||||
set VS_BUILD_ARGS=
|
||||
set VS_TARGET=build
|
||||
if /i "%~1" == "clean" (
|
||||
set VS_TARGET="clean"
|
||||
)
|
||||
shift
|
||||
|
||||
set VS_PLATFORM=x64
|
||||
if /i "%~1" == "i686" (
|
||||
set VS_PLATFORM="Win32"
|
||||
)
|
||||
if /i "%~1" == "win32" (
|
||||
set VS_PLATFORM="Win32"
|
||||
)
|
||||
shift
|
||||
|
||||
set VS_CONFIGURATION=Release
|
||||
if /i "%~1" == "debug" (
|
||||
set VS_CONFIGURATION="Debug"
|
||||
)
|
||||
shift
|
||||
|
||||
set MONO_MSVC_SOURCE_DIR=%RUN_BUILD_LLVM_MSBUILD_SCRIPT_PATH%..\msvc\
|
||||
if not "%~1" == "" (
|
||||
set MONO_MSVC_SOURCE_DIR=%~1
|
||||
)
|
||||
shift
|
||||
|
||||
set MONO_LLVM_BUILD_DIR=
|
||||
if not "%~1" == "" (
|
||||
set MONO_LLVM_BUILD_DIR=%~1
|
||||
)
|
||||
shift
|
||||
|
||||
set MONO_LLVM_INSTALL_DIR=
|
||||
if not "%~1" == "" (
|
||||
set MONO_LLVM_INSTALL_DIR=%~1
|
||||
)
|
||||
shift
|
||||
|
||||
set VS_ADDITIONAL_ARGUMENTS=
|
||||
if not "%~1" == "" (
|
||||
set VS_ADDITIONAL_ARGUMENTS=%~1
|
||||
)
|
||||
|
||||
:: Setup Windows environment.
|
||||
call %MONO_MSVC_SOURCE_DIR%setup-windows-env.bat
|
||||
|
||||
:: Setup VS msbuild environment.
|
||||
call %MONO_MSVC_SOURCE_DIR%setup-vs-msbuild-env.bat
|
||||
|
||||
if "%VS_ADDITIONAL_ARGUMENTS%" == "" (
|
||||
set "VS_ADDITIONAL_ARGUMENTS=/p:PlatformToolset=%VS_DEFAULT_PLATFORM_TOOL_SET% /p:MONO_TARGET_GC=sgen"
|
||||
)
|
||||
|
||||
if not "%MONO_LLVM_BUILD_DIR%" == "" (
|
||||
set VS_BUILD_ARGS=/p:_LLVMBuildDir="%MONO_LLVM_BUILD_DIR%"
|
||||
)
|
||||
|
||||
if not "%MONO_LLVM_INSTALL_DIR%" == "" (
|
||||
set VS_BUILD_ARGS=%VS_BUILD_ARGS% /p:_LLVMInstallDir="%MONO_LLVM_INSTALL_DIR%"
|
||||
)
|
||||
|
||||
set VS_BUILD_ARGS=%VS_BUILD_ARGS% /p:MONO_ENABLE_LLVM=true /p:Configuration=%VS_CONFIGURATION% /p:Platform=%VS_PLATFORM% %VS_ADDITIONAL_ARGUMENTS% /t:%VS_TARGET% /m
|
||||
call msbuild.exe %VS_BUILD_ARGS% "%MONO_MSVC_SOURCE_DIR%build-external-llvm.vcxproj" && (
|
||||
set BUILD_RESULT=0
|
||||
) || (
|
||||
set BUILD_RESULT=1
|
||||
if not %ERRORLEVEL% == 0 (
|
||||
set BUILD_RESULT=%ERRORLEVEL%
|
||||
)
|
||||
)
|
||||
|
||||
exit /b %BUILD_RESULT%
|
||||
|
||||
:: Set up build environment and build LLVM using MSVC and msbuild targets in mono.sln.
|
||||
|
||||
:: Arguments:
|
||||
:: -------------------------------------------------------
|
||||
:: %1 Visual Studio target, build|clean, default build
|
||||
:: %2 Host CPU architecture, x86_64|i686, default x86_64
|
||||
:: %3 Visual Studio configuration, debug|release, default release
|
||||
:: %4 Mono MSVC source folder.
|
||||
:: %5 LLVM build directory.
|
||||
:: %6 LLVM install directory.
|
||||
:: %7 Additional arguments passed to msbuild, needs to be quoted if multiple.
|
||||
:: -------------------------------------------------------
|
||||
|
||||
@echo off
|
||||
setlocal
|
||||
|
||||
set BUILD_RESULT=1
|
||||
|
||||
:: Get path for current running script.
|
||||
set RUN_BUILD_LLVM_MSBUILD_SCRIPT_PATH=%~dp0
|
||||
|
||||
:: Configure all known build arguments.
|
||||
set VS_BUILD_ARGS=
|
||||
set VS_TARGET=build
|
||||
if /i "%~1" == "clean" (
|
||||
set VS_TARGET="clean"
|
||||
)
|
||||
shift
|
||||
|
||||
set VS_PLATFORM=x64
|
||||
if /i "%~1" == "i686" (
|
||||
set VS_PLATFORM="Win32"
|
||||
)
|
||||
if /i "%~1" == "win32" (
|
||||
set VS_PLATFORM="Win32"
|
||||
)
|
||||
shift
|
||||
|
||||
set VS_CONFIGURATION=Release
|
||||
if /i "%~1" == "debug" (
|
||||
set VS_CONFIGURATION="Debug"
|
||||
)
|
||||
shift
|
||||
|
||||
set MONO_MSVC_SOURCE_DIR=%RUN_BUILD_LLVM_MSBUILD_SCRIPT_PATH%..\msvc\
|
||||
if not "%~1" == "" (
|
||||
set MONO_MSVC_SOURCE_DIR=%~1
|
||||
)
|
||||
shift
|
||||
|
||||
set MONO_LLVM_BUILD_DIR=
|
||||
if not "%~1" == "" (
|
||||
set MONO_LLVM_BUILD_DIR=%~1
|
||||
)
|
||||
shift
|
||||
|
||||
set MONO_LLVM_INSTALL_DIR=
|
||||
if not "%~1" == "" (
|
||||
set MONO_LLVM_INSTALL_DIR=%~1
|
||||
)
|
||||
shift
|
||||
|
||||
set VS_ADDITIONAL_ARGUMENTS=
|
||||
if not "%~1" == "" (
|
||||
set VS_ADDITIONAL_ARGUMENTS=%~1
|
||||
)
|
||||
|
||||
:: Setup Windows environment.
|
||||
call %MONO_MSVC_SOURCE_DIR%setup-windows-env.bat
|
||||
|
||||
:: Setup VS msbuild environment.
|
||||
call %MONO_MSVC_SOURCE_DIR%setup-vs-msbuild-env.bat
|
||||
|
||||
if "%VS_ADDITIONAL_ARGUMENTS%" == "" (
|
||||
set "VS_ADDITIONAL_ARGUMENTS=/p:PlatformToolset=%VS_DEFAULT_PLATFORM_TOOL_SET% /p:MONO_TARGET_GC=sgen"
|
||||
)
|
||||
|
||||
if not "%MONO_LLVM_BUILD_DIR%" == "" (
|
||||
set VS_BUILD_ARGS=/p:_LLVMBuildDir="%MONO_LLVM_BUILD_DIR%"
|
||||
)
|
||||
|
||||
if not "%MONO_LLVM_INSTALL_DIR%" == "" (
|
||||
set VS_BUILD_ARGS=%VS_BUILD_ARGS% /p:_LLVMInstallDir="%MONO_LLVM_INSTALL_DIR%"
|
||||
)
|
||||
|
||||
set VS_BUILD_ARGS=%VS_BUILD_ARGS% /p:MONO_ENABLE_LLVM=true /p:Configuration=%VS_CONFIGURATION% /p:Platform=%VS_PLATFORM% %VS_ADDITIONAL_ARGUMENTS% /t:%VS_TARGET% /m
|
||||
call msbuild.exe %VS_BUILD_ARGS% "%MONO_MSVC_SOURCE_DIR%build-external-llvm.vcxproj" && (
|
||||
set BUILD_RESULT=0
|
||||
) || (
|
||||
set BUILD_RESULT=1
|
||||
if not %ERRORLEVEL% == 0 (
|
||||
set BUILD_RESULT=%ERRORLEVEL%
|
||||
)
|
||||
)
|
||||
|
||||
exit /b %BUILD_RESULT%
|
||||
|
||||
@echo on
|
||||
@@ -14,6 +14,7 @@ AC_DEFUN([AC_MONO_OUTPUT], [
|
||||
AC_OUTPUT([
|
||||
Makefile
|
||||
llvm/Makefile
|
||||
mk/Makefile
|
||||
mono/Makefile
|
||||
mono/btls/Makefile
|
||||
mono/native/Makefile
|
||||
@@ -97,5 +98,6 @@ AC_DEFUN([AC_MONO_OUTPUT], [
|
||||
tools/mono-hang-watchdog/Makefile
|
||||
runtime/Makefile
|
||||
po/Makefile
|
||||
netcore/corerun/Makefile
|
||||
])
|
||||
])
|
||||
+9
-5
@@ -860,11 +860,9 @@ Instruct the runtime on the number of times that the method specified
|
||||
by --compile (or all the methods if --compile-all is used) to be
|
||||
compiled. This is used for testing the code generator performance.
|
||||
.TP
|
||||
\fB--stats=[method]\fR
|
||||
\fB--stats\fR
|
||||
Displays information about the work done by the runtime during the
|
||||
execution of an application. If a method (namespace.name:methodname)
|
||||
is specified, it will display that information when the method is
|
||||
first run in addition to the end of program execution.
|
||||
execution of an application.
|
||||
.TP
|
||||
\fB--wapi=hps|semdel\fR
|
||||
Perform maintenance of the process shared data.
|
||||
@@ -1498,6 +1496,9 @@ scanning is available.
|
||||
\fBno-managed-allocator\fR
|
||||
Disables the managed allocator.
|
||||
.TP
|
||||
\fBmanaged-allocator\fR
|
||||
Enables the managed allocator.
|
||||
.TP
|
||||
\fBcheck-scan-starts\fR
|
||||
If set, does a plausibility check on the scan_starts before and after each collection
|
||||
.TP
|
||||
@@ -1523,7 +1524,10 @@ sgen-gc.c. You can then use this command to explore the output
|
||||
\fBnursery-canaries\fR
|
||||
If set, objects allocated in the nursery are suffixed with a canary (guard)
|
||||
word, which is checked on each minor collection. Can be used to detect/debug
|
||||
heap corruption issues.
|
||||
heap corruption issues. This disables the usage of the managed allocator,
|
||||
because allocation from full aot code is inconsistent with this option. If
|
||||
the application is guaranteed not to use aot code, the managed allocator can
|
||||
be enabled back with managed-allocator option.
|
||||
|
||||
.TP
|
||||
\fBdo-not-finalize(=\fIclasses\fB)\fR
|
||||
|
||||
@@ -52,6 +52,8 @@ namespace Mono.CompilerServices.SymbolWriter
|
||||
|
||||
#if !CECIL && !MOBILE
|
||||
ModuleBuilder mb;
|
||||
delegate Guid GetGuidFunc (ModuleBuilder mb);
|
||||
GetGuidFunc get_guid_func;
|
||||
|
||||
public SymbolWriterImpl (ModuleBuilder mb)
|
||||
{
|
||||
@@ -60,7 +62,16 @@ namespace Mono.CompilerServices.SymbolWriter
|
||||
|
||||
public void Close ()
|
||||
{
|
||||
msw.WriteSymbolFile (mb.ModuleVersionId);
|
||||
MethodInfo mi = typeof (ModuleBuilder).GetMethod (
|
||||
"Mono_GetGuid",
|
||||
BindingFlags.Static | BindingFlags.NonPublic);
|
||||
if (mi == null)
|
||||
return;
|
||||
|
||||
get_guid_func = (GetGuidFunc) System.Delegate.CreateDelegate (
|
||||
typeof (GetGuidFunc), mi);
|
||||
|
||||
msw.WriteSymbolFile (get_guid_func (mb));
|
||||
}
|
||||
#else
|
||||
Guid guid;
|
||||
|
||||
@@ -51,19 +51,10 @@ namespace Mono.Debugger.Soft
|
||||
// Since protocol version 2.46
|
||||
public Value Value {
|
||||
get {
|
||||
ValueImpl value;
|
||||
if (Address == 0)
|
||||
return null;
|
||||
try {
|
||||
value = vm.conn.Pointer_GetValue (Address, Type);
|
||||
}
|
||||
catch (CommandException ex) {
|
||||
if (ex.ErrorCode == ErrorCode.INVALID_ARGUMENT)
|
||||
throw new ArgumentException ("Invalid pointer address.");
|
||||
else
|
||||
throw;
|
||||
}
|
||||
return vm.DecodeValue (value);
|
||||
|
||||
return vm.DecodeValue (vm.conn.Pointer_GetValue (Address, Type));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -609,10 +609,6 @@ public class Tests : TestsBase, ITest2
|
||||
fixed_size_array();
|
||||
test_new_exception_filter();
|
||||
test_async_debug_generics();
|
||||
if (args.Length >0 && args [0] == "pointer_arguments2") {
|
||||
pointers2 ();
|
||||
return 0;
|
||||
}
|
||||
return 3;
|
||||
}
|
||||
|
||||
@@ -2236,17 +2232,6 @@ public class Tests : TestsBase, ITest2
|
||||
rtMethod.Invoke(rtObject, new object[] { });
|
||||
}
|
||||
|
||||
public static unsafe void pointer_arguments2 (int* a) {
|
||||
*a = 0;
|
||||
}
|
||||
|
||||
[MethodImplAttribute (MethodImplOptions.NoInlining)]
|
||||
public static unsafe void pointers2 () {
|
||||
int[] a = new [] {1,2,3};
|
||||
fixed (int* pa = a)
|
||||
pointer_arguments2 (pa);
|
||||
}
|
||||
|
||||
[MethodImplAttribute (MethodImplOptions.NoInlining)]
|
||||
public static void new_thread_hybrid_exception() {
|
||||
try
|
||||
|
||||
@@ -470,7 +470,6 @@ public class DebuggerTests
|
||||
|
||||
var pdbFromMemory = assemblyMirror.GetPdbBlob ();
|
||||
if (!File.Exists (pdbPath)) {
|
||||
Assert.IsFalse (assemblyMirror.HasPdb);
|
||||
Assert.IsTrue (assemblyMirror.HasFetchedPdb);
|
||||
continue;
|
||||
}
|
||||
@@ -5174,32 +5173,6 @@ public class DebuggerTests
|
||||
e = step_in_await ("MoveNext", e);
|
||||
e = step_in_await ("MoveNext", e);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void InvalidPointer_GetValue () {
|
||||
vm.Detach ();
|
||||
Start (dtest_app_path, "pointer_arguments2");
|
||||
Event e = run_until ("pointer_arguments2");
|
||||
var frame = e.Thread.GetFrames () [0];
|
||||
|
||||
var param = frame.Method.GetParameters()[0];
|
||||
Assert.AreEqual("Int32*", param.ParameterType.Name);
|
||||
|
||||
var pointerValue = frame.GetValue(param) as PointerValue;
|
||||
Assert.AreEqual("Int32*", pointerValue.Type.Name);
|
||||
|
||||
|
||||
var pointerValue2 = new PointerValue (pointerValue.VirtualMachine, pointerValue.Type, 200);
|
||||
|
||||
try {
|
||||
var val = pointerValue2.Value;
|
||||
}
|
||||
catch (ArgumentException ex) {
|
||||
Assert.IsInstanceOfType (typeof (ArgumentException), ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
} // class DebuggerTests
|
||||
|
||||
@@ -311,8 +311,8 @@ public class UnixEncoding : Encoding
|
||||
|
||||
public unsafe override int GetBytes(char* chars, int charCount, byte* bytes, int byteCount)
|
||||
{
|
||||
if ((bytes == null && byteCount != 0) || (chars == null && charCount != 0))
|
||||
throw new ArgumentNullException ((bytes == null && byteCount != 0) ? "bytes" : "chars");
|
||||
if (bytes == null || chars == null)
|
||||
throw new ArgumentNullException (bytes == null ? "bytes" : "chars");
|
||||
|
||||
if (charCount < 0 || byteCount < 0)
|
||||
throw new ArgumentOutOfRangeException (charCount < 0 ? "charCount" : "byteCount");
|
||||
|
||||
@@ -995,23 +995,6 @@ namespace MonoTests.Mono.Unix {
|
||||
);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestEmptyString ()
|
||||
{
|
||||
byte[] data = new byte [] {};
|
||||
Encoding enc = new UnixEncoding ();
|
||||
|
||||
string s = enc.GetString (data);
|
||||
Assert.AreEqual (s, "", "#1");
|
||||
char[] chars = enc.GetChars (data);
|
||||
Assert.AreEqual (chars.Length, 0, "#2");
|
||||
|
||||
byte[] b1 = enc.GetBytes ("");
|
||||
Assert.AreEqual (b1.Length, 0, "#3");
|
||||
byte[] b2 = enc.GetBytes (new char[] {});
|
||||
Assert.AreEqual (b2.Length, 0, "#3");
|
||||
}
|
||||
|
||||
private void Compare (string prefix, string start, byte[] end)
|
||||
{
|
||||
byte[] bytes = unix.GetBytes (start);
|
||||
|
||||
@@ -508,7 +508,7 @@ namespace MonoTests.Mono.Profiler.Log {
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Fact (Skip = "https://github.com/mono/mono/issues/8709")]
|
||||
public void HeapshotDataIsValid ()
|
||||
{
|
||||
new ProfilerTestRun ("simple-allocation", "heapshot").Run (events => {
|
||||
|
||||
+22
-22
@@ -1,22 +1,22 @@
|
||||
@echo off
|
||||
echo This batch will throw some errors, if the user already exists or
|
||||
echo the database does not exist. You can safely ignore those
|
||||
echo.
|
||||
echo You should run this as the installation owner (the user, that installed Ingres)
|
||||
echo.
|
||||
echo Tested on Ingres 9.2.0 Build 118
|
||||
|
||||
echo Trying to drop database northwind...
|
||||
destroydb northwind -uLinqUser > nwind.log
|
||||
|
||||
echo Creating user LinqUser...
|
||||
sql iidbdb < create_User.sql >> nwind.log
|
||||
|
||||
echo Creating database northwind...
|
||||
createdb northwind -uLinqUser >> nwind.log
|
||||
|
||||
echo Filling data into northwind...
|
||||
sql northwind -uLinqUser < create_Northwind.sql >> nwind.log
|
||||
|
||||
echo Done.
|
||||
pause
|
||||
@echo off
|
||||
echo This batch will throw some errors, if the user already exists or
|
||||
echo the database does not exist. You can safely ignore those
|
||||
echo.
|
||||
echo You should run this as the installation owner (the user, that installed Ingres)
|
||||
echo.
|
||||
echo Tested on Ingres 9.2.0 Build 118
|
||||
|
||||
echo Trying to drop database northwind...
|
||||
destroydb northwind -uLinqUser > nwind.log
|
||||
|
||||
echo Creating user LinqUser...
|
||||
sql iidbdb < create_User.sql >> nwind.log
|
||||
|
||||
echo Creating database northwind...
|
||||
createdb northwind -uLinqUser >> nwind.log
|
||||
|
||||
echo Filling data into northwind...
|
||||
sql northwind -uLinqUser < create_Northwind.sql >> nwind.log
|
||||
|
||||
echo Done.
|
||||
pause
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
REM you need to have DbMetal.exe compiled in the standard directory
|
||||
|
||||
REM you need to have DbMetal.exe compiled in the standard directory
|
||||
|
||||
..\..\..\DbMetal\bin\DbMetal.exe -Provider=MySql -server:localhost -user:LinqUser -password:linq2 -database:AllTypes -namespace:AllTypesExample -code:AllTypes.cs
|
||||
@@ -1,5 +1,5 @@
|
||||
REM: note that the '-sprocs' option is turned on
|
||||
|
||||
..\..\..\SqlMetal\bin\MySqlMetal.exe -database:Andrus -server:localhost -user:LinqUser -password:linq2 -namespace:andrusDB -code:..\nwind\Andrus.cs -sprocs
|
||||
|
||||
|
||||
REM: note that the '-sprocs' option is turned on
|
||||
|
||||
..\..\..\SqlMetal\bin\MySqlMetal.exe -database:Andrus -server:localhost -user:LinqUser -password:linq2 -namespace:andrusDB -code:..\nwind\Andrus.cs -sprocs
|
||||
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
using System.Reflection;
|
||||
|
||||
namespace System.Net.Http
|
||||
{
|
||||
partial class HttpClientHandler : HttpMessageHandler
|
||||
{
|
||||
static IMonoHttpClientHandler CreateDefaultHandler ()
|
||||
{
|
||||
string envvar = Environment.GetEnvironmentVariable ("XA_HTTP_CLIENT_HANDLER_TYPE")?.Trim ();
|
||||
if (envvar?.StartsWith("System.Net.Http.MonoWebRequestHandler", StringComparison.InvariantCulture) == true)
|
||||
{
|
||||
Type monoWrhType = Type.GetType (envvar, false);
|
||||
if (monoWrhType != null)
|
||||
return (IMonoHttpClientHandler) Activator.CreateInstance (monoWrhType);
|
||||
}
|
||||
|
||||
// Ignore other types of handlers here (e.g. AndroidHttpHandler) to keep the old behavior
|
||||
// and always create SocketsHttpHandler for code like this if MonoWebRequestHandler was not specified:
|
||||
//
|
||||
// var handler = new HttpClientHandler { Credentials = ... };
|
||||
// var httpClient = new HttpClient (handler);
|
||||
//
|
||||
// AndroidHttpHandler is used only when we use the parameterless ctor of HttpClient
|
||||
return new SocketsHttpHandler ();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -70,7 +70,7 @@ namespace System.Net.Http
|
||||
TimeSpan? timeout;
|
||||
bool disposed;
|
||||
|
||||
internal MonoWebRequestHandler ()
|
||||
public MonoWebRequestHandler ()
|
||||
{
|
||||
allowAutoRedirect = true;
|
||||
maxAutomaticRedirections = 50;
|
||||
|
||||
@@ -1328,7 +1328,7 @@
|
||||
<Compile Include="..\..\..\external\corefx\src\System.Net.Http\src\System\Net\Http\StreamContent.cs" />
|
||||
<Compile Include="..\..\..\external\corefx\src\System.Net.Http\src\System\Net\Http\StreamToStreamCopy.cs" />
|
||||
<Compile Include="..\..\..\external\corefx\src\System.Net.Http\src\System\Net\Http\StringContent.cs" />
|
||||
<Compile Include="HttpClientHandler.SocketsHandler.cs" />
|
||||
<Compile Include="HttpClientHandler.SocketsHandler.Android.cs" />
|
||||
<Compile Include="HttpClientHandler.cs" />
|
||||
<Compile Include="HttpRequestMessage.Mono.cs" />
|
||||
<Compile Include="IMonoHttpClientHandler.cs" />
|
||||
|
||||
@@ -8,27 +8,34 @@ namespace System.Net.Http {
|
||||
|
||||
static HttpMessageHandler CreateDefaultHandler ()
|
||||
{
|
||||
Type type = Type.GetType("Android.Runtime.AndroidEnvironment, Mono.Android");
|
||||
if (type == null)
|
||||
return GetFallback ("Invalid Mono.Android assembly? Cannot find Android.Runtime.AndroidEnvironment");
|
||||
string envvar = Environment.GetEnvironmentVariable ("XA_HTTP_CLIENT_HANDLER_TYPE")?.Trim ();
|
||||
|
||||
MethodInfo method = type.GetMethod ("GetHttpMessageHandler", BindingFlags.Static | BindingFlags.NonPublic);
|
||||
if (method == null)
|
||||
return GetFallback ("Your Xamarin.Android version does not support obtaining of the custom HttpClientHandler");
|
||||
if (string.IsNullOrEmpty (envvar))
|
||||
return new HttpClientHandler ();
|
||||
|
||||
object ret = method.Invoke (null, null);
|
||||
if (ret == null)
|
||||
return GetFallback ("Xamarin.Android returned no custom HttpClientHandler");
|
||||
if (envvar?.StartsWith ("System.Net.Http.MonoWebRequestHandler", StringComparison.InvariantCulture) == true)
|
||||
{
|
||||
Type monoWrhType = Type.GetType (envvar, false);
|
||||
if (monoWrhType != null)
|
||||
return new HttpClientHandler ((IMonoHttpClientHandler) Activator.CreateInstance (monoWrhType));
|
||||
|
||||
var handler = ret as HttpMessageHandler;
|
||||
if (handler == null)
|
||||
return GetFallback ($"{ret?.GetType()} is not a valid HttpMessageHandler");
|
||||
return handler;
|
||||
}
|
||||
return new HttpClientHandler ();
|
||||
}
|
||||
|
||||
Type handlerType = Type.GetType (envvar, false);
|
||||
if (handlerType == null && !envvar.Contains (", "))
|
||||
{
|
||||
// if assembly was not specified - look for it in Mono.Android too
|
||||
// (e.g. AndroidHttpHandler is there)
|
||||
handlerType = Type.GetType (envvar + ", Mono.Android", false);
|
||||
}
|
||||
|
||||
if (handlerType == null)
|
||||
return new HttpClientHandler ();
|
||||
|
||||
if (Activator.CreateInstance (handlerType) is HttpMessageHandler msgHandler)
|
||||
return msgHandler;
|
||||
|
||||
static HttpMessageHandler GetFallback (string message)
|
||||
{
|
||||
Console.WriteLine (message + ". Defaulting to System.Net.Http.HttpClientHandler");
|
||||
return new HttpClientHandler ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
HttpClient.DefaultHandler.cs
|
||||
HttpClientHandler.SocketsHandler.cs
|
||||
@@ -1,2 +1,3 @@
|
||||
#include socketshandler.sources
|
||||
System.Net.Http/HttpClient.android.cs
|
||||
HttpClientHandler.SocketsHandler.Android.cs
|
||||
+3
-1
@@ -423,8 +423,10 @@ namespace System.Runtime.Serialization.Json
|
||||
XmlDictionaryString namespaceLocal = null;
|
||||
if (nameLocal != null && nameLocal is string)
|
||||
writer.WriteStartElement ((string) name, null);
|
||||
else
|
||||
else if (name is XmlDictionaryString)
|
||||
writer.WriteStartElement ((XmlDictionaryString) name, null);
|
||||
else
|
||||
writer.WriteStartElement (name.ToString(), null);
|
||||
}
|
||||
|
||||
void WriteEndElement ()
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
<Docs>
|
||||
<remarks>
|
||||
<attribution license="cc4" from="Microsoft" modified="false" />
|
||||
<para>XML Web services discovery involves discovering the available Web Services given an URL. The URL usually points to a discovery document, which typically has a.disco file name extension. Within a discovery document are references to information about the existence of XML Web services. These references can refer to service descriptions, XML Schema Definition language (XSD) schemas or other discovery documents. This class represents a reference to a Service Description.</para>
|
||||
<para>XML Web services discovery involves discovering the available Web Services given an URL. The URL usually points to a discovery document, which typically has a.disco file name extension. Within a discovery document are references to information about the existance of XML Web services. These references can refer to service descriptions, XML Schema Definition language (XSD) schemas or other discovery documents. This class represents a reference to a Service Description.</para>
|
||||
<para>Within a discovery document, a reference to a Service Description is contained within a contractRef XML element. The contractRef XML element has two attributes: ref and docRef. The contractRef element must have an XML namespace matching the <see cref="F:System.Web.Services.Discovery.ContractReference.Namespace" /> constant, whereas the ref and docRef attributes are placed in the <see cref="P:System.Web.Services.Discovery.ContractReference.Ref" /> and <see cref="P:System.Web.Services.Discovery.ContractReference.DocRef" /> properties.</para>
|
||||
</remarks>
|
||||
<summary>
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
<Docs>
|
||||
<remarks>
|
||||
<attribution license="cc4" from="Microsoft" modified="false" />
|
||||
<para>XML Web services discovery involves discovering the available XML Web services, given an URL. The URL typically points to a discovery document, which usually has a.disco file name extension. The discovery document, which is an XML document, contains references to information about the existence of XML Web services, such as a service description, XML Schema Definition (XSD) language schema, or another discovery document. This class represents the contents of the discovery document; where the <see cref="P:System.Web.Services.Discovery.DiscoveryDocument.References" /> property contains a list of the references contained within the discovery document.</para>
|
||||
<para>XML Web services discovery involves discovering the available XML Web services, given an URL. The URL typically points to a discovery document, which usually has a.disco file name extension. The discovery document, which is an XML document, contains references to information about the existance of XML Web services, such as a service description, XML Schema Definition (XSD) language schema, or another discovery document. This class represents the contents of the discovery document; where the <see cref="P:System.Web.Services.Discovery.DiscoveryDocument.References" /> property contains a list of the references contained within the discovery document.</para>
|
||||
</remarks>
|
||||
<summary>
|
||||
<attribution license="cc4" from="Microsoft" modified="false" />
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
<Docs>
|
||||
<remarks>
|
||||
<attribution license="cc4" from="Microsoft" modified="false" />
|
||||
<para>XML Web services discovery involves discovering the available XML Web services given an URL. The URL typically points to a discovery document, which usually has a.disco file name extension. The discovery document contains references to information about the existence of XML Web services, such as Service Descriptions, XML Schema Definition language (XSD) schemas, or other discovery documents. This class represents a reference to a discovery document.</para>
|
||||
<para>XML Web services discovery involves discovering the available XML Web services given an URL. The URL typically points to a discovery document, which usually has a.disco file name extension. The discovery document contains references to information about the existance of XML Web services, such as Service Descriptions, XML Schema Definition language (XSD) schemas, or other discovery documents. This class represents a reference to a discovery document.</para>
|
||||
</remarks>
|
||||
<summary>
|
||||
<attribution license="cc4" from="Microsoft" modified="false" />
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
<Docs>
|
||||
<remarks>
|
||||
<attribution license="cc4" from="Microsoft" modified="false" />
|
||||
<para>XML Web services discovery involves discovering the available XML Web services given, a URL. A The URL typically points to a discovery document, which usually has a.disco file name extension. The discovery document contains references to information about the existence of XML Web services. These references can refer to service descriptions, XSD schemas, or other discovery documents. This class represents a reference to an XSD schema.</para>
|
||||
<para>XML Web services discovery involves discovering the available XML Web services given, a URL. A The URL typically points to a discovery document, which usually has a.disco file name extension. The discovery document contains references to information about the existance of XML Web services. These references can refer to service descriptions, XSD schemas, or other discovery documents. This class represents a reference to an XSD schema.</para>
|
||||
<para>Within a discovery document, a reference to an XSD schema is contained within a schemaRef XML element. The schemaRef XML element has an XML namespace and a ref attribute. The value of the XML namespace must match the <see cref="F:System.Web.Services.Discovery.SchemaReference.Namespace" /> constant. The value of the ref attribute is placed in the <see cref="P:System.Web.Services.Discovery.SchemaReference.Ref" /> property.</para>
|
||||
</remarks>
|
||||
<summary>
|
||||
|
||||
@@ -0,0 +1,413 @@
|
||||
// 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 substantial 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.
|
||||
//
|
||||
// Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
|
||||
//
|
||||
// Authors:
|
||||
// Peter Bartok ([email protected])
|
||||
//
|
||||
//
|
||||
|
||||
// COMPLETE
|
||||
|
||||
using System.Collections;
|
||||
|
||||
namespace System.Windows.Forms.RTF {
|
||||
internal class Charcode {
|
||||
#region Local Variables
|
||||
private StandardCharCode[] codes;
|
||||
private Hashtable reverse;
|
||||
private int size;
|
||||
#endregion // Local Variables
|
||||
|
||||
#region Cached Values
|
||||
static Charcode ansi_generic;
|
||||
#endregion
|
||||
|
||||
#region Public Constructors
|
||||
public Charcode() : this(256) {
|
||||
}
|
||||
|
||||
private Charcode(int size) {
|
||||
this.size = size;
|
||||
this.codes = new StandardCharCode[size];
|
||||
this.reverse = new Hashtable(size);
|
||||
|
||||
// No need to reinitialize array to its default value
|
||||
//for (int i = 0; i < size; i++) {
|
||||
// codes[i] = StandardCharCode.nothing;
|
||||
//}
|
||||
}
|
||||
#endregion // Public Constructors
|
||||
|
||||
#region Public Instance Properties
|
||||
public int this[StandardCharCode c] {
|
||||
get {
|
||||
object obj;
|
||||
|
||||
obj = reverse[c];
|
||||
if (obj != null) {
|
||||
return (int)obj;
|
||||
}
|
||||
for (int i = 0; i < size; i++) {
|
||||
if (codes[i] == c) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
public StandardCharCode this[int c] {
|
||||
get {
|
||||
if (c < 0 || c >= size) {
|
||||
return StandardCharCode.nothing;
|
||||
}
|
||||
|
||||
return codes[c];
|
||||
}
|
||||
|
||||
private set {
|
||||
if (c < 0 || c >= size) {
|
||||
return;
|
||||
}
|
||||
|
||||
codes[c] = value;
|
||||
reverse[value] = c;
|
||||
}
|
||||
}
|
||||
#endregion // Public Instance Properties
|
||||
|
||||
#region Public Instance Methods
|
||||
#endregion // Public Instance Methods
|
||||
|
||||
#region Public Static Methods
|
||||
public static Charcode AnsiGeneric {
|
||||
get {
|
||||
if (ansi_generic != null)
|
||||
return ansi_generic;
|
||||
|
||||
ansi_generic = new Charcode(256);
|
||||
|
||||
ansi_generic[0x06] = StandardCharCode.formula;
|
||||
ansi_generic[0x1e] = StandardCharCode.nobrkhyphen;
|
||||
ansi_generic[0x1f] = StandardCharCode.opthyphen;
|
||||
ansi_generic[' '] = StandardCharCode.space;
|
||||
ansi_generic['!'] = StandardCharCode.exclam;
|
||||
ansi_generic['"'] = StandardCharCode.quotedbl;
|
||||
ansi_generic['#'] = StandardCharCode.numbersign;
|
||||
ansi_generic['$'] = StandardCharCode.dollar;
|
||||
ansi_generic['%'] = StandardCharCode.percent;
|
||||
ansi_generic['&'] = StandardCharCode.ampersand;
|
||||
ansi_generic['\\'] = StandardCharCode.quoteright;
|
||||
ansi_generic['('] = StandardCharCode.parenleft;
|
||||
ansi_generic[')'] = StandardCharCode.parenright;
|
||||
ansi_generic['*'] = StandardCharCode.asterisk;
|
||||
ansi_generic['+'] = StandardCharCode.plus;
|
||||
ansi_generic[','] = StandardCharCode.comma;
|
||||
ansi_generic['-'] = StandardCharCode.hyphen;
|
||||
ansi_generic['.'] = StandardCharCode.period;
|
||||
ansi_generic['/'] = StandardCharCode.slash;
|
||||
ansi_generic['0'] = StandardCharCode.zero;
|
||||
ansi_generic['1'] = StandardCharCode.one;
|
||||
ansi_generic['2'] = StandardCharCode.two;
|
||||
ansi_generic['3'] = StandardCharCode.three;
|
||||
ansi_generic['4'] = StandardCharCode.four;
|
||||
ansi_generic['5'] = StandardCharCode.five;
|
||||
ansi_generic['6'] = StandardCharCode.six;
|
||||
ansi_generic['7'] = StandardCharCode.seven;
|
||||
ansi_generic['8'] = StandardCharCode.eight;
|
||||
ansi_generic['9'] = StandardCharCode.nine;
|
||||
ansi_generic[':'] = StandardCharCode.colon;
|
||||
ansi_generic[';'] = StandardCharCode.semicolon;
|
||||
ansi_generic['<'] = StandardCharCode.less;
|
||||
ansi_generic['='] = StandardCharCode.equal;
|
||||
ansi_generic['>'] = StandardCharCode.greater;
|
||||
ansi_generic['?'] = StandardCharCode.question;
|
||||
ansi_generic['@'] = StandardCharCode.at;
|
||||
ansi_generic['A'] = StandardCharCode.A;
|
||||
ansi_generic['B'] = StandardCharCode.B;
|
||||
ansi_generic['C'] = StandardCharCode.C;
|
||||
ansi_generic['D'] = StandardCharCode.D;
|
||||
ansi_generic['E'] = StandardCharCode.E;
|
||||
ansi_generic['F'] = StandardCharCode.F;
|
||||
ansi_generic['G'] = StandardCharCode.G;
|
||||
ansi_generic['H'] = StandardCharCode.H;
|
||||
ansi_generic['I'] = StandardCharCode.I;
|
||||
ansi_generic['J'] = StandardCharCode.J;
|
||||
ansi_generic['K'] = StandardCharCode.K;
|
||||
ansi_generic['L'] = StandardCharCode.L;
|
||||
ansi_generic['M'] = StandardCharCode.M;
|
||||
ansi_generic['N'] = StandardCharCode.N;
|
||||
ansi_generic['O'] = StandardCharCode.O;
|
||||
ansi_generic['P'] = StandardCharCode.P;
|
||||
ansi_generic['Q'] = StandardCharCode.Q;
|
||||
ansi_generic['R'] = StandardCharCode.R;
|
||||
ansi_generic['S'] = StandardCharCode.S;
|
||||
ansi_generic['T'] = StandardCharCode.T;
|
||||
ansi_generic['U'] = StandardCharCode.U;
|
||||
ansi_generic['V'] = StandardCharCode.V;
|
||||
ansi_generic['W'] = StandardCharCode.W;
|
||||
ansi_generic['X'] = StandardCharCode.X;
|
||||
ansi_generic['Y'] = StandardCharCode.Y;
|
||||
ansi_generic['Z'] = StandardCharCode.Z;
|
||||
ansi_generic['['] = StandardCharCode.bracketleft;
|
||||
ansi_generic['\\'] = StandardCharCode.backslash;
|
||||
ansi_generic[']'] = StandardCharCode.bracketright;
|
||||
ansi_generic['^'] = StandardCharCode.asciicircum;
|
||||
ansi_generic['_'] = StandardCharCode.underscore;
|
||||
ansi_generic['`'] = StandardCharCode.quoteleft;
|
||||
ansi_generic['a'] = StandardCharCode.a;
|
||||
ansi_generic['b'] = StandardCharCode.b;
|
||||
ansi_generic['c'] = StandardCharCode.c;
|
||||
ansi_generic['d'] = StandardCharCode.d;
|
||||
ansi_generic['e'] = StandardCharCode.e;
|
||||
ansi_generic['f'] = StandardCharCode.f;
|
||||
ansi_generic['g'] = StandardCharCode.g;
|
||||
ansi_generic['h'] = StandardCharCode.h;
|
||||
ansi_generic['i'] = StandardCharCode.i;
|
||||
ansi_generic['j'] = StandardCharCode.j;
|
||||
ansi_generic['k'] = StandardCharCode.k;
|
||||
ansi_generic['l'] = StandardCharCode.l;
|
||||
ansi_generic['m'] = StandardCharCode.m;
|
||||
ansi_generic['n'] = StandardCharCode.n;
|
||||
ansi_generic['o'] = StandardCharCode.o;
|
||||
ansi_generic['p'] = StandardCharCode.p;
|
||||
ansi_generic['q'] = StandardCharCode.q;
|
||||
ansi_generic['r'] = StandardCharCode.r;
|
||||
ansi_generic['s'] = StandardCharCode.s;
|
||||
ansi_generic['t'] = StandardCharCode.t;
|
||||
ansi_generic['u'] = StandardCharCode.u;
|
||||
ansi_generic['v'] = StandardCharCode.v;
|
||||
ansi_generic['w'] = StandardCharCode.w;
|
||||
ansi_generic['x'] = StandardCharCode.x;
|
||||
ansi_generic['y'] = StandardCharCode.y;
|
||||
ansi_generic['z'] = StandardCharCode.z;
|
||||
ansi_generic['{'] = StandardCharCode.braceleft;
|
||||
ansi_generic['|'] = StandardCharCode.bar;
|
||||
ansi_generic['}'] = StandardCharCode.braceright;
|
||||
ansi_generic['~'] = StandardCharCode.asciitilde;
|
||||
ansi_generic[0xa0] = StandardCharCode.nobrkspace;
|
||||
ansi_generic[0xa1] = StandardCharCode.exclamdown;
|
||||
ansi_generic[0xa2] = StandardCharCode.cent;
|
||||
ansi_generic[0xa3] = StandardCharCode.sterling;
|
||||
ansi_generic[0xa4] = StandardCharCode.currency;
|
||||
ansi_generic[0xa5] = StandardCharCode.yen;
|
||||
ansi_generic[0xa6] = StandardCharCode.brokenbar;
|
||||
ansi_generic[0xa7] = StandardCharCode.section;
|
||||
ansi_generic[0xa8] = StandardCharCode.dieresis;
|
||||
ansi_generic[0xa9] = StandardCharCode.copyright;
|
||||
ansi_generic[0xaa] = StandardCharCode.ordfeminine;
|
||||
ansi_generic[0xab] = StandardCharCode.guillemotleft;
|
||||
ansi_generic[0xac] = StandardCharCode.logicalnot;
|
||||
ansi_generic[0xad] = StandardCharCode.opthyphen;
|
||||
ansi_generic[0xae] = StandardCharCode.registered;
|
||||
ansi_generic[0xaf] = StandardCharCode.macron;
|
||||
ansi_generic[0xb0] = StandardCharCode.degree;
|
||||
ansi_generic[0xb1] = StandardCharCode.plusminus;
|
||||
ansi_generic[0xb2] = StandardCharCode.twosuperior;
|
||||
ansi_generic[0xb3] = StandardCharCode.threesuperior;
|
||||
ansi_generic[0xb4] = StandardCharCode.acute;
|
||||
ansi_generic[0xb5] = StandardCharCode.mu;
|
||||
ansi_generic[0xb6] = StandardCharCode.paragraph;
|
||||
ansi_generic[0xb7] = StandardCharCode.periodcentered;
|
||||
ansi_generic[0xb8] = StandardCharCode.cedilla;
|
||||
ansi_generic[0xb9] = StandardCharCode.onesuperior;
|
||||
ansi_generic[0xba] = StandardCharCode.ordmasculine;
|
||||
ansi_generic[0xbb] = StandardCharCode.guillemotright;
|
||||
ansi_generic[0xbc] = StandardCharCode.onequarter;
|
||||
ansi_generic[0xbd] = StandardCharCode.onehalf;
|
||||
ansi_generic[0xbe] = StandardCharCode.threequarters;
|
||||
ansi_generic[0xbf] = StandardCharCode.questiondown;
|
||||
ansi_generic[0xc0] = StandardCharCode.Agrave;
|
||||
ansi_generic[0xc1] = StandardCharCode.Aacute;
|
||||
ansi_generic[0xc2] = StandardCharCode.Acircumflex;
|
||||
ansi_generic[0xc3] = StandardCharCode.Atilde;
|
||||
ansi_generic[0xc4] = StandardCharCode.Adieresis;
|
||||
ansi_generic[0xc5] = StandardCharCode.Aring;
|
||||
ansi_generic[0xc6] = StandardCharCode.AE;
|
||||
ansi_generic[0xc7] = StandardCharCode.Ccedilla;
|
||||
ansi_generic[0xc8] = StandardCharCode.Egrave;
|
||||
ansi_generic[0xc9] = StandardCharCode.Eacute;
|
||||
ansi_generic[0xca] = StandardCharCode.Ecircumflex;
|
||||
ansi_generic[0xcb] = StandardCharCode.Edieresis;
|
||||
ansi_generic[0xcc] = StandardCharCode.Igrave;
|
||||
ansi_generic[0xcd] = StandardCharCode.Iacute;
|
||||
ansi_generic[0xce] = StandardCharCode.Icircumflex;
|
||||
ansi_generic[0xcf] = StandardCharCode.Idieresis;
|
||||
ansi_generic[0xd0] = StandardCharCode.Eth;
|
||||
ansi_generic[0xd1] = StandardCharCode.Ntilde;
|
||||
ansi_generic[0xd2] = StandardCharCode.Ograve;
|
||||
ansi_generic[0xd3] = StandardCharCode.Oacute;
|
||||
ansi_generic[0xd4] = StandardCharCode.Ocircumflex;
|
||||
ansi_generic[0xd5] = StandardCharCode.Otilde;
|
||||
ansi_generic[0xd6] = StandardCharCode.Odieresis;
|
||||
ansi_generic[0xd7] = StandardCharCode.multiply;
|
||||
ansi_generic[0xd8] = StandardCharCode.Oslash;
|
||||
ansi_generic[0xd9] = StandardCharCode.Ugrave;
|
||||
ansi_generic[0xda] = StandardCharCode.Uacute;
|
||||
ansi_generic[0xdb] = StandardCharCode.Ucircumflex;
|
||||
ansi_generic[0xdc] = StandardCharCode.Udieresis;
|
||||
ansi_generic[0xdd] = StandardCharCode.Yacute;
|
||||
ansi_generic[0xde] = StandardCharCode.Thorn;
|
||||
ansi_generic[0xdf] = StandardCharCode.germandbls;
|
||||
ansi_generic[0xe0] = StandardCharCode.agrave;
|
||||
ansi_generic[0xe1] = StandardCharCode.aacute;
|
||||
ansi_generic[0xe2] = StandardCharCode.acircumflex;
|
||||
ansi_generic[0xe3] = StandardCharCode.atilde;
|
||||
ansi_generic[0xe4] = StandardCharCode.adieresis;
|
||||
ansi_generic[0xe5] = StandardCharCode.aring;
|
||||
ansi_generic[0xe6] = StandardCharCode.ae;
|
||||
ansi_generic[0xe7] = StandardCharCode.ccedilla;
|
||||
ansi_generic[0xe8] = StandardCharCode.egrave;
|
||||
ansi_generic[0xe9] = StandardCharCode.eacute;
|
||||
ansi_generic[0xea] = StandardCharCode.ecircumflex;
|
||||
ansi_generic[0xeb] = StandardCharCode.edieresis;
|
||||
ansi_generic[0xec] = StandardCharCode.igrave;
|
||||
ansi_generic[0xed] = StandardCharCode.iacute;
|
||||
ansi_generic[0xee] = StandardCharCode.icircumflex;
|
||||
ansi_generic[0xef] = StandardCharCode.idieresis;
|
||||
ansi_generic[0xf0] = StandardCharCode.eth;
|
||||
ansi_generic[0xf1] = StandardCharCode.ntilde;
|
||||
ansi_generic[0xf2] = StandardCharCode.ograve;
|
||||
ansi_generic[0xf3] = StandardCharCode.oacute;
|
||||
ansi_generic[0xf4] = StandardCharCode.ocircumflex;
|
||||
ansi_generic[0xf5] = StandardCharCode.otilde;
|
||||
ansi_generic[0xf6] = StandardCharCode.odieresis;
|
||||
ansi_generic[0xf7] = StandardCharCode.divide;
|
||||
ansi_generic[0xf8] = StandardCharCode.oslash;
|
||||
ansi_generic[0xf9] = StandardCharCode.ugrave;
|
||||
ansi_generic[0xfa] = StandardCharCode.uacute;
|
||||
ansi_generic[0xfb] = StandardCharCode.ucircumflex;
|
||||
ansi_generic[0xfc] = StandardCharCode.udieresis;
|
||||
ansi_generic[0xfd] = StandardCharCode.yacute;
|
||||
ansi_generic[0xfe] = StandardCharCode.thorn;
|
||||
ansi_generic[0xff] = StandardCharCode.ydieresis;
|
||||
|
||||
return ansi_generic;
|
||||
}
|
||||
}
|
||||
|
||||
public static Charcode AnsiSymbol {
|
||||
get {
|
||||
Charcode code = new Charcode(256);
|
||||
|
||||
code[0x06] = StandardCharCode.formula;
|
||||
code[0x1e] = StandardCharCode.nobrkhyphen;
|
||||
code[0x1f] = StandardCharCode.opthyphen;
|
||||
code[' '] = StandardCharCode.space;
|
||||
code['!'] = StandardCharCode.exclam;
|
||||
code['"'] = StandardCharCode.universal;
|
||||
code['#'] = StandardCharCode.mathnumbersign;
|
||||
code['$'] = StandardCharCode.existential;
|
||||
code['%'] = StandardCharCode.percent;
|
||||
code['&'] = StandardCharCode.ampersand;
|
||||
code['\\'] = StandardCharCode.suchthat;
|
||||
code['('] = StandardCharCode.parenleft;
|
||||
code[')'] = StandardCharCode.parenright;
|
||||
code['*'] = StandardCharCode.mathasterisk;
|
||||
code['+'] = StandardCharCode.mathplus;
|
||||
code[','] = StandardCharCode.comma;
|
||||
code['-'] = StandardCharCode.mathminus;
|
||||
code['.'] = StandardCharCode.period;
|
||||
code['/'] = StandardCharCode.slash;
|
||||
code['0'] = StandardCharCode.zero;
|
||||
code['1'] = StandardCharCode.one;
|
||||
code['2'] = StandardCharCode.two;
|
||||
code['3'] = StandardCharCode.three;
|
||||
code['4'] = StandardCharCode.four;
|
||||
code['5'] = StandardCharCode.five;
|
||||
code['6'] = StandardCharCode.six;
|
||||
code['7'] = StandardCharCode.seven;
|
||||
code['8'] = StandardCharCode.eight;
|
||||
code['9'] = StandardCharCode.nine;
|
||||
code[':'] = StandardCharCode.colon;
|
||||
code[';'] = StandardCharCode.semicolon;
|
||||
code['<'] = StandardCharCode.less;
|
||||
code['='] = StandardCharCode.mathequal;
|
||||
code['>'] = StandardCharCode.greater;
|
||||
code['?'] = StandardCharCode.question;
|
||||
code['@'] = StandardCharCode.congruent;
|
||||
code['A'] = StandardCharCode.Alpha;
|
||||
code['B'] = StandardCharCode.Beta;
|
||||
code['C'] = StandardCharCode.Chi;
|
||||
code['D'] = StandardCharCode.Delta;
|
||||
code['E'] = StandardCharCode.Epsilon;
|
||||
code['F'] = StandardCharCode.Phi;
|
||||
code['G'] = StandardCharCode.Gamma;
|
||||
code['H'] = StandardCharCode.Eta;
|
||||
code['I'] = StandardCharCode.Iota;
|
||||
code['K'] = StandardCharCode.Kappa;
|
||||
code['L'] = StandardCharCode.Lambda;
|
||||
code['M'] = StandardCharCode.Mu;
|
||||
code['N'] = StandardCharCode.Nu;
|
||||
code['O'] = StandardCharCode.Omicron;
|
||||
code['P'] = StandardCharCode.Pi;
|
||||
code['Q'] = StandardCharCode.Theta;
|
||||
code['R'] = StandardCharCode.Rho;
|
||||
code['S'] = StandardCharCode.Sigma;
|
||||
code['T'] = StandardCharCode.Tau;
|
||||
code['U'] = StandardCharCode.Upsilon;
|
||||
code['V'] = StandardCharCode.varsigma;
|
||||
code['W'] = StandardCharCode.Omega;
|
||||
code['X'] = StandardCharCode.Xi;
|
||||
code['Y'] = StandardCharCode.Psi;
|
||||
code['Z'] = StandardCharCode.Zeta;
|
||||
code['['] = StandardCharCode.bracketleft;
|
||||
code['\\'] = StandardCharCode.backslash;
|
||||
code[']'] = StandardCharCode.bracketright;
|
||||
code['^'] = StandardCharCode.asciicircum;
|
||||
code['_'] = StandardCharCode.underscore;
|
||||
code['`'] = StandardCharCode.quoteleft;
|
||||
code['a'] = StandardCharCode.alpha;
|
||||
code['b'] = StandardCharCode.beta;
|
||||
code['c'] = StandardCharCode.chi;
|
||||
code['d'] = StandardCharCode.delta;
|
||||
code['e'] = StandardCharCode.epsilon;
|
||||
code['f'] = StandardCharCode.phi;
|
||||
code['g'] = StandardCharCode.gamma;
|
||||
code['h'] = StandardCharCode.eta;
|
||||
code['i'] = StandardCharCode.iota;
|
||||
code['k'] = StandardCharCode.kappa;
|
||||
code['l'] = StandardCharCode.lambda;
|
||||
code['m'] = StandardCharCode.mu;
|
||||
code['n'] = StandardCharCode.nu;
|
||||
code['o'] = StandardCharCode.omicron;
|
||||
code['p'] = StandardCharCode.pi;
|
||||
code['q'] = StandardCharCode.theta;
|
||||
code['r'] = StandardCharCode.rho;
|
||||
code['s'] = StandardCharCode.sigma;
|
||||
code['t'] = StandardCharCode.tau;
|
||||
code['u'] = StandardCharCode.upsilon;
|
||||
code['w'] = StandardCharCode.omega;
|
||||
code['x'] = StandardCharCode.xi;
|
||||
code['y'] = StandardCharCode.psi;
|
||||
code['z'] = StandardCharCode.zeta;
|
||||
code['{'] = StandardCharCode.braceleft;
|
||||
code['|'] = StandardCharCode.bar;
|
||||
code['}'] = StandardCharCode.braceright;
|
||||
code['~'] = StandardCharCode.mathtilde;
|
||||
|
||||
return code;
|
||||
}
|
||||
}
|
||||
#endregion // Public Static Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
// 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 substantial 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.
|
||||
//
|
||||
// Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
|
||||
//
|
||||
// Authors:
|
||||
// Peter Bartok ([email protected])
|
||||
//
|
||||
//
|
||||
|
||||
using System;
|
||||
|
||||
// COMPLETE
|
||||
|
||||
namespace System.Windows.Forms.RTF {
|
||||
|
||||
#if RTF_LIB
|
||||
public
|
||||
#else
|
||||
internal
|
||||
#endif
|
||||
class Charset {
|
||||
#region Local Variables
|
||||
private CharsetType id;
|
||||
private CharsetFlags flags;
|
||||
private Charcode code;
|
||||
private string file;
|
||||
#endregion // Local Variables
|
||||
|
||||
#region Public Constructors
|
||||
public Charset() {
|
||||
flags = CharsetFlags.Read | CharsetFlags.Switch;
|
||||
id = CharsetType.General;
|
||||
file = string.Empty;
|
||||
this.ReadMap();
|
||||
}
|
||||
#endregion // Public Constructors
|
||||
|
||||
#region Public Instance Properties
|
||||
public Charcode Code {
|
||||
get {
|
||||
return code;
|
||||
}
|
||||
|
||||
set {
|
||||
code = value;
|
||||
}
|
||||
}
|
||||
|
||||
public CharsetFlags Flags {
|
||||
get {
|
||||
return flags;
|
||||
}
|
||||
|
||||
set {
|
||||
flags = value;
|
||||
}
|
||||
}
|
||||
|
||||
public CharsetType ID {
|
||||
get {
|
||||
return id;
|
||||
}
|
||||
|
||||
set {
|
||||
switch(value) {
|
||||
case CharsetType.Symbol: {
|
||||
id = CharsetType.Symbol;
|
||||
return;
|
||||
}
|
||||
|
||||
default:
|
||||
case CharsetType.General: {
|
||||
id = CharsetType.General;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string File {
|
||||
get {
|
||||
return file;
|
||||
}
|
||||
|
||||
set {
|
||||
if (file != value) {
|
||||
file = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public StandardCharCode this[int c] {
|
||||
get {
|
||||
return code[c];
|
||||
}
|
||||
}
|
||||
|
||||
#endregion // Public Instance Properties
|
||||
|
||||
#region Public Instance Methods
|
||||
public bool ReadMap() {
|
||||
switch (id) {
|
||||
case CharsetType.General: {
|
||||
if (file == string.Empty) {
|
||||
code = Charcode.AnsiGeneric;
|
||||
return true;
|
||||
}
|
||||
// FIXME - implement reading charmap from file...
|
||||
return true;
|
||||
}
|
||||
|
||||
case CharsetType.Symbol: {
|
||||
if (file == string.Empty) {
|
||||
code = Charcode.AnsiSymbol;
|
||||
return true;
|
||||
}
|
||||
|
||||
// FIXME - implement reading charmap from file...
|
||||
return true;
|
||||
}
|
||||
|
||||
default: {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public char StdCharCode(string name) {
|
||||
// FIXME - finish this
|
||||
return ' ';
|
||||
|
||||
}
|
||||
|
||||
public string StdCharName(char code) {
|
||||
// FIXME - finish this
|
||||
return String.Empty;
|
||||
}
|
||||
#endregion // Public Instance Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
// 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 substantial 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.
|
||||
//
|
||||
// Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
|
||||
//
|
||||
// Authors:
|
||||
// Peter Bartok ([email protected])
|
||||
//
|
||||
//
|
||||
|
||||
// COMPLETE
|
||||
|
||||
namespace System.Windows.Forms.RTF {
|
||||
[Flags]
|
||||
#if RTF_LIB
|
||||
public
|
||||
#else
|
||||
internal
|
||||
#endif
|
||||
enum CharsetFlags {
|
||||
None = 0x00,
|
||||
Read = 0x01,
|
||||
Switch = 0x02
|
||||
}
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
// 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 substantial 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.
|
||||
//
|
||||
// Copyright (c) 2020 Karl Scowen
|
||||
//
|
||||
// Authors:
|
||||
// Karl Scowen <[email protected]>
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
namespace System.Windows.Forms.RTF {
|
||||
internal static class CharsetToCodepage {
|
||||
public static int Translate(CharsetType charset)
|
||||
{
|
||||
switch (charset) {
|
||||
case CharsetType.General:
|
||||
case CharsetType.Arabic_Traditional:
|
||||
case CharsetType.Arabic_user:
|
||||
case CharsetType.Hebrew_user:
|
||||
case CharsetType.Mac: // Technically wrong, because "mac" should actually be quite a few with their own code pages...
|
||||
default:
|
||||
return System.Text.Encoding.Default.CodePage;
|
||||
case CharsetType.ANSI:
|
||||
return 1252;
|
||||
case CharsetType.Symbol:
|
||||
return 42;
|
||||
case CharsetType.Shift_Jis:
|
||||
return 932;
|
||||
case CharsetType.Hangul:
|
||||
return 949;
|
||||
case CharsetType.Johab:
|
||||
return 1361;
|
||||
case CharsetType.GB2312:
|
||||
return 936;
|
||||
case CharsetType.Big5:
|
||||
return 950;
|
||||
case CharsetType.Greek:
|
||||
return 1253;
|
||||
case CharsetType.Turkish:
|
||||
return 1254;
|
||||
case CharsetType.Vietnamese:
|
||||
return 1258;
|
||||
case CharsetType.Hebrew:
|
||||
return 1255;
|
||||
case CharsetType.Arabic:
|
||||
return 1256;
|
||||
case CharsetType.Baltic:
|
||||
return 1257;
|
||||
case CharsetType.Russian:
|
||||
return 1251;
|
||||
case CharsetType.Thai:
|
||||
return 874;
|
||||
case CharsetType.Eastern_European:
|
||||
return 1250;
|
||||
case CharsetType.PC_437:
|
||||
return 437;
|
||||
case CharsetType.OEM:
|
||||
return 850;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,6 @@
|
||||
//
|
||||
// Authors:
|
||||
// Peter Bartok ([email protected])
|
||||
// Karl Scowen ([email protected])
|
||||
//
|
||||
//
|
||||
|
||||
@@ -34,29 +33,8 @@ namespace System.Windows.Forms.RTF {
|
||||
#else
|
||||
internal
|
||||
#endif
|
||||
enum CharsetType : byte {
|
||||
ANSI = 0,
|
||||
General = 1,
|
||||
Symbol = 2,
|
||||
Mac = 77,
|
||||
Shift_Jis = 128,
|
||||
Hangul = 129,
|
||||
Johab = 130,
|
||||
GB2312 = 134,
|
||||
Big5 = 136,
|
||||
Greek = 161,
|
||||
Turkish = 162,
|
||||
Vietnamese = 163,
|
||||
Hebrew = 177,
|
||||
Arabic = 178,
|
||||
Arabic_Traditional = 179,
|
||||
Arabic_user = 180,
|
||||
Hebrew_user = 181,
|
||||
Baltic = 186,
|
||||
Russian = 204,
|
||||
Thai = 222,
|
||||
Eastern_European = 238,
|
||||
PC_437 = 254,
|
||||
OEM = 255
|
||||
enum CharsetType {
|
||||
General = 0,
|
||||
Symbol = 1,
|
||||
}
|
||||
}
|
||||
@@ -366,12 +366,10 @@ namespace System.Windows.Forms.RTF {
|
||||
new KeyStruct(Major.StyleAttr, Minor.Next, "snext"),
|
||||
new KeyStruct(Major.PictAttr, Minor.MacQD, "macpict"),
|
||||
new KeyStruct(Major.PictAttr, Minor.PMMetafile, "pmmetafile"),
|
||||
new KeyStruct(Major.PictAttr, Minor.EnhancedMetafile, "emfblip"),
|
||||
new KeyStruct(Major.PictAttr, Minor.WinMetafile, "wmetafile"),
|
||||
new KeyStruct(Major.PictAttr, Minor.DevIndBitmap, "dibitmap"),
|
||||
new KeyStruct(Major.PictAttr, Minor.WinBitmap, "wbitmap"),
|
||||
new KeyStruct(Major.PictAttr, Minor.PngBlip, "pngblip"),
|
||||
new KeyStruct(Major.PictAttr, Minor.JpegBlip, "jpgblip"),
|
||||
new KeyStruct(Major.PictAttr, Minor.PixelBits, "wbmbitspixel"),
|
||||
new KeyStruct(Major.PictAttr, Minor.BitmapPlanes, "wbmplanes"),
|
||||
new KeyStruct(Major.PictAttr, Minor.BitmapWid, "wbmwidthbytes"),
|
||||
@@ -395,7 +393,6 @@ namespace System.Windows.Forms.RTF {
|
||||
new KeyStruct(Major.NeXTGrAttr, Minor.NeXTGHeight, "height"),
|
||||
new KeyStruct(Major.Destination, Minor.OptDest, "*"),
|
||||
new KeyStruct(Major.Destination, Minor.FontTbl, "fonttbl"),
|
||||
new KeyStruct(Major.Destination, Minor.FontName, "fname"),
|
||||
new KeyStruct(Major.Destination, Minor.FontAltName, "falt"),
|
||||
new KeyStruct(Major.Destination, Minor.EmbeddedFont, "fonteb"),
|
||||
new KeyStruct(Major.Destination, Minor.FontFile, "fontfile"),
|
||||
|
||||
@@ -41,7 +41,6 @@ namespace System.Windows.Forms.RTF {
|
||||
|
||||
// Major.Destinan
|
||||
FontTbl,
|
||||
FontName,
|
||||
FontAltName,
|
||||
EmbeddedFont,
|
||||
FontFile,
|
||||
@@ -521,12 +520,10 @@ namespace System.Windows.Forms.RTF {
|
||||
// Major.PictAttr
|
||||
MacQD,
|
||||
PMMetafile,
|
||||
EnhancedMetafile,
|
||||
WinMetafile,
|
||||
DevIndBitmap,
|
||||
WinBitmap,
|
||||
PngBlip,
|
||||
JpegBlip,
|
||||
PixelBits,
|
||||
BitmapPlanes,
|
||||
BitmapWid,
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace System.Windows.Forms.RTF {
|
||||
public float Width {
|
||||
get {
|
||||
float w = width;
|
||||
if (w < 0) {
|
||||
if (w == -1) {
|
||||
if (image == null)
|
||||
image = ToImage ();
|
||||
w = image.Width;
|
||||
@@ -79,7 +79,7 @@ namespace System.Windows.Forms.RTF {
|
||||
public float Height {
|
||||
get {
|
||||
float h = height;
|
||||
if (h < 0) {
|
||||
if (h == -1) {
|
||||
if (image == null)
|
||||
image = ToImage ();
|
||||
h = image.Height;
|
||||
@@ -113,9 +113,7 @@ namespace System.Windows.Forms.RTF {
|
||||
return false;
|
||||
switch (image_type) {
|
||||
case Minor.PngBlip:
|
||||
case Minor.JpegBlip:
|
||||
case Minor.WinMetafile:
|
||||
case Minor.EnhancedMetafile:
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
@@ -128,7 +126,15 @@ namespace System.Windows.Forms.RTF {
|
||||
{
|
||||
if (image == null)
|
||||
image = ToImage ();
|
||||
dc.DrawImage (image, x, y, Width, Height);
|
||||
|
||||
float height = this.height;
|
||||
float width = this.width;
|
||||
|
||||
if (height == -1)
|
||||
height = image.Height;
|
||||
if (width == -1)
|
||||
width = image.Width;
|
||||
dc.DrawImage (image, x, y, width, height);
|
||||
}
|
||||
|
||||
public Image ToImage ()
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
//
|
||||
// Authors:
|
||||
// Peter Bartok ([email protected])
|
||||
// Karl Scowen <[email protected]>
|
||||
//
|
||||
|
||||
// COMPLETE
|
||||
@@ -61,6 +60,10 @@ namespace System.Windows.Forms.RTF {
|
||||
|
||||
private char prev_char;
|
||||
private bool bump_line;
|
||||
|
||||
private Font font_list;
|
||||
|
||||
private Charset cur_charset;
|
||||
private Stack charset_stack;
|
||||
|
||||
private Style styles;
|
||||
@@ -98,7 +101,10 @@ namespace System.Windows.Forms.RTF {
|
||||
line_pos = 0;
|
||||
prev_char = unchecked((char)-1);
|
||||
bump_line = false;
|
||||
charset_stack = new Stack();
|
||||
font_list = null;
|
||||
charset_stack = null;
|
||||
|
||||
cur_charset = new Charset();
|
||||
|
||||
destination_callbacks = new DestinationCallback();
|
||||
class_callbacks = new ClassCallback();
|
||||
@@ -363,52 +369,49 @@ SkipCRLF:
|
||||
GetToken2();
|
||||
|
||||
if (this.rtf_class == TokenClass.Text) {
|
||||
if (encoding == null)
|
||||
this.minor = (Minor)this.cur_charset[(int)this.major];
|
||||
if (encoding == null) {
|
||||
encoding = Encoding.GetEncoding (encoding_code_page);
|
||||
}
|
||||
encoded_text = new String (encoding.GetChars (new byte [] { (byte) this.major }));
|
||||
} else if (CheckCMM (TokenClass.Control, Major.Unicode, Minor.UnicodeAnsiCodepage)) {
|
||||
}
|
||||
|
||||
if (this.cur_charset.Flags == CharsetFlags.None) {
|
||||
return this.rtf_class;
|
||||
}
|
||||
|
||||
if (CheckCMM (TokenClass.Control, Major.Unicode, Minor.UnicodeAnsiCodepage)) {
|
||||
encoding_code_page = param;
|
||||
|
||||
// fallback to the default one in case we have an invalid value
|
||||
if (encoding_code_page < 0 || encoding_code_page > 65535)
|
||||
encoding_code_page = DefaultEncodingCodePage;
|
||||
}
|
||||
|
||||
encoding = null;
|
||||
} else if (CheckCMM(TokenClass.Control, Major.CharAttr, Minor.FontNum)) {
|
||||
if (((this.cur_charset.Flags & CharsetFlags.Read) != 0) && CheckCM(TokenClass.Control, Major.CharSet)) {
|
||||
this.cur_charset.ReadMap();
|
||||
} else if (((this.cur_charset.Flags & CharsetFlags.Switch) != 0) && CheckCMM(TokenClass.Control, Major.CharAttr, Minor.FontNum)) {
|
||||
Font fp;
|
||||
|
||||
fp = Font.GetFont(this.fonts, this.param);
|
||||
fp = Font.GetFont(this.font_list, this.param);
|
||||
|
||||
if (fp != null) {
|
||||
if (fp.Codepage != 0) {
|
||||
if (fp.Codepage != encoding_code_page) {
|
||||
encoding_code_page = fp.Codepage;
|
||||
encoding = null;
|
||||
}
|
||||
if (fp.Name.StartsWith("Symbol")) {
|
||||
this.cur_charset.ID = CharsetType.Symbol;
|
||||
} else {
|
||||
var cp = CharsetToCodepage.Translate (fp.Charset);
|
||||
if (cp != 0 && cp != encoding_code_page) {
|
||||
encoding_code_page = cp;
|
||||
encoding = null;
|
||||
this.cur_charset.ID = CharsetType.General;
|
||||
}
|
||||
} else if (((this.cur_charset.Flags & CharsetFlags.Switch) != 0) && (this.rtf_class == TokenClass.Group)) {
|
||||
switch(this.major) {
|
||||
case Major.BeginGroup: {
|
||||
this.charset_stack.Push(this.cur_charset);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (this.rtf_class == TokenClass.Group) {
|
||||
switch(this.major) {
|
||||
case Major.BeginGroup: {
|
||||
charset_stack.Push(encoding_code_page);
|
||||
break;
|
||||
}
|
||||
|
||||
case Major.EndGroup: {
|
||||
if (charset_stack.Count > 0) {
|
||||
encoding_code_page = (int)this.charset_stack.Pop();
|
||||
} else {
|
||||
encoding_code_page = DefaultEncodingCodePage;
|
||||
case Major.EndGroup: {
|
||||
this.cur_charset = (Charset)this.charset_stack.Pop();
|
||||
break;
|
||||
}
|
||||
if (encoding != null && encoding.CodePage != encoding_code_page)
|
||||
encoding = null;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -674,10 +677,7 @@ SkipCRLF:
|
||||
|
||||
font = new Font(rtf);
|
||||
|
||||
int depth = 0;
|
||||
string untaggedName = null;
|
||||
|
||||
while ((rtf.rtf_class != TokenClass.EOF) && (!rtf.CheckCM(TokenClass.Text, (Major)';')) && depth >= 0) {
|
||||
while ((rtf.rtf_class != TokenClass.EOF) && (!rtf.CheckCM(TokenClass.Text, (Major)';')) && (!rtf.CheckCM(TokenClass.Group, Major.EndGroup))) {
|
||||
if (rtf.rtf_class == TokenClass.Control) {
|
||||
switch(rtf.major) {
|
||||
case Major.FontFamily: {
|
||||
@@ -734,26 +734,6 @@ SkipCRLF:
|
||||
break;
|
||||
}
|
||||
|
||||
case Major.Destination: {
|
||||
switch (rtf.minor) {
|
||||
case Minor.FontName:
|
||||
untaggedName = ReadFontName (rtf);
|
||||
break;
|
||||
|
||||
case Minor.FontAltName:
|
||||
font.AltName = ReadFontName (rtf);
|
||||
break;
|
||||
|
||||
default: {
|
||||
#if RTF_DEBUG
|
||||
Console.WriteLine ("Got unhandled Control.Destination.Minor: " + rtf.minor);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
#if RTF_DEBUG
|
||||
Console.WriteLine("ReadFontTbl: Unknown Control token " + rtf.major);
|
||||
@@ -762,12 +742,22 @@ SkipCRLF:
|
||||
}
|
||||
}
|
||||
} else if (rtf.CheckCM(TokenClass.Group, Major.BeginGroup)) {
|
||||
depth++;
|
||||
} else if (rtf.CheckCM(TokenClass.Group, Major.EndGroup)) {
|
||||
depth--;
|
||||
} else if (rtf.rtf_class == TokenClass.Text)
|
||||
{
|
||||
font.Name = ReadFontName (rtf);
|
||||
rtf.SkipGroup();
|
||||
} else if (rtf.rtf_class == TokenClass.Text) {
|
||||
StringBuilder sb;
|
||||
|
||||
sb = new StringBuilder();
|
||||
|
||||
while ((rtf.rtf_class != TokenClass.EOF) && (!rtf.CheckCM(TokenClass.Text, (Major)';')) && (!rtf.CheckCM(TokenClass.Group, Major.EndGroup)) && (!rtf.CheckCM(TokenClass.Group, Major.BeginGroup))) {
|
||||
sb.Append((char)rtf.major);
|
||||
rtf.GetToken();
|
||||
}
|
||||
|
||||
if (rtf.CheckCM(TokenClass.Group, Major.EndGroup)) {
|
||||
rtf.UngetToken();
|
||||
}
|
||||
|
||||
font.Name = sb.ToString();
|
||||
continue;
|
||||
#if RTF_DEBUG
|
||||
} else {
|
||||
@@ -778,9 +768,6 @@ SkipCRLF:
|
||||
rtf.GetToken();
|
||||
}
|
||||
|
||||
if (untaggedName != null)
|
||||
font.Name = untaggedName;
|
||||
|
||||
if (old == 0) {
|
||||
rtf.GetToken();
|
||||
|
||||
@@ -801,26 +788,6 @@ SkipCRLF:
|
||||
rtf.RouteToken();
|
||||
}
|
||||
|
||||
private static String ReadFontName(RTF rtf)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder ();
|
||||
|
||||
while (rtf.rtf_class != TokenClass.EOF && rtf.rtf_class != TokenClass.Text)
|
||||
rtf.GetToken ();
|
||||
|
||||
while ((rtf.rtf_class != TokenClass.EOF) && (!rtf.CheckCM (TokenClass.Text, (Major)';')) && (!rtf.CheckCM(TokenClass.Group, Major.EndGroup)) &&
|
||||
(!rtf.CheckCM (TokenClass.Group, Major.BeginGroup))) {
|
||||
sb.Append ((char)rtf.major);
|
||||
rtf.GetToken ();
|
||||
}
|
||||
|
||||
if (rtf.CheckCM (TokenClass.Group, Major.EndGroup)) {
|
||||
rtf.UngetToken();
|
||||
}
|
||||
|
||||
return sb.ToString ();
|
||||
}
|
||||
|
||||
private void ReadColorTbl(RTF rtf) {
|
||||
Color color;
|
||||
int num;
|
||||
@@ -976,25 +943,20 @@ SkipCRLF:
|
||||
private void ReadPictGroup(RTF rtf)
|
||||
{
|
||||
bool read_image_data = false;
|
||||
int groupDepth = 0;
|
||||
|
||||
Picture picture = new Picture ();
|
||||
while (true) {
|
||||
rtf.GetToken ();
|
||||
|
||||
if (rtf.CheckCM (TokenClass.Group, Major.BeginGroup))
|
||||
groupDepth++;
|
||||
|
||||
if (rtf.CheckCM (TokenClass.Group, Major.EndGroup))
|
||||
groupDepth--;
|
||||
|
||||
if (groupDepth < 0)
|
||||
break;
|
||||
|
||||
switch (minor) {
|
||||
case Minor.PngBlip:
|
||||
case Minor.JpegBlip:
|
||||
picture.ImageType = minor;
|
||||
read_image_data = true;
|
||||
break;
|
||||
case Minor.WinMetafile:
|
||||
case Minor.EnhancedMetafile:
|
||||
picture.ImageType = minor;
|
||||
read_image_data = true;
|
||||
continue;
|
||||
@@ -1085,33 +1047,10 @@ SkipCRLF:
|
||||
}
|
||||
}
|
||||
|
||||
private void ReadObjGroup (RTF rtf)
|
||||
{
|
||||
int level;
|
||||
|
||||
level = 1;
|
||||
|
||||
while (GetToken () != TokenClass.EOF && this.minor != Minor.ObjResult) {
|
||||
if (rtf_class == TokenClass.Group) {
|
||||
if (this.major == Major.BeginGroup) {
|
||||
level++;
|
||||
} else if (this.major == Major.EndGroup) {
|
||||
level--;
|
||||
if (level < 1) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (level >= 1) {
|
||||
GetToken ();
|
||||
|
||||
if (rtf_class == TokenClass.Group)
|
||||
GetToken ();
|
||||
rtf.RouteToken ();
|
||||
}
|
||||
private void ReadObjGroup(RTF rtf) {
|
||||
rtf.SkipGroup();
|
||||
rtf.RouteToken();
|
||||
}
|
||||
#endregion // Default Delegates
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,392 @@
|
||||
// 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 substantial 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.
|
||||
//
|
||||
// Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
|
||||
//
|
||||
// Authors:
|
||||
// Peter Bartok ([email protected])
|
||||
//
|
||||
//
|
||||
|
||||
// COMPLETE
|
||||
|
||||
namespace System.Windows.Forms.RTF {
|
||||
|
||||
#if RTF_LIB
|
||||
public
|
||||
#else
|
||||
internal
|
||||
#endif
|
||||
enum StandardCharCode {
|
||||
nothing = 0,
|
||||
space = 1,
|
||||
exclam = 2,
|
||||
quotedbl = 3,
|
||||
numbersign = 4,
|
||||
dollar = 5,
|
||||
percent = 6,
|
||||
ampersand = 7,
|
||||
quoteright = 8,
|
||||
parenleft = 9,
|
||||
parenright = 10,
|
||||
asterisk = 11,
|
||||
plus = 12,
|
||||
comma = 13,
|
||||
hyphen = 14,
|
||||
period = 15,
|
||||
slash = 16,
|
||||
zero = 17,
|
||||
one = 18,
|
||||
two = 19,
|
||||
three = 20,
|
||||
four = 21,
|
||||
five = 22,
|
||||
six = 23,
|
||||
seven = 24,
|
||||
eight = 25,
|
||||
nine = 26,
|
||||
colon = 27,
|
||||
semicolon = 28,
|
||||
less = 29,
|
||||
equal = 30,
|
||||
greater = 31,
|
||||
question = 32,
|
||||
at = 33,
|
||||
A = 34,
|
||||
B = 35,
|
||||
C = 36,
|
||||
D = 37,
|
||||
E = 38,
|
||||
F = 39,
|
||||
G = 40,
|
||||
H = 41,
|
||||
I = 42,
|
||||
J = 43,
|
||||
K = 44,
|
||||
L = 45,
|
||||
M = 46,
|
||||
N = 47,
|
||||
O = 48,
|
||||
P = 49,
|
||||
Q = 50,
|
||||
R = 51,
|
||||
S = 52,
|
||||
T = 53,
|
||||
U = 54,
|
||||
V = 55,
|
||||
W = 56,
|
||||
X = 57,
|
||||
Y = 58,
|
||||
Z = 59,
|
||||
bracketleft = 60,
|
||||
backslash = 61,
|
||||
bracketright = 62,
|
||||
asciicircum = 63,
|
||||
underscore = 64,
|
||||
quoteleft = 65,
|
||||
a = 66,
|
||||
b = 67,
|
||||
c = 68,
|
||||
d = 69,
|
||||
e = 70,
|
||||
f = 71,
|
||||
g = 72,
|
||||
h = 73,
|
||||
i = 74,
|
||||
j = 75,
|
||||
k = 76,
|
||||
l = 77,
|
||||
m = 78,
|
||||
n = 79,
|
||||
o = 80,
|
||||
p = 81,
|
||||
q = 82,
|
||||
r = 83,
|
||||
s = 84,
|
||||
t = 85,
|
||||
u = 86,
|
||||
v = 87,
|
||||
w = 88,
|
||||
x = 89,
|
||||
y = 90,
|
||||
z = 91,
|
||||
braceleft = 92,
|
||||
bar = 93,
|
||||
braceright = 94,
|
||||
asciitilde = 95,
|
||||
exclamdown = 96,
|
||||
cent = 97,
|
||||
sterling = 98,
|
||||
fraction = 99,
|
||||
yen = 100,
|
||||
florin = 101,
|
||||
section = 102,
|
||||
currency = 103,
|
||||
quotedblleft = 104,
|
||||
guillemotleft = 105,
|
||||
guilsinglleft = 106,
|
||||
guilsinglright = 107,
|
||||
fi = 108,
|
||||
fl = 109,
|
||||
endash = 110,
|
||||
dagger = 111,
|
||||
daggerdbl = 112,
|
||||
periodcentered = 113,
|
||||
paragraph = 114,
|
||||
bullet = 115,
|
||||
quotesinglbase = 116,
|
||||
quotedblbase = 117,
|
||||
quotedblright = 118,
|
||||
guillemotright = 119,
|
||||
ellipsis = 120,
|
||||
perthousand = 121,
|
||||
questiondown = 122,
|
||||
grave = 123,
|
||||
acute = 124,
|
||||
circumflex = 125,
|
||||
tilde = 126,
|
||||
macron = 127,
|
||||
breve = 128,
|
||||
dotaccent = 129,
|
||||
dieresis = 130,
|
||||
ring = 131,
|
||||
cedilla = 132,
|
||||
hungarumlaut = 133,
|
||||
ogonek = 134,
|
||||
caron = 135,
|
||||
emdash = 136,
|
||||
AE = 137,
|
||||
ordfeminine = 138,
|
||||
Lslash = 139,
|
||||
Oslash = 140,
|
||||
OE = 141,
|
||||
ordmasculine = 142,
|
||||
ae = 143,
|
||||
dotlessi = 144,
|
||||
lslash = 145,
|
||||
oslash = 146,
|
||||
oe = 147,
|
||||
germandbls = 148,
|
||||
Aacute = 149,
|
||||
Acircumflex = 150,
|
||||
Adieresis = 151,
|
||||
Agrave = 152,
|
||||
Aring = 153,
|
||||
Atilde = 154,
|
||||
Ccedilla = 155,
|
||||
Eacute = 156,
|
||||
Ecircumflex = 157,
|
||||
Edieresis = 158,
|
||||
Egrave = 159,
|
||||
Eth = 160,
|
||||
Iacute = 161,
|
||||
Icircumflex = 162,
|
||||
Idieresis = 163,
|
||||
Igrave = 164,
|
||||
Ntilde = 165,
|
||||
Oacute = 166,
|
||||
Ocircumflex = 167,
|
||||
Odieresis = 168,
|
||||
Ograve = 169,
|
||||
Otilde = 170,
|
||||
Scaron = 171,
|
||||
Thorn = 172,
|
||||
Uacute = 173,
|
||||
Ucircumflex = 174,
|
||||
Udieresis = 175,
|
||||
Ugrave = 176,
|
||||
Yacute = 177,
|
||||
Ydieresis = 178,
|
||||
aacute = 179,
|
||||
acircumflex = 180,
|
||||
adieresis = 181,
|
||||
agrave = 182,
|
||||
aring = 183,
|
||||
atilde = 184,
|
||||
brokenbar = 185,
|
||||
ccedilla = 186,
|
||||
copyright = 187,
|
||||
degree = 188,
|
||||
divide = 189,
|
||||
eacute = 190,
|
||||
ecircumflex = 191,
|
||||
edieresis = 192,
|
||||
egrave = 193,
|
||||
eth = 194,
|
||||
iacute = 195,
|
||||
icircumflex = 196,
|
||||
idieresis = 197,
|
||||
igrave = 198,
|
||||
logicalnot = 199,
|
||||
minus = 200,
|
||||
multiply = 201,
|
||||
ntilde = 202,
|
||||
oacute = 203,
|
||||
ocircumflex = 204,
|
||||
odieresis = 205,
|
||||
ograve = 206,
|
||||
onehalf = 207,
|
||||
onequarter = 208,
|
||||
onesuperior = 209,
|
||||
otilde = 210,
|
||||
plusminus = 211,
|
||||
registered = 212,
|
||||
thorn = 213,
|
||||
threequarters = 214,
|
||||
threesuperior = 215,
|
||||
trademark = 216,
|
||||
twosuperior = 217,
|
||||
uacute = 218,
|
||||
ucircumflex = 219,
|
||||
udieresis = 220,
|
||||
ugrave = 221,
|
||||
yacute = 222,
|
||||
ydieresis = 223,
|
||||
Alpha = 224,
|
||||
Beta = 225,
|
||||
Chi = 226,
|
||||
Delta = 227,
|
||||
Epsilon = 228,
|
||||
Phi = 229,
|
||||
Gamma = 230,
|
||||
Eta = 231,
|
||||
Iota = 232,
|
||||
Kappa = 233,
|
||||
Lambda = 234,
|
||||
Mu = 235,
|
||||
Nu = 236,
|
||||
Omicron = 237,
|
||||
Pi = 238,
|
||||
Theta = 239,
|
||||
Rho = 240,
|
||||
Sigma = 241,
|
||||
Tau = 242,
|
||||
Upsilon = 243,
|
||||
varUpsilon = 244,
|
||||
Omega = 245,
|
||||
Xi = 246,
|
||||
Psi = 247,
|
||||
Zeta = 248,
|
||||
alpha = 249,
|
||||
beta = 250,
|
||||
chi = 251,
|
||||
delta = 252,
|
||||
epsilon = 253,
|
||||
phi = 254,
|
||||
varphi = 255,
|
||||
gamma = 256,
|
||||
eta = 257,
|
||||
iota = 258,
|
||||
kappa = 259,
|
||||
lambda = 260,
|
||||
mu = 261,
|
||||
nu = 262,
|
||||
omicron = 263,
|
||||
pi = 264,
|
||||
varpi = 265,
|
||||
theta = 266,
|
||||
vartheta = 267,
|
||||
rho = 268,
|
||||
sigma = 269,
|
||||
varsigma = 270,
|
||||
tau = 271,
|
||||
upsilon = 272,
|
||||
omega = 273,
|
||||
xi = 274,
|
||||
psi = 275,
|
||||
zeta = 276,
|
||||
nobrkspace = 277,
|
||||
nobrkhyphen = 278,
|
||||
lessequal = 279,
|
||||
greaterequal = 280,
|
||||
infinity = 281,
|
||||
integral = 282,
|
||||
notequal = 283,
|
||||
radical = 284,
|
||||
radicalex = 285,
|
||||
approxequal = 286,
|
||||
apple = 287,
|
||||
partialdiff = 288,
|
||||
opthyphen = 289,
|
||||
formula = 290,
|
||||
lozenge = 291,
|
||||
universal = 292,
|
||||
existential = 293,
|
||||
suchthat = 294,
|
||||
congruent = 295,
|
||||
therefore = 296,
|
||||
perpendicular = 297,
|
||||
minute = 298,
|
||||
club = 299,
|
||||
diamond = 300,
|
||||
heart = 301,
|
||||
spade = 302,
|
||||
arrowboth = 303,
|
||||
arrowleft = 304,
|
||||
arrowup = 305,
|
||||
arrowright = 306,
|
||||
arrowdown = 307,
|
||||
second = 308,
|
||||
proportional = 309,
|
||||
equivalence = 310,
|
||||
arrowvertex = 311,
|
||||
arrowhorizex = 312,
|
||||
carriagereturn = 313,
|
||||
aleph = 314,
|
||||
Ifraktur = 315,
|
||||
Rfraktur = 316,
|
||||
weierstrass = 317,
|
||||
circlemultiply = 318,
|
||||
circleplus = 319,
|
||||
emptyset = 320,
|
||||
intersection = 321,
|
||||
union = 322,
|
||||
propersuperset = 323,
|
||||
reflexsuperset = 324,
|
||||
notsubset = 325,
|
||||
propersubset = 326,
|
||||
reflexsubset = 327,
|
||||
element = 328,
|
||||
notelement = 329,
|
||||
angle = 330,
|
||||
gradient = 331,
|
||||
product = 332,
|
||||
logicaland = 333,
|
||||
logicalor = 334,
|
||||
arrowdblboth = 335,
|
||||
arrowdblleft = 336,
|
||||
arrowdblup = 337,
|
||||
arrowdblright = 338,
|
||||
arrowdbldown = 339,
|
||||
angleleft = 340,
|
||||
registersans = 341,
|
||||
copyrightsans = 342,
|
||||
trademarksans = 343,
|
||||
angleright = 344,
|
||||
mathplus = 345,
|
||||
mathminus = 346,
|
||||
mathasterisk = 347,
|
||||
mathnumbersign = 348,
|
||||
dotmath = 349,
|
||||
mathequal = 350,
|
||||
mathtilde = 351,
|
||||
|
||||
MaxChar = 352
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,411 @@
|
||||
// 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 substantial 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.
|
||||
//
|
||||
// Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
|
||||
//
|
||||
// Authors:
|
||||
// Peter Bartok ([email protected])
|
||||
//
|
||||
//
|
||||
|
||||
// COMPLETE
|
||||
|
||||
namespace System.Windows.Forms.RTF {
|
||||
|
||||
#if RTF_LIB
|
||||
public
|
||||
#else
|
||||
internal
|
||||
#endif
|
||||
class StandardCharName {
|
||||
public static string[] Names = {
|
||||
"nothing",
|
||||
"space",
|
||||
"exclam",
|
||||
"quotedbl",
|
||||
"numbersign",
|
||||
"dollar",
|
||||
"percent",
|
||||
"ampersand",
|
||||
"quoteright",
|
||||
"parenleft",
|
||||
"parenright",
|
||||
"asterisk",
|
||||
"plus",
|
||||
"comma",
|
||||
"hyphen",
|
||||
"period",
|
||||
"slash",
|
||||
"zero",
|
||||
"one",
|
||||
"two",
|
||||
"three",
|
||||
"four",
|
||||
"five",
|
||||
"six",
|
||||
"seven",
|
||||
"eight",
|
||||
"nine",
|
||||
"colon",
|
||||
"semicolon",
|
||||
"less",
|
||||
"equal",
|
||||
"greater",
|
||||
"question",
|
||||
"at",
|
||||
"A",
|
||||
"B",
|
||||
"C",
|
||||
"D",
|
||||
"E",
|
||||
"F",
|
||||
"G",
|
||||
"H",
|
||||
"I",
|
||||
"J",
|
||||
"K",
|
||||
"L",
|
||||
"M",
|
||||
"N",
|
||||
"O",
|
||||
"P",
|
||||
"Q",
|
||||
"R",
|
||||
"S",
|
||||
"T",
|
||||
"U",
|
||||
"V",
|
||||
"W",
|
||||
"X",
|
||||
"Y",
|
||||
"Z",
|
||||
"bracketleft",
|
||||
"backslash",
|
||||
"bracketright",
|
||||
"asciicircum",
|
||||
"underscore",
|
||||
"quoteleft",
|
||||
"a",
|
||||
"b",
|
||||
"c",
|
||||
"d",
|
||||
"e",
|
||||
"f",
|
||||
"g",
|
||||
"h",
|
||||
"i",
|
||||
"j",
|
||||
"k",
|
||||
"l",
|
||||
"m",
|
||||
"n",
|
||||
"o",
|
||||
"p",
|
||||
"q",
|
||||
"r",
|
||||
"s",
|
||||
"t",
|
||||
"u",
|
||||
"v",
|
||||
"w",
|
||||
"x",
|
||||
"y",
|
||||
"z",
|
||||
"braceleft",
|
||||
"bar",
|
||||
"braceright",
|
||||
"asciitilde",
|
||||
"exclamdown",
|
||||
"cent",
|
||||
"sterling",
|
||||
"fraction",
|
||||
"yen",
|
||||
"florin",
|
||||
"section",
|
||||
"currency",
|
||||
"quotedblleft",
|
||||
"guillemotleft",
|
||||
"guilsinglleft",
|
||||
"guilsinglright",
|
||||
"fi",
|
||||
"fl",
|
||||
"endash",
|
||||
"dagger",
|
||||
"daggerdbl",
|
||||
"periodcentered",
|
||||
"paragraph",
|
||||
"bullet",
|
||||
"quotesinglbase",
|
||||
"quotedblbase",
|
||||
"quotedblright",
|
||||
"guillemotright",
|
||||
"ellipsis",
|
||||
"perthousand",
|
||||
"questiondown",
|
||||
"grave",
|
||||
"acute",
|
||||
"circumflex",
|
||||
"tilde",
|
||||
"macron",
|
||||
"breve",
|
||||
"dotaccent",
|
||||
"dieresis",
|
||||
"ring",
|
||||
"cedilla",
|
||||
"hungarumlaut",
|
||||
"ogonek",
|
||||
"caron",
|
||||
"emdash",
|
||||
"AE",
|
||||
"ordfeminine",
|
||||
"Lslash",
|
||||
"Oslash",
|
||||
"OE",
|
||||
"ordmasculine",
|
||||
"ae",
|
||||
"dotlessi",
|
||||
"lslash",
|
||||
"oslash",
|
||||
"oe",
|
||||
"germandbls",
|
||||
"Aacute",
|
||||
"Acircumflex",
|
||||
"Adieresis",
|
||||
"Agrave",
|
||||
"Aring",
|
||||
"Atilde",
|
||||
"Ccedilla",
|
||||
"Eacute",
|
||||
"Ecircumflex",
|
||||
"Edieresis",
|
||||
"Egrave",
|
||||
"Eth",
|
||||
"Iacute",
|
||||
"Icircumflex",
|
||||
"Idieresis",
|
||||
"Igrave",
|
||||
"Ntilde",
|
||||
"Oacute",
|
||||
"Ocircumflex",
|
||||
"Odieresis",
|
||||
"Ograve",
|
||||
"Otilde",
|
||||
"Scaron",
|
||||
"Thorn",
|
||||
"Uacute",
|
||||
"Ucircumflex",
|
||||
"Udieresis",
|
||||
"Ugrave",
|
||||
"Yacute",
|
||||
"Ydieresis",
|
||||
"aacute",
|
||||
"acircumflex",
|
||||
"adieresis",
|
||||
"agrave",
|
||||
"aring",
|
||||
"atilde",
|
||||
"brokenbar",
|
||||
"ccedilla",
|
||||
"copyright",
|
||||
"degree",
|
||||
"divide",
|
||||
"eacute",
|
||||
"ecircumflex",
|
||||
"edieresis",
|
||||
"egrave",
|
||||
"eth",
|
||||
"iacute",
|
||||
"icircumflex",
|
||||
"idieresis",
|
||||
"igrave",
|
||||
"logicalnot",
|
||||
"minus",
|
||||
"multiply",
|
||||
"ntilde",
|
||||
"oacute",
|
||||
"ocircumflex",
|
||||
"odieresis",
|
||||
"ograve",
|
||||
"onehalf",
|
||||
"onequarter",
|
||||
"onesuperior",
|
||||
"otilde",
|
||||
"plusminus",
|
||||
"registered",
|
||||
"thorn",
|
||||
"threequarters",
|
||||
"threesuperior",
|
||||
"trademark",
|
||||
"twosuperior",
|
||||
"uacute",
|
||||
"ucircumflex",
|
||||
"udieresis",
|
||||
"ugrave",
|
||||
"yacute",
|
||||
"ydieresis",
|
||||
"Alpha",
|
||||
"Beta",
|
||||
"Chi",
|
||||
"Delta",
|
||||
"Epsilon",
|
||||
"Phi",
|
||||
"Gamma",
|
||||
"Eta",
|
||||
"Iota",
|
||||
"Kappa",
|
||||
"Lambda",
|
||||
"Mu",
|
||||
"Nu",
|
||||
"Omicron",
|
||||
"Pi",
|
||||
"Theta",
|
||||
"Rho",
|
||||
"Sigma",
|
||||
"Tau",
|
||||
"Upsilon",
|
||||
"varUpsilon",
|
||||
"Omega",
|
||||
"Xi",
|
||||
"Psi",
|
||||
"Zeta",
|
||||
"alpha",
|
||||
"beta",
|
||||
"chi",
|
||||
"delta",
|
||||
"epsilon",
|
||||
"phi",
|
||||
"varphi",
|
||||
"gamma",
|
||||
"eta",
|
||||
"iota",
|
||||
"kappa",
|
||||
"lambda",
|
||||
"mu",
|
||||
"nu",
|
||||
"omicron",
|
||||
"pi",
|
||||
"varpi",
|
||||
"theta",
|
||||
"vartheta",
|
||||
"rho",
|
||||
"sigma",
|
||||
"varsigma",
|
||||
"tau",
|
||||
"upsilon",
|
||||
"omega",
|
||||
"xi",
|
||||
"psi",
|
||||
"zeta",
|
||||
"nobrkspace",
|
||||
"nobrkhyphen",
|
||||
"lessequal",
|
||||
"greaterequal",
|
||||
"infinity",
|
||||
"integral",
|
||||
"notequal",
|
||||
"radical",
|
||||
"radicalex",
|
||||
"approxequal",
|
||||
"apple",
|
||||
"partialdiff",
|
||||
"opthyphen",
|
||||
"formula",
|
||||
"lozenge",
|
||||
"universal",
|
||||
"existential",
|
||||
"suchthat",
|
||||
"congruent",
|
||||
"therefore",
|
||||
"perpendicular",
|
||||
"minute",
|
||||
"club",
|
||||
"diamond",
|
||||
"heart",
|
||||
"spade",
|
||||
"arrowboth",
|
||||
"arrowleft",
|
||||
"arrowup",
|
||||
"arrowright",
|
||||
"arrowdown",
|
||||
"second",
|
||||
"proportional",
|
||||
"equivalence",
|
||||
"arrowvertex",
|
||||
"arrowhorizex",
|
||||
"carriagereturn",
|
||||
"aleph",
|
||||
"Ifraktur",
|
||||
"Rfraktur",
|
||||
"weierstrass",
|
||||
"circlemultiply",
|
||||
"circleplus",
|
||||
"emptyset",
|
||||
"intersection",
|
||||
"union",
|
||||
"propersuperset",
|
||||
"reflexsuperset",
|
||||
"notsubset",
|
||||
"propersubset",
|
||||
"reflexsubset",
|
||||
"element",
|
||||
"notelement",
|
||||
"angle",
|
||||
"gradient",
|
||||
"product",
|
||||
"logicaland",
|
||||
"logicalor",
|
||||
"arrowdblboth",
|
||||
"arrowdblleft",
|
||||
"arrowdblup",
|
||||
"arrowdblright",
|
||||
"arrowdbldown",
|
||||
"angleleft",
|
||||
"registersans",
|
||||
"copyrightsans",
|
||||
"trademarksans",
|
||||
"angleright",
|
||||
"mathplus",
|
||||
"mathminus",
|
||||
"mathasterisk",
|
||||
"mathnumbersign",
|
||||
"dotmath",
|
||||
"mathequal",
|
||||
"mathtilde"
|
||||
};
|
||||
|
||||
/// <summary>Lookup name by ID</summary>
|
||||
public static string Name(int index) {
|
||||
if ((index < 0) || (index >= Names.Length)) {
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
return Names[index];
|
||||
}
|
||||
|
||||
/// <summary>Lookup ID by name (e.g. mathtilde)</summary>
|
||||
public static int ID(string name) {
|
||||
for (int i=0; i < Names.Length; i++) {
|
||||
if (name.Equals(Names[i])) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,440 @@
|
||||
// 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 substantial 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.
|
||||
//
|
||||
// Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
|
||||
//
|
||||
// Authors:
|
||||
// Peter Bartok ([email protected])
|
||||
//
|
||||
//
|
||||
|
||||
// This map is for convencience only, any app can create/use it's own
|
||||
// StdCharCode -> <text> table
|
||||
|
||||
using System.Collections;
|
||||
|
||||
namespace System.Windows.Forms.RTF {
|
||||
|
||||
#if RTF_LIB
|
||||
public
|
||||
#else
|
||||
internal
|
||||
#endif
|
||||
class TextMap {
|
||||
#region Local Variables
|
||||
private string[] table;
|
||||
#endregion // Local Variables
|
||||
|
||||
#region Public Constructors
|
||||
public TextMap() {
|
||||
table = new string[(int)StandardCharCode.MaxChar];
|
||||
|
||||
for (int i = 0; i < (int)StandardCharCode.MaxChar; i++) {
|
||||
table[i] = string.Empty;
|
||||
}
|
||||
}
|
||||
#endregion // Public Constructors
|
||||
|
||||
#region Public Instance Properties
|
||||
internal string this[StandardCharCode c] { // FIXME - this should be public, if the whole namespace was public (ie standalone RTF parser)
|
||||
get {
|
||||
return table[(int)c];
|
||||
}
|
||||
|
||||
set {
|
||||
table[(int)c] = value;
|
||||
}
|
||||
}
|
||||
|
||||
public string[] Table {
|
||||
get {
|
||||
return table;
|
||||
}
|
||||
}
|
||||
#endregion // Public Instance Properties
|
||||
|
||||
#region Public Static Methods
|
||||
public static void SetupStandardTable(string[] table)
|
||||
{
|
||||
/*
|
||||
table[(int)StandardCharCode.space] = " ";
|
||||
table[(int)StandardCharCode.exclam] = "!";
|
||||
table[(int)StandardCharCode.quotedbl] = "\"";
|
||||
table[(int)StandardCharCode.numbersign] = "#";
|
||||
table[(int)StandardCharCode.dollar] = "$";
|
||||
table[(int)StandardCharCode.percent] = "%";
|
||||
table[(int)StandardCharCode.ampersand] = "&";
|
||||
table[(int)StandardCharCode.quoteright] = "'";
|
||||
table[(int)StandardCharCode.parenleft] = "(";
|
||||
table[(int)StandardCharCode.parenright] = ")";
|
||||
table[(int)StandardCharCode.asterisk] = "*";
|
||||
table[(int)StandardCharCode.plus] = "+";
|
||||
table[(int)StandardCharCode.comma] = ",";
|
||||
table[(int)StandardCharCode.hyphen] = "-";
|
||||
table[(int)StandardCharCode.period] = ".";
|
||||
table[(int)StandardCharCode.slash] = "/";
|
||||
table[(int)StandardCharCode.zero] = "0";
|
||||
table[(int)StandardCharCode.one] = "1";
|
||||
table[(int)StandardCharCode.two] = "2";
|
||||
table[(int)StandardCharCode.three] = "3";
|
||||
table[(int)StandardCharCode.four] = "4";
|
||||
table[(int)StandardCharCode.five] = "5";
|
||||
table[(int)StandardCharCode.six] = "6";
|
||||
table[(int)StandardCharCode.seven] = "7";
|
||||
table[(int)StandardCharCode.eight] = "8";
|
||||
table[(int)StandardCharCode.nine] = "9";
|
||||
table[(int)StandardCharCode.colon] = ":";
|
||||
table[(int)StandardCharCode.semicolon] = ";";
|
||||
table[(int)StandardCharCode.less] = "<";
|
||||
table[(int)StandardCharCode.equal] = "=";
|
||||
table[(int)StandardCharCode.greater] = ">";
|
||||
table[(int)StandardCharCode.question] = "?";
|
||||
table[(int)StandardCharCode.at] = "@";
|
||||
table[(int)StandardCharCode.A] = "A";
|
||||
table[(int)StandardCharCode.B] = "B";
|
||||
table[(int)StandardCharCode.C] = "C";
|
||||
table[(int)StandardCharCode.D] = "D";
|
||||
table[(int)StandardCharCode.E] = "E";
|
||||
table[(int)StandardCharCode.F] = "F";
|
||||
table[(int)StandardCharCode.G] = "G";
|
||||
table[(int)StandardCharCode.H] = "H";
|
||||
table[(int)StandardCharCode.I] = "I";
|
||||
table[(int)StandardCharCode.J] = "J";
|
||||
table[(int)StandardCharCode.K] = "K";
|
||||
table[(int)StandardCharCode.L] = "L";
|
||||
table[(int)StandardCharCode.M] = "M";
|
||||
table[(int)StandardCharCode.N] = "N";
|
||||
table[(int)StandardCharCode.O] = "O";
|
||||
table[(int)StandardCharCode.P] = "P";
|
||||
table[(int)StandardCharCode.Q] = "Q";
|
||||
table[(int)StandardCharCode.R] = "R";
|
||||
table[(int)StandardCharCode.S] = "S";
|
||||
table[(int)StandardCharCode.T] = "T";
|
||||
table[(int)StandardCharCode.U] = "U";
|
||||
table[(int)StandardCharCode.V] = "V";
|
||||
table[(int)StandardCharCode.W] = "W";
|
||||
table[(int)StandardCharCode.X] = "X";
|
||||
table[(int)StandardCharCode.Y] = "Y";
|
||||
table[(int)StandardCharCode.Z] = "Z";
|
||||
table[(int)StandardCharCode.bracketleft] = "[";
|
||||
table[(int)StandardCharCode.backslash] = "\\";
|
||||
table[(int)StandardCharCode.bracketright] = "]";
|
||||
table[(int)StandardCharCode.asciicircum] = "^";
|
||||
table[(int)StandardCharCode.underscore] = "_";
|
||||
table[(int)StandardCharCode.quoteleft] = "`";
|
||||
table[(int)StandardCharCode.a] = "a";
|
||||
table[(int)StandardCharCode.b] = "b";
|
||||
table[(int)StandardCharCode.c] = "c";
|
||||
table[(int)StandardCharCode.d] = "d";
|
||||
table[(int)StandardCharCode.e] = "e";
|
||||
table[(int)StandardCharCode.f] = "f";
|
||||
table[(int)StandardCharCode.g] = "g";
|
||||
table[(int)StandardCharCode.h] = "h";
|
||||
table[(int)StandardCharCode.i] = "i";
|
||||
table[(int)StandardCharCode.j] = "j";
|
||||
table[(int)StandardCharCode.k] = "k";
|
||||
table[(int)StandardCharCode.l] = "l";
|
||||
table[(int)StandardCharCode.m] = "m";
|
||||
table[(int)StandardCharCode.n] = "n";
|
||||
table[(int)StandardCharCode.o] = "o";
|
||||
table[(int)StandardCharCode.p] = "p";
|
||||
table[(int)StandardCharCode.q] = "q";
|
||||
table[(int)StandardCharCode.r] = "r";
|
||||
table[(int)StandardCharCode.s] = "s";
|
||||
table[(int)StandardCharCode.t] = "t";
|
||||
table[(int)StandardCharCode.u] = "u";
|
||||
table[(int)StandardCharCode.v] = "v";
|
||||
table[(int)StandardCharCode.w] = "w";
|
||||
table[(int)StandardCharCode.x] = "x";
|
||||
table[(int)StandardCharCode.y] = "y";
|
||||
table[(int)StandardCharCode.z] = "z";
|
||||
table[(int)StandardCharCode.braceleft] = "{";
|
||||
table[(int)StandardCharCode.bar] = "|";
|
||||
table[(int)StandardCharCode.braceright] = "}";
|
||||
table[(int)StandardCharCode.asciitilde] = "~";
|
||||
table[(int)StandardCharCode.AE] = "AE";
|
||||
table[(int)StandardCharCode.OE] = "OE";
|
||||
table[(int)StandardCharCode.acute] = "'";
|
||||
table[(int)StandardCharCode.ae] = "ae";
|
||||
table[(int)StandardCharCode.angleleft] = "<";
|
||||
table[(int)StandardCharCode.angleright] = ">";
|
||||
table[(int)StandardCharCode.arrowboth] = "<->";
|
||||
table[(int)StandardCharCode.arrowdblboth] = "<=>";
|
||||
table[(int)StandardCharCode.arrowdblleft] = "<=";
|
||||
table[(int)StandardCharCode.arrowdblright] = "=>";
|
||||
table[(int)StandardCharCode.arrowleft] = "<-";
|
||||
table[(int)StandardCharCode.arrowright] = "->";
|
||||
table[(int)StandardCharCode.bullet] = "o";
|
||||
table[(int)StandardCharCode.cent] = "cent";
|
||||
table[(int)StandardCharCode.circumflex] = "^";
|
||||
table[(int)StandardCharCode.copyright] = "(c)";
|
||||
table[(int)StandardCharCode.copyrightsans] = "(c)";
|
||||
table[(int)StandardCharCode.degree] = "deg.";
|
||||
table[(int)StandardCharCode.divide] = "/";
|
||||
table[(int)StandardCharCode.dotlessi] = "i";
|
||||
table[(int)StandardCharCode.ellipsis] = "...";
|
||||
table[(int)StandardCharCode.emdash] = "--";
|
||||
table[(int)StandardCharCode.endash] = "-";
|
||||
table[(int)StandardCharCode.fi] = "fi";
|
||||
table[(int)StandardCharCode.fl] = "fl";
|
||||
table[(int)StandardCharCode.fraction] = "/";
|
||||
table[(int)StandardCharCode.germandbls] = "ss";
|
||||
table[(int)StandardCharCode.grave] = "`";
|
||||
table[(int)StandardCharCode.greaterequal] = ">=";
|
||||
table[(int)StandardCharCode.guillemotleft] = "<<";
|
||||
table[(int)StandardCharCode.guillemotright] = ">>";
|
||||
table[(int)StandardCharCode.guilsinglleft] = "<";
|
||||
table[(int)StandardCharCode.guilsinglright] = ">";
|
||||
table[(int)StandardCharCode.lessequal] = "<=";
|
||||
table[(int)StandardCharCode.logicalnot] = "~";
|
||||
table[(int)StandardCharCode.mathasterisk] = "*";
|
||||
table[(int)StandardCharCode.mathequal] = "=";
|
||||
table[(int)StandardCharCode.mathminus] = "-";
|
||||
table[(int)StandardCharCode.mathnumbersign] = "#";
|
||||
table[(int)StandardCharCode.mathplus] = "+";
|
||||
table[(int)StandardCharCode.mathtilde] = "~";
|
||||
table[(int)StandardCharCode.minus] = "-";
|
||||
table[(int)StandardCharCode.mu] = "u";
|
||||
table[(int)StandardCharCode.multiply] = "x";
|
||||
table[(int)StandardCharCode.nobrkhyphen] = "-";
|
||||
table[(int)StandardCharCode.nobrkspace] = "";
|
||||
table[(int)StandardCharCode.notequal] = "!=";
|
||||
table[(int)StandardCharCode.oe] = "oe";
|
||||
table[(int)StandardCharCode.onehalf] = "1/2";
|
||||
table[(int)StandardCharCode.onequarter] = "1/4";
|
||||
table[(int)StandardCharCode.periodcentered] = ".";
|
||||
table[(int)StandardCharCode.plusminus] = "+/-";
|
||||
table[(int)StandardCharCode.quotedblbase] = ",,";
|
||||
table[(int)StandardCharCode.quotedblleft] = "\"";
|
||||
table[(int)StandardCharCode.quotedblright] = "\"";
|
||||
table[(int)StandardCharCode.quotesinglbase] = ",";
|
||||
table[(int)StandardCharCode.registered] = "reg.";
|
||||
table[(int)StandardCharCode.registersans] = "reg.";
|
||||
table[(int)StandardCharCode.threequarters] = "3/4";
|
||||
table[(int)StandardCharCode.tilde] = "~";
|
||||
table[(int)StandardCharCode.trademark] = "(TM)";
|
||||
table[(int)StandardCharCode.trademarksans] = "(TM)";
|
||||
|
||||
table[(int)StandardCharCode.aacute] = "\xE0";
|
||||
table[(int)StandardCharCode.questiondown] = "\xBF";
|
||||
|
||||
table[(int)StandardCharCode.udieresis] = "\xFC";
|
||||
table[(int)StandardCharCode.Udieresis] = "\xDC";
|
||||
table[(int)StandardCharCode.odieresis] = "\xF6";
|
||||
table[(int)StandardCharCode.Odieresis] = "\xD6";
|
||||
*/
|
||||
|
||||
table [(int) StandardCharCode.formula] = "\x6";
|
||||
table [(int) StandardCharCode.nobrkhyphen] = "\x1e";
|
||||
table [(int) StandardCharCode.opthyphen] = "\x1f";
|
||||
table [(int) StandardCharCode.space] = " ";
|
||||
table [(int) StandardCharCode.exclam] = "!";
|
||||
table [(int) StandardCharCode.quotedbl] = "\"";
|
||||
table [(int) StandardCharCode.numbersign] = "#";
|
||||
table [(int) StandardCharCode.dollar] = "$";
|
||||
table [(int) StandardCharCode.percent] = "%";
|
||||
table [(int) StandardCharCode.ampersand] = "&";
|
||||
table [(int) StandardCharCode.parenleft] = "(";
|
||||
table [(int) StandardCharCode.parenright] = ")";
|
||||
table [(int) StandardCharCode.asterisk] = "*";
|
||||
table [(int) StandardCharCode.plus] = "+";
|
||||
table [(int) StandardCharCode.comma] = ",";
|
||||
table [(int) StandardCharCode.hyphen] = "-";
|
||||
table [(int) StandardCharCode.period] = ".";
|
||||
table [(int) StandardCharCode.slash] = "/";
|
||||
table [(int) StandardCharCode.zero] = "0";
|
||||
table [(int) StandardCharCode.one] = "1";
|
||||
table [(int) StandardCharCode.two] = "2";
|
||||
table [(int) StandardCharCode.three] = "3";
|
||||
table [(int) StandardCharCode.four] = "4";
|
||||
table [(int) StandardCharCode.five] = "5";
|
||||
table [(int) StandardCharCode.six] = "6";
|
||||
table [(int) StandardCharCode.seven] = "7";
|
||||
table [(int) StandardCharCode.eight] = "8";
|
||||
table [(int) StandardCharCode.nine] = "9";
|
||||
table [(int) StandardCharCode.colon] = ":";
|
||||
table [(int) StandardCharCode.semicolon] = ";";
|
||||
table [(int) StandardCharCode.less] = "<";
|
||||
table [(int) StandardCharCode.equal] = "=";
|
||||
table [(int) StandardCharCode.greater] = ">";
|
||||
table [(int) StandardCharCode.question] = "?";
|
||||
table [(int) StandardCharCode.at] = "@";
|
||||
table [(int) StandardCharCode.A] = "A";
|
||||
table [(int) StandardCharCode.B] = "B";
|
||||
table [(int) StandardCharCode.C] = "C";
|
||||
table [(int) StandardCharCode.D] = "D";
|
||||
table [(int) StandardCharCode.E] = "E";
|
||||
table [(int) StandardCharCode.F] = "F";
|
||||
table [(int) StandardCharCode.G] = "G";
|
||||
table [(int) StandardCharCode.H] = "H";
|
||||
table [(int) StandardCharCode.I] = "I";
|
||||
table [(int) StandardCharCode.J] = "J";
|
||||
table [(int) StandardCharCode.K] = "K";
|
||||
table [(int) StandardCharCode.L] = "L";
|
||||
table [(int) StandardCharCode.M] = "M";
|
||||
table [(int) StandardCharCode.N] = "N";
|
||||
table [(int) StandardCharCode.O] = "O";
|
||||
table [(int) StandardCharCode.P] = "P";
|
||||
table [(int) StandardCharCode.Q] = "Q";
|
||||
table [(int) StandardCharCode.R] = "R";
|
||||
table [(int) StandardCharCode.S] = "S";
|
||||
table [(int) StandardCharCode.T] = "T";
|
||||
table [(int) StandardCharCode.U] = "U";
|
||||
table [(int) StandardCharCode.V] = "V";
|
||||
table [(int) StandardCharCode.W] = "W";
|
||||
table [(int) StandardCharCode.X] = "X";
|
||||
table [(int) StandardCharCode.Y] = "Y";
|
||||
table [(int) StandardCharCode.Z] = "Z";
|
||||
table [(int) StandardCharCode.bracketleft] = "[";
|
||||
table [(int) StandardCharCode.backslash] = "\\";
|
||||
table [(int) StandardCharCode.bracketright] = "]";
|
||||
table [(int) StandardCharCode.asciicircum] = "^";
|
||||
table [(int) StandardCharCode.underscore] = "_";
|
||||
table [(int) StandardCharCode.quoteleft] = "`";
|
||||
table [(int) StandardCharCode.a] = "a";
|
||||
table [(int) StandardCharCode.b] = "b";
|
||||
table [(int) StandardCharCode.c] = "c";
|
||||
table [(int) StandardCharCode.d] = "d";
|
||||
table [(int) StandardCharCode.e] = "e";
|
||||
table [(int) StandardCharCode.f] = "f";
|
||||
table [(int) StandardCharCode.g] = "g";
|
||||
table [(int) StandardCharCode.h] = "h";
|
||||
table [(int) StandardCharCode.i] = "i";
|
||||
table [(int) StandardCharCode.j] = "j";
|
||||
table [(int) StandardCharCode.k] = "k";
|
||||
table [(int) StandardCharCode.l] = "l";
|
||||
table [(int) StandardCharCode.m] = "m";
|
||||
table [(int) StandardCharCode.n] = "n";
|
||||
table [(int) StandardCharCode.o] = "o";
|
||||
table [(int) StandardCharCode.p] = "p";
|
||||
table [(int) StandardCharCode.q] = "q";
|
||||
table [(int) StandardCharCode.r] = "r";
|
||||
table [(int) StandardCharCode.s] = "s";
|
||||
table [(int) StandardCharCode.t] = "t";
|
||||
table [(int) StandardCharCode.u] = "u";
|
||||
table [(int) StandardCharCode.v] = "v";
|
||||
table [(int) StandardCharCode.w] = "w";
|
||||
table [(int) StandardCharCode.x] = "x";
|
||||
table [(int) StandardCharCode.y] = "y";
|
||||
table [(int) StandardCharCode.z] = "z";
|
||||
table [(int) StandardCharCode.braceleft] = "{";
|
||||
table [(int) StandardCharCode.bar] = "|";
|
||||
table [(int) StandardCharCode.braceright] = "}";
|
||||
table [(int) StandardCharCode.asciitilde] = "~";
|
||||
table [(int) StandardCharCode.nobrkspace] = "\xa0";
|
||||
table [(int) StandardCharCode.exclamdown] = "\xa1";
|
||||
table [(int) StandardCharCode.cent] = "\xa2";
|
||||
table [(int) StandardCharCode.sterling] = "\xa3";
|
||||
table [(int) StandardCharCode.currency] = "\xa4";
|
||||
table [(int) StandardCharCode.yen] = "\xa5";
|
||||
table [(int) StandardCharCode.brokenbar] = "\xa6";
|
||||
table [(int) StandardCharCode.section] = "\xa7";
|
||||
table [(int) StandardCharCode.dieresis] = "\xa8";
|
||||
table [(int) StandardCharCode.copyright] = "\xa9";
|
||||
table [(int) StandardCharCode.ordfeminine] = "\xaa";
|
||||
table [(int) StandardCharCode.guillemotleft] = "\xab";
|
||||
table [(int) StandardCharCode.logicalnot] = "\xac";
|
||||
table [(int) StandardCharCode.opthyphen] = "\xad";
|
||||
table [(int) StandardCharCode.registered] = "\xae";
|
||||
table [(int) StandardCharCode.macron] = "\xaf";
|
||||
table [(int) StandardCharCode.degree] = "\xb0";
|
||||
table [(int) StandardCharCode.plusminus] = "\xb1";
|
||||
table [(int) StandardCharCode.twosuperior] = "\xb2";
|
||||
table [(int) StandardCharCode.threesuperior] = "\xb3";
|
||||
table [(int) StandardCharCode.acute] = "\xb4";
|
||||
table [(int) StandardCharCode.mu] = "\xb5";
|
||||
table [(int) StandardCharCode.paragraph] = "\xb6";
|
||||
table [(int) StandardCharCode.periodcentered] = "\xb7";
|
||||
table [(int) StandardCharCode.cedilla] = "\xb8";
|
||||
table [(int) StandardCharCode.onesuperior] = "\xb9";
|
||||
table [(int) StandardCharCode.ordmasculine] = "\xba";
|
||||
table [(int) StandardCharCode.guillemotright] = "\xbb";
|
||||
table [(int) StandardCharCode.onequarter] = "\xbc";
|
||||
table [(int) StandardCharCode.onehalf] = "\xbd";
|
||||
table [(int) StandardCharCode.threequarters] = "\xbe";
|
||||
table [(int) StandardCharCode.questiondown] = "\xbf";
|
||||
table [(int) StandardCharCode.Agrave] = "\xc0";
|
||||
table [(int) StandardCharCode.Aacute] = "\xc1";
|
||||
table [(int) StandardCharCode.Acircumflex] = "\xc2";
|
||||
table [(int) StandardCharCode.Atilde] = "\xc3";
|
||||
table [(int) StandardCharCode.Adieresis] = "\xc4";
|
||||
table [(int) StandardCharCode.Aring] = "\xc5";
|
||||
table [(int) StandardCharCode.AE] = "\xc6";
|
||||
table [(int) StandardCharCode.Ccedilla] = "\xc7";
|
||||
table [(int) StandardCharCode.Egrave] = "\xc8";
|
||||
table [(int) StandardCharCode.Eacute] = "\xc9";
|
||||
table [(int) StandardCharCode.Ecircumflex] = "\xca";
|
||||
table [(int) StandardCharCode.Edieresis] = "\xcb";
|
||||
table [(int) StandardCharCode.Igrave] = "\xcc";
|
||||
table [(int) StandardCharCode.Iacute] = "\xcd";
|
||||
table [(int) StandardCharCode.Icircumflex] = "\xce";
|
||||
table [(int) StandardCharCode.Idieresis] = "\xcf";
|
||||
table [(int) StandardCharCode.Eth] = "\xd0";
|
||||
table [(int) StandardCharCode.Ntilde] = "\xd1";
|
||||
table [(int) StandardCharCode.Ograve] = "\xd2";
|
||||
table [(int) StandardCharCode.Oacute] = "\xd3";
|
||||
table [(int) StandardCharCode.Ocircumflex] = "\xd4";
|
||||
table [(int) StandardCharCode.Otilde] = "\xd5";
|
||||
table [(int) StandardCharCode.Odieresis] = "\xd6";
|
||||
table [(int) StandardCharCode.multiply] = "\xd7";
|
||||
table [(int) StandardCharCode.Oslash] = "\xd8";
|
||||
table [(int) StandardCharCode.Ugrave] = "\xd9";
|
||||
table [(int) StandardCharCode.Uacute] = "\xda";
|
||||
table [(int) StandardCharCode.Ucircumflex] = "\xdb";
|
||||
table [(int) StandardCharCode.Udieresis] = "\xdc";
|
||||
table [(int) StandardCharCode.Yacute] = "\xdd";
|
||||
table [(int) StandardCharCode.Thorn] = "\xde";
|
||||
table [(int) StandardCharCode.germandbls] = "\xdf";
|
||||
table [(int) StandardCharCode.agrave] = "\xe0";
|
||||
table [(int) StandardCharCode.aacute] = "\xe1";
|
||||
table [(int) StandardCharCode.acircumflex] = "\xe2";
|
||||
table [(int) StandardCharCode.atilde] = "\xe3";
|
||||
table [(int) StandardCharCode.adieresis] = "\xe4";
|
||||
table [(int) StandardCharCode.aring] = "\xe5";
|
||||
table [(int) StandardCharCode.ae] = "\xe6";
|
||||
table [(int) StandardCharCode.ccedilla] = "\xe7";
|
||||
table [(int) StandardCharCode.egrave] = "\xe8";
|
||||
table [(int) StandardCharCode.eacute] = "\xe9";
|
||||
table [(int) StandardCharCode.ecircumflex] = "\xea";
|
||||
table [(int) StandardCharCode.edieresis] = "\xeb";
|
||||
table [(int) StandardCharCode.igrave] = "\xec";
|
||||
table [(int) StandardCharCode.iacute] = "\xed";
|
||||
table [(int) StandardCharCode.icircumflex] = "\xee";
|
||||
table [(int) StandardCharCode.idieresis] = "\xef";
|
||||
table [(int) StandardCharCode.eth] = "\xf0";
|
||||
table [(int) StandardCharCode.ntilde] = "\xf1";
|
||||
table [(int) StandardCharCode.ograve] = "\xf2";
|
||||
table [(int) StandardCharCode.oacute] = "\xf3";
|
||||
table [(int) StandardCharCode.ocircumflex] = "\xf4";
|
||||
table [(int) StandardCharCode.otilde] = "\xf5";
|
||||
table [(int) StandardCharCode.odieresis] = "\xf6";
|
||||
table [(int) StandardCharCode.divide] = "\xf7";
|
||||
table [(int) StandardCharCode.oslash] = "\xf8";
|
||||
table [(int) StandardCharCode.ugrave] = "\xf9";
|
||||
table [(int) StandardCharCode.uacute] = "\xfa";
|
||||
table [(int) StandardCharCode.ucircumflex] = "\xfb";
|
||||
table [(int) StandardCharCode.udieresis] = "\xfc";
|
||||
table [(int) StandardCharCode.yacute] = "\xfd";
|
||||
table [(int) StandardCharCode.thorn] = "\xfe";
|
||||
table [(int) StandardCharCode.ydieresis] = "\xff";
|
||||
|
||||
}
|
||||
#endregion // Public Static Methods
|
||||
}
|
||||
}
|
||||
@@ -40,8 +40,6 @@ namespace System.Windows.Forms.Theming.Default
|
||||
|
||||
label.DrawImage (dc, label.Image, rect, label.ImageAlign);
|
||||
|
||||
rect.Height = Math.Max(rect.Height, label.Font.Height);
|
||||
|
||||
if (label.Enabled) {
|
||||
dc.DrawString (label.Text, label.Font,
|
||||
ThemeEngine.Current.ResPool.GetSolidBrush (label.ForeColor),
|
||||
|
||||
@@ -100,7 +100,9 @@
|
||||
<Compile Include="System.Windows.Forms.Layout\TableLayout.cs" />
|
||||
<Compile Include="System.Windows.Forms.Layout\TableLayoutSettingsTypeConverter.cs" />
|
||||
<Compile Include="System.Windows.Forms.PropertyGridInternal\PropertiesTab.cs" />
|
||||
<Compile Include="System.Windows.Forms.RTF\CharsetToCodepage.cs" />
|
||||
<Compile Include="System.Windows.Forms.RTF\Charcode.cs" />
|
||||
<Compile Include="System.Windows.Forms.RTF\Charset.cs" />
|
||||
<Compile Include="System.Windows.Forms.RTF\CharsetFlags.cs" />
|
||||
<Compile Include="System.Windows.Forms.RTF\CharsetType.cs" />
|
||||
<Compile Include="System.Windows.Forms.RTF\ClassDelegate.cs" />
|
||||
<Compile Include="System.Windows.Forms.RTF\Color.cs" />
|
||||
@@ -113,9 +115,12 @@
|
||||
<Compile Include="System.Windows.Forms.RTF\Picture.cs" />
|
||||
<Compile Include="System.Windows.Forms.RTF\RTF.cs" />
|
||||
<Compile Include="System.Windows.Forms.RTF\RTFException.cs" />
|
||||
<Compile Include="System.Windows.Forms.RTF\StandardCharCode.cs" />
|
||||
<Compile Include="System.Windows.Forms.RTF\StandardCharName.cs" />
|
||||
<Compile Include="System.Windows.Forms.RTF\Style.cs" />
|
||||
<Compile Include="System.Windows.Forms.RTF\StyleElement.cs" />
|
||||
<Compile Include="System.Windows.Forms.RTF\StyleType.cs" />
|
||||
<Compile Include="System.Windows.Forms.RTF\TextMap.cs" />
|
||||
<Compile Include="System.Windows.Forms.RTF\TokenClass.cs" />
|
||||
<Compile Include="System.Windows.Forms.Theming\Default\ButtonPainter.cs" />
|
||||
<Compile Include="System.Windows.Forms.Theming\Default\CheckBoxPainter.cs" />
|
||||
@@ -782,7 +787,6 @@
|
||||
<Compile Include="System.Windows.Forms\TabPage.cs" />
|
||||
<Compile Include="System.Windows.Forms\TabRenderer.cs" />
|
||||
<Compile Include="System.Windows.Forms\TabSizeMode.cs" />
|
||||
<Compile Include="System.Windows.Forms\TabStops.cs" />
|
||||
<Compile Include="System.Windows.Forms\TableLayoutCellPaintEventArgs.cs" />
|
||||
<Compile Include="System.Windows.Forms\TableLayoutCellPaintEventHandler.cs" />
|
||||
<Compile Include="System.Windows.Forms\TableLayoutColumnStyleCollection.cs" />
|
||||
|
||||
@@ -29,7 +29,9 @@ System.Windows.Forms.Design/WindowsFormsComponentEditor.cs
|
||||
System.Windows.Forms.Internal/Accessor.cs
|
||||
System.Windows.Forms.Internal/DebugHelper.cs
|
||||
System.Windows.Forms.PropertyGridInternal/PropertiesTab.cs
|
||||
System.Windows.Forms.RTF/CharsetToCodepage.cs
|
||||
System.Windows.Forms.RTF/Charcode.cs
|
||||
System.Windows.Forms.RTF/Charset.cs
|
||||
System.Windows.Forms.RTF/CharsetFlags.cs
|
||||
System.Windows.Forms.RTF/CharsetType.cs
|
||||
System.Windows.Forms.RTF/ClassDelegate.cs
|
||||
System.Windows.Forms.RTF/Color.cs
|
||||
@@ -42,9 +44,12 @@ System.Windows.Forms.RTF/Minor.cs
|
||||
System.Windows.Forms.RTF/Picture.cs
|
||||
System.Windows.Forms.RTF/RTF.cs
|
||||
System.Windows.Forms.RTF/RTFException.cs
|
||||
System.Windows.Forms.RTF/StandardCharCode.cs
|
||||
System.Windows.Forms.RTF/StandardCharName.cs
|
||||
System.Windows.Forms.RTF/Style.cs
|
||||
System.Windows.Forms.RTF/StyleElement.cs
|
||||
System.Windows.Forms.RTF/StyleType.cs
|
||||
System.Windows.Forms.RTF/TextMap.cs
|
||||
System.Windows.Forms.RTF/TokenClass.cs
|
||||
System.Windows.Forms.Theming/Default/LabelPainter.cs
|
||||
System.Windows.Forms.Theming/Default/LinkLabelPainter.cs
|
||||
@@ -652,7 +657,6 @@ System.Windows.Forms/TableLayoutRowStyleCollection.cs
|
||||
System.Windows.Forms/TableLayoutSettings.cs
|
||||
System.Windows.Forms/TableLayoutStyle.cs
|
||||
System.Windows.Forms/TableLayoutStyleCollection.cs
|
||||
System.Windows.Forms/TabStops.cs
|
||||
System.Windows.Forms/TextBox.cs
|
||||
System.Windows.Forms/TextBoxBase.cs
|
||||
System.Windows.Forms/TextBoxRenderer.cs
|
||||
|
||||
@@ -92,16 +92,14 @@ namespace System.Windows.Forms {
|
||||
#region Protected Methods
|
||||
protected override void OnClick (EventArgs e)
|
||||
{
|
||||
Form p = FindForm ();
|
||||
if (p != null) {
|
||||
p.dialog_result_changed = false; // manages the case where the DialogResult of the form is overriden in the button click event.
|
||||
base.OnClick (e);
|
||||
if (dialog_result != DialogResult.None && !p.dialog_result_changed) {
|
||||
if (dialog_result != DialogResult.None) {
|
||||
Form p = FindForm ();
|
||||
|
||||
if (p != null)
|
||||
p.DialogResult = dialog_result;
|
||||
}
|
||||
} else {
|
||||
base.OnClick (e);
|
||||
}
|
||||
|
||||
base.OnClick (e);
|
||||
}
|
||||
|
||||
protected override void OnFontChanged (EventArgs e)
|
||||
|
||||
@@ -1695,7 +1695,7 @@ namespace System.Windows.Forms
|
||||
}
|
||||
}
|
||||
|
||||
void SetSelectedIndex (int value, bool supressAutoScroll, bool triggerEvents = true)
|
||||
void SetSelectedIndex (int value, bool supressAutoScroll)
|
||||
{
|
||||
if (selected_index == value)
|
||||
return;
|
||||
@@ -1718,11 +1718,9 @@ namespace System.Windows.Forms
|
||||
if (listbox_ctrl != null)
|
||||
listbox_ctrl.HighlightedIndex = value;
|
||||
|
||||
if (triggerEvents) {
|
||||
OnSelectedValueChanged (EventArgs.Empty);
|
||||
OnSelectedIndexChanged (EventArgs.Empty);
|
||||
OnSelectedItemChanged (EventArgs.Empty);
|
||||
}
|
||||
OnSelectedValueChanged (EventArgs.Empty);
|
||||
OnSelectedIndexChanged (EventArgs.Empty);
|
||||
OnSelectedItemChanged (EventArgs.Empty);
|
||||
}
|
||||
|
||||
// If no item is currently selected, and an item is found matching the text
|
||||
@@ -2136,7 +2134,9 @@ namespace System.Windows.Forms
|
||||
throw new ArgumentOutOfRangeException ("index");
|
||||
|
||||
if (index < owner.SelectedIndex)
|
||||
owner.SetSelectedIndex (owner.SelectedIndex - 1, false, false);
|
||||
--owner.SelectedIndex;
|
||||
else if (index == owner.SelectedIndex)
|
||||
owner.SelectedIndex = -1;
|
||||
|
||||
object removed = object_items [index];
|
||||
|
||||
|
||||
@@ -35,23 +35,27 @@ namespace System.Windows.Forms
|
||||
[DefaultEvent ("Opening")]
|
||||
public class ContextMenuStrip : ToolStripDropDownMenu
|
||||
{
|
||||
internal Control AssociatedControl;
|
||||
Control source_control;
|
||||
internal Control container;
|
||||
|
||||
#region Public Construtors
|
||||
public ContextMenuStrip () : base ()
|
||||
{
|
||||
source_control = null;
|
||||
}
|
||||
|
||||
public ContextMenuStrip (IContainer container) : this ()
|
||||
public ContextMenuStrip (IContainer container) : base ()
|
||||
{
|
||||
// TODO: handle `container` argument
|
||||
source_control = null;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Public Properties
|
||||
[Browsable (false)]
|
||||
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
|
||||
public Control SourceControl { get; protected set; }
|
||||
public Control SourceControl {
|
||||
get { return this.source_control; }
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Protected Methods
|
||||
@@ -66,12 +70,11 @@ namespace System.Windows.Forms
|
||||
if (visible)
|
||||
XplatUI.SetTopmost (this.Handle, true);
|
||||
}
|
||||
|
||||
protected override void SetOwnerControl (Control control)
|
||||
{
|
||||
base.SetOwnerControl (control);
|
||||
SourceControl = control;
|
||||
}
|
||||
#endregion
|
||||
|
||||
internal void SetSourceControl (Control source_control)
|
||||
{
|
||||
container = this.source_control = source_control;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1246,7 +1246,7 @@ namespace System.Windows.Forms
|
||||
} else {
|
||||
if (!active_tracker.OnMouseDown (args)) {
|
||||
Control control = GetRealChildAtPoint (Cursor.Position);
|
||||
if (control != null && control.Visible && control.Enabled) {
|
||||
if (control != null) {
|
||||
Point pt = control.PointToClient (Cursor.Position);
|
||||
XplatUI.SendMessage (control.Handle,
|
||||
(Msg)m.Msg,
|
||||
@@ -1406,7 +1406,8 @@ namespace System.Windows.Forms
|
||||
if (background_image == null) {
|
||||
if (!tbstyle_flat) {
|
||||
Rectangle paintRect = pevent.ClipRectangle;
|
||||
pevent.Graphics.FillRectangle(BackColorBrush, paintRect);
|
||||
Brush pen = ThemeEngine.Current.ResPool.GetSolidBrush(BackColor);
|
||||
pevent.Graphics.FillRectangle(pen, paintRect);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -1416,8 +1417,8 @@ namespace System.Windows.Forms
|
||||
|
||||
void DrawBackgroundImage (Graphics g) {
|
||||
Rectangle drawing_rectangle = new Rectangle ();
|
||||
g.FillRectangle (BackColorBrush, ClientRectangle);
|
||||
|
||||
g.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (BackColor), ClientRectangle);
|
||||
|
||||
switch (backgroundimage_layout)
|
||||
{
|
||||
case ImageLayout.Tile:
|
||||
@@ -2266,9 +2267,6 @@ namespace System.Windows.Forms
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!is_visible || !is_enabled)
|
||||
return false;
|
||||
|
||||
parent = this;
|
||||
while (parent != null) {
|
||||
if (!parent.is_visible || !parent.is_enabled) {
|
||||
@@ -2425,7 +2423,7 @@ namespace System.Windows.Forms
|
||||
if (this.context_menu_strip != value) {
|
||||
this.context_menu_strip = value;
|
||||
if (value != null)
|
||||
value.AssociatedControl = this;
|
||||
value.container = this;
|
||||
OnContextMenuStripChanged (EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
@@ -3468,8 +3466,6 @@ namespace System.Windows.Forms
|
||||
}
|
||||
}
|
||||
|
||||
protected SolidBrush BackColorBrush => ThemeEngine.Current.ResPool.GetSolidBrush (BackColor);
|
||||
|
||||
#endregion // Protected Instance Properties
|
||||
|
||||
#region Public Static Methods
|
||||
@@ -4842,8 +4838,6 @@ namespace System.Windows.Forms
|
||||
XplatUI.SetVisible (Handle, is_visible, true);
|
||||
if (!is_visible) {
|
||||
if (parent != null && parent.IsHandleCreated) {
|
||||
if (InternalContainsFocus)
|
||||
parent.SelectNextControl(this, true, true, true, true);
|
||||
parent.Invalidate (bounds);
|
||||
parent.Update ();
|
||||
} else {
|
||||
@@ -5383,12 +5377,6 @@ namespace System.Windows.Forms
|
||||
}
|
||||
|
||||
private void WmMButtonUp (ref Message m) {
|
||||
// Menu handle.
|
||||
if (XplatUI.IsEnabled (Handle) && active_tracker != null) {
|
||||
ProcessActiveTracker (ref m);
|
||||
return;
|
||||
}
|
||||
|
||||
MouseEventArgs me;
|
||||
|
||||
me = new MouseEventArgs (FromParamToMouseButtons ((int) m.WParam.ToInt32()) | MouseButtons.Middle,
|
||||
@@ -5407,12 +5395,6 @@ namespace System.Windows.Forms
|
||||
}
|
||||
|
||||
private void WmMButtonDown (ref Message m) {
|
||||
// Menu handle.
|
||||
if (XplatUI.IsEnabled (Handle) && active_tracker != null) {
|
||||
ProcessActiveTracker (ref m);
|
||||
return;
|
||||
}
|
||||
|
||||
InternalCapture = true;
|
||||
OnMouseDown (new MouseEventArgs (FromParamToMouseButtons ((int) m.WParam.ToInt32()),
|
||||
mouse_clicks, LowOrder ((int) m.LParam.ToInt32 ()), HighOrder ((int) m.LParam.ToInt32 ()),
|
||||
@@ -5498,21 +5480,22 @@ namespace System.Windows.Forms
|
||||
return;
|
||||
}
|
||||
|
||||
// If there isn't a regular context menu, show the Strip version
|
||||
if (context_menu == null && context_menu_strip != null) {
|
||||
Point pt;
|
||||
// If there isn't a regular context menu, show the Strip version
|
||||
if (context_menu == null && context_menu_strip != null) {
|
||||
Point pt;
|
||||
|
||||
pt = new Point (LowOrder ((int)m.LParam.ToInt32 ()), HighOrder ((int)m.LParam.ToInt32 ()));
|
||||
|
||||
if (pt.X == -1 || pt.Y == -1) {
|
||||
pt.X = (this.Width / 2) + this.Left;
|
||||
pt.Y = (this.Height /2) + this.Top;
|
||||
pt = this.PointToScreen (pt);
|
||||
pt = new Point (LowOrder ((int)m.LParam.ToInt32 ()), HighOrder ((int)m.LParam.ToInt32 ()));
|
||||
|
||||
if (pt.X == -1 || pt.Y == -1) {
|
||||
pt.X = (this.Width / 2) + this.Left;
|
||||
pt.Y = (this.Height /2) + this.Top;
|
||||
pt = this.PointToScreen (pt);
|
||||
}
|
||||
|
||||
context_menu_strip.SetSourceControl (this);
|
||||
context_menu_strip.Show (this, PointToClient (pt));
|
||||
return;
|
||||
}
|
||||
|
||||
context_menu_strip.Show (this, PointToClient (pt));
|
||||
return;
|
||||
}
|
||||
DefWndProc(ref m);
|
||||
}
|
||||
|
||||
@@ -6499,6 +6482,7 @@ namespace System.Windows.Forms
|
||||
remove { Events.RemoveHandler (ContextMenuStripChangedEvent, value);}
|
||||
}
|
||||
|
||||
|
||||
[EditorBrowsable(EditorBrowsableState.Advanced)]
|
||||
[Browsable(true)]
|
||||
public event ControlEventHandler ControlAdded {
|
||||
|
||||
@@ -370,11 +370,11 @@ namespace System.Windows.Forms {
|
||||
ThemeEngine.Current.CPDrawContainerGrabHandle (graphics, bounds);
|
||||
}
|
||||
|
||||
public static void DrawFocusRectangle(Graphics graphics, Rectangle rectangle) {
|
||||
public static void DrawFocusRectangle( Graphics graphics, Rectangle rectangle) {
|
||||
DrawFocusRectangle(graphics, rectangle, SystemColors.Control, SystemColors.ControlText);
|
||||
}
|
||||
|
||||
public static void DrawFocusRectangle(Graphics graphics, Rectangle rectangle, Color foreColor, Color backColor) {
|
||||
public static void DrawFocusRectangle( Graphics graphics, Rectangle rectangle, Color foreColor, Color backColor) {
|
||||
|
||||
ThemeEngine.Current.CPDrawFocusRectangle (graphics, rectangle, foreColor, backColor);
|
||||
}
|
||||
|
||||
@@ -108,7 +108,6 @@ namespace System.Windows.Forms {
|
||||
cell.defaultNewRowValue = this.defaultNewRowValue;
|
||||
cell.description = this.description;
|
||||
cell.valueIsIcon = this.valueIsIcon;
|
||||
cell.imageLayout = this.imageLayout;
|
||||
return cell;
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,6 @@ namespace System.Windows.Forms
|
||||
clone.linkBehavior = this.linkBehavior;
|
||||
clone.visited_link_color = this.visited_link_color;
|
||||
clone.trackVisitedState = this.trackVisitedState;
|
||||
clone.useColumnTextForLinkValue = this.useColumnTextForLinkValue;
|
||||
|
||||
return clone;
|
||||
}
|
||||
|
||||
@@ -77,8 +77,7 @@ namespace System.Windows.Forms
|
||||
throw new InvalidOperationException ("CellTemplate is null when getting this property.");
|
||||
|
||||
template.ActiveLinkColor = value;
|
||||
if (DataGridView == null)
|
||||
return;
|
||||
|
||||
foreach (DataGridViewRow row in DataGridView.Rows) {
|
||||
DataGridViewLinkCell cell = row.Cells[Index] as DataGridViewLinkCell;
|
||||
if (cell != null)
|
||||
@@ -114,8 +113,6 @@ namespace System.Windows.Forms
|
||||
throw new InvalidOperationException ("CellTemplate is null when getting this property.");
|
||||
|
||||
template.LinkBehavior = value;
|
||||
if (DataGridView == null)
|
||||
return;
|
||||
foreach (DataGridViewRow row in DataGridView.Rows)
|
||||
{
|
||||
DataGridViewLinkCell cell = row.Cells[Index] as DataGridViewLinkCell;
|
||||
@@ -140,8 +137,6 @@ namespace System.Windows.Forms
|
||||
if (template == null)
|
||||
throw new InvalidOperationException ("CellTemplate is null when getting this property.");
|
||||
template.LinkColor = value;
|
||||
if (DataGridView == null)
|
||||
return;
|
||||
foreach (DataGridViewRow row in DataGridView.Rows)
|
||||
{
|
||||
DataGridViewLinkCell cell = row.Cells[Index] as DataGridViewLinkCell;
|
||||
@@ -155,20 +150,20 @@ namespace System.Windows.Forms
|
||||
[DefaultValue ((string) null)]
|
||||
public string Text {
|
||||
get {
|
||||
DataGridViewLinkCell template = CellTemplate as DataGridViewLinkCell;
|
||||
if (template == null)
|
||||
throw new InvalidOperationException ("CellTemplate is null when getting this property.");
|
||||
return text;
|
||||
}
|
||||
set {
|
||||
if (this.Text == value)
|
||||
return;
|
||||
DataGridViewLinkCell template = CellTemplate as DataGridViewLinkCell;
|
||||
if (template == null)
|
||||
throw new InvalidOperationException ("CellTemplate is null when getting this property.");
|
||||
//TODO : sets the Text property of every cell in the column
|
||||
//TODO only if UseColumnTextForLinkValue is true
|
||||
text = value;
|
||||
if (DataGridView == null)
|
||||
return;
|
||||
foreach (DataGridViewRow row in DataGridView.Rows)
|
||||
{
|
||||
DataGridViewLinkCell cell = row.Cells[Index] as DataGridViewLinkCell;
|
||||
if (cell != null && cell.UseColumnTextForLinkValue)
|
||||
cell.Value = value;
|
||||
}
|
||||
DataGridView.InvalidateColumn (Index);
|
||||
}
|
||||
}
|
||||
@@ -189,8 +184,6 @@ namespace System.Windows.Forms
|
||||
if (template == null)
|
||||
throw new InvalidOperationException ("CellTemplate is null when getting this property.");
|
||||
template.TrackVisitedState = value;
|
||||
if (DataGridView == null)
|
||||
return;
|
||||
foreach (DataGridViewRow row in DataGridView.Rows)
|
||||
{
|
||||
DataGridViewLinkCell cell = row.Cells[Index] as DataGridViewLinkCell;
|
||||
@@ -217,8 +210,6 @@ namespace System.Windows.Forms
|
||||
if (template == null)
|
||||
throw new InvalidOperationException ("CellTemplate is null when getting this property.");
|
||||
template.UseColumnTextForLinkValue = value;
|
||||
if (DataGridView == null)
|
||||
return;
|
||||
foreach (DataGridViewRow row in DataGridView.Rows)
|
||||
{
|
||||
DataGridViewLinkCell cell = row.Cells[Index] as DataGridViewLinkCell;
|
||||
@@ -244,8 +235,6 @@ namespace System.Windows.Forms
|
||||
if (template == null)
|
||||
throw new InvalidOperationException ("CellTemplate is null when getting this property.");
|
||||
template.VisitedLinkColor = value;
|
||||
if (DataGridView == null)
|
||||
return;
|
||||
foreach (DataGridViewRow row in DataGridView.Rows)
|
||||
{
|
||||
DataGridViewLinkCell cell = row.Cells[Index] as DataGridViewLinkCell;
|
||||
|
||||
@@ -102,7 +102,6 @@ namespace System.Windows.Forms {
|
||||
private bool autoscale_base_size_set;
|
||||
internal ArrayList disabled_by_showdialog = new ArrayList();
|
||||
internal static ArrayList modal_dialogs = new ArrayList();
|
||||
internal bool dialog_result_changed;
|
||||
#endregion // Local Variables
|
||||
|
||||
#region Private & Internal Methods
|
||||
@@ -201,11 +200,7 @@ namespace System.Windows.Forms {
|
||||
|
||||
internal override void UpdateWindowText ()
|
||||
{
|
||||
var old_clientsize = ClientSize;
|
||||
|
||||
if (!IsHandleCreated) {
|
||||
if (is_clientsize_set)
|
||||
ClientSize = old_clientsize;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -217,9 +212,6 @@ namespace System.Windows.Forms {
|
||||
}
|
||||
|
||||
XplatUI.Text (Handle, Text.Replace (Environment.NewLine, string.Empty));
|
||||
|
||||
if (ClientSize != old_clientsize)
|
||||
ClientSize = old_clientsize;
|
||||
}
|
||||
|
||||
internal void SelectActiveControl ()
|
||||
@@ -243,7 +235,7 @@ namespace System.Windows.Forms {
|
||||
|
||||
this.is_visible = visible;
|
||||
} else {
|
||||
SendControlFocus (ActiveControl);
|
||||
Select (ActiveControl);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -603,7 +595,7 @@ namespace System.Windows.Forms {
|
||||
set {
|
||||
if (control_box != value) {
|
||||
control_box = value;
|
||||
UpdateFormStyles();
|
||||
UpdateStyles();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -645,7 +637,6 @@ namespace System.Windows.Forms {
|
||||
typeof (DialogResult));
|
||||
|
||||
dialog_result = value;
|
||||
dialog_result_changed = true;
|
||||
if (dialog_result != DialogResult.None && is_modal)
|
||||
RaiseCloseEvents (false, false); // .Net doesn't send WM_CLOSE here.
|
||||
}
|
||||
@@ -669,10 +660,15 @@ namespace System.Windows.Forms {
|
||||
window_manager.UpdateBorderStyle (value);
|
||||
}
|
||||
|
||||
UpdateFormStyles();
|
||||
Size current_client_size = ClientSize;
|
||||
UpdateStyles();
|
||||
|
||||
if (this.IsHandleCreated)
|
||||
if (this.IsHandleCreated) {
|
||||
this.Size = InternalSizeFromClientSize (current_client_size);
|
||||
XplatUI.InvalidateNC (this.Handle);
|
||||
} else if (is_clientsize_set) {
|
||||
this.Size = InternalSizeFromClientSize (current_client_size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1101,8 +1097,6 @@ namespace System.Windows.Forms {
|
||||
XplatUI.SetOwner(this.window.Handle, IntPtr.Zero);
|
||||
}
|
||||
}
|
||||
// UIA Framework: Raises internal event
|
||||
OnUIAOwnerChanged ();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1126,7 +1120,7 @@ namespace System.Windows.Forms {
|
||||
set {
|
||||
if (this.show_icon != value ) {
|
||||
this.show_icon = value;
|
||||
UpdateFormStyles ();
|
||||
UpdateStyles ();
|
||||
|
||||
if (IsHandleCreated) {
|
||||
XplatUI.SetIcon (this.Handle, value == true ? this.Icon : null);
|
||||
@@ -2199,7 +2193,7 @@ namespace System.Windows.Forms {
|
||||
if (keyData == Keys.Enter) {
|
||||
IntPtr window = XplatUI.GetFocus ();
|
||||
Control c = Control.FromHandle (window);
|
||||
if (c is Button && c.Visible && c.Enabled && c.FindForm () == this) {
|
||||
if (c is Button && c.FindForm () == this) {
|
||||
((Button)c).PerformClick ();
|
||||
return true;
|
||||
}
|
||||
@@ -2896,13 +2890,6 @@ namespace System.Windows.Forms {
|
||||
is_loaded = true;
|
||||
}
|
||||
|
||||
private void UpdateFormStyles() {
|
||||
var old_clientsize = ClientSize;
|
||||
UpdateStyles();
|
||||
if ((!IsHandleCreated && is_clientsize_set) || ClientSize != old_clientsize)
|
||||
ClientSize = old_clientsize;
|
||||
}
|
||||
|
||||
private void UpdateMinMax()
|
||||
{
|
||||
var min_size = AutoSize ? new Size (Math.Max (minimum_auto_size.Width, minimum_size.Width), Math.Max (minimum_auto_size.Height, minimum_size.Height)) : minimum_size;
|
||||
@@ -3213,7 +3200,6 @@ namespace System.Windows.Forms {
|
||||
static object UIAMenuChangedEvent = new object ();
|
||||
static object UIATopMostChangedEvent = new object ();
|
||||
static object UIAWindowStateChangedEvent = new object ();
|
||||
static object UIAOwnerChangedEvent = new object ();
|
||||
|
||||
internal event EventHandler UIAMenuChanged {
|
||||
add { Events.AddHandler (UIAMenuChangedEvent, value); }
|
||||
@@ -3230,11 +3216,6 @@ namespace System.Windows.Forms {
|
||||
remove { Events.RemoveHandler (UIAWindowStateChangedEvent, value); }
|
||||
}
|
||||
|
||||
internal event EventHandler UIAOwnerChanged {
|
||||
add { Events.AddHandler (UIAOwnerChangedEvent, value); }
|
||||
remove { Events.RemoveHandler (UIAOwnerChangedEvent, value); }
|
||||
}
|
||||
|
||||
internal void OnUIAMenuChanged (EventArgs e)
|
||||
{
|
||||
EventHandler eh = (EventHandler) Events [UIAMenuChangedEvent];
|
||||
@@ -3255,13 +3236,6 @@ namespace System.Windows.Forms {
|
||||
if (eh != null)
|
||||
eh (this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
internal void OnUIAOwnerChanged ()
|
||||
{
|
||||
EventHandler eh = (EventHandler) Events [UIAOwnerChangedEvent];
|
||||
if (eh != null)
|
||||
eh (this, EventArgs.Empty);
|
||||
}
|
||||
#endregion // UIA Framework Events
|
||||
#endregion // Events
|
||||
}
|
||||
|
||||
@@ -307,12 +307,28 @@ namespace System.Windows.Forms
|
||||
#region Internal Methods
|
||||
internal override Size GetPreferredSizeCore (Size proposedSize)
|
||||
{
|
||||
// (Copied from Panel)
|
||||
// Translating 0, 0 from ClientSize to actual Size tells us how much space
|
||||
// is required for the borders.
|
||||
Size borderSize = SizeFromClientSize(Size.Empty);
|
||||
Size totalPadding = borderSize + Padding.Size;
|
||||
return LayoutEngine.GetPreferredSize(this, proposedSize - totalPadding) + totalPadding;
|
||||
Size retsize = new Size (Padding.Left, Padding.Top);
|
||||
|
||||
foreach (Control child in Controls) {
|
||||
if (child.Dock == DockStyle.Fill) {
|
||||
if (child.Bounds.Right > retsize.Width)
|
||||
retsize.Width = child.Bounds.Right;
|
||||
} else if (child.Dock != DockStyle.Top && child.Dock != DockStyle.Bottom && (child.Bounds.Right + child.Margin.Right) > retsize.Width)
|
||||
retsize.Width = child.Bounds.Right + child.Margin.Right;
|
||||
|
||||
if (child.Dock == DockStyle.Fill) {
|
||||
if (child.Bounds.Bottom > retsize.Height)
|
||||
retsize.Height = child.Bounds.Bottom;
|
||||
} else if (child.Dock != DockStyle.Left && child.Dock != DockStyle.Right && (child.Bounds.Bottom + child.Margin.Bottom) > retsize.Height)
|
||||
retsize.Height = child.Bounds.Bottom + child.Margin.Bottom;
|
||||
}
|
||||
|
||||
retsize.Width += Padding.Right;
|
||||
retsize.Height += Padding.Bottom;
|
||||
|
||||
retsize.Height += this.Font.Height;
|
||||
|
||||
return retsize;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
//
|
||||
// Authors:
|
||||
// Peter Bartok [email protected]
|
||||
// Karl Scowen <[email protected]>
|
||||
//
|
||||
//
|
||||
|
||||
@@ -45,20 +44,14 @@ namespace System.Windows.Forms
|
||||
internal int line_no; // Line number
|
||||
internal LineTag tags; // Tags describing the text
|
||||
internal int offset; // Baseline can be on the X or Y axis depending if we are in multiline mode or not
|
||||
internal int height; // Total height of the line, including TotalParagraphSpacing and LineSpacing
|
||||
private int textHeight; // Height of the line without spacing.
|
||||
internal int ascent; // Ascent of the line (highest distance above the baseline, including character offset)
|
||||
internal int height; // Height of the line (height of tallest tag)
|
||||
internal int ascent; // Ascent of the line (ascent of the tallest tag)
|
||||
internal HorizontalAlignment alignment; // Alignment of the line
|
||||
internal int align_shift; // Pixel shift caused by the alignment
|
||||
internal float indent; // Left indent for the first line
|
||||
internal float hanging_indent; // Hanging indent (difference between first line indent and other lines)
|
||||
internal float right_indent; // Right indent for all lines
|
||||
internal int indent; // Left indent for the first line
|
||||
internal int hanging_indent; // Hanging indent (left indent for all but the first line)
|
||||
internal int right_indent; // Right indent for all lines
|
||||
internal LineEnding ending;
|
||||
internal float spacing_before;
|
||||
internal float spacing_after;
|
||||
internal float line_spacing;
|
||||
internal bool line_spacing_multiple;
|
||||
internal TabStopCollection tab_stops; // Custom tabstops for this paragraph.
|
||||
|
||||
// Stuff that's important for the tree
|
||||
internal Line parent; // Our parent line
|
||||
@@ -93,11 +86,10 @@ namespace System.Windows.Forms
|
||||
text = new StringBuilder (Text, space);
|
||||
line_no = LineNo;
|
||||
this.ending = ending;
|
||||
tab_stops = new TabStopCollection();
|
||||
|
||||
widths = new float[space + 1];
|
||||
|
||||
|
||||
|
||||
tags = new LineTag(this, 1);
|
||||
tags.Font = font;
|
||||
tags.Color = color;
|
||||
@@ -111,7 +103,6 @@ namespace System.Windows.Forms
|
||||
line_no = LineNo;
|
||||
this.ending = ending;
|
||||
alignment = align;
|
||||
tab_stops = new TabStopCollection();
|
||||
|
||||
widths = new float[space + 1];
|
||||
|
||||
@@ -121,38 +112,6 @@ namespace System.Windows.Forms
|
||||
tags.Color = color;
|
||||
}
|
||||
|
||||
internal Line (Document document, int LineNo, string Text, HorizontalAlignment align, Font font, Color color,
|
||||
Color back_color, TextPositioning text_position, float char_offset, float left_indent, float hanging_indent,
|
||||
float right_indent, float spacing_before, float spacing_after, float line_spacing, bool line_spacing_multiple,
|
||||
TabStopCollection tab_stops, bool visible, LineEnding ending) : this(document, ending)
|
||||
{
|
||||
space = Text.Length > DEFAULT_TEXT_LEN ? Text.Length+1 : DEFAULT_TEXT_LEN;
|
||||
|
||||
text = new StringBuilder (Text, space);
|
||||
line_no = LineNo;
|
||||
this.ending = ending;
|
||||
alignment = align;
|
||||
indent = left_indent;
|
||||
HangingIndent = hanging_indent;
|
||||
this.right_indent = right_indent;
|
||||
this.spacing_before = spacing_before;
|
||||
this.spacing_after = spacing_after;
|
||||
this.tab_stops = tab_stops;
|
||||
this.line_spacing = line_spacing;
|
||||
this.line_spacing_multiple = line_spacing_multiple;
|
||||
|
||||
widths = new float[space + 1];
|
||||
|
||||
|
||||
tags = new LineTag(this, 1);
|
||||
tags.Font = font;
|
||||
tags.Color = color;
|
||||
tags.BackColor = back_color;
|
||||
tags.TextPosition = text_position;
|
||||
tags.CharOffset = char_offset;
|
||||
tags.Visible = visible;
|
||||
}
|
||||
|
||||
internal Line (Document document, int LineNo, string Text, LineTag tag, LineEnding ending) : this(document, ending)
|
||||
{
|
||||
space = Text.Length > DEFAULT_TEXT_LEN ? Text.Length+1 : DEFAULT_TEXT_LEN;
|
||||
@@ -178,10 +137,10 @@ namespace System.Windows.Forms
|
||||
}
|
||||
}
|
||||
|
||||
internal float HangingIndent {
|
||||
internal int HangingIndent {
|
||||
get { return hanging_indent; }
|
||||
set {
|
||||
this.hanging_indent = value;
|
||||
hanging_indent = value;
|
||||
recalc = true;
|
||||
}
|
||||
}
|
||||
@@ -192,63 +151,7 @@ namespace System.Windows.Forms
|
||||
set { height = value; }
|
||||
}
|
||||
|
||||
internal int TextHeight {
|
||||
get {
|
||||
return textHeight;
|
||||
}
|
||||
}
|
||||
|
||||
internal TabStopCollection TabStops {
|
||||
get { return tab_stops; }
|
||||
set { tab_stops = value; }
|
||||
}
|
||||
|
||||
internal float TotalParagraphSpacing {
|
||||
get {
|
||||
return SpacingBefore + SpacingAfter;
|
||||
}
|
||||
}
|
||||
|
||||
internal float LineSpacing {
|
||||
get {
|
||||
if (textHeight == 0) {
|
||||
throw new InvalidOperationException("Can't get LineSpacing when the line height isn't calculated!");
|
||||
}
|
||||
if (line_spacing < 0) {
|
||||
return -line_spacing;
|
||||
} else if (line_spacing_multiple) {
|
||||
return line_spacing * textHeight * 6f / document.Dpi;
|
||||
} else {
|
||||
return Math.Max(line_spacing, textHeight);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal float SpacingBefore {
|
||||
get {
|
||||
bool has_spacing = true;
|
||||
if (line_no > 1) {
|
||||
Line previous_line = document.GetLine(line_no - 1);
|
||||
if (previous_line != null && (previous_line.ending == LineEnding.Wrap || previous_line.ending == LineEnding.None))
|
||||
has_spacing = false;
|
||||
}
|
||||
if (has_spacing)
|
||||
return spacing_before;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
internal float SpacingAfter {
|
||||
get {
|
||||
if (ending == LineEnding.Wrap)
|
||||
return 0;
|
||||
else
|
||||
return spacing_after;
|
||||
}
|
||||
}
|
||||
|
||||
internal float Indent {
|
||||
internal int Indent {
|
||||
get { return indent; }
|
||||
set {
|
||||
indent = value;
|
||||
@@ -261,7 +164,7 @@ namespace System.Windows.Forms
|
||||
set { line_no = value; }
|
||||
}
|
||||
|
||||
internal float RightIndent {
|
||||
internal int RightIndent {
|
||||
get { return right_indent; }
|
||||
set {
|
||||
right_indent = value;
|
||||
@@ -351,7 +254,7 @@ namespace System.Windows.Forms
|
||||
return;
|
||||
|
||||
// Find the first tag that we are deleting from
|
||||
tag = FindTag (pos);
|
||||
tag = FindTag (pos + 1);
|
||||
|
||||
// Remove the characters from the line
|
||||
text.Remove (pos, count);
|
||||
@@ -368,10 +271,10 @@ namespace System.Windows.Forms
|
||||
left = count;
|
||||
|
||||
left -= tag.Start + tag.Length - pos - 1;
|
||||
tag = tag.Next;
|
||||
|
||||
// Update the start of each tag
|
||||
while ((tag.Next != null) && (left > 0)) {
|
||||
tag = tag.Next;
|
||||
while ((tag != null) && (left > 0)) {
|
||||
// Cache tag.Length as is will be indireclty modified
|
||||
// by changes to tag.Start
|
||||
int tag_length = tag.Length;
|
||||
@@ -381,6 +284,7 @@ namespace System.Windows.Forms
|
||||
left = 0;
|
||||
} else {
|
||||
left -= tag_length;
|
||||
tag = tag.Next;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -391,7 +295,15 @@ namespace System.Windows.Forms
|
||||
streamline = true;
|
||||
}
|
||||
|
||||
// Delete empty orphaned tags at the end
|
||||
LineTag walk = tag;
|
||||
while (walk != null && walk.Next != null && walk.Next.Length == 0) {
|
||||
LineTag t = walk;
|
||||
walk.Next = walk.Next.Next;
|
||||
if (walk.Next != null)
|
||||
walk.Next.Previous = t;
|
||||
walk = walk.Next;
|
||||
}
|
||||
|
||||
// Adjust the start point of any tags following
|
||||
if (tag != null) {
|
||||
@@ -402,15 +314,6 @@ namespace System.Windows.Forms
|
||||
}
|
||||
}
|
||||
|
||||
// Delete empty orphaned tags at the end. Do this after adjusting their starts, otherwise we might delete tags that acutally do have content.
|
||||
while (walk != null && walk.Next != null && walk.Next.Length == 0) {
|
||||
LineTag t = walk;
|
||||
walk.Next = walk.Next.Next;
|
||||
if (walk.Next != null)
|
||||
walk.Next.Previous = t;
|
||||
walk = walk.Next;
|
||||
}
|
||||
|
||||
recalc = true;
|
||||
|
||||
if (streamline)
|
||||
@@ -458,7 +361,7 @@ namespace System.Windows.Forms
|
||||
pos = text.Length - 1;
|
||||
|
||||
while (tag != null) {
|
||||
if (((tag.Start - 1) <= pos) && (pos < (tag.Start + tag.Length - 1)))
|
||||
if (((tag.Start - 1) <= pos) && (pos <= (tag.Start + tag.Length - 1)))
|
||||
return LineTag.GetFinalTag (tag);
|
||||
|
||||
tag = tag.Next;
|
||||
@@ -531,33 +434,6 @@ namespace System.Windows.Forms
|
||||
// Insert the text into the StringBuilder
|
||||
text.Insert (pos, s);
|
||||
|
||||
// Check that tag is still in use in the line. If not, then we choose the last tag at that position.
|
||||
LineTag t = tags;
|
||||
while (t != null) {
|
||||
if (((t.Start - 1) <= pos) && (pos < (t.End - 1) || (pos == t.End - 1 && t.Length == 0))) {
|
||||
// found the location
|
||||
bool foundTag = false;
|
||||
while (pos < (t.Start + t.Length - 1)) {
|
||||
if (t == tag) {
|
||||
foundTag = true;
|
||||
break;
|
||||
}
|
||||
if (t.Next == null)
|
||||
break;
|
||||
t = t.Next;
|
||||
}
|
||||
if (!foundTag) {
|
||||
if (pos < (t.Start + t.Length - 1)) {
|
||||
tag = t.Previous;
|
||||
} else {
|
||||
tag = t;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
t = t.Next;
|
||||
}
|
||||
|
||||
// Update the start position of every tag after this one
|
||||
tag = tag.Next;
|
||||
|
||||
@@ -578,95 +454,56 @@ namespace System.Windows.Forms
|
||||
/// returns true if lineheight changed
|
||||
/// </summary>
|
||||
internal bool RecalculateLine (Graphics g, Document doc)
|
||||
{
|
||||
return RecalculateLine (g, doc, kerning_fonts.ContainsKey (tags.Font.GetHashCode ()));
|
||||
}
|
||||
|
||||
private bool RecalculateLine (Graphics g, Document doc, bool handleKerning)
|
||||
{
|
||||
LineTag tag;
|
||||
int pos;
|
||||
int len;
|
||||
Font currentFont;
|
||||
int currentFontStart;
|
||||
SizeF size;
|
||||
float w;
|
||||
int prev_offset;
|
||||
bool retval;
|
||||
bool wrapped;
|
||||
bool first_in_para;
|
||||
Line line;
|
||||
int wrap_pos;
|
||||
int prev_wrap_pos;
|
||||
int prev_height;
|
||||
int prev_ascent;
|
||||
float prev_spacing_before;
|
||||
int max_above_baseline;
|
||||
int max_below_baseline;
|
||||
int total_ascent;
|
||||
int total_descent;
|
||||
TabStop lastTab;
|
||||
int lastTabPos;
|
||||
char c;
|
||||
bool handleKerning;
|
||||
float right_indent;
|
||||
float add_width;
|
||||
|
||||
pos = 0;
|
||||
len = this.text.Length;
|
||||
currentFont = tags.FontToDisplay;
|
||||
currentFontStart = 0;
|
||||
tag = this.tags;
|
||||
prev_offset = this.offset; // For drawing optimization calculations
|
||||
prev_height = this.height;
|
||||
prev_ascent = this.ascent;
|
||||
prev_spacing_before = this.SpacingBefore;
|
||||
max_above_baseline = 0;
|
||||
max_below_baseline = 0;
|
||||
total_ascent = 0;
|
||||
total_descent = 0;
|
||||
lastTab = null;
|
||||
lastTabPos = 0;
|
||||
this.height = 0; // Reset line height
|
||||
this.ascent = 0; // Reset the ascent for the line
|
||||
tag.Shift = 0; // Reset shift (which should be stored as pixels, not as points)
|
||||
right_indent = Math.Max(this.right_indent, 0); // Ignore any negative right indent.
|
||||
|
||||
if (line_no > 0) {
|
||||
line = doc.GetLine (LineNo - 1);
|
||||
first_in_para = line != null && line.ending != LineEnding.Wrap;
|
||||
} else {
|
||||
first_in_para = true;
|
||||
}
|
||||
|
||||
if (first_in_para)
|
||||
widths [0] = indent;
|
||||
if (ending == LineEnding.Wrap)
|
||||
widths[0] = document.left_margin + hanging_indent;
|
||||
else
|
||||
widths [0] = indent + hanging_indent;
|
||||
|
||||
if (widths [0] < 0)
|
||||
widths [0] = 0; // Don't allow a negative indent to take the line to a negative position.
|
||||
|
||||
widths [0] += document.left_margin;
|
||||
widths[0] = document.left_margin + indent;
|
||||
|
||||
this.recalc = false;
|
||||
retval = false;
|
||||
wrapped = false;
|
||||
|
||||
wrap_pos = 0;
|
||||
prev_wrap_pos = 0;
|
||||
|
||||
handleKerning = kerning_fonts.ContainsKey (currentFont.GetHashCode ());
|
||||
add_width = 0;
|
||||
|
||||
while (pos < len) {
|
||||
|
||||
while (tag.Length == 0) { // We should always have tags after a tag.length==0 unless len==0
|
||||
//tag.Ascent = 0;
|
||||
tag.Shift = (tag.Line.ascent - tag.Ascent); // / 72;
|
||||
tag.Shift = (tag.Line.ascent - tag.Ascent) / 72;
|
||||
tag = tag.Next;
|
||||
if (tag.Length != 0 && tag.FontToDisplay != currentFont) {
|
||||
CheckKerning (g, currentFont, currentFontStart, pos - currentFontStart);
|
||||
currentFont = tag.FontToDisplay;
|
||||
currentFontStart = pos;
|
||||
handleKerning = kerning_fonts.ContainsKey (currentFont.GetHashCode ());
|
||||
}
|
||||
}
|
||||
|
||||
c = text [pos];
|
||||
|
||||
// kerning is a problem. The original code in this method assumed that the
|
||||
// width of a string equals the sum of the widths of its characters. This is
|
||||
// not true when kerning takes place during the display process. Since it's
|
||||
@@ -683,103 +520,44 @@ namespace System.Windows.Forms
|
||||
// MeasureText doesn't measure trailing spaces, so we do the best we can for those
|
||||
// in the else branch.
|
||||
// It doesn't measure /t characters either, we need to add it manually with add_width.
|
||||
size = TextBoxTextRenderer.MeasureText (g, text.ToString (currentFontStart, pos + 1 - currentFontStart), currentFont);
|
||||
newWidth = widths [currentFontStart] + size.Width;
|
||||
size = TextBoxTextRenderer.MeasureText (g, text.ToString (0, pos + 1), tag.Font);
|
||||
newWidth = widths[0] + size.Width + add_width;
|
||||
}
|
||||
else if (c != '\t') {
|
||||
else
|
||||
{
|
||||
size = tag.SizeOfPosition (g, pos);
|
||||
w = size.Width;
|
||||
newWidth = widths[pos] + w;
|
||||
} else {
|
||||
CheckKerning (g, currentFont, currentFontStart, pos - currentFontStart);
|
||||
currentFontStart = pos + 1; // Don't try handling the tab along with kerned text.
|
||||
|
||||
if (lastTab != null) {
|
||||
ProcessLastTab (lastTab, lastTabPos, pos);
|
||||
lastTab = null;
|
||||
}
|
||||
|
||||
float l = widths [pos];
|
||||
w = -1;
|
||||
for (int i = 0; i < tab_stops.Count; i++) {
|
||||
if (tab_stops [i].Position > l) {
|
||||
lastTab = tab_stops [i];
|
||||
lastTabPos = pos;
|
||||
w = lastTab.GetInitialWidth (this, pos);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (w < 0) {
|
||||
w = tag.SizeOfPosition (g, pos).Width;
|
||||
}
|
||||
|
||||
newWidth = widths [pos] + w;
|
||||
if (text[pos] == '\t') add_width += w;
|
||||
}
|
||||
|
||||
if (doc.Wrap) {
|
||||
// FIXME: Technically there are multiple no-break spaces, not just the main one.
|
||||
if ((Char.IsWhiteSpace (c) && c != '\u00A0') || c == '-' || c == '\u2013' || c == '\u2014') {
|
||||
// Primarily break on dashes or whitespace other than a no-break space.
|
||||
prev_wrap_pos = wrap_pos;
|
||||
if (c == '\t') {
|
||||
wrap_pos = pos; // Wrap before tabs for some reason.
|
||||
} else {
|
||||
wrap_pos = pos + 1;
|
||||
}
|
||||
}
|
||||
if (Char.IsWhiteSpace (text[pos]))
|
||||
wrap_pos = pos + 1;
|
||||
|
||||
if (newWidth > (doc.viewport_width - this.right_indent)) {
|
||||
LineTag split_tag = null;
|
||||
if (wrap_pos > 0) {
|
||||
// Make sure to set the last width of the line before wrapping
|
||||
widths [pos + 1] = newWidth;
|
||||
if (doc.wrap) {
|
||||
if ((wrap_pos > 0) && (wrap_pos != len) && (newWidth + 5) > (doc.viewport_width - this.right_indent)) {
|
||||
// Make sure to set the last width of the line before wrapping
|
||||
widths[pos + 1] = newWidth;
|
||||
|
||||
if (Char.IsWhiteSpace (c)) {
|
||||
if (wrap_pos > pos) {
|
||||
while (wrap_pos < text.Length && Char.IsWhiteSpace (text [wrap_pos]) && text [wrap_pos] != '\t') {
|
||||
wrap_pos++;
|
||||
}
|
||||
pos++;
|
||||
wrapped = true;
|
||||
// don't try pulling more into this line, but keep looping to deal with the rest of the widths and tags
|
||||
}
|
||||
} else {
|
||||
if (wrap_pos > pos && pos > 0) {
|
||||
// We're at a dash (otherwise we'd be above), but don't have room to fit it in.
|
||||
// Wrap at the previous wrap point if possible.
|
||||
wrap_pos = prev_wrap_pos > 0 ? prev_wrap_pos : pos;
|
||||
}
|
||||
split_tag = tag;
|
||||
pos = wrap_pos;
|
||||
}
|
||||
} else if (pos > 0) {
|
||||
// No suitable wrap position was found so break right in the middle of a word
|
||||
pos = wrap_pos;
|
||||
len = text.Length;
|
||||
doc.Split (this, tag, pos);
|
||||
ending = LineEnding.Wrap;
|
||||
len = this.text.Length;
|
||||
|
||||
// Make sure to set the last width of the line before wrapping
|
||||
widths [pos + 1] = newWidth;
|
||||
retval = true;
|
||||
wrapped = true;
|
||||
} else if (pos > 1 && newWidth > (doc.viewport_width - this.right_indent)) {
|
||||
// No suitable wrap position was found so break right in the middle of a word
|
||||
|
||||
split_tag = tag;
|
||||
} // Else don't wrap -- pos == 0, so we'd infinite loop adding blank lines before this.
|
||||
// Make sure to set the last width of the line before wrapping
|
||||
widths[pos + 1] = newWidth;
|
||||
|
||||
if (split_tag != null) {
|
||||
if (lastTab != null) {
|
||||
ProcessLastTab (lastTab, lastTabPos, pos);
|
||||
lastTab = null;
|
||||
}
|
||||
|
||||
while (pos < split_tag.Start)
|
||||
split_tag = split_tag.Previous;
|
||||
// We have to pass Split the correct tag, and that can change if pos
|
||||
// is set somewhere before the tag change (e.g. by wrap_pos).
|
||||
|
||||
doc.Split (this, split_tag, pos);
|
||||
ending = LineEnding.Wrap;
|
||||
len = this.text.Length;
|
||||
|
||||
retval = true;
|
||||
wrapped = true;
|
||||
}
|
||||
doc.Split (this, tag, pos);
|
||||
ending = LineEnding.Wrap;
|
||||
len = this.text.Length;
|
||||
retval = true;
|
||||
wrapped = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -791,23 +569,12 @@ namespace System.Windows.Forms
|
||||
|
||||
if (pos == len) {
|
||||
line = doc.GetLine (this.line_no + 1);
|
||||
do {
|
||||
if ((line != null) && (ending == LineEnding.Wrap || ending == LineEnding.None) &&
|
||||
(widths[pos] < (doc.viewport_width - this.right_indent) || line.text.Length == 0)) {
|
||||
// Pull the two lines together
|
||||
// Only do this if the line isn't already full, or the next line is empty.
|
||||
var h = this.height; // Back up h, because Combine sets it to zero.
|
||||
doc.Combine (this, line);
|
||||
this.height = h; // And restore it. There's no point starting at the start again.
|
||||
// Document.Combine() called Line.Streamline(), so it is possible tag points a tag that got removed.
|
||||
tag = FindTag (pos - 1); // So make sure we've got the correct tag.
|
||||
len = this.text.Length;
|
||||
line = doc.GetLine (this.line_no + 1);
|
||||
retval = true;
|
||||
}
|
||||
} while ((ending == LineEnding.Wrap || ending == LineEnding.None) && line != null && line.text.Length == 0);
|
||||
// If the next line is empty, do it again (if possible).
|
||||
// The amount of room on this line doesn't matter when there's no text being added...
|
||||
if ((line != null) && (ending == LineEnding.Wrap || ending == LineEnding.None)) {
|
||||
// Pull the two lines together
|
||||
doc.Combine (this.line_no, this.line_no + 1);
|
||||
len = this.text.Length;
|
||||
retval = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -815,63 +582,54 @@ namespace System.Windows.Forms
|
||||
// We just found the end of our current tag
|
||||
tag.Height = tag.MaxHeight ();
|
||||
|
||||
/* line.ascent is the highest point above the baseline.
|
||||
* total_ascent will equal the maximum distance of the tag above the baseline.
|
||||
* total_descent is needed to calculate the line height.
|
||||
* tag.Shift does not include tag.CharOffset, because Shift puts the tag
|
||||
* on the baseline, while CharOffset moves the baseline.
|
||||
* However, we move the normal baseline when CharOffset is trying to push
|
||||
* stuff off the top.
|
||||
*/
|
||||
total_ascent = tag.Ascent + (int)tag.CharOffset;
|
||||
total_descent = tag.Descent - (int)tag.CharOffset; // gets bigger as CharOffset gets smaller
|
||||
if (total_ascent > max_above_baseline) {
|
||||
int moveBy = total_ascent - max_above_baseline;
|
||||
max_above_baseline = total_ascent;
|
||||
// Check if we're the tallest on the line (so far)
|
||||
if (tag.Height > this.height)
|
||||
this.height = tag.Height; // Yep; make sure the line knows
|
||||
|
||||
LineTag t = tags;
|
||||
if (tag.Ascent > this.ascent) {
|
||||
LineTag t;
|
||||
|
||||
// We have a tag that has a taller ascent than the line;
|
||||
t = tags;
|
||||
while (t != null && t != tag) {
|
||||
t.Shift += moveBy;
|
||||
t.Shift = (tag.Ascent - t.Ascent) / 72;
|
||||
t = t.Next;
|
||||
}
|
||||
|
||||
tag.Shift = (int)tag.CharOffset;
|
||||
this.ascent = max_above_baseline;
|
||||
// Save on our line
|
||||
this.ascent = tag.Ascent;
|
||||
} else {
|
||||
tag.Shift = (this.ascent - tag.Ascent);
|
||||
tag.Shift = (this.ascent - tag.Ascent) / 72;
|
||||
}
|
||||
|
||||
if (total_descent > max_below_baseline)
|
||||
max_below_baseline = total_descent;
|
||||
|
||||
if (this.height < max_above_baseline + max_below_baseline + tag.Height - tag.Ascent - tag.Descent)
|
||||
this.height = max_above_baseline + max_below_baseline + tag.Height - tag.Ascent - tag.Descent;
|
||||
|
||||
tag = tag.Next;
|
||||
if (tag != null) {
|
||||
if (tag.Length != 0 && tag.FontToDisplay != currentFont) {
|
||||
CheckKerning (g, currentFont, currentFontStart, pos - currentFontStart);
|
||||
currentFont = tag.FontToDisplay;
|
||||
currentFontStart = pos;
|
||||
handleKerning = kerning_fonts.ContainsKey (currentFont.GetHashCode ());
|
||||
}
|
||||
tag.Shift = 0;
|
||||
// We can't just wrap on tag boundaries -- e.g. if the first letter of the word has a different colour / font.
|
||||
wrap_pos = pos;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pos != currentFontStart) {
|
||||
CheckKerning (g, currentFont, currentFontStart, pos - currentFontStart);
|
||||
var fullText = text.ToString();
|
||||
if (!handleKerning && fullText.Length > 1 && !wrapped)
|
||||
{
|
||||
// Check whether kerning takes place for this string and font.
|
||||
var realSize = TextBoxTextRenderer.MeasureText(g, fullText, tags.Font);
|
||||
float realWidth = realSize.Width + widths[0];
|
||||
// MeasureText ignores trailing whitespace, so we will too at this point.
|
||||
int length = fullText.TrimEnd().Length;
|
||||
float sumWidth = widths[length];
|
||||
if (realWidth != sumWidth)
|
||||
{
|
||||
kerning_fonts.Add(tags.Font.GetHashCode (), true);
|
||||
// Using a slightly incorrect width this time around isn't that bad. All that happens
|
||||
// is that the cursor is a pixel or two off until the next character is typed. It's
|
||||
// the accumulation of pixel after pixel that causes display problems.
|
||||
}
|
||||
}
|
||||
|
||||
if (lastTab != null) {
|
||||
ProcessLastTab (lastTab, lastTabPos, pos);
|
||||
lastTab = null;
|
||||
}
|
||||
|
||||
while (tag != null) {
|
||||
tag.Shift = (tag.Line.ascent - tag.Ascent); // / 72;
|
||||
while (tag != null) {
|
||||
tag.Shift = (tag.Line.ascent - tag.Ascent) / 72;
|
||||
tag = tag.Next;
|
||||
}
|
||||
|
||||
@@ -881,49 +639,12 @@ namespace System.Windows.Forms
|
||||
tags.Shift = 0;
|
||||
}
|
||||
|
||||
this.textHeight = this.height;
|
||||
this.height = (int)(this.LineSpacing + this.TotalParagraphSpacing);
|
||||
|
||||
if (prev_offset != offset || prev_height != this.height || prev_ascent != this.ascent ||
|
||||
Math.Abs (prev_spacing_before - this.SpacingBefore) > document.Dpi / 1440f)
|
||||
if (prev_offset != offset || prev_height != this.height || prev_ascent != this.ascent)
|
||||
retval = true;
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
private void ProcessLastTab (TabStop tab, int tab_pos, int pos)
|
||||
{
|
||||
float prevTabRight = widths[tab_pos + 1];
|
||||
float tabRight = tab.CalculateRight (this, tab_pos);
|
||||
float change = tabRight - prevTabRight;
|
||||
|
||||
for (int i = tab_pos + 1; i <= pos; i++) {
|
||||
widths[i] += change;
|
||||
}
|
||||
}
|
||||
|
||||
private void CheckKerning (Graphics g, Font font, int start, int length)
|
||||
{
|
||||
if (length > 1) {
|
||||
if (!kerning_fonts.ContainsKey (font.GetHashCode ())) {
|
||||
// Check whether kerning takes place for this string and font.
|
||||
var partText = text.ToString(start, length);
|
||||
var realSize = TextBoxTextRenderer.MeasureText(g, partText, font);
|
||||
float realWidth = realSize.Width + widths[start + 1];
|
||||
// MeasureText ignores trailing whitespace, so we will too at this point.
|
||||
int textLength = partText.TrimEnd().Length;
|
||||
float sumWidth = widths[textLength + start + 1];
|
||||
if (realWidth != sumWidth)
|
||||
{
|
||||
kerning_fonts.Add(font.GetHashCode (), true);
|
||||
// Using a slightly incorrect width this time around isn't that bad. All that happens
|
||||
// is that the cursor is a pixel or two off until the next character is typed. It's
|
||||
// the accumulation of pixel after pixel that causes display problems.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recalculate a single line using the same char for every character in the line
|
||||
/// </summary>
|
||||
@@ -946,14 +667,13 @@ namespace System.Windows.Forms
|
||||
|
||||
w = TextBoxTextRenderer.MeasureText (g, doc.password_char, tags.Font).Width;
|
||||
|
||||
if (this.textHeight != (int)tag.Font.Height)
|
||||
if (this.height != (int)tag.Font.Height)
|
||||
ret = true;
|
||||
else
|
||||
ret = false;
|
||||
|
||||
this.textHeight = (int)tag.Font.Height;
|
||||
tag.Height = this.textHeight;
|
||||
this.height = (int)(this.textHeight + this.LineSpacing + this.TotalParagraphSpacing);
|
||||
this.height = (int)tag.Font.Height;
|
||||
tag.Height = this.height;
|
||||
|
||||
this.ascent = tag.Ascent;
|
||||
|
||||
@@ -964,42 +684,7 @@ namespace System.Windows.Forms
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
internal void CalculateAlignment ()
|
||||
{
|
||||
var alignmentWidth = document.ViewPortWidth - document.left_margin - document.right_margin;
|
||||
var alignmentLineWidth = GetAlignmentLineWidth ();
|
||||
|
||||
switch (alignment) {
|
||||
case HorizontalAlignment.Left:
|
||||
align_shift = 0;
|
||||
break;
|
||||
case HorizontalAlignment.Center:
|
||||
align_shift = (alignmentWidth - alignmentLineWidth) / 2;
|
||||
break;
|
||||
case HorizontalAlignment.Right:
|
||||
align_shift = alignmentWidth - alignmentLineWidth;
|
||||
break;
|
||||
}
|
||||
|
||||
align_shift = Math.Max (align_shift, 0); // Don't allow negative shifts.
|
||||
}
|
||||
|
||||
private int GetAlignmentLineWidth ()
|
||||
{
|
||||
int last = text.Length - 1;
|
||||
if (last < 0)
|
||||
return 0;
|
||||
|
||||
char c = text [last];
|
||||
while (last > 0 && Char.IsWhiteSpace (c) && c != '\t' && c != '\u00A0') {
|
||||
c = text [--last];
|
||||
}
|
||||
// widths[0] has both the left margin and the left indents.
|
||||
// Remove the margin (it is part of the viewport) and add the right indents (part of the line width, for alignment purposes).
|
||||
return (int)(widths [last + 1] - document.left_margin + Math.Max (right_indent, 0));
|
||||
}
|
||||
|
||||
|
||||
internal void Streamline (int lines)
|
||||
{
|
||||
LineTag current;
|
||||
@@ -1026,7 +711,7 @@ namespace System.Windows.Forms
|
||||
return;
|
||||
|
||||
while (next != null) {
|
||||
// Take out 0 length tags unless it's the last tag in the document.
|
||||
// Take out 0 length tags unless it's the last tag in the document
|
||||
if (current.IsTextTag && next.Length == 0 && next.IsTextTag) {
|
||||
if ((next.Next != null) || (line_no != lines)) {
|
||||
current.Next = next.Next;
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
//
|
||||
// Authors:
|
||||
// Peter Bartok [email protected]
|
||||
// Karl Scowen <[email protected]>
|
||||
//
|
||||
//
|
||||
|
||||
@@ -45,10 +44,6 @@ namespace System.Windows.Forms
|
||||
private string link_text; // The full link text e.g. this might be
|
||||
// word-wrapped to "w" but this would be
|
||||
// "www.example.com"
|
||||
private bool visible;
|
||||
private TextPositioning text_position; // Normal / superscript / subscript
|
||||
private Font small_font; // Cached font for superscript / subscript
|
||||
private float char_offset; // Shift the text baseline up or down
|
||||
|
||||
// Payload; text
|
||||
private int start; // start, in chars; index into Line.text
|
||||
@@ -58,8 +53,7 @@ namespace System.Windows.Forms
|
||||
private int height; // Height in pixels of the text this tag describes
|
||||
private int ascent; // Ascent of the font for this tag
|
||||
private int descent; // Descent of the font for this tag
|
||||
private int shift; // Shift down for this tag, to stay on baseline.
|
||||
// Measured from top of line to top of tag.
|
||||
private int shift; // Shift down for this tag, to stay on baseline
|
||||
|
||||
// Administrative
|
||||
private Line line; // The line we're on
|
||||
@@ -75,7 +69,6 @@ namespace System.Windows.Forms
|
||||
link_font = null;
|
||||
is_link = false;
|
||||
link_text = null;
|
||||
visible = true;
|
||||
}
|
||||
#endregion // Constructors
|
||||
|
||||
@@ -120,16 +113,6 @@ namespace System.Windows.Forms
|
||||
return link_font;
|
||||
}
|
||||
|
||||
if (TextPosition != TextPositioning.Normal) {
|
||||
if (small_font == null)
|
||||
small_font = new Font (font.FontFamily, font.Size * 0.583F, font.Style);
|
||||
|
||||
if (IsLink)
|
||||
return new Font (small_font, font.Style | FontStyle.Underline);
|
||||
else
|
||||
return small_font;
|
||||
}
|
||||
|
||||
return font;
|
||||
}
|
||||
}
|
||||
@@ -139,43 +122,20 @@ namespace System.Windows.Forms
|
||||
set {
|
||||
if (font != value) {
|
||||
link_font = null;
|
||||
small_font = null;
|
||||
font = value;
|
||||
|
||||
height = Font.Height;
|
||||
XplatUI.GetFontMetrics (Hwnd.GraphicsContext, Font, out ascent, out descent);
|
||||
float scale_factor = font.GetHeight () / font.FontFamily.GetLineSpacing (font.Style);
|
||||
ascent = (int) Math.Ceiling (ascent * scale_factor);
|
||||
descent = (int) Math.Ceiling (descent * scale_factor);
|
||||
line.recalc = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public TextPositioning TextPosition {
|
||||
get { return text_position; }
|
||||
set { text_position = value; }
|
||||
}
|
||||
|
||||
public float CharOffset {
|
||||
get { return char_offset; }
|
||||
set { char_offset = value; }
|
||||
}
|
||||
|
||||
public int Height {
|
||||
get { return height; }
|
||||
set { height = value; }
|
||||
}
|
||||
|
||||
public int DrawnHeight {
|
||||
get {
|
||||
if (text_position != TextPositioning.Normal)
|
||||
return (int) (height * 0.583F);
|
||||
|
||||
return height;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual bool IsTextTag {
|
||||
get { return true; }
|
||||
}
|
||||
@@ -226,7 +186,7 @@ namespace System.Windows.Forms
|
||||
throw new Exception("New tag makes an insane tag");
|
||||
}
|
||||
#endif
|
||||
start = value;
|
||||
start = value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -246,14 +206,9 @@ namespace System.Windows.Forms
|
||||
}
|
||||
}
|
||||
|
||||
public bool Visible {
|
||||
get { return visible; }
|
||||
set { visible = value; }
|
||||
}
|
||||
|
||||
public float Width {
|
||||
get {
|
||||
if (Length == 0 || !visible)
|
||||
if (Length == 0)
|
||||
return 0;
|
||||
return line.widths [start + Length - 1] - (start != 0 ? line.widths [start - 1] : 0);
|
||||
}
|
||||
@@ -267,15 +222,6 @@ namespace System.Windows.Forms
|
||||
}
|
||||
}
|
||||
|
||||
public int OffsetY {
|
||||
get {
|
||||
if (text_position == TextPositioning.Subscript)
|
||||
return (int) (height * 0.45F);
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsLink {
|
||||
get { return is_link; }
|
||||
set { is_link = value; }
|
||||
@@ -307,8 +253,8 @@ namespace System.Windows.Forms
|
||||
new_tag = new LineTag(line, pos);
|
||||
new_tag.CopyFormattingFrom (this);
|
||||
|
||||
new_tag.Next = this.next;
|
||||
this.Next = new_tag;
|
||||
new_tag.next = this.next;
|
||||
this.next = new_tag;
|
||||
new_tag.previous = this;
|
||||
|
||||
if (new_tag.next != null)
|
||||
@@ -323,7 +269,7 @@ namespace System.Windows.Forms
|
||||
if (!this.Equals (other))
|
||||
return false;
|
||||
|
||||
this.Next = other.next;
|
||||
this.next = other.next;
|
||||
|
||||
if (this.next != null)
|
||||
this.next.previous = this;
|
||||
@@ -336,9 +282,6 @@ namespace System.Windows.Forms
|
||||
Font = other.font;
|
||||
color = other.color;
|
||||
back_color = other.back_color;
|
||||
TextPosition = other.text_position;
|
||||
CharOffset = other.CharOffset;
|
||||
Visible = other.Visible;
|
||||
}
|
||||
|
||||
public void Delete ()
|
||||
@@ -369,8 +312,6 @@ namespace System.Windows.Forms
|
||||
|
||||
public virtual void Draw (Graphics dc, Color color, float x, float y, int start, int end)
|
||||
{
|
||||
if (text_position == TextPositioning.Subscript)
|
||||
y += OffsetY;
|
||||
TextBoxTextRenderer.DrawText (dc, line.text.ToString (start, end).Replace ("\r", string.Empty), FontToDisplay, color, x, y, false);
|
||||
}
|
||||
|
||||
@@ -387,14 +328,6 @@ namespace System.Windows.Forms
|
||||
public virtual void Draw (Graphics dc, Color color, float xoff, float y, int drawStart, int drawEnd,
|
||||
string text, out Rectangle measuredText, bool measureText)
|
||||
{
|
||||
if (!visible) {
|
||||
measuredText = new Rectangle ();
|
||||
return;
|
||||
}
|
||||
|
||||
if (text_position == TextPositioning.Subscript)
|
||||
y += OffsetY;
|
||||
|
||||
if (measureText) {
|
||||
int xstart = (int)line.widths [drawStart] + (int)xoff;
|
||||
int xend = (int)line.widths [drawEnd] - (int)line.widths [drawStart];
|
||||
@@ -409,7 +342,7 @@ namespace System.Windows.Forms
|
||||
while (drawStart < drawEnd) {
|
||||
int tab_index = text.IndexOf ("\t", drawStart);
|
||||
|
||||
if (tab_index == -1 || tab_index > drawEnd)
|
||||
if (tab_index == -1)
|
||||
tab_index = drawEnd;
|
||||
|
||||
TextBoxTextRenderer.DrawText (dc, text.Substring (drawStart, tab_index - drawStart).Replace ("\r", string.Empty), FontToDisplay, color, xoff + line.widths [drawStart], y, false);
|
||||
@@ -447,16 +380,7 @@ namespace System.Windows.Forms
|
||||
if (this.LinkText != other.LinkText)
|
||||
return false;
|
||||
|
||||
if (this.TextPosition != other.TextPosition)
|
||||
return false;
|
||||
|
||||
if (this.CharOffset != other.CharOffset)
|
||||
return false;
|
||||
|
||||
if (this.Visible != other.Visible)
|
||||
return false;
|
||||
|
||||
if (this.font.Equals (other.font) && this.color.Equals (other.color) && this.back_color.Equals (other.back_color))
|
||||
if (this.font.Equals (other.font) && this.color.Equals (other.color))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@@ -485,17 +409,11 @@ namespace System.Windows.Forms
|
||||
return null;
|
||||
}
|
||||
|
||||
public static bool FormatText (Line line, int formatStart, int length, Font font, Color color, Color backColor, FormatSpecified specified)
|
||||
{
|
||||
return FormatText (line, formatStart, length, font, color, backColor, TextPositioning.Normal, 0, true, specified);
|
||||
}
|
||||
|
||||
/// <summary>Applies 'font' and 'brush' to characters starting at 'start' for 'length' chars;
|
||||
/// Removes any previous tags overlapping the same area;
|
||||
/// returns true if lineheight has changed</summary>
|
||||
/// <param name="formatStart">1-based character position on line</param>
|
||||
public static bool FormatText (Line line, int formatStart, int length, Font font, Color color, Color backColor,
|
||||
TextPositioning text_position, float char_offset, bool visible, FormatSpecified specified)
|
||||
public static bool FormatText (Line line, int formatStart, int length, Font font, Color color, Color backColor, FormatSpecified specified)
|
||||
{
|
||||
LineTag tag;
|
||||
LineTag start_tag;
|
||||
@@ -504,7 +422,7 @@ namespace System.Windows.Forms
|
||||
bool retval = false; // Assume line-height doesn't change
|
||||
|
||||
// Too simple?
|
||||
if (((FormatSpecified.Font & specified) == FormatSpecified.Font) && font.Height != line.TextHeight)
|
||||
if (((FormatSpecified.Font & specified) == FormatSpecified.Font) && font.Height != line.height)
|
||||
retval = true;
|
||||
|
||||
line.recalc = true; // This forces recalculation of the line in RecalculateDocument
|
||||
@@ -518,7 +436,7 @@ namespace System.Windows.Forms
|
||||
|
||||
// Common special case
|
||||
if ((formatStart == 1) && (length == tag.Length)) {
|
||||
SetFormat (tag, font, color, backColor, text_position, char_offset, visible, specified);
|
||||
SetFormat (tag, font, color, backColor, specified);
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -526,7 +444,7 @@ namespace System.Windows.Forms
|
||||
// we only need one new tag
|
||||
if (formatStart == 1 && length == 0) {
|
||||
line.tags.Break (1);
|
||||
SetFormat (line.tags, font, color, backColor, text_position, char_offset, visible, specified);
|
||||
SetFormat (line.tags, font, color, backColor, specified);
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -537,7 +455,7 @@ namespace System.Windows.Forms
|
||||
// Find Tag will return tag 0 at position 3, but we should just
|
||||
// use the empty tag after..
|
||||
if (start_tag.End == formatStart && length == 0 && start_tag.Next != null && start_tag.Next.Length == 0) {
|
||||
SetFormat (start_tag.Next, font, color, backColor, text_position, char_offset, visible, specified);
|
||||
SetFormat (start_tag.Next, font, color, backColor, specified);
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -545,22 +463,13 @@ namespace System.Windows.Forms
|
||||
while (start_tag.End == formatStart && start_tag.Next != null)
|
||||
start_tag = start_tag.Next;
|
||||
|
||||
if (start_tag.Start == formatStart && start_tag.Length == length) {
|
||||
SetFormat (start_tag, font, color, backColor, text_position, char_offset, visible, specified);
|
||||
return retval;
|
||||
}
|
||||
|
||||
// Break the tag if needed -- we don't need to break for the start if we're starting at its start.
|
||||
if (start_tag.Start != formatStart)
|
||||
tag = start_tag.Break (formatStart);
|
||||
else
|
||||
tag = start_tag;
|
||||
tag = start_tag.Break (formatStart);
|
||||
|
||||
// empty selection style at end of line - its the only situation
|
||||
// where the rest of the tag would be empty, since we moved to the
|
||||
// begining of next non empty tag
|
||||
if (tag.Length == 0) {
|
||||
SetFormat (tag, font, color, backColor, text_position, char_offset, visible, specified);
|
||||
SetFormat (tag, font, color, backColor, specified);
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -568,27 +477,25 @@ namespace System.Windows.Forms
|
||||
// after our new (now) empty one..
|
||||
if (length == 0) {
|
||||
tag.Break (formatStart);
|
||||
SetFormat (tag, font, color, backColor, text_position, char_offset, visible, specified);
|
||||
SetFormat (tag, font, color, backColor, specified);
|
||||
return retval;
|
||||
}
|
||||
|
||||
bool atEnd = false;
|
||||
while (tag != null && tag.End <= end) {
|
||||
SetFormat (tag, font, color, backColor, text_position, char_offset, visible, specified);
|
||||
atEnd |= tag.End == end;
|
||||
SetFormat (tag, font, color, backColor, specified);
|
||||
tag = tag.next;
|
||||
}
|
||||
|
||||
// did the last tag conveniently fit?
|
||||
if (atEnd || (tag != null && tag.End == end))
|
||||
if (tag != null && tag.End == end)
|
||||
return retval;
|
||||
|
||||
// Now do the last tag
|
||||
/// Now do the last tag
|
||||
end_tag = FindTag (line, end-1);
|
||||
|
||||
if (end_tag != null) {
|
||||
end_tag.Break (end);
|
||||
SetFormat (end_tag, font, color, backColor, text_position, char_offset, visible, specified);
|
||||
SetFormat (end_tag, font, color, backColor, specified);
|
||||
}
|
||||
|
||||
return retval;
|
||||
@@ -602,7 +509,6 @@ namespace System.Windows.Forms
|
||||
int low = start;
|
||||
int high = low + Length;
|
||||
int length_no_ending = line.TextLengthWithoutEnding ();
|
||||
float char_mid;
|
||||
|
||||
if (Length == 0)
|
||||
return low-1;
|
||||
@@ -611,8 +517,7 @@ namespace System.Windows.Forms
|
||||
return 0;
|
||||
|
||||
if (x < line.widths [low]) {
|
||||
char_mid = (line.widths [1] + line.widths [0]) / 2;
|
||||
if (low == 1 && x >= char_mid)
|
||||
if (low == 1 && x > (line.widths [1] / 2))
|
||||
return low;
|
||||
return low - 1;
|
||||
}
|
||||
@@ -630,9 +535,9 @@ namespace System.Windows.Forms
|
||||
high = mid;
|
||||
}
|
||||
|
||||
char_mid = (line.widths [high] + line.widths [low]) / 2;
|
||||
float char_width = line.widths[high] - line.widths[low];
|
||||
|
||||
if (x >= char_mid)
|
||||
if ((x - line.widths[low]) >= (char_width / 2))
|
||||
return high;
|
||||
else
|
||||
return low;
|
||||
@@ -663,12 +568,6 @@ namespace System.Windows.Forms
|
||||
}
|
||||
|
||||
private static void SetFormat (LineTag tag, Font font, Color color, Color back_color, FormatSpecified specified)
|
||||
{
|
||||
SetFormat (tag, font, color, back_color, TextPositioning.Normal, 0, true, specified);
|
||||
}
|
||||
|
||||
private static void SetFormat (LineTag tag, Font font, Color color, Color back_color, TextPositioning text_position,
|
||||
float char_offset, bool visible, FormatSpecified specified)
|
||||
{
|
||||
if ((FormatSpecified.Font & specified) == FormatSpecified.Font) {
|
||||
tag.Font = font;
|
||||
@@ -678,52 +577,28 @@ namespace System.Windows.Forms
|
||||
if ((FormatSpecified.BackColor & specified) == FormatSpecified.BackColor) {
|
||||
tag.back_color = back_color;
|
||||
}
|
||||
if ((FormatSpecified.TextPosition & specified) == FormatSpecified.TextPosition)
|
||||
tag.TextPosition = text_position;
|
||||
if ((FormatSpecified.CharOffset & specified) == FormatSpecified.CharOffset)
|
||||
tag.CharOffset = char_offset;
|
||||
if ((FormatSpecified.Visibility & specified) == FormatSpecified.Visibility)
|
||||
tag.Visible = visible;
|
||||
// Console.WriteLine ("setting format: {0} {1} new color {2}", color.Color, specified, tag.color.Color);
|
||||
}
|
||||
|
||||
public virtual SizeF SizeOfPosition (Graphics dc, int pos)
|
||||
{
|
||||
if ((pos >= line.TextLengthWithoutEnding () && line.document.multiline) || !visible)
|
||||
if (pos >= line.TextLengthWithoutEnding () && line.document.multiline)
|
||||
return SizeF.Empty;
|
||||
|
||||
string text = line.text.ToString (pos, 1);
|
||||
switch ((int)text [0]) {
|
||||
switch ((int) text [0]) {
|
||||
case '\t':
|
||||
if (!line.document.multiline)
|
||||
goto case 10;
|
||||
SizeF res = TextBoxTextRenderer.MeasureText (dc, " ", FontToDisplay); // This way we get the height, not that it is ever used...
|
||||
float left = line.widths [pos];
|
||||
float right = -1;
|
||||
TabStopCollection stops = line.tab_stops;
|
||||
float tabPos;
|
||||
for (int i = 0; i < stops.Count; i++) {
|
||||
tabPos = stops [i].Position;
|
||||
if (tabPos >= left) {
|
||||
if (tabPos <= line.document.viewport_width - line.RightIndent)
|
||||
break; // Can't use tabs that are past the end of the line.
|
||||
|
||||
right = stops [i].CalculateRight (line, pos);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (right < 0) {
|
||||
float maxWidth = dc.DpiX / 2; // tab stops are 1/2"
|
||||
right = (float)(Math.Floor (left / maxWidth) + 1) * maxWidth;
|
||||
}
|
||||
res.Width = right - left;
|
||||
SizeF res = TextBoxTextRenderer.MeasureText (dc, " ", font);
|
||||
res.Width *= 8.0F;
|
||||
return res;
|
||||
case 10:
|
||||
case 13:
|
||||
return TextBoxTextRenderer.MeasureText (dc, "\u000D", FontToDisplay);
|
||||
return TextBoxTextRenderer.MeasureText (dc, "\u000D", font);
|
||||
}
|
||||
|
||||
return TextBoxTextRenderer.MeasureText (dc, text, FontToDisplay);
|
||||
|
||||
return TextBoxTextRenderer.MeasureText (dc, text, font);
|
||||
}
|
||||
|
||||
public virtual string Text ()
|
||||
|
||||
@@ -1614,7 +1614,7 @@ namespace System.Windows.Forms
|
||||
private bool KeySearch (Keys key)
|
||||
{
|
||||
char c = (char) key;
|
||||
if (!Char.IsLetterOrDigit (c) || SelectionMode == SelectionMode.None)
|
||||
if (!Char.IsLetterOrDigit (c))
|
||||
return false;
|
||||
|
||||
int idx = FindString (c.ToString (), SelectedIndex);
|
||||
|
||||
@@ -326,6 +326,8 @@ namespace System.Windows.Forms {
|
||||
if (!Checked) {
|
||||
Checked = true;
|
||||
}
|
||||
} else {
|
||||
Checked = !Checked;
|
||||
}
|
||||
|
||||
base.OnClick (e);
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,258 +0,0 @@
|
||||
// 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 substantial 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.
|
||||
//
|
||||
// Copyright (c) 2015 Karl Scowen
|
||||
//
|
||||
// Authors:
|
||||
// Karl Scowen <[email protected]>
|
||||
//
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace System.Windows.Forms {
|
||||
abstract class TabStop : IComparable<TabStop> {
|
||||
float _pos = -1;
|
||||
|
||||
internal float Position {
|
||||
get {
|
||||
return _pos;
|
||||
}
|
||||
|
||||
set {
|
||||
if (_pos >= 0)
|
||||
throw new InvalidOperationException ("Can't change Position once it has been set!");
|
||||
|
||||
_pos = value;
|
||||
}
|
||||
}
|
||||
|
||||
internal virtual float GetInitialWidth (Line line, int pos)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
internal abstract float CalculateRight (Line line, int pos);
|
||||
|
||||
public override bool Equals (object obj)
|
||||
{
|
||||
return obj.GetType () == this.GetType () && Math.Abs (((TabStop)obj).Position - Position) < 0.01;
|
||||
}
|
||||
|
||||
public override int GetHashCode ()
|
||||
{
|
||||
return this.GetType ().GetHashCode () ^ Position.GetHashCode ();
|
||||
}
|
||||
|
||||
public override string ToString ()
|
||||
{
|
||||
return string.Format ("[{0}: Position {1}]", this.GetType().Name, Position);
|
||||
}
|
||||
|
||||
#region IComparable implementation
|
||||
public int CompareTo (TabStop other)
|
||||
{
|
||||
return Position.CompareTo (other.Position);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
class LeftTabStop : TabStop {
|
||||
internal LeftTabStop ()
|
||||
{
|
||||
}
|
||||
internal LeftTabStop (float position)
|
||||
{
|
||||
Position = position;
|
||||
}
|
||||
|
||||
internal override float GetInitialWidth (Line line, int pos)
|
||||
{
|
||||
return Position - line.widths[pos];
|
||||
}
|
||||
|
||||
internal override float CalculateRight (Line line, int pos)
|
||||
{
|
||||
return Position;
|
||||
}
|
||||
}
|
||||
|
||||
class CentredTabStop : TabStop {
|
||||
internal override float CalculateRight (Line line, int pos)
|
||||
{
|
||||
int endIndex = line.Text.IndexOfAny (new [] {'\t', '\n', '\r'}, pos + 1); // pos is this tab's index, so look after that.
|
||||
if (endIndex < 0)
|
||||
endIndex = line.text.Length;
|
||||
float textWidth = line.widths [endIndex] - line.widths [pos + 1]; // We use the position after this tabstop, hence pos + 1.
|
||||
return Math.Max (Position - textWidth / 2f, line.widths [pos]); // We want the width until the start of the text, which is before Position, but we can't go below zero.
|
||||
}
|
||||
}
|
||||
|
||||
internal class RightTabStop : TabStop {
|
||||
internal override float CalculateRight (Line line, int pos)
|
||||
{
|
||||
int endIndex = line.Text.IndexOfAny (new [] {'\t', '\n', '\r'}, pos + 1); // pos is this tab's index, so look after that.
|
||||
return calcWidth (line, pos, endIndex);
|
||||
}
|
||||
|
||||
protected float calcWidth (Line line, int pos, int endIndex)
|
||||
{
|
||||
if (endIndex < 0)
|
||||
endIndex = line.text.Length;
|
||||
float textWidth = line.widths [endIndex] - line.widths [pos + 1]; // We use the position after this tabstop, hence pos + 1.
|
||||
return Math.Max (Position - textWidth, line.widths [pos]);
|
||||
}
|
||||
}
|
||||
|
||||
internal class DecimalTabStop : RightTabStop {
|
||||
internal override float CalculateRight (Line line, int pos)
|
||||
{
|
||||
// This is simply a right-align tabstop that regards the decimal as the end.
|
||||
int endIndex = line.Text.IndexOfAny (new [] {'\t', '\n', '\r', '.'}, pos + 1); // pos is this tab's index, so look after that.
|
||||
return calcWidth (line, pos, endIndex);
|
||||
}
|
||||
}
|
||||
|
||||
internal class TabStopCollection : IList<TabStop> {
|
||||
SortedList<TabStop, TabStop> tabs = new SortedList<TabStop, TabStop> ();
|
||||
|
||||
public TabStopCollection Clone ()
|
||||
{
|
||||
var n = new TabStopCollection ();
|
||||
foreach (var tab in tabs.Keys) {
|
||||
n.tabs.Add (tab, null);
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
public int IndexOf (TabStop tab)
|
||||
{
|
||||
return tabs.IndexOfKey (tab);
|
||||
}
|
||||
|
||||
public void Insert (int index, TabStop item)
|
||||
{
|
||||
throw new NotSupportedException ("Not relevant to sorted data!");
|
||||
}
|
||||
|
||||
public void RemoveAt (int index)
|
||||
{
|
||||
tabs.RemoveAt (index);
|
||||
}
|
||||
|
||||
public TabStop this [int index] {
|
||||
get {
|
||||
return tabs.Keys [index];
|
||||
}
|
||||
set {
|
||||
throw new NotSupportedException ("Not relevant to sorted data!");
|
||||
}
|
||||
}
|
||||
|
||||
#region ICollection implementation
|
||||
public void Add (TabStop tab)
|
||||
{
|
||||
tabs.Add (tab, null);
|
||||
}
|
||||
|
||||
public void Clear ()
|
||||
{
|
||||
tabs.Clear ();
|
||||
}
|
||||
|
||||
public bool Contains (TabStop tab)
|
||||
{
|
||||
return tabs.ContainsKey (tab);
|
||||
}
|
||||
|
||||
public void CopyTo (TabStop[] array, int arrayIndex)
|
||||
{
|
||||
tabs.Keys.CopyTo (array, arrayIndex);
|
||||
}
|
||||
|
||||
public TabStop[] ToArray ()
|
||||
{
|
||||
var arr = new TabStop [Count];
|
||||
CopyTo (arr, 0);
|
||||
return arr;
|
||||
}
|
||||
|
||||
public int[] ToPosArray ()
|
||||
{
|
||||
var arr = new int [Count];
|
||||
for (int i = 0; i < Count; i++) {
|
||||
arr [i] = (int)this [i].Position;
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
public bool Remove (TabStop tab)
|
||||
{
|
||||
return tabs.Remove (tab);
|
||||
}
|
||||
|
||||
public int Count {
|
||||
get {
|
||||
return tabs.Count;
|
||||
}
|
||||
}
|
||||
|
||||
bool ICollection<TabStop>.IsReadOnly {
|
||||
get {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region IEnumerable implementation
|
||||
public IEnumerator<TabStop> GetEnumerator ()
|
||||
{
|
||||
return tabs.Keys.GetEnumerator ();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region IEnumerable implementation
|
||||
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator ()
|
||||
{
|
||||
return GetEnumerator ();
|
||||
}
|
||||
#endregion
|
||||
|
||||
public override bool Equals (object obj)
|
||||
{
|
||||
var other = obj as TabStopCollection;
|
||||
if (other == null || other.Count != this.Count)
|
||||
return false;
|
||||
|
||||
for (int i = 0; i < Count; i++) {
|
||||
if (!tabs.Keys [i].Equals (other.tabs.Keys [i]))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public override int GetHashCode ()
|
||||
{
|
||||
// I don't like warnings, but I honestly don't care about the hash code.
|
||||
return base.GetHashCode ();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -284,8 +284,8 @@ namespace System.Windows.Forms
|
||||
{
|
||||
if (control == null)
|
||||
throw new ArgumentNullException ();
|
||||
if (value < 1)
|
||||
throw new ArgumentOutOfRangeException ();
|
||||
if (value < -1)
|
||||
throw new ArgumentException ();
|
||||
|
||||
column_spans[control] = value;
|
||||
|
||||
@@ -310,8 +310,8 @@ namespace System.Windows.Forms
|
||||
{
|
||||
if (control == null)
|
||||
throw new ArgumentNullException ();
|
||||
if (value < 1)
|
||||
throw new ArgumentOutOfRangeException ();
|
||||
if (value < -1)
|
||||
throw new ArgumentException ();
|
||||
|
||||
row_spans[control] = value;
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
//
|
||||
// Authors:
|
||||
// Peter Bartok [email protected]
|
||||
// Karl Scowen <[email protected]>
|
||||
//
|
||||
//
|
||||
|
||||
@@ -117,7 +116,8 @@ namespace System.Windows.Forms
|
||||
current_link = null;
|
||||
show_caret_w_selection = (this is TextBox);
|
||||
document = new Document(this);
|
||||
document.SizeChanged += new EventHandler<Document.SizeChangedEventArgs> (document_SizeChanged);
|
||||
document.WidthChanged += new EventHandler(document_WidthChanged);
|
||||
document.HeightChanged += new EventHandler(document_HeightChanged);
|
||||
//document.CaretMoved += new EventHandler(CaretMoved);
|
||||
document.Wrap = false;
|
||||
click_last = DateTime.Now;
|
||||
@@ -296,7 +296,8 @@ namespace System.Windows.Forms
|
||||
if (value == actual_border_style)
|
||||
return;
|
||||
|
||||
Invalidate ();
|
||||
if (actual_border_style != BorderStyle.Fixed3D || value != BorderStyle.Fixed3D)
|
||||
Invalidate ();
|
||||
|
||||
actual_border_style = value;
|
||||
document.UpdateMargins ();
|
||||
@@ -616,10 +617,7 @@ namespace System.Windows.Forms
|
||||
Line line = null;
|
||||
for (int i = 1; i <= document.Lines; i++) {
|
||||
line = document.GetLine (i);
|
||||
if (i == document.Lines)
|
||||
sb.Append(line.TextWithoutEnding ());
|
||||
else
|
||||
sb.Append(line.text.ToString ());
|
||||
sb.Append(line.text.ToString ());
|
||||
}
|
||||
|
||||
return sb.ToString();
|
||||
@@ -1823,7 +1821,6 @@ namespace System.Windows.Forms
|
||||
}
|
||||
|
||||
document.PositionCaret(e.X + document.ViewPortX, e.Y + document.ViewPortY);
|
||||
document.DisplayCaret ();
|
||||
|
||||
if (dbliclick) {
|
||||
switch (click_mode) {
|
||||
@@ -2045,24 +2042,22 @@ namespace System.Windows.Forms
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
internal bool CalculateScrollBars ()
|
||||
internal void CalculateScrollBars ()
|
||||
{
|
||||
var old_canvas_width = canvas_width;
|
||||
|
||||
// FIXME - need separate calculations for center and right alignment
|
||||
SizeControls ();
|
||||
|
||||
if (document.Width > document.ViewPortWidth) {
|
||||
if (document.Width >= document.ViewPortWidth) {
|
||||
hscroll.SetValues (0, Math.Max (1, document.Width), -1,
|
||||
document.ViewPortWidth < 0 ? 0 : document.ViewPortWidth);
|
||||
if (document.multiline)
|
||||
hscroll.Enabled = true;
|
||||
} else {
|
||||
hscroll.Enabled = false;
|
||||
hscroll.Value = hscroll.Minimum;
|
||||
hscroll.Maximum = document.ViewPortWidth;
|
||||
}
|
||||
|
||||
if (document.Height > document.ViewPortHeight) {
|
||||
if (document.Height >= document.ViewPortHeight) {
|
||||
vscroll.SetValues (0, Math.Max (1, document.Height), -1,
|
||||
document.ViewPortHeight < 0 ? 0 : document.ViewPortHeight);
|
||||
if (document.multiline)
|
||||
@@ -2113,16 +2108,16 @@ namespace System.Windows.Forms
|
||||
PositionControls ();
|
||||
|
||||
SizeControls (); //Update sizings now we've decided whats visible
|
||||
|
||||
return (canvas_width != old_canvas_width);
|
||||
}
|
||||
|
||||
private void document_SizeChanged (object sender, Document.SizeChangedEventArgs e)
|
||||
private void document_WidthChanged (object sender, EventArgs e)
|
||||
{
|
||||
var canvas_width_changed = CalculateScrollBars ();
|
||||
if (e.HeightChanged && canvas_width_changed)
|
||||
CalculateDocument (); // Viewport has changed due to the document change, update the document.
|
||||
// TODO: technically the opposite situation could happen too, where a document width change causes a change in canvas height.
|
||||
CalculateScrollBars();
|
||||
}
|
||||
|
||||
private void document_HeightChanged (object sender, EventArgs e)
|
||||
{
|
||||
CalculateScrollBars();
|
||||
}
|
||||
|
||||
private void ScrollLinks (int xChange, int yChange)
|
||||
@@ -2315,41 +2310,40 @@ namespace System.Windows.Forms
|
||||
// If the caret moves to the left outside the visible area, we jump the document into view, not just one
|
||||
// character, but 1/3 of the width of the document
|
||||
// If the caret moves to the right outside the visible area, we scroll just enough to keep the caret visible
|
||||
// For comparison, in Windows 8.1 / .Net 4:
|
||||
// Multiline: as above, but 1/4
|
||||
// Single line: either direction with the cursors jumps 1/4
|
||||
// Both are irrespective of alignment.
|
||||
|
||||
// Handle horizontal scrolling
|
||||
// Check if we moved out of view to the left
|
||||
if (pos.X < (document.ViewPortX)) {
|
||||
do {
|
||||
var newVal = hscroll.Value - document.ViewPortWidth / 3 - 1; // - 1 so that we're guaranteed to move, even if document.ViewPortWidth is < 3.
|
||||
if (newVal >= hscroll.Minimum) {
|
||||
hscroll.SafeValueSet (newVal);
|
||||
} else {
|
||||
hscroll.Value = hscroll.Minimum;
|
||||
}
|
||||
} while (hscroll.Value > pos.X);
|
||||
}
|
||||
if (document.CaretLine.alignment == HorizontalAlignment.Left) {
|
||||
// Check if we moved out of view to the left
|
||||
if (pos.X < (document.ViewPortX)) {
|
||||
do {
|
||||
if ((hscroll.Value - document.ViewPortWidth / 3) >= hscroll.Minimum) {
|
||||
hscroll.SafeValueSet (hscroll.Value - document.ViewPortWidth / 3);
|
||||
} else {
|
||||
hscroll.Value = hscroll.Minimum;
|
||||
}
|
||||
} while (hscroll.Value > pos.X);
|
||||
}
|
||||
|
||||
// Check if we moved out of view to the right
|
||||
if ((pos.X >= (document.ViewPortWidth + document.ViewPortX)) && (hscroll.Value != hscroll.Maximum)) {
|
||||
int newVal;
|
||||
if (Multiline) {
|
||||
newVal = pos.X - document.ViewPortWidth + 1;
|
||||
} else {
|
||||
newVal = pos.X - document.ViewPortWidth * 2 / 3 + 1;
|
||||
}
|
||||
if (newVal <= hscroll.Maximum - document.ViewPortWidth + 1) {
|
||||
if (newVal >= 0) {
|
||||
hscroll.SafeValueSet (newVal);
|
||||
// Check if we moved out of view to the right
|
||||
if ((pos.X >= (document.ViewPortWidth + document.ViewPortX)) && (hscroll.Value != hscroll.Maximum)) {
|
||||
if ((pos.X - document.ViewPortWidth + 1) <= hscroll.Maximum) {
|
||||
if (pos.X - document.ViewPortWidth >= 0) {
|
||||
hscroll.SafeValueSet (pos.X - document.ViewPortWidth + 1);
|
||||
} else {
|
||||
hscroll.Value = 0;
|
||||
}
|
||||
} else {
|
||||
hscroll.Value = 0;
|
||||
hscroll.Value = hscroll.Maximum;
|
||||
}
|
||||
} else {
|
||||
hscroll.Value = hscroll.Maximum - document.ViewPortWidth + 1;
|
||||
}
|
||||
} else if (document.CaretLine.alignment == HorizontalAlignment.Right) {
|
||||
// hscroll.Value = pos.X;
|
||||
|
||||
// if ((pos.X > (this.canvas_width + document.ViewPortX)) && (hscroll.Enabled && (hscroll.Value != hscroll.Maximum))) {
|
||||
// hscroll.Value = hscroll.Maximum;
|
||||
// }
|
||||
} else {
|
||||
// FIXME - implement center cursor alignment
|
||||
}
|
||||
|
||||
if (Text.Length > 0)
|
||||
@@ -2359,10 +2353,7 @@ namespace System.Windows.Forms
|
||||
return;
|
||||
|
||||
// Handle vertical scrolling
|
||||
height = document.CaretLine.Height;
|
||||
|
||||
if (document.CaretLine.line_no < document.Lines)
|
||||
height += 1; // Add a bit of room on the bottom if there are more lines - but don't scroll past the bottom when ther aren't.
|
||||
height = document.CaretLine.Height + 1;
|
||||
|
||||
if (pos.Y < document.ViewPortY)
|
||||
vscroll.SafeValueSet (pos.Y);
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -383,36 +383,26 @@ namespace System.Windows.Forms
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
public new void Show ()
|
||||
{
|
||||
Show (Location);
|
||||
}
|
||||
|
||||
public void Show (int x, int y)
|
||||
{
|
||||
Show (new Point (x, y));
|
||||
Show (Location, DefaultDropDownDirection);
|
||||
}
|
||||
|
||||
public void Show (Point screenLocation)
|
||||
{
|
||||
SetOwnerControl (null);
|
||||
Show (screenLocation, DefaultDropDownDirection);
|
||||
}
|
||||
|
||||
public void Show (Control control, int x, int y)
|
||||
{
|
||||
Show (control, new Point (x, y));
|
||||
}
|
||||
|
||||
public void Show (Control control, Point position)
|
||||
{
|
||||
Show (control, position, DefaultDropDownDirection);
|
||||
}
|
||||
|
||||
public void Show (Control control, Point position, ToolStripDropDownDirection direction)
|
||||
public void Show (Control control, Point position)
|
||||
{
|
||||
if (control == null)
|
||||
throw new ArgumentNullException ("control");
|
||||
SetOwnerControl (control);
|
||||
Show (control.PointToScreen (position), direction);
|
||||
|
||||
XplatUI.SetOwner (Handle, control.Handle);
|
||||
Show (control.PointToScreen (position), DefaultDropDownDirection);
|
||||
}
|
||||
|
||||
public void Show (int x, int y)
|
||||
{
|
||||
Show (new Point (x, y), DefaultDropDownDirection);
|
||||
}
|
||||
|
||||
public void Show (Point position, ToolStripDropDownDirection direction)
|
||||
@@ -532,17 +522,26 @@ namespace System.Windows.Forms
|
||||
|
||||
this.OnOpened (EventArgs.Empty);
|
||||
}
|
||||
|
||||
public void Show (Control control, int x, int y)
|
||||
{
|
||||
if (control == null)
|
||||
throw new ArgumentNullException ("control");
|
||||
|
||||
Show (control, new Point (x, y));
|
||||
}
|
||||
|
||||
public void Show (Control control, Point position, ToolStripDropDownDirection direction)
|
||||
{
|
||||
if (control == null)
|
||||
throw new ArgumentNullException ("control");
|
||||
|
||||
XplatUI.SetOwner (Handle, control.Handle);
|
||||
Show (control.PointToScreen (position), direction);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected virtual void SetOwnerControl (Control ownerControl)
|
||||
{
|
||||
var ownerControlHandle = (ownerControl == null) ? IntPtr.Zero : ownerControl.Handle;
|
||||
XplatUI.SetOwner (Handle, ownerControlHandle);
|
||||
}
|
||||
|
||||
protected override AccessibleObject CreateAccessibilityInstance ()
|
||||
{
|
||||
return new ToolStripDropDownAccessibleObject (this);
|
||||
|
||||
@@ -419,8 +419,10 @@ namespace System.Windows.Forms
|
||||
if (item.Owner == null)
|
||||
return null;
|
||||
|
||||
if (item.Owner is ContextMenuStrip ownerContextMenuStrip)
|
||||
return ownerContextMenuStrip.SourceControl?.TopLevelControl;
|
||||
if (item.Owner is ContextMenuStrip) {
|
||||
Control container = ((ContextMenuStrip)item.Owner).container;
|
||||
return container == null ? null : container.TopLevelControl;
|
||||
}
|
||||
|
||||
// MainMenuStrip
|
||||
return item.Owner.TopLevelControl;
|
||||
|
||||
@@ -1419,7 +1419,7 @@ namespace System.Windows.Forms {
|
||||
|
||||
private void Draw (Rectangle clip, Graphics dc)
|
||||
{
|
||||
dc.FillRectangle (BackColorBrush, clip);
|
||||
dc.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (BackColor), clip);
|
||||
|
||||
if (dash == null)
|
||||
CreateDashPen ();
|
||||
@@ -1670,6 +1670,7 @@ namespace System.Windows.Forms {
|
||||
{
|
||||
if (!full_row_select || show_lines)
|
||||
DrawSelectionAndFocus(node, dc, node.Bounds);
|
||||
|
||||
|
||||
Font font = node.NodeFont;
|
||||
if (node.NodeFont == null)
|
||||
@@ -1690,7 +1691,7 @@ namespace System.Windows.Forms {
|
||||
int middle = y + (ActualItemHeight / 2);
|
||||
|
||||
if (full_row_select && !show_lines) {
|
||||
var r = new Rectangle (1, y, ViewportRectangle.Width - 2, ActualItemHeight);
|
||||
Rectangle r = new Rectangle (1, y, ViewportRectangle.Width - 2, ActualItemHeight);
|
||||
DrawSelectionAndFocus (node, dc, r);
|
||||
}
|
||||
|
||||
@@ -1715,25 +1716,26 @@ namespace System.Windows.Forms {
|
||||
}
|
||||
|
||||
if (draw_mode != TreeViewDrawMode.Normal) {
|
||||
dc.FillRectangle (BackColorBrush, node.Bounds);
|
||||
|
||||
var tree_node_state = TreeNodeStates.Default;;
|
||||
dc.FillRectangle (Brushes.White, node.Bounds);
|
||||
TreeNodeStates tree_node_state = TreeNodeStates.Default;;
|
||||
if (node.IsSelected)
|
||||
tree_node_state = TreeNodeStates.Selected;
|
||||
if (node.Checked)
|
||||
tree_node_state |= TreeNodeStates.Checked;
|
||||
if (node == focused_node)
|
||||
tree_node_state |= TreeNodeStates.Focused;
|
||||
|
||||
var node_bounds = node.Bounds;
|
||||
if (draw_mode != TreeViewDrawMode.OwnerDrawText) {
|
||||
Rectangle node_bounds = node.Bounds;
|
||||
if (draw_mode == TreeViewDrawMode.OwnerDrawText) {
|
||||
node_bounds.X += 3;
|
||||
node_bounds.Y += 1;
|
||||
} else {
|
||||
node_bounds.X = 0;
|
||||
node_bounds.Width = Width;
|
||||
}
|
||||
|
||||
var e = new DrawTreeNodeEventArgs (dc, node, node_bounds, tree_node_state);
|
||||
DrawTreeNodeEventArgs e = new DrawTreeNodeEventArgs (dc, node, node_bounds, tree_node_state);
|
||||
|
||||
OnDrawNode (e);
|
||||
OnDrawNode (e);
|
||||
if (!e.DrawDefault)
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -416,11 +416,6 @@ namespace System.Windows.Forms {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (vkey == 0) {
|
||||
buffer = String.Empty;
|
||||
return 0;
|
||||
}
|
||||
|
||||
XEvent e = new XEvent ();
|
||||
e.AnyEvent.type = XEventName.KeyPress;
|
||||
e.KeyEvent.display = display;
|
||||
@@ -445,15 +440,6 @@ namespace System.Windows.Forms {
|
||||
|
||||
e.KeyEvent.state |= AltGrMask;
|
||||
|
||||
if ((vkey >= (int) VirtualKeys.VK_NUMPAD0) && (vkey <= (int) VirtualKeys.VK_NUMPAD9))
|
||||
e.KeyEvent.keycode = XKeysymToKeycode (display, vkey - (int) VirtualKeys.VK_NUMPAD0 + (int) KeypadKeys.XK_KP_0);
|
||||
|
||||
if (vkey == (int) VirtualKeys.VK_DECIMAL)
|
||||
e.KeyEvent.keycode = XKeysymToKeycode (display, (int) KeypadKeys.XK_KP_Decimal);
|
||||
|
||||
if (vkey == (int) VirtualKeys.VK_SEPARATOR)
|
||||
e.KeyEvent.keycode = XKeysymToKeycode(display, (int) KeypadKeys.XK_KP_Separator);
|
||||
|
||||
for (int keyc = min_keycode; (keyc <= max_keycode) && (e.KeyEvent.keycode == 0); keyc++) {
|
||||
// find keycode that could have generated this vkey
|
||||
if ((keyc2vkey [keyc] & 0xFF) == vkey) {
|
||||
@@ -466,6 +452,15 @@ namespace System.Windows.Forms {
|
||||
}
|
||||
}
|
||||
|
||||
if ((vkey >= (int) VirtualKeys.VK_NUMPAD0) && (vkey <= (int) VirtualKeys.VK_NUMPAD9))
|
||||
e.KeyEvent.keycode = XKeysymToKeycode (display, vkey - (int) VirtualKeys.VK_NUMPAD0 + (int) KeypadKeys.XK_KP_0);
|
||||
|
||||
if (vkey == (int) VirtualKeys.VK_DECIMAL)
|
||||
e.KeyEvent.keycode = XKeysymToKeycode (display, (int) KeypadKeys.XK_KP_Decimal);
|
||||
|
||||
if (vkey == (int) VirtualKeys.VK_SEPARATOR)
|
||||
e.KeyEvent.keycode = XKeysymToKeycode(display, (int) KeypadKeys.XK_KP_Separator);
|
||||
|
||||
if (e.KeyEvent.keycode == 0 && vkey != (int) VirtualKeys.VK_NONAME) {
|
||||
// And I couldn't find the keycode so i returned the vkey and was like whatever
|
||||
Console.Error.WriteLine ("unknown virtual key {0:X}", vkey);
|
||||
@@ -1218,7 +1213,7 @@ namespace System.Windows.Forms {
|
||||
if (xic != IntPtr.Zero && have_Xutf8LookupString && xevent.type == XEventName.KeyPress) {
|
||||
do {
|
||||
try {
|
||||
res = Xutf8LookupString (xic, ref xevent, lookup_byte_buffer, lookup_byte_buffer.Length, out keysym_res, out status);
|
||||
res = Xutf8LookupString (xic, ref xevent, lookup_byte_buffer, 100, out keysym_res, out status);
|
||||
} catch (EntryPointNotFoundException) {
|
||||
have_Xutf8LookupString = false;
|
||||
|
||||
@@ -1236,10 +1231,8 @@ namespace System.Windows.Forms {
|
||||
return s.Length;
|
||||
} else {
|
||||
IntPtr statusPtr = IntPtr.Zero;
|
||||
res = XLookupString (ref xevent, lookup_byte_buffer, len, out keysym_res, out statusPtr);
|
||||
lookup_buffer.Length = 0;
|
||||
string s = Encoding.ASCII.GetString (lookup_byte_buffer, 0, res);
|
||||
lookup_buffer.Append (s);
|
||||
res = XLookupString (ref xevent, lookup_buffer, len, out keysym_res, out statusPtr);
|
||||
keysym = (XKeySym) keysym_res.ToInt32 ();
|
||||
return res;
|
||||
}
|
||||
@@ -1305,7 +1298,7 @@ namespace System.Windows.Forms {
|
||||
private static extern bool XSetLocaleModifiers (string mods);
|
||||
|
||||
[DllImport ("libX11")]
|
||||
internal extern static int XLookupString(ref XEvent xevent, byte [] buffer, int num_bytes, out IntPtr keysym, out IntPtr status);
|
||||
internal extern static int XLookupString(ref XEvent xevent, StringBuilder buffer, int num_bytes, out IntPtr keysym, out IntPtr status);
|
||||
[DllImport ("libX11")]
|
||||
internal extern static int Xutf8LookupString(IntPtr xic, ref XEvent xevent, byte [] buffer, int num_bytes, out IntPtr keysym, out XLookupStatus status);
|
||||
|
||||
|
||||
Loaded 100 of 524 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user