コード例 #1
0
 internal Resource(string fullName, ResourceKind kind, Stream stream)
 {
     FullName = fullName;
     Kind     = kind;
     Stream   = stream;
     Binary   = this is BinaryResource;
 }
コード例 #2
0
        static void SubmitWorkitem(string inResource, ResourceKind inResourceKind)
        {
            //create a workitem
            var wi = new WorkItem()
            {
                Id = "", //must be set to empty
                Arguments = new Arguments(),
                ActivityId = "PlotToPDF" //PlotToPDF is a predefined activity
            };

            wi.Arguments.InputArguments.Add(new Argument()
            {
                Name = "HostDwg",// Must match the input parameter in activity
                Resource = inResource,
                ResourceKind = inResourceKind,
                StorageProvider = StorageProvider.Generic //Generic HTTP download (as opposed to A360)
            });
            wi.Arguments.OutputArguments.Add(new Argument()
            {
                Name = "Result", //must match the output parameter in activity
                StorageProvider = StorageProvider.Generic, //Generic HTTP upload (as opposed to A360)
                HttpVerb = HttpVerbType.POST, //use HTTP POST when delivering result
                Resource = null //use storage provided by AutoCAD.IO
            });

            container.AddToWorkItems(wi);
            Console.WriteLine("Submitting workitem...");
            container.SaveChanges();

            pollWorkitem(wi, inResourceKind.ToString());

        }
コード例 #3
0
        internal static VkDescriptorType VdToVkDescriptorType(ResourceKind kind, ResourceLayoutElementOptions options)
        {
            bool dynamicBinding = (options & ResourceLayoutElementOptions.DynamicBinding) != 0;

            switch (kind)
            {
            case ResourceKind.UniformBuffer:
                return(dynamicBinding ? VkDescriptorType.UniformBufferDynamic : VkDescriptorType.UniformBuffer);

            case ResourceKind.StructuredBufferReadWrite:
            case ResourceKind.StructuredBufferReadOnly:
                return(dynamicBinding ? VkDescriptorType.StorageBufferDynamic : VkDescriptorType.StorageBuffer);

            case ResourceKind.TextureReadOnly:
                return(VkDescriptorType.SampledImage);

            case ResourceKind.TextureReadWrite:
                return(VkDescriptorType.StorageImage);

            case ResourceKind.Sampler:
                return(VkDescriptorType.Sampler);

            default:
                throw Illegal.Value <ResourceKind>();
            }
        }
コード例 #4
0
        /// <summary>
        /// Finds a resource by a search string. The string can be a partial resource name. If no resource
        /// is found, throws an UnknownResource exception. If more than one resource is found, throws
        /// an AmbiguousResource exception.
        /// <param name="searchString">The case insensitive string to use for the search</param>
        /// <param name="kind">The resource kind to filter results against</param>
        /// </summary>
        public static IResource Find(string searchString, ResourceKind kind = ResourceKind.All)
        {
            if (searchString == null)
            {
                throw new UnknownResource("null");
            }
            var resource = Admin.ResourceAlias.GetByAlias(searchString)?.IResource;

            if (resource != null)
            {
                return(resource);
            }
            if (!RESTarConfig.ResourceFinder.TryGetValue(searchString, out resource))
            {
                throw new UnknownResource(searchString);
            }
            if (resource == null)
            {
                throw new AmbiguousResource(searchString);
            }
            if (!kind.HasFlag(resource.ResourceKind))
            {
                throw new WrongResourceKind(searchString, kind, resource.ResourceKind);
            }
            return(resource);
        }
コード例 #5
0
 public TransmuteOrder(ActorController actor, NeolithicObject target, ResourceKind fromResourceKind, ResourceKind toResourceKind)
 {
     this.fromResourceKind = fromResourceKind;
     this.toResourceKind   = toResourceKind;
     this.target           = target;
     GoToState(cGetSourceMaterial, actor);
 }
コード例 #6
0
 public ResourceBindingInfo(uint slot, ShaderStages stages, ResourceKind kind, bool dynamicBuffer)
 {
     Slot          = slot;
     Stages        = stages;
     Kind          = kind;
     DynamicBuffer = dynamicBuffer;
 }
コード例 #7
0
        protected override void SetProperties(Comment response)
        {
            if (response == null)
            {
                return;
            }

            _rawData = response;
            _id      = response.Id;
            _kind    = response.Kind;

            if (response.Snippet == null)
            {
                return;
            }

            _publishedAt           = response.Snippet.PublishedAt.GetValueOrDefault();
            _authorChannelId       = response.Snippet.AuthorChannelId?.Value;
            _authorChannelUrl      = response.Snippet.AuthorChannelUrl;
            _authorDisplayName     = response.Snippet.AuthorDisplayName;
            _authorProfileImageUrl = response.Snippet.AuthorProfileImageUrl;
            _channelId             = response.Snippet.ChannelId;
            _likeCount             = response.Snippet.LikeCount.GetValueOrDefault();
            _parentId    = response.Snippet.ParentId;
            _textDisplay = response.Snippet.TextDisplay;
            _updatedAt   = response.Snippet.UpdatedAt.GetValueOrDefault();
            _videoId     = response.Snippet.VideoId;

            _url       = GetUrl(_videoId, _id);
            _parentUrl = GetUrl(_videoId, _parentId);
            _videoUrl  = YoutubeVideo.GetUrl(_videoId);
        }
コード例 #8
0
        protected override void SetProperties(ChannelSection response)
        {
            if (response == null)
            {
                return;
            }

            _rawData = response;
            _id      = response.Id;
            _kind    = response.Kind;

            if (response.Snippet != null)
            {
                _channelId = response.Snippet.ChannelId;
                _position  = response.Snippet.Position.GetValueOrDefault();
                _style     = response.Snippet.Style.GetValueOrDefault();
                _title     = response.Snippet.Title;
                _type      = response.Snippet.Type.GetValueOrDefault();
            }

            if (response.ContentDetails != null)
            {
                _channelIds  = response.ContentDetails.Channels?.ToList().AsReadOnly();
                _playlistIds = response.ContentDetails.Playlists?.ToList().AsReadOnly();
            }
        }
コード例 #9
0
		internal Resource(string fullName, ResourceKind kind, Stream stream)
		{
			FullName = fullName;
			Kind = kind;
			Stream = stream;
			Binary = this is BinaryResource;
		}
コード例 #10
0
        static void SubmitWorkitem(string inResource, ResourceKind inResourceKind)
        {
            //create a workitem
            var wi = new WorkItem()
            {
                Id         = "",         //must be set to empty
                Arguments  = new Arguments(),
                ActivityId = "PlotToPDF" //PlotToPDF is a predefined activity
            };

            wi.Arguments.InputArguments.Add(new Argument()
            {
                Name            = "HostDwg",// Must match the input parameter in activity
                Resource        = inResource,
                ResourceKind    = inResourceKind,
                StorageProvider = StorageProvider.Generic //Generic HTTP download (as opposed to A360)
            });
            wi.Arguments.OutputArguments.Add(new Argument()
            {
                Name            = "Result",                //must match the output parameter in activity
                StorageProvider = StorageProvider.Generic, //Generic HTTP upload (as opposed to A360)
                HttpVerb        = HttpVerbType.POST,       //use HTTP POST when delivering result
                Resource        = null                     //use storage provided by AutoCAD.IO
            });

            container.AddToWorkItems(wi);
            Console.WriteLine("Submitting workitem...");
            container.SaveChanges();

            pollWorkitem(wi, inResourceKind.ToString());
        }
コード例 #11
0
 /// <summary>
 /// Initializes a new instance of the Equipment class
 /// </summary>
 /// <param name="id">Equipment ID as string</param>
 /// <param name="arrival">Estimated Arrival DateTime</param>
 /// <param name="res">Resource Type</param>
 /// <param name="estAvail">Estimated Availability, as a DateTime Range</param>
 public Equipment(string id, DateTime arrival, ResourceKind res, DateTimeRange estAvail)
 {
     ID = id;
     estimatedArrival      = arrival.ToUniversalTime();
     ResourceKind          = res;
     EstimatedAvailability = estAvail;
 }
