private CloudBlobContainer GetBlobContainer(ContainerType containerType)
        {
            var storageCredentials = new StorageCredentials(this._accountName, this._accountKey);
            var storageAccount     = new CloudStorageAccount(storageCredentials, true);
            var blobClient         = storageAccount.CreateCloudBlobClient();

            return(blobClient.GetContainerReference(containerType.ToString()));
        }
Beispiel #2
0
 private void ValidateAzureVMContainerType(ContainerType type)
 {
     if (type != ContainerType.AzureVM)
     {
         throw new ArgumentException(string.Format(Resources.UnExpectedContainerTypeException,
                                                   ContainerType.AzureVM.ToString(),
                                                   type.ToString()));
     }
 }
Beispiel #3
0
    // Sectors
    public void SetSectorMessage()
    {
        sector_title.SetActive(true);
        sector_text.text = active_container_type.ToString();
        Color color;

        color             = active_container.active_color;
        sector_text.color = color;
    }
Beispiel #4
0
        /// <summary>
        /// Gets an instance of the provider based on the container type and backup management type (optional)
        /// </summary>
        /// <param name="containerType">Type of the container</param>
        /// <param name="backupManagementType">Type of the backup management type (optional)</param>
        /// <returns></returns>
        public IPsBackupProvider GetProviderInstance
        (
            ContainerType containerType,
            BackupManagementType?backupManagementType
        )
        {
            PsBackupProviderTypes providerType = 0;

            switch (containerType)
            {
            case ContainerType.AzureVM:
                if (backupManagementType == BackupManagementType.AzureVM || backupManagementType == null)
                {
                    providerType = PsBackupProviderTypes.IaasVm;
                }
                else
                {
                    throw new ArgumentException(
                              String.Format(Resources.BackupManagementTypeIncorrectForContainerType,
                                            containerType)
                              );
                }
                break;

            case ContainerType.Windows:
                if (backupManagementType == BackupManagementType.MARS)
                {
                    providerType = PsBackupProviderTypes.Mab;
                }
                else if (backupManagementType == null)
                {
                    throw new ArgumentException(
                              String.Format(
                                  Resources.BackupManagementTypeRequiredForContainerType,
                                  containerType)
                              );
                }
                else
                {
                    throw new ArgumentException(
                              String.Format(
                                  Resources.BackupManagementTypeIncorrectForContainerType,
                                  containerType)
                              );
                }
                break;

            default:
                throw new ArgumentException(
                          String.Format(Resources.UnsupportedContainerType,
                                        containerType.ToString())
                          );
            }

            return(GetProviderInstance(providerType));
        }
Beispiel #5
0
        static CloudBlobContainer GetContainer(ContainerType containerType)
        {
            var account = CloudStorageAccount.Parse(App.Current.Properties["connectionString"].ToString());

            Debug.WriteLine("Account Created");
            var client = account.CreateCloudBlobClient();

            Debug.WriteLine(client.ToString());
            return(client.GetContainerReference(containerType.ToString().ToLower()));
        }
Beispiel #6
0
 /// <param name="containerName">Имя контейнера должно быть меньше 256 символов и не содержать завершающего слеша '/' в конце.</param>
 /// <param name="customHeaders">Произвольные мета-данные через передачу заголовков с префиксом X-Container-Meta-.</param>
 /// <param name="type">X-Container-Meta-Type: Тип контейнера (public, private, gallery)</param>
 public UpdateContainerMetaRequest(
     string containerName,
     ContainerType type = ContainerType.Private,
     IDictionary <string, object> customHeaders = null,
     CORSHeaders corsHeaders = null)
     : base(containerName)
 {
     customHeaders.Add(HeaderKeys.XContainerMetaType, type.ToString().ToLower());
     SetCustomHeaders(customHeaders);
     SetCORSHeaders(corsHeaders);
 }
Beispiel #7
0
        public async Task <string> UploadFileAsync(ContainerType containerType, Stream stream)
        {
            var container = _client.GetContainerReference(containerType.ToString().ToLower());
            await container.CreateIfNotExistsAsync();

            var name     = Guid.NewGuid().ToString();
            var fileBlob = container.GetBlockBlobReference(name);
            await fileBlob.UploadFromStreamAsync(stream);

            return(name);
        }
