예제 #1
0
        /// <summary>初始化</summary>
        protected void Init(int capacity = 0)
        {
            if (Keys != null)
            {
                Keys.Clear();
            }
            else
            {
            }

            if (Values != null)
            {
                Values.Clear();
            }
            else
            {
            }

            if (capacity != 0)
            {
                Keys   = new List <K>(capacity);
                Values = new List <V>(capacity);
            }
            else
            {
                Keys   = new List <K>();
                Values = new List <V>();
            }
            Capacity = Keys.Capacity;
        }
예제 #2
0
        /// <summary>
        /// Shows the menu items and return the user's choice
        /// </summary>
        /// <returns>string with the user selected option</returns>
        public string Show()
        {
            var tokenizer = new AcceleratorCharTokenizer();
            int i         = 0;

            Keys.Clear();
            foreach (var item in Items)
            {
                if (Options.NumerationStyle == MenuNumeration.AcceleratorKey)
                {
                    Console.WriteLine(tokenizer.Parse(item));
                    Keys.Add(GetAcceleratorChar(item).ToString());
                }
                else
                {
                    (string key, IEnumerable <ColorToken> tokens) = ComposeMenuItem(i, item);
                    Console.WriteLine(tokens);
                    Keys.Add(key);
                }
                i++;
            }
            Console.Ask(BuildMessage());
            string value = Console.ReadLine <string>(x => IsDefaultValue(x) || Keys.Contains(x));

            return(IsDefaultValue(value) ? Options.DefaultItem : value);
        }
예제 #3
0
파일: Call.cs 프로젝트: JocysCom/PassGen
        private void loadContents(string contents, bool append)
        {
            Call call = (Call)JocysCom.ClassLibrary.Runtime.Serializer.DeserializeFromJson(contents, typeof(Call));

            CallName        = call.CallName;
            CallDescription = call.CallDescription;
            FontName        = call.FontName;
            Data            = call.Data;
            if (Keys == null)
            {
                Keys = new Dictionary <uint, CallItem>();
            }
            if (!append)
            {
                Keys.Clear();
            }
            foreach (string[] item in Data)
            {
                uint code = 0;
                if (item[0].StartsWith("0x", StringComparison.OrdinalIgnoreCase))
                {
                    code = uint.Parse(item[0].Substring(2), System.Globalization.NumberStyles.HexNumber);
                }
                else
                {
                    code = uint.Parse(item[0]);
                }
                Keys.Remove(code);
                CallItem ci = new CallItem();
                ci.Code        = code;
                ci.Name        = item[1];
                ci.Description = item[2];
                Keys[code]     = ci;
            }
        }
예제 #4
0
 public CacheIndex Clear()
 {
     OldKeys = Keys.ToList();
     Keys.Clear();
     UpdatedAt = DateTimeOffset.UtcNow;
     return(this);
 }
예제 #5
0
    private void ChangedActiveScene(Scene current, Scene next)
    {
        var nextScene = next.name;

        if (lastScene == "Sun" && nextScene == "Warp")
        {
            RegionName = null;
            Deaths.Clear();
            Keys.Clear();
        }
        else if (lastScene != "Sun" && nextScene == "Warp")
        {
            if (!string.IsNullOrEmpty(RegionName))
            {
                Log[RegionName] = new JObject()
                {
                    { "duration", RegionDuration },
                    { "deathCount", Deaths.Count },
                    { "deaths", new JArray(Deaths) },
                    { "keyCount", Keys.Count },
                    { "keys", new JArray(Keys) }
                }
            }
            ;
        }
        else if (lastScene == "Warp" && nextScene != "Sun")
        {
            RegionDuration = (int)RegionManager.Main.TimeElapsed;
            RegionName     = nextScene;
        }
        lastScene = nextScene;
    }
        public override async Task <bool> NextResultAsync(CancellationToken cancellationToken)
        {
            var result = await Reader.NextResultAsync(cancellationToken);

            Keys.Clear();
            return(result);
        }
        public override bool NextResult()
        {
            var result = Reader.NextResult();

            Keys.Clear();
            return(result);
        }
예제 #8
0
 /// <summary>
 /// 根据children生成key
 /// </summary>
 public void BuildKeys()
 {
     Keys.Clear();
     for (int i = 1; i < Children.Count; i++)
     {
         Keys.Add(Children[i].GetMinKey());
     }
 }
예제 #9
0
 public void Clear()
 {
     head  = null;
     tail  = null;
     Count = 0;
     Keys.Clear();
     Values.Clear();
     Notify?.Invoke($"Dictionary cleared");
 }
