This script is an extension of the interactable script. This specific script handles interaction with containers
Inheritance: Interactable
        /// <include file='InterfaceDocumentationComments.xml' path='doc/members/member[@name="M:OraclePermissionGeneratorWebServiceAPI.ITrackingDataLogger.Log(System.DateTime,System.String,System.String,OraclePermissionGeneratorWebServiceAPI.Location,System.Byte[])"]/*'/>
        public void Log(DateTime timeStamp, string userIdentifier, string methodName, Containers.Location location, byte[] ipV4Address)
        {
            StringBuilder stringBuilder = new StringBuilder();
            stringBuilder.Append(timeStamp.ToString(logEntryDateFormat) + " | ");
            stringBuilder.Append(userIdentifier + " | ");
            stringBuilder.Append(methodName + " | ");
            if (location != null)
            {
                stringBuilder.Append(location.Latitude + ", " + location.Longitude + ", " + location.SecondsSinceUpdate + " | ");
            }
            else
            {
                stringBuilder.Append(" | ");
            }
            if (ipV4Address != null)
            {
                for (int i = 0; i <= 3; i++)
                {
                    stringBuilder.Append(ipV4Address[i]);
                    if (i != 3)
                    {
                        stringBuilder.Append(".");
                    }
                }
            }

            streamWriter.WriteLine(stringBuilder.ToString());
            streamWriter.Flush();
        }
Example #2
0
        public Containers <decimal> BuildContainersExampl1()
        {
            Containers <decimal> a = new Containers <decimal>(3, 1, 1, 0, 100);

            a.AllocateMemoryForPoints2DInEachContainer(1, 0, 50);
            a.AllocateMemoryForPoints2DInEachContainer(1, 1, 200);
            for (int i = 0; i < 3; i++)
            {
                a.SetRaingPoint2DInAllocatedMemory(i, 1, 0, GenereteColectionPoint2D(50));
                a.SetRaingPoint2DInAllocatedMemory(i, 1, 1, GenereteColectionPoint2D(200));
                a.AddRangePoint1D(i, 0, 0, GenereteColectionPoint1D(rnd1.Next(15, 250)));
                a.AddRangePoint1D(i, 0, 1, GenereteColectionPoint1D(rnd1.Next(60, 250)));
            }
            return(a);
        }
Example #3
0
        private bool AreLoopsDisjoint(IForStatement loop, IExpression expr, IExpression expr2)
        {
            List <IStatement> targetLoops = Containers.GetLoopsNeededForExpression(context, expr, -1, false);
            List <IStatement> indexLoops  = Containers.GetLoopsNeededForExpression(context, expr2, -1, false);
            Set <IStatement>  parentLoops = new Set <IStatement>();

            parentLoops.AddRange(targetLoops);
            parentLoops.AddRange(indexLoops);
            if (Containers.ListContains(parentLoops, loop))
            {
                // expression has the form array[k][indices[k]] or array[indices[k][k]]
                return(false);
            }
            return(true);
        }
Example #4
0
        public SignalViewContainerViewModel AddView()
        {
            SignalViewContainerViewModel newInstance = null;

            newInstance = new SignalViewContainerViewModel(Root, () =>
            {
                newInstance.Cleanup();
                Containers.Remove(newInstance);
                Root.IsDataModified = true;
            });

            Containers.Add(newInstance);

            return(newInstance);
        }
Example #5
0
 public void RemoveAt(int index)
 {
     Count--;
     if (index < Containers.Count)
     {
         Containers.RemoveAt(index);
         if (Border != null)
         {
             Border.Index--;
         }
     }
     else if (index == Containers.Count)
     {
         Border = null;
     }
 }
Example #6
0
 public bool Remove(IndexedItemContainer <T, bool> item)
 {
     Count--;
     if (Containers.Remove(item))
     {
         if (Border != null)
         {
             Border.Index--;
         }
     }
     else if (Equals(Border, item))
     {
         Border = null;
     }
     return(true);
 }
