Brought up to date with the private repository (feea4c7)

This commit is contained in:
S committed 2026-10-14 20:57:33 +03:00
1 parent 1aa738d692
commit 1b1df1ae48
7925 files changed
+2617237 -20

No files matched your search

@@ -0,0 +1,130 @@
package it.gotoandplay.smartfoxserver.util
{
public class Entities
{
private static var ascTab:Array = [];
ascTab[">"] = ">";
ascTab["<"] = "&lt;";
ascTab["&"] = "&amp;";
ascTab["\'"] = "&apos;";
ascTab["\""] = "&quot;";
private static var ascTabRev:Array = [];
ascTabRev["&gt;"] = ">";
ascTabRev["&lt;"] = "<";
ascTabRev["&amp;"] = "&";
ascTabRev["&apos;"] = "\'";
ascTabRev["&quot;"] = "\"";
private static var hexTable:Array = [];
hexTable["0"] = 0;
hexTable["1"] = 1;
hexTable["2"] = 2;
hexTable["3"] = 3;
hexTable["4"] = 4;
hexTable["5"] = 5;
hexTable["6"] = 6;
hexTable["7"] = 7;
hexTable["8"] = 8;
hexTable["9"] = 9;
hexTable["A"] = 10;
hexTable["B"] = 11;
hexTable["C"] = 12;
hexTable["D"] = 13;
hexTable["E"] = 14;
hexTable["F"] = 15;
public function Entities()
{
super();
}
public static function encodeEntities(param1:String) : String
{
var _loc4_:int = 0;
var _loc2_:String = null;
var _loc5_:int = 0;
var _loc3_:String = "";
_loc4_ = 0;
while(_loc4_ < param1.length)
{
_loc2_ = param1.charAt(_loc4_);
_loc5_ = param1.charCodeAt(_loc4_);
if(_loc5_ == 9 || _loc5_ == 10 || _loc5_ == 13)
{
_loc3_ += _loc2_;
}
else if(_loc5_ >= 32 && _loc5_ <= 126)
{
if(ascTab[_loc2_] != null)
{
_loc3_ += ascTab[_loc2_];
}
else
{
_loc3_ += _loc2_;
}
}
else
{
_loc3_ += _loc2_;
}
_loc4_++;
}
return _loc3_;
}
public static function decodeEntities(param1:String) : String
{
var _loc5_:String = null;
var _loc3_:String = null;
var _loc7_:String = null;
var _loc4_:String = null;
var _loc2_:String = null;
var _loc6_:int = 0;
_loc5_ = "";
while(_loc6_ < param1.length)
{
_loc3_ = param1.charAt(_loc6_);
if(_loc3_ == "&")
{
_loc7_ = _loc3_;
do
{
_loc6_++;
_loc4_ = param1.charAt(_loc6_);
_loc7_ += _loc4_;
}
while(_loc4_ != ";" && _loc6_ < param1.length);
_loc2_ = ascTabRev[_loc7_];
if(_loc2_ != null)
{
_loc5_ += _loc2_;
}
else
{
_loc5_ += String.fromCharCode(getCharCode(_loc7_));
}
}
else
{
_loc5_ += _loc3_;
}
_loc6_++;
}
return _loc5_;
}
public static function getCharCode(param1:String) : Number
{
var _loc2_:String = param1.substr(3,param1.length);
_loc2_ = _loc2_.substr(0,_loc2_.length - 1);
return Number("0x" + _loc2_);
}
}
}
@@ -0,0 +1,50 @@
package it.gotoandplay.smartfoxserver.util
{
import flash.events.ErrorEvent;
import flash.events.SecurityErrorEvent;
public class FailCode
{
public static const TYPE_SOCKET:int = 1;
public static const TYPE_BLUEBOX:int = 2;
public static const PHASE_INIT:int = 256;
public static const PHASE_CONNECTED:int = 512;
public static const REASON_SECURITY:int = 65536;
public static const REASON_IO:int = 131072;
public static const REASON_PIN:int = 262144;
public static const REASON_API:int = 524288;
public static const REASON_POLL:int = 1048576;
public static const REASON_UNSUPPORTED:int = 2097152;
public function FailCode()
{
super();
}
public static function build(param1:int, param2:int, param3:int) : int
{
return param1 | param2 | param3;
}
public static function getReasonFromEvent(param1:ErrorEvent) : int
{
return param1 is SecurityErrorEvent ? 65536 : 131072;
}
public static function getTypeFromConnectionMode(param1:String) : int
{
return param1 == "http" ? 2 : 1;
}
}
}
@@ -0,0 +1,175 @@
package it.gotoandplay.smartfoxserver.util
{
public class ObjectSerializer
{
private static var instance:ObjectSerializer;
private var debug:Boolean;
private var eof:String;
private var tabs:String;
public function ObjectSerializer(param1:Boolean = false)
{
super();
this.tabs = "\t\t\t\t\t\t\t\t\t\t\t\t\t";
setDebug(param1);
}
public static function getInstance(param1:Boolean = false) : ObjectSerializer
{
if(instance == null)
{
instance = new ObjectSerializer(param1);
}
return instance;
}
private function setDebug(param1:Boolean) : void
{
this.debug = param1;
if(this.debug)
{
this.eof = "\n";
}
else
{
this.eof = "";
}
}
public function serialize(param1:Object) : String
{
var _loc2_:Object = {};
obj2xml(param1,_loc2_);
return _loc2_.xmlStr;
}
public function deserialize(param1:String) : Object
{
var _loc3_:XML = new XML(param1);
var _loc2_:Object = {};
xml2obj(_loc3_,_loc2_);
return _loc2_;
}
private function obj2xml(param1:Object, param2:Object, param3:int = 0, param4:String = "") : void
{
var _loc6_:String = null;
var _loc5_:String = null;
var _loc8_:* = undefined;
if(param3 == 0)
{
param2.xmlStr = "<dataObj>" + this.eof;
}
else
{
if(this.debug)
{
param2.xmlStr += this.tabs.substr(0,param3);
}
_loc6_ = param1 is Array ? "a" : "o";
param2.xmlStr += "<obj t=\'" + _loc6_ + "\' o=\'" + param4 + "\'>" + this.eof;
}
for(var _loc7_:String in param1)
{
_loc5_ = typeof param1[_loc7_];
_loc8_ = param1[_loc7_];
if(_loc5_ == "boolean" || _loc5_ == "number" || _loc5_ == "string" || _loc5_ == "null")
{
if(_loc5_ == "boolean")
{
_loc8_ = Number(_loc8_);
}
else if(_loc5_ == "null")
{
_loc5_ = "x";
_loc8_ = "";
}
else if(_loc5_ == "string")
{
_loc8_ = Entities.encodeEntities(_loc8_);
}
if(this.debug)
{
param2.xmlStr += this.tabs.substr(0,param3 + 1);
}
param2.xmlStr += "<var n=\'" + _loc7_ + "\' t=\'" + _loc5_.substr(0,1) + "\'>" + _loc8_ + "</var>" + this.eof;
}
else if(_loc5_ == "object")
{
obj2xml(_loc8_,param2,param3 + 1,_loc7_);
if(this.debug)
{
param2.xmlStr += this.tabs.substr(0,param3 + 1);
}
param2.xmlStr += "</obj>" + this.eof;
}
}
if(param3 == 0)
{
param2.xmlStr += "</dataObj>" + this.eof;
}
}
private function xml2obj(param1:XML, param2:Object) : void
{
var _loc3_:String = null;
var _loc9_:String = null;
var _loc10_:String = null;
var _loc5_:String = null;
var _loc6_:String = null;
var _loc11_:String = null;
var _loc8_:int = 0;
var _loc7_:XMLList = param1.children();
for each(var _loc4_:XML in _loc7_)
{
_loc3_ = _loc4_.name().toString();
if(_loc3_ == "obj")
{
_loc9_ = _loc4_.@o;
_loc10_ = _loc4_.@t;
if(_loc10_ == "a")
{
param2[_loc9_] = [];
}
else if(_loc10_ == "o")
{
param2[_loc9_] = {};
}
xml2obj(_loc4_,param2[_loc9_]);
}
else if(_loc3_ == "var")
{
_loc5_ = _loc4_.@n;
_loc6_ = _loc4_.@t;
_loc11_ = _loc4_.toString();
if(_loc6_ == "b")
{
param2[_loc5_] = _loc11_ == "0" ? false : true;
}
else if(_loc6_ == "n")
{
param2[_loc5_] = Number(_loc11_);
}
else if(_loc6_ == "s")
{
param2[_loc5_] = _loc11_;
}
else if(_loc6_ == "x")
{
param2[_loc5_] = null;
}
}
}
}
private function encodeEntities(param1:String) : String
{
return param1;
}
}
}