C/C++ [Resolu] [C++] Help D20

Inscrit
27 Aout 2012
Messages
264
Reactions
0
#21
Il y a bien un readBoolean.
C'est juste que je pense que Veriditas a utilisé une ancienne version (très ancienne apparemment).
Voici l'init de la dernière version (2.18.2.82358.1) :
Code:
public function init(param1:Uri) : void {
   var _loc6_:* = 0;
   var _loc7_:* = 0;
   var _loc8_:* = false;
   var _loc10_:uint = 0;
   var _loc11_:String = null;
   var _loc2_:File = param1.toFile();
   if(!_loc2_ || !_loc2_.exists)
   {
      throw new Error("I18n file not readable.");
   }
   else
   {
      this._stream = new FileStream();
      this._stream.endian = Endian.BIG_ENDIAN;
      this._stream.open(_loc2_,FileMode.READ);
      this._indexes = new Dictionary();
      this._unDiacriticalIndex = new Dictionary();
      this._textIndexes = new Dictionary();
      this._textIndexesOverride = new Dictionary();
      this._textSortIndex = new Dictionary();
      this._textCount = 0;
      _loc3_ = this._stream.readInt();
      _loc4_ = 0;
      this._stream.position = _loc3_;
      _loc5_ = this._stream.readInt();
      _loc9_ = 0;
      while(_loc9_ < _loc5_)
      {
         _loc6_ = this._stream.readInt();
         _loc8_ = this._stream.readBoolean();
         _loc7_ = this._stream.readInt();
         this._indexes[_loc6_] = _loc7_;
         _loc4_++;
         if(_loc8_)
         {
            _loc4_++;
            _loc9_ = _loc9_ + 4;
            this._unDiacriticalIndex[_loc6_] = this._stream.readInt();
         }
         else
         {
            this._unDiacriticalIndex[_loc6_] = _loc7_;
         }
         _loc9_ = _loc9_ + 9;
      }
      _loc5_ = this._stream.readInt();
      while(_loc5_ > 0)
      {
         _loc10_ = this._stream.position;
         _loc11_ = this._stream.readUTF();
         _loc7_ = this._stream.readInt();
         this._textCount++;
         this._textIndexes[_loc11_] = _loc7_;
         _loc5_ = _loc5_ - (this._stream.position - _loc10_);
      }
      _loc5_ = this._stream.readInt();
      _loc9_ = 0;
      while(_loc5_ > 0)
      {
         _loc10_ = this._stream.position;
         this._textSortIndex[this._stream.readInt()] = ++_loc9_;
         _loc5_ = _loc5_ - (this._stream.position - _loc10_);
      }
      for (_loc11_ in this._textIndexes)
      {
         LangManager.getInstance().setEntry(_loc11_,this.getNamedText(_loc11_));
      }
      _log.debug("Initialized !");
      return;
   }
}

Et une version plus ancienne (2.14.0.75913.2) avec les noms des variables (parce que c'est plus joli hein :D) :
Code:
public function init(fileUri:Uri) : void {
   var key:* = 0;
   var pointer:* = 0;
   var diacriticalText:* = false;
   var position:uint = 0;
   var textKey:String = null;
   var nativeFile:File = fileUri.toFile();
   if((!nativeFile) || (!nativeFile.exists))
   {
      throw new Error("I18n file not readable.");
   }
   else
   {
      this._stream=new FileStream();
      this._stream.endian=Endian.BIG_ENDIAN;
      this._stream.open(nativeFile,FileMode.READ);
      this._indexes=new Dictionary();
      this._unDiacriticalIndex=new Dictionary();
      this._textIndexes=new Dictionary();
      this._textIndexesOverride=new Dictionary();
      this._textSortIndex=new Dictionary();
      this._textCount=0;
      indexesPointer=this._stream.readInt();
      keyCount=0;
      this._stream.position=indexesPointer;
      indexesLength=this._stream.readInt();
      i=0;
      while(i < indexesLength)
      {
         key=this._stream.readInt();
         diacriticalText=this._stream.readBoolean();
         pointer=this._stream.readInt();
         this._indexes[key]=pointer;
         keyCount++;
         if(diacriticalText)
         {
            keyCount++;
            i=i + 4;
            this._unDiacriticalIndex[key]=this._stream.readInt();
         }
         else
         {
            this._unDiacriticalIndex[key]=pointer;
         }
         i=i + 9;
      }
      indexesLength=this._stream.readInt();
      while(indexesLength > 0)
      {
         position=this._stream.position;
         textKey=this._stream.readUTF();
         pointer=this._stream.readInt();
         this._textCount++;
         this._textIndexes[textKey]=pointer;
         indexesLength=indexesLength - (this._stream.position - position);
      }
      indexesLength=this._stream.readInt();
      i=0;
      while(indexesLength > 0)
      {
         position=this._stream.position;
         this._textSortIndex[this._stream.readInt()]=++i;
         indexesLength=indexesLength - (this._stream.position - position);
      }
      for (textKey in this._textIndexes)
      {
         LangManager.getInstance().setEntry(textKey,this.getNamedText(textKey));
      }
      _log.debug("Initialized !");
      return;
   }
}

Voilà. À vous de voir maintenant. :)
 
