public ColorVariable(string name, ColorSetCollection colors, string color) : this(name, colors[color]) { if (this.ColorSet == null) { throw new InvalidVariableException(name, color); } }
public ModifyVariableForm(ColorSetCollection colors, Tuple<string, string> varDesc = null) { InitializeComponent(); this.Colors = colors; this.VarName = ""; this.ColorSetName = Colors.ElementAt(0).Name; if (varDesc != null) { this.VarName = varDesc.Item1; this.ColorSetName = varDesc.Item2; } }
public ColouredPetriGraph(ColorSetCollection colors = null) : base() { if (colors == null) { this.Colors = new ColorSetCollection(); } else { this.Colors = colors; } this._currentArcFunc = ""; this._currentColorName = ""; }
public ModifyColorSetForm(ColorSetCollection colors, Tuple<string, string, string> colorSetDescription = null) { InitializeComponent(); this.Colors = colors; if (colorSetDescription == null) { this.ColorSetDescription = null;// new Tuple<string, string, string>("", ColorSet.Types.Keys.ElementAt(0), ""); this.Name = "Создание цвета"; } else { this.ColorSetDescription = new Tuple<string, string, string>(colorSetDescription.Item1, colorSetDescription.Item2, colorSetDescription.Item3); this.Name = "Редактирование цвета"; } size = this.Size; }
//public Token(string initFunc, ColorSet colorSet) //{ // string[] masks = new string[]{ // @"^\s*(?<count>\d+)`\((?<value>.+)\)\s*", // @"^\s*(?<count>\d+)`(?<value>.+)\s*", // @"^\s*(?<value>.+)\s*" // }; // Match m = null; // foreach (var mask in masks) // { // m = Regex.Match(initFunc, mask); // if (m.Success) // { // break; // } // } // if (m != null && m.Success) // { // if (String.IsNullOrEmpty(m.Groups["count"].Value)) // { // this.Count = 1; // } // else // { // this.Count = UInt32.Parse(m.Groups["count"].Value); // } // this.Value = m.Groups["value"].Value; // } // else // { // throw new InvalidTokenException(this.Value, "<?>"); // } // this.ColorSet = colorSet; //} public Token(string value, ColorSetCollection colors, string colorName) : this(value, colors[colorName]) { }
public ColorSet(string name, ColorSetType type, ColorSetCollection colors, string attrs = "") { this.Name = name; this.type = type; this.attrs = attrs; this.Collection = colors; this.ParseAttributes(); //this.Collection.AddColorSet(this); }
public ColorSet(string colorSetDescription, ColorSetCollection colors) { string[] masks = new string[] { //@"^(?<name>\w.*)\s*=\s*(?<type>\w+)$", @"^\s*(?<name>([A-Z]|[a-z])([A-Z]|[a-z]|[0-9])*)\s*=\s*(?<type>\w+)\((?<attrs>(.|\n)*)\)\s*$" }; Match m = null; foreach (var mask in masks) { m = Regex.Match(colorSetDescription, mask); if (m.Success) { break; } } if (m == null || !m.Success || !ColorSet.Types.ContainsKey(m.Groups["type"].Value)) { throw new InvalidColorSetAttributesException("NewColorSet()", colorSetDescription); } this.Name = m.Groups["name"].Value.Trim(); this.type = ColorSet.Types[m.Groups["type"].Value]; this.attrs = m.Groups["attrs"].Value; this.Collection = colors; this.ParseAttributes(); //this.Collection.AddColorSet(this); }