Example #7
0
        public CosmosContext(CosmosConfig config)
        {
            _cache = new Cache("Cosmos", config.CacheMb);
            var retriesOn429Throttling = 1;          // Number of retries before failing processing when provisioned RU/s limit in CosmosDb is breached
            var timeout   = TimeSpan.FromSeconds(5); // Timeout applied per request to CosmosDb, including retry attempts
            var discovery = Discovery.FromConnectionString(config.ConnectionStringWithUriAndKey);

            _connect = async() =>
            {
                var gateway = await Connect("App", config.Mode, discovery, timeout, retriesOn429Throttling, timeout);

                var containers = new Containers(config.Database, config.Container);

                _store = new Context(gateway, containers);
            };
        }
Example #8
0
 public void Grow()
 {
     while (Containers.Count < Source.Count && Border is null)
     {
         var container = _owner.CreateContainer(Source[Containers.Count]);
         container.Index = Containers.Count;
         if (container.Value)
         {
             Containers.Add(container);
         }
         else
         {
             Border = container;
         }
     }
 }
Example #9
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;
            }
        }
Example #10
0
 private bool HasPartitionedLoop(Containers containers)
 {
     foreach (var container in containers.inputs)
     {
         if (container is IForStatement)
         {
             IForStatement        ifs     = (IForStatement)container;
             IVariableDeclaration loopVar = Recognizer.LoopVariable(ifs);
             if (context.InputAttributes.Has <Partitioned>(loopVar))
             {
                 return(true);
             }
         }
     }
     return(false);
 }
Example #11
0
 public async Task <Containers> InsertContainer(Containers autors)
 {
     try
     {
         using (var context = this._context)
         {
             context.Containers.Add(autors);
             context.SaveChanges();
             return(autors);
         }
     }
     catch (Exception ex)
     {
         throw new Exception("Houve um erro ao incluir Autor: " + ex.Message);
     }
 }
Example #12
0
        public async Task ReturnContainerRev(ImgContainer container)
        {
            container.Cts?.Cancel();
            CancellationTokenSource cts = new CancellationTokenSource();

            container.Cts = cts;

            Containers.ForEach(c => c.CurrentIndex += 1);
            container.CurrentIndex = -numofBackwardContainer;
            container.InitPos(CurrentSlideDirection);
            ReleaseContainerImage(container);
            ImagePool.ShiftForwardIndex(-container.NumofImage);
            MapImageFileContextToContainer(container, true);
            MainWindow.Current.UpdatePageInfo();
            await container.LoadImage(cts.Token);
        }
Example #13
0
        /// <summary>
        /// Convert this instance into a simplified type for JSON serialization.
        /// </summary>
        /// <returns>The instance as a simplified representation.</returns>
        public JsonInstance ToJsonInstance()
        {
            // Convert to JSON representation
            var jsonInstance = new JsonInstance()
            {
                Name       = Name,
                Containers = Containers.Select(c =>
                                               new JsonContainer()
                {
                    ID     = c.ID,
                    Length = c.Mesh.Length,
                    Width  = c.Mesh.Width,
                    Height = c.Mesh.Height
                }).ToList(),
                Pieces = Pieces.Select(p =>
                                       new JsonPiece()
                {
                    ID    = p.ID,
                    Flags = p.GetFlags().Select(f => new JsonFlag()
                    {
                        FlagId = f.flag, FlagValue = f.value
                    }).ToList(),
                    Cubes = p.Original.Components.Select(c =>
                                                         new JsonCube()
                    {
                        X      = c.RelPosition.X,
                        Y      = c.RelPosition.Y,
                        Z      = c.RelPosition.Z,
                        Length = c.Length,
                        Width  = c.Width,
                        Height = c.Height
                    }).ToList()
                }).ToList(),
                Rules = new JsonRuleSet()
                {
                    FlagRules = Rules.FlagRules.Select(r => new JsonFlagRule()
                    {
                        FlagId    = r.FlagId,
                        RuleType  = r.RuleType,
                        Parameter = r.Parameter
                    }).ToList(),
                }
            };

            // Return it
            return(jsonInstance);
        }
