Keine Cache-Version

Caching deaktiviert Standardeinstellung für diese Seite:aktiviert (code LNG204)
Wenn die Anzeige zu langsam ist, können Sie den Benutzermodus deaktivieren, um die zwischengespeicherte Version anzuzeigen.

BytePtr.cs

Description du code

BytePtr.cs est un fichier du projet BiblioBrol.
Ce fichier est situé dans /var/www/bin/sniplets/bibliobrol/src/.

Projet BiblioBrol :

Gestion de media en CSharp.

Pour plus d'infos, vous pouvez consulter la brève analyse.

Code source ou contenu du fichier

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using System.Runtime.InteropServices;
  5.  
  6. namespace be.gaudry.bibliobrol.model.eid
  7. {
  8. public struct BytePtr
  9. {
  10. private IntPtr data;
  11.  
  12. public BytePtr(byte[] data)
  13. : this((data != null) ? data : null, 0, (data != null) ? data.Length : 0)
  14. {
  15.  
  16. }
  17. public BytePtr(byte[] data, int offset, int count)
  18. {
  19. // allocate
  20. this.data = (data == null) ? IntPtr.Zero : Memory.ByteToHLocal(data, offset, count);
  21. }
  22.  
  23.  
  24. public BytePtr(int size)
  25. {
  26. // allocate
  27. this.data = Memory.AllocHLocal(size);
  28. }
  29.  
  30. public override string ToString()
  31. {
  32. // return
  33. return data.ToString();
  34. }
  35.  
  36. public IntPtr Handle
  37. {
  38. get
  39. {
  40. // return value
  41. return this.data;
  42. }
  43. }
  44. public void Free()
  45. {
  46. // free
  47. Memory.FreeHLocal(this.data);
  48. }
  49.  
  50. public static BytePtr Zero
  51. {
  52. get
  53. {
  54. // return empty version
  55. return new BytePtr(null);
  56. }
  57. }
  58. public static bool operator ==(BytePtr v1, BytePtr v2)
  59. {
  60. // check
  61. return v1.Equals(v2);
  62. }
  63. public static bool operator !=(BytePtr v1, BytePtr v2)
  64. {
  65. // check
  66. return !v1.Equals(v2);
  67. }
  68. public override bool Equals(object obj)
  69. {
  70. // check if it is an instance
  71. return ((obj is BytePtr) && ((BytePtr)obj).data.Equals(this.data));
  72. }
  73. public override int GetHashCode()
  74. {
  75. // return hash code of data block
  76. return data.GetHashCode();
  77. }
  78. public static void Free(BytePtr ptr)
  79. {
  80. // check if zero
  81. if (BytePtr.Zero != ptr)
  82. {
  83. // free it
  84. ptr.Free();
  85. }
  86. }
  87.  
  88.  
  89.  
  90.  
  91. public static byte[] Free(BytePtr ptr, int length)
  92. {
  93. // declare
  94. byte[] result = null;
  95. // check if zero
  96. if (BytePtr.Zero != ptr)
  97. {
  98. // convert to array
  99. result = ptr.ToArray(length);
  100. // free it
  101. ptr.Free();
  102. }
  103. // return result
  104. return result;
  105. }
  106.  
  107. public byte[] ToArray(int length)
  108. {
  109. // declare result
  110. byte[] result = null;
  111. // check if zer
  112. if (this.data != IntPtr.Zero)
  113. {
  114. // allocate
  115. result = new byte[length];
  116. // copy
  117. Marshal.Copy(this.data, result, 0, Convert.ToInt32(length));
  118. }
  119. // return result
  120. return result;
  121. }
  122. public void Dispose()
  123. {
  124. // just free
  125. Free();
  126. }
  127. }
  128. }

Structure et Fichiers du projet

Afficher/masquer...


Répertoires contenus dans /var/www/bin/sniplets/bibliobrol/src/model/eid/ 
IcôneNomTailleModification
Pas de sous-répertoires.
IcôneNomTailleModification
| _ Répertoire parent0 octets1719386019 26/06/2024 09:13:39
Fichiers contenus dans /var/www/bin/sniplets/bibliobrol/src/model/eid/ 
IcôneNomTailleModificationAction
IcôneNomTailleModificationAction
Afficher le fichier .cs|.csEidAdapter.cs27.46 Ko31/10/2018 18:32:54-refusé-
Afficher le fichier .cs|.csMemory.cs4.31 Ko31/10/2018 18:32:54-refusé-
Afficher le fichier .cs|.csBytePtr.cs3.12 Ko31/10/2018 18:32:54-refusé-
Afficher le fichier .cs|.csStringPtr.cs1.81 Ko31/10/2018 18:32:55-refusé-
Afficher le fichier .cs|.csEidPerson.cs171 octets31/10/2018 18:32:54-refusé-

Utilisation de l'explorateur de code

  • Navigation :
    • Un clic sur une icône de répertoire ouvre ce répertoire pour en afficher les fichiers.
    • Lorsque le répertoire en cours ne contient pas de sous-répertoires il est possible de remonter vers le répertoire parent.
    • La structure de répertoires en treetable (tableau en forme d'arborescence) n'est plus possibledans cette version.
    • Un clic sur une icône de fichier ouvre ce fichier pour en afficher le code avec la coloration syntaxique adaptée en fonction du langage principal utilisé dans le fichier.
  • Affichage :
    • Il est possible de trier les répertoires ou les fichiers selon certains critères (nom, taille, date).
  • Actions :
    • Les actions possible sur les fichiers dépendent de vos droits d'utilisateur sur le site. Veuillez activer le mode utilisateur pour activer les actions.

Deutsche Übersetzung

Sie haben gebeten, diese Seite auf Deutsch zu besuchen. Momentan ist nur die Oberfläche übersetzt, aber noch nicht der gesamte Inhalt.

Wenn Sie mir bei Übersetzungen helfen wollen, ist Ihr Beitrag willkommen. Alles, was Sie tun müssen, ist, sich auf der Website zu registrieren und mir eine Nachricht zu schicken, in der Sie gebeten werden, Sie der Gruppe der Übersetzer hinzuzufügen, die Ihnen die Möglichkeit gibt, die gewünschten Seiten zu übersetzen. Ein Link am Ende jeder übersetzten Seite zeigt an, dass Sie der Übersetzer sind und einen Link zu Ihrem Profil haben.

Vielen Dank im Voraus.

Dokument erstellt 16/10/2009, zuletzt geändert 26/10/2018
Quelle des gedruckten Dokuments:https://www.gaudry.be/de/cs-bibliobrol-source-rf-model/eid//BytePtr.cs.html

Die Infobro ist eine persönliche Seite, deren Inhalt in meiner alleinigen Verantwortung liegt. Der Text ist unter der CreativeCommons-Lizenz (BY-NC-SA) verfügbar. Weitere Informationen auf die Nutzungsbedingungen und dem Autor.