Beispiel #8
0
        /// <summary>
        /// Adds a container to the linkcollector list.
        /// </summary>
        /// <param name="type">The value can be: DLC, RSDF, CCF or CRAWLJOB</param>
        /// <param name="content">File as dataurl. https://de.wikipedia.org/wiki/Data-URL </param>
        public async Task AddContainer(ContainerType type, string content)
        {
            var containerObject = new AddContainerObject
            {
                Type    = type.ToString(),
                Content = content
            };
            var json  = JsonConvert.SerializeObject(containerObject);
            var param = new[] { json };

            await CallAction <object>("addContainer", param);
        }
        private void WriteStart(ContainerType containerType, string propertyName)
        {
            var containerString = containerType.ToString();

            if (string.IsNullOrWhiteSpace(propertyName))
            {
                writer.WriteLine($"output.WriteStart{containerString}();");
            }
            else
            {
                writer.WriteLine($"output.WriteStart{containerString}(\"{propertyName}\");");
            }
        }
Beispiel #10
0
 public async Task DeleteAsync(string fileName, ContainerType containerType)
 {
     try
     {
         var containerClient = _blobServiceClient.GetBlobContainerClient(containerType.ToString());
         var blobClient      = containerClient.GetBlobClient(fileName);
         await blobClient.DeleteAsync();
     }
     catch (Exception exception)
     {
         throw new Exception(exception.Message);
     }
 }
Beispiel #11
0
        public async Task <Stream> DownloadAsync(string fileName, ContainerType containerType)
        {
            try
            {
                var containerClient = _blobServiceClient.GetBlobContainerClient(containerType.ToString());
                var blobClient      = containerClient.GetBlobClient(fileName);
                var contentInfo     = await blobClient.DownloadAsync();

                return(contentInfo.Value.Content);
            }
            catch (Exception exception)
            {
                throw new Exception(exception.Message);
            }
        }
Beispiel #12
0
        /// <summary>
        /// Adds a container to the linkcollector list.
        /// </summary>
        /// <param name="type">The value can be: DLC, RSDF, CCF or CRAWLJOB</param>
        /// <param name="content">File as dataurl. https://de.wikipedia.org/wiki/Data-URL </param>
        public bool AddContainer(ContainerType type, string content)
        {
            AddContainerObject containerObject = new AddContainerObject
            {
                Type    = type.ToString(),
                Content = content
            };

            var json     = JsonConvert.SerializeObject(containerObject);
            var param    = new[] { json };
            var response = ApiHandler.CallAction <object>(Device, "/linkgrabberv2/addContainer",
                                                          param, JDownloaderHandler.LoginObject);

            return(response != null);
        }
        /// <param name="containerName">Имя контейнера должно быть меньше 256 символов и не содержать завершающего слеша '/' в конце.</param>
        /// <param name="customHeaders">Произвольные мета-данные через передачу заголовков с префиксом X-Container-Meta-.</param>
        /// <param name="type">X-Container-Meta-Type: Тип контейнера (public, private, gallery)</param>
        /// <param name="corsHeaders">Дополнительные заголовки кэшировани и CORS</param>
        public CreateContainerRequest(
            string containerName,
            ContainerType type = ContainerType.Private,
            Dictionary <string, object> customHeaders = null,
            CorsHeaders corsHeaders = null)
            : base(containerName)
        {
            if (customHeaders == null)
            {
                customHeaders = new Dictionary <string, object>();
            }

            customHeaders.Add(HeaderKeys.XContainerMetaType, type.ToString().ToLower());

            SetCustomHeaders(customHeaders);
            SetCorsHeaders(corsHeaders);
        }
Beispiel #14
0
        public async Task UploadAsync(Stream stream, string fileName, ContainerType containerType)
        {
            try
            {
                var containerClient = _blobServiceClient.GetBlobContainerClient(containerType.ToString());
                await containerClient.CreateIfNotExistsAsync();

                await containerClient.SetAccessPolicyAsync(Azure.Storage.Blobs.Models.PublicAccessType.BlobContainer);

                var blobClient  = containerClient.GetBlobClient(fileName);
                var contentInfo = await blobClient.UploadAsync(stream);
            }
            catch (Exception exception)
            {
                throw new Exception(exception.Message);
            }
        }
Beispiel #15
0
        public async Task <byte[]> GetFileAsync(ContainerType containerType, string name)
        {
            var container = _client.GetContainerReference(containerType.ToString().ToLower());

            var blob = container.GetBlobReference(name);

            if (await blob.ExistsAsync())
            {
                await blob.FetchAttributesAsync();

                byte[] blobBytes = new byte[blob.Properties.Length];

                await blob.DownloadToByteArrayAsync(blobBytes, 0);

                return(blobBytes);
            }
            return(null);
        }
