Update packets

This commit is contained in:
Bill 2021-07-30 21:48:21 -04:00
parent df861e08ed
commit 89db02a844
6 changed files with 141 additions and 128 deletions

View File

@ -3,42 +3,43 @@ import { IMessageParser } from './../../../../../core/communication/messages/IMe
export class CameraPublishStatusMessageParser implements IMessageParser export class CameraPublishStatusMessageParser implements IMessageParser
{ {
private _ok: boolean = false; private _ok: boolean = false;
private _secondsToWait: number = 0; private _secondsToWait: number = 0;
private _extraDataId: string; private _extraDataId: string;
public flush(): boolean
{
this._ok = false;
this._secondsToWait = 0;
this._extraDataId = null;
public isOk(): boolean return true;
{ }
return this._ok;
}
public getSecondsToWait(): number public parse(wrapper: IMessageDataWrapper): boolean
{ {
return this._secondsToWait; if(!wrapper) return false;
}
public getExtraDataId(): string this._ok = wrapper.readBoolean();
{ this._secondsToWait = wrapper.readInt();
return this._extraDataId;
}
public flush(): boolean if(this._ok && wrapper.bytesAvailable) this._extraDataId = wrapper.readString();
{
this._ok = false;
this._secondsToWait = 0;
this._extraDataId = null;
return true;
}
public parse(k: IMessageDataWrapper): boolean return true;
{ }
this._ok = k.readBoolean();
this._secondsToWait = k.readInt(); public get ok(): boolean
if(((this._ok) && (k.bytesAvailable))) {
{ return this._ok;
this._extraDataId = k.readString(); }
}
return true; public get secondsToWait(): number
} {
return this._secondsToWait;
}
public get extraDataId(): string
{
return this._extraDataId;
}
} }

View File

@ -3,13 +3,15 @@ import { IMessageParser } from './../../../../../core/communication/messages/IMe
export class CameraPurchaseOKMessageParser implements IMessageParser export class CameraPurchaseOKMessageParser implements IMessageParser
{ {
public flush():boolean public flush(): boolean
{ {
return true; return true;
} }
public parse(k:IMessageDataWrapper):boolean public parse(wrapper: IMessageDataWrapper): boolean
{ {
if(!wrapper) return false;
return true; return true;
} }
} }

View File

@ -3,22 +3,26 @@ import { IMessageParser } from './../../../../../core/communication/messages/IMe
export class CameraStorageUrlMessageParser implements IMessageParser export class CameraStorageUrlMessageParser implements IMessageParser
{ {
private _url:string; private _url: string;
public get url():string public flush(): boolean
{ {
return this._url; this._url = '';
}
public flush():boolean return true;
{ }
this._url = '';
return true;
}
public parse(k:IMessageDataWrapper):boolean public parse(wrapper: IMessageDataWrapper): boolean
{ {
this._url = k.readString(); if(!wrapper) return false;
return true;
} this._url = wrapper.readString();
return true;
}
public get url(): string
{
return this._url;
}
} }

View File

@ -3,31 +3,34 @@ import { IMessageParser } from './../../../../../core/communication/messages/IMe
export class CompetitionStatusMessageParser implements IMessageParser export class CompetitionStatusMessageParser implements IMessageParser
{ {
private _ok:boolean = false; private _ok: boolean = false;
private _errorReason:string = null; private _errorReason: string = null;
public flush(): boolean
{
this._ok = false;
this._errorReason = null;
public isOk():boolean return true;
{ }
return this._ok;
}
public getErrorReason():string public parse(wrapper: IMessageDataWrapper): boolean
{ {
return this._errorReason; if(!wrapper) return false;
}
public flush():boolean this._ok = wrapper.readBoolean();
{ this._errorReason = wrapper.readString();
this._ok = false;
this._errorReason = null;
return true;
}
public parse(k:IMessageDataWrapper):boolean return true;
{ }
this._ok = k.readBoolean();
this._errorReason = k.readString(); public get ok(): boolean
return true; {
} return this._ok;
}
public get errorReason(): string
{
return this._errorReason;
}
} }

View File

@ -3,42 +3,43 @@ import { IMessageParser } from './../../../../../core/communication/messages/IMe
export class InitCameraMessageParser implements IMessageParser export class InitCameraMessageParser implements IMessageParser
{ {
private _creditPrice:number = 0; private _creditPrice: number = 0;
private _ducketPrice:number = 0; private _ducketPrice: number = 0;
private _publishDucketPrice:number = 0; private _publishDucketPrice: number = 0;
public flush(): boolean
{
this._creditPrice = 0;
this._ducketPrice = 0;
this._publishDucketPrice = 0;
public getCreditPrice():number return true;
{ }
return this._creditPrice;
}
public getDucketPrice():number public parse(wrapper: IMessageDataWrapper): boolean
{ {
return this._ducketPrice; if(!wrapper) return false;
}
public getPublishDucketPrice():number this._creditPrice = wrapper.readInt();
{ this._ducketPrice = wrapper.readInt();
return this._publishDucketPrice;
}
public flush():boolean if(wrapper.bytesAvailable) this._publishDucketPrice = wrapper.readInt();
{
this._creditPrice = 0;
this._ducketPrice = 0;
this._publishDucketPrice = 0;
return true;
}
public parse(k:IMessageDataWrapper):boolean return true;
{ }
this._creditPrice = k.readInt();
this._ducketPrice = k.readInt(); public get creditPrice(): number
if(k.bytesAvailable) {
{ return this._creditPrice;
this._publishDucketPrice = k.readInt(); }
}
return true; public get ducketPrice(): number
} {
return this._ducketPrice;
}
public get publishDucketPrice(): number
{
return this._publishDucketPrice;
}
} }

View File

@ -3,34 +3,36 @@ import { IMessageParser } from './../../../../../core/communication/messages/IMe
export class ThumbnailStatusMessageParser implements IMessageParser export class ThumbnailStatusMessageParser implements IMessageParser
{ {
private _ok:boolean = true; private _ok: boolean = true;
private _renderLimitHit:boolean = false; private _renderLimitHit: boolean = false;
public flush(): boolean
{
this._ok = true;
this._renderLimitHit = false;
return true;
}
public isOk():boolean public parse(wrapper: IMessageDataWrapper): boolean
{ {
return this._ok; if(!wrapper) return false;
}
public isRenderLimitHit():boolean if(wrapper.bytesAvailable)
{ {
return this._renderLimitHit; this._ok = wrapper.readBoolean();
} this._renderLimitHit = wrapper.readBoolean();
}
public flush():boolean return true;
{ }
this._ok = true;
this._renderLimitHit = false;
return true;
}
public parse(k:IMessageDataWrapper):boolean public get ok(): boolean
{ {
if(k.bytesAvailable) return this._ok;
{ }
this._ok = k.readBoolean();
this._renderLimitHit = k.readBoolean(); public get isRenderLimitHit(): boolean
} {
return true; return this._renderLimitHit;
} }
} }