public static bool FormatIdentifier(Identifier iden, out string result, ValueFormat nameformat, ValueFormat varformat) { if (!String.IsNullOrEmpty(iden.Name)) { StringBuilder builder=new StringBuilder(128); builder.Append(iden.GetNameFormatted(nameformat)); foreach (ValueVariable val in iden.Children) { builder.Append(' '); builder.Append(val.GetValueFormatted(varformat)); //builder.Append(String.Format("<{0}>", val.TypeName)); } result=builder.ToString(); return true; } else { result=String.Empty; // clear the result string } return false; }
public override Variable Clone() { Identifier clone=new Identifier(_name); foreach (Variable v in _children) clone.Add(v.Clone()); return clone; }
private Scene CreateScene(Identifier iden, World world, Scene parent) { int i = 0; Scene scene = new Scene(world, iden.GetInt(i++).Value, parent); scene.MiniMapVisibility = 2; if (!SNODatabase.Instance.IsOfGroup(scene.SceneSNO, SNOGroup.Scenes)) { Logger.Warn("SceneSNO {0} doesn't appear to be a valid SNO ID..", scene.SceneSNO); } if (parent != null) parent.Subscenes.Add(scene); scene.SceneSpec = new SceneSpecification { CellZ = iden.GetInt(i++).Value, Cell = new IVector2D { X = iden.GetInt(i++).Value, Y = iden.GetInt(i++).Value }, arSnoLevelAreas = new int[4] { iden.GetInt(i++).Value, iden.GetInt(i++).Value, iden.GetInt(i++).Value, iden.GetInt(i++).Value }, snoPrevWorld = iden.GetInt(i++).Value, Field4 = iden.GetInt(i++).Value, snoPrevLevelArea = iden.GetInt(i++).Value, snoNextWorld = iden.GetInt(i++).Value, Field7 = iden.GetInt(i++).Value, snoNextLevelArea = iden.GetInt(i++).Value, snoMusic = iden.GetInt(i++).Value, snoCombatMusic = iden.GetInt(i++).Value, snoAmbient = iden.GetInt(i++).Value, snoReverb = iden.GetInt(i++).Value, snoWeather = iden.GetInt(i++).Value, snoPresetWorld = iden.GetInt(i++).Value, Field15 = iden.GetInt(i++).Value, Field16 = iden.GetInt(i++).Value, Field17 = iden.GetInt(i++).Value, Field18 = iden.GetInt(i++).Value, tCachedValues = new SceneCachedValues { Field0 = iden.GetInt(i++).Value, Field1 = iden.GetInt(i++).Value, Field2 = iden.GetInt(i++).Value, Field3 = new AABB { Min = new Vector3D { X = iden.GetFloat(i++).Value, Y = iden.GetFloat(i++).Value, Z = iden.GetFloat(i++).Value }, Max = new Vector3D { X = iden.GetFloat(i++).Value, Y = iden.GetFloat(i++).Value, Z = iden.GetFloat(i++).Value }, }, Field4 = new AABB { Min = new Vector3D { X = iden.GetFloat(i++).Value, Y = iden.GetFloat(i++).Value, Z = iden.GetFloat(i++).Value }, Max = new Vector3D { X = iden.GetFloat(i++).Value, Y = iden.GetFloat(i++).Value, Z = iden.GetFloat(i++).Value }, }, Field5 = new int[4] { iden.GetInt(i++).Value, iden.GetInt(i++).Value, iden.GetInt(i++).Value, iden.GetInt(i++).Value }, Field6 = iden.GetInt(i++).Value }, }; scene.RotationAxis.X = iden.GetFloat(i++).Value; scene.RotationAxis.Y = iden.GetFloat(i++).Value; scene.RotationAxis.Z = iden.GetFloat(i++).Value; scene.RotationAmount = iden.GetFloat(i++).Value; scene.Position.X = iden.GetFloat(i++).Value; scene.Position.Y = iden.GetFloat(i++).Value; scene.Position.Z = iden.GetFloat(i++).Value; scene.SceneGroupSNO = iden.GetInt(i++).Value; //scene.AppliedLabels = new int[0]; return scene; }
void __add(CollectionVariable collection, List<_IndexVariablePair> pairs, string name, ref int addcount) { if (pairs.Count>0) { bool first=true; Identifier iden=new Identifier(name, collection); foreach (_IndexVariablePair pair in pairs) { collection.Children.RemoveAt(pair.i); if (first) { collection.Children.Insert(pair.i, iden); first=false; } iden.Add(pair.variable); // re-own to the new identifier } addcount++; } }
public bool ValidateIdentifier(Identifier identifier) { if (identifier!=null) { // TODO: _layout==null ? if (!(identifier.Count>_layout.Length && (_infinitism==VariableType.NONE)) && !(identifier.Count<_layout.Length) && _checkIden(_iden, identifier.Name, _casesens)) { // Compare defined variables in the identifier int i=0; foreach (Variable variable in identifier.Children.GetRange(0, _layout.Length)) { if ((_layout[i]&variable.Type)==0) return false; i++; } // Check infinitism if (identifier.Count>_layout.Length && _infinitism!=VariableType.NONE) { i=_layout.Length; foreach (Variable variable in identifier.Children.GetRange(_layout.Length, identifier.Count-_layout.Length)) { if (!_checkVariable(_infinitism, variable)) return false; } i++; } return true; // Identifier passed all tests } } return false; }
public bool Validate(Identifier identifier) { return ValidateIdentifier(identifier); }
void Reset(bool iden, bool val) { _varname=String.Empty; _equals=false; if (val) _currentvalue=null; if (iden) _currentiden=null; }
void MakeIdentifier(Token<ScriptToken> token, bool resetiden, bool resetvalue, bool force) { if (_currentiden==null || force) { _currentiden=new Identifier(_varname); AddVariableAndReset(_currentnode, _currentiden, resetiden, resetvalue); } }
protected override void Clean() { base.Clean(); _varname=String.Empty; _equals=false; _currentvalue=null; _currentiden=null; }
public static bool FormatIdentifier(Identifier iden, out string result, ValueFormat nameformat) { return FormatIdentifier(iden, out result, nameformat, ValueFormat.ALL_DEFAULT); }
public static string FormatIdentifier(Identifier iden, ValueFormat nameformat, ValueFormat varformat) { string formatted; FormatIdentifier(iden, out formatted, nameformat, varformat); return formatted; }
public static string FormatIdentifier(Identifier iden, ValueFormat nameformat) { return FormatIdentifier(iden, nameformat, ValueFormat.ALL_DEFAULT); }
public static string FormatIdentifier(Identifier iden) { return FormatIdentifier(iden, ValueFormat.NAME_DEFAULT, ValueFormat.ALL_DEFAULT); }