コード例 #1
0
        private int readGroup(string[] lines, List <DICT> list)
        {
            int group_start = find_line(lines, "\"GROUP\",\"DICT\"");

            if (group_start == NOT_FOUND)
            {
                return(-1);
            }

            string[] header = lines[group_start + 1].QuoteSplit();
            string[] units  = lines[group_start + 2].QuoteSplit();
            string[] type   = lines[group_start + 3].QuoteSplit();

            for (int i = group_start + 4; i < lines.Count(); i++)
            {
                string line = lines[i];
                if (line.Length == 0)
                {
                    return(i);
                }
                string[] values = line.QuoteSplit();
                DICT     p      = new DICT();
                setValues(header, values, p);
                list.Add(p);
            }
            return(0);
        }
コード例 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="dimensions">Canvas dimentions.</param>
        /// <param name="items"></param>
        /// <returns></returns>
        public DictionaryList <int, long> CalculateRows(FloatPoint dimensions, DICT <long, FloatRect> items)
        {
            this.Dimensions = dimensions;
            int   rowIndex      = 0;
            float rowTotalWidth = 0;
            DictionaryList <int, long> newRow = new DictionaryList <int, long>();
            List <long> newRowIndex           = new List <long>();

            foreach (long l in items.Keys)
            {
                if (HasColumnWidth(items[l], rowTotalWidth, dimensions.X))
                {
                    newRowIndex.Add(l);
                    rowTotalWidth += items[l].Width;
                }
                else
                {
                    newRow.Add(rowIndex++, new List <long>(newRowIndex.ToArray()));
                    newRowIndex.Clear();
                    rowTotalWidth = 0;
                    newRowIndex.Add(l);
                    rowTotalWidth += items[l].Width;
                }
            }
            newRow.Add(rowIndex++, new List <long>(newRowIndex.ToArray()));
            rowsAndColumns = newRow;
            Rows           = GetRowHeights(items).ToArray();   // we could have gotten these?
            return(newRow);
        }
コード例 #3
0
 public IEnumerable <FloatPoint> GetRowHeights(DICT <long, FloatRect> basis)
 {
     foreach (int i in rowsAndColumns.KeyArray)
     {
         yield return
             (GetRowMaxHeight(basis, rowsAndColumns[i].ToArray()));
     }
 }
コード例 #4
0
        static DICT <long, FloatRect> Imagine(long max, int rMin, int rMax)
        {
            DICT <long, FloatRect> items = new DICT <long, FloatRect>();

            for (long l = 0; l < max; l++)
            {
                items.Add(l, new FloatRect(0, 0, R.Next(rMin, rMax), 24));                                   //
            }
            return(items);
        }
コード例 #5
0
        public bool Contains(string Key)
        {
            bool returned = false;
            DICT <string, object> prams = Params;

            returned = prams.ContainsKey(Key);
            prams.Clear();
            prams = null;
            return(returned);
        }
コード例 #6
0
        public FloatPoint GetRowMaxHeight(DICT <long, FloatRect> basis, params long[] items)
        {
            FloatPoint point = new FloatPoint(0, 0);

            foreach (long i in items)
            {
                point.Y = GetBigger(basis[i].X, (float)basis[i].Size.Y, point.Y);
            }
            return(point);
        }
コード例 #7
0
        public DICT <long, FloatRect> Imagine(ImageLoader il, FloatPoint TSiz)
        {
            IsFileMode = true; ilx = il;
            DICT <long, FloatRect> items = new DICT <long, FloatRect>();
            long incr = 0;

            foreach (FileInfo fi in il.Files)
            {
                items.Add(incr++, new FloatRect(0, 0, TSiz.X, TSiz.Y));
            }
            return(data = items);
        }
コード例 #8
0
        /// <summary>
        /// <para>• Lists the fields in a set of “DbDataRecords[]”</para>
        /// </summary>
        /// <param name="rez"></param>
        /// <returns></returns>
        static public DICT <string, string> GetFieldTypes(DbDataRecord[] rez)
        {
            DICT <string, string> names = new DICT <string, string>();

            if (rez.Length > 0)
            {
                for (int i = 0; i < rez[0].FieldCount; i++)
                {
                    names.Add(rez[0].GetName(i), string.Concat(rez[0].GetFieldType(i).Name, ", ", rez[0].GetDataTypeName(i)));
                }
            }
            return(names);
        }
コード例 #9
0
        public string FilterString(string value)
        {
            string output = string.Copy(value);
            DICT <string, string> values = KeyIndex;

            foreach (string key in fieldnames.Split(','))
            {
                output = output.Replace(string.Format("$({0})", key), values[key]);
            }
            values.Clear();
            values = null;
            return(output);
        }
コード例 #10
0
        /// <summary>
        /// Generates the field's dictionary and performs string-replace on string-input
        /// against each key-value-pair of the field values stored to dictionary (memory).
        /// </summary>
        /// <param name="Input"></param>
        /// <param name="action">never seems to be used.</param>
        /// <returns></returns>
        public string Replace(string Input, Action <DICT <string, object> > action = null)
        {
            Transform = action; Transform = null;       // < this is never used.
            DICT <string, object> prams = Params;
            string rv = string.Copy(Input);

            foreach (KeyValuePair <string, object> entry in prams)
            {
                rv = rv
                     .Replace(string.Format("$({0})", entry.Key), string.Format("{0}", entry.Value))
                     .Replace(string.Format("$({0})", entry.Key.CapitolN()), string.Format("{0}", entry.Value.ToStringCapitolize()));
            }
            return(rv);
        }
