Esempio n. 1
0
 private static void DeleteByTimeout()
 {
     lock (m_SyncObject)
     {
         try
         {
             var list = ObjectStorage.Find <AvrPivotGridModel>(m => m.m_RealPivotData != null && (DateTime.Now - m.LastAccessTime).TotalSeconds > WebAvrDataLifeTime);
             list.ForEach(m =>
             {
                 if (m.m_RealPivotData != null)
                 {
                     m.m_RealPivotData.Dispose();
                     m.m_RealPivotData = null;
                     if (m.ClonedPivotData != null)
                     {
                         m.ClonedPivotData.Dispose();
                         //m.ClonedPivotData = null;
                     }
                 }
             });
         }
         catch
         {
         }
     }
 }
Esempio n. 2
0
        private async void buttonCreateBucket_Click(object sender, EventArgs e)
        {
            try
            {
                buttonCreateBucket.Enabled = false;
                buttonCreateBucket.Text    = "requested...";

                ObjectStorage o = new ObjectStorage(textBoxAccessKey.Text, textBoxSecretKey.Text, textBoxObjectStorageEndPoint.Text);
                if (!await o.IsExistsBucket(textBoxBucketName.Text))
                {
                    o.CreateBucket(textBoxBucketName.Text);
                    while (!await o.IsExistsBucket(textBoxBucketName.Text))
                    {
                        Task  task = Task.Delay(1000);
                        await task;
                    }
                    MessageBox.Show("bucket created");
                }
                else
                {
                    MessageBox.Show("bucket exists");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                buttonCreateBucket.Text    = "Create Bucket";
                buttonCreateBucket.Enabled = true;
            }
        }
Esempio n. 3
0
        private AvrPivotGridModel GetModelFromSession(long layoutId = -1)
        {
            if (layoutId <= 0)
            {
                NameValueCollection nameValueCollection = HttpUtility.ParseQueryString(Request.UrlReferrer.Query);
                layoutId = Convert.ToInt64(nameValueCollection["layoutId"]);
            }
            //var model = ModelStorage.Get(Session.SessionID, layoutId, StoragePrefix, false) as AvrPivotGridModel;
            var model = ObjectStorage.Using <AvrPivotGridModel, AvrPivotGridModel>(o => o, Session.SessionID, layoutId, StoragePrefix, false);

            if (model == null)
            {
                long queryId = 0L;
                try
                {
                    AvrServiceAccessability access = AvrServiceAccessability.Check();
                    if (!access.IsOk)
                    {
                        m_ErrorMessage = access.ErrorMessage;
                        return(null);
                    }

                    model = FillData(ref queryId, layoutId);
                }
                catch (Exception ex)
                {
                    m_ErrorMessage = ex.Message;
                    return(null);
                }
                ObjectStorage.Put(Session.SessionID, queryId, layoutId, StoragePrefix, model);
            }
            LayoutPivotGridHelper.ResetDisplayTextHandler();

            return(model);
        }
Esempio n. 4
0
        private async void buttonSave_Click(object sender, EventArgs e)
        {
            dataManager.SetValue(DataManager.Category.ObjectStorage, DataManager.Key.Endpoint, textBoxObjectStorageEndPoint.Text.Trim());
            dataManager.SetValue(DataManager.Category.ObjectStorage, DataManager.Key.Bucket, textBoxBucketName.Text.Trim());
            if (dataManager.GetValue(DataManager.Category.Login, DataManager.Key.IsSaveKeyYn).Equals("Y", StringComparison.OrdinalIgnoreCase))
            {
                logClientConfig.SetValue(LogClient.Category.Api, LogClient.Key.AccessKey, textBoxAccessKey.Text.Trim());
                logClientConfig.SetValue(LogClient.Category.Api, LogClient.Key.SecretKey, textBoxSecretKey.Text.Trim());
            }
            else
            {
                logClientConfig.SetValue(LogClient.Category.Api, LogClient.Key.AccessKey, "");
                logClientConfig.SetValue(LogClient.Category.Api, LogClient.Key.SecretKey, "");
            }
            ObjectStorage o = new ObjectStorage(textBoxAccessKey.Text, textBoxSecretKey.Text, textBoxObjectStorageEndPoint.Text);

            if (!await o.IsExistsBucket(textBoxBucketName.Text.Trim()))
            {
                buttonCreateBucket.PerformClick();
            }

            dataManager.SaveUserData();
            logClientConfig.SaveLogClientData();
            logClientConfig.SetValue(LogClient.Category.Api, LogClient.Key.AccessKey, textBoxAccessKey.Text.Trim());
            logClientConfig.SetValue(LogClient.Category.Api, LogClient.Key.SecretKey, textBoxSecretKey.Text.Trim());
            Close();
        }
Esempio n. 5
0
 public void SetObjectStorage(ObjectStorage objectStorage)
 {
     this.objectStorage = objectStorage;
     Show();
     RefreshData();
     //transform.SetParent(parentCanvas, false);
 }
        public override void Awake()
        {
            var types = ObjectTypeStorage.GetTypes <BaseActor>();

            foreach (var type in types)
            {
                using (var component = ObjectStorage.Fetch(type) as BaseActorComponent)
                {
                    ActorTypes[component.ActorType] = type;
                }
            }

            this.Distributions = Game.Scene.AddComponent <NetDistributionsComponent>();
            this.Distributions.OnDisconnected += network =>
            {
                if (!NetIdActors.TryGetValue(network.Id, out Dictionary <int, BaseActorComponent> dicVal))
                {
                    return;
                }

                this.OnDisconnected?.Invoke(network);

                var acotrs = dicVal.Values.ToList();
                foreach (var acotr in acotrs)
                {
                    acotr.Dispose();
                }
            };

            this.Distributions.OnConnected += network =>
            {
                this.OnConnected?.Invoke(network);
                network.Send((ushort)MSGCommand.SyncActorInfoCmd);
            };
        }
Esempio n. 7
0
        private async void buttonBucketTest_Click(object sender, EventArgs e)
        {
            if (textBoxAccessKey.Text.Trim().Length == 0 || textBoxSecretKey.Text.Trim().Length == 0)
            {
                MessageBox.Show("please check accessKey and secretKey");
            }
            else
            {
                LogClient.Config.Instance.SetValue(Category.Api, Key.AccessKey, textBoxAccessKey.Text);
                LogClient.Config.Instance.SetValue(Category.Api, Key.SecretKey, textBoxSecretKey.Text);
                LogClient.Config.Instance.SaveLogClientData();
            }

            try
            {
                ObjectStorage o = new ObjectStorage(textBoxAccessKey.Text, textBoxSecretKey.Text, textBoxObjectStorageEndPoint.Text);
                if (!await o.IsExistsBucket(textBoxBucketName.Text))
                {
                    MessageBox.Show("bucket does not exists");
                }
                else
                {
                    MessageBox.Show("OK");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 8
0
        private async Task PurgeObjectStorage(string path, int purgeLimitSec)
        {
            ObjectStorage o = new ObjectStorage(
                LogClient.Config.Instance.GetValue(LogClient.Category.Api, LogClient.Key.AccessKey)
                , LogClient.Config.Instance.GetValue(LogClient.Category.Api, LogClient.Key.SecretKey)
                , config.GetValue(Category.Backup, Key.ObjectStorageServiceUrl)
                );

            var task  = o.List(bucketName, path);
            var files = await task;

            foreach (var file in files)
            {
                DateTime.TryParseExact(file.LastWriteTime, "yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime date);
                string   filenameWithExtention = file.Name.Replace(".full", "");
                string   filename      = filenameWithExtention.Replace(".log", "");
                string[] splitfilename = filename.Split(new string[] { "__" }, StringSplitOptions.None);
                if (splitfilename.Count() == 3)
                {
                    if (date < DateTime.Now.Add(new TimeSpan(0, 0, Math.Abs(purgeLimitSec) * -1)))
                    {
                        var   task2 = o.DeleteFileAsync(bucketName, file.Name);
                        await task2;
                    }
                }
            }
        }
Esempio n. 9
0
        private static void LargeFiles(string[] args, Configuration configuration)
        {
            log.Info("files by size");
            if (args.Length != 2)
            {
                log.Error("wrong number of command line args");
                Environment.Exit(-1);
            }

            DirectoryInfo diTarget = new DirectoryInfo(args[1]);

            if (!diTarget.Exists)
            {
                log.Error("storage does not exists");
                Environment.Exit(-1);
            }

            log.Info("init storage " + diTarget.FullName);
            ObjectStorage store = new ObjectStorage(diTarget, configuration);

            LargeFileAnalyzer lfa = new LargeFileAnalyzer(store, configuration);

            lfa.Analyze();

            log.Info("finished analysis");
        }
Esempio n. 10
0
        private AvrPivotViewModel GetModelFromSession(long layoutId, out string error)
        {
            error = null;
            if (layoutId <= 0)
            {
                layoutId = GetLayoutId();
            }
            var viewModel = ObjectStorage.Using <AvrPivotViewModel, AvrPivotViewModel>(o => o, Session.SessionID, layoutId, StoragePrefix, false);

            if (viewModel == null)
            {
                object ret = GetModelFromService(layoutId);
                if (ret is string)
                {
                    error = ret as string;
                    return(null);
                }
                var pivotResult = ret as AvrServicePivotResult;

                // get viewModel from database and merge it with pivotResult
                // add values of aggregate columns to datasource
                viewModel = GetModelFromDb(layoutId, pivotResult);
            }

            return(viewModel);
        }
Esempio n. 11
0
 public bool TryGetUser(string name, string email, out User user)
 {
     lock (SyncRoot)
     {
         return(ObjectStorage.TryGetValue(name + "\n" + email, out user));
     }
 }
Esempio n. 12
0
        public void CreateDatatypeProperty(string id, string label, PropertyDataType dataType, bool isFunctional = true)
        {
            var schema            = GetSchema();
            var datatypePropClass = schema.FindClassByID(OwlConfig.DatatypePropertyClassID);
            var rangeClass        = schema.FindClassByID(OwlConfig.RangeClassID);
            var rdfTypeClass      = schema.FindClassByID(OwlConfig.RdfTypeClassID);
            var funcPropClass     = schema.FindClassByID(OwlConfig.FunctionalPropertyClassID);

            var datatypePropRangeRel   = datatypePropClass.FindRelationship(rangeClass, schema.FindClassByID(OwlConfig.DatatypeClassID));
            var datatypePropRdfTypeRel = datatypePropClass.FindRelationship(rdfTypeClass, schema.FindClassByID(OwlConfig.SuperClassID));

            var dataTypeIds = ObjectStorage.GetObjectIds(new Query(OwlConfig.DatatypeClassID, (QField)OwlConfig.SuperIdPropertyID == new QConst(dataType.ID)));

            if (dataTypeIds.Length != 1)
            {
                throw new ArgumentException("Cannot locate object for datatype ID=" + dataType.ID);
            }

            var dtPropObj = new ObjectContainer(datatypePropClass);

            dtPropObj[OwlConfig.SuperIdPropertyID] = id;
            dtPropObj[OwlConfig.LabelClassID]      = label;
            ObjectStorage.Insert(dtPropObj);

            if (isFunctional)
            {
                ObjectStorage.AddRelation(new ObjectRelation(dtPropObj.ID.Value, datatypePropRdfTypeRel, funcPropClass.CompactID));
            }
            ObjectStorage.AddRelation(new ObjectRelation(dtPropObj.ID.Value, datatypePropRangeRel, dataTypeIds[0]));

            Refresh();
        }
Esempio n. 13
0
        public ActionResult OnRefreshDataPost(long layoutId, bool save)
        {
            string error;
            var    viewModel = GetModelFromSession(layoutId, out error);

            if (viewModel == null)
            {
                return(View("AvrServiceError", (object)error));
            }

            if (save)
            {
                SaveModelInDb(viewModel.ViewHeader);
            }

            ServiceClientHelper.AvrServiceClearQueryCache(GetQueryIdFromSession(layoutId));
            ObjectStorage.Remove(Session.SessionID, layoutId, LayoutController.StoragePrefix);

            object ret = GetModelFromService(layoutId);

            if (ret is string)
            {
                return(View("AvrServiceError", (object)ret));
            }
            var pivotResult = ret as AvrServicePivotResult;

            AdjustToNew(layoutId, viewModel.ViewHeader, pivotResult.Model);

            viewModel.ViewHeader.GridViewSettings = null;
            ViewBag.LayoutId = layoutId;
            return(RedirectToAction("ViewLayout", new { layoutId = layoutId }));
        }
Esempio n. 14
0
        public void CreateObjectProperty(string id, string label, bool isFunctional = false, bool isInverseFunctional = false)
        {
            var schema       = GetSchema();
            var objPropClass = schema.FindClassByID(OwlConfig.ObjectPropertyClassID);

            var rdfTypeClass          = schema.FindClassByID(OwlConfig.RdfTypeClassID);
            var funcPropClass         = schema.FindClassByID(OwlConfig.FunctionalPropertyClassID);
            var invFuncPropClass      = schema.FindClassByID(OwlConfig.InverseFunctionalPropertyClassID);
            var objPropPropRdfTypeRel = objPropClass.FindRelationship(rdfTypeClass, schema.FindClassByID(OwlConfig.SuperClassID));

            var newObj = new ObjectContainer(objPropClass);

            newObj[OwlConfig.SuperIdPropertyID] = id;
            newObj[OwlConfig.LabelClassID]      = label;
            ObjectStorage.Insert(newObj);

            if (isFunctional)
            {
                ObjectStorage.AddRelation(new ObjectRelation(newObj.ID.Value, objPropPropRdfTypeRel, funcPropClass.CompactID));
            }
            if (isInverseFunctional)
            {
                ObjectStorage.AddRelation(new ObjectRelation(newObj.ID.Value, objPropPropRdfTypeRel, invFuncPropClass.CompactID));
            }

            Refresh();
        }
Esempio n. 15
0
        public DataSchema GetSchema()
        {
            if (CachedDataSchema != null)
            {
                return(CachedDataSchema);
            }

            lock (this) {
                if (CachedDataSchema != null)
                {
                    return(CachedDataSchema);
                }

                var schema = new DataSchema();
                InitSuperClassSchema(schema);
                CachedDataSchema = schema;

                // load all OWL classes
                var owlClassIds = ObjectStorage.GetObjectIds(new Query(OwlConfig.SuperClassID));
                var owlClassMap = ObjectStorage.Load(owlClassIds);
                InitMetaSchema(schema, owlClassMap.Values);

                // load data schema described in OWL terms
                InitDataSchema(schema);
            }

            return(CachedDataSchema);
        }
Esempio n. 16
0
 public ActionResult ChartTypeCombo(long layoutId)
 {
     return(ObjectStorage.Using <AvrPivotViewModel, ActionResult>(viewModel =>
     {
         return PartialView("ChartTypeCombo", (object)viewModel.ViewHeader.ChartType);
     }, Session.SessionID, layoutId, ViewLayoutController.StoragePrefix));
 }
Esempio n. 17
0
        private void AddComponent(Type type, DBConfigEntity sysConfig, DBConfigEntity logConfig, MongoClient sysDbClient, MongoClient logDbClient, IMongoDatabase sysDb, IMongoDatabase logDb)
        {
            if (!typeof(IRpository).IsAssignableFrom(type))
            {
                return;
            }

            var isSingle = ObjectStorage.IsSingleType(type);

            if (!isSingle)
            {
                throw new ComponentException("规定Rpository类型组件只能定义成单例(SingleCase)组件。");
            }

            var component = ObjectStorage.Fetch(type);
            var rpository = component as IRpository;

            if (rpository.DBType == DBType.SysDb)
            {
                rpository.SetDBContext(sysDb, sysConfig.DatabaseName, sysDbClient);
                Game.Scene.AddComponent(component);
            }
            else if (rpository.DBType == DBType.LoggerDb)
            {
                rpository.SetDBContext(logDb, logConfig.DatabaseName, logDbClient);
                Game.Scene.AddComponent(component);
            }
        }
        public IEnumerator PowerUp_Review()
        {
            #region Prepare

            IObjectStorage objectStorage = new ObjectStorage();
            ISpawnManager  spawnManager  = new SpawnManager(objectStorage);

            #endregion

            yield return(new WaitForSeconds(0.5f));

            #region Prepare Cell and Output to Screen

            Vector3 position = new Vector3(0, 0, 0);

            ICell cell = new NormalCell(0, 0);

            foreach (PowerUpTypesEnum powerUp in System.Enum.GetValues(typeof(PowerUpTypesEnum)))
            {
                cell.CurrentGameObject = spawnManager.SpawnPowerPrefab(powerUp, position);

                yield return(new WaitForSeconds(0.5f));

                GameObject.Destroy(cell.CurrentGameObject);
            }

            #endregion
        }
Esempio n. 19
0
 public void SetStorage(ObjectStorage storage)
 {
     UpgradedStorage    = storage;
     UpgradedProtection = storage.Protection;
     if (Level != null)
     {
         Level.text = storage.Level.ToString();
     }
     if (UpgradePoints != null)
     {
         UpgradePoints.text = storage.UpgradePoints.ToString();
     }
     if (UpgradePointsPanel != null)
     {
         UpgradePointsPanel.SetActive(storage.UpgradePoints > 0);
     }
     ProtectionUpgradeUI.MaxValue   = 10;
     ProtectionUpgradeUI.FreePoints = storage.UpgradePoints;
     for (int i = 0; i < ImpactFactors.FieldsCount; i++)
     {
         if (i < FactorProtection.Length ? FactorProtection[i] != null : false)
         {
             FactorProtection[i].SetBaseValue((int)storage.Protection[i], (int)SessionData.Data.Researches.ResearchedTechs[i]);
         }
     }
     UpgradeButton.interactable = SessionData.Data.ResourceStorage.Money >= 40;
 }
Esempio n. 20
0
 internal Tree(ObjectStorage storage ,string id, long size, Func<byte[]> loader, Tree parent = null, string name = null, string mode = null)
     : base(id, parent, name, mode)
 {
     this.Size = size;
     this._storage = storage;
     this._loader = loader.Try(n => new Lazy<byte[]>(loader));
 }
Esempio n. 21
0
 public CollectionGrain(ILogger <CollectionGrain <T> > logger)
 {
     _logger  = logger;
     _storage = new ObjectStorage <T>(Configuration.Default, new Collection {
         Name = this.GetPrimaryKeyString()
     });
 }
Esempio n. 22
0
        private ITestData createData()
        {
            var dataStore  = new ObjectStorage(s => values[s], (s, v) => values[s] = v);
            var observable = DataStorageInterceptor <ITestData> .ImplementInterface(dataStore, new ProxyGenerator());

            return(observable);
        }
        public void SpawnManager_Create_NotNull()
        {
            IObjectStorage objectStorage = new ObjectStorage();
            ISpawnManager  spawnManager  = new SpawnManager(objectStorage);

            Assert.IsNotNull(spawnManager);
        }
Esempio n. 24
0
    IEnumerator Start()
    {
        _count = 0;
        foreach (PoolEntity entity in entities)
        {
            ObjectStorage data = new ObjectStorage()
            {
                InitCapacity = entity.amount,
                Entities     = new Queue <GameObject>(entity.amount)
            };
            for (int i = 0; i < entity.amount; i++)
            {
                var obj = Instantiate(entity.prefab, objectsParentTransform, true);
                data.Entities.Enqueue(obj);
                _count++;
                if (_count >= maxInitializationsPerFrame)
                {
                    _count = 0;
                    yield return(null);
                }
            }

            _freeEntities.Add(entity.type, data);
        }

        Debug.Log("Pool is ready");
        OnPoolReady?.Invoke();
    }
Esempio n. 25
0
        internal Commit(ObjectStorage storage, ObjectReader reader, string id)
            : base(id)
        {
            _storage = storage;
            _reader = reader;

            this._parents = new List<Commit>();
        }
Esempio n. 26
0
 void Start()
 {
     objectStorage = new ObjectStorage();
     levelManager  = new LevelManager(this);
     meshManager   = new MeshManager(levelManager, objectStorage, grid);
     GameObject.Find("water").GetComponent <Spacing>().Manager = levelManager;
     meshManager.CreateRoad();
     isPlaying = true;
 }
Esempio n. 27
0
 public static IEnumerable <Acteur> FromDirectory(string dir)
 {
     return(Directory.GetFiles(dir).Select(f =>
     {
         var result = FromJson(File.ReadAllText(f)).Acteur;
         ObjectStorage <BaseRawData> .Singleton().Register(result.Uid, result);
         return result;
     }));
 }
Esempio n. 28
0
        public void Save()
        {
            if (settings == null)
            {
                settings = new ObjectStorage <Settings>();
            }

            settings.Data = Settings.Instance;
            settings.Save();
        }
Esempio n. 29
0
        public void CopyBackup2ObjectStorage()
        {
            CancellationTokenSource cancelTokenSource = new CancellationTokenSource();

            try
            {
                if (Path.Substring(Path.Length - 1).Equals(@"\"))
                {
                    Path = Path.Substring(0, Path.Length - 1);
                }

                if (!Directory.Exists(Path))
                {
                    Directory.CreateDirectory(Path);
                }

                foreach (var a in targets)
                {
                    try
                    {
                        string localFileFullname  = Path + @"\" + a.BACKUP_FILE_NAME;
                        string remoteFileFullname = $@"backup/{config.GetServerName()}/" + a.BACKUP_FILE_NAME;
                        currentBackupFileName = localFileFullname;
                        if (!int.TryParse(config.GetValue(Category.Backup, Key.ObjectStorageBandWidthThrottleSleepMiliSec), out int sleepMiliSec))
                        {
                            sleepMiliSec = 0;
                        }

                        ObjectStorage o = new ObjectStorage(
                            LogClient.Config.Instance.GetValue(LogClient.Category.Api, LogClient.Key.AccessKey)
                            , LogClient.Config.Instance.GetValue(LogClient.Category.Api, LogClient.Key.SecretKey)
                            , config.GetValue(Category.Backup, Key.ObjectStorageServiceUrl)
                            );
                        o.UploadProgressEvent += ProgressLog;
                        o.UploadObjectAsync(bucketName, localFileFullname, remoteFileFullname, cancelTokenSource.Token, sleepMiliSec).Wait();
                        if (!IsRunning)
                        {
                            break;
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Warn($"objectStorage Upload Error filename : {currentBackupFileName}, exception info : {ex.Message}, {ex.StackTrace}");
                    }
                }
            }
            catch (Exception ex)
            {
                log.Warn($"objectStorage Upload Error filename : {currentBackupFileName}, exception info : {ex.Message}, {ex.StackTrace}");
            }
            finally
            {
                log.Warn($"objectStorage Upload Completed filename : {currentBackupFileName}");
            }
        }
Esempio n. 30
0
 /// <summary>Perform initial load of remote branches.</summary>
 /// <param name="branchDataList">List of remote branch data containers.</param>
 internal void Load(IEnumerable <BranchData> branchDataList)
 {
     ObjectStorage.Clear();
     if (branchDataList != null)
     {
         foreach (var remoteBranchData in branchDataList)
         {
             AddObject(ObjectFactories.CreateRemoteBranch(Repository, remoteBranchData));
         }
     }
 }
        public static ProcessContainer GetTarget_OwnerProcessContainer()
        {
            var processContainer = ObjectStorage.RetrieveFromOwnerContent <ProcessContainer>(InformationContext.CurrentOwner, "default");

            if (processContainer == null)
            {
                processContainer = new ProcessContainer();
                processContainer.SetLocationAsOwnerContent(InformationContext.CurrentOwner, "default");
            }
            return(processContainer);
        }
Esempio n. 32
0
 /// <summary>Perform initial load of tags.</summary>
 /// <param name="tagDataList">List of tag data containers.</param>
 internal void Load(IEnumerable <TagData> tagDataList)
 {
     ObjectStorage.Clear();
     if (tagDataList != null)
     {
         foreach (var tagData in tagDataList)
         {
             AddObject(ObjectFactories.CreateTag(Repository, tagData));
         }
     }
 }
Esempio n. 33
0
 internal Tag(ObjectStorage storage, ObjectReader reader, string id)
     : base(id)
 {
     _storage = storage;
     _loader = () => LoadFromObjectReader(reader);
 }
Esempio n. 34
0
 /// <summary>
 /// Gets called from the Storage property getter for lazy loading
 /// </summary>
 private void LoadStorage()
 {
     _storage = new ObjectStorage(this);
 }