Beispiel #16
0
 public List <string> GetNames(ContainerType containerType)
 {
     try
     {
         var blobNames       = new List <string>();
         var containerClient = _blobServiceClient.GetBlobContainerClient(containerType.ToString());
         var blobs           = containerClient.GetBlobs();
         blobs.ToList().ForEach(x =>
         {
             blobNames.Add(x.Name);
         });
         return(blobNames);
     }
     catch (Exception exception)
     {
         throw new Exception(exception.Message);
     }
 }
Beispiel #17
0
        public async Task <IList <string> > GetFilesListAsync(ContainerType containerType)
        {
            var container = _client.GetContainerReference(containerType.ToString().ToLower());

            var allBlobsList            = new List <string>();
            BlobContinuationToken token = null;

            do
            {
                var result = await container.ListBlobsSegmentedAsync(token);

                if (result.Results.Any())
                {
                    var blobs = result.Results.Cast <CloudBlockBlob>().Select(b => b.Name);
                    allBlobsList.AddRange(blobs);
                }
                token = result.ContinuationToken;
            } while (token != null);

            return(allBlobsList);
        }
Beispiel #18
0
        private static void CheckContainerType(ContainerType containerType)
        {
            switch (containerType)
            {
            case ContainerType.Box:
            case ContainerType.Building:
            case ContainerType.Floor:
            case ContainerType.Freezer:
            case ContainerType.Refrigerator:
            case ContainerType.Room:
            case ContainerType.Shelf:
            case ContainerType.TopLevel:
            case ContainerType.Uncontained:
                // OK to create container.
                break;

            default:
                throw new DataArgumentException("Not supported container type " +
                                                containerType.ToString(),
                                                "containerType");
            }
        }
Beispiel #19
0
        public override IDictionary <string, object> GetAttributes()
        {
            base.GetAttributes();

            if (this.ContainerType == Enums.ContainerType.Main)
            {
                this.Configuration.Add("role", ContainerType.ToString().ToLower());
            }
            else
            {
                this.Configuration.Add("data-role", ContainerType.ToString().ToLower());
            }

            if (this.IsFixed)
            {
                this.Configuration.Add("data-position", "fixed");
            }

            if (this.IsFullScreen)
            {
                this.Configuration.Add("data-fullscreen", "true");
            }

            if (this.CreateBackButton)
            {
                this.Configuration.Add("data-add-back-btn", "true");
                if (string.IsNullOrEmpty(this.BackButtonText))
                {
                    this.Configuration.Add("data-back-btn-text", "Return");
                }
            }

            if (!string.IsNullOrEmpty(this.BackButtonText))
            {
                this.Configuration.Add("data-back-btn-text", this.BackButtonText);
            }

            return(this.Configuration);
        }
Beispiel #20
0
        public InventoryAddResult AddItem(ContainerType container, Item item, bool newIndex)
        {
            switch (container)
            {
            case ContainerType.BODY:
            case ContainerType.LEFT_BAG:
            case ContainerType.RIGHT_BAG:
            case ContainerType.BACK_BAG:
                List <Item> list  = items[container];
                var         query =
                    from it in list
                    where it.ItemID == item.ItemID && ((it.stack + item.stack) < 99)
                    select it;
                if (query.Count() != 0 && item.Stackable)
                {
                    query.First().stack += item.stack;
                    item.stack = query.First().stack;
                    item.Slot  = query.First().Slot;
                    return(InventoryAddResult.STACKED);
                }
                else
                {
                    list.Add(item);
                    if (newIndex)
                    {
                        item.Slot = index;
                        index++;
                    }
                    return(InventoryAddResult.NEW_INDEX);
                }

            case ContainerType.BACK:
            case ContainerType.CHEST_ACCE:
            case ContainerType.FACE:
            case ContainerType.FACE_ACCE:
            case ContainerType.HEAD:
            case ContainerType.HEAD_ACCE:
            case ContainerType.LEFT_HAND:
            case ContainerType.LOWER_BODY:
            case ContainerType.PET:
            case ContainerType.RIGHT_HAND:
            case ContainerType.SHOES:
            case ContainerType.SOCKS:
            case ContainerType.UPPER_BODY:
                if (equipments.ContainsKey((EnumEquipSlot)Enum.Parse(typeof(EnumEquipSlot), container.ToString())))
                {
                    Logger.ShowDebug("Container:" + container.ToString() + " must be empty before adding item!", Logger.CurrentLogger);
                }
                else
                {
                    equipments.Add((EnumEquipSlot)Enum.Parse(typeof(EnumEquipSlot), container.ToString()), item);
                    if (newIndex)
                    {
                        item.Slot = index;
                        index++;
                    }
                }
                return(InventoryAddResult.NEW_INDEX);

            default:
                throw new ArgumentException("Unsupported container!");
            }
        }
