Exemplo n.º 1
0
        static UOFLegends()
        {
            CMOptions = new UOFLegendsOptions();

            ObjectStateTypes = typeof(LegendState).GetConstructableChildren();

            ObjectStates = new LegendState[ObjectStateTypes.Length];

            ExportQueue = new ConcurrentDictionary <string, ConcurrentStack <QueuedData> >();

            UpdateTimes = new Queue <TimeSpan>(10);
        }
Exemplo n.º 2
0
        private static void Enqueue <T>(T obj)
        {
            if (!_Updating)
            {
                OnAbort();
                return;
            }

            IDictionary <string, SimpleType> data = null;
            LegendState state = ObjectStates.FirstOrDefault(s => s.Compile(obj, out data));

            if (state != null && data != null && data.Count > 0)
            {
                ExportQueue.GetOrAdd(state.TableName, new ConcurrentStack <QueuedData>()).Push(
                    new QueuedData
                {
                    RawData = data,
                    SqlData = data.Select(kd => new MySQLData(kd.Key, SQL.Encode(kd.Value, true))).ToArray()
                });
            }
        }