EidAdapter.cs
Description du code
EidAdapter.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
Code c# (EidAdapter.cs) (821 lignes)
using System; using System.Runtime.InteropServices; using System.Text; using be.gaudry.bibliobrol.model.identity; using be.gaudry.model; using be.gaudry.bibliobrol.config; namespace be.gaudry.bibliobrol.model.eid { class EidAdapter { //private const string RefactoredConfig.eidDllPath = "Eidlib.dll"; #region Version Constants // // version info // private const int INTERFACE_VERSION = 1; // Changes each time the interface is modified private const int INTERFACE_COMPAT_VERSION = 1; // Stays until incompatible changes in existing functions #endregion #region Field Constants internal const int MAX_CARD_NUMBER_LEN = 12; internal const int MAX_CHIP_NUMBER_LEN = 32; internal const int MAX_DATE_BEGIN_LEN = 10; internal const int MAX_DATE_END_LEN = 10; internal const int MAX_DELIVERY_MUNICIPALITY_LEN = 80; internal const int MAX_NATIONAL_NUMBER_LEN = 11; internal const int MAX_NAME_LEN = 110; internal const int MAX_FIRST_NAME1_LEN = 95; internal const int MAX_FIRST_NAME2_LEN = 50; internal const int MAX_FIRST_NAME3_LEN = 3; internal const int MAX_NATIONALITY_LEN = 3; internal const int MAX_BIRTHPLACE_LEN = 80; internal const int MAX_BIRTHDATE_LEN = 10; internal const int MAX_SEX_LEN = 1; internal const int MAX_NOBLE_CONDITION_LEN = 50; internal const int MAX_DOCUMENT_TYPE_LEN = 2; internal const int MAX_SPECIAL_STATUS_LEN = 2; internal const int MAX_HASH_PICTURE_LEN = 20; internal const int MAX_STREET_LEN = 80; internal const int MAX_STREET_NR = 10; internal const int MAX_STREET_BOX_NR = 6; internal const int MAX_ZIP_LEN = 4; internal const int MAX_MUNICIPALITY_LEN = 67; internal const int MAX_COUNTRY_LEN = 4; internal const int MAX_RAW_ADDRESS_LEN = 512; internal const int MAX_RAW_ID_LEN = 1024; internal const int MAX_PICTURE_LEN = 4096; internal const int MAX_CERT_LEN = 2048; internal const int MAX_CERT_NUMBER = 10; internal const int MAX_CERT_LABEL_LEN = 256; internal const int MAX_SIGNATURE_LEN = 256; internal const int MAX_CARD_DATA_LEN = 28; internal const int MAX_CARD_DATA_SIG_LEN = MAX_SIGNATURE_LEN + MAX_CARD_DATA_LEN; internal const int MAX_CHALLENGE_LEN = 20; internal const int MAX_RESPONSE_LEN = 128; #endregion #region Constructors private EidAdapter() { } #endregion #region Enumerations public enum ErrorCodeOptions : int { /// <summary> /// Function succeeded /// </summary> OK = 0, /// <summary> /// Unknown system error (see system error code) /// </summary> E_SYSTEM = 1, /// <summary> /// Unknown PC/SC error (see PC/SC error code) /// </summary> E_PCSC = 2, /// <summary> /// Unknown card error (see card status word) /// </summary> E_CARD = 3, /// <summary> /// Invalid parameter (NULL pointer, out of bound, etc.) /// </summary> E_BAD_PARAM = 4, /// <summary> /// An internal consistency check failed /// </summary> E_INTERNAL = 5, /// <summary> /// The supplied handle was invalid /// </summary> E_INVALID_HANDLE = 6, /// <summary> /// The data buffer to receive returned data is too small for the /// returned data /// </summary> E_INSUFFICIENT_BUFFER = 7, /// <summary> /// An internal communications error has been detected /// </summary> E_COMM_ERROR = 8, /// <summary> /// A specified timeout value has expired /// </summary> E_TIMEOUT = 9, /// <summary> /// Unknown card detected /// </summary> E_UNKNOWN_CARD = 10, /// <summary> /// Input on pinpad cancelled /// </summary> E_KEYPAD_CANCELLED = 11, /// <summary> /// Timout returned from pinpad /// </summary> E_KEYPAD_TIMEOUT = 12, /// <summary> /// The two PINs did not match /// </summary> E_KEYPAD_PIN_MISMATCH = 13, /// <summary> /// Message too long on pinpad /// </summary> E_KEYPAD_MSG_TOO_LONG = 14, /// <summary> /// Invalid PIN length /// </summary> E_INVALID_PIN_LENGTH = 15, /// <summary> /// Error in a signature verification or a certificate validation /// </summary> E_VERIFICATION = 16, /// <summary> /// Library not initialized /// </summary> E_NOT_INITIALIZED = 17, /// <summary> /// An internal error has been detected, but the source is unknown /// </summary> E_UNKNOWN = 18, /// <summary> /// Function is not supported /// </summary> E_UNSUPPORTED_FUNCTION = 19, /// <summary> /// Incorrect library version /// </summary> E_INCORRECT_VERSION = 20 } public enum OCSPPolicyOptions : int { /// <summary> /// OCSP Policy is Not Used /// </summary> NotUsed = 0, /// <summary> /// OCSP Policy is Optional /// </summary> Optional = 1, /// <summary> /// OCSP Policy is Mandatory /// </summary> Mandatory = 2 } public enum CRLPolicyOptions : int { /// <summary> /// CRL Policy is Not Used /// </summary> NotUsed = 0, /// <summary> /// CRL Policy is Optional /// </summary> Optional = 1, /// <summary> /// CRL Policy is Mandatory /// </summary> Mandatory = 2 } public enum PinTypeOptions : int { PKCS15 = 0, OS = 1 } public enum PinUsageOptions: int { Authentication = 1, Signing = 2 } #endregion #region Structures [StructLayout(LayoutKind.Sequential)] public struct Status { /// <summary> /// General Error Code /// </summary> [MarshalAs(UnmanagedType.I4)] public ErrorCodeOptions General; /// <summary> /// System Error Code /// </summary> [MarshalAs(UnmanagedType.I4)] public int System; /// <summary> /// PC/SC Error Code /// </summary> [MarshalAs(UnmanagedType.I4)] public int PCSC; /// <summary> /// Card Status Word /// </summary> [MarshalAs(UnmanagedType.I2)] public short CSW; /// <summary> /// Reserved for future use /// </summary> [MarshalAs(UnmanagedType.I2)] public short RFU1; [MarshalAs(UnmanagedType.I2)] public short RFU2; [MarshalAs(UnmanagedType.I2)] public short RFU3; } [StructLayout(LayoutKind.Sequential)] public unsafe struct BEID_Bytes { public const int BEID_MAX_PICTURE_LEN = 4096; public byte* data; #if ARCHITECTURE_x86_64 public ulong length; #else public uint length; #endif [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] public byte[] rfu; }; public class Bytes : DisposableObject { public BytePtr Data; public int Length; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6, ArraySubType = UnmanagedType.U1)] public byte[] RFU; public Bytes(int length) { // // init // this.Length = length; } public Bytes(byte[] data) { // // init // this.Length = data.Length; } protected override void ReleaseUnmanagedResources() { BytePtr.Free(Data); } }; [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 4)] public struct Certif { /// <summary> /// byte stream encoded certificate /// </summary> [MarshalAs(UnmanagedType.ByValArray, SizeConst = MAX_CERT_LEN, ArraySubType = UnmanagedType.U1)] public byte[] Data; /// <summary> /// Size in bytes of the encoded certificate /// </summary> public int Length; /// <summary> /// Label of the certificate (Authentication, Signature, CA, Root,…) /// </summary> [MarshalAs(UnmanagedType.ByValArray, SizeConst = MAX_CERT_LABEL_LEN + 1, ArraySubType = UnmanagedType.I1)] public char[] Label; /// <summary> /// Validation status /// </summary> public int Status; /// <summary> /// reserved for future use /// </summary> [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6, ArraySubType = UnmanagedType.U1)] public byte[] RFU; }; [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 4)] public struct CertifCheck { /// <summary> /// Policy used: 0=None/1=OCSP/2=CRL /// </summary> public int Policy; /// <summary> /// Array of BEID_Certif structures /// </summary> [MarshalAs(UnmanagedType.ByValArray, SizeConst = MAX_CERT_NUMBER * 2324, ArraySubType = UnmanagedType.U1)] public byte[] Certificates; /// <summary> /// Number of elements in Array /// </summary> public int Length; /// <summary> /// Status of signature (for ID and Address) or hash (for Picture) on retrieved field /// </summary> public int SignatureCheck; /// <summary> /// reserved for future use /// </summary> [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6, ArraySubType = UnmanagedType.U1)] public byte[] RFU; }; [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] public struct IDData { [MarshalAs(UnmanagedType.I2)] public short Version; [MarshalAs(UnmanagedType.ByValArray, SizeConst = MAX_CARD_NUMBER_LEN + 1)] public char[] CardNumber; [MarshalAs(UnmanagedType.ByValArray, SizeConst = MAX_CHIP_NUMBER_LEN + 1)] public char[] ChipNumber; [MarshalAs(UnmanagedType.ByValArray, SizeConst = MAX_DATE_BEGIN_LEN + 1)] public char[] ValidityDateBegin; [MarshalAs(UnmanagedType.ByValArray, SizeConst = MAX_DATE_END_LEN + 1)] public char[] ValidityDateEnd; [MarshalAs(UnmanagedType.ByValArray, SizeConst = MAX_DELIVERY_MUNICIPALITY_LEN + 1)] public byte[] Municipality; [MarshalAs(UnmanagedType.ByValArray, SizeConst = MAX_NATIONAL_NUMBER_LEN + 1)] public char[] NationalNumber; [MarshalAs(UnmanagedType.ByValArray, SizeConst = MAX_NAME_LEN + 1)] public byte[] Name; [MarshalAs(UnmanagedType.ByValArray, SizeConst = MAX_FIRST_NAME1_LEN + 1)] public byte[] FirstName1; [MarshalAs(UnmanagedType.ByValArray, SizeConst = MAX_FIRST_NAME2_LEN + 1)] public byte[] FirstName2; [MarshalAs(UnmanagedType.ByValArray, SizeConst = MAX_FIRST_NAME3_LEN + 1)] public byte[] FirstName3; [MarshalAs(UnmanagedType.ByValArray, SizeConst = MAX_NATIONALITY_LEN + 1)] public char[] Nationality; [MarshalAs(UnmanagedType.ByValArray, SizeConst = MAX_BIRTHPLACE_LEN + 1)] public byte[] BirthLocation; [MarshalAs(UnmanagedType.ByValArray, SizeConst = MAX_BIRTHDATE_LEN + 1)] public char[] BirthDate; [MarshalAs(UnmanagedType.ByValArray, SizeConst = MAX_SEX_LEN + 1)] public byte[] Sex; [MarshalAs(UnmanagedType.ByValArray, SizeConst = MAX_NOBLE_CONDITION_LEN + 1)] public byte[] NobleCondition; [MarshalAs(UnmanagedType.I4)] public int DocumentType; [MarshalAs(UnmanagedType.Bool)] public bool WhiteCane; [MarshalAs(UnmanagedType.Bool)] public bool YellowCane; [MarshalAs(UnmanagedType.Bool)] public bool ExtendedMinority; [MarshalAs(UnmanagedType.ByValArray, SizeConst = MAX_HASH_PICTURE_LEN, ArraySubType = UnmanagedType.U1)] public byte[] HashPhoto; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6, ArraySubType = UnmanagedType.U1)] public byte[] RFU; }; [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] public struct VersionInfo { [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] SerialNumber; [MarshalAs(UnmanagedType.U1)] public byte ComponentCode; [MarshalAs(UnmanagedType.U1)] public byte OSNumber; [MarshalAs(UnmanagedType.U1)] public byte OSVersion; [MarshalAs(UnmanagedType.U1)] public byte SoftmaskNumber; [MarshalAs(UnmanagedType.U1)] public byte SoftmaskVersion; [MarshalAs(UnmanagedType.U1)] public byte AppletVersion; [MarshalAs(UnmanagedType.U2)] public short GlobalOSVersion; [MarshalAs(UnmanagedType.U1)] public byte AppletInterfaceVersion; [MarshalAs(UnmanagedType.U1)] public byte PKCS1Support; [MarshalAs(UnmanagedType.U1)] public byte KeyExchangeVersion; [MarshalAs(UnmanagedType.U1)] public byte ApplicationLifeCycle; [MarshalAs(UnmanagedType.U1)] public byte GraphPerso; [MarshalAs(UnmanagedType.U1)] public byte ElecPerso; [MarshalAs(UnmanagedType.U1)] public byte ElecPersoInterface; [MarshalAs(UnmanagedType.U1)] public byte Reserved; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6, ArraySubType = UnmanagedType.U1)] public byte[] RFU; } [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] public struct Address { [MarshalAs(UnmanagedType.U2)] public short Version; [MarshalAs(UnmanagedType.ByValArray, SizeConst = MAX_STREET_LEN + 1)] public byte[] Street; [MarshalAs(UnmanagedType.ByValArray, SizeConst = MAX_STREET_NR + 1)] public char[] StreetNumber; [MarshalAs(UnmanagedType.ByValArray, SizeConst = MAX_STREET_BOX_NR + 1)] public char[] BoxNumber; [MarshalAs(UnmanagedType.ByValArray, SizeConst = MAX_ZIP_LEN + 1)] public char[] Zip; [MarshalAs(UnmanagedType.ByValArray, SizeConst = MAX_MUNICIPALITY_LEN + 1)] public byte[] Municipality; [MarshalAs(UnmanagedType.ByValArray, SizeConst = MAX_COUNTRY_LEN + 1)] public char[] Country; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6, ArraySubType = UnmanagedType.U1)] public byte[] RFU; }; [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] public struct Pin { [MarshalAs(UnmanagedType.I4)] PinTypeOptions PinType; [MarshalAs(UnmanagedType.U1)] byte ID; [MarshalAs(UnmanagedType.I4)] PinUsageOptions PinUsage; [MarshalAs(UnmanagedType.LPStr)] string ShortUsage; [MarshalAs(UnmanagedType.LPStr)] string LongUsage; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6, ArraySubType = UnmanagedType.U1)] public byte[] RFU; public Pin(byte id, PinTypeOptions type, PinUsageOptions usage, string shortUsage,string longUsage) { this.ID = id; this.PinType = type; this.PinUsage = usage; this.ShortUsage = shortUsage; this.LongUsage = longUsage; } }; #endregion #region API [DllImport(Config.EidDllPath, EntryPoint="BEID_InitEx", SetLastError=true)] private static extern Status InitEx(string readerName, OCSPPolicyOptions ocsp, CRLPolicyOptions crl, out IntPtr cardHandle, int interfaceVersion, int interfaceCompVersion); [DllImport(Config.EidDllPath, EntryPoint="BEID_Exit", SetLastError=true)] internal static extern Status Exit(); [DllImport(Config.EidDllPath, EntryPoint="BEID_GetID", SetLastError=true)] internal static extern Status GetID(out IDData data, out CertifCheck check); [DllImport(Config.EidDllPath, EntryPoint="BEID_GetAddress", SetLastError=true)] internal static extern Status GetAddress(out Address address, out CertifCheck check); [DllImport(Config.EidDllPath, EntryPoint="BEID_GetPicture", SetLastError=true)] private static extern Status GetPicture( ref BEID_Bytes bytes, out CertifCheck check ); // // Mid Level API // [DllImport(Config.EidDllPath, EntryPoint="BEID_GetVersionInfo", SetLastError=true)] internal static extern Status GetVersionInfo(ref VersionInfo versionInfo, bool signature, Bytes SignedStatus); [DllImport(Config.EidDllPath, EntryPoint="BEID_BeginTransaction", SetLastError=true)] internal static extern Status BeginTransaction(); [DllImport(Config.EidDllPath, EntryPoint="BEID_EndTransaction", SetLastError=true)] internal static extern Status EndTransaction(); [DllImport(Config.EidDllPath, EntryPoint="BEID_SelectApplication", SetLastError=true)] internal static extern Status SelectApplication(Bytes Application); [DllImport(Config.EidDllPath, EntryPoint="BEID_VerifyPIN", SetLastError=true)] internal static extern Status VerifyPIN(ref Pin pinData, string pin, out int triesLeft); [DllImport(Config.EidDllPath, EntryPoint="BEID_ChangePIN", SetLastError=true)] internal static extern Status ChangePin(ref Pin pinData, string oldPin, string newPin, out int triesLeft); [DllImport(Config.EidDllPath, EntryPoint="BEID_GetPINStatus", SetLastError=true)] internal static extern Status GetPinStatus(ref Pin pinData, out int triesLeft, bool signature, out Bytes signedStatus); [DllImport(Config.EidDllPath, EntryPoint="BEID_ReadFile", SetLastError=true)] internal static extern Status ReadFile(Bytes fileID, Bytes outData, ref Pin pinData); [DllImport(Config.EidDllPath, EntryPoint="BEID_WriteFile", SetLastError=true)] internal static extern Status WriteFile(Bytes fileID, Bytes inData, ref Pin pinData); // // Low Level API // [DllImport(Config.EidDllPath, EntryPoint="BEID_FlushCache", SetLastError=true)] internal static extern Status FlushCache(); [DllImport(Config.EidDllPath, EntryPoint="BEID_SendAPDU", SetLastError=true)] internal static extern Status SendAPDU(Bytes cmdAPDU, ref Pin pinData, out Bytes respAPDU); #endregion /// <summary> /// /// </summary> /// <param name="readerName">Card reader name as know by the OS. Empty string to use default reader.</param> /// <param name="ocsp">Value of enum OCSPPolicyOptions</param> /// <param name="crl">Value of enum CRLPolicyOptions</param> /// <param name="cardHandle"></param> /// <exception cref="System.DllNotFoundException">In this case, it will be impossible to do anything with the eid</exception> /// <returns></returns> internal static Status Init(string readerName, OCSPPolicyOptions ocsp, CRLPolicyOptions crl, out IntPtr cardHandle) { return InitEx(readerName, ocsp, crl, out cardHandle, INTERFACE_VERSION, INTERFACE_COMPAT_VERSION); } /// <summary> /// Init with default reader, no OCSPPolicyOptions and no CRLPolicyOptions /// </summary> /// <param name="readerName">Card reader name as know by the OS. Empty string to use default reader.</param> /// <exception cref="System.DllNotFoundException">In this case, it will be impossible to do anything with the eid</exception> /// <returns></returns> internal static Status Init() { IntPtr handle; return InitEx( "", EidAdapter.OCSPPolicyOptions.NotUsed, EidAdapter.CRLPolicyOptions.NotUsed, out handle, INTERFACE_VERSION, INTERFACE_COMPAT_VERSION ); } public static unsafe Status getPicture(out System.Drawing.Bitmap picture, out CertifCheck check) { Status status; byte [] _pictureBuffer; _PictureData.length = MAX_PICTURE_LEN; fixed (byte* p = _pictureBuffer) { _PictureData.data = p; status = GetPicture(ref _PictureData, out check); } if (status.General == ErrorCodeOptions.OK) { //Console.WriteLine("GetPicture : " + ms.Length); return status; } else { picture = null; } return status; } public static bool testDllExists() { bool result = false; try { IntPtr handle; EidAdapter.Init( "", EidAdapter.OCSPPolicyOptions.NotUsed, EidAdapter.CRLPolicyOptions.NotUsed, out handle); EidAdapter.Exit(); result = true; } catch (DllNotFoundException) { } return result; } /// <summary> /// /// </summary> /// <param name="readCardBGW">BackgroundWorker to do an asynchroneous reading</param> /// <param name="e">DoWorkEventArgs to report progress and results of job</param> /// <exception cref="System.DllNotFoundException">In this case, it will be impossible to do anything with the eid</exception> /// <param name="user"></param> public static void readCard(System.ComponentModel.BackgroundWorker readCardBGW, System.ComponentModel.DoWorkEventArgs e, User user) { readCardBGW.ReportProgress(0, "Initialisation du lecteur"); IntPtr handle; EidAdapter.Init( "", EidAdapter.OCSPPolicyOptions.NotUsed, EidAdapter.CRLPolicyOptions.NotUsed, out handle); EidAdapter.Status status; EidAdapter.CertifCheck check; EidAdapter.IDData data; readCardBGW.ReportProgress(15, "Lecture de l'identité"); //System.Diagnostics.Debug.Print("GetID : " + status.General); try { status = EidAdapter.GetID(out data, out check); //readCardBGW.ReportProgress(40, new object[] { status, data }); if (EidAdapter.ErrorCodeOptions.OK == status.General) { validity.BeginDate = getDate(data.ValidityDateBegin); validity.EndDate = getDate(data.ValidityDateEnd); validity.Issuer = getString(data.Municipality); validity.ChipNumber = getString(data.ChipNumber); validity.CardNumber = getString(data.CardNumber); readCardBGW.ReportProgress(30, validity); user.LastName = getString(data.Name); user.FirstName = getString(data.FirstName1); user.FirstName2 = getString(data.FirstName2); user.FirstName3 = getString(data.FirstName3); user.Birthdate = getDate(data.BirthDate); try { user.Sex = (SEX)Enum.Parse( getString(data.Sex) ); } catch(ArgumentException) { user.Sex = SEX._; } user.NationalNumber = getString(data.NationalNumber); user.BirthPlace = getString(data.BirthLocation); user.Nationality = getString(data.Nationality); readCardBGW.ReportProgress(40, user); } readCardBGW.ReportProgress(45, "Lecture de l'adresse"); EidAdapter.Address address; status = EidAdapter.GetAddress(out address, out check); if (EidAdapter.ErrorCodeOptions.OK == status.General) { ad.Street = getString(address.Street); ad.HouseNumber = getString(address.StreetNumber); ad.BoxNumber = getString(address.BoxNumber); ad.ZipCode = getString(address.Zip); ad.Municipality = getString(address.Municipality); ad.Country = getString(address.Country); user.Address = ad; readCardBGW.ReportProgress(60, user); } System.Drawing.Bitmap photo; readCardBGW.ReportProgress(65, "Lecture de la photo"); status = EidAdapter.getPicture(out photo, out check); if (EidAdapter.ErrorCodeOptions.OK == status.General) { readCardBGW.ReportProgress(90, photo); } EidAdapter.Exit(); readCardBGW.ReportProgress(100, "Chargement terminé"); } catch (AccessViolationException) { readCardBGW.ReportProgress(100, "Erreur de lecture"); } } /// <summary> /// /// </summary> /// <param name="characters"></param> /// <remarks>DEPRECATED</remarks> /// <returns></returns> public static string UTF8ByteArrayToString(byte[] characters) { int byteCount = 0; while (characters[byteCount] != 0) { byteCount++; } string constructedString = encoding.GetString(characters, 0, byteCount); return (constructedString); } /// <summary> /// Get a string from a chars array (readed from eid card), and clean it /// </summary> /// <param name="str"></param> /// <returns></returns> private static string getString(char[] str) { } /// <summary> /// Get a string from a bytes array (readed from eid card), and clean it /// </summary> /// <param name="str"></param> /// <returns></returns> private static string getString(byte[] str) { return Encoding.UTF8.GetString(str).Replace("\0", "").Trim(); } /// <summary> /// Get a DateTime from a chars array (readed from eid card), and clean it /// </summary> /// <param name="str"></param> /// <returns></returns> private static DateTime getDate(char[] str) { return getDate(getString(str)); } public static DateTime getDate(string value) { if (value.Equals(string.Empty)) try { int year, month, day; int.TryParse(value.Substring(0, 4), out year); int.TryParse(value.Substring(4, 2), out month); int.TryParse(value.Substring(6, 2), out day); } catch (ArgumentOutOfRangeException) { } } } }
Structure et Fichiers du projet
Afficher/masquer...Icône | Nom | Taille | Modification |
Pas de sous-répertoires. | |||
Icône | Nom | Taille | Modification |
| _ | Répertoire parent | 0 octets | 1737539741 22/01/2025 10:55:41 |
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.
Version en cache
22/01/2025 10:55:41 Cette version de la page est en cache (à la date du 22/01/2025 10:55:41) afin d'accélérer le traitement. Vous pouvez activer le mode utilisateur dans le menu en haut pour afficher la dernère version de la page.Document créé le 16/10/2009, dernière modification le 26/10/2018
Source du document imprimé : https://www.gaudry.be/cs-bibliobrol-source-rf-model/eid/EidAdapter.cs.html
L'infobrol est un site personnel dont le contenu n'engage que moi. Le texte est mis à disposition sous licence CreativeCommons(BY-NC-SA). Plus d'info sur les conditions d'utilisation et sur l'auteur.