Example #14
0
        public void ReadContainerFromExternalFile()
        {
            Database db = HostApplicationServices.WorkingDatabase;
            Editor   ed = Application.DocumentManager.MdiActiveDocument.Editor;

            OpenFileDialog dlg = new OpenFileDialog();

            dlg.Filter      = "MSH or Text Files|*.msh;*.txt|Text Files|*.txt|Office Files|*.doc|All Files|*.*";
            dlg.Multiselect = false;
            dlg.Title       = "Select MSH File ";
            dlg.DefaultExt  = "msh";

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                container = new Containers();
                if (container.ReadFromExternalFile(dlg.FileName))
                {
                    int notfictive = 0;
                    foreach (Bend b in container.Bends)
                    {
                        if (!b.Fictive)
                        {
                            notfictive++;
                        }
                    }

                    string formatString = "{0,-20}\t{1,-12}\n\n";

                    string mess = "\n";
                    mess += string.Format(formatString, "Nodes:", container.Nodes.Count);
                    mess += string.Format(formatString, "All Bends:", container.Bends.Count);
                    mess += string.Format(formatString, "Bends:", notfictive);
                    mess += string.Format(formatString, "Fictive Bends:", container.Bends.Count - notfictive);
                    mess += string.Format(formatString, "Peripheral Bends:", container.peripheralBendsNumers.Count);
                    mess += string.Format(formatString, "Triangles:", container.Triangles.Count);
                    mess += string.Format(formatString, "Polygons:", container.Polygons.Count);

                    MessageBox.Show("\nMesh data was loaded from the Dictionary !\n\n" + mess +
                                    "\n\n" + ConstantsAndSettings.GetString(), "Reading from the Dictionary ...", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    ed.WriteMessage("\nMesh data was loaded from the Dictionary !");
                }
                else
                {
                    container = new Containers();
                }
            }
        }
Example #15
0
        internal void ValidateAndResolve(ModuleJson module)
        {
            Validation.Validate(Fields is object ^ Containers is object,
                                "Each container must either specify fields or containers as children, but not both.");

            if (Fields is object)
            {
                Validation.Validate(Size is object, "Field containers must specify a size.");
                Fields.ForEach(f => f.ValidateJson(module));
                resolvedFields            = ResolveFields(module);
                requiresOverlayResolution = resolvedFields.Any(f => f is OverlayField overlay && overlay.SwitchPath.Contains('{'));
            }
            else
            {
                Containers?.ForEach(f => f.ValidateJson(module));
            }
        }
Example #16
0
        public MemoryDb()
        {
            var stackRecord = new ContainerStack
            {
                StackType = typeof(MinecraftBedrockStack)
            };

            stackRecord.SetConfig(new MinecraftBedrockStackConfig());

            Stacks.SaveAsync(stackRecord).Wait();

            Containers.SaveAsync(new Container
            {
                StackId   = stackRecord.Id,
                ImageName = "itzg/minecraft-bedrock-server"
            });
        }
Example #17
0
            public void Add(IndexedItemContainer <T, bool> item)
            {
                item.Index = Containers.Count;
                if (Border is null)
                {
                    if (item.Value)
                    {
                        Containers.Add(item);
                    }
                    else
                    {
                        Border = item;
                    }
                }

                Count++;
            }
        public async Task <IActionResult> Edit(int id, int page)
        {
            Containers containers = await context.Containers.FindAsync(id);

            if (containers != null)
            {
                ContainersViewModel costsViewModel = new ContainersViewModel();
                costsViewModel.PageViewModel = new PageViewModel {
                    PageNumber = page
                };
                costsViewModel.Container = containers;

                return(View(costsViewModel));
            }

            return(NotFound());
        }
