/// <summary> /// Create a new commit. /// </summary> /// <param name="id">the identity of this commit.</param> /// <param name="tags">the tags associated with this commit, null for no tags</param> public PlotCommit(AnyObjectId id, Ref[] tags) : base(id) { this.refs = tags; passingLanes = NO_LANES; children = NO_CHILDREN; }
public MemoryTier this[Ref @ref] { get { return this[@ref.AssertNotNull().Sym]; } }
private void SelectRef(Ref r) { if (r == null) return; var obj = r.Target; if (obj.IsCommit) { DisplayCommit(obj as Commit, "Commit history of " + r.Name); return; } else if (obj.IsTag) { var tag = obj as Tag; if (tag.Target == tag) // it sometimes happens to have self referencing tags { return; } SelectTag(tag); return; } else if (obj.IsTree) { // hmm, display somehow } else if (obj.IsBlob) { // hmm, display somehow } else { Debug.Fail("don't know how to display this object: "+obj.ToString()); } }
public static SwitchGeneratorAction LabelJumpAction(Ref<Labels>[] valueLabels) { return (EmitSyntax emit, int value) => { emit.Br(valueLabels[value]); }; }
/// <param name="message"></param> /// <param name="ref"></param> /// <param name="rc"></param> public ConcurrentRefUpdateException(string message, Ref @ref, RefUpdate.Result rc ) : base((rc == null) ? message : message + ". " + MessageFormat.Format(JGitText .Get().refUpdateReturnCodeWas, rc)) { this.rc = rc; this.@ref = @ref; }
public Emitter ld(Ref @ref) { var layout = _alloc[@ref]; var lt_slot = layout as SlotLayout; if (lt_slot != null) { var slot = lt_slot.Slot; if (slot is Reg) { var reg = (Reg)slot; push(reg); } else if (slot is Var) { var @var = (Var)slot; var type = @var.Type; var reg = def_local(type); _ptx.Add(new ld{ss = @var.Space, type = type, d = reg, a = @var}); push(reg); } else { throw AssertionHelper.Fail(); } } else { push(layout); } return this; }
public void OlderRefCompareToNewerRef() { Ref older = new Ref(null); Ref newer = new Ref(null); Assert.IsTrue(older.CompareTo(newer) < 0); Assert.IsTrue(newer.CompareTo(older) > 0); }
private static JToken SerializeRef(Ref reference) { var result = new JObject(); result["$type"] = "ref"; result["value"] = new JArray(reference.AsRef().Select(SerializationHelper.SerializeItem).ToList()); return result; }
public void NullEqualsRef() { Ref r = null; Ref other = new Ref(null); Assert.IsFalse(r == other); Assert.IsTrue(r != other); }
public override bool Place(Point origin, StructureMap structures) { if (GenBase._tiles[origin.X, origin.Y].active() && WorldGen.SolidTile(origin.X, origin.Y)) return false; Point result; if (!WorldUtils.Find(origin, Searches.Chain(new Searches.Down(80), new Conditions.IsSolid()), out result)) return false; result.Y += 2; Ref<int> count = new Ref<int>(0); WorldUtils.Gen(result, new Shapes.Circle(8), Actions.Chain(new Modifiers.IsSolid(), new Actions.Scanner(count))); if (count.Value < 20 || !structures.CanPlace(new Microsoft.Xna.Framework.Rectangle(result.X - 8, result.Y - 8, 16, 16), 0)) return false; WorldUtils.Gen(result, new Shapes.Circle(8), Actions.Chain(new Modifiers.RadialDither(0.0f, 10f), new Modifiers.IsSolid(), new Actions.SetTile(229, true, true))); ShapeData data = new ShapeData(); WorldUtils.Gen(result, new Shapes.Circle(4, 3), Actions.Chain(new Modifiers.Blotches(2, 0.3), new Modifiers.IsSolid(), new Actions.ClearTile(true), new Modifiers.RectangleMask(-6, 6, 0, 3).Output(data), new Actions.SetLiquid(2, byte.MaxValue))); WorldUtils.Gen(new Point(result.X, result.Y + 1), new ModShapes.InnerOutline(data, true), Actions.Chain(new Modifiers.IsEmpty(), new Modifiers.RectangleMask(-6, 6, 1, 3), new Actions.SetTile(59, true, true))); structures.AddStructure(new Microsoft.Xna.Framework.Rectangle(result.X - 8, result.Y - 8, 16, 16), 0); return true; }
public MemberInfo(Ref memberRef) { this.memberRef = memberRef; oldFullName = memberRef.memberReference.FullName; oldName = memberRef.memberReference.Name; newName = memberRef.memberReference.Name; }
public EmitSyntax Build(EmitSyntax emit) { int rows = table.RowCount; int columns = table.ColumnCount; Ref<Labels> END = emit.Labels.Generate().GetRef(); Ref<Labels>[] labels = new Ref<Labels>[rows]; for (int i = 0; i != rows; ++i) { labels[i] = emit.Labels.Generate().GetRef(); } emit .Do(LdRow) .Switch(labels) .Ldc_I4(-1) .Br(END) ; var columnRange = new IntInterval(0, columns - 1); var columnFrequency = new UniformIntFrequency(columnRange); for (int i = 0; i != rows; ++i) { var switchEmitter = SwitchGenerator.Sparse(table.GetRow(i), columnRange, columnFrequency); emit.Label(labels[i].Def); switchEmitter.Build(emit, LdCol, SwitchGenerator.LdValueAction(END)); } return emit .Label(END.Def); }
public void OlderRefNotEqualsNewerRef() { Ref older = new Ref(null); Ref newer = new Ref(null); Assert.IsFalse(older.Equals(newer)); Assert.IsFalse(older == newer); Assert.IsTrue(older != newer); }
public override bool Place(Point origin, StructureMap structures) { Ref<int> count1 = new Ref<int>(0); Ref<int> count2 = new Ref<int>(0); WorldUtils.Gen(origin, new Shapes.Circle(10), Actions.Chain(new Actions.Scanner(count2), new Modifiers.IsSolid(), new Actions.Scanner(count1))); if (count1.Value < count2.Value - 5) return false; int radius = GenBase._random.Next(6, 10); int num1 = GenBase._random.Next(5); if (!structures.CanPlace(new Microsoft.Xna.Framework.Rectangle(origin.X - radius, origin.Y - radius, radius * 2, radius * 2), 0)) return false; ShapeData data = new ShapeData(); WorldUtils.Gen(origin, new Shapes.Slime(radius), Actions.Chain(new Modifiers.Blotches(num1, num1, num1, 1, 0.3).Output(data), new Modifiers.Offset(0, -2), new Modifiers.OnlyTiles(new ushort[1] { 53 }), new Actions.SetTile(397, true, true), new Modifiers.OnlyWalls(new byte[1]), new Actions.PlaceWall(16, true))); WorldUtils.Gen(origin, new ModShapes.All(data), Actions.Chain(new Actions.ClearTile(false), new Actions.SetLiquid(0, 0), new Actions.SetFrames(true), new Modifiers.OnlyWalls(new byte[1]), new Actions.PlaceWall(16, true))); Point result; if (!WorldUtils.Find(origin, Searches.Chain(new Searches.Down(10), new Conditions.IsSolid()), out result)) return false; int j = result.Y - 1; bool flag = GenBase._random.Next() % 2 == 0; if (GenBase._random.Next() % 10 != 0) { int num2 = GenBase._random.Next(1, 4); int num3 = flag ? 4 : -(radius >> 1); for (int index1 = 0; index1 < num2; ++index1) { int num4 = GenBase._random.Next(1, 3); for (int index2 = 0; index2 < num4; ++index2) WorldGen.PlaceTile(origin.X + num3 - index1, j - index2, 331, false, false, -1, 0); } } int num5 = (radius - 3) * (flag ? -1 : 1); if (GenBase._random.Next() % 10 != 0) WorldGen.PlaceTile(origin.X + num5, j, 186, false, false, -1, 0); if (GenBase._random.Next() % 10 != 0) { WorldGen.PlaceTile(origin.X, j, 215, true, false, -1, 0); if (GenBase._tiles[origin.X, j].active() && GenBase._tiles[origin.X, j].type == 215) { GenBase._tiles[origin.X, j].frameY += 36; GenBase._tiles[origin.X - 1, j].frameY += 36; GenBase._tiles[origin.X + 1, j].frameY += 36; GenBase._tiles[origin.X, j - 1].frameY += 36; GenBase._tiles[origin.X - 1, j - 1].frameY += 36; GenBase._tiles[origin.X + 1, j - 1].frameY += 36; } } structures.AddStructure(new Microsoft.Xna.Framework.Rectangle(origin.X - radius, origin.Y - radius, radius * 2, radius * 2), 4); return true; }
public static SwitchGeneratorAction LdValueAction(Ref<Labels> END) { return (EmitSyntax emit, int value) => { emit .Ldc_I4(value) .Br(END); }; }
public AutomationWindow(Ship_Game.ScreenManager ScreenManager, UniverseScreen screen) { this.screen = screen; this.ScreenManager = ScreenManager; int WindowWidth = 210; this.win = new Rectangle(ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth - 115 - WindowWidth, 490, WindowWidth, 300); Rectangle rectangle = new Rectangle(ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth - 5 - WindowWidth + 20, 225, WindowWidth - 40, 455); this.ConstructionSubMenu = new Submenu(ScreenManager, this.win, true); this.ConstructionSubMenu.AddTab(Localizer.Token(304)); Ref<bool> aeRef = new Ref<bool>(() => EmpireManager.GetEmpireByName(screen.PlayerLoyalty).AutoExplore, (bool x) => EmpireManager.GetEmpireByName(screen.PlayerLoyalty).AutoExplore = x); Checkbox cb = new Checkbox(new Vector2((float)this.win.X, (float)(this.win.Y + 25)), Localizer.Token(305), aeRef, Fonts.Arial12Bold); this.Checkboxes.Add(cb); cb.Tip_Token = 2226; this.ScoutDropDown = new DropOptions(new Rectangle(this.win.X + 12, this.win.Y + 25 + Fonts.Arial12Bold.LineSpacing + 7, 190, 18)); Ref<bool> acRef = new Ref<bool>(() => EmpireManager.GetEmpireByName(screen.PlayerLoyalty).AutoColonize, (bool x) => EmpireManager.GetEmpireByName(screen.PlayerLoyalty).AutoColonize = x); cb = new Checkbox(new Vector2((float)this.win.X, (float)(this.win.Y + 65)), Localizer.Token(306), acRef, Fonts.Arial12Bold); this.Checkboxes.Add(cb); cb.Tip_Token = 2227; this.ColonyShipDropDown = new DropOptions(new Rectangle(this.win.X + 12, this.win.Y + 65 + Fonts.Arial12Bold.LineSpacing + 7, 190, 18)); Ref<bool> afRef = new Ref<bool>(() => EmpireManager.GetEmpireByName(screen.PlayerLoyalty).AutoFreighters, (bool x) => EmpireManager.GetEmpireByName(screen.PlayerLoyalty).AutoFreighters = x); cb = new Checkbox(new Vector2((float)this.win.X, (float)(this.win.Y + 105)), Localizer.Token(308), afRef, Fonts.Arial12Bold); this.Checkboxes.Add(cb); cb.Tip_Token = 2229; this.AutoFreighterDropDown = new DropOptions(new Rectangle(this.win.X + 12, this.win.Y + 105 + Fonts.Arial12Bold.LineSpacing + 7, 190, 18)); this.ConstructorTitle = new Vector2((float)this.win.X + 29, (float)(this.win.Y + 155)); this.ConstructorString = Localizer.Token(6181); this.ConstructorDropDown = new DropOptions(new Rectangle(this.win.X + 12, this.win.Y + 155 + Fonts.Arial12Bold.LineSpacing + 7, 190, 18)); Ref<bool> abRef = new Ref<bool>(() => EmpireManager.GetEmpireByName(screen.PlayerLoyalty).AutoBuild, (bool x) => EmpireManager.GetEmpireByName(screen.PlayerLoyalty).AutoBuild = x); cb = new Checkbox(new Vector2((float)this.win.X, (float)(this.win.Y + 210)), string.Concat(Localizer.Token(307), " Projectors"), abRef, Fonts.Arial12Bold); this.Checkboxes.Add(cb); cb.Tip_Token = 2228; Ref<bool> acomRef = new Ref<bool>(() => GlobalStats.AutoCombat, (bool x) => GlobalStats.AutoCombat = x); cb = new Checkbox(new Vector2((float)this.win.X, (float)(this.win.Y + 210 + Fonts.Arial12Bold.LineSpacing + 3)), Localizer.Token(2207), acomRef, Fonts.Arial12Bold); this.Checkboxes.Add(cb); cb.Tip_Token = 2230; Ref<bool> arRef = new Ref<bool>(() => EmpireManager.GetEmpireByName(screen.PlayerLoyalty).AutoResearch, (bool x) => EmpireManager.GetEmpireByName(screen.PlayerLoyalty).AutoResearch = x); cb = new Checkbox(new Vector2((float)this.win.X, (float)(this.win.Y + 210 + Fonts.Arial12Bold.LineSpacing * 2 + 6)), Localizer.Token(6136), arRef, Fonts.Arial12Bold); this.Checkboxes.Add(cb); cb.Tip_Token = 7039; Ref<bool> atRef = new Ref<bool>(() => EmpireManager.GetEmpireByName(screen.PlayerLoyalty).AutoTaxes, (bool x) => EmpireManager.GetEmpireByName(screen.PlayerLoyalty).AutoTaxes = x); cb = new Checkbox(new Vector2((float)this.win.X, (float)(this.win.Y + 210 + Fonts.Arial12Bold.LineSpacing * 3 + 9)), Localizer.Token(6138), atRef, Fonts.Arial12Bold); this.Checkboxes.Add(cb); cb.Tip_Token = 7040; this.SetDropDowns(); }
public Checkbox(Vector2 Position, string text, Ref<bool> connectedTo, SpriteFont Font) { this.connectedTo = connectedTo; this.Text = text; this.Font = Font; this.EnclosingRect = new Rectangle((int)Position.X, (int)Position.Y, (int)Font.MeasureString(text).X + 32, Font.LineSpacing + 6); this.CheckRect = new Rectangle(this.EnclosingRect.X + 15, this.EnclosingRect.Y + this.EnclosingRect.Height / 2 - 5, 10, 10); this.TextPos = new Vector2((float)(this.CheckRect.X + 15), (float)(this.CheckRect.Y + this.CheckRect.Height / 2 - Font.LineSpacing / 2)); this.CheckPos = new Vector2((float)(this.CheckRect.X + 5) - Fonts.Arial12Bold.MeasureString("x").X / 2f, (float)(this.CheckRect.Y + 4 - Fonts.Arial12Bold.LineSpacing / 2)); }
public void RefNameResolution() { using (var repo = GetTrashRepository()) { var master = new Ref(repo, "refs/heads/master"); var previous = new Ref(repo, "refs/heads/master^"); Assert.AreNotEqual(master.Target.Hash, previous.Target.Hash); Assert.AreEqual((master.Target as Commit).Parent.Hash, previous.Target.Hash); } }
public void BuildBody(EmitSyntax emit, LanguageData data, Ref<Args>[] args) { BuildBody( emit, data, ruleId: args[0], ruleArgs: args[1], argsStart: args[2], ctx: args[3], lookbackStart: args[4]); }
public static IEnumerator<CommandDelegate> CoroutineOne(Ref<float> val, int depth, Ref<int> calledCount) { if (depth > 0) { ++calledCount.Value; yield return Commands.ChangeTo(val, 5.0f, 4.0f); yield return Commands.WaitForSeconds(1.0f); yield return Commands.ChangeBy(val, -4.0f, 4.0f); yield return null; // Wait for a single frame yield return Commands.Coroutine(() => CoroutineOne(val, depth - 1, calledCount)); } }
public void BuildBody(EmitSyntax emit, LanguageData data, Ref<Args>[] args) { BuildBody( emit, data, tokenId: args[0], oldValue: args[1], newValue: args[2], ctx: args[3], lookbackStart: args[4]); }
/// <summary> /// Oscillates around a value. This will animation from /// startValue > startValue + amount > startValue - amount- > startValue, /// in a smooth circular motion. /// </summary> /// <param name="amount"> /// The maximum amount to oscillate away from the default value. /// </param> public static CommandDelegate Oscillate(Ref<float> single, float amount, double duration, CommandEase ease = null) { CheckArgumentNonNull(single, "single"); float baseValue = 0f; return Commands.Sequence( Commands.Do( () => baseValue = single.Value), Commands.Duration( t => { single.Value = baseValue + Mathf.Sin((float) t * 2f * Mathf.PI) * amount; }, duration, ease) ); }
/// <exception cref="System.SqlSyntaxErrorException" /> public virtual Ref BuildRef(Ref first) { for (; lexer.Token() == MySqlToken.KwJoin;) { lexer.NextToken(); var temp = Factor(); first = new Join(first, temp); } return first; }
public ProcessorState( Ref<System.Drawing.Rectangle> crop, Ref<System.Drawing.Rectangle> crop_values, Ref<int> upper, Ref<int> lower, KinectData data_, short[] depth, byte[] depth_label_, byte[] rgb, byte[] bitmap_bits, Dictionary<Tuple<byte, byte, byte>, byte> nearest_cache_, Dictionary<byte, byte[]> label_color_, byte kBackgroundLabel, List<byte[]> centroid_colors_, List<byte> centroid_labels, Ref<bool> predict_on_enable_, Ref<bool>feature_extract_on_enable_, Ref<bool> overlay_start_, int kNoOverlay, int[] overlay_bitmap_bits_, int[] kEmptyOverlay, FeatureExtractionLib.FeatureExtraction feature, float[] predict_output_, int[] predict_labels_, List<IWebSocketConnection> all_sockets_, Filter.Step[] pipeline, HandGestureFormat hand_gesture_value_, RangeModeFormat range_mode_value_, int[] pool, byte[] bitmap_bits_copy, int radius, double density, int cluster_threshold_count) { this.crop = crop; this.crop_values = crop_values; this.upper = upper; this.lower = lower; this.data_ = data_; this.depth = depth; this.rgb = rgb; this.bitmap_bits_ = bitmap_bits; this.depth_label_ = depth_label_; this.bitmap_bits_copy_ = bitmap_bits_copy; this.nearest_cache_ = nearest_cache_; this.label_color_ = label_color_; this.kBackgroundLabel = kBackgroundLabel; this.centroid_colors_ = centroid_colors_; this.centroid_labels_ = centroid_labels; this.predict_on_enable_ = predict_on_enable_; this.feature_extract_on_enable_ = feature_extract_on_enable_; this.overlay_start_ = overlay_start_; this.kNoOverlay = kNoOverlay; this.overlay_bitmap_bits_ = overlay_bitmap_bits_; this.kEmptyOverlay = kEmptyOverlay; this.feature = feature; this.predict_output_ = predict_output_; this.predict_labels_ = predict_labels_; this.all_sockets_ = all_sockets_; this.pipeline = pipeline; this.hand_gesture_value_ = hand_gesture_value_; this.range_mode_value_ = range_mode_value_; this.pool_ = pool; this.radius_ = radius; this.density_ = density; this.cluster_threshold_count_ = cluster_threshold_count; }
/// <summary> /// Performs a squash and stretch animation, while changing from a target scale. /// </summary> /// <param name="scale">The value to animate.</param> /// <param name="startScale">The scale to animate from.</param> /// <param name="amplitude">The amplitude of a squash and strech</param> /// <param name="duration">The duration of the animation</param> /// <param name="normal"> The normal of the animation. </param> /// <param name="tangent"> The tangent of the animation. </param> public static CommandDelegate ScaleSquashAndStretchFrom(Ref<Vector3> scale, Vector3 startScale, float amplitude, double duration, Vector3 normal, Vector3 tangent) { CheckArgumentNonNull(scale, "scale"); Vector3 targetScale = Vector3.zero; return Commands.Sequence( Commands.Do( () => { targetScale = scale.Value; scale.Value = startScale; }), Commands.Defer( () => Commands.ScaleSquashAndStretchTo(scale, targetScale, amplitude, duration, normal, tangent)) ); }
public override bool Place(Point origin, StructureMap structures) { if (GenBase._tiles[origin.X, origin.Y].active() && WorldGen.SolidTile(origin.X, origin.Y)) { return false; } Point origin2; if (!WorldUtils.Find(origin, Searches.Chain(new Searches.Down(80), new GenCondition[] { new Conditions.IsSolid() }), out origin2)) { return false; } origin2.Y += 2; Ref<int> @ref = new Ref<int>(0); WorldUtils.Gen(origin2, new Shapes.Circle(8), Actions.Chain(new GenAction[] { new Modifiers.IsSolid(), new Actions.Scanner(@ref) })); if (@ref.Value < 20) { return false; } if (!structures.CanPlace(new Rectangle(origin2.X - 8, origin2.Y - 8, 16, 16), 0)) { return false; } WorldUtils.Gen(origin2, new Shapes.Circle(8), Actions.Chain(new GenAction[] { new Modifiers.RadialDither(0f, 10f), new Modifiers.IsSolid(), new Actions.SetTile(229, true, true) })); ShapeData data = new ShapeData(); WorldUtils.Gen(origin2, new Shapes.Circle(4, 3), Actions.Chain(new GenAction[] { new Modifiers.Blotches(2, 0.3), new Modifiers.IsSolid(), new Actions.ClearTile(true), new Modifiers.RectangleMask(-6, 6, 0, 3).Output(data), new Actions.SetLiquid(2, 255) })); WorldUtils.Gen(new Point(origin2.X, origin2.Y + 1), new ModShapes.InnerOutline(data, true), Actions.Chain(new GenAction[] { new Modifiers.IsEmpty(), new Modifiers.RectangleMask(-6, 6, 1, 3), new Actions.SetTile(59, true, true) })); structures.AddStructure(new Rectangle(origin2.X - 8, origin2.Y - 8, 16, 16), 0); return true; }
public Layout this[Ref @ref] { get { @ref.AssertNotNull(); var local = @ref.Sym.AssertCast<Local>(); return _locals_cache.GetOrCreate(local, () => { var t = @ref.Type(); if (_scheme[@ref] == MemoryTier.Private) { if (t.IsArray) { throw AssertionHelper.Fail(); } else { (t.IsCudaPrimitive() || t.IsCudaVector()).AssertTrue(); var slot = new Reg{Type = @ref.Type(), Name = @ref.Sym.Name}; return new SlotLayout(@ref, slot); } } else if (_scheme[@ref] == MemoryTier.Shared) { if (t.IsArray) { throw AssertionHelper.Fail(); } else { throw AssertionHelper.Fail(); } } else if (_scheme[@ref] == MemoryTier.Global) { if (t.IsArray) { throw AssertionHelper.Fail(); } else { throw AssertionHelper.Fail(); } } else { throw AssertionHelper.Fail(); } }); } }
private WantArgsBase DefineArgs(WantArgsBase wantArgs) { this.inputArgs = new Ref<Args>[argTypes.Length]; for (int i = 0; i != inputArgs.Length; ++i) { var arg = wantArgs.Args.Generate(argNames[i]).GetRef(); wantArgs = wantArgs.Argument(wantArgs.Types.Import(argTypes[i]), arg.Def); inputArgs[i] = arg; } return wantArgs; }
public StackGenerator(EmitSyntax emit, Type itemType, bool nullContainer = false) { this.itemType = emit.Types.Import(itemType); this.stackType = emit.Types.Import(itemType.MakeArrayType()); this.nullContainer = nullContainer; this.stack = emit.Locals.Generate(); this.index = emit.Locals.Generate(); emit .Local(stack, stackType) .Local(index, emit.Types.Int32) ; }
/// <summary> /// Pulsates a value. /// </summary> /// <param name="amount">The amount to increase the value by.</param> public static CommandDelegate PulsateScale(Ref<float> scale, float amount, double duration) { CheckArgumentNonNull(scale, "scale"); CommandDelegate tweenBack = null; return Commands.Sequence( Commands.Do( () => { // Because we don't know what the original scale is at this point, // we have to recreate the scale back tween every time. tweenBack = Commands.ChangeTo(scale, scale.Value, duration / 2.0, Ease.Smooth()); }), Commands.ChangeBy(scale, amount, duration / 2.0, Ease.Smooth()), Commands.Defer( () => tweenBack) ); }
public SimpleOverlay(string textureName, string shaderName = "Default", EffectPriority priority = EffectPriority.VeryLow, RenderLayers layer = RenderLayers.All) : base(priority, layer) { this._texture = TextureManager.AsyncLoad(textureName == null ? "" : textureName); this._shader = new ScreenShaderData(Main.ScreenShaderRef, shaderName); }
public SimpleOverlay(string textureName, ScreenShaderData shader, EffectPriority priority = EffectPriority.VeryLow, RenderLayers layer = RenderLayers.All) : base(priority, layer) { this._texture = TextureManager.AsyncLoad(textureName == null ? "" : textureName); this._shader = shader; }
public Count(Ref <int> count) { _count = count; }
/// <exception cref="NGit.Errors.TransportException"></exception> private IDictionary <string, RemoteRefUpdate> PrepareRemoteUpdates() { IDictionary <string, RemoteRefUpdate> result = new Dictionary <string, RemoteRefUpdate >(); foreach (RemoteRefUpdate rru in toPush.Values) { Ref advertisedRef = connection.GetRef(rru.GetRemoteName()); ObjectId advertisedOld = (advertisedRef == null ? ObjectId.ZeroId : advertisedRef .GetObjectId()); if (rru.GetNewObjectId().Equals(advertisedOld)) { if (rru.IsDelete()) { // ref does exist neither locally nor remotely rru.SetStatus(RemoteRefUpdate.Status.NON_EXISTING); } else { // same object - nothing to do rru.SetStatus(RemoteRefUpdate.Status.UP_TO_DATE); } continue; } // caller has explicitly specified expected old object id, while it // has been changed in the mean time - reject if (rru.IsExpectingOldObjectId() && !rru.GetExpectedOldObjectId().Equals(advertisedOld )) { rru.SetStatus(RemoteRefUpdate.Status.REJECTED_REMOTE_CHANGED); continue; } // create ref (hasn't existed on remote side) and delete ref // are always fast-forward commands, feasible at this level if (advertisedOld.Equals(ObjectId.ZeroId) || rru.IsDelete()) { rru.SetFastForward(true); result.Put(rru.GetRemoteName(), rru); continue; } // check for fast-forward: // - both old and new ref must point to commits, AND // - both of them must be known for us, exist in repository, AND // - old commit must be ancestor of new commit bool fastForward = true; try { RevObject oldRev = walker.ParseAny(advertisedOld); RevObject newRev = walker.ParseAny(rru.GetNewObjectId()); if (!(oldRev is RevCommit) || !(newRev is RevCommit) || !walker.IsMergedInto((RevCommit )oldRev, (RevCommit)newRev)) { fastForward = false; } } catch (MissingObjectException) { fastForward = false; } catch (Exception x) { throw new TransportException(transport.GetURI(), MessageFormat.Format(JGitText.Get ().readingObjectsFromLocalRepositoryFailed, x.Message), x); } rru.SetFastForward(fastForward); if (!fastForward && !rru.IsForceUpdate()) { rru.SetStatus(RemoteRefUpdate.Status.REJECTED_NONFASTFORWARD); } else { result.Put(rru.GetRemoteName(), rru); } } return(result); }
private void wantTag(Ref r) { want(r, new RefSpec(r.Name, r.Name)); }
public void ExitGameScene() { Ref.LoadScene(Ref.SceneType.MainMenu); GameSaving.GameSave.UpdatePersistantSave(); }
// Same as XmlReader.IsStartElement except does not call MoveToContent first. private static bool IsOnElement(XmlReader xmlReader, string elementName) { return(xmlReader.NodeType == XmlNodeType.Element && Ref.Equal(xmlReader.LocalName, elementName)); }
// returns false if attribute is actualy namespace private bool ReadAttribute(ref Record rec) { Debug.Assert(_reader.NodeType == XmlNodeType.Attribute, "reader.NodeType == XmlNodeType.Attribute"); FillupRecord(ref rec); if (Ref.Equal(rec.prefix, _atoms.Xmlns)) { // xmlns:foo="NS_FOO" string atomizedValue = _atoms.NameTable.Add(_reader.Value); if (!Ref.Equal(rec.localName, _atoms.Xml)) { _scopeManager.AddNsDeclaration(rec.localName, atomizedValue); _ctxInfo !.AddNamespace(rec.localName, atomizedValue); } return(false); } else if (rec.prefix.Length == 0 && Ref.Equal(rec.localName, _atoms.Xmlns)) { // xmlns="NS_FOO" string atomizedValue = _atoms.NameTable.Add(_reader.Value); _scopeManager.AddNsDeclaration(string.Empty, atomizedValue); _ctxInfo !.AddNamespace(string.Empty, atomizedValue); return(false); } /* Read Attribute Value */ { if (!_reader.ReadAttributeValue()) { // XmlTextReader never returns false from first call to ReadAttributeValue() rec.value = string.Empty; SetRecordEnd(ref rec); return(true); } if (_readerLineInfo != null) { int correction = (_reader.NodeType == XmlNodeType.EntityReference) ? -2 : -1; rec.valueStart = new Location(_readerLineInfo.LineNumber, _readerLineInfo.LinePosition + correction); if (_reader.BaseURI != rec.baseUri || rec.valueStart.LessOrEqual(rec.start)) { int nameLength = ((rec.prefix.Length != 0) ? rec.prefix.Length + 1 : 0) + rec.localName.Length; rec.end = new Location(rec.start.Line, rec.start.Pos + nameLength + 1); } } string lastText = string.Empty; _strConcat.Clear(); do { switch (_reader.NodeType) { case XmlNodeType.EntityReference: _reader.ResolveEntity(); break; case XmlNodeType.EndEntity: break; default: Debug.Assert(_reader.NodeType == XmlNodeType.Text, "Unexpected node type inside attribute value"); lastText = _reader.Value; _strConcat.Concat(lastText); break; } } while (_reader.ReadAttributeValue()); rec.value = _strConcat.GetResult(); if (_readerLineInfo != null) { Debug.Assert(_reader.NodeType != XmlNodeType.EntityReference); int correction = ((_reader.NodeType == XmlNodeType.EndEntity) ? 1 : lastText.Length) + 1; rec.end = new Location(_readerLineInfo.LineNumber, _readerLineInfo.LinePosition + correction); if (_reader.BaseURI != rec.baseUri || rec.end.LessOrEqual(rec.valueStart)) { rec.end = new Location(rec.start.Line, int.MaxValue); } } } return(true); }
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, Newtonsoft.Json.JsonSerializer serializer) { return(Ref.Deserialize((string)reader.Value)); }
public CustomArmorShader2(Ref <Effect> shader, string passName) : base(shader, passName) { dustShaderData = new ArmorShaderData(shader, passName); }
public TimeStopShader(Ref <Effect> shader, string passName) : base(shader, passName) { }
/// <summary>Peel a possibly unpeeled reference by traversing the annotated tags.</summary> /// <remarks> /// Peel a possibly unpeeled reference by traversing the annotated tags. /// <p> /// If the reference cannot be peeled (as it does not refer to an annotated /// tag) the peeled id stays null, but /// <see cref="Ref.IsPeeled()">Ref.IsPeeled()</see> /// will be true. /// <p> /// Implementors should check /// <see cref="Ref.IsPeeled()">Ref.IsPeeled()</see> /// before performing any /// additional work effort. /// </remarks> /// <param name="ref">The reference to peel</param> /// <returns> /// /// <code>ref</code> /// if /// <code>ref.isPeeled()</code> /// is true; otherwise a new /// Ref object representing the same data as Ref, but isPeeled() will /// be true and getPeeledObjectId() will contain the peeled object /// (or null). /// </returns> /// <exception cref="System.IO.IOException">the reference space or object space cannot be accessed. /// </exception> public abstract Ref Peel(Ref @ref);
public void Relaunch() { Ref.LoadScene(Ref.SceneType.Build); Ref.loadLaunchedRocket = true; GameSaving.GameSave.UpdatePersistantSave(); }
/// <summary> /// Apply the groupFunction repeatedly to a list of groups of lights /// </summary> /// <param name="list"></param> /// <param name="groupFunction"></param> /// <param name="mode"></param> /// <param name="waitTime"></param> /// <param name="duration"></param> /// <param name="cancellationToken"></param> /// <returns></returns> public static async Task IteratorEffect(this IEnumerable <IEnumerable <EntertainmentLight> > list, CancellationToken cancellationToken, IteratorEffectFunc groupFunction, IteratorEffectMode mode, IteratorEffectMode secondaryMode, Ref <TimeSpan?> waitTime, TimeSpan?duration = null, int maxIterations = int.MaxValue) { if (waitTime == null) { waitTime = TimeSpan.FromSeconds(1); } if (duration == null) { duration = TimeSpan.MaxValue; } int secondaryMaxIterations = 1; //Normalize secondary iterator mode switch (secondaryMode) { case IteratorEffectMode.Bounce: secondaryMaxIterations = 2; break; case IteratorEffectMode.Cycle: case IteratorEffectMode.Single: secondaryMode = IteratorEffectMode.Single; break; case IteratorEffectMode.Random: case IteratorEffectMode.RandomOrdered: secondaryMode = IteratorEffectMode.RandomOrdered; break; case IteratorEffectMode.All: case IteratorEffectMode.AllIndividual: default: break; } bool keepGoing = true; var groups = list.ToList(); bool reverse = false; if (mode == IteratorEffectMode.RandomOrdered) { groups = groups.OrderBy(x => Guid.NewGuid()).ToList(); } Stopwatch sw = new Stopwatch(); sw.Start(); int i = 0; while (keepGoing && !cancellationToken.IsCancellationRequested && !(sw.Elapsed > duration) && i < maxIterations) { //Apply to all groups if mode is all if (mode == IteratorEffectMode.All) { var flatGroup = list.SelectMany(x => x); if (!cancellationToken.IsCancellationRequested) { groupFunction(flatGroup, cancellationToken, waitTime); } //foreach (var group in list) //{ // if (!cancellationToken.IsCancellationRequested) // await groupFunction(group, waitTime); //} await Task.Delay(waitTime.Value.Value, cancellationToken).ConfigureAwait(false); i++; continue; } if (reverse) { groups.Reverse(); } if (mode == IteratorEffectMode.Random) { groups = groups.OrderBy(x => Guid.NewGuid()).ToList(); } if (mode == IteratorEffectMode.AllIndividual) { List <Task> allIndividualTasks = new List <Task>(); foreach (var group in groups.Skip(reverse ? 1 : 0)) { //Do not await, AllIndividual runs them all at the same time var t = group.IteratorEffect(cancellationToken, groupFunction, secondaryMode, waitTime, maxIterations: secondaryMaxIterations); allIndividualTasks.Add(t); } await Task.WhenAll(allIndividualTasks); } else { foreach (var group in groups.Skip(reverse ? 1 : 0)) { await group.IteratorEffect(cancellationToken, groupFunction, secondaryMode, waitTime, maxIterations : secondaryMaxIterations); } } keepGoing = mode == IteratorEffectMode.Single || mode == IteratorEffectMode.RandomOrdered ? false : true; if (mode == IteratorEffectMode.Bounce) { reverse = true; } i++; } }
/// <summary> /// Apply the effectFunction repeatedly to a group of lights /// </summary> /// <param name="group"></param> /// <param name="effectFunction"></param> /// <param name="mode"></param> /// <param name="waitTime"></param> /// <param name="duration"></param> /// <param name="cancellationToken"></param> /// <returns></returns> public static async Task IteratorEffect(this IEnumerable <EntertainmentLight> group, CancellationToken cancellationToken, IteratorEffectFunc effectFunction, IteratorEffectMode mode, Ref <TimeSpan?> waitTime, TimeSpan?duration = null, int maxIterations = int.MaxValue) { if (waitTime == null) { waitTime = TimeSpan.FromSeconds(1); } if (duration == null) { duration = TimeSpan.MaxValue; } bool keepGoing = true; var lights = group.ToList(); bool reverse = false; Stopwatch sw = new Stopwatch(); sw.Start(); int i = 0; while (keepGoing && !cancellationToken.IsCancellationRequested && !(sw.Elapsed > duration) && i < maxIterations) { //Apply to whole group if mode is all if (mode == IteratorEffectMode.All) { effectFunction(group, cancellationToken, waitTime); await Task.Delay(waitTime.Value.Value, cancellationToken).ConfigureAwait(false); i++; continue; } if (reverse) { lights.Reverse(); } if (mode == IteratorEffectMode.Random) { lights = lights.OrderBy(x => Guid.NewGuid()).ToList(); } foreach (var light in lights.Skip(reverse ? 1 : 0)) { if (!cancellationToken.IsCancellationRequested) { effectFunction(new List <EntertainmentLight>() { light }, cancellationToken, waitTime); if (mode != IteratorEffectMode.AllIndividual) { await Task.Delay(waitTime.Value.Value, cancellationToken).ConfigureAwait(false); } } } if (mode == IteratorEffectMode.AllIndividual) { await Task.Delay(waitTime.Value.Value, cancellationToken).ConfigureAwait(false); } keepGoing = mode == IteratorEffectMode.Single ? false : true; if (mode == IteratorEffectMode.Bounce) { reverse = true; } i++; } }
public override bool Place(Point origin, StructureMap structures) { Ref <int> count1 = new Ref <int>(0); Ref <int> count2 = new Ref <int>(0); Ref <int> count3 = new Ref <int>(0); Ref <int> count4 = new Ref <int>(0); WorldUtils.Gen(origin, new Shapes.Circle(15), Actions.Chain(new Actions.Scanner(count3), new Modifiers.IsSolid(), new Actions.Scanner(count1), new Modifiers.OnlyTiles(new ushort[2] { 60, 59 }), new Actions.Scanner(count2), new Modifiers.OnlyTiles(new ushort[1] { 60 }), new Actions.Scanner(count4))); if (((((float)count2.Value) / ((float)count1.Value)) < 0.75) || count4.Value < 2 || !structures.CanPlace(new Microsoft.Xna.Framework.Rectangle(origin.X - 50, origin.Y - 50, 100, 100), 0)) { return(false); } int num1 = origin.X; int num2 = origin.Y; int num3 = 150; int index1 = num1 - num3; while (index1 < num1 + num3) { if (index1 > 0 && index1 <= Main.maxTilesX - 1) { int index2 = num2 - num3; while (index2 < num2 + num3) { if (index2 > 0 && index2 <= Main.maxTilesY - 1 && (Main.tile[index1, index2].active() && Main.tile[index1, index2].type == 226 || (Main.tile[index1, index2].wall == 87 || Main.tile[index1, index2].wall == 3) || Main.tile[index1, index2].wall == 83)) { return(false); } index2 += 10; } } index1 += 10; } int num4 = origin.X; int num5 = origin.Y; int index3 = 0; int[] numArray1 = new int[10]; int[] numArray2 = new int[10]; Vector2 vector2_1 = new Vector2((float)num4, (float)num5); Vector2 vector2_2 = vector2_1; int num6 = WorldGen.genRand.Next(2, 5); for (int index2 = 0; index2 < num6; ++index2) { int num7 = WorldGen.genRand.Next(2, 5); for (int index4 = 0; index4 < num7; ++index4) { vector2_2 = WorldGen.Hive((int)vector2_1.X, (int)vector2_1.Y); } vector2_1 = vector2_2; numArray1[index3] = (int)vector2_1.X; numArray2[index3] = (int)vector2_1.Y; ++index3; } for (int index2 = 0; index2 < index3; ++index2) { int index4 = numArray1[index2]; int index5 = numArray2[index2]; bool flag = false; int num7 = 1; if (WorldGen.genRand.Next(2) == 0) { num7 = -1; } while (index4 > 10 && index4 < Main.maxTilesX - 10 && (index5 > 10 && index5 < Main.maxTilesY - 10) && (!Main.tile[index4, index5].active() || !Main.tile[index4, index5 + 1].active() || (!Main.tile[index4 + 1, index5].active() || !Main.tile[index4 + 1, index5 + 1].active()))) { index4 += num7; if (Math.Abs(index4 - numArray1[index2]) > 50) { flag = true; break; } } if (!flag) { int i = index4 + num7; for (int index6 = i - 1; index6 <= i + 2; ++index6) { for (int index7 = index5 - 1; index7 <= index5 + 2; ++index7) { if (index6 < 10 || index6 > Main.maxTilesX - 10) { flag = true; } else if (Main.tile[index6, index7].active() && (int)Main.tile[index6, index7].type != 225) { flag = true; break; } } } if (!flag) { for (int index6 = i - 1; index6 <= i + 2; ++index6) { for (int index7 = index5 - 1; index7 <= index5 + 2; ++index7) { if (index6 >= i && index6 <= i + 1 && (index7 >= index5 && index7 <= index5 + 1)) { Main.tile[index6, index7].active(false); Main.tile[index6, index7].liquid = byte.MaxValue; Main.tile[index6, index7].honey(true); } else { Main.tile[index6, index7].active(true); Main.tile[index6, index7].type = (ushort)225; } } } int num8 = num7 * -1; int j = index5 + 1; int num9 = 0; while ((num9 < 4 || WorldGen.SolidTile(i, j)) && (i > 10 && i < Main.maxTilesX - 10)) { ++num9; i += num8; if (WorldGen.SolidTile(i, j)) { WorldGen.PoundTile(i, j); if (!Main.tile[i, j + 1].active()) { Main.tile[i, j + 1].active(true); Main.tile[i, j + 1].type = (ushort)225; } } } } } } WorldGen.larvaX[WorldGen.numLarva] = Utils.Clamp <int>((int)vector2_1.X, 5, Main.maxTilesX - 5); WorldGen.larvaY[WorldGen.numLarva] = Utils.Clamp <int>((int)vector2_1.Y, 5, Main.maxTilesY - 5); ++WorldGen.numLarva; int num10 = (int)vector2_1.X; int num11 = (int)vector2_1.Y; for (int index2 = num10 - 1; index2 <= num10 + 1 && (index2 > 0 && index2 < Main.maxTilesX); ++index2) { for (int index4 = num11 - 2; index4 <= num11 + 1 && (index4 > 0 && index4 < Main.maxTilesY); ++index4) { if (index4 != num11 + 1) { Main.tile[index2, index4].active(false); } else { Main.tile[index2, index4].active(true); Main.tile[index2, index4].type = (ushort)225; Main.tile[index2, index4].slope((byte)0); Main.tile[index2, index4].halfBrick(false); } } } structures.AddStructure(new Microsoft.Xna.Framework.Rectangle(origin.X - 50, origin.Y - 50, 100, 100), 5); return(true); }
private static bool isTag(Ref r) { return(isTag(r.Name)); }
public void OpenTutorial() { Ref.openTutorial = true; Ref.LoadScene(Ref.SceneType.MainMenu); }
private void deleteTrackingRef(FetchResult result, Repository db, RevWalk.RevWalk walk, RefSpec spec, Ref localRef) { string name = localRef.Name; try { TrackingRefUpdate u = new TrackingRefUpdate(db, name, spec.Source, true, ObjectId.ZeroId, "deleted"); result.Add(u); if (_transport.DryRun) { return; } u.Delete(walk); switch (u.Result) { case RefUpdate.RefUpdateResult.New: case RefUpdate.RefUpdateResult.NoChange: case RefUpdate.RefUpdateResult.FastForward: case RefUpdate.RefUpdateResult.Forced: break; default: throw new TransportException(_transport.Uri, "Cannot delete stale tracking ref " + name + ": " + u.Result.ToString()); } } catch (System.IO.IOException e) { throw new TransportException(_transport.Uri, "Cannot delete stale tracking ref " + name, e); } }
/// <summary>Resolve submodule repository URL.</summary> /// <remarks> /// Resolve submodule repository URL. /// <p> /// This handles relative URLs that are typically specified in the /// '.gitmodules' file by resolving them against the remote URL of the parent /// repository. /// <p> /// Relative URLs will be resolved against the parent repository's working /// directory if the parent repository has no configured remote URL. /// </remarks> /// <param name="parent">parent repository</param> /// <param name="url">absolute or relative URL of the submodule repository</param> /// <returns>resolved URL</returns> /// <exception cref="System.IO.IOException">System.IO.IOException</exception> public static string GetSubmoduleRemoteUrl(Repository parent, string url) { if (!url.StartsWith("./") && !url.StartsWith("../")) { return(url); } string remoteName = null; // Look up remote URL associated wit HEAD ref Ref @ref = parent.GetRef(Constants.HEAD); if (@ref != null) { if (@ref.IsSymbolic()) { @ref = @ref.GetLeaf(); } remoteName = parent.GetConfig().GetString(ConfigConstants.CONFIG_BRANCH_SECTION, Repository.ShortenRefName(@ref.GetName()), ConfigConstants.CONFIG_KEY_REMOTE); } // Fall back to 'origin' if current HEAD ref has no remote URL if (remoteName == null) { remoteName = Constants.DEFAULT_REMOTE_NAME; } string remoteUrl = parent.GetConfig().GetString(ConfigConstants.CONFIG_REMOTE_SECTION , remoteName, ConfigConstants.CONFIG_KEY_URL); // Fall back to parent repository's working directory if no remote URL if (remoteUrl == null) { remoteUrl = parent.WorkTree.GetAbsolutePath(); // Normalize slashes to '/' if ('\\' == FilePath.separatorChar) { remoteUrl = remoteUrl.Replace('\\', '/'); } } // Remove trailing '/' if (remoteUrl[remoteUrl.Length - 1] == '/') { remoteUrl = Sharpen.Runtime.Substring(remoteUrl, 0, remoteUrl.Length - 1); } char separator = '/'; string submoduleUrl = url; while (submoduleUrl.Length > 0) { if (submoduleUrl.StartsWith("./")) { submoduleUrl = Sharpen.Runtime.Substring(submoduleUrl, 2); } else { if (submoduleUrl.StartsWith("../")) { int lastSeparator = remoteUrl.LastIndexOf('/'); if (lastSeparator < 1) { lastSeparator = remoteUrl.LastIndexOf(':'); separator = ':'; } if (lastSeparator < 1) { throw new IOException(MessageFormat.Format(JGitText.Get().submoduleParentRemoteUrlInvalid , remoteUrl)); } remoteUrl = Sharpen.Runtime.Substring(remoteUrl, 0, lastSeparator); submoduleUrl = Sharpen.Runtime.Substring(submoduleUrl, 3); } else { break; } } } return(remoteUrl + separator + submoduleUrl); }
/// <summary> /// Drop the configured entry from the stash reflog and return value of the /// stash reference after the drop occurs /// </summary> /// <returns>commit id of stash reference or null if no more stashed changes</returns> /// <exception cref="NGit.Api.Errors.GitAPIException">NGit.Api.Errors.GitAPIException /// </exception> public override ObjectId Call() { CheckCallable(); Ref stashRef = GetRef(); if (stashRef == null) { return(null); } if (all) { DeleteRef(stashRef); return(null); } ReflogReader reader = new ReflogReader(repo, Constants.R_STASH); IList <ReflogEntry> entries; try { entries = reader.GetReverseEntries(); } catch (IOException e) { throw new JGitInternalException(JGitText.Get().stashDropFailed, e); } if (stashRefEntry >= entries.Count) { throw new JGitInternalException(JGitText.Get().stashDropMissingReflog); } if (entries.Count == 1) { DeleteRef(stashRef); return(null); } ReflogWriter writer = new ReflogWriter(repo, true); string stashLockRef = ReflogWriter.RefLockFor(Constants.R_STASH); FilePath stashLockFile = writer.LogFor(stashLockRef); FilePath stashFile = writer.LogFor(Constants.R_STASH); if (stashLockFile.Exists()) { throw new JGitInternalException(JGitText.Get().stashDropFailed, new LockFailedException (stashFile)); } entries.Remove(stashRefEntry); ObjectId entryId = ObjectId.ZeroId; try { for (int i = entries.Count - 1; i >= 0; i--) { ReflogEntry entry = entries[i]; writer.Log(stashLockRef, entryId, entry.GetNewId(), entry.GetWho(), entry.GetComment ()); entryId = entry.GetNewId(); } if (!stashLockFile.RenameTo(stashFile)) { FileUtils.Delete(stashFile); if (!stashLockFile.RenameTo(stashFile)) { throw new JGitInternalException(MessageFormat.Format(JGitText.Get().couldNotWriteFile , stashLockFile.GetPath(), stashFile.GetPath())); } } } catch (IOException e) { throw new JGitInternalException(JGitText.Get().stashDropFailed, e); } UpdateRef(stashRef, entryId); try { Ref newStashRef = repo.GetRef(Constants.R_STASH); return(newStashRef != null?newStashRef.GetObjectId() : null); } catch (IOException e) { throw new InvalidRefNameException(MessageFormat.Format(JGitText.Get().cannotRead, Constants.R_STASH), e); } }
protected void AddToTable(XmlSchemaObjectTable table, XmlQualifiedName qname, XmlSchemaObject item) { if (qname.Name.Length == 0) { return; } XmlSchemaObject existingObject = (XmlSchemaObject)table[qname]; if (existingObject != null) { if (existingObject == item) { return; } string code = Res.Sch_DupGlobalElement; if (item is XmlSchemaAttributeGroup) { string ns = nameTable.Add(qname.Namespace); if (Ref.Equal(ns, NsXml)) //Check for xml namespace { XmlSchema schemaForXmlNS = Preprocessor.GetBuildInSchema(); XmlSchemaObject builtInAttributeGroup = schemaForXmlNS.AttributeGroups[qname]; if ((object)existingObject == (object)builtInAttributeGroup) { table.Insert(qname, item); return; } else if ((object)item == (object)builtInAttributeGroup) //trying to overwrite customer's component with built-in, ignore built-in { return; } } else if (IsValidAttributeGroupRedefine(existingObject, item, table)) //check for redefines { return; } code = Res.Sch_DupAttributeGroup; } else if (item is XmlSchemaAttribute) { string ns = nameTable.Add(qname.Namespace); if (Ref.Equal(ns, NsXml)) { XmlSchema schemaForXmlNS = Preprocessor.GetBuildInSchema(); XmlSchemaObject builtInAttribute = schemaForXmlNS.Attributes[qname]; if ((object)existingObject == (object)builtInAttribute) //replace built-in one { table.Insert(qname, item); return; } else if ((object)item == (object)builtInAttribute) //trying to overwrite customer's component with built-in, ignore built-in { return; } } code = Res.Sch_DupGlobalAttribute; } else if (item is XmlSchemaSimpleType) { if (IsValidTypeRedefine(existingObject, item, table)) { return; } code = Res.Sch_DupSimpleType; } else if (item is XmlSchemaComplexType) { if (IsValidTypeRedefine(existingObject, item, table)) { return; } code = Res.Sch_DupComplexType; } else if (item is XmlSchemaGroup) { if (IsValidGroupRedefine(existingObject, item, table)) //check for redefines { return; } code = Res.Sch_DupGroup; } else if (item is XmlSchemaNotation) { code = Res.Sch_DupNotation; } else if (item is XmlSchemaIdentityConstraint) { code = Res.Sch_DupIdentityConstraint; } else { Debug.Assert(item is XmlSchemaElement); } SendValidationEvent(code, qname.ToString(), item); } else { table.Add(qname, item); } }
public Alert(Ref TextBox txt1) { InitializeComponent(); txt = txt1; }
private void load_Reparacion() { if (cargar_informacion_sql) { // Mysql sql = new Mysql(); /* * string str = @" * select * r.id, * r.codigo, * operador.nombre, * operador.apellido, * r.modelo, * r.lote, * r.panel, * causa.causa, * defecto.defecto, * r.defecto as referencia, * accion.accion, * origen.origen, * r.correctiva, * r.estado, * turno.turno, * DATE_FORMAT(r.fecha, '%d/%m/%Y') as fecha, * DATE_FORMAT(r.hora, '%H:%i') as hora , * sector.sector * * ,( * select COUNT(*) from reparacion rc * where * rc.estado = 'R' * and rc.codigo = r.codigo * group by rc.codigo * ) AS reparaciones * * from * area area * ,operador operador * ,turno turno * ,accion accion * ,sector sector * ,origen origen * ,defecto defecto * ,causa causa * ,reparacion r * * where * r.id_area = area.id * and r.id_operador = operador.id * and r.id_turno = turno.id * and r.id_accion = accion.id * and r.id_sector = sector.id * and r.id_origen = origen.id * and r.id_defecto = defecto.id * and r.id_causa = causa.id * * and r.id_sector = '" + Operador.sector_id + @"' * and r.codigo = '" + codigo + @"' * and r.id = '" + rp.id + @"' * * group by r.codigo order by r.id desc * limit 1 * "; * * DataTable dt = sql.Select(str); */ Filtros.codigo = codigo; DataTable dt = Reparacion.Get(); if (dt.Rows.Count > 0) { DataRow r = dt.Rows[0]; inCodigo.Text = r["codigo"].ToString(); comboModelo.SelectedIndex = comboModelo.FindStringExact(r["modelo"].ToString()); comboLote.SelectedIndex = comboLote.FindStringExact(r["lote"].ToString()); comboPanel.SelectedIndex = comboPanel.FindStringExact(r["panel"].ToString()); inAccion.Text = r["correctiva"].ToString(); if (!reingresar) { string[] referencias = r["referencia"].ToString().Split(','); foreach (string Ref in referencias) { string add = Ref.Trim(); if (add != "") { if (ReferenciaExistente(add)) { dataReferencias.Rows.Add("", add.ToUpper()); } else { MessageBox.Show("Referencia no localizada en ingenieria: " + add); } } } comboDefecto.SelectedIndex = comboDefecto.FindStringExact(r["defecto"].ToString()); comboCausa.SelectedIndex = comboCausa.FindStringExact(r["causa"].ToString()); comboAccion.SelectedIndex = comboAccion.FindStringExact(r["accion"].ToString()); comboOrigen.SelectedIndex = comboOrigen.FindStringExact(r["origen"].ToString()); } else { inAccion.Text = ""; } string historial = r["reparaciones"].ToString(); int his = 0; if (historial != "") { his = int.Parse(historial); } rp.reparaciones = his; } // Ejecuto la carga solo una vez. cargar_informacion_sql = false; } }
public override bool Place(Point origin, StructureMap structures) { Ref <int> @ref = new Ref <int>(0); Ref <int> ref2 = new Ref <int>(0); WorldUtils.Gen(origin, new Shapes.Circle(10), Actions.Chain(new Actions.Scanner(ref2), new Modifiers.IsSolid(), new Actions.Scanner(@ref))); if (@ref.Value < ref2.Value - 5) { return(false); } int num = GenBase._random.Next(6, 10); int num2 = GenBase._random.Next(5); if (!structures.CanPlace(new Rectangle(origin.X - num, origin.Y - num, num * 2, num * 2))) { return(false); } ushort type = (byte)(196 + WorldGen.genRand.Next(4)); for (int i = origin.X - num; i <= origin.X + num; i++) { for (int j = origin.Y - num; j <= origin.Y + num; j++) { if (Main.tile[i, j].active()) { int type2 = Main.tile[i, j].type; if (type2 == 53 || type2 == 396 || type2 == 397 || type2 == 404) { type = 187; } if (type2 == 161 || type2 == 147) { type = 40; } if (type2 == 60) { type = (byte)(204 + WorldGen.genRand.Next(4)); } if (type2 == 367) { type = 178; } if (type2 == 368) { type = 180; } } } } ShapeData data = new ShapeData(); WorldUtils.Gen(origin, new Shapes.Slime(num), Actions.Chain(new Modifiers.Blotches(num2, num2, num2, 1).Output(data), new Modifiers.Offset(0, -2), new Modifiers.OnlyTiles(53), new Actions.SetTile(397, setSelfFrames: true), new Modifiers.OnlyWalls(default(ushort)), new Actions.PlaceWall(type))); WorldUtils.Gen(origin, new ModShapes.All(data), Actions.Chain(new Actions.ClearTile(), new Actions.SetLiquid(0, 0), new Actions.SetFrames(frameNeighbors: true), new Modifiers.OnlyWalls(default(ushort)), new Actions.PlaceWall(type))); if (!WorldUtils.Find(origin, Searches.Chain(new Searches.Down(10), new Conditions.IsSolid()), out var result)) { return(false); } int num3 = result.Y - 1; bool flag = GenBase._random.Next() % 2 == 0; if (GenBase._random.Next() % 10 != 0) { int num4 = GenBase._random.Next(1, 4); int num5 = (flag ? 4 : (-(num >> 1))); for (int k = 0; k < num4; k++) { int num6 = GenBase._random.Next(1, 3); for (int l = 0; l < num6; l++) { WorldGen.PlaceTile(origin.X + num5 - k, num3 - l, 332, mute: true); } } } int num7 = (num - 3) * ((!flag) ? 1 : (-1)); if (GenBase._random.Next() % 10 != 0) { WorldGen.PlaceTile(origin.X + num7, num3, 186); } if (GenBase._random.Next() % 10 != 0) { WorldGen.PlaceTile(origin.X, num3, 215, mute: true); if (GenBase._tiles[origin.X, num3].active() && GenBase._tiles[origin.X, num3].type == 215) { GenBase._tiles[origin.X, num3].frameY += 36; GenBase._tiles[origin.X - 1, num3].frameY += 36; GenBase._tiles[origin.X + 1, num3].frameY += 36; GenBase._tiles[origin.X, num3 - 1].frameY += 36; GenBase._tiles[origin.X - 1, num3 - 1].frameY += 36; GenBase._tiles[origin.X + 1, num3 - 1].frameY += 36; } } structures.AddProtectedStructure(new Rectangle(origin.X - num, origin.Y - num, num * 2, num * 2), 4); return(true); }
public override void Load() { if (!Main.dedServ) { HairGFX.LoadHairGFX(this); WishMenuGFX.LoadWishGFX(this); SteamHelper.Initialize(); #region HotKeys characterMenuKey = RegisterHotKey("Character Menu", "K"); energyChargeKey = RegisterHotKey("Energy Charge", "C"); speedToggleKey = RegisterHotKey("Speed Toggle", "Z"); transformDownKey = RegisterHotKey("Transform Down", "V"); transformUpKey = RegisterHotKey("Transform Up", "X"); flightToggleKey = RegisterHotKey("Flight Toggle", "Q"); instantTransmission = RegisterHotKey("Instant Transmission", "I"); techniqueMenuKey = RegisterHotKey("Technique Menu", "N"); #endregion kiBar = new KiBar(); kiBar.Activate(); kiBarInterface = new UserInterface(); kiBarInterface.SetState(kiBar); kiBarInterface = new UserInterface(); kiBarInterface.SetState(kiBar); kiBar.Visible = true; overloadBar = new OverloadBar(); overloadBar.Activate(); overloadBarInterface = new UserInterface(); overloadBarInterface.SetState(overloadBar); dbtMenu = new DBTMenu(); dbtMenu.Activate(); characterTransformationsMenu = new CharacterTransformationsMenu(this); characterTransformationsMenu.Activate(); characterMenuInterface = new UserInterface(); characterMenuInterface.SetState(characterTransformationsMenu); techniqueMenu = new TechniqueMenu(this); techniqueMenu.Activate(); techniqueMenuInterface = new UserInterface(); techniqueMenuInterface.SetState(techniqueMenu); wishMenu = new WishMenu(); wishMenu.Activate(); wishMenuInterface = new UserInterface(); wishMenuInterface.SetState(wishMenu); hairMenu = new HairMenu(); hairMenu.Activate(); hairMenuInterface = new UserInterface(); hairMenuInterface.SetState(hairMenu); namekBookUI = new NamekianBookUI(); namekBookUI.Activate(); namekBookInterface = new UserInterface(); namekBookInterface.SetState(namekBookUI); Ref <Effect> screenRef = new Ref <Effect>(GetEffect("Effects/ShockwaveEffect")); Filters.Scene["Shockwave"] = new Filter(new ScreenShaderData(screenRef, "Shockwave"), EffectPriority.VeryHigh); Filters.Scene["Shockwave"].Load(); circle = new CircleShader(new Ref <Effect>(GetEffect("Effects/CircleShader")), "Pass1"); AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/MusicBoxes/BirthOfAGod"), ModContent.ItemType <AngelStaffBoxItem>(), ModContent.TileType <AngelStaffBoxTile>()); AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/MusicBoxes/HeadChala"), ModContent.ItemType <OneStarBoxItem>(), ModContent.TileType <OneStarBoxTile>()); AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/MusicBoxes/Budokai2"), ModContent.ItemType <TwoStarBoxItem>(), ModContent.TileType <TwoStarBoxTile>()); AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/MusicBoxes/Budokai3"), ModContent.ItemType <ThreeStarBoxItem>(), ModContent.TileType <ThreeStarBoxTile>()); AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/MusicBoxes/SSJ3Song"), ModContent.ItemType <FourStarBoxItem>(), ModContent.TileType <FourStarBoxTile>()); AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/MusicBoxes/Challenge"), ModContent.ItemType <FiveStarBoxItem>(), ModContent.TileType <FiveStarBoxTile>()); AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/MusicBoxes/LostCourage"), ModContent.ItemType <SixStarBoxItem>(), ModContent.TileType <SixStarBoxTile>()); AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/MusicBoxes/VegetaSSJ"), ModContent.ItemType <SevenStarBoxItem>(), ModContent.TileType <SevenStarBoxTile>()); AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/MusicBoxes/XV2Villain"), ModContent.ItemType <DragonBallsBoxItem>(), ModContent.TileType <DragonBallsBoxTile>()); AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/MusicBoxes/BurstLimit"), ModContent.ItemType <BabidisMagicBoxItem>(), ModContent.TileType <BabidisMagicBoxTile>()); AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/TheBarrenWastelands"), ModContent.ItemType <WastelandsBoxItem>(), ModContent.TileType <WastelandsBoxTile>()); AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/TheUnexpectedArrival"), ModContent.ItemType <FFBoxItem>(), ModContent.TileType <FFBoxTile>()); } }
public override IEnumerable <CilMatcher> GetMatchers() { var tokenType = Method.ReturnType; var nextConditionType = GetNextConditionType(); var matcher = new CilMatcher(); var contextType = GetContextType(); //var context = CilContextRef.ByType(contextType); if (tokenType != typeof(void)) { var outcome = CilSymbolRef.Create(tokenType, LiteralText); matcher.MainOutcome = outcome; matcher.AllOutcomes.Add(outcome); } matcher.DefiningMethod = Method; matcher.Disambiguation = Disambiguation; if (LiteralText == null) { matcher.Pattern = ScanPattern.CreateRegular(Pattern, RegexPattern); } else { matcher.Pattern = ScanPattern.CreateLiteral(LiteralText); } var parameters = Method.GetParameters().ToList(); matcher.Context = GetContext(); matcher.NextConditionType = nextConditionType; matcher.ActionBuilder = code => { ParameterInfo nextModeParameter; if (parameters.Count != 0 && parameters.Last().IsOut) { nextModeParameter = parameters.Last(); parameters.RemoveAt(parameters.Count - 1); } else { nextModeParameter = null; } if (parameters.Count == 0) { } else if (parameters.Count == 1 && parameters[0].ParameterType == typeof(string)) { code.LdMatcherTokenString(); } else if (parameters.Count == 3 && parameters[0].ParameterType == typeof(char[]) && parameters[1].ParameterType == typeof(int) && parameters[2].ParameterType == typeof(int)) { code .LdMatcherBuffer() .LdMatcherStartIndex() .LdMatcherLength(); } else { throw new InvalidOperationException( "Unsupported match-method signature: " + string.Join(", ", parameters.Select(p => p.ParameterType.Name))); } Ref <Locals> nextModeVar = null; if (nextModeParameter != null) { code .Emit(il => { nextModeVar = il.Locals.Generate().GetRef(); return(il .Local(nextModeVar.Def, il.Types.Object) .Ldloca(nextModeVar)); }); } code.Emit(il => il.Call(Method)); if (nextModeParameter != null) { code .Emit(il => il.Ldloc(nextModeVar)) .ChangeCondition(nextConditionType); } if (Method.ReturnType == typeof(void)) { code.SkipAction(); } else { if (Method.ReturnType.IsValueType) { code.Emit(il => il.Box(il.Types.Import(Method.ReturnType))); } code .ReturnFromAction() ; } return(code); }; return(new[] { matcher }); }
private void CompileConditions(Compiler compiler) { NavigatorInput input = compiler.Input; bool when = false; bool otherwise = false; do { switch (input.NodeType) { case XPathNodeType.Element: compiler.PushNamespaceScope(); string nspace = input.NamespaceURI; string name = input.LocalName; if (Ref.Equal(nspace, input.Atoms.UriXsl)) { IfAction?action = null; if (Ref.Equal(name, input.Atoms.When)) { if (otherwise) { throw XsltException.Create(SR.Xslt_WhenAfterOtherwise); } action = compiler.CreateIfAction(IfAction.ConditionType.ConditionWhen); when = true; } else if (Ref.Equal(name, input.Atoms.Otherwise)) { if (otherwise) { throw XsltException.Create(SR.Xslt_DupOtherwise); } action = compiler.CreateIfAction(IfAction.ConditionType.ConditionOtherwise); otherwise = true; } else { throw compiler.UnexpectedKeyword(); } AddAction(action); } else { throw compiler.UnexpectedKeyword(); } compiler.PopScope(); break; case XPathNodeType.Comment: case XPathNodeType.ProcessingInstruction: case XPathNodeType.Whitespace: case XPathNodeType.SignificantWhitespace: break; default: throw XsltException.Create(SR.Xslt_InvalidContents, "choose"); } }while (compiler.Advance()); if (!when) { throw XsltException.Create(SR.Xslt_NoWhen); } }
public Scanner(Ref <int> count) { _count = count; }
public void BuildNew() { Ref.LoadScene(Ref.SceneType.Build); GameSaving.GameSave.UpdatePersistantSave(); }