Beispiel #21
0
        private void MoveItem(ContainerType src, int ID, ContainerType dst, int count, SearchType type)
        {
            List <Item> list;

            if (src == dst)
            {
                Logger.ShowDebug("Source container is equal to Destination container! Transfer aborted!", Logger.CurrentLogger);
                return;
            }
            switch (src)
            {
            case ContainerType.BODY:
            case ContainerType.LEFT_BAG:
            case ContainerType.RIGHT_BAG:
            case ContainerType.BACK_BAG:
                list = items[src];
                break;

            case ContainerType.BACK:
            case ContainerType.CHEST_ACCE:
            case ContainerType.FACE:
            case ContainerType.FACE_ACCE:
            case ContainerType.HEAD:
            case ContainerType.HEAD_ACCE:
            case ContainerType.LEFT_HAND:
            case ContainerType.LOWER_BODY:
            case ContainerType.PET:
            case ContainerType.RIGHT_HAND:
            case ContainerType.SHOES:
            case ContainerType.SOCKS:
            case ContainerType.UPPER_BODY:
                list = new List <Item>();
                list.Add(equipments[(EnumEquipSlot)Enum.Parse(typeof(EnumEquipSlot), src.ToString())]);
                equipments.Remove((EnumEquipSlot)Enum.Parse(typeof(EnumEquipSlot), src.ToString()));
                break;

            default:
                throw new ArgumentException("Unsupported Source Container!");
            }

            List <Item> result = new List <Item>();

            switch (type)
            {
            case SearchType.ITEM_ID:
                var query =
                    from it in list
                    where it.ItemID == ID
                    select it;
                result = query.ToList();
                break;

            case SearchType.SLOT_ID:
                var query1 =
                    from it in list
                    where it.Slot == ID
                    select it;
                result = query1.ToList();
                break;
            }
            if (result.Count == 0)
            {
                throw new ArgumentException("The source container doesn't contain such item");
            }
            else
            {
                Item oldItem = result.First();
                Item newItem = oldItem.Clone();
                newItem.Slot = oldItem.Slot;
                if (count > oldItem.stack)
                {
                    count = oldItem.stack;
                }
                newItem.stack  = (byte)count;
                oldItem.stack -= (byte)count;
                if (oldItem.stack == 0)
                {
                    list.Remove(oldItem);
                }
                AddItem(dst, newItem, false);
            }
        }
Beispiel #22
0
        private InventoryDeleteResult DeleteItem(ContainerType container, int ID, int count, SearchType type)
        {
            switch (container)
            {
            case ContainerType.BODY:
            case ContainerType.LEFT_BAG:
            case ContainerType.RIGHT_BAG:
            case ContainerType.BACK_BAG:
                List <Item> list   = items[container];
                List <Item> result = new List <Item>();
                switch (type)
                {
                case SearchType.ITEM_ID:
                    var query =
                        from it in list
                        where it.ItemID == ID
                        select it;
                    result = query.ToList();
                    break;

                case SearchType.SLOT_ID:
                    var query1 =
                        from it in list
                        where it.Slot == ID
                        select it;
                    result = query1.ToList();
                    break;
                }
                if (result.Count() == 0)
                {
                    throw new ArgumentException("No such item");
                }
                Item item = result.First();
                if (item.stack > count)
                {
                    item.stack -= (byte)count;
                    return(InventoryDeleteResult.STACK_UPDATED);
                }
                else
                {
                    int rest = count - item.stack;
                    list.Remove(item);
                    return(InventoryDeleteResult.ALL_DELETED);
                }

            case ContainerType.BACK:
            case ContainerType.CHEST_ACCE:
            case ContainerType.FACE:
            case ContainerType.FACE_ACCE:
            case ContainerType.HEAD:
            case ContainerType.HEAD_ACCE:
            case ContainerType.LEFT_HAND:
            case ContainerType.LOWER_BODY:
            case ContainerType.PET:
            case ContainerType.RIGHT_HAND:
            case ContainerType.SHOES:
            case ContainerType.SOCKS:
            case ContainerType.UPPER_BODY:
                equipments.Remove((EnumEquipSlot)Enum.Parse(typeof(EnumEquipSlot), container.ToString()));
                return(InventoryDeleteResult.ALL_DELETED);
            }
            return(InventoryDeleteResult.ALL_DELETED);
        }
