Esempio n. 1
0
 public IOPointer(IOFieldAttribute field, int rank, int index, V2Int pos, string name)
 {
     Field = field;
     Rank  = rank;
     Index = index;
     Pos   = pos;
     Name  = name;
 }
Esempio n. 2
0
        } // todo: highlight elements of free array with color (chessboard-ish order)    with   ((index.X + index.Y) & 1) ? color1 : color2

        void WriteValue(object value, V2Int pos)
        {
            for (int i = Values.Count; i <= pos.X; i++)
            {
                Values.Add(new List <object>());
            }
            for (int i = Values[pos.X].Count; i < pos.Y; i++)
            {
                Values[pos.X].Add(null);
            }
            Values[pos.X].Add(serializer.Serialize(value));
        }
Esempio n. 3
0
        internal void CacheMeta(Type type)
        {
            Initialized = true;
            Type        = type;
            var allFields = type.GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance)
                            .Select(field => field.GetIOAttribute()).Where(x => x != null).ToArray();

            if (allFields.Length == 0)
            {
                throw new Exception($"Class {type.Name} has no IOField's!");
            }
            Sheets  = allFields.Where(x => !string.IsNullOrEmpty(x.Meta?.SheetName ?? string.Empty)).ToArray();
            Regions = allFields.Where(x => x.Meta is null || string.IsNullOrEmpty(x.Meta.SheetName)).OrderBy(x => x.SortOrder).ToArray();
            Size    = V2Int.Zero;
            foreach (var f in Regions)
            {
                f.PosInType = new V2Int(Size.X, 0);
                Size        = new V2Int(Size.X + f.Sizes[0].X, Math.Max(Size.Y, f.Sizes[0].Y));
            }
        }
Esempio n. 4
0
 internal IEnumerable <IOPointer> GetPointers(V2Int pos) => Regions.Select((f, i) => new IOPointer(f, 0, i, pos.Add(f.PosInType), ""));
Esempio n. 5
0
 static string WriteA1(V2Int a1) => (a1.X >= 999 ? string.Empty : new string(ToLetters(a1.X).ToArray()))
 + (a1.Y >= 999 ? string.Empty : (a1.Y + 1).ToString());
Esempio n. 6
0
 V2Int NextRankSize(V2Int v2, int rank) => v2.Scale((rank & 1) > 0 ? MaxCount(rank) : 1, (rank & 1) > 0 ? 1 : MaxCount(rank));