public void applyOnSelection(IMask selection, float intensity, bool alternate) { //using (PerfSection p = new PerfSection("applyOnSelection")) { if (!isApplyOnSelectionEnabled()) { return; } List <VertIndexWeight> verts = new List <VertIndexWeight>(); //Dictionary<long, float>.Enumerator pointsIterator = points.GetEnumerator(); long index; float weight; selection.ResetIterator(); while (selection.MoveNext(out index, out weight)) { if (weight == 0.0f) { continue; } verts.Add(new VertIndexWeight((int)index, weight)); } apply(verts, intensity, alternate); } }
public override ActionBase InitAll() { var by = IMask.Gen(0); foreach (var ent in Injector.Entercloses) { by[ent.Index] = (int)ent.YZero; } var inject_list = Injector.Entercloses.Where(item => item.InjEnable).ToList(); var act = Sequence.create(InitXyz.create(this, 30000, inject_list.ToArray(), false, false, true)); act.AddAction(InitXyz.create(this, 30000, inject_list.ToArray(), true, true, false, by)); var device = new ActionDevice(this); int x = 0; int[] y = new int[4]; int [] z = new int [4]; device.GetRealX(ref x); device.GetRealY(inject_list.ToArray(), ref y); device.GetRealZ(inject_list.ToArray(), ref z); Injector.XMotor.CurrentDistance = x; for (int i = 0; i < inject_list.Count(); i++) { inject_list[i].YMotor.CurrentDistance = y[i] + (int)inject_list[i].TipDis; inject_list[i].ZMotor.CurrentDistance = z[i]; } return(act); }
public void SetLastMask(IMask mask) { MaskItem item = null; string lastItemName = "--Last Selected Mask--"; foreach (MaskItem m in MaskCheckList.Items) { if (m.Name == lastItemName) { item = m; } } if (item == null) { item = new MaskItem(); item.Name = lastItemName; MaskCheckList.Items.Add(item, false); } item.mMask = mask.Clone(); CurrentMaskNameTextBox.Text = "NewMaskName"; }
/// <summary> /// Initializes a new instance of the <see cref="CurlMamFactory"/> class. /// </summary> /// <param name="curl"> /// The curl. /// </param> /// <param name="mask"> /// The mask. /// </param> /// <param name="signingHelper"> /// The signing helper. /// </param> /// <param name="hammingNonceDiver"> /// The hamming nonce diver. /// </param> public CurlMamFactory(AbstractCurl curl, IMask mask, ISigningHelper signingHelper, AbstractPearlDiver hammingNonceDiver) { this.SigningHelper = signingHelper; this.HammingNonceDiver = hammingNonceDiver; this.Mask = mask; this.Curl = curl; }
public static Image ExportMask(IMask mask) { int width = TerrainGlobals.getTerrain().getNumXVerts(); int height = TerrainGlobals.getTerrain().getNumZVerts(); Rectangle r = new Rectangle(0, 0, width, height); Bitmap destination = new Bitmap(width, height, PixelFormat.Format24bppRgb); unsafe { BitmapData outputData = destination.LockBits(r, ImageLockMode.WriteOnly, destination.PixelFormat); if (outputData.PixelFormat == PixelFormat.Format24bppRgb) { PixelData24 *outputBase = (PixelData24 *)outputData.Scan0; for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { PixelData24 *pPixel = outputBase + y * width + x; long index = y * width + x; float value = mask.GetMaskWeight(index); byte outputValue = (byte)(value * byte.MaxValue); pPixel->blue = outputValue; pPixel->red = outputValue; pPixel->green = outputValue; } } destination.UnlockBits(outputData); } } return((Image)destination); }
public IMask Blur(IMask l, int fadeSize) { IMask m = new Mask(l.Resolution); blur.Process(l, m, fadeSize); return(m); }
public ILog Apply(ILog log) { IMask mask = null; var items = log.GetFields().ToList(); var copy = new List <KeyValuePair <string, object> >(); foreach (var item in items) { if (_masks.TryGetValue(item.Key, out mask) == false) { copy.Add(item); } else { var value = item.Value as string; if (value == null) { copy.Add(item); } else { try { copy.Add(new KeyValuePair <string, object>(item.Key, mask.Mask(item.Value.ToString()))); } catch { copy.Add(new KeyValuePair <string, object>(item.Key, KeyStore.Masking.MaskingFailed)); copy.Add(new KeyValuePair <string, object>(KeyStore.Masking.MaskingFailedKey, true)); } } } } return(new SimpleLog(log.Id, log.LogTime, copy, log.Filters)); }
static void Main(string[] args) { //Strategy IMask cpf = MaskGateway.GetMask(MaskType.CPF); Console.WriteLine(MaskApply.FormatApply(cpf, "77693284621")); IMask cnpj = MaskGateway.GetMask(MaskType.CNPJ); Console.WriteLine(MaskApply.FormatApply(cnpj, "17630236000104")); //TemplateMethod Figure square = new Square(10); square.ShowInfo(); Figure rectangle = new Rectangle(5, 10); rectangle.ShowInfo(); //Factory Method Console.WriteLine("Peter is an user with the following permissions: "); User peter = User.CreateUser(UserType.Administrator); Console.WriteLine("Joseph is an user with the following permissions: "); User joseph = User.CreateUser(UserType.Supervisor); Console.ReadKey(); }
public void SubLiquid() { if (SelectedBJ is T_BJ_GelSeat gelseat) { int x = (int)(gelseat.InjectorX); int y = gelseat.GetInjectorY(SeatYIndex); var sequ_putsample = Sequence.create( InjectMoveTo.create(injectorDevice, 3000, injectorDevice.GetSeleteced(), -1, IMask.Gen(-1), IMask.Gen(0)), InjectAbsorbMove.create(300, injectorDevice.GetSeleteced(), 100, IMask.Gen(0))); for (int i = 0; i < 8; i++) { var points = IMask.Gen(new ActionPoint(-1, -1, -1)); foreach (var ent in injectorDevice.GetSeleteced()) { points[ent.Index].x = x + i * (int)gelseat.InjectorGapX; points[ent.Index].y = y + ent.Index * (int)gelseat.InjectorGapY; points[ent.Index].z = (int)gelseat.InjectorZ; points[ent.Index].zb = points[ent.Index].z - 1500; points[ent.Index].minwidth = (double)gelseat.MinWidth; points[ent.Index].type = TestStepEnum.SpuLiquid; points[ent.Index].capacity = 500; } sequ_putsample.AddAction(InjectMoveActs.create(3000, points.ToArray(), true)); } sequ_putsample.runAction(injectorDevice); } }
/// <summary> /// Initializes a new instance of the <see cref="CurlMamParser"/> class. /// </summary> /// <param name="mask"> /// The mask. /// </param> /// <param name="treeFactory"> /// The tree Factory. /// </param> /// <param name="curl"> /// The curl. /// </param> /// <param name="signingHelper"> /// The signature Validator. /// </param> public CurlMamParser(IMask mask, IMerkleTreeFactory treeFactory, AbstractCurl curl, ISigningHelper signingHelper) { this.TreeFactory = treeFactory; this.SigningHelper = signingHelper; this.Mask = mask; this.Curl = curl; }
public void TakeTip() { if (this.SelectedBJ == null) { return; } if (SelectedBJ is T_BJ_Tip tipseat) { var tip_seat = IMask.Gen(new ActionPoint(-1, -1, -1)); int x = (int)(tipseat.X - SeatXIndex * tipseat.GapX); int y = (int)(tipseat.Y + SeatYIndex * tipseat.GapY); foreach (var ent in injectorDevice.GetSeleteced()) { var point = new ActionPoint(); point.x = x; point.y = y; point.z = (int)tipseat.Limit; point.type = TestStepEnum.JXZT; point.index = ent.Index; tip_seat[ent.Index] = point; } var sequ_taketip = Sequence.create(); var move_act = InjectMoveActs.create(3000, tip_seat.ToArray(), false); sequ_taketip.AddAction(InjectMoveTo.create(3000, injectorDevice.GetSeleteced(), -1, IMask.Gen(-1), IMask.Gen(0))); sequ_taketip.AddAction(move_act); sequ_taketip.runAction(injectorDevice); } }
public void TakeTipAuto() { //生成装帧动作 if (this.SelectedBJ == null) { return; } if (SelectedBJ is T_BJ_Tip tipseat) { var sequ_taketip = Sequence.create(); var tip_seat = resmanager.GetFreeTipActPoint(injectorDevice.GetSeleteced().Length, 2, tipseat.Name); if (tip_seat != null) { int index = 0; var tip_seat_tem = IMask.Gen(new ActionPoint(-1, -1, -1)); foreach (var ent in injectorDevice.GetSeleteced()) { tip_seat_tem[ent.Index] = tip_seat[index]; index++; } var move_act = InjectMoveActs.create(20000, tip_seat_tem, false); //sequ_taketip.AddAction(InjectMoveTo.create(3000, injectorDevice.GetSeleteced(), -1, IMask.Gen(-1), IMask.Gen(0))); sequ_taketip.AddAction(move_act); sequ_taketip.runAction(injectorDevice); } else { ErrorSystem.WriteActError("吸盘盒为空!", true, false, 9999); } } }
public virtual void applyOnSelection(IMask selection, float intensity, bool alternate) { ////using (PerfSection p = new PerfSection("applyOnSelection")) //{ // if (!isApplyOnSelectionEnabled()) // return; // List<VertIndexWeight> verts = new List<VertIndexWeight>(); // //Dictionary<long, float>.Enumerator pointsIterator = points.GetEnumerator(); // long index; // float weight; // selection.ResetIterator(); // while (selection.MoveNext(out index, out weight)) // { // if (weight == 0.0f) // continue; // verts.Add(new VertIndexWeight((int)index, weight)); // } // apply(verts, intensity, alternate); //} }
public static char[] ApplyMaskToNumber(ulong number, IMask mask) { var numberToString = ConvertNumberToCharArray(number); var numberAfterMask = mask.ApplyMask(numberToString); return(numberAfterMask); }
public MemoryInputDay14(ulong number, int memoryIndex, int order, IMask mask) { Number = number; MemoryIndex = memoryIndex; Mask = mask; Order = order; }
public void AddMaskToList(IMask mask, string maskName) { string mName = maskName; foreach (MaskItem m in MaskCheckList.Items) { if (m.Name == mName) { //is there a difference in the two? if (mask.GetType() == m.mMask.GetType()) { m.mMask = mask.Clone(); return; } else { maskName += "1"; } } } //new MaskItem item = new MaskItem(); item.Name = maskName; item.mMask = mask; MaskCheckList.Items.Add(item, false); }
public void MoveXY() { if (this.SelectedBJ == null) { return; } var move_act = Sequence.create(); move_act.AddAction(InjectMoveTo.create(10000, injectorDevice.GetSeleteced(), -1, IMask.Gen(-1), IMask.Gen(0))); int x = 0; int y = 0; double min_width = 1.0f; if (SelectedBJ is T_BJ_Tip tipseat) { x = (int)(tipseat.X - SeatXIndex * tipseat.GapX); y = tipseat.GetY(SeatYIndex); min_width = (double)tipseat.MinWidth; } else if (SelectedBJ is T_BJ_SampleRack sampleseat) { x = (int)(sampleseat.X); y = (int)sampleseat.GetY(SeatYIndex); min_width = (double)sampleseat.MinWidth; } else if (SelectedBJ is T_BJ_DeepPlate deepplate) { x = (int)(deepplate.X + SeatXIndex * deepplate.GapX); y = deepplate.GetY(SeatYIndex); min_width = (double)deepplate.MinWidth; } else if (SelectedBJ is T_BJ_AgentiaWarehouse agentiaware) { x = (int)(agentiaware.X); y = agentiaware.GetY(SeatYIndex); min_width = (double)agentiaware.MinWidth; } else if (SelectedBJ is T_BJ_GelSeat gelseat) { x = (int)(gelseat.InjectorX + SeatXIndex * gelseat.InjectorGapX); y = gelseat.GetInjectorY(SeatYIndex); min_width = (double)gelseat.MinWidth; } else if (SelectedBJ is T_BJ_Unload unload) { x = (int)(unload.X); y = (int)(unload.Y + SeatYIndex * unload.FZ); } var points = IMask.Gen(new ActionPoint(-1, -1, -1)); foreach (var ent in injectorDevice.GetSeleteced()) { points[ent.Index].x = x; points[ent.Index].y = y; points[ent.Index].minwidth = min_width; } move_act.AddAction(InjectMoveActs.create(3001, points.ToArray(), true)); move_act.runAction(injectorDevice); }
public void SetMask(IMask mask, int height, int width) { mMask = mask; mHeight = height; mWidth = width; mMaxA = mHeight; mMaxB = mWidth; }
private IMask getBlurredMask(List <Vector2> oldpoints) { IMask mask = obtainBluredMask(oldpoints, _layerLocalParameters.BlurSize, _layerLocalParameters.ExtendSize); mask = _layerUtility.Blur(mask, 5); mask = _layerUtility.Blur(mask, 5); return(mask); }
public void Set(IMask m) { GraphBasedMask sameTypeMask = m as GraphBasedMask; if (sameTypeMask != null) { //base.Set(sameTypeMask); } }
public bool DoneZ(Enterclose[] injects, int speed) { bool ret = true; var device = (InjectorDevice)node; foreach (var ent in injects) { ret = ret && device.CanComm.GetBool(ent.ZMotor.DoneCoil.Addr, false); if (ent.ZMotor.forecast_move.Count != 0) { int set_speed = 0; if (speed == 0) { set_speed = ent.ZMotor.Speed.SetValue; } else if (speed == 1) { set_speed = ent.ZMotor.SecondSpeed.SetValue; } else if (speed == 2) { set_speed = ent.ZMotor.DownSpeed.SetValue; } else { set_speed = speed; } if (ent.ZMotor.forecast_move.ContainsKey(set_speed)) { var forecastmove = ent.ZMotor.forecast_move[set_speed]; if (ret == false && forecastmove.is_bin && forecastmove.distance != 0 && forecastmove.tager == 0) { double min_dis = 2000; double wait_time = forecastmove.setp_time * (forecastmove.distance - min_dis); if (CurrentTimeStamp() - forecastmove.beg_time >= wait_time) { var real_z = IMask.Gen(0); Enterclose[] ents = { ent }; GetRealZ(ents, ref real_z); ret = Math.Abs(forecastmove.tager - real_z[ent.Index]) < min_dis; } } else if (ret && forecastmove.distance != 0 && forecastmove.is_bin == false) { var use_time = CurrentTimeStamp() - forecastmove.beg_time; forecastmove.setp_time = use_time / forecastmove.distance; forecastmove.is_bin = true; } } } if (ret == false) { break; } } return(ret); }
public void Set(IMask m) { ArrayBasedMask sameTypeMask = m as ArrayBasedMask; if (sameTypeMask != null) { base.Set(sameTypeMask); } }
private Tetromino(char name, char draw, char uni, Color colour, Color bg, IMask bricks) { Name = name; UniDraw = uni; Draw = draw; Colour = colour; Background = bg; Bricks = bricks; Style = new ConsolePixel(draw, colour, bg); }
public FilterStateConfiguration MaskField(string field, IMask mask = null) { var filter = new TextLogMaskingFilter(new TextMaskingRule() { Field = field, Mask = mask ?? Masks.DefaultMask }); _actions.Add(f => f.Filters.Add(filter)); return(this); }
public QueryStringFilterStateConfiguration WithField(string path, IMask mask = null) { var rule = new TextMaskingRule() { Field = path, Mask = mask }; _rules.Add(rule); return(this); }
public XmlPayloadFilterStateConfiguration WithField(string path, IMask mask = null) { var rule = new PayloadFieldMaskingRule() { Path = path, Mask = mask }; _rules.Add(rule); return(this); }
public static IArea Create(string id, IMask mask) { var area = new AGSArea(id, AGSGame.Resolver) { Mask = mask }; area.AddComponent <IWalkableArea>(); return(area); }
public MamService(IIotaRepository repository, IMask mask, Seed seed) { var curl = new Curl(); var treeFactory = new CurlMerkleTreeFactory(new CurlMerkleNodeFactory(curl), new CurlMerkleLeafFactory(new AddressGenerator(seed, SecurityNumber))); var mamFactory = new CurlMamFactory(curl, mask); var mamParser = new CurlMamParser(mask, treeFactory, curl); this.ChannelFactory = new MamChannelFactory(mamFactory, treeFactory, repository); this.SubscriptionFactory = new MamChannelSubscriptionFactory(repository, mamParser); }
public static MemoryInputDay14 CreateMemoryInput(int order, string line, IMask mask) { var matches = Regex.Match(line, pattern); var memory = int.Parse(matches.Groups[1].Value); var number = ulong.Parse(matches.Groups[2].Value); var memoryInputData = new MemoryInputDay14(number, memory, order, mask); return(memoryInputData); }
protected IMask obtainBluredMask(IList <Vector2> points, int blurSize, int extendSize) { IMask mask = _layUtils.GetMaskForPoints(points); var layer = _layUtils.ExtendLayer(mask, extendSize); layer = _layUtils.Blur(layer, blurSize); layer = _layUtils.Blur(layer, blurSize); layer = _layUtils.Blur(layer, 15); _layUtils.Normalize(layer); return(layer); }
private void setMask (IMask mask, string hotspot, string [] sayWhenLook = null, string [] sayWhenInteract = null) { mask.DebugDraw.PixelPerfect (true); mask.DebugDraw.Hotspot = hotspot; mask.DebugDraw.Opacity = 0; mask.DebugDraw.Z = mask.MinY; subscribeSentences (sayWhenLook, mask.DebugDraw.Interactions.OnInteract(AGSInteractions.LOOK)); subscribeSentences (sayWhenInteract, mask.DebugDraw.Interactions.OnInteract(AGSInteractions.INTERACT)); }
protected BaseEntity PixelCollide(Vector2 parentPosition, IMask mask) { PixelCollisionMask pixelMask = mask as PixelCollisionMask; if (Collision.PerPixelCollision(Parent.CurrentImages[CollisionIndex],pixelMask.Parent.CurrentImages[pixelMask.CollisionIndex], parentPosition, mask.Parent.Position)) { return mask.Parent; } return null; }
protected BaseEntity HitboxCollide(Vector2 parentPosition, IMask mask) { HitboxMask hitboxMask = mask as HitboxMask; if (Collision.HitBoxCollision(new Rectangle(Hitbox.X, Hitbox.Y, Hitbox.Width, Hitbox.Height), new Rectangle(hitboxMask.Hitbox.X, hitboxMask.Hitbox.Y, hitboxMask.Hitbox.Width, hitboxMask.Hitbox.Height), parentPosition, hitboxMask.Parent.Position)) { return mask.Parent; } return null; }
public override void AddCollisionMask(IMask mask) { base.AddCollisionMask(mask); OriginalMask.X = (mask as HitboxMask).Hitbox.X; OriginalMask.Y = (mask as HitboxMask).Hitbox.Y; OriginalMask.Width = (mask as HitboxMask).Hitbox.Width; OriginalMask.Height = (mask as HitboxMask).Hitbox.Height; (CollisionMasks[0] as HitboxMask).Hitbox.X = (int)(StartingScale * OriginalMask.X); (CollisionMasks[0] as HitboxMask).Hitbox.Y = (int)(StartingScale * OriginalMask.Y); (CollisionMasks[0] as HitboxMask).Hitbox.Width = (int)(StartingScale * OriginalMask.Width); (CollisionMasks[0] as HitboxMask).Hitbox.Height = (int)(StartingScale * OriginalMask.Height); }
public virtual void AddCollisionMask(IMask mask) { mask.Parent = this; CollisionMasks.Add(mask); }
public BaseEntity Collide(Vector2 parentPosition, IMask mask) { return collideFunctions[mask.Type](parentPosition, mask); }
public static IArea Create(string id, IMask mask) { var area = new AGSArea(id, AGSGame.Resolver) { Mask = mask }; area.AddComponent<IWalkBehindArea>(); return area; }