예제 #10
0
 public void Clear(bool isTrimExcess = false)
 {
     Values.Clear();
     Keys.Clear();
     if (isTrimExcess)
     {
         TrimExcess();
     }
 }
 public void FromDictionary(IDictionary <TKey, TValue> parent)
 {
     Keys.Clear();
     Values.Clear();
     foreach (TKey key in parent.Keys)
     {
         Keys.Add(key);
         Values.Add(parent[key]);
     }
 }
예제 #12
0
 public IObservable <CacheIndex> Clear(IBlobCache cache, string indexKey, DateTimeOffset?absoluteExpiration = null)
 {
     OldKeys = Keys.ToList();
     Keys.Clear();
     UpdatedAt = DateTimeOffset.UtcNow;
     return(cache
            .InvalidateObject <CacheIndex>(indexKey)
            .SelectMany(_ => cache.InsertObject(indexKey, this, absoluteExpiration))
            .Select(_ => this));
 }
예제 #13
0
 public void Clear()
 {
     mDic.Clear();
     if (mIsHasKeys)
     {
         Keys.Clear();
     }
     if (mIsHasValues)
     {
         Values.Clear();
     }
 }
 public Task Update()
 {
     _uiContext.Send(async x =>
     {
         Keys.Clear();
         foreach (var key in await ApiKeyController.LoadKeysAsync())
         {
             Keys.Add(key);
         }
     }, null);
     return(Task.CompletedTask);
 }
        private bool HandleStructureDeletedEvent(ReplayedEvent replayedEvent)
        {
            if (!(replayedEvent.DomainEvent is StructureDeleted deleted) || deleted.Identifier != Identifier)
            {
                return(false);
            }

            Created = false;
            Deleted = true;
            Keys.Clear();
            Variables.Clear();
            return(true);
        }
예제 #16
0
 /// <summary>
 /// Removes all keys from this keyring.
 /// </summary>
 public void Clear()
 {
     if (ReadOnly)
     {
         throw new Exception("Keyring is read-only.");
     }
     Keys.Clear();
     KeyNames.Clear();
     GC.Collect();
     if (KeyringChanged != null)
     {
         KeyringChanged();
     }
 }
예제 #17
0
    public void Awake()
    {
        Application.targetFrameRate = 60;
        Main = this;

        Log = new JObject()
        {
            { "id", Guid.NewGuid().ToString() }
        };
        lastScene  = null;
        RegionName = null;
        Deaths.Clear();
        Keys.Clear();

        SceneManager.activeSceneChanged += ChangedActiveScene;
    }
예제 #18
0
        public async Task RefreshKeysAsync()
        {
            Keys.Clear();

            EndPoint[] endpoints = Mx.GetEndPoints();

            foreach (EndPoint ep in endpoints)
            {
                IServer server = Mx.GetServer(ep);
                IEnumerable <RedisKey> keys = server.Keys();
                foreach (RedisKey key in keys)
                {
                    RedisType keyType = await Db.KeyTypeAsync(key);

                    Keys.Add(new RedisKeyViewModel(key.ToString(), keyType));
                }
            }
        }
예제 #19
0
 /// <summary>
 /// Reload our list of valid keys. This could come from a file or a database
 /// </summary>
 protected void ReloadKeys()
 {
     Keys.Clear();
     Keys.AddRange(
         new string[]
     {
         "ececb2bf-3309-4b71-a723-45a582b92af1",
         "6fd721a7-4377-4645-9386-6faff7e27787",
         "17f8fb35-1547-4584-851c-6884ef89c1fe",
         "f642489d-602e-4bb1-a898-baf6a160c999",
         "7728c5cd-5c69-449b-b4f7-573e0b66ffd9",
         "2f1cc887-6f3a-44b8-ba00-a67aebb80c50",
         "517a864d-d202-4b8f-ba4c-ce093dde08a2",
         "e0eea45d-ae30-4226-8d9f-efc2fbc7f164",
         "d0b2b8a7-645e-44f8-be05-05ea08c89869",
         "3c83d890-2cd4-414f-9f72-30ef3fce99f0"
     });
     Keys.Sort();
 }
예제 #20
0
        /// <summary>
        /// The virtual dispose method that allows
        /// classes inherithed from this one to dispose their resources.
        /// </summary>
        /// <param name="disposing"></param>
        protected virtual void Dispose(bool disposing)
        {
            if (!disposed)
            {
                if (disposing)
                {
                    // Dispose managed resources here.
                    Header = null;

                    GameStats = null;
                    Chunks.Clear();
                    Keys.Clear();
                    Chunks = null;
                    Keys   = null;
                }

                // Dispose unmanaged resources here.
            }

            disposed = true;
        }
