private void ProcessPropertyValue(SGF_Property property) { if (PeekChar() != '[') { return; } bool isContinue = true; do { int indexPropertyValueEnd = FindNextPropertyValueEnd(); byte[] value = ReadBytes(indexPropertyValueEnd - index_ + 1); if (value.Length > 2 && value[0] == (byte)'[' && value[value.Length - 1] == (byte)']') { byte[] realValue = new byte[value.Length - 2]; Buffer.BlockCopy(value, 1, realValue, 0, realValue.Length); property.AddValue(realValue); } while (!EOF) { char ch = PeekChar(); if (IsUnusedChar(ch)) { ReadChar(); continue; } else if (ch != '[' || IsControlChar(ch)) { isContinue = false; } break; } } while (!EOF && isContinue); return; }
internal virtual void AddProperty(SGF_Property property) { if (property.Name.Length == 0) { SGFException.Throw("A Property name is NULL"); } if (properties_.ContainsKey(property.Name)) { SGFException.Throw("Attempt to add duplicate Property"); } property.Setting = rootNote_.Setting; properties_.Add(property.Name, property); }
public void SetProperty(SGF_Property_Entity_Base entity) { SGF_Property property = null; if (properties_.ContainsKey(entity.Name)) { property = properties_[entity.Name]; property.ClearAllValues(); } else { property = new SGF_Property(entity.Name); AddProperty(property); } List <byte[]> values = entity.ToPropertyValues(rootNote_.Setting); foreach (byte[] value in values) { property.AddValue(value); } }
private SGF_Node ProcessNode(SGF_Node parent, int branchNumber) { SGF_Node newNode = null; if (parent == null) { newNode = new SGF_Node_Root(); roots_.Add(newNode as SGF_Node_Root); } else { newNode = new SGF_Node(roots_[branchNumber]); parent.AddNode(newNode); } while (!EOF) { char ch = PeekChar(); if (IsControlChar(ch)) { break; } else if (IsUnusedChar(ch)) { ReadChar(); continue; } int indexPropertyValueStart = FindToPropertyValueStart(); if (indexPropertyValueStart == -1) { break; } byte[] name = ReadBytes(indexPropertyValueStart - index_); string nameString = Encoding.ASCII.GetString(name); SGF_Property propertry = new SGF_Property(nameString); ProcessPropertyValue(propertry); newNode.AddProperty(propertry); } return(newNode); }
internal void FilterProperty(SGF_Property property) { if (property.Name == "FF") { SGF_Property_FF ff = new SGF_Property_FF(); ff.BindProperty(property); FF = ff.Value.Number; } else if (property.Name == "CA") { } else if (property.Name == "AP") { } else if (property.Name == "GM") { } else if (property.Name == "ST") { } else if (property.Name == "SZ") { } }
internal override void AddProperty(SGF_Property property) { base.AddProperty(property); setting_.FilterProperty(property); }
internal void BindProperty(SGF_Property property) { OnSetValue(property.Values, property.Setting); }