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

@ -7,38 +7,39 @@ export class CameraPublishStatusMessageParser implements IMessageParser
private _secondsToWait: number = 0; private _secondsToWait: number = 0;
private _extraDataId: string; private _extraDataId: string;
public isOk(): boolean
{
return this._ok;
}
public getSecondsToWait(): number
{
return this._secondsToWait;
}
public getExtraDataId(): string
{
return this._extraDataId;
}
public flush(): boolean public flush(): boolean
{ {
this._ok = false; this._ok = false;
this._secondsToWait = 0; this._secondsToWait = 0;
this._extraDataId = null; this._extraDataId = null;
return true; return true;
} }
public parse(k: IMessageDataWrapper): boolean public parse(wrapper: IMessageDataWrapper): boolean
{ {
this._ok = k.readBoolean(); if(!wrapper) return false;
this._secondsToWait = k.readInt();
if(((this._ok) && (k.bytesAvailable))) this._ok = wrapper.readBoolean();
{ this._secondsToWait = wrapper.readInt();
this._extraDataId = k.readString();
} if(this._ok && wrapper.bytesAvailable) this._extraDataId = wrapper.readString();
return true; return true;
} }
public get ok(): boolean
{
return this._ok;
}
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
{
this._url = '';
return true;
}
public parse(wrapper: IMessageDataWrapper): boolean
{
if(!wrapper) return false;
this._url = wrapper.readString();
return true;
}
public get url(): string
{ {
return this._url; return this._url;
} }
public flush():boolean
{
this._url = '';
return true;
}
public parse(k:IMessageDataWrapper):boolean
{
this._url = k.readString();
return true;
}
} }

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;
}
public parse(wrapper: IMessageDataWrapper): boolean
{
if(!wrapper) return false;
this._ok = wrapper.readBoolean();
this._errorReason = wrapper.readString();
return true;
}
public get ok(): boolean
{ {
return this._ok; return this._ok;
} }
public getErrorReason():string public get errorReason(): string
{ {
return this._errorReason; return this._errorReason;
} }
public flush():boolean
{
this._ok = false;
this._errorReason = null;
return true;
}
public parse(k:IMessageDataWrapper):boolean
{
this._ok = k.readBoolean();
this._errorReason = k.readString();
return true;
}
} }

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
public getCreditPrice():number
{
return this._creditPrice;
}
public getDucketPrice():number
{
return this._ducketPrice;
}
public getPublishDucketPrice():number
{
return this._publishDucketPrice;
}
public flush():boolean
{ {
this._creditPrice = 0; this._creditPrice = 0;
this._ducketPrice = 0; this._ducketPrice = 0;
this._publishDucketPrice = 0; this._publishDucketPrice = 0;
return true; return true;
} }
public parse(k:IMessageDataWrapper):boolean public parse(wrapper: IMessageDataWrapper): boolean
{ {
this._creditPrice = k.readInt(); if(!wrapper) return false;
this._ducketPrice = k.readInt();
if(k.bytesAvailable) this._creditPrice = wrapper.readInt();
{ this._ducketPrice = wrapper.readInt();
this._publishDucketPrice = k.readInt();
} if(wrapper.bytesAvailable) this._publishDucketPrice = wrapper.readInt();
return true; return true;
} }
public get creditPrice(): number
{
return this._creditPrice;
}
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
public isOk():boolean
{
return this._ok;
}
public isRenderLimitHit():boolean
{
return this._renderLimitHit;
}
public flush():boolean
{ {
this._ok = true; this._ok = true;
this._renderLimitHit = false; this._renderLimitHit = false;
return true; return true;
} }
public parse(k:IMessageDataWrapper):boolean public parse(wrapper: IMessageDataWrapper): boolean
{ {
if(k.bytesAvailable) if(!wrapper) return false;
if(wrapper.bytesAvailable)
{ {
this._ok = k.readBoolean(); this._ok = wrapper.readBoolean();
this._renderLimitHit = k.readBoolean(); this._renderLimitHit = wrapper.readBoolean();
} }
return true; return true;
} }
public get ok(): boolean
{
return this._ok;
}
public get isRenderLimitHit(): boolean
{
return this._renderLimitHit;
}
} }