예제 #21
0
        public bool LoadAncientDB()
        {
            lock (this)
            {
                Keys.Clear();
                // Checking if db isn't broken
                Core.RecoverFile(datafile_raw, pChannel.Name);
                if (!File.Exists(datafile_raw))
                {
                    return(false);
                }

                string[] db = File.ReadAllLines(datafile_raw);
                foreach (string x in db)
                {
                    if (x.Contains(Configuration.System.Separator))
                    {
                        string[] info  = x.Split(Char.Parse(Configuration.System.Separator));
                        string   type  = info[2];
                        string   value = info[1];
                        string   name  = info[0];
                        if (type == "key")
                        {
                            string Locked = info[3];
                            Keys.Add(new InfobotKey(name.Replace("<separator>", "|"), value.Replace("<separator>", "|"), "", Locked, NA.ToBinary().ToString(),
                                                    NA.ToBinary().ToString()));
                        }
                        else
                        {
                            Aliases.Add(new InfobotAlias(name.Replace("<separator>", "|"), value.Replace("<separator>", "|")));
                        }
                    }
                }
            }
            return(true);
        }
예제 #22
0
 public void Dispose()
 {
     Keys.Clear();
 }
예제 #23
0
파일: Keylist.cs 프로젝트: Andrius-B/Tabler
 /// <summary>
 /// Wipes the KeyList to a blank state.
 /// </summary>
 new public void Clear()
 {
     Keys.Clear();
     HeadersDict.Clear();
     Rows = new RowEnum(this);
 }
예제 #24
0
 public void Clear()
 {
     dictionary.Clear();
     Keys.Clear();
     Values.Clear();
 }
예제 #25
0
        private void GetTableInfo()
        {
            DescribeTableRequest req = new DescribeTableRequest
            {
                TableName = TableName
            };

            req.BeforeRequestEvent += new RequestEventHandler(this.UserAgentRequestEventHandlerSync);
            DescribeTableResult info = this.DDBClient.DescribeTable(req);

            if (info.Table == null)
            {
                throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, "Table name {0} does not exist", TableName));
            }

            Keys.Clear();
            HashKeys.Clear();
            RangeKeys.Clear();
            TableDescription table = info.Table;

            foreach (var key in table.KeySchema)
            {
                string keyName = key.AttributeName;
                AttributeDefinition attributeDefinition = table.AttributeDefinitions
                                                          .FirstOrDefault(a => string.Equals(a.AttributeName, keyName, StringComparison.Ordinal));
                if (attributeDefinition == null)
                {
                    throw new InvalidOperationException("No attribute definition found for key " + key.AttributeName);
                }
                KeyDescription keyDescription = new KeyDescription
                {
                    IsHash = string.Equals(key.KeyType, "HASH", StringComparison.OrdinalIgnoreCase),
                    Type   = GetType(attributeDefinition.AttributeType)
                };
                if (keyDescription.IsHash)
                {
                    HashKeys.Add(keyName);
                }
                else
                {
                    RangeKeys.Add(keyName);
                }
                Keys[keyName] = keyDescription;
            }

            LocalSecondaryIndexes.Clear();
            LocalSecondaryIndexNames.Clear();
            if (table.LocalSecondaryIndexes != null)
            {
                foreach (var index in table.LocalSecondaryIndexes)
                {
                    LocalSecondaryIndexes[index.IndexName] = index;
                    LocalSecondaryIndexNames.Add(index.IndexName);
                }
            }

            GlobalSecondaryIndexes.Clear();
            GlobalSecondaryIndexNames.Clear();
            if (table.GlobalSecondaryIndexes != null)
            {
                foreach (var index in table.GlobalSecondaryIndexes)
                {
                    GlobalSecondaryIndexes[index.IndexName] = index;
                    GlobalSecondaryIndexNames.Add(index.IndexName);
                }
            }

            Attributes.Clear();
            foreach (var attribute in table.AttributeDefinitions)
            {
                Attributes.Add(attribute);
            }

            keyNames = Keys.Keys.ToArray();
        }
예제 #26
0
 public new void Clear()
 {
     Keys.Clear();
     data.Clear();
 }
예제 #27
0
 public void Clear()
 {
     Keys.Clear();
     Values.Clear();
 }
예제 #28
0
 public void Clear()
 {
     Presets.Clear();
     Keys.Clear();
     presets.Clear();
 }
예제 #29
0
 public void Clear()
 {
     keyIndex = 0;
     Keys.Clear();
 }
예제 #30
0
 public void Clear()
 {
     Count = 0;
     Keys.Clear();
     Values.Clear();
 }