Example #19
0
        /// <summary>
        /// Constructor. Initialize the image list from the application resources based on the containers
        /// </summary>
        /// <param name="containers">Containers collection of containerNames</param>
        internal TreeImages(Containers containers)
        {
            ImageList = new ImageList();

            //Load default image for Load and Save trees
            ImageList.Images.Add("db", Properties.Resources.db);
            ImageList.Images.Add("folder", Properties.Resources.folder);

            foreach (ContainerNames container in containers)
            {
                foreach (ObjectTypeExtension ote in container.ObjectTypes)
                {
                    string extension = ote.FileExtension.ToString();
                    ImageList.Images.Add(extension, LoadFromResources(extension));
                }
            }
        }
    private bool TryTakeChamberEntity(EntityUid uid, [NotNullWhen(true)] out EntityUid?entity)
    {
        if (!Containers.TryGetContainer(uid, ChamberSlot, out var container) ||
            container is not ContainerSlot slot)
        {
            entity = null;
            return(false);
        }

        entity = slot.ContainedEntity;
        if (entity == null)
        {
            return(false);
        }
        container.Remove(entity.Value);
        return(true);
    }
        protected virtual void DestroyCell()
        {
            var temp = new T[_containers.Length - 1];

            for (var i = 0; i < _containers.Length - 1; i++)
            {
                temp[i] = _containers[i];
            }
            var cell = Containers.Last();   //Последняя вьюшку предмета

            if (_choosenCell != null && ChoosenCell.Equals(cell))
            {
                _choosenCell = default(T);
            }
            cell.Destroy();
            _containers = temp;
        }
Example #22
0
        public int CountItem(uint itemID, Containers container = Containers.Inventory)
        {
            var items = from item in
                        (from item in containers[container]
                         where item != null && item.ItemID == itemID
                         select item)
                        where item.SlotID < ListSize
                        select item;
            int count = 0;

            foreach (Item.Item i in items)
            {
                count += i.Count;
            }

            return(count);
        }
Example #23
0
 public int InsertContainer(Containers ourContainer)
 {
     using (IDbConnection conn = Connection)
     {
         conn.Open();
         int insertedId = conn.Query <int>(@"INSERT INTO Containers([Address],
         [Longitude],[Latitude],[Description],[EGDid],[LastStateid]) 
             values (@Address, @Longitude, @Latitude, @Description, @EGDid, @LastStateid);
             SELECT CAST(SCOPE_IDENTITY() as int)",
                                           new { ourContainer.Address, Longitude = (int?)null, Latitude = (int?)null, ourContainer.Description, EGDid = (int?)null, LastStateid = (int?)null }).Single();
         if (insertedId != -1)
         {
             return(insertedId);
         }
         return(-1);
     }
 }
Example #24
0
        public bool IncreaseQuantity(string containerName, int byQuantity = 1)
        {
            Container container;

            if (!Containers.TryGetValue(containerName, out container))
            {
                return(false);
            }

            if (container.Quantity >= container.Maximum)
            {
                return(false);
            }

            container.Quantity = (int)Math.Min(container.Maximum.Value, container.Quantity + byQuantity);
            return(true);
        }
        private void RepackStdCpk(string dataDir, string stdDir)
        {
            Console.WriteLine("Repacking std.cpk...");

            string stdCpk = Path.Join(dataDir, "PSP_GAME", "USRDIR", "std.cpk");

            Containers.RepackCpk(stdCpk, stdDir);

            string stdDns = Path.Join(dataDir, "PSP_GAME", "INSDIR", "STD.DNS");

            if (File.Exists(stdDns))
            {
                File.Delete(stdDns);
            }

            File.Copy(stdCpk, stdDns);
        }
Example #26
0
 protected bool IsPartitionedExpr(IExpression expr)
 {
     return Recognizer.GetVariables(expr).Any(ivd =>
     {
         Containers c = context.InputAttributes.Get<Containers>(ivd);
         foreach (IStatement container in c.inputs)
         {
             if (container is IForStatement loop)
             {
                 IVariableDeclaration loopVar = Recognizer.LoopVariable(loop);
                 bool isPartitionedLoop = context.InputAttributes.Has<Partitioned>(loopVar);
                 if (isPartitionedLoop && loopVar.Equals(ivd)) return true;
             }
         }
         return false;
     });
 }
