Example #1
0
        internal void CheckPreRegisterInterval(IHiveData hiveData)
        {
            if (hiveData.IsManaged == false)
            {
                throw new ArgumentException("hiveData.IsManaged == false");
            }

            lock (LockObj)
            {
                CheckNotCanceled();

                if (RegisteredHiveData.ContainsKey(hiveData.DataName))
                {
                    throw new ApplicationException($"The hive name \"{hiveData.DataName}\" is already registered on the same hive.");
                }
            }
        }
Example #2
0
        internal void UnregisterInternal(IHiveData hiveData)
        {
            // 最後に Sync を実行する
            HiveSyncFlags flags = HiveSyncFlags.LoadFromFile;

            if (hiveData.IsReadOnly == false)
            {
                flags |= HiveSyncFlags.SaveToFile;
            }

            // エラーを無視
            hiveData.SyncWithStorageAsync(flags, true)._GetResult();

            lock (LockObj)
            {
                RegisteredHiveData.Remove(hiveData.DataName);
            }
        }
Example #3
0
        internal void RegisterInternal(IHiveData hiveData)
        {
            if (hiveData.IsManaged == false)
            {
                throw new ArgumentException("hiveData.IsManaged == false");
            }

            lock (LockObj)
            {
                CheckNotCanceled();

                if (RegisteredHiveData.TryAdd(hiveData.DataName, hiveData) == false)
                {
                    throw new ApplicationException($"The hive name \"{hiveData.DataName}\" is already registered on the same hive.");
                }
            }

            this.EventWhenFirstHiveDataRegistered.Set(true);
        }