// Start is called before the first frame update public static void Filter() { ListKey keyShape = JsonUtility.FromJson <ListKey>(ReadFile.Ins.JsonDataKey.text); //ListKey keyShape = SavingDataWithJson.LoadData<ListKey>("Key.fun"); List <string> keyGame = new List <string>(); keyGame = keyShape.Key; for (int i = 0; i < keyGame.Count; i++) { DirectKey.Add(keyGame[i], i); } keyGame = keyShape.Key; Debug.Log("Has KEY : " + keyShape.Key.Count); //for (int i = 0; i < keyShape.Key.Count; i++) //{ // // Debug.Log(" KEY : " + keyShape.Key[i]+ CtrlData.AllShape.Count); //} //for (int i = 0; i < CtrlData.AllShape.Count; i++) //{ // InforForSplitShape SplitShape = new InforForSplitShape(); // string key = CtrlData.AllShape[i].ToString(); // for (int j = 0; j < keyShape.Key.Count; j++) // { // // Debug.Log("Key : "+ keyShape.Key[j] +" "+ key); // //if (keyShape.Key[j].Contains(key)) // //{ // // Debug.Log("Co Key : " + keyShape.Key[j] + " " + key); // //} // //else // //{ // // Debug.Log("NO Key:" + keyShape.Key[j] + " " + key); // //} // if (keyShape.Key[j].Contains(key)) // { // // Debug.Log("Push Key : " + keyShape.Key[j]); // SplitShape.InforShape.Add(keyShape.Key[j], InforShapeSplit.InforShape[keyShape.Key[j]]); // SplitShape.List_Point.Add(keyShape.Key[j], InforShapeSplit.List_Point[keyShape.Key[j]]); // } // else // { // // Debug.Log("Khong Push Key : " + keyShape.Key[j] + " " + key); // } // } // Directory.Add(CtrlData.AllShape[i], SplitShape); //} }
public override int GetHashCode() { int hash = 1; if (ListKey.Length != 0) { hash ^= ListKey.GetHashCode(); } if (Metadata.Length != 0) { hash ^= Metadata.GetHashCode(); } return(hash); }
public void CommandListKeyWithTwoKey() { string keyName = "KeyOther"; createRSAKey(); CreateKey createKey = new CreateKey(); createKey.setCommand(START_OF_COMMAND_CREATE + keyName + END_OF_COMMAND); Assert.AreEqual(true, createKey.verifyCommand()); Assert.AreEqual(KEY_CREATION_MESSAGE + keyName, createKey.action()); ListKey listKey = new ListKey(); listKey.setCommand("RSA LIST"); Assert.AreEqual(true, listKey.verifyCommand()); Assert.AreEqual("\nKeys: " + "\n" + KEY_NAME + "\n" + keyName, listKey.action()); }
public override string ToLC(bool printDefaultParams = false) { /* * KEYCHAIN SUCCESS OR * STRINGKEY @myVariable Contains "abc" * DICTKEY @data.COOKIES HasKey "my-cookie" * KEYCHAIN FAIL AND * LISTKEY @myList Contains "item" * FLOATKEY 1 GreaterThan 2 */ using var writer = new LoliCodeWriter(base.ToLC(printDefaultParams)); // Write all the keychains foreach (var keychain in Keychains) { writer .AppendToken("KEYCHAIN", 2) .AppendToken(keychain.ResultStatus) .AppendLine(keychain.Mode.ToString()); foreach (var key in keychain.Keys) { (string keyName, string comparison) = key switch { BoolKey x => ("BOOLKEY", x.Comparison.ToString()), StringKey x => ("STRINGKEY", x.Comparison.ToString()), IntKey x => ("INTKEY", x.Comparison.ToString()), FloatKey x => ("FLOATKEY", x.Comparison.ToString()), DictionaryKey x => ("DICTKEY", x.Comparison.ToString()), ListKey x => ("LISTKEY", x.Comparison.ToString()), _ => throw new Exception("Unknown key type") }; writer .AppendToken(keyName, 4) .AppendToken(LoliCodeWriter.GetSettingValue(key.Left)) .AppendToken(comparison) .AppendLine(LoliCodeWriter.GetSettingValue(key.Right)); } } return(writer.ToString()); }
public override bool Equals(object obj) { if (obj == null) { return(false); } ListKey key2 = (ListKey)obj; if (_bytes.Length != key2._bytes.Length) { return(false); } for (int i = 0; i < _bytes.Length; i++) { if (_bytes[i] != key2._bytes[i]) { return(false); } } return(true); }
public ISourceList <TType> GetList <TType>(int key = 0) where TType : IEntity { CheckDisposed(); var listKey = new ListKey(key, typeof(TType)); while (true) { if (_lists.TryGetValue(listKey, out var target)) { return((ISourceList <TType>)target); } var list = new SourceList <TType>(); if (_lists.TryAdd(listKey, list)) { return(list); } list.Dispose(); } }
public IEnumerator Start_1(List <DataGameShape> DataShape, List <DataGamePositon> DataShapePositon) { Dictionary <string, List <int[, ]> > DirectoryGame1 = new Dictionary <string, List <int[, ]> >(); for (int i = 0; i < DataShape.Count; i++) { Debug.Log("Loading"); // Debug.Log("DATA : " + DataShape[i].StringMatrix.Count); DirectoryGame1.Add(DataShape[i].key, DataShape[i].GetListMatrix()); yield return(new WaitForSeconds(0.1f)); } InforShapeSplit.InforShape = DirectoryGame1; Dictionary <string, List <Vector2> > DirectoryGame2 = new Dictionary <string, List <Vector2> >(); for (int i = 0; i < DataShapePositon.Count; i++) { DirectoryGame2.Add(DataShapePositon[i].key, DataShapePositon[i].Matrix); Debug.Log("Loading"); yield return(new WaitForSeconds(0.1f)); } InforShapeSplit.List_Point = DirectoryGame2; ListKey keyShape = JsonUtility.FromJson <ListKey>(ReadFile.Ins.JsonDataKey.text); //ListKey keyShape = SavingDataWithJson.LoadData<ListKey>("Key.fun"); List <string> keyGame = new List <string>(); keyGame = keyShape.Key; Debug.Log("Has KEY : " + keyShape.Key.Count); for (int i = 0; i < keyShape.Key.Count; i++) { // Debug.Log(" KEY : " + keyShape.Key[i]+ CtrlData.AllShape.Count); } for (int i = 0; i < CtrlData.AllShape.Count; i++) { List <string> keyremove = new List <string>(); InforForSplitShape SplitShape = new InforForSplitShape(); string key = CtrlData.AllShape[i].ToString(); for (int j = 0; j < keyShape.Key.Count; j++) { // Debug.Log("Key : "+ keyShape.Key[j] +" "+ key); //if (keyShape.Key[j].Contains(key)) //{ // Debug.Log("Co Key : " + keyShape.Key[j] + " " + key); //} //else //{ // Debug.Log("NO Key:" + keyShape.Key[j] + " " + key); //} if (keyShape.Key[j].Contains(key)) { keyremove.Add(keyShape.Key[j]); // Debug.Log("Push Key : " + keyShape.Key[j]); SplitShape.InforShape.Add(keyShape.Key[j], InforShapeSplit.InforShape[keyShape.Key[j]]); SplitShape.List_Point.Add(keyShape.Key[j], InforShapeSplit.List_Point[keyShape.Key[j]]); Debug.Log("Loading"); yield return(new WaitForSeconds(0.2f)); } else { // Debug.Log("Khong Push Key : " + keyShape.Key[j] + " " + key); } } for (int r = 0; r < keyremove.Count; r++) { keyShape.Key.Remove(keyremove[r]); } InforShapeSplit.Directory.Add(CtrlData.AllShape[i], SplitShape); } CompleteCode = true; }
public IEnumerator LoadFile() { string s = textAssetData.text; StringReader strReader = new StringReader(s); while (true) { string line = strReader.ReadLine(); if (line != null) { if (!line.StartsWith("TypeShape") && line != "") { Format(line); } yield return(new WaitForSeconds(0)); } else { break; } } ListKey lKey = new ListKey(); lKey.Key = InforShapeSplit.ListKey; // SavingDataWithJson.SaveData<ListKey>(lKey, "Key.fun"); string jsonKey = JsonUtility.ToJson(lKey); WriteStringKey(jsonKey); // Debug.Log("Key khoi tao : " +SavingDataWithJson.LoadData<ListKey>("Key.fun").Key.Count); Dictionary <string, List <int[, ]> > SInforShape = InforShapeSplit.InforShape; Dictionary <string, List <Vector2> > SListShape = InforShapeSplit.List_Point; List <DataGameShape> DataShape = DirctortToList(SInforShape, InforShapeSplit.ListKey); List <DataGamePositon> DataShapePositon = DirctortToListPositopn(SListShape, InforShapeSplit.ListKey); SavaDataGame save = new SavaDataGame(DataShape, DataShapePositon); string json = JsonUtility.ToJson(save); Debug.Log(json); SaveJson(json); // SavingDataWithJson.SaveData(save,"Dataa.fun"); // InforShapeSplit.Filter(); Debug.Log("Get Data"); CompleteCode = true; //Debug.Log("Get Data" + a.shape.Count); //for(int i = 0; i < a.shape.Count; i++) //{ // Debug.Log((a.shape[i].key)+" "+ a.shape[i].GetListMatrix().Count); //} //Debug.Log("Get Data" + a.shape.Count); }
public List <string> GetList(ListKey key) { return(_liststDict[key]); }