Created
October 23, 2014 06:20
-
-
Save rcombs/8b39fabf90dadf894dbd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module libjass { | |
export class ASSStream { | |
public ASS: ASS; | |
private buffer: string; | |
private state: boolean; | |
constructor() { | |
this.state = 0; | |
this.buffer = ""; | |
} | |
append(raw: string): boolean { | |
var lines: string[] = raw.split("\n"); | |
switch (this.ready) { | |
case false: | |
for (var i = 0; i < lines.length; i++) { | |
var line = lines[i]; | |
if (line == "[Events]") { | |
this.ready = 1; | |
} | |
this.buffer += line + "\n"; | |
} | |
if (this.ready) | |
this.ASS = ASS.fromString(this.buffer); | |
break; | |
case true: | |
for (var i = 0; i < lines.length; i++) { | |
this.ASS.addEvent(lines[i]); | |
} | |
} | |
return this.ready; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment