private Level?stringToLevel(string levelString) { Level?result = null; if (!String.IsNullOrEmpty(levelString)) { if (levelString.Contains("high")) { result = Level.High; } else if (levelString.Contains("moderate")) { result = Level.Medium; } else if (levelString.Contains("low")) { result = Level.Low; } else { } } return(result); }
protected virtual void DoingJob(string mesage, Level?level = null) { if (OnDoingJob != null) { OnDoingJob.Invoke(mesage, level); } }
private void Verify(Stream cryptMsg, Level?level) { IDataVerifier verifier = new DataVerifierFactory().Create(level); SignatureSecurityInformation result; if (useSenderWKey) { result = verifier.Verify(cryptMsg, senderWKey); } else { result = verifier.Verify(cryptMsg); } Console.WriteLine(result.ToString()); Assert.AreEqual(validationStatus, result.ValidationStatus); Assert.AreEqual(trustStatus, result.TrustStatus); if (useSenderWKey) { Assert.IsNull(result.Signer); Assert.IsFalse(result.IsNonRepudiatable); } else { Assert.IsNotNull(result.Signer); Assert.IsTrue(result.IsNonRepudiatable); } Assert.IsNotNull(result.SignerId); Assert.AreEqual((level & Level.T_Level) == Level.T_Level, result.TimestampRenewalTime > DateTime.UtcNow); Assert.IsNotNull(result.SignatureValue); Assert.IsTrue((DateTime.UtcNow - result.SigningTime) < new TimeSpan(0, 1, 0)); }
public void LT_LevelIn3StepsRepudiatable() { level = Level.B_Level; nonRepudiatable = false; useTmaInsteadOfTsa = false; validationStatus = ValidationStatus.Valid; trustStatus = EHealth.Etee.Crypto.Status.TrustStatus.Full; trace.TraceInformation("B-Level: seal"); Stream output = Seal(); trace.TraceInformation("T-Level: complete"); level = Level.T_Level; output = Complete(output); trace.TraceInformation("LT-Level: complete"); level = Level.LT_Level; output = Complete(output); trace.TraceInformation("LT-Level: verify"); Verify(output); output.Position = 0; trace.TraceInformation("LT-Level: unseal"); Unseal(output); output.Close(); }
public ProductModel(string json) { Debug.Log("BLANK: JSON parse started"); Debug.Log(json); // https://github.com/mtschoen/JSONObject JSONObject rootObject = new JSONObject(json); JSONObject productObject = rootObject["product"]; JSONObject nutriscoreObject = productObject["nutriscore_data"]; JSONObject nutrientLevelsObject = productObject["nutrient_levels"]; this.code = J2S(rootObject["code"]); this.brand = J2S(productObject["brands"]); this.category = J2S(productObject["pnns_groups_1"]); this.countryOfOrigin = J2S(productObject["countries"]); this.hasPlasticPackaging = J2S(productObject["packaging"]).Contains("plast"); this.grade = J2S(nutriscoreObject["grade"]); this.sugars = stringToLevel(J2S(nutrientLevelsObject["sugars"])); this.fat = stringToLevel(J2S(nutrientLevelsObject["fat"])); this.saturatedFat = stringToLevel(J2S(nutrientLevelsObject["saturated-fat"])); this.salt = stringToLevel(J2S(nutrientLevelsObject["salt"])); double energyKcalPerHundredGrams = double.Parse(J2S(nutriscoreObject["energy_value"])); setEnergyLevel(energyKcalPerHundredGrams); Debug.Log("BLANK: json code: plastic:" + this.hasPlasticPackaging); }
public void LTA_LevelTmaRepudiatable() { level = Level.LTA_Level; nonRepudiatable = false; useTmaInsteadOfTsa = true; validationStatus = ValidationStatus.Valid; trustStatus = EHealth.Etee.Crypto.Status.TrustStatus.Full; trace.TraceInformation("LTA-Level TMA: seal"); Stream output = Seal(); trace.TraceInformation("LTA-Level TMA: Verify from TMA"); VerifyFromTma(output); output.Position = 0; trace.TraceInformation("LTA-Level TMA: Verify as TMA"); VerifyAsTma(output); output.Position = 0; trace.TraceInformation("LTA-Level TMA: unseal"); Unseal(output); output.Close(); }
protected virtual void DoingWork(string message, Level?level = null) { if (OnDoingWork != null) { OnDoingWork.Invoke(string.Format("任务[{0}]{1}", MonitroName, message), level); } }
public void NullLevelRepudiatable() { level = null; nonRepudiatable = false; useTmaInsteadOfTsa = false; validationStatus = ValidationStatus.Valid; trustStatus = EHealth.Etee.Crypto.Status.TrustStatus.Full; trace.TraceInformation("Null-Level: Sealing"); Stream output = Seal(); //Do some extra seals Seal(); Seal(); Seal(); trace.TraceInformation("Null-Level: Verify"); Verify(output); output.Position = 0; trace.TraceInformation("Null-Level: Unseal"); Unseal(output); output.Close(); }
public StartTransferCallStructure(VehicleType vehicleType, bool tramsferToSource, bool transferToTarget, Level?vehicleLevel = null) { this.vehicleType = vehicleType; this.tramsferToSource = tramsferToSource; this.transferToTarget = transferToTarget; this.vehicleLevel = vehicleLevel; }
public void LT_LevelRepudiatable() { level = Level.LT_Level; nonRepudiatable = false; useTmaInsteadOfTsa = false; validationStatus = ValidationStatus.Valid; trustStatus = EHealth.Etee.Crypto.Status.TrustStatus.Full; trace.TraceInformation("LT-Level: seal"); Stream output = Seal(); using (var file = File.Create("eid-levelLT.cms")) { output.CopyTo(file); output.Position = 0; } trace.TraceInformation("LT-Level: verify"); Verify(output); output.Position = 0; trace.TraceInformation("LT-Level: unseal"); Unseal(output); output.Close(); }
public override bool FromXML(System.Xml.XmlElement myElement) { if (myElement != null) { this.Type = StringCommon.GetTypeByName(myElement.GetAttribute("type")); //value应该在设置Attributes之前 string level = myElement.GetAttribute("level"); if (level.Length == 0) { this.Level = null; } else { this.Level = (Level?)Enum.Parse(typeof(Level), level); } this.Attributes.FromXML(myElement); this.Name = myElement.GetAttribute("name"); if (myElement.HasAttribute("print")) { this.Print = bool.Parse(myElement.GetAttribute("print")); } this.Text = myElement.InnerText; return(true); } return(false); }
IDataUnsealer Create(Level?level, X509Certificate2Collection encCerts, X509Certificate2Collection authCertChains, params WebKey[] ownWebKeys) { return(new TripleUnwrapper( #if !NETFRAMEWORK _loggerFactory, #endif level, null, encCerts, ToStore(authCertChains), ownWebKeys)); }
IDataUnsealer Create(Level?level, EHealthP12[] p12s, WebKey[] ownWebKeys) { X509Certificate2Collection encCerts; X509Certificate2Collection allCerts; Extract(p12s, out encCerts, out allCerts); return(Create(level, encCerts, allCerts, ownWebKeys)); }
IDataVerifier Create(Level?level) { return(new TripleUnwrapper( #if !NETFRAMEWORK _loggerFactory, #endif level, null, null, null, null)); }
internal TripleUnwrapper(Level? level, ITimemarkProvider timemarkauthority, X509Certificate2Collection encCerts) { if (level == Level.L_Level || level == Level.A_level ) throw new ArgumentException("level", "Only null or levels B, T, LT and LTA are allowed"); this.level = level; this.timemarkauthority = timemarkauthority; //Wrap it inside a IX509Store to (incorrectly) returns an windows x509Certificate2 encCertStore = encCerts == null || encCerts.Count == 0 ? null : new WinX509CollectionStore(encCerts); }
public Hash(IReadOnlyList <byte> saltedHash, Level?saltiness = null) { saltiness = saltiness ?? Hashing.SaltLevel; var splitValues = saltedHash.Bisect((int)saltiness); _salt = splitValues.FirstSegment; _saltedHash = new Data(splitValues.SecondSegment); }
private void _scheduleDictionary_OnDoingJob(string obj, Level?level) { if (level == null) { UpdateUi(obj); } else { UpdateUi(obj, (Level)level); } }
private void Unseal(Stream cryptoMsg, Level?level) { IDataUnsealer unsealer = new DataUnsealerFactory().Create(level, new EHealthP12[] { alice, bob }, new WebKey[] { receiverWKey }); UnsealResult result; if (useSenderWKey) { result = unsealer.Unseal(cryptoMsg, senderWKey); } else { result = unsealer.Unseal(cryptoMsg); } Console.WriteLine(result.SecurityInformation.ToString()); MemoryStream stream = new MemoryStream(); result.UnsealedData.CopyTo(stream); result.UnsealedData.Close(); Assert.IsTrue((DateTime.UtcNow - result.SealedOn) < new TimeSpan(0, 1, 0)); Assert.IsNotNull(result.SignatureValue); Assert.AreEqual(validationStatus, result.SecurityInformation.ValidationStatus); Assert.AreEqual(trustStatus, result.SecurityInformation.TrustStatus); if (useSenderWKey) { Assert.IsNull(result.SigningCertificate); Assert.IsNull(result.SecurityInformation.OuterSignature.Signer); Assert.IsNull(result.SecurityInformation.InnerSignature.Signer); } else { Assert.IsNotNull(result.SigningCertificate); Assert.IsNotNull(result.SecurityInformation.OuterSignature.Signer); Assert.IsNotNull(result.SecurityInformation.InnerSignature.Signer); } Assert.IsNotNull(result.SecurityInformation.OuterSignature.SignerId); Assert.IsNotNull(result.SecurityInformation.InnerSignature.SignerId); if (useReceiverWKey) { CollectionAssert.AreEqual(receiverWKey.Id, result.RecipientId); } else { Assert.AreEqual(bob["825373489"].Thumbprint, result.RecipientCertificate.Thumbprint); } Assert.AreEqual(clearMessage, Encoding.UTF8.GetString(stream.ToArray())); Assert.IsNotNull(result.SecurityInformation.ToString()); }
/// <summary> /// Constructeur. /// </summary> /// <param name="id">Identifiant.</param> /// <param name="tournamentID">Identifiant du tournoi.</param> /// <param name="year">Année.</param> /// <param name="drawSize">Nombre de joueurs inscrits.</param> /// <param name="dateBegin">Date de début.</param> /// <param name="onTwoWeeks">Indique si l'édition se déroule sur deux semaines.</param> /// <param name="dateEnd">Date de fin.</param> /// <param name="tournamentCity">Ville pour cette édition.</param> /// <param name="tournamentIndoor">Environnement pour cette édition.</param> /// <param name="tournamentLevel">Niveau pour cette édition.</param> /// <param name="tournamentName">Nom pour cette édition.</param> /// <param name="tournamentSlotOrder">Créneau pour cette édition.</param> /// <param name="tournamentSurface">Surface pour cette édition.</param> /// <exception cref="BaseService.NotUniqueIdException">L'identifiant n'est pas unique.</exception> /// <exception cref="ArgumentException">Une édition avec le même identifiant existe déjà.</exception> /// <exception cref="ArgumentException">Une édition du tournoi pour la même année existe déjà.</exception> /// <exception cref="ArgumentException">Le tournoi avec l'identifiant spécifié n'a pas pu être trouvé.</exception> /// <exception cref="ArgumentException">La date de fin doit être postérieure à la date de début.</exception> public Edition(uint id, uint tournamentID, uint year, ushort drawSize, DateTime dateBegin, bool onTwoWeeks, DateTime dateEnd, bool?tournamentIndoor, Level?tournamentLevel, string tournamentName, string tournamentCity, byte?tournamentSlotOrder, Surface?tournamentSurface) : this(id, tournamentID, year, drawSize, dateBegin, onTwoWeeks, dateEnd) { TournamentIsIndoor = tournamentIndoor.HasValue ? tournamentIndoor.Value : Tournament.IsIndoor; TournamentLevel = tournamentLevel.HasValue ? tournamentLevel.Value : Tournament.Level; TournamentName = tournamentName != null ? tournamentName : Tournament.Name; TournamentCity = tournamentCity != null ? tournamentCity : Tournament.City; TournamentSlotOrder = tournamentSlotOrder.HasValue ? tournamentSlotOrder.Value : Tournament.SlotOrder; TournamentSurface = tournamentSurface.HasValue ? tournamentSurface.Value : Tournament.Surface; }
public static void SetLevel(string prefix, Level?flags) { MySession.Static.Log.Info($"EquinoxCore Logging level for \"{prefix}\" set to {flags?.ToString() ?? "nil"}"); if (flags.HasValue) { State[prefix] = flags.Value; } else { State.Remove(prefix); } _anythingEnabled = State.Count > 0; DerivedState.Clear(); }
private void setEnergyLevel(double energyKcalperHundredGrams) { var value = energyKcalperHundredGrams; var threshold = energyKcalThresholdPerHundredGrams; if (value > threshold) { energy = Level.High; } else { energy = Level.Low; } }
// Validate if the level of the LogEvent is valid private static void ValidateLogEventLevel(Level?level, List <Exception> exceptions) { switch (level) { case Level.INFO: case Level.WARNING: case Level.ERROR: case Level.FATAL: case Level.EXTENSION: break; default: exceptions.Add(new InvalidOperationException($"Ungültiger Wert für \"LogEvent/Level\": \"{level}\".")); break; } }
public ILogger Create(string name, string app = null, string module = null, Level?level = null, object additionalProperties = null) { if (name == null) { throw new ArgumentNullException(nameof(name)); } app = app ?? _defaultApp; var loggerKey = $"{app}{name}"; var logger = Loggers.GetOrAdd(loggerKey, key => new Log4NetLogger(LogManager.GetLogger(key), _loggerLevelController.GetOrAddLoggerLevel(app, name, level), app, module, additionalProperties)); return(logger); }
/// <inheritdoc /> public async Task <int> GetEntriesCountAsync(Stage stage, Level?level, DateTime?startDate, DateTime?endDate) { using (var connection = _connectionProvider.TheEliteConnection) { return(await connection .QueryFirstAsync <int>( ToPsName(_getEntriesCountPsName), new { stage_id = (long)stage, level_id = (long?)level, start_date = startDate, end_date = endDate }, commandType : CommandType.StoredProcedure) .ConfigureAwait(false)); } }
public void NullLevel() { level = null; validationStatus = ValidationStatus.Valid; trustStatus = EHealth.Etee.Crypto.Status.TrustStatus.Full; trace.TraceInformation("Null-Level: Sealing"); Stream output = Seal(); trace.TraceInformation("Null-Level: Verify"); Verify(output); output.Position = 0; trace.TraceInformation("Null-Level: Unseal"); Unseal(output); output.Close(); }
public virtual void ReadFrom(XElement xE) { Impressions = null; TimeUnit = null; Level = null; foreach (var xItem in xE.Elements()) { var localName = xItem.Name.LocalName; if (localName == "impressions") { Impressions = long.Parse(xItem.Value); } else if (localName == "timeUnit") { TimeUnit = TimeUnitExtensions.Parse(xItem.Value); } else if (localName == "level") { Level = LevelExtensions.Parse(xItem.Value); } } }
public override void _Ready() { _game = GetNode("Level") as Level; //_game?.TestInit(); }
public void LT_LevelIn3Steps() { level = Level.B_Level; useTmaInsteadOfTsa = false; validationStatus = ValidationStatus.Valid; trustStatus = EHealth.Etee.Crypto.Status.TrustStatus.Full; trace.TraceInformation("B-Level: seal"); Stream output = Seal(); trace.TraceInformation("T-Level: complete"); level = Level.T_Level; output = Complete(output); trace.TraceInformation("LT-Level: complete"); level = Level.LT_Level; output = Complete(output); trace.TraceInformation("LT-Level: verify"); Verify(output); output.Position = 0; trace.TraceInformation("LT-Level: unseal"); Unseal(output); output.Close(); }
public Hash(string text, Level?saltiness = null) : this(text, Hashing.GetSalt(saltiness ?? Hashing.SaltLevel)) { }
public void T_LevelTma() { level = Level.LT_Level; useTmaInsteadOfTsa = true; validationStatus = ValidationStatus.Valid; trustStatus = EHealth.Etee.Crypto.Status.TrustStatus.Full; trace.TraceInformation("T-Level TMA: Seal"); Stream output = Seal(); trace.TraceInformation("T-Level TMA: Verify from TMA"); VerifyFromTma(output); output.Position = 0; trace.TraceInformation("T-Level TMA: Verify as TMA"); VerifyAsTma(output); output.Position = 0; trace.TraceInformation("T-Level TMA: Unseal"); Unseal(output); output.Close(); }
///<summary>Specify the level of detail for returned information</summary> public ClusterHealthDescriptor Level(Level?level) => Qs("level", level);
///<summary>Return indices stats aggregated at index, node or shard level</summary> public NodesStatsDescriptor Level(Level?level) => Qs("level", level);
public void B_Level() { level = Level.B_Level; validationStatus = ValidationStatus.Valid; trustStatus = EHealth.Etee.Crypto.Status.TrustStatus.Full; trace.TraceInformation("B-Level: Sealing"); Stream output = Seal(); trace.TraceInformation("B-Level: Verify"); Verify(output); output.Position = 0; trace.TraceInformation("B-Level: Unseal"); Unseal(output); output.Close(); }
public ILogger Create(Type type, Level?level = null, object additionalProperties = null) { return(Create(type.FullName, null, null, level, additionalProperties)); }
public void T_Level() { level = Level.LT_Level; useTmaInsteadOfTsa = false; validationStatus = ValidationStatus.Valid; trustStatus = EHealth.Etee.Crypto.Status.TrustStatus.Full; trace.TraceInformation("T-Level: Sealing"); Stream output = Seal(); trace.TraceInformation("T-Level: Verify"); Verify(output); output.Position = 0; trace.TraceInformation("T-Level: Unseal"); Unseal(output); output.Close(); }