コード例 #1
0
ファイル: KeyValueList.cs プロジェクト: firefishes/ShipDock
        /// <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
ファイル: StatsManager.cs プロジェクト: alkaitagi/Sungazer
    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;
    }
コード例 #6
0
        public override async Task <bool> NextResultAsync(CancellationToken cancellationToken)
        {
            var result = await Reader.NextResultAsync(cancellationToken);

            Keys.Clear();
            return(result);
        }
コード例 #7
0
        public override bool NextResult()
        {
            var result = Reader.NextResult();

            Keys.Clear();
            return(result);
        }
コード例 #8
0
ファイル: BNode.cs プロジェクト: wuran-github/algo_study
 /// <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
ファイル: KeyValueList.cs プロジェクト: lfzl000/SimpleFSM
 public void Clear(bool isTrimExcess = false)
 {
     Values.Clear();
     Keys.Clear();
     if (isTrimExcess)
     {
         TrimExcess();
     }
 }
コード例 #11
0
 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();
     }
 }
コード例 #14
0
 public Task Update()
 {
     _uiContext.Send(async x =>
     {
         Keys.Clear();
         foreach (var key in await ApiKeyController.LoadKeysAsync())
         {
             Keys.Add(key);
         }
     }, null);
     return(Task.CompletedTask);
 }
コード例 #15
0
        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
ファイル: StatsManager.cs プロジェクト: alkaitagi/Sungazer
    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();
 }