Inscrit
19 Mai 2013
Messages
68
Reactions
0
#22
Moonlight-Angel a dit:
Il y a bien un readBoolean.
C'est juste que je pense que Veriditas a utilisé une ancienne version (très ancienne apparemment).
Voici l'init de la dernière version (2.18.2.82358.1) :
Code:
public function init(param1:Uri) : void {
   var _loc6_:* = 0;
   var _loc7_:* = 0;
   var _loc8_:* = false;
   var _loc10_:uint = 0;
   var _loc11_:String = null;
   var _loc2_:File = param1.toFile();
   if(!_loc2_ || !_loc2_.exists)
   {
      throw new Error("I18n file not readable.");
   }
   else
   {
      this._stream = new FileStream();
      this._stream.endian = Endian.BIG_ENDIAN;
      this._stream.open(_loc2_,FileMode.READ);
      this._indexes = new Dictionary();
      this._unDiacriticalIndex = new Dictionary();
      this._textIndexes = new Dictionary();
      this._textIndexesOverride = new Dictionary();
      this._textSortIndex = new Dictionary();
      this._textCount = 0;
      _loc3_ = this._stream.readInt();
      _loc4_ = 0;
      this._stream.position = _loc3_;
      _loc5_ = this._stream.readInt();
      _loc9_ = 0;
      while(_loc9_ < _loc5_)
      {
         _loc6_ = this._stream.readInt();
         _loc8_ = this._stream.readBoolean();
         _loc7_ = this._stream.readInt();
         this._indexes[_loc6_] = _loc7_;
         _loc4_++;
         if(_loc8_)
         {
            _loc4_++;
            _loc9_ = _loc9_ + 4;
            this._unDiacriticalIndex[_loc6_] = this._stream.readInt();
         }
         else
         {
            this._unDiacriticalIndex[_loc6_] = _loc7_;
         }
         _loc9_ = _loc9_ + 9;
      }
      _loc5_ = this._stream.readInt();
      while(_loc5_ > 0)
      {
         _loc10_ = this._stream.position;
         _loc11_ = this._stream.readUTF();
         _loc7_ = this._stream.readInt();
         this._textCount++;
         this._textIndexes[_loc11_] = _loc7_;
         _loc5_ = _loc5_ - (this._stream.position - _loc10_);
      }
      _loc5_ = this._stream.readInt();
      _loc9_ = 0;
      while(_loc5_ > 0)
      {
         _loc10_ = this._stream.position;
         this._textSortIndex[this._stream.readInt()] = ++_loc9_;
         _loc5_ = _loc5_ - (this._stream.position - _loc10_);
      }
      for (_loc11_ in this._textIndexes)
      {
         LangManager.getInstance().setEntry(_loc11_,this.getNamedText(_loc11_));
      }
      _log.debug("Initialized !");
      return;
   }
}