コード例 #12
0
ファイル: MplsAllocationSolver.cs プロジェクト: mpls-fse/mpls
        private Dictionary <ResourceKind, AllocationMetric[]> CaptureMetrics()
        {
            Dictionary <ResourceKind, AllocationMetric[]> metricsPerResource = new Dictionary <ResourceKind, AllocationMetric[]>();

            for (int k = 0; k < this.ResourceCount; k++)
            {
                AllocationMetric[] metrics      = new AllocationMetric[this.Rows];
                ResourceKind       resourceKind = this.parameters.OptimizeResources[k];
                metricsPerResource[resourceKind] = metrics;

                for (int i = 0; i < metrics.Length; i++)
                {
                    Machine machine = this.parameters.Machines[i];
                    metrics[i] = new AllocationMetric
                    {
                        Index          = i,
                        MachineName    = machine.Name,
                        Resource       = resourceKind,
                        Allocated      = this.SumRow(this.containerCoefficientsPerResource[k], i),
                        TotalAvailable = this.machineConstraintsPerResource[k][i]
                    };
                }
            }

            return(metricsPerResource);
        }
コード例 #13
0
        protected override void SetProperties(Channel response)
        {
            if (response == null)
            {
                return;
            }

            _rawData = response;
            _id      = response.Id;
            _kind    = response.Kind;
            _url     = GetUrl(response.Id);

            if (response.Snippet != null)
            {
                _title       = response.Snippet.Title;
                _description = response.Snippet.Description;
                _customUrl   = GetUrl(response.Snippet.CustomUrl, true);
                _publishedAt = response.Snippet.PublishedAt.GetValueOrDefault();
                _thumbnails  = response.Snippet.Thumbnails?.Clone();
                _thumbnails?.TryGetValue(ThumbnailSize.Default, out _defaultThumbnail);
            }

            if (response.ContentDetails != null)
            {
                _uploadsPlaylistId = response.ContentDetails.RelatedPlaylists?.Uploads;
            }

            if (response.Statistics != null)
            {
                _subscriberCount = response.Statistics.SubscriberCount.GetValueOrDefault();
                _uploadsCount    = response.Statistics.VideoCount.GetValueOrDefault();
                _viewCount       = response.Statistics.ViewCount.GetValueOrDefault();
                _commentCount    = response.Statistics.CommentCount.GetValueOrDefault();
            }
        }
コード例 #14
0
 private void OnResourcesChange(ResourceKind kind, int value)
 {
     if (kind == _kind)
     {
         _value.text = AppModel.Player().Backpack.Resources[_kind].ToString();
     }
 }
コード例 #15
0
        protected override void SetProperties(Playlist response)
        {
            if (response == null)
            {
                return;
            }

            _rawData = response;
            _id      = response.Id;
            _kind    = response.Kind;
            _url     = GetUrl(response.Id);

            if (response.Snippet != null)
            {
                _publishedAt  = response.Snippet.PublishedAt.GetValueOrDefault();
                _channelId    = response.Snippet.ChannelId;
                _title        = response.Snippet.Title;
                _description  = response.Snippet.Description;
                _channelTitle = response.Snippet.ChannelTitle;
                _thumbnails   = response.Snippet.Thumbnails?.Clone();
                _thumbnails?.TryGetValue(ThumbnailSize.Default, out _defaultThumbnail);
            }

            if (response.ContentDetails != null)
            {
                _itemCount = response.ContentDetails.ItemCount.GetValueOrDefault();
            }
        }
コード例 #16
0
 /// <summary>
 /// Initializes a new instance of the Equipment class
 /// </summary>
 /// <param name="id">Equipment ID as string</param>
 /// <param name="arrival">Estimated Arrival DateTime</param>
 public Equipment(string id, DateTime arrival)
 {
     ID = id;
     estimatedArrival      = arrival.ToUniversalTime();
     ResourceKind          = new ResourceKind();
     EstimatedAvailability = new DateTimeRange();
 }
コード例 #17
0
 /// <summary>
 /// Initializes a new instance of the Equipment class
 /// </summary>
 public Equipment()
 {
     SerialID              = new IdentificationID();
     estimatedArrival      = new DateTime();
     ResourceKind          = new ResourceKind();
     EstimatedAvailability = new DateTimeRange();
 }
