/// <summary> /// Converts an <see cref="IUuid"/> instance to a UUID with a concrete type. /// </summary> /// <typeparam name="TUuid">The concrete UUID type.</typeparam> /// <param name="uuid">The <see cref="IUuid"/> to convert</param> /// <returns>The converted UUID.</returns> public static TUuid ToUuid <TUuid>(this IUuid uuid) where TUuid : class, IUuid, new() { return(uuid == null ? null : uuid as TUuid ?? new TUuid { Value = uuid.Value }); }
public void Read(IStarReader reader) { AssetDigest = reader.ReadUInt8Array(); Uuid = reader.Serializer.Deserialize<IUuid>(reader); PlayerName = reader.ReadString(); PlayerSpecies = reader.ReadString(); ShipChunks = reader.Serializer.Deserialize<Dictionary<byte[], Maybe<byte[]>>>(reader); ShipUpgrades = reader.Serializer.Deserialize<IShipUpgrades>(reader); Account = reader.ReadString(); }
public ActionResult getUuidFromCpr(string query) { //query = System.Web.HttpContext.Current.Request["query"], // Search is now by CPR, clear the saved name (if any) SearchInput searchInput = new SearchInput(); searchInput.fillFromSession(this); searchInput.setQuery(""); searchInput.saveToSession(this); String ipAddress = LoggingTools.GetVisitorIPAddress(); String hostName = LoggingTools.GetHostName(ipAddress); // Logging the search cpreader.Logger.info(String.Format("<{0}> searched for: <{1}> from host name: <{2}> at local IP address <{3}>.", User.Identity.Name, query, hostName, ipAddress )); // Check if there is errors (empty strings) // TODO: Check the ASP.NET euivalent /*if (searchForm.hasErrors()) * { * return badRequest("Form had errors"); * }*/ // Input type == cprnumber IUuid uuid = cprBroker.getUuid(query); // logging the returned resultcode cpreader.Logger.info(User.Identity.Name + "'s search request to CPRBroker responded, " + uuid.code() + " - " + uuid.message()); if (uuid.code() == 200) { String uuidStr = uuid.value(); return(Content(uuidStr)); } else { // this should never happen as person master will just assign // a new uuid if it doesn't exist cpreader.Logger.info(String.Format("CPR number <{0}> not found.", query)); return(new HttpStatusCodeResult(HttpStatusCode.BadRequest, "CPR not found in local")); } }
public void Read(IStarReader reader) { ClientId = reader.ReadVLQ(); Uuid = reader.Serializer.Deserialize<IUuid>(reader); CelestialInformation = new CelestialBaseInformation { PlanetOrbitalLevels = reader.ReadInt32(), SatelliteOrbitalLevels = reader.ReadInt32(), ChunkSize = reader.ReadInt32(), XyCoordRange = new Vec2I { X = reader.ReadInt32(), Y = reader.ReadInt32() }, ZCoordRange = new Vec2I { X = reader.ReadInt32(), Y = reader.ReadInt32() } }; }
public UuidGuidSource(IUuid uuid) { _uuid = uuid; }
/// <summary> /// Converts the UUID to a <see cref="Guid"/> instance. /// </summary> /// <param name="uuid">The UUID.</param> /// <returns>A new <see cref="Guid"/> instance.</returns> public static Guid ToGuid(this IUuid uuid) { return(!uuid.IsValidGuid() ? default(Guid) : new Guid(GuidUtility.GetSwappedBytes(uuid.Value))); }
/// <summary> /// Checks if the UUID can be converted to a valid <see cref="Guid"/> instance. /// </summary> /// <param name="uuid">The UUID.</param> /// <returns><c>true</c> if the UUID can be converted to a valid <see cref="Guid"/> instance; <c>false</c> otherwise.</returns> public static bool IsValidGuid(this IUuid uuid) { return(uuid?.Value?.Length == 16); }
/// <summary> /// Converts the UUID to a base64 encoded string /// </summary> /// <param name="uuid">The UUID.</param> /// <returns>The base64 encoded string representation of the UUID.</returns> public static string ToBase64String(this IUuid uuid) { return(Convert.ToBase64String(uuid?.Value ?? new byte[0])); }