Example #27
0
        public static Hashtable <object, object> AcquireHashtable(uint capacity)
        {
            Containers cache = GetContainers();

            Hashtable <object, object> result = Acquire(ref cache.m_hashTable1, ref cache.m_hashTable2);

            if (result != null)
            {
                result.Clear();
            }
            else
            {
                result = new Hashtable <object, object>(capacity);
            }

            return(result);
        }
Example #28
0
        public bool DecreaseQuantity(string containerName, int byQuantity = 1)
        {
            Container container;

            if (!Containers.TryGetValue(containerName, out container))
            {
                return(false);
            }

            if (container.Quantity < byQuantity)
            {
                return(false);
            }

            container.Quantity = container.Quantity - byQuantity;
            return(true);
        }
 /// <summary>
 /// Creates the task factory.
 /// </summary>
 /// <param name="scheduler">The scheduler.</param>
 /// <param name="weOwnScheduler">if set to <c>true</c> [we own scheduler].</param>
 /// <returns></returns>
 private ITaskFactory CreateTaskFactoryInternal(ATaskScheduler scheduler, bool weOwnScheduler)
 {
     if (weOwnScheduler)
     {
         var container = _createContainerInternal().Create(QueueContexts.TaskFactory, _registerService, _transportInit,
                                                           serviceRegister => serviceRegister.Register(() => scheduler, LifeStyles.Singleton), _setOptions);
         Containers.Add(container);
         return(container.GetInstance <ITaskFactory>());
     }
     else
     {
         var container = _createContainerInternal().Create(QueueContexts.TaskFactory, _registerService, _transportInit,
                                                           serviceRegister => serviceRegister.RegisterNonScopedSingleton(scheduler), _setOptions);
         Containers.Add(container);
         return(container.GetInstance <ITaskFactory>());
     }
 }
        bool PutBlobStream(string containerName, string blobName, Stream stream, bool overwrite, string expectedEtag, out string etag)
        {
            var memoryStream = stream as MemoryStream;

            if (memoryStream == null)
            {
                memoryStream = new MemoryStream();
                stream.CopyTo(memoryStream);
            }
            memoryStream.Position = 0;

            lock (_syncRoot)
            {
                etag = null;
                if (Containers.ContainsKey(containerName))
                {
                    if (Containers[containerName].BlobNames.Contains(blobName))
                    {
                        if (!overwrite || expectedEtag != null && expectedEtag != Containers[containerName].BlobsEtag[blobName])
                        {
                            return(false);
                        }

                        Containers[containerName].SetBlob(blobName, memoryStream);
                        etag = Containers[containerName].BlobsEtag[blobName];
                        return(true);
                    }

                    Containers[containerName].AddBlob(blobName, memoryStream);
                    etag = Containers[containerName].BlobsEtag[blobName];
                    return(true);
                }

                if (!BlobStorageExtensions.IsContainerNameValid(containerName))
                {
                    throw new NotSupportedException("the containerName is not compliant with azure constraints on container names");
                }

                Containers.Add(containerName, new MemoryContainer());

                Containers[containerName].AddBlob(blobName, memoryStream);
                etag = Containers[containerName].BlobsEtag[blobName];
                return(true);
            }
        }
        public override void Add(ParseItem item, ITextProvider text)
        {
            if (item is SassImportDirective)
            {
                var directive = item as SassImportDirective;
                foreach (var file in directive.Files.Where(x => x.IsValid))
                {
                    Containers.Add(new ImportContainer(directive, IntellisenseManager.Get(file.Document)));
                }
            }
            else if (item is XmlDocumentationComment)
            {
                var comment = item as XmlDocumentationComment;
                foreach (var tag in comment.Children.OfType <FileReferenceTag>().Where(x => x.Document != null))
                {
                    Containers.Add(new ImportContainer(tag, IntellisenseManager.Get(tag.Document)));
                }
            }
            else if (item is MixinDefinition)
            {
                var definition = item as MixinDefinition;
                if (definition.Name != null && definition.Name.Name != null)
                {
                    Parse(new MixinContainer(definition, text), definition.Children, text);

                    var name = text.GetText(definition.Name.Name.Start, definition.Name.Name.Length);
                    _Mixins.Add(definition.End, new MixinCompletionValue(name));
                }
            }
            else if (item is UserFunctionDefinition)
            {
                var definition = item as UserFunctionDefinition;
                if (definition.Name != null)
                {
                    Parse(new FunctionContainer(definition, text), definition.Children, text);

                    var name = text.GetText(definition.Name.Start, definition.Name.Length);
                    _Functions.Add(definition.End, new UserFunctionCompletionValue(name));
                }
            }
            else
            {
                base.Add(item, text);
            }
        }
