本文整理汇总了C#中AssetType.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# AssetType.ToString方法的具体用法?C# AssetType.ToString怎么用?C# AssetType.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AssetType
的用法示例。
在下文中一共展示了AssetType.ToString方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AssetKey
public AssetKey(AssetType assetType, params string[] tags)
{
AssetType = assetType;
Tags = tags.Select(x => x.ToUpperInvariant()).OrderBy(x => x).ToArray();
var objects = Tags.Concat(new string[] { AssetType.ToString() }).ToArray();
compoundKey = new CompoundKey(objects);
}
示例2: ntfGroupNotice
public ntfGroupNotice(RadegastInstance instance, InstantMessage msg)
: base(NotificationType.GroupNotice)
{
InitializeComponent();
this.instance = instance;
this.msg = msg;
if (msg.BinaryBucket.Length > 18 && msg.BinaryBucket[0] != 0)
{
type = (AssetType)msg.BinaryBucket[1];
destinationFolderID = client.Inventory.FindFolderForType(type);
int icoIndx = InventoryConsole.GetItemImageIndex(type.ToString().ToLower());
if (icoIndx >= 0)
{
icnItem.Image = frmMain.ResourceImages.Images[icoIndx];
icnItem.Visible = true;
}
txtItemName.Text = Utils.BytesToString(msg.BinaryBucket, 18, msg.BinaryBucket.Length - 19);
btnSave.Enabled = true;
btnSave.Visible = icnItem.Visible = txtItemName.Visible = true;
}
string group = string.Empty;
string text = msg.Message.Replace("\n", System.Environment.NewLine);
int pos = msg.Message.IndexOf('|');
string title = msg.Message.Substring(0, pos);
text = text.Remove(0, pos + 1);
if (instance.Groups.ContainsKey(msg.FromAgentID))
{
group = instance.Groups[msg.FromAgentID].Name;
if (instance.Groups[msg.FromAgentID].InsigniaID != UUID.Zero)
{
imgGroup.Init(instance, instance.Groups[msg.FromAgentID].InsigniaID, string.Empty);
}
}
lblTitle.Text = title;
lblSentBy.Text = string.Format("Sent by {0}, {1}", msg.FromAgentName, group);
txtNotice.Text = text;
// Fire off event
NotificationEventArgs args = new NotificationEventArgs(instance);
args.Text = string.Format("{0}{1}{2}{3}{4}",
lblTitle.Text, System.Environment.NewLine,
lblSentBy.Text, System.Environment.NewLine,
txtNotice.Text
);
if (btnSave.Visible == true)
{
args.Buttons.Add(btnSave);
args.Text += string.Format("{0}Attachment: {1}", System.Environment.NewLine, txtItemName.Text);
}
args.Buttons.Add(btnOK);
FireNotificationCallback(args);
}
示例3: ntfGroupNotice
public ntfGroupNotice(RadegastInstance instance, InstantMessage msg)
: base(NotificationType.GroupNotice)
{
InitializeComponent();
Disposed += new System.EventHandler(ntfGroupNotice_Disposed);
this.instance = instance;
this.msg = msg;
client.Groups.GroupProfile += new System.EventHandler<GroupProfileEventArgs>(Groups_GroupProfile);
if (msg.BinaryBucket.Length > 18 && msg.BinaryBucket[0] != 0)
{
type = (AssetType)msg.BinaryBucket[1];
destinationFolderID = client.Inventory.FindFolderForType(type);
int icoIndx = InventoryConsole.GetItemImageIndex(type.ToString().ToLower());
if (icoIndx >= 0)
{
icnItem.Image = frmMain.ResourceImages.Images[icoIndx];
icnItem.Visible = true;
}
txtItemName.Text = Utils.BytesToString(msg.BinaryBucket, 18, msg.BinaryBucket.Length - 19);
btnSave.Enabled = true;
btnSave.Visible = icnItem.Visible = txtItemName.Visible = true;
}
if (msg.BinaryBucket.Length >= 18)
{
groupID = new UUID(msg.BinaryBucket, 2);
}
else
{
groupID = msg.FromAgentID;
}
int pos = msg.Message.IndexOf('|');
string title = msg.Message.Substring(0, pos);
lblTitle.Text = title;
string text = msg.Message.Replace("\n", System.Environment.NewLine);
text = text.Remove(0, pos + 1);
lblSentBy.Text = string.Format("Sent by {0}", msg.FromAgentName);
txtNotice.Text = text;
if (instance.Groups.ContainsKey(groupID))
{
group = instance.Groups[groupID];
ShowNotice();
}
else
{
client.Groups.RequestGroupProfile(groupID);
}
}
示例4: Execute
public override string Execute(string[] args, UUID fromAgentID)
{
if (args.Length != 2)
return "Usage: download [uuid] [assetType]";
Success = false;
AssetID = UUID.Zero;
assetType = AssetType.Unknown;
DownloadHandle.Reset();
if (UUID.TryParse(args[0], out AssetID))
{
int typeInt;
if (Int32.TryParse(args[1], out typeInt) && typeInt >= 0 && typeInt <= 22)
{
assetType = (AssetType)typeInt;
// Start the asset download
Client.Assets.RequestAsset(AssetID, assetType, true, Assets_OnAssetReceived);
if (DownloadHandle.WaitOne(120 * 1000, false))
{
if (Success)
return String.Format("Saved {0}.{1}", AssetID, assetType.ToString().ToLower());
else
return String.Format("Failed to download asset {0}, perhaps {1} is the incorrect asset type?",
AssetID, assetType);
}
else
{
return "Timed out waiting for texture download";
}
}
else
{
return "Usage: download [uuid] [assetType]";
}
}
else
{
return "Usage: download [uuid] [assetType]";
}
}
示例5: Execute
public override string Execute(string[] args, UUID fromAgentID)
{
if (args.Length != 2)
return usage;
Success = false;
AssetID = UUID.Zero;
assetType = AssetType.Unknown;
DownloadHandle.Reset();
if (!UUID.TryParse(args[0], out AssetID))
return usage;
try {
assetType = (AssetType)Enum.Parse(typeof(AssetType), args[1], ignoreCase: true);
} catch (ArgumentException) {
return usage;
}
if (!Enum.IsDefined(typeof(AssetType), assetType))
return usage;
// Start the asset download
Client.Assets.RequestAsset(AssetID, assetType, true, Assets_OnAssetReceived);
if (DownloadHandle.WaitOne(120 * 1000, false))
{
if (Success)
return String.Format("Saved {0}.{1}", AssetID, assetType.ToString().ToLower());
else
return String.Format("Failed to download asset {0}, perhaps {1} is the incorrect asset type?",
AssetID, assetType);
}
else
{
return "Timed out waiting for texture download";
}
}
示例6: RequestAsset
public void RequestAsset(UUID uuid, AssetType assetType, bool priority)
{
m_log.Info("[REQ ASSET]: " + " " + uuid.ToString() + " " + assetType.ToString());
m_user.Assets.RequestAsset(uuid, assetType, priority);
}
示例7: CopyInventoryFolders
/// <summary>
/// This method is called by establishAppearance to copy inventory folders to make
/// copies of Clothing and Bodyparts inventory folders and attaches worn attachments
/// </summary>
private void CopyInventoryFolders(UUID destination, UUID source, AssetType assetType, Dictionary<UUID,UUID> inventoryMap,
AvatarAppearance avatarAppearance)
{
IInventoryService inventoryService = manager.CurrentOrFirstScene.InventoryService;
InventoryFolderBase sourceFolder = inventoryService.GetFolderForType(source, InventoryType.Unknown, assetType);
InventoryFolderBase destinationFolder = inventoryService.GetFolderForType (destination, InventoryType.Unknown, assetType);
if (sourceFolder == null || destinationFolder == null)
throw new Exception("Cannot locate folder(s)");
// Missing source folder? This should *never* be the case
if (sourceFolder.Type != (short)assetType)
{
sourceFolder = new InventoryFolderBase();
sourceFolder.ID = UUID.Random();
if (assetType == AssetType.Clothing) {
sourceFolder.Name = "Clothing";
} else {
sourceFolder.Name = "Body Parts";
}
sourceFolder.Owner = source;
sourceFolder.Type = (short)assetType;
sourceFolder.ParentID = inventoryService.GetRootFolder(source).ID;
sourceFolder.Version = 1;
inventoryService.AddFolder(sourceFolder); // store base record
m_log.ErrorFormat("[RADMIN] Created folder for source {0}", source);
}
// Missing destination folder? This should *never* be the case
if (destinationFolder.Type != (short)assetType)
{
destinationFolder = new InventoryFolderBase();
destinationFolder.ID = UUID.Random();
destinationFolder.Name = assetType.ToString();
destinationFolder.Owner = destination;
destinationFolder.Type = (short)assetType;
destinationFolder.ParentID = inventoryService.GetRootFolder(destination).ID;
destinationFolder.Version = 1;
inventoryService.AddFolder(destinationFolder); // store base record
m_log.ErrorFormat("[RADMIN] Created folder for destination {0}", source);
}
InventoryFolderBase extraFolder;
List<InventoryFolderBase> folders = inventoryService.GetFolderContent(source, sourceFolder.ID).Folders;
foreach (InventoryFolderBase folder in folders)
{
extraFolder = new InventoryFolderBase();
extraFolder.ID = UUID.Random();
extraFolder.Name = folder.Name;
extraFolder.Owner = destination;
extraFolder.Type = folder.Type;
extraFolder.Version = folder.Version;
extraFolder.ParentID = destinationFolder.ID;
inventoryService.AddFolder(extraFolder);
m_log.DebugFormat("[RADMIN] Added folder {0} to folder {1}", extraFolder.ID, sourceFolder.ID);
List<InventoryItemBase> items = inventoryService.GetFolderContent(source, folder.ID).Items;
foreach (InventoryItemBase item in items)
{
InventoryItemBase destinationItem = new InventoryItemBase(UUID.Random(), destination);
destinationItem.Name = item.Name;
destinationItem.Description = item.Description;
destinationItem.InvType = item.InvType;
destinationItem.CreatorId = item.CreatorId;
destinationItem.CreatorData = item.CreatorData;
destinationItem.CreatorIdAsUuid = item.CreatorIdAsUuid;
destinationItem.NextPermissions = item.NextPermissions;
destinationItem.CurrentPermissions = item.CurrentPermissions;
destinationItem.BasePermissions = item.BasePermissions;
destinationItem.EveryOnePermissions = item.EveryOnePermissions;
destinationItem.GroupPermissions = item.GroupPermissions;
destinationItem.AssetType = item.AssetType;
destinationItem.AssetID = item.AssetID;
destinationItem.GroupID = item.GroupID;
destinationItem.GroupOwned = item.GroupOwned;
destinationItem.SalePrice = item.SalePrice;
destinationItem.SaleType = item.SaleType;
destinationItem.Flags = item.Flags;
destinationItem.CreationDate = item.CreationDate;
destinationItem.Folder = extraFolder.ID;
ILLClientInventory inventoryModule = manager.CurrentOrFirstScene.RequestModuleInterface<ILLClientInventory>();
if (inventoryModule != null)
inventoryModule.AddInventoryItem(destinationItem);
inventoryMap.Add(item.ID, destinationItem.ID);
m_log.DebugFormat("[RADMIN]: Added item {0} to folder {1}", destinationItem.ID, extraFolder.ID);
// Attach item, if original is attached
int attachpoint = avatarAppearance.GetAttachpoint(item.ID);
if (attachpoint != 0)
//.........这里部分代码省略.........
示例8: CreateAsset
Asset CreateAsset(AssetType type, UUID assetID, byte[] data)
{
switch (type)
{
case AssetType.Bodypart:
return new AssetBodypart(assetID, data);
case AssetType.Clothing:
return new AssetClothing(assetID, data);
case AssetType.LSLBytecode:
return new AssetScriptBinary(assetID, data);
case AssetType.LSLText:
return new AssetScriptText(assetID, data);
case AssetType.Notecard:
return new AssetNotecard(assetID, data);
case AssetType.Texture:
return new AssetTexture(assetID, data);
case AssetType.Animation:
return new AssetAnimation(assetID, data);
case AssetType.CallingCard:
case AssetType.Folder:
case AssetType.Gesture:
case AssetType.ImageJPEG:
case AssetType.ImageTGA:
case AssetType.Landmark:
case AssetType.LostAndFoundFolder:
case AssetType.Object:
case AssetType.RootFolder:
case AssetType.Simstate:
case AssetType.SnapshotFolder:
case AssetType.Sound:
return new AssetSound(assetID, data);
case AssetType.SoundWAV:
case AssetType.TextureTGA:
case AssetType.TrashFolder:
case AssetType.Unknown:
default:
Logger.Log("Asset type " + type.ToString() + " not implemented!", Helpers.LogLevel.Warning);
return null;
}
}
示例9: ntfInventoryOffer
public ntfInventoryOffer(RadegastInstance instance, InstantMessage msg)
: base(NotificationType.InventoryOffer)
{
InitializeComponent();
Disposed += new EventHandler(ntfInventoryOffer_Disposed);
this.instance = instance;
this.msg = msg;
instance.Names.NameUpdated += new EventHandler<UUIDNameReplyEventArgs>(Avatars_UUIDNameReply);
if (msg.BinaryBucket.Length > 0)
{
type = (AssetType)msg.BinaryBucket[0];
destinationFolderID = client.Inventory.FindFolderForType(type);
if (msg.BinaryBucket.Length == 17)
{
objectID = new UUID(msg.BinaryBucket, 1);
}
if (msg.Dialog == InstantMessageDialog.InventoryOffered)
{
txtInfo.Text = string.Format("{0} has offered you {1} \"{2}\".", msg.FromAgentName, type.ToString(), msg.Message);
}
else if (msg.Dialog == InstantMessageDialog.TaskInventoryOffered)
{
txtInfo.Text = objectOfferText();
}
// Fire off event
NotificationEventArgs args = new NotificationEventArgs(instance);
args.Text = txtInfo.Text;
args.Buttons.Add(btnAccept);
args.Buttons.Add(btnDiscard);
args.Buttons.Add(btnIgnore);
FireNotificationCallback(args);
}
else
{
Logger.Log("Wrong format of the item offered", Helpers.LogLevel.Warning, client);
}
}
示例10: GetAssetSources
public IEnumerable<string> GetAssetSources(AssetType type, PageModel pageModel, UrlHelper helper)
{
//load items not in any group or delivered by CDN
foreach (Asset asset in GetNonGroupedAssets(pageModel.Assets, type))
{
if (Settings.Default.UseCDN && GetCdnUrl(asset.Name) != null)
yield return GetCdnUrl(asset.Name);
else yield return helper.AssetPath(asset.AssetType, asset.Name);
}
var groups = pageModel.Assets.Select(a => a.Group).Distinct().ToArray();
var grouped = GetGroupedAssets(pageModel.Assets, groups, type);
if (AssetGroupMode == AssetGroupMode.Disabled)
{
foreach (string s in grouped.Select(a => helper.AssetPath(a.AssetType, a.Name)))
yield return s;
}
else //load local via combination
{
if (grouped.Count > 0)
{
foreach (string group in groups)
{
//the following method will load and cache the combined script for later
var version = GetGroupCombined(type, group, helper).Md5;
//add versioning querystring for future updates overridding expires
yield return helper.RouteUrl("AssetGroup" + type.ToString(), new { group = group, v = version });
}
}
}
}
示例11: GetAssetUrl
public string GetAssetUrl(AssetType assetType, string theme, string assetName, UrlHelper helper)
{
if (Settings.Default.UseCDN)
{
string url = GetCdnUrl(assetName);
if (url != null) return url;
}
string type = assetType.ToString().ToLower();
if (theme != null)
{
string path = string.Format("~/{0}/{1}/{2}", type, theme, assetName);
if (File.Exists(HostingEnvironment.MapPath(path))) return helper.Content(path);
path = string.Format("~/{0}/default/{1}", type, assetName);
if (File.Exists(HostingEnvironment.MapPath(path))) return helper.Content(path);
}
return helper.Content(string.Format("~/{0}/{1}", type, assetName));
}
示例12: Inventory_OnObjectOffered
bool Inventory_OnObjectOffered(InstantMessage offerDetails, AssetType type, UUID objectID, bool fromTask)
{
AutoResetEvent ObjectOfferEvent = new AutoResetEvent(false);
ResponseType object_offer_result=ResponseType.Yes;
string msg = "";
ResponseType result;
if (!fromTask)
msg = "The user "+offerDetails.FromAgentName + " has offered you\n" + offerDetails.Message + "\n Which is a " + type.ToString() + "\nPress Yes to accept or no to decline";
else
msg = "The object "+offerDetails.FromAgentName + " has offered you\n" + offerDetails.Message + "\n Which is a " + type.ToString() + "\nPress Yes to accept or no to decline";
Application.Invoke(delegate {
ObjectOfferEvent.Reset();
Gtk.MessageDialog md = new MessageDialog(MainClass.win, DialogFlags.Modal, MessageType.Other, ButtonsType.YesNo, false, msg);
result = (ResponseType)md.Run();
object_offer_result=result;
md.Destroy();
ObjectOfferEvent.Set();
});
ObjectOfferEvent.WaitOne(1000*3600,false);
if (object_offer_result == ResponseType.Yes)
{
if(OnInventoryAccepted!=null)
{
OnInventoryAccepted(type,objectID);
}
return true;
}
else
{
return false;
}
}
示例13: Inventory_OnInventoryObjectReceived
bool Inventory_OnInventoryObjectReceived(UUID fromAgentID, string fromAgentName, uint parentEstateID, UUID regionID, Vector3 position, DateTime timestamp, AssetType type, UUID objectID, bool fromTask)
{
InventoryBase obj = Session.Client.Inventory.Store[objectID];
Display.InventoryItemReceived(Session.SessionNumber, fromAgentID, fromAgentName, parentEstateID, regionID, position, timestamp, obj);
Dictionary<string, string> identifiers = new Dictionary<string, string>();
identifiers.Add("$name", fromAgentName);
identifiers.Add("$id", fromAgentID.ToString());
identifiers.Add("$item", obj.Name);
identifiers.Add("$itemid", objectID.ToString());
identifiers.Add("$type", type.ToString());
ScriptSystem.TriggerEvents(Session.SessionNumber, ScriptSystem.EventTypes.GetItem, identifiers);
return true;
}