public void GoodCurveGroupsShouldResultInAPass(CurveGroup curveGroup) { TlsConnectionResult tlsConnectionResult = new TlsConnectionResult(null, null, curveGroup, null, null, null, null, null); ConnectionResults connectionResults = TlsTestDataUtil.CreateConnectionResults(TlsTestType.TlsSecureDiffieHellmanGroupSelected, tlsConnectionResult); Assert.AreEqual(_sut.Test(connectionResults).Result, EvaluatorResult.PASS); }
public void CurvesWithCurveNumberLessThan256ShouldResultInAFail(CurveGroup curveGroup) { TlsConnectionResult tlsConnectionResult = new TlsConnectionResult(null, null, curveGroup, null, null, null, null, null); ConnectionResults connectionResults = TlsTestDataUtil.CreateConnectionResults(TlsTestType.TlsSecureEllipticCurveSelected, tlsConnectionResult); Assert.AreEqual(_sut.Test(connectionResults).Result, EvaluatorResult.FAIL); }
public void AddCurve(CurveGroup scf) { if (scf == null) { return; } curveFile.AddCurves(scf); }
public CurveGroupEditor(CurveGroup group) { InitializeComponent(); //m_grid.LabelEdit = true; //m_grid.MultiSelect = false; m_grid.View = View.Details; m_group = group; Label = group.Label; Count = group.Count; group.ForEach(c => { this[m_grid.Items.Count] = c; }); }
// Use this for initialization private void Start() { m_CurveGroups = GetComponentInChildren <CurveGroup>(); float halfCell = CellSize / 2; float DtAngle = Mathf.Asin(halfCell / Radio) * 2 * Mathf.Rad2Deg; m_DtAngle = DtAngle; Vector3 startPos = new Vector3(0, 0, StartZ); m_CurveGroups.InitOnce(startPos, Radio, CellSize, Offset, DtAngle); }
private BouncyCastleTlsTestResult ProcessKeyExchange(TestTlsDhKeyExchange keyExchange) { CurveGroup group = keyExchange.DhParameters.ToGroup(); TlsVersion version = Context.ServerVersion.ToTlsVersion(); CipherSuite cipherSuite = mSecurityParameters.CipherSuite.ToCipherSuite(); List <X509Certificate2> certificates = mPeerCertificate.ToCertificateList(); base.CleanupHandshake(); return(new BouncyCastleTlsTestResult(version, cipherSuite, group, null, _tlsError, _errorMessage, null, certificates)); }
private TlsConnectionResult ProcessKeyExchange(TestTlsDheKeyExchange keyExchange) { CurveGroup group = keyExchange.DhParameters.ToGroup(); TlsVersion version = Context.ServerVersion.ToTlsVersion(); CipherSuite cipherSuite = mSecurityParameters.CipherSuite.ToCipherSuite(); SignatureHashAlgorithm signatureHashAlgorithm = keyExchange.EcSignatureAndHashAlgorithm.ToSignatureAlgorithm(); List <X509Certificate2> certificates = mPeerCertificate.ToCertificateList(); base.CleanupHandshake(); return(new TlsConnectionResult(version, cipherSuite, group, signatureHashAlgorithm, _error, _errorMessage, null, certificates)); }
public async Task CurvesWithCurveNumberLessThan256ShouldResultInAFail(CurveGroup curveGroup) { BouncyCastleTlsTestResult tlsConnectionResult = new BouncyCastleTlsTestResult(null, null, curveGroup, null, null, null, null, null); TlsTestResults connectionTestResults = TlsTestDataUtil.CreateMxHostTlsResults(TlsTestType.TlsSecureEllipticCurveSelected, tlsConnectionResult); List <RuleTypedTlsEvaluationResult> evaluatorResults = await _sut.Evaluate(connectionTestResults); Assert.That(evaluatorResults.Count, Is.EqualTo(1)); Assert.AreEqual(evaluatorResults[0].TlsEvaluatedResult.Result, EvaluatorResult.FAIL); }
public async Task GoodCurveGroupsShouldResultInAPass(CurveGroup curveGroup) { BouncyCastleTlsTestResult tlsConnectionResult = new BouncyCastleTlsTestResult(null, null, curveGroup, null, null, null, null, null); TlsTestResults connectionTestResults = TlsTestDataUtil.CreateMxHostTlsResults(TlsTestType.TlsSecureDiffieHellmanGroupSelected, tlsConnectionResult); List <RuleTypedTlsEvaluationResult> evaluatorResults = await _sut.Evaluate(connectionTestResults); Assert.That(evaluatorResults.Count, Is.EqualTo(1)); Assert.AreEqual(evaluatorResults[0].TlsEvaluatedResult.Result, EvaluatorResult.PASS); }
private BouncyCastleTlsTestResult ProcessKeyExchange(TestTlsEcDhKeyExchange keyExchange) { string curveName = keyExchange.EcPublicKeyParameters.Parameters.Curve.GetType().Name.ToLower(); CurveGroup curve = curveName.ToCurve(); TlsVersion version = Context.ServerVersion.ToTlsVersion(); CipherSuite cipherSuite = mSecurityParameters.CipherSuite.ToCipherSuite(); List <X509Certificate2> certificates = mPeerCertificate.ToCertificateList(); base.CleanupHandshake(); return(new BouncyCastleTlsTestResult(version, cipherSuite, curve, null, _tlsError, _errorMessage, null, certificates)); }
private void OnValidate() { if (!Application.isPlaying) { CurveGroup curveGroups = GetComponentInChildren <CurveGroup>(); float halfCell = CellSize / 2; float DtAngle = Mathf.Asin(halfCell / Radio) * 2 * Mathf.Rad2Deg; m_DtAngle = DtAngle; Vector3 startPos = new Vector3(0, 0, StartZ); curveGroups.InitOnce(startPos, Radio, CellSize, Offset, DtAngle); } }
private TlsConnectionResult ProcessKeyExchange(TestTlsEcDheKeyExchange keyExchange) { string curveName = keyExchange.EcPublicKeyParameters.Parameters.Curve.GetType().Name.ToLower(); CurveGroup curve = curveName.ToCurve(); TlsVersion version = Context.ServerVersion.ToTlsVersion(); CipherSuite cipherSuite = mSecurityParameters.CipherSuite.ToCipherSuite(); SignatureHashAlgorithm signatureHashAlgorithm = keyExchange.EcSignatureAndHashAlgorithm.ToSignatureAlgorithm(); List <X509Certificate2> certificates = mPeerCertificate.ToCertificateList(); base.CleanupHandshake(); return(new TlsConnectionResult(version, cipherSuite, curve, signatureHashAlgorithm, _error, _errorMessage, null, certificates)); }
public override int GetHashCode() { unchecked { var hashCode = Version.GetHashCode(); hashCode = (hashCode * 397) ^ CipherSuite.GetHashCode(); hashCode = (hashCode * 397) ^ CurveGroup.GetHashCode(); hashCode = (hashCode * 397) ^ SignatureHashAlgorithm.GetHashCode(); hashCode = (hashCode * 397) ^ Error.GetHashCode(); hashCode = (hashCode * 397) ^ (ErrorDescription != null ? ErrorDescription.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (SmtpResponses != null ? SmtpResponses.GetHashCode() : 0); return(hashCode); } }
public DevCurve(IniDocument ini, CurveGroup grp, int index) { this.Group = grp; this.Index = index; string section = grp.Name + "\\" + (index + 1); this.Name = ini.GetString(section, "设备名称"); if (string.IsNullOrEmpty(this.Name)) return; if (this.Name.ToUpper() == "DUMMY") return; this.ADMax = grp.ADMax; this.ADMin = grp.ADMin; float limit = ini.GetFloat(section, "AD最小", float.NaN); if (float.IsNaN(limit) == false) { this.ADMin = limit; } limit = ini.GetFloat(section, "AD最大", float.NaN); if (float.IsNaN(limit) == false) { this.ADMax = limit; } this.Tag = ini.GetInt(grp.Name + "\\" + (index + 1), "标志", 0); this.TimeInterval = grp.TimeInterval; float interval = ini.GetFloat(grp.Name + "\\" + (index + 1), "时间间隔", float.NaN); string monitor = ini.GetString(grp.Name + "\\" + (index + 1), "室外监测类型"); this.MonitorType = SignalType.SignalACCurve; if (monitor == "直流道岔") { this.MonitorType = SignalType.SignalDCCurve; } if (float.IsNaN(interval) == false) { this.TimeInterval = interval; } this.IsValid = true; }
public void AddCurves(CurveGroup grp) { List <StationCurve> listCurve = grp.Curves; if ((listCurve == null) || (listCurve.Count <= 0)) { return; } DateTime tmCurve = DateTime.Now; for (int i = 0; i < listCurve.Count; i++) { if (listCurve[i] != null) { tmCurve = listCurve[i].OccurTime; break; } } for (int i = 0; i < listCurve.Count; i++) { int ptNum = (listCurve[i] == null) ? 0 : listCurve[i].Points.Length; CurveIndex indexRecord = fileIndex.NewRecord(ptNum); indexRecord.CurveTime = tmCurve; indexRecord.CurveType = (Int16)grp.Type; indexRecord.CrvIndex = (Int16)grp.Index; indexRecord.CurvePhase = (byte)((listCurve.Count == 1) ? 0 : (i + 1)); indexRecord.Direction = (listCurve[i] == null) ? (byte)0 : listCurve[i].Dir; indexRecord.CurveMark = 0; indexRecord.SampleRate = (listCurve[i] == null) ? (Int16)0 : (Int16)listCurve[i].SampleRate; CurveStoreBlock blk = new CurveStoreBlock(this, indexRecord, (listCurve[i] == null) ? null:listCurve[i].Points); manager.AddBlock(blk); } }
IGroup[] CreateInnerCurves() { CurveGroup outer = FindGroup("Outer") as CurveGroup; if (outer == null) outer = CreateOuterCurves() as CurveGroup; IGroup[] rets = new IGroup[2]; //SurfaceCurve gir = null; for (int i = 0; i < 2; i++) { CurveGroup curves = new CurveGroup(i == 0 ? "Horiz" : "Verts", this); for (double dg = 0.0; dg < 1; dg += 0.1) { IFitPoint[] gir = new IFitPoint[2]; gir[1] = new CurvePoint(1, outer[2 * i + 1], dg); //gir[1] = new FixedPoint(.3, .3); gir[0] = new CurvePoint(0, outer[2 * i], dg); MouldCurve curve = new MouldCurve(String.Format("{0}ec-{1:##0}%", i == 0 ? "S" : "V", dg * 100), this, null); curve.Fit(gir); curves.Add(curve); } Add(curves); rets[i] = curves; } return rets; }
public IGroup CreateOuterCurves() { if (FindGroup("Outer") != null) return FindGroup("Outer"); CurveGroup outer = new CurveGroup("Outer", this); //int nLayer = View.AddLayer("Outer", Color.MistyRose, true); FixedPoint[] corners = new FixedPoint[4]; corners[0] = new FixedPoint(0, 0); corners[1] = new FixedPoint(0, 1); corners[2] = new FixedPoint(1, 1); corners[3] = new FixedPoint(1, 0); FixedPoint middle = new FixedPoint(0.5, 0.5); FixedPoint[] lu = new FixedPoint[] { new FixedPoint(corners[0]), new FixedPoint(corners[1]) }; FixedPoint[] hd = new FixedPoint[] { new FixedPoint(corners[1]), new FixedPoint(corners[2]) }; FixedPoint[] le = new FixedPoint[] { new FixedPoint(corners[3]), new FixedPoint(corners[2]) }; FixedPoint[] ft = new FixedPoint[] { new FixedPoint(corners[0]), new FixedPoint(corners[3]) }; outer.Add(new MouldCurve("Luff", this, lu)); outer.Add(new MouldCurve("Leech", this, le)); outer.Add(new MouldCurve("Head", this, hd)); outer.Add(new MouldCurve("Foot", this, ft)); Add(outer); return outer; //LinearPath[] paths = new LinearPath[4]; //Entity[] es; //for (int i = 0; i < 4; i++) //{ // Color c = Color.FromArgb(255 * (i % 2), 122 * (i % 3), 85 * i); // // LinearPath p = new LinearPath(GetPathPoints(outer[i], 100)); // //p.LayerIndex = nLayer; // es = outer[i].CreateEntity(false); // foreach (Entity e in es) // { // e.LayerIndex = nLayer; // View.Add(e); // } // //m_viewleft.Entities.Add(new PointCloud(GetPoints(outer[i].xFits), 5f, Color.Tomato)); //} //s.Layout.Add(outer); ////SurfaceCurve gir = null; //for (int i = 0; i < 2; i++) //{ // CurveGroup girths = new CurveGroup(i == 0 ? "Girths" : "Virths", s); // nLayer = View.AddLayer(girths.Label, i == 0 ? Color.SteelBlue : Color.IndianRed, i == 0); // for (double dg = 0.0; dg < 1; dg += 0.1) // { // IFitPoint[] gir = new IFitPoint[2]; // gir[1] = new CurvePoint(1, outer[2 * i + 1], dg); // //gir[1] = new FixedPoint(.3, .3); // if (i == 0) // gir[0] = new SlidePoint(0, outer[2 * i], dg); // else // gir[0] = new CurvePoint(0, outer[2 * i], dg); // Geodesic girth = new Geodesic(String.Format("{0}ir-{1:##0}%", i == 0 ? "G" : "V", dg * 100), s, gir); // if (girth.xGeos != null) // { // //gir = girth; // //m_viewleft.Entities.Add(new LinearPath(GetPathPoints(girth, 100), Color.DarkGoldenrod)); // //LinearPath p = new LinearPath(GetPathPoints(girth, 100)); // //p.LayerIndex = nLayer; // es = girth.CreateEntity(false); // foreach (Entity e in es) // { // e.LayerIndex = nLayer; // View.Add(e); // } // //m_viewleft.Entities.Add(new PointCloud(GetPoints(girth.xGeos), 5f, Color.Tomato)); // girths.Add(girth); // } // } // s.Layout.Add(girths); //} //CurveGroup mid = new CurveGroup("Mids", s); //nLayer = View.AddLayer("Mids", Color.GreenYellow, true); //SurfaceCurve x = new SurfaceCurve("CtoH", s, new IFitPoint[] { corners[1], middle, new CurvePoint(1, outer["Leech"], 0.0) }); //mid.Add(x); //es = x.CreateEntity(false); //foreach (Entity e in es) //{ // e.LayerIndex = nLayer; // View.Add(e); //} //s.Layout.Add(mid); }
IGroup[] CreateInnerGirths() { CurveGroup outer = FindGroup("Outer") as CurveGroup; if (outer == null) outer = CreateOuterCurves() as CurveGroup; IGroup[] girvir = new IGroup[2]; //SurfaceCurve gir = null; for (int i = 0; i < 2; i++) { CurveGroup girths = new CurveGroup(i == 0 ? "Girths" : "Virths", this); for (double dg = 0.0; dg < 1; dg += 0.1) { IFitPoint[] gir = new IFitPoint[2]; gir[1] = new CurvePoint(1, outer[2 * i + 1], dg); //gir[1] = new FixedPoint(.3, .3); if (i == 0) gir[0] = new SlidePoint(0, outer[2 * i], dg); else gir[0] = new CurvePoint(0, outer[2 * i], dg); MouldCurve girth = new MouldCurve(String.Format("{0}ir-{1:##0}%", i == 0 ? "G" : "V", dg * 100), this, null); girth.Fit(gir); girths.Add(girth); } Add(girths); girvir[i] = girths; } return girvir; }
public void AddCurve(CurveGroup cg) { CurveManager manager = CurveManager.GetInstance(); manager.AddCurve(cg); }
public void AddCurve(int type, int index, DateTime time, int sampleRate, float[] data) { CurveGroup grp = new CurveGroup(type, index, time, sampleRate, data); CurveManager.GetInstance().AddCurve(grp); }
public CurveGroupTracker(CurveGroup group) { m_group = group; m_edit = new CurveGroupEditor(m_group); }
private void helpToolStripButton_Click(object sender, EventArgs e) { if (ActiveSail == null) return; if (Tree.SelectedTag != null) { IRebuild tag = Tree.SelectedTag as IRebuild; List<IRebuild> rebuilds = new List<IRebuild>(); if (tag != null) tag.GetParents(ActiveSail, rebuilds); StringBuilder sb = new StringBuilder(); foreach (IRebuild rb in rebuilds) sb.AppendLine(rb.Label); MessageBox.Show(sb.ToString()); return; } VariableGroup varGroup = new VariableGroup("Vars", ActiveSail); varGroup.Add(new Equation("yarScale", 1.0)); varGroup.Add(new Equation("yarnDPI", "yarScale * 12780")); varGroup.Add(new Equation("targetScale", 1.0)); varGroup.Add(new Equation("targetDPI", "targetScale * 14416")); ActiveSail.Add(varGroup); UpdateViews(ActiveSail.CreateOuterCurves()); //Geodesic geo = new Geodesic("Geo", ActiveSail, new IFitPoint[] { new FixedPoint(.1, .1), new FixedPoint(.1, .9) }); MouldCurve v1 = new MouldCurve("v1", ActiveSail, new IFitPoint[] { new FixedPoint(1, 0), new FixedPoint(.3, .4), new FixedPoint(.1, .8), new FixedPoint(0, 1) }); MouldCurve v2 = new MouldCurve("v2", ActiveSail, new IFitPoint[] { new FixedPoint(1, 0), new FixedPoint(0, 1) }); MouldCurve v3 = new MouldCurve("v3", ActiveSail, new IFitPoint[] { new FixedPoint(1, 0), new FixedPoint(.95, .25), new FixedPoint(.9, .55), new FixedPoint(.65, .85), new FixedPoint(0, 1) }); //MouldCurve v4 = new MouldCurve("v4", ActiveSail, new IFitPoint[] { new FixedPoint(1, 0), new FixedPoint(.8, .5), new FixedPoint(1, 1) }); //MouldCurve v5 = new MouldCurve("v5", ActiveSail, new IFitPoint[] { new FixedPoint(1, 0), new FixedPoint(1, 1) }); CurveGroup grp = new CurveGroup("Warps", ActiveSail); grp.Add(v1); grp.Add(v2); grp.Add(v3); grp.Add(new MouldCurve("g3", ActiveSail, new IFitPoint[] { new FixedPoint(0,0), new SlidePoint(v1, 0), new FixedPoint(1,.5) })); grp.Add(new MouldCurve("g4", ActiveSail, new IFitPoint[] { new FixedPoint(1, 0), new FixedPoint(.4, .4), new FixedPoint(.3, .7), new FixedPoint(0,1)})); //grp.Add(v4); //grp.Add(v5); //grp.Add(guide); CurveGroup guides = new CurveGroup("Guides", ActiveSail); GuideComb guide = new GuideComb("Guide", ActiveSail, new IFitPoint[] { new FixedPoint(0, .5), new SlidePoint(v2, .5), new FixedPoint(1, .5) }, new Vect2[] { new Vect2(0, 1), new Vect2(.3, .55), new Vect2(.5, .5), new Vect2(.7, .55), new Vect2(1, 1) }); guides.Add(guide); YarnGroup yar = new YarnGroup("yar1", ActiveSail, varGroup["yarnDPI"], varGroup["targetDPI"]); yar.Warps.Add((ActiveSail.FindGroup("Outer") as CurveGroup)[0]); yar.Warps.Add((ActiveSail.FindGroup("Outer") as CurveGroup)[1]); yar.Guide = guide; yar.DensityPos = new List<double>() { 0.2, 0.8 }; ActiveSail.Add(grp); ActiveSail.Add(guides); ActiveSail.Add(yar); UpdateViews(grp); UpdateViews(guides); //YarnGroup LuYar = new YarnGroup("LuYar", ActiveSail, 12780); //LuYar.DensityPos.AddRange(new double[] { 0.25, 0.5, 0.75 }); //LuYar.YarnsUpdated += LuYar_YarnsUpdated; ////if (LuYar.LayoutYarns(new List<MouldCurve>() { lu, mi, le }, guide, 14416) > 0) ////DateTime now = DateTime.Now; ////LuYar.LayoutYarns(grp, guide, 14416, LuYar.SpreadYarnsAlongGuide); ////TimeSpan gde = DateTime.Now - now; ////now = DateTime.Now; ////LuYar.LayoutYarns(grp, guide, 14416, LuYar.SpreadYarnsAcrossWarps); ////TimeSpan wrps = DateTime.Now - now; ////now = DateTime.Now; ////MessageBox.Show(string.Format("AcrossWarps: {0}\nAlongGuide: {1}", wrps.TotalMilliseconds, gde.TotalMilliseconds)); UpdateViews(guides); UpdateViews(grp); yar.Update(ActiveSail); UpdateViews(yar); //if (LuYar.LayoutYarns(grp, guide, 14416) > 0 // || MessageBox.Show(String.Format("Failed to match Target Dpi\nTarget: {0}\nAchieved: {1}\nContinue Anyway?", LuYar.TargetDpi, LuYar.AchievedDpi), "Yarn Generation Failed", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes ) // ActiveSail.Add(LuYar); ////Yarns.YarnGroup LeYar = new Yarns.YarnGroup("LeYar", ActiveSail, 12780); ////if (LeYar.LayoutYarns(new List<MouldCurve>() { mi, le }, guide, 14416) > 0) //// ActiveSail.Add(LeYar); ////Rebuild(null); //UpdateViews(LuYar); //Rebuild(grp); //Rebuild(grp); //Rebuild(guides); //Rebuild(LuYar); View.Refresh(); ActiveSail.Rebuild(null); }
void CreateSpokes() { const int NGIR = 5; const int NANG = 5; Vect2[] uv = new Vect2[2]; CurveGroup group; //for (int nLu = 0; nLu < 1; nLu++) for (int nGir = 0; nGir < NGIR; nGir++) { group = new CurveGroup(string.Format("Spokes[{0}]", nGir), this); //group = new CurveGroup(string.Format("Spokes[{0}][{1}]", nLu, nGir), S); uv[0] = new Vect2(-0.3, BLAS.interpolant(nGir, NGIR)); //uv[1-nLu] = new Vect2(1,0); for (int nAng = 0; nAng < NANG; nAng++) { uv[1] = new Vect2(1.3, BLAS.interpolant(nAng, NANG)); MouldCurve g = new MouldCurve(string.Format(group.Label + "[{0}]", nAng), this, null); g.Fit(uv[0], uv[1]); group.Add(g); } Add(group); } }
public Transform GetForward(float posZ) { CurveGroup curveGroups = GetComponentInChildren <CurveGroup>(); return(curveGroups.GetForward(posZ)); }
public Tweener Create() { if (_targ == null) return null; //set curves Tweener tween = null; if (_props.Count == 0) { return new ObjectTweener(_targ, new NullCurve()); } else if (_props.Count == 1) { var curve = this.CreateCurve(_props[0]); if (curve == null) Debug.LogWarning("Failed to create tween for property '" + _props[0].name + "' on target.", _targ as Object); else tween = new ObjectTweener(_targ, curve); } else { var grp = new CurveGroup(); for (int i = 0; i < _props.Count; i++) { var curve = this.CreateCurve(_props[i]); if (curve == null) Debug.LogWarning("Failed to create tween for property '" + _props[i].name + "' on target.", _targ as Object); else grp.Curves.Add(curve); } tween = new ObjectTweener(_targ, grp); } //set props tween.Id = _id; tween.UpdateType = _updateType; tween.TimeSupplier = _timeSupplier; tween.WrapMode = _wrap; tween.WrapCount = _wrapCount; tween.Reverse = _reverse; if (_onStep != null) tween.OnStep += _onStep; if (_onWrap != null) tween.OnWrap += _onWrap; if (_onFinish != null) tween.OnFinish += _onFinish; return tween; }
// finds the curve private Curve findCurve(CurveId id, CurveGroup curveGroup) { return(curveGroup.findCurve(id.CurveName).orElseThrow(() => new System.ArgumentException(Messages.format("No curve found: {}", id.CurveName)))); }