Beispiel #23
0
        public async Task <bool> DeleteContainerAsync(ContainerType containerType)
        {
            var container = _client.GetContainerReference(containerType.ToString().ToLower());

            return(await container.DeleteIfExistsAsync());
        }
Beispiel #24
0
        private void MoveItem(ContainerType src, int ID, ContainerType dst, int count, SearchType type)
        {
            List<Item> list;
            if (src == dst)
            {
                Logger.ShowDebug("Source container is equal to Destination container! Transfer aborted!", Logger.CurrentLogger);
                return;
            }
            switch (src)
            {
                case ContainerType.BODY:
                case ContainerType.LEFT_BAG:
                case ContainerType.RIGHT_BAG:
                case ContainerType.BACK_BAG:
                    list = items[src];
                    break;
                case ContainerType.BACK:
                case ContainerType.CHEST_ACCE:
                case ContainerType.FACE:
                case ContainerType.FACE_ACCE:
                case ContainerType.HEAD:
                case ContainerType.HEAD_ACCE:
                case ContainerType.LEFT_HAND:
                case ContainerType.LOWER_BODY:
                case ContainerType.PET:
                case ContainerType.RIGHT_HAND:
                case ContainerType.SHOES:
                case ContainerType.SOCKS:
                case ContainerType.UPPER_BODY:
                    list = new List<Item>();
                    list.Add(equipments[(EnumEquipSlot)Enum.Parse(typeof(EnumEquipSlot), src.ToString())]);
                    equipments.Remove((EnumEquipSlot)Enum.Parse(typeof(EnumEquipSlot), src.ToString()));
                    break;
                default:
                    throw new ArgumentException("Unsupported Source Container!");
            }

            List<Item> result = new List<Item>();
            switch (type)
            {
                case SearchType.ITEM_ID:
                    var query =
                              from it in list
                              where it.ItemID == ID
                              select it;
                    result = query.ToList();
                    break;
                case SearchType.SLOT_ID:
                    var query1 =
                            from it in list
                            where it.Slot == ID
                            select it;
                    result = query1.ToList();
                    break;
            }
            if (result.Count == 0)
            {
                throw new ArgumentException("The source container doesn't contain such item");
            }
            else
            {
                Item oldItem = result.First();
                Item newItem = oldItem.Clone();
                newItem.Slot = oldItem.Slot;
                if (count > oldItem.stack)
                    count = oldItem.stack;
                newItem.stack = (byte)count;
                oldItem.stack -= (byte)count;
                if (oldItem.stack == 0)
                    list.Remove(oldItem);
                AddItem(dst, newItem, false);
            }
        }