コード例 #18
0
        protected override void SetProperties(Caption response)
        {
            if (response == null)
            {
                return;
            }

            _rawData = response;
            _id      = response.Id;
            _kind    = response.Kind;

            if (response.Snippet == null)
            {
                return;
            }

            _audioTrackType = response.Snippet.AudioTrackType.GetValueOrDefault();
            _isAutoSynced   = response.Snippet.IsAutoSynced.GetValueOrDefault();
            _isCc           = response.Snippet.IsCC.GetValueOrDefault();
            _isEasyReader   = response.Snippet.IsEasyReader.GetValueOrDefault();
            _isLarge        = response.Snippet.IsLarge.GetValueOrDefault();
            _language       = response.Snippet.Language;
            _lastUpdated    = response.Snippet.LastUpdated.GetValueOrDefault();
            _name           = response.Snippet.Name;
            _type           = response.Snippet.TrackKind.GetValueOrDefault();
            _videoId        = response.Snippet.VideoId;
        }
コード例 #19
0
 /// <summary>
 /// Constructs a new ResourceLayoutElementDescription.
 /// </summary>
 /// <param name="name">The name of the element.</param>
 /// <param name="kind">The kind of resource.</param>
 /// <param name="stages">The <see cref="ShaderStages"/> in which this element is used.</param>
 public ResourceLayoutElementDescription(string name, ResourceKind kind, ShaderStages stages)
 {
     Name    = name;
     Kind    = kind;
     Stages  = stages;
     Options = ResourceLayoutElementOptions.None;
 }
コード例 #20
0
 /// <summary>
 /// Gets total contents without reservations on them (for the given tag)
 /// </summary>
 /// <param name="resourceTag"></param>
 /// <returns></returns>
 public double GetUnclaimedContents(ResourceKind resourceKind)
 {
     if (!enabled)
     {
         return(0);
     }
     return(GetTotalContents(resourceKind) - GetClaimedContents(resourceKind));
 }
コード例 #21
0
 /// <summary>
 /// Constructs a new ResourceLayoutElementDescription.
 /// </summary>
 /// <param name="name">The name of the element.</param>
 /// <param name="kind">The kind of resource.</param>
 /// <param name="stages">The <see cref="ShaderStages"/> in which this element is used.</param>
 /// <param name="descCount">The number of descriptors to use.</param>
 public ResourceLayoutElementDescription(string name, ResourceKind kind, ShaderStages stages, uint descCount)
 {
     Name            = name;
     Kind            = kind;
     Stages          = stages;
     Options         = ResourceLayoutElementOptions.None;
     DescriptorCount = descCount;
 }
コード例 #22
0
 /// <summary>
 /// Gets the total unreserved space currently available for the given resource tag
 /// </summary>
 /// <param name="resourceTag"></param>
 /// <returns></returns>
 public double GetAvailableStorage(ResourceKind resourceKind)
 {
     if (!enabled)
     {
         return(0);
     }
     return(GetTotalStorage(resourceKind) - GetTotalContents(resourceKind) - GetReservedStorage(resourceKind));
 }
コード例 #23
0
        public ResourceUsage(ResourceKind kind, int value)
        {
            if (value < 0)
            {
                throw new ArgumentException("Value should be 0 or more");
            }

            this.Kind  = kind;
            this.Value = value;
        }
コード例 #24
0
ファイル: Resource.cs プロジェクト: BernieWhite/PSDocs
 protected Resource(ResourceKind kind, string apiVersion, SourceFile source, ResourceMetadata metadata, ResourceHelpInfo info, TSpec spec)
 {
     Kind       = kind;
     ApiVersion = apiVersion;
     Info       = info;
     Source     = source;
     Spec       = spec;
     Id         = ResourceHelper.GetId(source.ModuleName, metadata.Name);
     Metadata   = metadata;
     Name       = metadata.Name;
 }
コード例 #25
0
        public ConvertResourceOrder(ActorController a, ResourceKind fromResourceKind, ResourceKind toResourceKind) : base()
        {
            Resource r = a.GetCarriedResource();

            if (r.resourceKind != fromResourceKind)
            {
                Debug.Log($"Actor does not have resource {fromResourceKind} to convert");
                Failed = true;
            }
            sourceResource      = r;
            this.toResourceKind = toResourceKind;
        }
