public static void CleanUpVariableReferences(Variable deletedUserVariable, Sprite selectedSprite) { foreach (var script in selectedSprite.Scripts) { foreach (var brick in script.Bricks) { if (brick is VariableBrick) { var setVariableBrick = brick as VariableBrick; if (ReferenceEquals(setVariableBrick.Variable, deletedUserVariable)) setVariableBrick.Variable = null; } } } }
public static bool VariableNameExistsCheckSelf(Program project, Sprite sprite, Variable self, string variableName) { return project.GlobalVariables.Concat<Variable>(sprite.LocalVariables) .Any(variable => !ReferenceEquals(variable, self) && variable.Name == variableName); }
public static bool IsVariableLocal(Program project, Variable variable) { return variable is LocalVariable; }
protected bool TestEquals(Variable other) { return string.Equals(_name, other._name); }