Now it mostly works with some limitations:
- ambient declarations seem not to be working, thus the following converters have temporarily been disabled: - punycode - utf8 - quoted-printable
This commit is contained in:
		
							parent
							
								
									3938254b36
								
							
						
					
					
						commit
						8fc3b8e3aa
					
				
					 20 changed files with 115 additions and 130 deletions
				
			
		|  | @ -5,11 +5,12 @@ import {Converter} from "./converter/converter"; | |||
| import {NativeLibraryWrapperService} from "./nativelibrarywrapper.service"; | ||||
| import {Step} from "./step"; | ||||
| 
 | ||||
| import "../assets/css/style.css"; | ||||
| 
 | ||||
| @Component({ | ||||
|     moduleId: module.id, | ||||
|     selector: "den-app", | ||||
|     templateUrl: "app.component.html", | ||||
|     styleUrls: ["app.component.css"], | ||||
|     templateUrl: "./app.component.html", | ||||
|     styleUrls: ["./app.component.css"], | ||||
|     providers: [ConverterRegistryService, InputComponentManagerService, NativeLibraryWrapperService] | ||||
| }) | ||||
| export class AppComponent extends OnInit { | ||||
|  |  | |||
|  | @ -15,6 +15,7 @@ export class PunycodeDecoder implements Converter { | |||
|     } | ||||
| 
 | ||||
|     convert(input: string): string { | ||||
|         return this.nativeLibraryWrapperService.punycode.decode(input); | ||||
|         // return this.nativeLibraryWrapperService.punycode.decode(input);
 | ||||
|         return ""; | ||||
|     } | ||||
| } | ||||
|  |  | |||
|  | @ -15,6 +15,7 @@ export class PunycodeEncoder implements Converter { | |||
|     } | ||||
| 
 | ||||
|     convert(input: string): string { | ||||
|         return this.nativeLibraryWrapperService.punycode.encode(input); | ||||
|         // return this.nativeLibraryWrapperService.punycode.encode(input);
 | ||||
|         return ""; | ||||
|     } | ||||
| } | ||||
|  |  | |||
|  | @ -14,10 +14,10 @@ export class QuotedPrintableDecoder implements Converter { | |||
|     } | ||||
| 
 | ||||
|     convert(input:string):string { | ||||
|         try { | ||||
|             return this.nativeLibraryWrapperService.utf8.decode(this.nativeLibraryWrapperService.quotedPrintable.decode(input)); | ||||
|         } catch (error) { | ||||
|         // try {
 | ||||
|         //     return this.nativeLibraryWrapperService.utf8.decode(this.nativeLibraryWrapperService.quotedPrintable.decode(input));
 | ||||
|         // } catch (error) {
 | ||||
|             throw new Error("The input can not be interpreted as quoted-printable. May be corrupt?"); | ||||
|         } | ||||
|         // }
 | ||||
|     } | ||||
| } | ||||
|  |  | |||
|  | @ -14,6 +14,7 @@ export class QuotedPrintableEncoder implements Converter { | |||
|     } | ||||
| 
 | ||||
|     convert(input:string):string { | ||||
|         return this.nativeLibraryWrapperService.quotedPrintable.encode(this.nativeLibraryWrapperService.utf8.encode(input)); | ||||
|         // return this.nativeLibraryWrapperService.quotedPrintable.encode(this.nativeLibraryWrapperService.utf8.encode(input));
 | ||||
|         return ""; | ||||
|     } | ||||
| } | ||||
|  |  | |||
|  | @ -12,11 +12,11 @@ import {DecToHexConverter} from "./converter/dectohexconverter"; | |||
| import {HexToDecConverter} from "./converter/hextodecconverter"; | ||||
| import {DecToBinConverter} from "./converter/dectobinconverter"; | ||||
| import {BinToDecConverter} from "./converter/bintodecconverter"; | ||||
| import {QuotedPrintableDecoder} from "./converter/quotedprintabledecoder"; | ||||
| import {QuotedPrintableEncoder} from "./converter/quotedprintableencoder"; | ||||
| // import {QuotedPrintableDecoder} from "./converter/quotedprintabledecoder";
 | ||||
| // import {QuotedPrintableEncoder} from "./converter/quotedprintableencoder";
 | ||||
| import {NativeLibraryWrapperService} from "./nativelibrarywrapper.service"; | ||||
| import {PunycodeEncoder} from "./converter/punycodeencoder"; | ||||
| import {PunycodeDecoder} from "./converter/punycodedecoder"; | ||||
| // import {PunycodeEncoder} from "./converter/punycodeencoder";
 | ||||
| // import {PunycodeDecoder} from "./converter/punycodedecoder";
 | ||||
| 
 | ||||
| @Injectable() | ||||
| export class ConverterRegistryService { | ||||
|  | @ -48,14 +48,14 @@ export class ConverterRegistryService { | |||
|         this.registerConverter(new URIComponentDecoder()); | ||||
|         this.registerConverter(new HTMLEntitiesEncoder()); | ||||
|         this.registerConverter(new HTMLEntitiesDecoder()); | ||||
|         this.registerConverter(new QuotedPrintableEncoder(this.wrapper)); | ||||
|         this.registerConverter(new QuotedPrintableDecoder(this.wrapper)); | ||||
|         // this.registerConverter(new QuotedPrintableEncoder(this.wrapper));
 | ||||
|         // this.registerConverter(new QuotedPrintableDecoder(this.wrapper));
 | ||||
|         this.registerConverter(new DecToHexConverter()); | ||||
|         this.registerConverter(new HexToDecConverter()); | ||||
|         this.registerConverter(new DecToBinConverter()); | ||||
|         this.registerConverter(new BinToDecConverter()); | ||||
|         this.registerConverter(new PunycodeEncoder(this.wrapper)); | ||||
|         this.registerConverter(new PunycodeDecoder(this.wrapper)); | ||||
|         // this.registerConverter(new PunycodeEncoder(this.wrapper));
 | ||||
|         // this.registerConverter(new PunycodeDecoder(this.wrapper));
 | ||||
|     } | ||||
| 
 | ||||
|     private registerConverter(converter:Converter):void { | ||||
|  |  | |||
|  | @ -6,13 +6,13 @@ declare var punycode:any; | |||
| 
 | ||||
| @Injectable() | ||||
| export class NativeLibraryWrapperService { | ||||
|     public utf8:any; | ||||
|     public quotedPrintable:any; | ||||
|     public punycode:any; | ||||
|     // public utf8:any;
 | ||||
|     // public quotedPrintable:any;
 | ||||
|     // public punycode:any;
 | ||||
| 
 | ||||
|     constructor() { | ||||
|         this.utf8 = utf8; | ||||
|         this.quotedPrintable = quotedPrintable; | ||||
|         this.punycode = punycode; | ||||
|         // this.utf8 = utf8;
 | ||||
|         // this.quotedPrintable = quotedPrintable;
 | ||||
|         // this.punycode = punycode;
 | ||||
|     } | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue