public virtual T GetSlotById(string id)
        {
            //string fff = string.Format("Count {0} Search {1}  IDS : ", Containers.Length, id);
            //Containers.ForEach(e =>
            //{
            //    fff += string.Format("{0} ", e.CellIndetifer);
            //});
            //Debug.Log(fff);
            var res = Containers.FirstOrDefault(o => o.CellIndetifer == id);

            if (res != null)
            {
                return(res);
            }
            res = Containers.FirstOrDefault(o => o.CellIndetifer == "" || o.CellIndetifer == "0");
            if (res == null && !_createNewIfNoSlot)
            {
                return(default(T));
            }
            if (res == null)
            {
                res = (T)InstantiatePrefabCell();
            }
            res.CellIndetifer = id;
            return(res);
        }
Ejemplo n.º 2
0
        public void SetStepTarget(Pipelines.StepTarget target)
        {
            // Enforce command restriction if set for the step target
            var commandManager = HostContext.GetService <IWorkerCommandManager>();

            if (string.Equals(WellKnownStepTargetStrings.Restricted, target?.Commands, StringComparison.OrdinalIgnoreCase))
            {
                commandManager.SetCommandRestrictionPolicy(new AttributeBasedWorkerCommandRestrictionPolicy());
            }
            else
            {
                commandManager.SetCommandRestrictionPolicy(new UnrestricedWorkerCommandRestrictionPolicy());
            }

            // When step targets are set, we need to take over control for translating paths
            // from the job execution context
            Variables.StringTranslator = TranslatePathForStepTarget;

            if (string.Equals(WellKnownStepTargetStrings.Host, target?.Target, StringComparison.OrdinalIgnoreCase))
            {
                _currentStepTarget = new HostInfo();
            }
            else
            {
                _currentStepTarget = Containers.FirstOrDefault(x => string.Equals(x.ContainerName, target?.Target, StringComparison.OrdinalIgnoreCase));
            }
        }
 public T GetSlotByN(int slotNumber)
 {
     if (Containers.Length <= slotNumber && _createNewIfNoSlot)
     {
         return((T)InstantiatePrefabCell());
     }
     return(Containers.FirstOrDefault(o => o.CellIndex == slotNumber));
 }
        public MyCosmosDB(string endPointUri, string primaryKey, ICosmosDbRepositoryLogger log = null) : base(log)
        {
            Logger = log;
            var desc = new MyCosmosDbDescriptor();

            InitAsync(endPointUri, primaryKey, desc).GetAwaiter().GetResult();
            MainContainer = Containers.FirstOrDefault();
        }
Ejemplo n.º 5
0
        public void SetStepTarget(Pipelines.StepTarget target)
        {
            // When step targets are set, we need to take over control for translating paths
            // from the job execution context
            Variables.StringTranslator = TranslatePathForStepTarget;

            if (string.Equals(WellKnownStepTargetStrings.Host, target?.Target, StringComparison.OrdinalIgnoreCase))
            {
                _currentStepTarget = new HostInfo();
            }
            else
            {
                _currentStepTarget = Containers.FirstOrDefault(x => string.Equals(x.ContainerName, target?.Target, StringComparison.OrdinalIgnoreCase));
            }
        }
Ejemplo n.º 6
0
        public void Login(string storageName, string key)
        {
            var credentials = new StorageCredentials(storageName, key);
            var account     = new Microsoft.WindowsAzure.Storage.CloudStorageAccount(credentials, false);

            Containers.Clear();
            Blobs.Clear();
            account.CreateCloudBlobClient().ListContainers().ToList().ForEach(Containers.Add);
            var lastUsed = Preferences.Instance.LastUsedContainer;
            CloudBlobContainer container;

            if (lastUsed != null && (container = Containers.FirstOrDefault(c => c.Name == lastUsed)) != null)
            {
                CurrentContainer = container;
            }
        }
Ejemplo n.º 7
0
        internal INodeContainer GetNodeContainerInstance(DataNodeContainer ncnt)
        {
            var ret   = Containers.FirstOrDefault(d => d.Id == ncnt.Id);
            var isNew = false;

            if (ret == null)
            {
                ret   = new NodeContainer();
                isNew = true;
            }
            ret.Parse(ncnt);
            if (isNew)
            {
                Containers.Add(ret);
            }

            return(ret);
        }
Ejemplo n.º 8
0
        private void TimerCallback(object state)
        {
            string containerId = FetchUpdatedLogContainerId();

            while (containerId != null)
            {
                string log = service.GetLog(containerId);

                if (log != null)
                {
                    string localContainerId = containerId;
                    appBrowserViewModel.ViewContext.Invoke(() =>
                    {
                        DockerContainerViewModel containerViewModel = Containers.FirstOrDefault(c => c.Id == localContainerId);
                        if (containerViewModel != null)
                        {
                            containerViewModel.Log = log;
                        }
                    });
                }

                containerId = FetchUpdatedLogContainerId();
            }
        }
Ejemplo n.º 9
0
 public void KillContainer() => KillContainer(Containers.FirstOrDefault().Key);
 public DependencyObject ContainerFromItem(object item)
 {
     return(Containers.FirstOrDefault(o => o.Content == item));
 }
Ejemplo n.º 11
0
 public void Close()
 {
     Containers.FirstOrDefault().Remove(this);
 }