forked from billsonnn/nitro-renderer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
billsonnn#28 - UserClassificationMessageEvent added
- Loading branch information
Showing
8 changed files
with
82 additions
and
1 deletion.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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
This file contains 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
16 changes: 16 additions & 0 deletions
16
...itro/communication/messages/incoming/userclassification/UserClassificationMessageEvent.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { IMessageEvent } from '../../../../../api'; | ||
import { MessageEvent } from '../../../../../events'; | ||
import { UserClassificationMessageParser } from '../../parser'; | ||
|
||
export class UserClassificationMessageEvent extends MessageEvent implements IMessageEvent | ||
{ | ||
constructor(callBack: Function) | ||
{ | ||
super(callBack, UserClassificationMessageParser); | ||
} | ||
|
||
public getParser(): UserClassificationMessageParser | ||
{ | ||
return this.parser as UserClassificationMessageParser; | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
src/nitro/communication/messages/incoming/userclassification/index.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './UserClassificationMessageEvent'; |
This file contains 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
59 changes: 59 additions & 0 deletions
59
...nitro/communication/messages/parser/userclassification/UserClassificationMessageParser.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; | ||
|
||
export class UserClassificationMessageParser implements IMessageParser | ||
{ | ||
private _classifiedUsersNames: Map<number, string>; | ||
private _classifiedUsersClass: Map<number, string>; | ||
|
||
public flush(): boolean | ||
{ | ||
if(this._classifiedUsersNames) | ||
{ | ||
this._classifiedUsersNames = new Map(); | ||
} | ||
if(this._classifiedUsersClass) | ||
{ | ||
this._classifiedUsersClass = new Map(); | ||
} | ||
|
||
return true; | ||
} | ||
|
||
public parse(wrapper: IMessageDataWrapper): boolean | ||
{ | ||
if(!wrapper) return false; | ||
|
||
let _local_3: number; | ||
let _local_4: string; | ||
let _local_5: string; | ||
|
||
const _local_2: number = wrapper.readInt(); | ||
|
||
this._classifiedUsersNames = new Map(); | ||
this._classifiedUsersClass = new Map(); | ||
|
||
let _local_6: number; | ||
|
||
while(_local_6 < _local_2) | ||
{ | ||
_local_3 = wrapper.readInt(); | ||
_local_4 = wrapper.readString(); | ||
_local_5 = wrapper.readString(); | ||
this._classifiedUsersNames.set(_local_3, _local_4); | ||
this._classifiedUsersClass.set(_local_3, _local_5); | ||
_local_6++; | ||
} | ||
|
||
return true; | ||
} | ||
|
||
public get classifiedUsernameMap(): Map<number, string> | ||
{ | ||
return this._classifiedUsersNames; | ||
} | ||
|
||
public get classifiedUserTypeMap(): Map<number, string> | ||
{ | ||
return this._classifiedUsersClass; | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
src/nitro/communication/messages/parser/userclassification/index.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './UserClassificationMessageParser'; |