Beispiel #25
0
 public override string ToString()
 {
     return(ContainerType.ToString() + " " + ContainerWeight.ToString());
 }
        public static void HandleDebugEchoFlags(Session session, params string[] parameters)
        {
            try
            {
                if (parameters?.Length == 2)
                {
                    var debugOutput = "";
                    switch (parameters[0].ToLower())
                    {
                    case "descriptionflags":
                        ObjectDescriptionFlag objectDescFlag = new ObjectDescriptionFlag();
                        objectDescFlag = (ObjectDescriptionFlag)Convert.ToUInt32(parameters[1]);

                        debugOutput = $"{objectDescFlag.GetType().Name} = {objectDescFlag.ToString()}" + " (" + (uint)objectDescFlag + ")";
                        break;

                    case "weenieflags":
                        WeenieHeaderFlag weenieHdr = new WeenieHeaderFlag();
                        weenieHdr = (WeenieHeaderFlag)Convert.ToUInt32(parameters[1]);

                        debugOutput = $"{weenieHdr.GetType().Name} = {weenieHdr.ToString()}" + " (" + (uint)weenieHdr + ")";
                        break;

                    case "weenieflags2":
                        WeenieHeaderFlag2 weenieHdr2 = new WeenieHeaderFlag2();
                        weenieHdr2 = (WeenieHeaderFlag2)Convert.ToUInt32(parameters[1]);

                        debugOutput = $"{weenieHdr2.GetType().Name} = {weenieHdr2.ToString()}" + " (" + (uint)weenieHdr2 + ")";
                        break;

                    case "positionflag":
                        UpdatePositionFlag posFlag = new UpdatePositionFlag();
                        posFlag = (UpdatePositionFlag)Convert.ToUInt32(parameters[1]);

                        debugOutput = $"{posFlag.GetType().Name} = {posFlag.ToString()}" + " (" + (uint)posFlag + ")";
                        break;

                    case "type":
                        ItemType objectType = new ItemType();
                        objectType = (ItemType)Convert.ToUInt32(parameters[1]);

                        debugOutput = $"{objectType.GetType().Name} = {objectType.ToString()}" + " (" + (uint)objectType + ")";
                        break;

                    case "containertype":
                        ContainerType contType = new ContainerType();
                        contType = (ContainerType)Convert.ToUInt32(parameters[1]);

                        debugOutput = $"{contType.GetType().Name} = {contType.ToString()}" + " (" + (uint)contType + ")";
                        break;

                    case "usable":
                        Usable usableType = new Usable();
                        usableType = (Usable)Convert.ToInt64(parameters[1]);

                        debugOutput = $"{usableType.GetType().Name} = {usableType.ToString()}" + " (" + (Int64)usableType + ")";
                        break;

                    case "radarbehavior":
                        RadarBehavior radarBeh = new RadarBehavior();
                        radarBeh = (RadarBehavior)Convert.ToUInt32(parameters[1]);

                        debugOutput = $"{radarBeh.GetType().Name} = {radarBeh.ToString()}" + " (" + (uint)radarBeh + ")";
                        break;

                    case "physicsdescriptionflags":
                        PhysicsDescriptionFlag physicsDescFlag = new PhysicsDescriptionFlag();
                        physicsDescFlag = (PhysicsDescriptionFlag)Convert.ToUInt32(parameters[1]);

                        debugOutput = $"{physicsDescFlag.GetType().Name} = {physicsDescFlag.ToString()}" + " (" + (uint)physicsDescFlag + ")";
                        break;

                    case "physicsstate":
                        PhysicsState physState = new PhysicsState();
                        physState = (PhysicsState)Convert.ToUInt32(parameters[1]);

                        debugOutput = $"{physState.GetType().Name} = {physState.ToString()}" + " (" + (uint)physState + ")";
                        break;

                    case "validlocations":
                        EquipMask locFlags = new EquipMask();
                        locFlags = (EquipMask)Convert.ToUInt32(parameters[1]);

                        debugOutput = $"{locFlags.GetType().Name} = {locFlags.ToString()}" + " (" + (uint)locFlags + ")";
                        break;

                    case "currentwieldedlocation":
                        EquipMask locFlags2 = new EquipMask();
                        locFlags2 = (EquipMask)Convert.ToUInt32(parameters[1]);

                        debugOutput = $"{locFlags2.GetType().Name} = {locFlags2.ToString()}" + " (" + (uint)locFlags2 + ")";
                        break;

                    case "priority":
                        CoverageMask covMask = new CoverageMask();
                        covMask = (CoverageMask)Convert.ToUInt32(parameters[1]);

                        debugOutput = $"{covMask.GetType().Name} = {covMask.ToString()}" + " (" + (uint)covMask + ")";
                        break;

                    case "radarcolor":
                        RadarColor radarBlipColor = new RadarColor();
                        radarBlipColor = (RadarColor)Convert.ToUInt32(parameters[1]);

                        debugOutput = $"{radarBlipColor.GetType().Name} = {radarBlipColor.ToString()}" + " (" + (uint)radarBlipColor + ")";
                        break;

                    default:
                        debugOutput = "No valid type to test";
                        break;
                    }

                    if (session == null)
                    {
                        Console.WriteLine(debugOutput.Replace(", ", " | "));
                    }
                    else
                    {
                        session.Network.EnqueueSend(new GameMessageSystemChat(debugOutput, ChatMessageType.System));
                    }
                }
            }
            catch (Exception)
            {
                string debugOutput = "Exception Error, check input and try again";
                if (session == null)
                {
                    Console.WriteLine(debugOutput.Replace(", ", " | "));
                }
                else
                {
                    session.Network.EnqueueSend(new GameMessageSystemChat(debugOutput, ChatMessageType.System));
                }
            }
        }
