mirror of
https://github.com/opensim/opensim.git
synced 2026-08-08 10:15:33 +08:00
Add copyright headers, formatting cleanup.
This commit is contained in:
@@ -191,9 +191,9 @@ namespace pCampBot
|
||||
public void SaveDefaultAppearance()
|
||||
{
|
||||
saveDir = "MyAppearance/" + firstname + "_" + lastname;
|
||||
if (!Directory.Exists(saveDir))
|
||||
{
|
||||
Directory.CreateDirectory(saveDir);
|
||||
if (!Directory.Exists(saveDir))
|
||||
{
|
||||
Directory.CreateDirectory(saveDir);
|
||||
}
|
||||
|
||||
Array wtypes = Enum.GetValues(typeof(WearableType));
|
||||
@@ -212,7 +212,7 @@ namespace pCampBot
|
||||
{
|
||||
if (asset != null)
|
||||
{
|
||||
try
|
||||
try
|
||||
{
|
||||
if (asset.Decode())
|
||||
{
|
||||
@@ -220,14 +220,14 @@ namespace pCampBot
|
||||
asset.AssetType.ToString().ToLower(),
|
||||
asset.WearableType)), asset.AssetData);
|
||||
}
|
||||
else
|
||||
{
|
||||
MainConsole.Instance.Error(String.Format("Failed to decode {0} asset {1}", asset.AssetType, asset.AssetID));
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MainConsole.Instance.Error(String.Format("Exception: {0}",e.ToString()));
|
||||
else
|
||||
{
|
||||
MainConsole.Instance.Error(String.Format("Failed to decode {0} asset {1}", asset.AssetType, asset.AssetID));
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MainConsole.Instance.Error(String.Format("Exception: {0}",e.ToString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -235,7 +235,7 @@ namespace pCampBot
|
||||
public WearableType GetWearableType(string path)
|
||||
{
|
||||
string type = ((((path.Split('/'))[2]).Split('.'))[0]).Trim();
|
||||
switch(type)
|
||||
switch (type)
|
||||
{
|
||||
case "Eyes":
|
||||
return WearableType.Eyes;
|
||||
@@ -256,7 +256,7 @@ namespace pCampBot
|
||||
|
||||
public void MakeDefaultAppearance(string wear)
|
||||
{
|
||||
try
|
||||
try
|
||||
{
|
||||
if (wear == "yes")
|
||||
{
|
||||
@@ -267,54 +267,54 @@ namespace pCampBot
|
||||
saveDir = "MyAppearance/" + wear;
|
||||
saveDir = saveDir + "/";
|
||||
|
||||
string[] clothing = Directory.GetFiles(saveDir, "*.clothing", SearchOption.TopDirectoryOnly);
|
||||
string[] clothing = Directory.GetFiles(saveDir, "*.clothing", SearchOption.TopDirectoryOnly);
|
||||
string[] bodyparts = Directory.GetFiles(saveDir, "*.bodypart", SearchOption.TopDirectoryOnly);
|
||||
InventoryFolder clothfolder = FindClothingFolder();
|
||||
UUID transid = UUID.Random();
|
||||
List<InventoryBase> listwearables = new List<InventoryBase>();
|
||||
|
||||
for (int i = 0; i < clothing.Length; i++)
|
||||
|
||||
for (int i = 0; i < clothing.Length; i++)
|
||||
{
|
||||
UUID assetID = UUID.Random();
|
||||
UUID assetID = UUID.Random();
|
||||
AssetClothing asset = new AssetClothing(assetID, File.ReadAllBytes(clothing[i]));
|
||||
asset.Decode();
|
||||
asset.Owner = client.Self.AgentID;
|
||||
asset.WearableType = GetWearableType(clothing[i]);
|
||||
asset.Encode();
|
||||
asset.Encode();
|
||||
transid = client.Assets.RequestUpload(asset,true);
|
||||
client.Inventory.RequestCreateItem(clothfolder.UUID, "MyClothing" + i.ToString(), "MyClothing", AssetType.Clothing,
|
||||
transid, InventoryType.Wearable, asset.WearableType, PermissionMask.All, delegate(bool success, InventoryItem item)
|
||||
{
|
||||
transid, InventoryType.Wearable, asset.WearableType, PermissionMask.All, delegate(bool success, InventoryItem item)
|
||||
{
|
||||
if (success)
|
||||
{
|
||||
listwearables.Add(item);
|
||||
}
|
||||
else
|
||||
MainConsole.Instance.Error(String.Format("Failed to create item {0}",item.Name));
|
||||
MainConsole.Instance.Error(String.Format("Failed to create item {0}",item.Name));
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
for (int i = 0; i < bodyparts.Length; i++)
|
||||
);
|
||||
}
|
||||
|
||||
for (int i = 0; i < bodyparts.Length; i++)
|
||||
{
|
||||
UUID assetID = UUID.Random();
|
||||
UUID assetID = UUID.Random();
|
||||
AssetBodypart asset = new AssetBodypart(assetID, File.ReadAllBytes(bodyparts[i]));
|
||||
asset.Decode();
|
||||
asset.Owner = client.Self.AgentID;
|
||||
asset.WearableType = GetWearableType(bodyparts[i]);
|
||||
asset.Encode();
|
||||
asset.Encode();
|
||||
transid = client.Assets.RequestUpload(asset,true);
|
||||
client.Inventory.RequestCreateItem(clothfolder.UUID, "MyBodyPart" + i.ToString(), "MyBodyPart", AssetType.Bodypart,
|
||||
transid, InventoryType.Wearable, asset.WearableType, PermissionMask.All, delegate(bool success, InventoryItem item)
|
||||
{
|
||||
if (success)
|
||||
transid, InventoryType.Wearable, asset.WearableType, PermissionMask.All, delegate(bool success, InventoryItem item)
|
||||
{
|
||||
if (success)
|
||||
{
|
||||
listwearables.Add(item);
|
||||
}
|
||||
else
|
||||
MainConsole.Instance.Error(String.Format("Failed to create item {0}",item.Name));
|
||||
MainConsole.Instance.Error(String.Format("Failed to create item {0}",item.Name));
|
||||
}
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
Thread.Sleep(1000);
|
||||
@@ -326,10 +326,10 @@ namespace pCampBot
|
||||
MainConsole.Instance.Notice(String.Format("Sending {0} wearables...",listwearables.Count));
|
||||
client.Appearance.WearOutfit(listwearables, false);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.ToString());
|
||||
Console.WriteLine(ex.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user