internal Resource(string fullName, ResourceKind kind, Stream stream) { FullName = fullName; Kind = kind; Stream = stream; Binary = this is BinaryResource; }
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()); }
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>(); } }
/// <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); }
public TransmuteOrder(ActorController actor, NeolithicObject target, ResourceKind fromResourceKind, ResourceKind toResourceKind) { this.fromResourceKind = fromResourceKind; this.toResourceKind = toResourceKind; this.target = target; GoToState(cGetSourceMaterial, actor); }
public ResourceBindingInfo(uint slot, ShaderStages stages, ResourceKind kind, bool dynamicBuffer) { Slot = slot; Stages = stages; Kind = kind; DynamicBuffer = dynamicBuffer; }
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); }
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(); } }
internal Resource(string fullName, ResourceKind kind, Stream stream) { FullName = fullName; Kind = kind; Stream = stream; Binary = this is BinaryResource; }
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()); }
/// <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; }
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); }
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(); } }
private void OnResourcesChange(ResourceKind kind, int value) { if (kind == _kind) { _value.text = AppModel.Player().Backpack.Resources[_kind].ToString(); } }
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(); } }
/// <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(); }
/// <summary> /// Initializes a new instance of the Equipment class /// </summary> public Equipment() { SerialID = new IdentificationID(); estimatedArrival = new DateTime(); ResourceKind = new ResourceKind(); EstimatedAvailability = new DateTimeRange(); }
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; }
/// <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; }
/// <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)); }
/// <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; }
/// <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)); }
public ResourceUsage(ResourceKind kind, int value) { if (value < 0) { throw new ArgumentException("Value should be 0 or more"); } this.Kind = kind; this.Value = value; }
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; }
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; }
/// <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; }
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)); }
/// <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"); }
/// <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); }
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); }
/// <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"); }
/// <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); }
internal TextResource(string fullName, ResourceKind kind, Stream stream) : base(fullName, kind, stream) { }