Beispiel #27
0
        public List <Item> GetContainer(ContainerType container)
        {
            switch (container)
            {
            case ContainerType.BODY:
            case ContainerType.LEFT_BAG:
            case ContainerType.RIGHT_BAG:
            case ContainerType.BACK_BAG:
                return(items[container]);

            case ContainerType.BACK:
            case ContainerType.CHEST_ACCE:
            case ContainerType.FACE:
            case ContainerType.FACE_ACCE:
            case ContainerType.HEAD:
            case ContainerType.HEAD_ACCE:
            case ContainerType.LEFT_HAND:
            case ContainerType.LOWER_BODY:
            case ContainerType.PET:
            case ContainerType.RIGHT_HAND:
            case ContainerType.SHOES:
            case ContainerType.SOCKS:
            case ContainerType.UPPER_BODY:
                Item        item;
                List <Item> newList = new List <Item>();
                if (equipments.ContainsKey((EnumEquipSlot)Enum.Parse(typeof(EnumEquipSlot), container.ToString())))
                {
                    item = equipments[(EnumEquipSlot)Enum.Parse(typeof(EnumEquipSlot), container.ToString())];
                    newList.Add(item);
                }
                return(newList);

            default:
                return(new List <Item>());
            }
        }
Beispiel #28
0
 internal static string GetTypeTagName(ContainerType type)
 {
     return(type.ToString().ToLower());
 }
Beispiel #29
0
 public List<Item> GetContainer(ContainerType container)
 {
     switch (container)
     {
         case ContainerType.BODY:
         case ContainerType.LEFT_BAG:
         case ContainerType.RIGHT_BAG:
         case ContainerType.BACK_BAG:
             return items[container];
         case ContainerType.BACK:
         case ContainerType.CHEST_ACCE:
         case ContainerType.FACE:
         case ContainerType.FACE_ACCE:
         case ContainerType.HEAD:
         case ContainerType.HEAD_ACCE:
         case ContainerType.LEFT_HAND:
         case ContainerType.LOWER_BODY:
         case ContainerType.PET:
         case ContainerType.RIGHT_HAND:
         case ContainerType.SHOES:
         case ContainerType.SOCKS:
         case ContainerType.UPPER_BODY:
             Item item;
             List<Item> newList = new List<Item>();
             if (equipments.ContainsKey((EnumEquipSlot)Enum.Parse(typeof(EnumEquipSlot), container.ToString())))
             {
                 item = equipments[(EnumEquipSlot)Enum.Parse(typeof(EnumEquipSlot), container.ToString())];
                 newList.Add(item);
             }
             return newList;
         default:
             return new List<Item>();
     }
 }
Beispiel #30
0
 private InventoryDeleteResult DeleteItem(ContainerType container, int ID, int count, SearchType type)
 {
     switch (container)
     {
         case ContainerType.BODY:
         case ContainerType.LEFT_BAG:
         case ContainerType.RIGHT_BAG:
         case ContainerType.BACK_BAG:
             List<Item> list = items[container];
             List<Item> result = new List<Item>();
             switch (type)
             {
                 case SearchType.ITEM_ID:
                     var query =
                               from it in list
                               where it.ItemID == ID
                               select it;
                     result = query.ToList();
                     break;
                 case SearchType.SLOT_ID:
                     var query1 =
                             from it in list
                             where it.Slot == ID
                             select it;
                     result = query1.ToList();
                     break;
             }
             if (result.Count() == 0)
             {
                 throw new ArgumentException("No such item");
             }
             Item item = result.First();
             if (item.stack > count)
             {
                 item.stack -= (byte)count;
                 return InventoryDeleteResult.STACK_UPDATED;
             }
             else
             {
                 int rest = count - item.stack;
                 list.Remove(item);
                 return InventoryDeleteResult.ALL_DELETED;
             }
         case ContainerType.BACK:
         case ContainerType.CHEST_ACCE:
         case ContainerType.FACE:
         case ContainerType.FACE_ACCE:
         case ContainerType.HEAD:
         case ContainerType.HEAD_ACCE:
         case ContainerType.LEFT_HAND:
         case ContainerType.LOWER_BODY:
         case ContainerType.PET:
         case ContainerType.RIGHT_HAND:
         case ContainerType.SHOES:
         case ContainerType.SOCKS:
         case ContainerType.UPPER_BODY:
             equipments.Remove((EnumEquipSlot)Enum.Parse(typeof(EnumEquipSlot), container.ToString()));
             return InventoryDeleteResult.ALL_DELETED;
     }
     return InventoryDeleteResult.ALL_DELETED;
 }