コード例 #11
0
        private int setValues(string[] header, string[] values, DICT p)
        {
            try {
                for (int i = 0; i < header.Count(); i++)
                {
                    if (header[i] == "DICT_DESC")
                    {
                        p.DICT_DESC = values[i];
                    }
                    if (header[i] == "DICT_DTYP")
                    {
                        p.DICT_DTYP = values[i];
                    }
                    if (header[i] == "DICT_HDNG")
                    {
                        p.DICT_HDNG = values[i];
                    }
                    if (header[i] == "DICT_PGRP")
                    {
                        p.DICT_PGRP = values[i];
                    }
                    if (header[i] == "DICT_REM")
                    {
                        p.DICT_REM = values[i];
                    }
                    if (header[i] == "DICT_STAT")
                    {
                        p.DICT_STAT = values[i];
                    }
                    if (header[i] == "DICT_TYPE")
                    {
                        p.DICT_TYPE = values[i];
                    }
                    if (header[i] == "DICT_UNIT")
                    {
                        p.DICT_UNIT = values[i];
                    }
                    if (header[i] == "FILE_FSET")
                    {
                        p.FILE_FSET = values[i];
                    }
                }
            } catch {
                return(-1);
            }

            return(0);
        }
コード例 #12
0
        public void setDict(DICT _dict)
        {
            if (_dict == dict)
            {
                return;
            }

            dict = _dict;

            NativePlugin.set_dictionary((int)dict);

            ARMarker[] markers = GameObject.FindObjectsOfType <ARMarker>();

            foreach (ARMarker marker in markers)
            {
                marker.DictionaryChanged();
            }
        }
コード例 #13
0
ファイル: ShaderMod.cs プロジェクト: salvadj1/RustSource
    public bool Replace(Replacement replacement, string incoming, ref string outgoing)
    {
        DICT dict = this[replacement];

        return((dict != null) && dict.Replace(replacement, incoming, ref outgoing));
    }
コード例 #14
0
ファイル: AGSService.cs プロジェクト: simon969/ge_repository
        public async Task <int> AddLibraryAGSData(IAGSGroupTables tables, Guid?LibraryAGSDataId)
        {
            if (LibraryAGSDataId != null)
            {
                await SetLibraryAGSData(LibraryAGSDataId.Value);
            }

            if (_library == null)
            {
                return(-1);
            }

            AGS404GroupTables ags404_lib = (AGS404GroupTables)_library;
            AGS404GroupTables _tables    = (AGS404GroupTables)tables;

            // ABBR

            if (_tables.ABBR != null)
            {
                foreach (ABBR abbr in _tables.ABBR.values)
                {
                    ABBR abbr_lib = ags404_lib.ABBR.values.Find(e => e.ABBR_CODE == abbr.ABBR_CODE &&
                                                                e.ABBR_HDNG == abbr.ABBR_HDNG);
                    if (abbr_lib != null)
                    {
                        abbr.ABBR_DESC = abbr_lib.ABBR_DESC;
                        abbr.ABBR_REM  = abbr_lib.ABBR_REM;
                    }
                }
            }

            if (_tables.UNIT != null)
            {
                foreach (UNIT unit in _tables.UNIT.values)
                {
                    UNIT unit_lib = ags404_lib.UNIT.values.Find(e => e.UNIT_UNIT == unit.UNIT_UNIT);
                    if (unit_lib != null)
                    {
                        unit.UNIT_DESC = unit_lib.UNIT_DESC;
                        unit.UNIT_REM  = unit_lib.UNIT_REM;
                    }
                }
            }

            if (_tables.TYPE != null)
            {
                foreach (TYPE type in _tables.TYPE.values)
                {
                    TYPE type_lib = ags404_lib.TYPE.values.Find(e => e.TYPE_TYPE == type.TYPE_TYPE);
                    if (type_lib != null)
                    {
                        type.TYPE_DESC = type_lib.TYPE_DESC;
                        //    type.TYPE_REM = type_lib.TYPE_REM;
                    }
                }
            }

            if (_tables.DICT != null)
            {
                foreach (DICT dict in _tables.DICT.values)
                {
                    DICT dict_lib = ags404_lib.DICT.values.Find(e => e.DICT_HDNG == dict.DICT_HDNG &&
                                                                e.DICT_PGRP == dict.DICT_PGRP);
                    if (dict_lib != null)
                    {
                        dict.DICT_DESC = dict_lib.DICT_DESC;
                        dict.DICT_DTYP = dict_lib.DICT_DTYP;
                        dict.DICT_EXMP = dict_lib.DICT_EXMP;
                        dict.DICT_REM  = dict_lib.DICT_REM;
                    }
                }
            }

            return(1);
        }
コード例 #15
0
 public Scaffold(FloatPoint dimensions, DICT <long, FloatRect> newItems)
 {
     CalculateRows(dimensions, newItems);
 }
コード例 #16
0
 public DictionaryList <int, long> CalculateRows(DICT <long, FloatRect> items)
 {
     return(CalculateRows(this.Dimensions, items));
 }