Et une version plus ancienne (2.14.0.75913.2) avec les noms des variables (parce que c'est plus joli hein :D) :
Code:
public function init(fileUri:Uri) : void {
   var key:* = 0;
   var pointer:* = 0;
   var diacriticalText:* = false;
   var position:uint = 0;
   var textKey:String = null;
   var nativeFile:File = fileUri.toFile();
   if((!nativeFile) || (!nativeFile.exists))
   {
      throw new Error("I18n file not readable.");
   }
   else
   {
      this._stream=new FileStream();
      this._stream.endian=Endian.BIG_ENDIAN;
      this._stream.open(nativeFile,FileMode.READ);
      this._indexes=new Dictionary();
      this._unDiacriticalIndex=new Dictionary();
      this._textIndexes=new Dictionary();
      this._textIndexesOverride=new Dictionary();
      this._textSortIndex=new Dictionary();
      this._textCount=0;
      indexesPointer=this._stream.readInt();
      keyCount=0;
      this._stream.position=indexesPointer;
      indexesLength=this._stream.readInt();
      i=0;
      while(i < indexesLength)
      {
         key=this._stream.readInt();
         diacriticalText=this._stream.readBoolean();
         pointer=this._stream.readInt();
         this._indexes[key]=pointer;
         keyCount++;
         if(diacriticalText)
         {
            keyCount++;
            i=i + 4;
            this._unDiacriticalIndex[key]=this._stream.readInt();
         }
         else
         {
            this._unDiacriticalIndex[key]=pointer;
         }
         i=i + 9;
      }
      indexesLength=this._stream.readInt();
      while(indexesLength > 0)
      {
         position=this._stream.position;
         textKey=this._stream.readUTF();
         pointer=this._stream.readInt();
         this._textCount++;
         this._textIndexes[textKey]=pointer;
         indexesLength=indexesLength - (this._stream.position - position);
      }
      indexesLength=this._stream.readInt();
      i=0;
      while(indexesLength > 0)
      {
         position=this._stream.position;
         this._textSortIndex[this._stream.readInt()]=++i;
         indexesLength=indexesLength - (this._stream.position - position);
      }
      for (textKey in this._textIndexes)
      {
         LangManager.getInstance().setEntry(textKey,this.getNamedText(textKey));
      }
      _log.debug("Initialized !");
      return;
   }
}

Voilà. À vous de voir maintenant. :)
Voilà qui explique tout. Pourtant mon code est tiré de la Bêta
 
Inscrit
27 Aout 2012
Messages
264
Reactions
0
#23
Y'a ce code aussi, plus récent (2.18.2.82009.1) :
Code:
public function init(fileUri:Uri) : void {
   var key:* = 0;
   var pointer:* = 0;
   var diacriticalText:* = false;
   var position:uint = 0;
   var textKey:String = null;
   var nativeFile:File = fileUri.toFile();
   if((!nativeFile) || (!nativeFile.exists))
   {
      throw new Error("I18n file not readable.");
   }
   else
   {
      this._stream = new FileStream();
      this._stream.endian = Endian.BIG_ENDIAN;
      this._stream.open(nativeFile,FileMode.READ);
      this._indexes = new Dictionary();
      this._unDiacriticalIndex = new Dictionary();
      this._textIndexes = new Dictionary();
      this._textIndexesOverride = new Dictionary();
      this._textSortIndex = new Dictionary();
      this._textCount = 0;
      indexesPointer = this._stream.readInt();
      keyCount = 0;
      this._stream.position = indexesPointer;
      indexesLength = this._stream.readInt();
      i = 0;
      while(i < indexesLength)
      {
         key = this._stream.readInt();
         diacriticalText = this._stream.readBoolean();
         pointer = this._stream.readInt();
         this._indexes[key] = pointer;
         keyCount++;
         if(diacriticalText)
         {
            keyCount++;
            i = i + 4;
            this._unDiacriticalIndex[key] = this._stream.readInt();
         }
         else
         {
            this._unDiacriticalIndex[key] = pointer;
         }
         i = i + 9;
      }
      indexesLength = this._stream.readInt();
      while(indexesLength > 0)
      {
         position = this._stream.position;
         textKey = this._stream.readUTF();
         pointer = this._stream.readInt();
         this._textCount++;
         this._textIndexes[textKey] = pointer;
         indexesLength = indexesLength - (this._stream.position - position);
      }
      indexesLength = this._stream.readInt();
      i = 0;
      while(indexesLength > 0)
      {
         position = this._stream.position;
         this._textSortIndex[this._stream.readInt()] = ++i;
         indexesLength = indexesLength - (this._stream.position - position);
      }
      for (textKey in this._textIndexes)
      {
         LangManager.getInstance().setEntry(textKey,this.getNamedText(textKey));
      }
      _log.debug("Initialized !");
      return;
   }
}
 
Haut Bas