ARUP.IssueTracker.Classes.IfcGuid.FromIfcGUID C# (CSharp) Метод

FromIfcGUID() публичный статический Метод

Reconstruction of the GUID from an IFC GUID string (base64)
public static FromIfcGUID ( string guid ) : System.Guid
guid string The GUID string to convert. Must be 22 characters long
Результат System.Guid
    public static Guid FromIfcGUID( string guid )
    {
      Debug.Assert( guid.Length == 22, "Input string must not be longer that 22 chars" );
      uint[] num = new uint[6];
      char[] str = guid.ToCharArray();
      int n = 2, pos = 0, i;
      for( i = 0; i < 6; i++ )
      {
        num[i] = cv_from_64( str, pos, n );
        pos += n; n = 4;
      }

      int a = ( int ) ( ( num[0] * 16777216 + num[1] ) );
      short b = ( short ) ( num[2] / 256 );
      short c = ( short ) ( ( num[2] % 256 ) * 256 + num[3] / 65536 );
      byte[] d = new byte[8];
      d[0] = Convert.ToByte( ( num[3] / 256 ) % 256 );
      d[1] = Convert.ToByte( num[3] % 256 );
      d[2] = Convert.ToByte( num[4] / 65536 );
      d[3] = Convert.ToByte( ( num[4] / 256 ) % 256 );
      d[4] = Convert.ToByte( num[4] % 256 );
      d[5] = Convert.ToByte( num[5] / 65536 );
      d[6] = Convert.ToByte( ( num[5] / 256 ) % 256 );
      d[7] = Convert.ToByte( num[5] % 256 );

      return new Guid( a, b, c, d );
    }