diff options
Diffstat (limited to 'src/WixToolset.Core/LocalizationParser.cs')
| -rw-r--r-- | src/WixToolset.Core/LocalizationParser.cs | 69 |
1 files changed, 37 insertions, 32 deletions
diff --git a/src/WixToolset.Core/LocalizationParser.cs b/src/WixToolset.Core/LocalizationParser.cs index f7f86a54..a3272fc8 100644 --- a/src/WixToolset.Core/LocalizationParser.cs +++ b/src/WixToolset.Core/LocalizationParser.cs | |||
| @@ -5,7 +5,6 @@ namespace WixToolset.Core | |||
| 5 | using System; | 5 | using System; |
| 6 | using System.Collections.Generic; | 6 | using System.Collections.Generic; |
| 7 | using System.Xml.Linq; | 7 | using System.Xml.Linq; |
| 8 | using WixToolset.Core.Native; | ||
| 9 | using WixToolset.Data; | 8 | using WixToolset.Data; |
| 10 | using WixToolset.Data.Bind; | 9 | using WixToolset.Data.Bind; |
| 11 | using WixToolset.Extensibility; | 10 | using WixToolset.Extensibility; |
| @@ -14,7 +13,7 @@ namespace WixToolset.Core | |||
| 14 | internal class LocalizationParser : ILocalizationParser | 13 | internal class LocalizationParser : ILocalizationParser |
| 15 | { | 14 | { |
| 16 | public static readonly XNamespace WxlNamespace = "http://wixtoolset.org/schemas/v4/wxl"; | 15 | public static readonly XNamespace WxlNamespace = "http://wixtoolset.org/schemas/v4/wxl"; |
| 17 | private static string XmlElementName = "WixLocalization"; | 16 | private const string XmlElementName = "WixLocalization"; |
| 18 | 17 | ||
| 19 | internal LocalizationParser(IServiceProvider serviceProvider) | 18 | internal LocalizationParser(IServiceProvider serviceProvider) |
| 20 | { | 19 | { |
| @@ -215,13 +214,14 @@ namespace WixToolset.Core | |||
| 215 | { | 214 | { |
| 216 | string dialog = null; | 215 | string dialog = null; |
| 217 | string control = null; | 216 | string control = null; |
| 218 | int x = CompilerConstants.IntegerNotSet; | 217 | var x = CompilerConstants.IntegerNotSet; |
| 219 | int y = CompilerConstants.IntegerNotSet; | 218 | var y = CompilerConstants.IntegerNotSet; |
| 220 | int width = CompilerConstants.IntegerNotSet; | 219 | var width = CompilerConstants.IntegerNotSet; |
| 221 | int height = CompilerConstants.IntegerNotSet; | 220 | var height = CompilerConstants.IntegerNotSet; |
| 222 | int attribs = 0; | 221 | var sourceLineNumbers = SourceLineNumber.CreateFromXObject(node); |
| 223 | string text = null; | 222 | var rightToLeft = false; |
| 224 | SourceLineNumber sourceLineNumbers = SourceLineNumber.CreateFromXObject(node); | 223 | var rightAligned = false; |
| 224 | var leftScroll = false; | ||
| 225 | 225 | ||
| 226 | foreach (XAttribute attrib in node.Attributes()) | 226 | foreach (XAttribute attrib in node.Attributes()) |
| 227 | { | 227 | { |
| @@ -236,34 +236,37 @@ namespace WixToolset.Core | |||
| 236 | control = Common.GetAttributeIdentifierValue(messaging, sourceLineNumbers, attrib); | 236 | control = Common.GetAttributeIdentifierValue(messaging, sourceLineNumbers, attrib); |
| 237 | break; | 237 | break; |
| 238 | case "X": | 238 | case "X": |
| 239 | x = Common.GetAttributeIntegerValue(messaging, sourceLineNumbers, attrib, 0, short.MaxValue); | 239 | x = Common.GetAttributeIntegerValue(messaging, sourceLineNumbers, attrib, 0, Int16.MaxValue); |
| 240 | break; | 240 | break; |
| 241 | case "Y": | 241 | case "Y": |
| 242 | y = Common.GetAttributeIntegerValue(messaging, sourceLineNumbers, attrib, 0, short.MaxValue); | 242 | y = Common.GetAttributeIntegerValue(messaging, sourceLineNumbers, attrib, 0, Int16.MaxValue); |
| 243 | break; | 243 | break; |
| 244 | case "Width": | 244 | case "Width": |
| 245 | width = Common.GetAttributeIntegerValue(messaging, sourceLineNumbers, attrib, 0, short.MaxValue); | 245 | width = Common.GetAttributeIntegerValue(messaging, sourceLineNumbers, attrib, 0, Int16.MaxValue); |
| 246 | break; | 246 | break; |
| 247 | case "Height": | 247 | case "Height": |
| 248 | height = Common.GetAttributeIntegerValue(messaging, sourceLineNumbers, attrib, 0, short.MaxValue); | 248 | height = Common.GetAttributeIntegerValue(messaging, sourceLineNumbers, attrib, 0, Int16.MaxValue); |
| 249 | break; | 249 | break; |
| 250 | case "RightToLeft": | 250 | case "RightToLeft": |
| 251 | if (YesNoType.Yes == Common.GetAttributeYesNoValue(messaging, sourceLineNumbers, attrib)) | 251 | rightToLeft = YesNoType.Yes == Common.GetAttributeYesNoValue(messaging, sourceLineNumbers, attrib); |
| 252 | { | 252 | //if (YesNoType.Yes == Common.GetAttributeYesNoValue(messaging, sourceLineNumbers, attrib)) |
| 253 | attribs |= MsiInterop.MsidbControlAttributesRTLRO; | 253 | //{ |
| 254 | } | 254 | // attribs |= MsiInterop.MsidbControlAttributesRTLRO; |
| 255 | //} | ||
| 255 | break; | 256 | break; |
| 256 | case "RightAligned": | 257 | case "RightAligned": |
| 257 | if (YesNoType.Yes == Common.GetAttributeYesNoValue(messaging, sourceLineNumbers, attrib)) | 258 | rightAligned = YesNoType.Yes == Common.GetAttributeYesNoValue(messaging, sourceLineNumbers, attrib); |
| 258 | { | 259 | //if (YesNoType.Yes == Common.GetAttributeYesNoValue(messaging, sourceLineNumbers, attrib)) |
| 259 | attribs |= MsiInterop.MsidbControlAttributesRightAligned; | 260 | //{ |
| 260 | } | 261 | // attribs |= MsiInterop.MsidbControlAttributesRightAligned; |
| 262 | //} | ||
| 261 | break; | 263 | break; |
| 262 | case "LeftScroll": | 264 | case "LeftScroll": |
| 263 | if (YesNoType.Yes == Common.GetAttributeYesNoValue(messaging, sourceLineNumbers, attrib)) | 265 | leftScroll = YesNoType.Yes == Common.GetAttributeYesNoValue(messaging, sourceLineNumbers, attrib); |
| 264 | { | 266 | //if (YesNoType.Yes == Common.GetAttributeYesNoValue(messaging, sourceLineNumbers, attrib)) |
| 265 | attribs |= MsiInterop.MsidbControlAttributesLeftScroll; | 267 | //{ |
| 266 | } | 268 | // attribs |= MsiInterop.MsidbControlAttributesLeftScroll; |
| 269 | //} | ||
| 267 | break; | 270 | break; |
| 268 | default: | 271 | default: |
| 269 | Common.UnexpectedAttribute(messaging, sourceLineNumbers, attrib); | 272 | Common.UnexpectedAttribute(messaging, sourceLineNumbers, attrib); |
| @@ -276,19 +279,21 @@ namespace WixToolset.Core | |||
| 276 | } | 279 | } |
| 277 | } | 280 | } |
| 278 | 281 | ||
| 279 | text = Common.GetInnerText(node); | 282 | var text = Common.GetInnerText(node); |
| 280 | 283 | ||
| 281 | if (String.IsNullOrEmpty(control) && 0 < attribs) | 284 | if (String.IsNullOrEmpty(control) && (rightToLeft || rightAligned || leftScroll)) |
| 282 | { | 285 | { |
| 283 | if (MsiInterop.MsidbControlAttributesRTLRO == (attribs & MsiInterop.MsidbControlAttributesRTLRO)) | 286 | if (rightToLeft) |
| 284 | { | 287 | { |
| 285 | messaging.Write(ErrorMessages.IllegalAttributeWithoutOtherAttributes(sourceLineNumbers, node.Name.ToString(), "RightToLeft", "Control")); | 288 | messaging.Write(ErrorMessages.IllegalAttributeWithoutOtherAttributes(sourceLineNumbers, node.Name.ToString(), "RightToLeft", "Control")); |
| 286 | } | 289 | } |
| 287 | else if (MsiInterop.MsidbControlAttributesRightAligned == (attribs & MsiInterop.MsidbControlAttributesRightAligned)) | 290 | |
| 291 | if (rightAligned) | ||
| 288 | { | 292 | { |
| 289 | messaging.Write(ErrorMessages.IllegalAttributeWithoutOtherAttributes(sourceLineNumbers, node.Name.ToString(), "RightAligned", "Control")); | 293 | messaging.Write(ErrorMessages.IllegalAttributeWithoutOtherAttributes(sourceLineNumbers, node.Name.ToString(), "RightAligned", "Control")); |
| 290 | } | 294 | } |
| 291 | else if (MsiInterop.MsidbControlAttributesLeftScroll == (attribs & MsiInterop.MsidbControlAttributesLeftScroll)) | 295 | |
| 296 | if (leftScroll) | ||
| 292 | { | 297 | { |
| 293 | messaging.Write(ErrorMessages.IllegalAttributeWithoutOtherAttributes(sourceLineNumbers, node.Name.ToString(), "LeftScroll", "Control")); | 298 | messaging.Write(ErrorMessages.IllegalAttributeWithoutOtherAttributes(sourceLineNumbers, node.Name.ToString(), "LeftScroll", "Control")); |
| 294 | } | 299 | } |
| @@ -301,8 +306,8 @@ namespace WixToolset.Core | |||
| 301 | 306 | ||
| 302 | if (!messaging.EncounteredError) | 307 | if (!messaging.EncounteredError) |
| 303 | { | 308 | { |
| 304 | LocalizedControl localizedControl = new LocalizedControl(dialog, control, x, y, width, height, attribs, text); | 309 | var localizedControl = new LocalizedControl(dialog, control, x, y, width, height, rightToLeft, rightAligned, leftScroll, text); |
| 305 | string key = localizedControl.GetKey(); | 310 | var key = localizedControl.GetKey(); |
| 306 | if (localizedControls.ContainsKey(key)) | 311 | if (localizedControls.ContainsKey(key)) |
| 307 | { | 312 | { |
| 308 | if (String.IsNullOrEmpty(localizedControl.Control)) | 313 | if (String.IsNullOrEmpty(localizedControl.Control)) |
