コード例 #1
0
        public static void Init(String version, String optionsFilename,
                                ILogManager defaultLog, IShutdown shutdown,
                                ICallbackManager callbacks,
                                IServerManager servers,
                                MeasureStringControl measure,
                                String defaultRegistryLoc)
        {
            _versionString = version;

            _defaultLogManager = defaultLog;
            _shutdownMethod    = shutdown;
            _callbackManager   = callbacks;
            _serverManager     = servers;
            _measureControl    = measure;

            _applianceFrameMap = new Hashtable();

            _store = new PUC.PersistentData.DataStore(optionsFilename);

            if (!_store.IsKeyValid(Globals.REGISTRY_FILE_ATTR))
            {
                _store.Set(Globals.REGISTRY_FILE_ATTR, defaultRegistryLoc);
                _store.Set(Globals.RECENT_SERVER_ATTR, 10);
                _store.Set(Globals.RECENT_COUNT_ATTR, 0);
            }
        }
コード例 #2
0
        public static void Main(string[] args)
        {
            Console.WriteLine("Starting Persistent DataStore test...");

            DataStore store = new DataStore(DataStore.PUC_DATA_FILE);

            store.Set("registry-file", "c:\\My Documents\\research\\controller\\puc\\registry\\pocketpc.xml");
            store.Set("recent-servers-count", 2);
            store.Set("random-double", 4.56);

            store.Close();

            store = new DataStore(DataStore.PUC_DATA_FILE);

            Console.WriteLine("registry-file: {0}", store.GetStringData("registry-file"));
            Console.WriteLine("random-double: {0}", store.GetDoubleData("random-double"));

            store.Set("random-double", 7.56);

            Console.WriteLine("random-double: {0}", store.GetDoubleData("random-double"));

            store.Close();

            store = new DataStore(DataStore.PUC_DATA_FILE);

            Console.WriteLine("registry-file: {0}", store.GetStringData("registry-file"));
            Console.WriteLine("random-double: {0}", store.GetDoubleData("random-double"));
        }