benjisimon icon

LocalConfigurationOps

benjisimon | PRO | 04/25/13 09:00:12 PM UTC | 0 ⭐ | 11257 👁️ | Never ⏰ | []
ActionScript 3 |

0 B

|

None

|

0 👍

/

0 👎

/*
 * Class LocalConfigurationOps is responsible for working with our local configuration
 */
package XXXX.ops {
  import com.ideas2executables.util.C;
  import flash.data.EncryptedLocalStore;
  import flash.utils.ByteArray;
 
  public class LocalConfigurationOps {
    
    public static function get():Object {
      var keysBytes:ByteArray = EncryptedLocalStore.getItem("localConfig.keys");
      if(keysBytes == null) {
        return null;
      }
 
      var data:Object = {};
      var keys:Object = JSON.parse(keysBytes.readUTFBytes(keysBytes.length));
      for(var i:int = 0; i < keys.length; i++) {
        var buffer:ByteArray = EncryptedLocalStore.getItem("localConfig.item." + keys[i]);
        if(buffer == null) {
          data[keys[i]] = null;
        } else {
          data[keys[i]] = JSON.parse(buffer.readUTFBytes(buffer.length));
        }
      }
 
      return data;
 
    }
 
    public static function set(data:Object):void {
      var existing:Object = LocalConfigurationOps.get();
      var k:String = null;
      var buffer:ByteArray = null;
      if(existing != null) {
        for(k in existing) {
          EncryptedLocalStore.removeItem("localConfig.item." + k);
        }
      }
 
      var keys:Array = [];
      for(k in data) {
        buffer = new ByteArray();
        buffer.writeUTFBytes(JSON.stringify(data[k]));
        EncryptedLocalStore.setItem("localConfig.item." + k, buffer);
        keys.push(k);
      }
 
      buffer = new ByteArray();
      buffer.writeUTFBytes(JSON.stringify(keys))
      EncryptedLocalStore.setItem("localConfig.keys", buffer);
    }
  }
}

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  • Fuxuinu icon
    05/27/26 05:59:08 AM UTC
    text |

    0 B

    |

    0 👍

    /

    0 👎

    Best t33n active cpx link daily updates!
     Copy and paste the link in a new browser tab and then hit enter!
     https://crazyporn.xxx/members/157354/?asgtbndr=1&play=true&spon=adworld&zone=400