Beispiel #31
0
        static BlobContainerClient GetContainer(ContainerType containerType)
        {
            string storageConnectionstring = string.Empty; // read from application settings

            storageConnectionstring = "DefaultEndpointsProtocol=https;AccountName=fbmdevstorageaccount;AccountKey=CnffIaECGNR1u12oDlMw8B0h6jxSX/tq7up+Lugi5ZAIu7VLLKAIsJgrgKE1Y/DCXF5OQiGLsKHRNDJnYvgeog==;EndpointSuffix=core.windows.net";
            //var account = CloudStorageAccount.Parse(storageConnectionstring);
            BlobContainerClient containerClient = new BlobContainerClient(storageConnectionstring, containerType.ToString().ToLower());

            containerClient.CreateIfNotExists();
            //CloudBlobClient client = account.CreateCloudBlobClient();
            return(containerClient);//.GetContainerReference(containerType.ToString().ToLower());
        }
Beispiel #32
0
 public override string ToString()
 {
     return("Type: " + ContainerType.ToString() + " | Ton: " + GetTonWeight());
 }
        /// <summary>
        /// Gets an instance of the provider based on the container type and backup management type (optional)
        /// </summary>
        /// <param name="containerType">Type of the container</param>
        /// <param name="backupManagementType">Type of the backup management type (optional)</param>
        /// <returns></returns>
        public IPsBackupProvider GetProviderInstance
            (
            ContainerType containerType, 
            BackupManagementType? backupManagementType
            )
        {
            PsBackupProviderTypes providerType = 0;

            switch (containerType)
            {
                case ContainerType.AzureVM:
                    if (backupManagementType == BackupManagementType.AzureVM || backupManagementType == null)
                        providerType = PsBackupProviderTypes.IaasVm;
                    else
                        throw new ArgumentException(
                            String.Format(Resources.BackupManagementTypeIncorrectForContainerType, 
                            containerType)
                            );
                    break;
                case ContainerType.Windows:
                    if (backupManagementType == BackupManagementType.MARS)
                        providerType = PsBackupProviderTypes.Mab;
                    else if (backupManagementType == null)
                        throw new ArgumentException(
                            String.Format(
                            Resources.BackupManagementTypeRequiredForContainerType, 
                            containerType)
                            );
                    else
                        throw new ArgumentException(
                            String.Format(
                            Resources.BackupManagementTypeIncorrectForContainerType, 
                            containerType)
                            );
                    break;
                default:
                    throw new ArgumentException(
                        String.Format(Resources.UnsupportedContainerType, 
                        containerType.ToString())
                        );
            }

            return GetProviderInstance(providerType);
        }
Beispiel #34
0
 public InventoryAddResult AddItem(ContainerType container, Item item, bool newIndex)
 {
     switch (container)
     {
         case ContainerType.BODY:
         case ContainerType.LEFT_BAG:
         case ContainerType.RIGHT_BAG:
         case ContainerType.BACK_BAG:
             List<Item> list = items[container];
             var query =
                 from it in list
                 where it.ItemID == item.ItemID && ((it.stack + item.stack) < 99)
                 select it;
             if (query.Count() != 0 && item.Stackable)
             {
                 query.First().stack += item.stack;
                 item.stack = query.First().stack;
                 item.Slot = query.First().Slot;
                 return InventoryAddResult.STACKED;
             }
             else
             {
                 list.Add(item);
                 if (newIndex)
                 {
                     item.Slot = index;
                     index++;
                 }
                 return InventoryAddResult.NEW_INDEX;
             }
         case ContainerType.BACK:
         case ContainerType.CHEST_ACCE:
         case ContainerType.FACE:
         case ContainerType.FACE_ACCE:
         case ContainerType.HEAD:
         case ContainerType.HEAD_ACCE:
         case ContainerType.LEFT_HAND:
         case ContainerType.LOWER_BODY:
         case ContainerType.PET:
         case ContainerType.RIGHT_HAND:
         case ContainerType.SHOES:
         case ContainerType.SOCKS:
         case ContainerType.UPPER_BODY:
             if (equipments.ContainsKey((EnumEquipSlot)Enum.Parse(typeof(EnumEquipSlot), container.ToString())))
             {
                 Logger.ShowDebug("Container:" + container.ToString() + " must be empty before adding item!", Logger.CurrentLogger);
             }
             else
             {
                 equipments.Add((EnumEquipSlot)Enum.Parse(typeof(EnumEquipSlot), container.ToString()), item);
                 if (newIndex)
                 {
                     item.Slot = index;
                     index++;
                 }
             }
             return InventoryAddResult.NEW_INDEX;
         default:
             throw new ArgumentException("Unsupported container!");
     }
 }