AssetData
byte array from the properties
- of the derived class.
- Simulator.Parcels
- dictionary)
- Simulator.Parcels
- dictionary)
- Parcels.RequestAllSimParcels
is required to populate map and
- dictionary.RequestAllSimParcels()
RequestAllSimParcels()
RequestAllSimParcels()
- // initialize a new ObservableDictionary named testDict with a string as the key and an int as the value.
- public ObservableDictionary<string, int> testDict = new ObservableDictionary<string, int>();
-
-
- // initialize a new ObservableDictionary named testDict with a string as the key and an int as the value,
- // initially allocated room for 10 entries.
- public ObservableDictionary<string, int> testDict = new ObservableDictionary<string, int>(10);
-
-
- // find your avatar using the Simulator.ObjectsAvatars ObservableDictionary:
- Avatar av;
- if (Client.Network.CurrentSim.ObjectsAvatars.TryGetValue(Client.Self.AgentID, out av))
- Console.WriteLine("Found Avatar {0}", av.Name);
-
-
- // use a delegate to find a prim in the ObjectsPrimitives ObservableDictionary
- // with the ID 95683496
- uint findID = 95683496;
- Primitive findPrim = sim.ObjectsPrimitives.Find(
- delegate(Primitive prim) { return prim.ID == findID; });
-
-
- int radius = 20;
- List<Primitive> prims = Client.Network.CurrentSim.ObjectsPrimitives.FindAll(
- delegate(Primitive prim) {
- Vector3 pos = prim.Position;
- return ((prim.ParentID == 0) && (pos != Vector3.Zero) && (Vector3.Distance(pos, location) < radius));
- }
- );
-
-
- List<UUID> matches = myDict.FindAll(
- delegate(UUID id) {
- return myOtherDict.ContainsKey(id);
- }
- );
-
- TextureEntryFace
for the
- default face
-
- // Example minimum code required to instantiate class and
- // connect to a simulator.
- using System;
- using System.Collections.Generic;
- using System.Text;
- using OpenMetaverse;
-
- namespace FirstBot
- {
- class Bot
- {
- public static GridClient Client;
- static void Main(string[] args)
- {
- Client = new GridClient(); // instantiates the GridClient class
- // to the global Client object
- // Login to Simulator
- Client.Network.Login("FirstName", "LastName", "Password", "FirstBot", "1.0");
- // Wait for a Keypress
- Console.ReadLine();
- // Logout of simulator
- Client.Network.Logout();
- }
- }
- }
-
- Settings.LOGOUT_TIMEOUT
- has expired and the network layer is manually shut down
- OnLogoutReply
event, and if this does not fire the
- Shutdown()
function needs to be manually called
- RequestLogout
- RequestLogout
-
- BuyObject(Client.Network.CurrentSim, 500, SaleType.Copy,
- 100, UUID.Zero, Client.Self.InventoryRootFolderUUID);
-
-
- // Subscribe to the event that gives us prim and foliage information
- Client.Objects.ObjectUpdate += Objects_ObjectUpdate;
-
-
- private void Objects_ObjectUpdate(object sender, PrimEventArgs e)
- {
- Console.WriteLine("Primitive {0} {1} in {2} is an attachment {3}", e.Prim.ID, e.Prim.LocalID, e.Simulator.Name, e.IsAttachment);
- }
-
-
- // subscribe to the AvatarUpdate event to get our information
- Client.Objects.AvatarUpdate += Objects_AvatarUpdate;
- Client.Avatars.AvatarPicksReply += Avatars_AvatarPicksReply;
-
- private void Objects_AvatarUpdate(object sender, AvatarUpdateEventArgs e)
- {
- // we only want our own data
- if (e.Avatar.LocalID == Client.Self.LocalID)
- {
- // Unsubscribe from the avatar update event to prevent a loop
- // where we continually request the picks every time we get an update for ourselves
- Client.Objects.AvatarUpdate -= Objects_AvatarUpdate;
- // make the top picks request through AvatarManager
- Client.Avatars.RequestAvatarPicks(e.Avatar.ID);
- }
- }
-
- private void Avatars_AvatarPicksReply(object sender, AvatarPicksReplyEventArgs e)
- {
- // we'll unsubscribe from the AvatarPicksReply event since we now have the data
- // we were looking for
- Client.Avatars.AvatarPicksReply -= Avatars_AvatarPicksReply;
- // loop through the dictionary and extract the names of the top picks from our profile
- foreach (var pickName in e.Picks.Values)
- {
- Console.WriteLine(pickName);
- }
- }
-
-
- // Subscribe to the event that provides additional primitive details
- Client.Objects.ObjectProperties += Objects_ObjectProperties;
-
- // handle the properties data that arrives
- private void Objects_ObjectProperties(object sender, ObjectPropertiesEventArgs e)
- {
- Console.WriteLine("Primitive Properties: {0} Name is {1}", e.Properties.ObjectID, e.Properties.Name);
- }
-
- OnLogMessage
handler is registered and the
- message will be sent to the logging engine
- GridClient.Settings.DEBUG
is true, an event will be
- fired if an OnLogMessage
handler is registered and the
- message will be sent to the logging engine
- folder
folder
does not exist in the inventoryitem.parentUUID
does
- not match node.Parent.Data.UUID
.
-
- You can not set the inventory root folder using this method
- uuid
.
- RemoveNodeFor(this[uuid])
.
- If the value is non-null, it is equivelant to a call to UpdateNodeFor(value)
,
- the uuid parameter is ignored.
- uuid
.vFileID
, or
- AssetType.Unknown
if filename is not empty
- Sets the FilePath in the request to Cache
- (4) if true, otherwise Unknown (0) is used
-
- Client.Assets.RequestImage(UUID.Parse("c307629f-e3a1-4487-5e88-0d96ac9d4965"), ImageType.Normal, TextureDownloader_OnDownloadFinished);
-
- private void TextureDownloader_OnDownloadFinished(TextureRequestState state, AssetTexture asset)
- {
- if(state == TextureRequestState.Finished)
- {
- Console.WriteLine("Texture {0} ({1} bytes) has been successfully downloaded",
- asset.AssetID,
- asset.AssetData.Length);
- }
- }
-
- Request an image and use an inline anonymous method to handle the downloaded texture data
-
- Client.Assets.RequestImage(UUID.Parse("c307629f-e3a1-4487-5e88-0d96ac9d4965"), ImageType.Normal, delegate(TextureRequestState state, AssetTexture asset)
- {
- if(state == TextureRequestState.Finished)
- {
- Console.WriteLine("Texture {0} ({1} bytes) has been successfully downloaded",
- asset.AssetID,
- asset.AssetData.Length);
- }
- }
- );
-
- Request a texture, decode the texture to a bitmap image and apply it to a imagebox
-
- Client.Assets.RequestImage(UUID.Parse("c307629f-e3a1-4487-5e88-0d96ac9d4965"), ImageType.Normal, TextureDownloader_OnDownloadFinished);
-
- private void TextureDownloader_OnDownloadFinished(TextureRequestState state, AssetTexture asset)
- {
- if(state == TextureRequestState.Finished)
- {
- ManagedImage imgData;
- Image bitmap;
-
- if (state == TextureRequestState.Finished)
- {
- OpenJPEG.DecodeToImage(assetTexture.AssetData, out imgData, out bitmap);
- picInsignia.Image = bitmap;
- }
- }
- }
-
-
- // Subscribe to the AttachedSound event
- Client.Sound.AttachedSound += Sound_AttachedSound;
-
- // process the data raised in the event here
- private void Sound_AttachedSound(object sender, AttachedSoundEventArgs e)
- {
- // ... Process AttachedSoundEventArgs here ...
- }
-
-
- // subscribe to the event
- Client.Sound.SoundTrigger += Sound_SoundTrigger;
-
- // play the pre-defined BELL_TING sound
- Client.Sound.SendSoundTrigger(Sounds.BELL_TING);
-
- // handle the response data
- private void Sound_SoundTrigger(object sender, SoundTriggerEventArgs e)
- {
- Console.WriteLine("{0} played the sound {1} at volume {2}",
- e.OwnerID, e.SoundID, e.Gain);
- }
-
-
- // subscribe to the event
- Client.Avatars.AvatarAppearance += Avatars_AvatarAppearance;
-
- // handle the data when the event is raised
- void Avatars_AvatarAppearance(object sender, AvatarAppearanceEventArgs e)
- {
- Console.WriteLine("The Agent {0} is using a {1} shape.", e.AvatarID, (e.VisualParams[31] > 0) : "male" ? "female")
- }
-
- SEND_AGENT_UPDATES
is true,
- AgentUpdate packets will continuously be sent out to give the bot
- smoother movement and autopilotingSimulator.ObjectAvatars
.
- If false, a new Avatar or Primitive object will be created
- each time an object update packet is receivedSimulator.ObjectPrimitives
.
- If false, a new Avatar or Primitive object will be created
- each time an object update packet is receivedSimulator.Parcels
dictionary as they are receivedAssetType.Unknown
- to create a normal folder, otherwise it will likely create a
- duplicate of an existing folder type
- AsseType.Folder
- it will create a new root folder which may likely cause all sorts
- of strange problems
- uint primID = 95899503; // Fake prim ID
- UUID scriptID = UUID.Parse("92a7fe8a-e949-dd39-a8d8-1681d8673232"); // Fake Script UUID in Inventory
-
- Client.Inventory.FolderContents(Client.Inventory.FindFolderForType(AssetType.LSLText), Client.Self.AgentID,
- false, true, InventorySortOrder.ByName, 10000);
-
- Client.Inventory.RezScript(primID, (InventoryItem)Client.Inventory.Store[scriptID]);
-
-
- // subscribe to the event
- Client.Avatars.AvatarAnimation += Avatars_AvatarAnimation;
-
- private void Avatars_AvatarAnimation(object sender, AvatarAnimationEventArgs e)
- {
- // create a dictionary of "known" animations from the Animations class using System.Reflection
- Dictionary<UUID, string> systemAnimations = new Dictionary<UUID, string>();
- Type type = typeof(Animations);
- System.Reflection.FieldInfo[] fields = type.GetFields(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static);
- foreach (System.Reflection.FieldInfo field in fields)
- {
- systemAnimations.Add((UUID)field.GetValue(type), field.Name);
- }
-
- // find out which animations being played are known animations and which are assets
- foreach (Animation animation in e.Animations)
- {
- if (systemAnimations.ContainsKey(animation.AnimationID))
- {
- Console.WriteLine("{0} is playing {1} ({2}) sequence {3}", e.AvatarID,
- systemAnimations[animation.AnimationID], animation.AnimationSequence);
- }
- else
- {
- Console.WriteLine("{0} is playing {1} (Asset) sequence {2}", e.AvatarID,
- animation.AnimationID, animation.AnimationSequence);
- }
- }
- }
-
-
- // subscribe to the event
- Client.Avatars.AvatarAppearance += Avatars_AvatarAppearance;
-
- // handle the data when the event is raised
- void Avatars_AvatarAppearance(object sender, AvatarAppearanceEventArgs e)
- {
- Console.WriteLine("The Agent {0} is using a {1} shape.", e.AvatarID, (e.VisualParams[31] > 0) : "male" ? "female")
- }
-
- AssetData
to the
-
- // Add the following code to any struct or class containing only fields to override the ToString()
- // method to display the values of the passed object
-
- /// Print the struct data as a string
- ///A string containing the field name, and field value
- public override string ToString()
- {
- return Helpers.StructToString(this);
- }
-
-
- // initialize a new InternalDictionary named testDict with a string as the key and an int as the value.
- public InternalDictionary<string, int> testDict = new InternalDictionary<string, int>();
-
-
- // initialize a new InternalDictionary named testAvName with a UUID as the key and an string as the value.
- // populates with copied values from example KeyNameCache Dictionary.
-
- // create source dictionary
- Dictionary<UUID, string> KeyNameCache = new Dictionary<UUID, string>();
- KeyNameCache.Add("8300f94a-7970-7810-cf2c-fc9aa6cdda24", "Jack Avatar");
- KeyNameCache.Add("27ba1e40-13f7-0708-3e98-5819d780bd62", "Jill Avatar");
-
- // Initialize new dictionary.
- public InternalDictionary<UUID, string> testAvName = new InternalDictionary<UUID, string>(KeyNameCache);
-
-
- // initialize a new InternalDictionary named testDict with a string as the key and an int as the value,
- // initially allocated room for 10 entries.
- public InternalDictionary<string, int> testDict = new InternalDictionary<string, int>(10);
-
-
- // find your avatar using the Simulator.ObjectsAvatars InternalDictionary:
- Avatar av;
- if (Client.Network.CurrentSim.ObjectsAvatars.TryGetValue(Client.Self.AgentID, out av))
- Console.WriteLine("Found Avatar {0}", av.Name);
-
-
- // use a delegate to find a prim in the ObjectsPrimitives InternalDictionary
- // with the ID 95683496
- uint findID = 95683496;
- Primitive findPrim = sim.ObjectsPrimitives.Find(
- delegate(Primitive prim) { return prim.ID == findID; });
-
-
- int radius = 20;
- List<Primitive> prims = Client.Network.CurrentSim.ObjectsPrimitives.FindAll(
- delegate(Primitive prim) {
- Vector3 pos = prim.Position;
- return ((prim.ParentID == 0) && (pos != Vector3.Zero) && (Vector3.Distance(pos, location) < radius));
- }
- );
-
-
- List<UUID> matches = myDict.FindAll(
- delegate(UUID id) {
- return myOtherDict.ContainsKey(id);
- }
- );
-
-
- // Iterates over the ObjectsPrimitives InternalDictionary and prints out some information.
- Client.Network.CurrentSim.ObjectsPrimitives.ForEach(
- delegate(Primitive prim)
- {
- if (prim.Text != null)
- {
- Console.WriteLine("NAME={0} ID = {1} TEXT = '{2}'",
- prim.PropertiesFamily.Name, prim.ID, prim.Text);
- }
- });
-
- OnGroupProfile
event to receive the results.OnGroupMembers
event to receive the results.OnGroupRoles
event to receive the results.OnGroupRolesMembers
event to receive the results.OnGroupTitles
event to receive the results.OnGroupAccountSummary
event to receive the results.OnGroupJoined
event for confirmation.OnGroupCreated
event to receive confirmation.GroupNotice
structure containing notice data
- GroupProposal
structure containing the proposal
- OnGroupLeft
event to receive confirmation
- UUID searchID = StartClassifiedSearch("foo bar", ClassifiedCategories.Any, ClassifiedQueryFlags.PG | ClassifiedQueryFlags.Mature);
-
-
- UUID searchID = StartDirPlacesSearch("foo bar", DirFindFlags.DwellSort | DirFindFlags.IncludePG | DirFindFlags.IncludeAdult, ParcelCategory.Any, 0);
-
-
- // request all mainland, any maturity rating that is larger than 512 sq.m
- StartLandSearch(DirFindFlags.SortAsc | DirFindFlags.PerMeterSort | DirFindFlags.LimitByArea | DirFindFlags.IncludePG | DirFindFlags.IncludeMature | DirFindFlags.IncludeAdult, SearchTypeFlags.Mainland, 0, 512, 0);
-
AssetData
byte array from the properties
+ of the derived class.
+ Simulator.Parcels
+ dictionary)
+ Simulator.Parcels
+ dictionary)
+ Parcels.RequestAllSimParcels
is required to populate map and
+ dictionary.RequestAllSimParcels()
RequestAllSimParcels()
RequestAllSimParcels()
+ // initialize a new ObservableDictionary named testDict with a string as the key and an int as the value.
+ public ObservableDictionary<string, int> testDict = new ObservableDictionary<string, int>();
+
+
+ // initialize a new ObservableDictionary named testDict with a string as the key and an int as the value,
+ // initially allocated room for 10 entries.
+ public ObservableDictionary<string, int> testDict = new ObservableDictionary<string, int>(10);
+
+
+ // find your avatar using the Simulator.ObjectsAvatars ObservableDictionary:
+ Avatar av;
+ if (Client.Network.CurrentSim.ObjectsAvatars.TryGetValue(Client.Self.AgentID, out av))
+ Console.WriteLine("Found Avatar {0}", av.Name);
+
+
+ // use a delegate to find a prim in the ObjectsPrimitives ObservableDictionary
+ // with the ID 95683496
+ uint findID = 95683496;
+ Primitive findPrim = sim.ObjectsPrimitives.Find(
+ delegate(Primitive prim) { return prim.ID == findID; });
+
+
+ int radius = 20;
+ List<Primitive> prims = Client.Network.CurrentSim.ObjectsPrimitives.FindAll(
+ delegate(Primitive prim) {
+ Vector3 pos = prim.Position;
+ return ((prim.ParentID == 0) && (pos != Vector3.Zero) && (Vector3.Distance(pos, location) < radius));
+ }
+ );
+
+
+ List<UUID> matches = myDict.FindAll(
+ delegate(UUID id) {
+ return myOtherDict.ContainsKey(id);
+ }
+ );
+
+ TextureEntryFace
for the
+ default face
+
+ // Example minimum code required to instantiate class and
+ // connect to a simulator.
+ using System;
+ using System.Collections.Generic;
+ using System.Text;
+ using OpenMetaverse;
+
+ namespace FirstBot
+ {
+ class Bot
+ {
+ public static GridClient Client;
+ static void Main(string[] args)
+ {
+ Client = new GridClient(); // instantiates the GridClient class
+ // to the global Client object
+ // Login to Simulator
+ Client.Network.Login("FirstName", "LastName", "Password", "FirstBot", "1.0");
+ // Wait for a Keypress
+ Console.ReadLine();
+ // Logout of simulator
+ Client.Network.Logout();
+ }
+ }
+ }
+
+ Settings.LOGOUT_TIMEOUT
+ has expired and the network layer is manually shut down
+ OnLogoutReply
event, and if this does not fire the
+ Shutdown()
function needs to be manually called
+ RequestLogout
+ RequestLogout
+
+ BuyObject(Client.Network.CurrentSim, 500, SaleType.Copy,
+ 100, UUID.Zero, Client.Self.InventoryRootFolderUUID);
+
+
+ // Subscribe to the event that gives us prim and foliage information
+ Client.Objects.ObjectUpdate += Objects_ObjectUpdate;
+
+
+ private void Objects_ObjectUpdate(object sender, PrimEventArgs e)
+ {
+ Console.WriteLine("Primitive {0} {1} in {2} is an attachment {3}", e.Prim.ID, e.Prim.LocalID, e.Simulator.Name, e.IsAttachment);
+ }
+
+
+ // subscribe to the AvatarUpdate event to get our information
+ Client.Objects.AvatarUpdate += Objects_AvatarUpdate;
+ Client.Avatars.AvatarPicksReply += Avatars_AvatarPicksReply;
+
+ private void Objects_AvatarUpdate(object sender, AvatarUpdateEventArgs e)
+ {
+ // we only want our own data
+ if (e.Avatar.LocalID == Client.Self.LocalID)
+ {
+ // Unsubscribe from the avatar update event to prevent a loop
+ // where we continually request the picks every time we get an update for ourselves
+ Client.Objects.AvatarUpdate -= Objects_AvatarUpdate;
+ // make the top picks request through AvatarManager
+ Client.Avatars.RequestAvatarPicks(e.Avatar.ID);
+ }
+ }
+
+ private void Avatars_AvatarPicksReply(object sender, AvatarPicksReplyEventArgs e)
+ {
+ // we'll unsubscribe from the AvatarPicksReply event since we now have the data
+ // we were looking for
+ Client.Avatars.AvatarPicksReply -= Avatars_AvatarPicksReply;
+ // loop through the dictionary and extract the names of the top picks from our profile
+ foreach (var pickName in e.Picks.Values)
+ {
+ Console.WriteLine(pickName);
+ }
+ }
+
+
+ // Subscribe to the event that provides additional primitive details
+ Client.Objects.ObjectProperties += Objects_ObjectProperties;
+
+ // handle the properties data that arrives
+ private void Objects_ObjectProperties(object sender, ObjectPropertiesEventArgs e)
+ {
+ Console.WriteLine("Primitive Properties: {0} Name is {1}", e.Properties.ObjectID, e.Properties.Name);
+ }
+
+ OnLogMessage
handler is registered and the
+ message will be sent to the logging engine
+ GridClient.Settings.DEBUG
is true, an event will be
+ fired if an OnLogMessage
handler is registered and the
+ message will be sent to the logging engine
+ folder
folder
does not exist in the inventoryitem.parentUUID
does
+ not match node.Parent.Data.UUID
.
+
+ You can not set the inventory root folder using this method
+ uuid
.
+ RemoveNodeFor(this[uuid])
.
+ If the value is non-null, it is equivelant to a call to UpdateNodeFor(value)
,
+ the uuid parameter is ignored.
+ uuid
.vFileID
, or
+ AssetType.Unknown
if filename is not empty
+ Sets the FilePath in the request to Cache
+ (4) if true, otherwise Unknown (0) is used
+
+ Client.Assets.RequestImage(UUID.Parse("c307629f-e3a1-4487-5e88-0d96ac9d4965"), ImageType.Normal, TextureDownloader_OnDownloadFinished);
+
+ private void TextureDownloader_OnDownloadFinished(TextureRequestState state, AssetTexture asset)
+ {
+ if(state == TextureRequestState.Finished)
+ {
+ Console.WriteLine("Texture {0} ({1} bytes) has been successfully downloaded",
+ asset.AssetID,
+ asset.AssetData.Length);
+ }
+ }
+
+ Request an image and use an inline anonymous method to handle the downloaded texture data
+
+ Client.Assets.RequestImage(UUID.Parse("c307629f-e3a1-4487-5e88-0d96ac9d4965"), ImageType.Normal, delegate(TextureRequestState state, AssetTexture asset)
+ {
+ if(state == TextureRequestState.Finished)
+ {
+ Console.WriteLine("Texture {0} ({1} bytes) has been successfully downloaded",
+ asset.AssetID,
+ asset.AssetData.Length);
+ }
+ }
+ );
+
+ Request a texture, decode the texture to a bitmap image and apply it to a imagebox
+
+ Client.Assets.RequestImage(UUID.Parse("c307629f-e3a1-4487-5e88-0d96ac9d4965"), ImageType.Normal, TextureDownloader_OnDownloadFinished);
+
+ private void TextureDownloader_OnDownloadFinished(TextureRequestState state, AssetTexture asset)
+ {
+ if(state == TextureRequestState.Finished)
+ {
+ ManagedImage imgData;
+ Image bitmap;
+
+ if (state == TextureRequestState.Finished)
+ {
+ OpenJPEG.DecodeToImage(assetTexture.AssetData, out imgData, out bitmap);
+ picInsignia.Image = bitmap;
+ }
+ }
+ }
+
+
+ // Subscribe to the AttachedSound event
+ Client.Sound.AttachedSound += Sound_AttachedSound;
+
+ // process the data raised in the event here
+ private void Sound_AttachedSound(object sender, AttachedSoundEventArgs e)
+ {
+ // ... Process AttachedSoundEventArgs here ...
+ }
+
+
+ // subscribe to the event
+ Client.Sound.SoundTrigger += Sound_SoundTrigger;
+
+ // play the pre-defined BELL_TING sound
+ Client.Sound.SendSoundTrigger(Sounds.BELL_TING);
+
+ // handle the response data
+ private void Sound_SoundTrigger(object sender, SoundTriggerEventArgs e)
+ {
+ Console.WriteLine("{0} played the sound {1} at volume {2}",
+ e.OwnerID, e.SoundID, e.Gain);
+ }
+
+
+ // subscribe to the event
+ Client.Avatars.AvatarAppearance += Avatars_AvatarAppearance;
+
+ // handle the data when the event is raised
+ void Avatars_AvatarAppearance(object sender, AvatarAppearanceEventArgs e)
+ {
+ Console.WriteLine("The Agent {0} is using a {1} shape.", e.AvatarID, (e.VisualParams[31] > 0) : "male" ? "female")
+ }
+
+ SEND_AGENT_UPDATES
is true,
+ AgentUpdate packets will continuously be sent out to give the bot
+ smoother movement and autopilotingSimulator.ObjectAvatars
.
+ If false, a new Avatar or Primitive object will be created
+ each time an object update packet is receivedSimulator.ObjectPrimitives
.
+ If false, a new Avatar or Primitive object will be created
+ each time an object update packet is receivedSimulator.Parcels
dictionary as they are receivedAssetType.Unknown
+ to create a normal folder, otherwise it will likely create a
+ duplicate of an existing folder type
+ AsseType.Folder
+ it will create a new root folder which may likely cause all sorts
+ of strange problems
+ uint primID = 95899503; // Fake prim ID
+ UUID scriptID = UUID.Parse("92a7fe8a-e949-dd39-a8d8-1681d8673232"); // Fake Script UUID in Inventory
+
+ Client.Inventory.FolderContents(Client.Inventory.FindFolderForType(AssetType.LSLText), Client.Self.AgentID,
+ false, true, InventorySortOrder.ByName, 10000);
+
+ Client.Inventory.RezScript(primID, (InventoryItem)Client.Inventory.Store[scriptID]);
+
+
+ // subscribe to the event
+ Client.Avatars.AvatarAnimation += Avatars_AvatarAnimation;
+
+ private void Avatars_AvatarAnimation(object sender, AvatarAnimationEventArgs e)
+ {
+ // create a dictionary of "known" animations from the Animations class using System.Reflection
+ Dictionary<UUID, string> systemAnimations = new Dictionary<UUID, string>();
+ Type type = typeof(Animations);
+ System.Reflection.FieldInfo[] fields = type.GetFields(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static);
+ foreach (System.Reflection.FieldInfo field in fields)
+ {
+ systemAnimations.Add((UUID)field.GetValue(type), field.Name);
+ }
+
+ // find out which animations being played are known animations and which are assets
+ foreach (Animation animation in e.Animations)
+ {
+ if (systemAnimations.ContainsKey(animation.AnimationID))
+ {
+ Console.WriteLine("{0} is playing {1} ({2}) sequence {3}", e.AvatarID,
+ systemAnimations[animation.AnimationID], animation.AnimationSequence);
+ }
+ else
+ {
+ Console.WriteLine("{0} is playing {1} (Asset) sequence {2}", e.AvatarID,
+ animation.AnimationID, animation.AnimationSequence);
+ }
+ }
+ }
+
+
+ // subscribe to the event
+ Client.Avatars.AvatarAppearance += Avatars_AvatarAppearance;
+
+ // handle the data when the event is raised
+ void Avatars_AvatarAppearance(object sender, AvatarAppearanceEventArgs e)
+ {
+ Console.WriteLine("The Agent {0} is using a {1} shape.", e.AvatarID, (e.VisualParams[31] > 0) : "male" ? "female")
+ }
+
+ AssetData
to the
+
+ // Add the following code to any struct or class containing only fields to override the ToString()
+ // method to display the values of the passed object
+
+ /// Print the struct data as a string
+ ///A string containing the field name, and field value
+ public override string ToString()
+ {
+ return Helpers.StructToString(this);
+ }
+
+
+ // initialize a new InternalDictionary named testDict with a string as the key and an int as the value.
+ public InternalDictionary<string, int> testDict = new InternalDictionary<string, int>();
+
+
+ // initialize a new InternalDictionary named testAvName with a UUID as the key and an string as the value.
+ // populates with copied values from example KeyNameCache Dictionary.
+
+ // create source dictionary
+ Dictionary<UUID, string> KeyNameCache = new Dictionary<UUID, string>();
+ KeyNameCache.Add("8300f94a-7970-7810-cf2c-fc9aa6cdda24", "Jack Avatar");
+ KeyNameCache.Add("27ba1e40-13f7-0708-3e98-5819d780bd62", "Jill Avatar");
+
+ // Initialize new dictionary.
+ public InternalDictionary<UUID, string> testAvName = new InternalDictionary<UUID, string>(KeyNameCache);
+
+
+ // initialize a new InternalDictionary named testDict with a string as the key and an int as the value,
+ // initially allocated room for 10 entries.
+ public InternalDictionary<string, int> testDict = new InternalDictionary<string, int>(10);
+
+
+ // find your avatar using the Simulator.ObjectsAvatars InternalDictionary:
+ Avatar av;
+ if (Client.Network.CurrentSim.ObjectsAvatars.TryGetValue(Client.Self.AgentID, out av))
+ Console.WriteLine("Found Avatar {0}", av.Name);
+
+
+ // use a delegate to find a prim in the ObjectsPrimitives InternalDictionary
+ // with the ID 95683496
+ uint findID = 95683496;
+ Primitive findPrim = sim.ObjectsPrimitives.Find(
+ delegate(Primitive prim) { return prim.ID == findID; });
+
+
+ int radius = 20;
+ List<Primitive> prims = Client.Network.CurrentSim.ObjectsPrimitives.FindAll(
+ delegate(Primitive prim) {
+ Vector3 pos = prim.Position;
+ return ((prim.ParentID == 0) && (pos != Vector3.Zero) && (Vector3.Distance(pos, location) < radius));
+ }
+ );
+
+
+ List<UUID> matches = myDict.FindAll(
+ delegate(UUID id) {
+ return myOtherDict.ContainsKey(id);
+ }
+ );
+
+
+ // Iterates over the ObjectsPrimitives InternalDictionary and prints out some information.
+ Client.Network.CurrentSim.ObjectsPrimitives.ForEach(
+ delegate(Primitive prim)
+ {
+ if (prim.Text != null)
+ {
+ Console.WriteLine("NAME={0} ID = {1} TEXT = '{2}'",
+ prim.PropertiesFamily.Name, prim.ID, prim.Text);
+ }
+ });
+
+ OnGroupProfile
event to receive the results.OnGroupMembers
event to receive the results.OnGroupRoles
event to receive the results.OnGroupRolesMembers
event to receive the results.OnGroupTitles
event to receive the results.OnGroupAccountSummary
event to receive the results.OnGroupJoined
event for confirmation.OnGroupCreated
event to receive confirmation.GroupNotice
structure containing notice data
+ GroupProposal
structure containing the proposal
+ OnGroupLeft
event to receive confirmation
+ UUID searchID = StartClassifiedSearch("foo bar", ClassifiedCategories.Any, ClassifiedQueryFlags.PG | ClassifiedQueryFlags.Mature);
+
+
+ UUID searchID = StartDirPlacesSearch("foo bar", DirFindFlags.DwellSort | DirFindFlags.IncludePG | DirFindFlags.IncludeAdult, ParcelCategory.Any, 0);
+
+
+ // request all mainland, any maturity rating that is larger than 512 sq.m
+ StartLandSearch(DirFindFlags.SortAsc | DirFindFlags.PerMeterSort | DirFindFlags.LimitByArea | DirFindFlags.IncludePG | DirFindFlags.IncludeMature | DirFindFlags.IncludeAdult, SearchTypeFlags.Mainland, 0, 512, 0);
+
+ using System;
+ using System.IO;
+
+ using ICSharpCode.SharpZipLib.Core;
+ using ICSharpCode.SharpZipLib.Zip;
+
+ class MainClass
+ {
+ public static void Main(string[] args)
+ {
+ string[] filenames = Directory.GetFiles(args[0]);
+ byte[] buffer = new byte[4096];
+
+ using ( ZipOutputStream s = new ZipOutputStream(File.Create(args[1])) ) {
+
+ s.SetLevel(9); // 0 - store only to 9 - means best compression
+
+ foreach (string file in filenames) {
+ ZipEntry entry = new ZipEntry(file);
+ s.PutNextEntry(entry);
+
+ using (FileStream fs = File.OpenRead(file)) {
+ StreamUtils.Copy(fs, s, buffer);
+ }
+ }
+ }
+ }
+ }
+
+ def.deflate()
until all bytes from the input buffers
+ are processed.
+
+ using System;
+ using System.IO;
+
+ using ICSharpCode.SharpZipLib.GZip;
+ using ICSharpCode.SharpZipLib.Core;
+
+ class MainClass
+ {
+ public static void Main(string[] args)
+ {
+ using (Stream s = new GZipOutputStream(File.Create(args[0] + ".gz")))
+ using (FileStream fs = File.OpenRead(args[0])) {
+ byte[] writeData = new byte[4096];
+ Streamutils.Copy(s, fs, writeData);
+ }
+ }
+ }
+ }
+
+
+ using System;
+ using System.Text;
+ using System.Collections;
+ using System.IO;
+
+ using ICSharpCode.SharpZipLib.Zip;
+
+ class MainClass
+ {
+ static public void Main(string[] args)
+ {
+ using (ZipFile zFile = new ZipFile(args[0])) {
+ Console.WriteLine("Listing of : " + zFile.Name);
+ Console.WriteLine("");
+ Console.WriteLine("Raw Size Size Date Time Name");
+ Console.WriteLine("-------- -------- -------- ------ ---------");
+ foreach (ZipEntry e in zFile) {
+ if ( e.IsFile ) {
+ DateTime d = e.DateTime;
+ Console.WriteLine("{0, -10}{1, -10}{2} {3} {4}", e.Size, e.CompressedSize,
+ d.ToString("dd-MM-yy"), d.ToString("HH:mm"),
+ e.Name);
+ }
+ }
+ }
+ }
+ }
+
+ getValue
. The complete checksum object can also be reset
+ so it can be used again with new data.
+ + TarEntries that are created from the header bytes read from + an archive are instantiated with the TarEntry( byte[] ) + constructor. These entries will be used when extracting from + or listing the contents of an archive. These entries have their + header filled in using the header bytes. They also set the File + to null, since they reference an archive entry not a file.
++ TarEntries that are created from files that are to be written + into an archive are instantiated with the CreateEntryFromFile(string) + pseudo constructor. These entries have their header filled in using + the File's information. They also keep a reference to the File + for convenience when writing entries.
++ Finally, TarEntries can be constructed from nothing but a name. + This allows the programmer to construct the entry by hand, for + instance when only an InputStream is available for writing to + the archive, and the header information is constructed from + other information. In this case the header fields are set to + defaults and the File is set to null.
+
+ using System;
+ using System.IO;
+
+ using ICSharpCode.SharpZipLib.Core;
+ using ICSharpCode.SharpZipLib.GZip;
+
+ class MainClass
+ {
+ public static void Main(string[] args)
+ {
+ using (Stream inStream = new GZipInputStream(File.OpenRead(args[0])))
+ using (FileStream outStream = File.Create(Path.GetFileNameWithoutExtension(args[0]))) {
+ byte[] buffer = new byte[4096];
+ StreamUtils.Copy(inStream, outStream, buffer);
+ }
+ }
+ }
+
+
+ using System;
+ using System.Text;
+ using System.IO;
+
+ using ICSharpCode.SharpZipLib.Zip;
+
+ class MainClass
+ {
+ public static void Main(string[] args)
+ {
+ using ( ZipInputStream s = new ZipInputStream(File.OpenRead(args[0]))) {
+
+ ZipEntry theEntry;
+ while ((theEntry = s.GetNextEntry()) != null) {
+ int size = 2048;
+ byte[] data = new byte[2048];
+
+ Console.Write("Show contents (y/n) ?");
+ if (Console.ReadLine() == "y") {
+ while (true) {
+ size = s.Read(data, 0, data.Length);
+ if (size > 0) {
+ Console.Write(new ASCIIEncoding().GetString(data, 0, size));
+ } else {
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ NeedsInput()
+ returns true
+
+ strstart + MAX_MATCH <= window.length.
+ prev[index & WMASK]
points to the previous index that has the
+ same hash code as the string starting at index. This way
+ entries with the same hash code are in a linked list.
+ Note that the array should really be unsigned short, so you need
+ to and the values with 0xffff.
+ + You should never have a need to access this class directly. + TarBuffers are created by Tar IO Streams. +
+setInput(input, 0, input.length)
.
+ setDictionary(dict, 0, dict.Length)
.
+ Read()
+ public Inflater(bool noHeader)
passing true
+ if there is no Zlib header information
+
+ The usage is as following. First you have to set some input with
+ SetInput()
, then Inflate() it. If inflate doesn't
+ inflate any bytes there may be three reasons:
+ SetInput()
.
+ NOTE: IsNeedingInput() also returns true when, the stream is finished.
+ SetDictionary()
.