1 // 2 // Copyright (c) 2010-2018 Antmicro 3 // Copyright (c) 2011-2015 Realtime Embedded 4 // 5 // This file is licensed under the MIT License. 6 // Full license text is available in 'licenses/MIT.txt'. 7 // 8 using System; 9 using System.Collections.Generic; 10 using IronPython.Runtime; 11 12 namespace Antmicro.Renode.Peripherals.Python 13 { 14 public class PythonDictionarySurrogate : Dictionary<object, object> 15 { PythonDictionarySurrogate(PythonDictionary dictionary)16 public PythonDictionarySurrogate(PythonDictionary dictionary) 17 { 18 internalDictionary = new Dictionary<object, object>(dictionary); 19 } 20 Restore()21 public PythonDictionary Restore() 22 { 23 var pythonDictionary = new PythonDictionary(); 24 foreach(var item in internalDictionary) 25 { 26 pythonDictionary.Add(item); 27 } 28 return pythonDictionary; 29 } 30 31 private readonly Dictionary<object, object> internalDictionary; 32 } 33 } 34 35