コード例 #26
0
 /// <summary>
 /// Constructs a new ResourceLayoutElementDescription.
 /// </summary>
 /// <param name="name">The name of the element.</param>
 /// <param name="kind">The kind of resource.</param>
 /// <param name="stages">The <see cref="ShaderStages"/> in which this element is used.</param>
 /// <param name="options">Miscellaneous resource options for this element.</param>
 public ResourceLayoutElementDescription(
     string name,
     ResourceKind kind,
     ShaderStages stages,
     ResourceLayoutElementOptions options)
 {
     Name            = name;
     Kind            = kind;
     Stages          = stages;
     Options         = options;
     DescriptorCount = 1;
 }
コード例 #27
0
        public static YoutubeSearch OfType(this YoutubeSearch search, ResourceKind t)
        {
            if (t != ResourceKind.Video && t != ResourceKind.Playlist && t != ResourceKind.Channel)
            {
                throw new InvalidOperationException();
            }

            var settings = search.Settings.Clone();

            settings.Type = t;
            return(Search(settings));
        }
コード例 #28
0
 /// <summary>
 /// Directly withdraws the specified resource without a reservation
 /// </summary>
 /// <param name="resourceKind"></param>
 /// <param name="amount"></param>
 public void WithdrawContents(ResourceKind resourceKind, double amount)
 {
     foreach (ResourceProfile rp in resourceContents)
     {
         if (rp.ResourceKind == resourceKind && rp.Amount >= amount)
         {
             rp.Amount -= amount;
             SendMessage("OnResourceWithdrawn", SendMessageOptions.DontRequireReceiver);
             return;
         }
     }
     throw new InvalidOperationException("Unable to withdraw reservation");
 }
コード例 #29
0
        /// <summary>
        /// Get the total reserved content
        /// </summary>
        /// <param name="resourceKind"></param>
        /// <returns></returns>
        public double GetReservedContents(ResourceKind resourceKind)
        {
            double amount = 0;

            foreach (ResourceReservation r in resourceReservations)
            {
                if (r.resourceKind == resourceKind)
                {
                    amount += r.amount;
                }
            }
            return(amount);
        }
コード例 #30
0
        private ResourceLayout _createLayoutOfResource(string name, ResourceKind resourceKind, ShaderStages shaderStages)
        {
            var resourceLayoutDescription = new ResourceLayoutDescription(new ResourceLayoutElementDescription[]
            {
                new ResourceLayoutElementDescription(name, resourceKind, shaderStages),
            });

            var resourceLayout = _resourceFactory.CreateResourceLayout(resourceLayoutDescription);

            _resourceLayouts.Add(resourceLayout);

            return(resourceLayout);
        }
コード例 #31
0
 /// <summary>
 /// Creates a new resource pile
 /// </summary>
 /// <param name="resourceKind"></param>
 /// <param name="amount"></param>
 /// <returns>A reference to the new pile's GameObject</returns>
 public Resource CreateResourcePile(ResourceKind resourceKind, double amount)
 {
     foreach (Resource g in resourcePrefabs)
     {
         if (g.resourceKind == resourceKind)
         {
             GameObject pile = Factory.Instantiate(g.gameObject);
             Resource   r    = pile.GetComponent <Resource>();
             r.amount = amount;
             return(r);
         }
     }
     throw new ArgumentException(string.Format("Unable to locate prefab for resource tag {0}", resourceKind), "resourceKind");
 }
コード例 #32
0
 /// <summary>
 /// Gets the amount of the given resource, whether reserved or not
 /// </summary>
 /// <param name="resourceKind"></param>
 /// <returns>Total deposited resources for the given tag</returns>
 public double GetTotalContents(ResourceKind resourceKind)
 {
     if (!enabled)
     {
         return(0);
     }
     foreach (ResourceProfile rp in resourceContents)
     {
         if (rp.ResourceKind == resourceKind)
         {
             return(rp.Amount);
         }
     }
     return(0);
 }
コード例 #33
0
		internal TextResource(string fullName, ResourceKind kind, Stream stream) :
			base(fullName, kind, stream)
		{

		}