Example #32
0
		/// <summary>
		/// Creates a new <see cref="ILEmitter"/> by wrapping an <see cref="ILGenerator"/>
		/// </summary>
		private ILEmitter(ILGenerator/*!*/ il, Containers container)
		{
			this.il = il;
			this.container = container;
			this.branchTargets = new Dictionary<Label, object>();
			this.unresolvedBranches = new Dictionary<Label, object>();

#if DEBUG
			forgottenTargets = new Dictionary<Label, object>();
#endif
		}
 /// <summary>
 /// Initializes a new instance of the <see cref="ContainerCollection"/> class.
 /// </summary>
 public ContainerCollection()
 {
     Containers = new Containers();
     this.SizeChanged += ContainerCollection_SizeChanged;
     bitmapImage = new Image();
     bitmapImage.Stretch = Stretch.None;
     #if DIRECTX2D
      this.factory = D2D.D2DFactory.CreateFactory(D2D.D2DFactoryType.Multithreaded);
     this.Directx2DGraphics = new D3D10Image();
     #endif
 }
Example #34
0
 /// -----------------------------------------------------------------------------
 /// <summary>
 /// Creates a Module Host control using the ModuleConfiguration for the Module
 /// </summary>
 /// <remarks>
 /// </remarks>
 /// <history>
 /// 	[cnurse]	12/16/2007  created
 /// </history>
 /// -----------------------------------------------------------------------------
 public ModuleHost(ModuleInfo moduleConfiguration, Skins.Skin skin, Containers.Container container)
 {
     ID = "ModuleContent";
     Container = container;
     _moduleConfiguration = moduleConfiguration;
     Skin = skin;
 }
 public AssemblyVersionPackage(Ref.AssemblyArtifacts meta, Containers.AssemblyBinVersions archive)
 {
     Version = meta;
     Container = archive;
 }
        private void getIPEvent(object sender, Containers.EventArgsContainer<string> ipEventArgsContainer)
        {
            var args = new EventArgsContainer<string>(ipEventArgsContainer._data);

            getIPEvent1(this, args);
        }
        private void getPosEvent(object sender, Containers.EventArgsContainer<List<ushort>> posEventArgsContainer)
        {
            //var args = new MyEventArgs<ushort>(posEventArgs._data);

            //getPositionEvent(this, args);

            var list = new List<ushort> { posEventArgsContainer._data[0], posEventArgsContainer._data[1] };

            EventArgsContainer<List<ushort>> argsContainer = new EventArgsContainer<List<ushort>>(list);

            getPositionEvent(this, argsContainer);
        }
 public void getResult(object e, Containers.EventArgsContainer<string> s)
 {
     Handle(s._data);
 }
        private void getVolEvent(object sender, Containers.EventArgsContainer<ushort> volEventArgsContainer)
        {
            var args = new EventArgsContainer<ushort>(volEventArgsContainer._data);

            VolumeUpdateEvent(this, args);
        }