private static Enum Reperm(PermissionMask mask, ImportSettings settings) { if (settings.Contains("sameperms")) { return(mask); } if (settings.Contains("+xfer+copy")) { return(mask | PermissionMask.Copy | PermissionMask.Transfer); } return(PermissionMask.All); }
private int ImportTaskFiles0(ImportSettings importSettings, bool createObjects) { //if (IsLocalScene) return 0; DateTime lastProgressNotice = DateTime.Now; int incomplete = 0; var agentSyncFolderHolder = Exporting.FolderCalled("TaskInvHolder"); int created = 0; foreach (var file in Directory.GetFiles(ExportCommand.dumpDir, "*.task")) { string fileUUID = Path.GetFileNameWithoutExtension(Path.GetFileName(file)); var ptc = APrimToCreate(UUID.Parse(fileUUID)); if (++created % 25 == 0) WriteLine("tasked " + created); if (ptc.PackedInsideNow) continue; // if (ptc.TaskInvComplete) continue; if ((ptc.Prim.RegionHandle != importSettings.CurSim.Handle) && importSettings.Contains("CheckRegion")) { KillID(ptc.OldID); continue; } string taskDataS = File.ReadAllText(file); if (string.IsNullOrEmpty(taskDataS) || taskDataS.Length < 30) { ptc.TaskInvComplete = true; continue; } ptc.CreateWorkflow(agentSyncFolderHolder); if (!ptc.LoadTaskOSD(WriteLine)) { //Failure("FAILED: LoadOSD " + ptc); incomplete++; continue; } if (!ptc.SyncToAgentFolder(WriteLine, createObjects)) { //Failure("FAILED: SyncToAgentFolder " + ptc); if (ptc.succeeded == 0) continue; } if (!ptc.SyncToObject(WriteLine, createObjects)) { //Failure("FAILED: SyncToObject " + ptc); if (ptc.succeeded == 0) continue; } if (!ptc.Complete) { Failure("INCOMPLETE: " + ptc); incomplete++; } else { Success("COMPLETE: " + ptc); } if (!IsLocalScene) Success("............"); if (lastProgressNotice.AddSeconds(30) < DateTime.Now) { lastProgressNotice = DateTime.Now; WriteLine("Task created " + created + " incomplete=" + incomplete); } } return incomplete; }
private void RequestMissingIDs(ImportSettings settings) { ExportCommand.IsExporting = true; foreach (MissingItemInfo itemInfo in MissingFromExport) { var ex = ExportCommand.Exporting; if (itemInfo.AssetType == AssetType.Unknown) { Failure("MISSING STILL: " + itemInfo); continue; } Success("Requesting: " + itemInfo); if (itemInfo.AssetType == AssetType.Landmark) { Client.Grid.RequestRegionHandle(itemInfo.MissingID); continue; } if (itemInfo.AssetType == AssetType.EnsembleStart) { if (settings.Contains("requestaccts")) { Client.Groups.RequestGroupName(itemInfo.MissingID); } continue; } if (itemInfo.AssetType == AssetType.CallingCard) { if (settings.Contains("requestaccts")) { Client.Avatars.RequestAvatarName(itemInfo.MissingID); } continue; } ex.AddRelated(itemInfo.MissingID, itemInfo.AssetType); } }
public static void ReplaceLSLText(string dir, string before, string after, ImportSettings arglist) { int changed = 0; int seenAsset = 0; HashSet <ItemToCreate> ItemsToCreate = LocalScene.Assets; bool alwayReupload = arglist.Contains("reup"); foreach (var file in Directory.GetFiles(dir, "*.lsl")) { seenAsset++; string readfile = File.ReadAllText(file); if (!readfile.Contains(before)) { continue; } readfile = readfile.Replace(before, after); changed++; File.WriteAllText(file, readfile); } Importing.Success("ReplaceLSLText seenAssets=" + seenAsset + " changed=" + changed); }
static void SOPToXml(XmlTextWriter writer, Primitive sop, int linkNum, Primitive parent, ICollection<InventoryBase> taskInventory, ImportSettings options) { // Primitive parent = null; throw new NotImplementedException();//"GETPArent" Primitive.ObjectProperties prop = sop.Properties; writer.WriteStartElement("SceneObjectPart"); writer.WriteAttributeString("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"); writer.WriteAttributeString("xmlns:xsd", "http://www.w3.org/2001/XMLSchema"); WriteUUID(writer, "UUID", sop.ID, options); if (CogbotHelpers.IsNullOrZero(sop.ID)) { throw new NullReferenceException("ID " + sop); } WriteValue(writer,"AllowedDrop", ((sop.Flags & PrimFlags.AllowInventoryDrop) != 0).ToString().ToLower()); WriteUserUUID(writer, "CreatorID", prop.CreatorID, options); /* if (sop.CreatorData != null && sop.CreatorData != string.Empty) WES(writer,"CreatorData", sop.CreatorData); else if (options.ContainsKey("home")) { if (m_UserManagement == null) m_UserManagement = sop.ParentGroup.Scene.RequestModuleInterface<IUserManagement>(); string name = m_UserManagement.GetUserName(sop.CreatorID); WES(writer,"CreatorData", (string)options["home"] + ";" + name); } */ WriteUUID(writer, "FolderID", prop.FolderID, options); WriteInt(writer,"InventorySerial", prop.InventorySerial); WriteTaskInventory(sop, writer, taskInventory, options); WriteFlags(writer, "ObjectFlags", sop.Flags, options); WriteInt(writer,"LocalId", sop.LocalID); WriteValue(writer,"Name", prop.Name); WriteEnum(writer, "Material", sop.PrimData.Material); WriteValue(writer,"PassTouches", "False");// sop.PassTouches.ToString().ToLower()); WriteUInt(writer,"RegionHandle", sop.RegionHandle); WriteValue(writer,"ScriptAccessPin", "0"); Vector3 groupPosition; if (parent == null) groupPosition = sop.Position; else groupPosition = parent.Position; WriteVector(writer, "GroupPosition", groupPosition); if (sop.ParentID == 0) WriteVector(writer, "OffsetPosition", Vector3.Zero); else WriteVector(writer, "OffsetPosition", sop.Position); WriteQuaternion(writer, "RotationOffset", sop.Rotation); WriteVector(writer, "Velocity", sop.Velocity); WriteVector(writer, "AngularVelocity", sop.AngularVelocity); WriteVector(writer, "Acceleration", sop.Acceleration); WriteValue(writer,"Description", prop.Description); writer.WriteStartElement("Color"); WriteFloat(writer,"R", sop.TextColor.R); WriteFloat(writer,"G", sop.TextColor.G); WriteFloat(writer,"B", sop.TextColor.B); WriteFloat(writer,"A", sop.TextColor.G); writer.WriteEndElement(); WriteValue(writer,"Text", sop.Text); WriteValue(writer,"SitName", prop.SitName); WriteValue(writer,"TouchName", prop.TouchName); WriteInt(writer,"LinkNum", linkNum); WriteEnum(writer,"ClickAction", sop.ClickAction); WriteShape(writer, sop, sop.Properties, sop.PrimData, options); WriteVector(writer, "Scale", sop.Scale); WriteValue(writer,"UpdateFlag", "0"); WriteVector(writer, "SitTargetOrientation", Vector3.UnitZ); WriteVector(writer, "SitTargetPosition", Vector3.Zero); WriteVector(writer, "SitTargetPositionLL", Vector3.Zero); WriteQuaternion(writer, "SitTargetOrientationLL", Quaternion.Identity); WriteInt(writer,"ParentID", sop.ParentID); WriteDate(writer, "CreationDate", sop.Properties.CreationDate); WriteEnum(writer, "Category", sop.Properties.Category); WriteInt(writer,"SalePrice", sop.Properties.SalePrice); WriteEnum(writer, "ObjectSaleType", sop.Properties.SaleType); WriteInt(writer,"OwnershipCost", sop.Properties.OwnershipCost); WriteUUID(writer, "GroupID", sop.GroupID, options); UUID ownerID = options.ContainsKey("wipe-owners") ? UUID.Zero : sop.OwnerID; WriteUserUUID(writer, "OwnerID", ownerID, options); UUID lastOwnerID = options.ContainsKey("wipe-owners") ? UUID.Zero : prop.LastOwnerID; WriteUserUUID(writer, "LastOwnerID", lastOwnerID, options); var perms = prop.Permissions; if (!options.Contains("sameperm") || options.Contains("fullperm")) { perms = Permissions.FullPermissions; } WriteEnum(writer, "BaseMask", Reperm(perms.BaseMask, options)); WriteEnum(writer, "OwnerMask", Reperm(perms.OwnerMask, options)); WriteEnum(writer, "GroupMask", Reperm(perms.GroupMask, options)); WriteEnum(writer, "EveryoneMask", Reperm(perms.EveryoneMask, options)); WriteEnum(writer, "NextOwnerMask", Reperm(perms.NextOwnerMask, options)); WriteFlags(writer, "Flags", sop.Flags, options); WriteUUID(writer, "CollisionSound", sop.Sound, options); WriteFloat(writer,"CollisionSoundVolume", sop.SoundGain); if (sop.MediaURL != null) WriteValue(writer,"MediaUrl", sop.MediaURL); WriteBytes(writer, "TextureAnimation", sop.TextureAnim.GetBytes()); WriteBytes(writer, "ParticleSystem", sop.ParticleSys.GetBytes()); /* WES(writer,"PayPrice0", sop.PayPrice[0]); WES(writer,"PayPrice1", sop.PayPrice[1]); WES(writer,"PayPrice2", sop.PayPrice[2]); WES(writer,"PayPrice3", sop.PayPrice[3]); WES(writer,"PayPrice4", sop.PayPrice[4]); */ writer.WriteEndElement(); }
public static void WriteTaskInventory(Primitive sop, XmlTextWriter writer, ICollection<InventoryBase> tinv, ImportSettings options) { if (tinv == null) { return; } int ObjectNum = -1; if (tinv.Count > 0) // otherwise skip this { writer.WriteStartElement("TaskInventory"); foreach (InventoryBase item2c in tinv) { InventoryItem item = item2c as InventoryItem; if (item == null) continue; string itemName = item.Name; bool obj = (item.AssetType == AssetType.Object); UUID itemAssetUUID = obj ? item.RezzID : item.AssetUUID; if (obj) { ObjectNum++; if (CogbotHelpers.IsNullOrZero(itemAssetUUID)) { string rtiStatus = ExportCommand.dumpDir + sop.ID + "." + ObjectNum + ".rti"; lock (ExportCommand.fileWriterLock) { if (File.Exists(rtiStatus)) { string[] conts = File.ReadAllText(rtiStatus).Split(','); if (conts.Length > 2) { itemAssetUUID = UUID.Parse(conts[0]); } } } } if (CogbotHelpers.IsNullOrZero(itemAssetUUID)) { ExportCommand.LogError(sop.ID, "AssetZERO: " + item); if (!options.ContainsKey("keepmissing")) continue; if (options.ContainsKey("use404")) itemAssetUUID = ImportCommand.GetMissingFiller(item.AssetType); if (options.ContainsKey("error404") && !itemName.Contains("ERROR404")) itemName += "ERROR404"; ImportCommand.Importing.Failure("Zero AssetID " + item.Name); } } else { if (CogbotHelpers.IsNullOrZero(itemAssetUUID)) itemAssetUUID = item.RezzID; if (CogbotHelpers.IsNullOrZero(itemAssetUUID)) { ExportCommand.LogError(sop.ID, "AssetZERO: " + item); if (!options.ContainsKey("keepmissing")) continue; if (options.ContainsKey("use404")) itemAssetUUID = ImportCommand.GetMissingFiller(item.AssetType); if (options.ContainsKey("error404") && !itemName.Contains("ERROR404")) itemName += "ERROR404"; ImportCommand.Importing.Failure("Zero AssetID " + item.Name); } } writer.WriteStartElement("TaskInventoryItem"); Permissions perms = item.Permissions; if (!options.Contains("sameperm")) { perms = Permissions.FullPermissions; } if (CogbotHelpers.IsNullOrZero(itemAssetUUID)) { continue; } WriteUUID(writer, "AssetID", itemAssetUUID, options); WriteEnum(writer, "BasePermissions", perms.BaseMask); WriteDate(writer, "CreationDate", item.CreationDate); WriteUUID(writer, "CreatorID", item.CreatorID, options); /* //todo if (item.CreatorData != null && item.CreatorData != string.Empty) WES(writer,"CreatorData", item.CreatorData); else if (options.ContainsKey("home")) { if (m_UserManagement == null) m_UserManagement = scene.RequestModuleInterface<IUserManagement>(); string name = m_UserManagement.GetUserName(item.CreatorID); WES(writer,"CreatorData", (string)options["home"] + ";" + name); } */ WriteValue(writer, "Description", item.Description); WriteEnum(writer, "EveryonePermissions", Reperm(perms.EveryoneMask, options)); WriteUInt(writer, "Flags", item.Flags); WriteUUID(writer, "GroupID", item.GroupID, options); WriteEnum(writer, "GroupPermissions", Reperm(perms.GroupMask, options)); WriteEnum(writer, "InvType", item.InventoryType); WriteUUID(writer, "ItemID", item.UUID, options); //todo WriteUUID(writer, "OldItemID", item.OldItemID, options); UUID lastOwnerID = options.ContainsKey("wipe-owners") ? UUID.Zero : item.LastOwnerID; WriteUserUUID(writer, "LastOwnerID", lastOwnerID, options); WriteValue(writer, "Name", itemName); WriteEnum(writer, "NextPermissions", Reperm(perms.NextOwnerMask, options)); UUID ownerID = options.ContainsKey("wipe-owners") ? UUID.Zero : item.OwnerID; WriteUUID(writer, "OwnerID", ownerID, options); WriteEnum(writer, "CurrentPermissions", Reperm(perms.OwnerMask, options)); WriteUUID(writer, "ParentID", item.ParentUUID, options); /*todo * WriteUUID(writer, "ParentPartID", item.ParentPartID, options); WriteUUID(writer, "PermsGranter", item.PermsGranter, options); */ // todo what is this? WriteEnum(writer, "PermsMask", PermissionMask.All);// perms.BaseMask);//item.PermsMask); WriteEnum(writer, "Type", item.AssetType); //todo WES(writer,"OwnerChanged", item.OwnerChanged.ToString().ToLower()); writer.WriteEndElement(); // TaskInventoryItem } writer.WriteEndElement(); // TaskInventory } }
public static void WriteTaskInventory(Primitive sop, XmlTextWriter writer, ICollection <InventoryBase> tinv, ImportSettings options) { if (tinv == null) { return; } int ObjectNum = -1; if (tinv.Count > 0) // otherwise skip this { writer.WriteStartElement("TaskInventory"); foreach (InventoryBase item2c in tinv) { InventoryItem item = item2c as InventoryItem; if (item == null) { continue; } string itemName = item.Name; bool obj = (item.AssetType == AssetType.Object); UUID itemAssetUUID = obj ? item.RezzID : item.AssetUUID; if (obj) { ObjectNum++; if (CogbotHelpers.IsNullOrZero(itemAssetUUID)) { string rtiStatus = ExportCommand.dumpDir + sop.ID + "." + ObjectNum + ".rti"; lock (ExportCommand.fileWriterLock) { if (File.Exists(rtiStatus)) { string[] conts = File.ReadAllText(rtiStatus).Split(','); if (conts.Length > 2) { itemAssetUUID = UUID.Parse(conts[0]); } } } } if (CogbotHelpers.IsNullOrZero(itemAssetUUID)) { ExportCommand.LogError(sop.ID, "AssetZERO: " + item); if (!options.ContainsKey("keepmissing")) { continue; } if (options.ContainsKey("use404")) { itemAssetUUID = ImportCommand.GetMissingFiller(item.AssetType); } if (options.ContainsKey("error404") && !itemName.Contains("ERROR404")) { itemName += "ERROR404"; } ImportCommand.Importing.Failure("Zero AssetID " + item.Name); } } else { if (CogbotHelpers.IsNullOrZero(itemAssetUUID)) { itemAssetUUID = item.RezzID; } if (CogbotHelpers.IsNullOrZero(itemAssetUUID)) { ExportCommand.LogError(sop.ID, "AssetZERO: " + item); if (!options.ContainsKey("keepmissing")) { continue; } if (options.ContainsKey("use404")) { itemAssetUUID = ImportCommand.GetMissingFiller(item.AssetType); } if (options.ContainsKey("error404") && !itemName.Contains("ERROR404")) { itemName += "ERROR404"; } ImportCommand.Importing.Failure("Zero AssetID " + item.Name); } } writer.WriteStartElement("TaskInventoryItem"); Permissions perms = item.Permissions; if (!options.Contains("sameperm")) { perms = Permissions.FullPermissions; } if (CogbotHelpers.IsNullOrZero(itemAssetUUID)) { continue; } WriteUUID(writer, "AssetID", itemAssetUUID, options); WriteEnum(writer, "BasePermissions", perms.BaseMask); WriteDate(writer, "CreationDate", item.CreationDate); WriteUUID(writer, "CreatorID", item.CreatorID, options); /* * //todo if (item.CreatorData != null && item.CreatorData != string.Empty) * WES(writer,"CreatorData", item.CreatorData); * else if (options.ContainsKey("home")) * { * if (m_UserManagement == null) * m_UserManagement = scene.RequestModuleInterface<IUserManagement>(); * string name = m_UserManagement.GetUserName(item.CreatorID); * WES(writer,"CreatorData", (string)options["home"] + ";" + name); * } */ WriteValue(writer, "Description", item.Description); WriteEnum(writer, "EveryonePermissions", Reperm(perms.EveryoneMask, options)); WriteUInt(writer, "Flags", item.Flags); WriteUUID(writer, "GroupID", item.GroupID, options); WriteEnum(writer, "GroupPermissions", Reperm(perms.GroupMask, options)); WriteEnum(writer, "InvType", item.InventoryType); WriteUUID(writer, "ItemID", item.UUID, options); //todo WriteUUID(writer, "OldItemID", item.OldItemID, options); UUID lastOwnerID = options.ContainsKey("wipe-owners") ? UUID.Zero : item.LastOwnerID; WriteUserUUID(writer, "LastOwnerID", lastOwnerID, options); WriteValue(writer, "Name", itemName); WriteEnum(writer, "NextPermissions", Reperm(perms.NextOwnerMask, options)); UUID ownerID = options.ContainsKey("wipe-owners") ? UUID.Zero : item.OwnerID; WriteUUID(writer, "OwnerID", ownerID, options); WriteEnum(writer, "CurrentPermissions", Reperm(perms.OwnerMask, options)); WriteUUID(writer, "ParentID", item.ParentUUID, options); /*todo * WriteUUID(writer, "ParentPartID", item.ParentPartID, options); * WriteUUID(writer, "PermsGranter", item.PermsGranter, options); */ // todo what is this? WriteEnum(writer, "PermsMask", PermissionMask.All);// perms.BaseMask);//item.PermsMask); WriteEnum(writer, "Type", item.AssetType); //todo WES(writer,"OwnerChanged", item.OwnerChanged.ToString().ToLower()); writer.WriteEndElement(); // TaskInventoryItem } writer.WriteEndElement(); // TaskInventory } }
static void SOPToXml(XmlTextWriter writer, Primitive sop, int linkNum, Primitive parent, ICollection <InventoryBase> taskInventory, ImportSettings options) { // Primitive parent = null; throw new NotImplementedException();//"GETPArent" Primitive.ObjectProperties prop = sop.Properties; writer.WriteStartElement("SceneObjectPart"); writer.WriteAttributeString("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"); writer.WriteAttributeString("xmlns:xsd", "http://www.w3.org/2001/XMLSchema"); WriteUUID(writer, "UUID", sop.ID, options); if (CogbotHelpers.IsNullOrZero(sop.ID)) { throw new NullReferenceException("ID " + sop); } WriteValue(writer, "AllowedDrop", ((sop.Flags & PrimFlags.AllowInventoryDrop) != 0).ToString().ToLower()); WriteUserUUID(writer, "CreatorID", prop.CreatorID, options); /* * if (sop.CreatorData != null && sop.CreatorData != string.Empty) * WES(writer,"CreatorData", sop.CreatorData); * else if (options.ContainsKey("home")) * { * if (m_UserManagement == null) * m_UserManagement = sop.ParentGroup.Scene.RequestModuleInterface<IUserManagement>(); * string name = m_UserManagement.GetUserName(sop.CreatorID); * WES(writer,"CreatorData", (string)options["home"] + ";" + name); * } */ WriteUUID(writer, "FolderID", prop.FolderID, options); WriteInt(writer, "InventorySerial", prop.InventorySerial); WriteTaskInventory(sop, writer, taskInventory, options); WriteFlags(writer, "ObjectFlags", sop.Flags, options); WriteInt(writer, "LocalId", sop.LocalID); WriteValue(writer, "Name", prop.Name); WriteEnum(writer, "Material", sop.PrimData.Material); WriteValue(writer, "PassTouches", "False");// sop.PassTouches.ToString().ToLower()); WriteUInt(writer, "RegionHandle", sop.RegionHandle); WriteValue(writer, "ScriptAccessPin", "0"); Vector3 groupPosition; if (parent == null) { groupPosition = sop.Position; } else { groupPosition = parent.Position; } WriteVector(writer, "GroupPosition", groupPosition); if (sop.ParentID == 0) { WriteVector(writer, "OffsetPosition", Vector3.Zero); } else { WriteVector(writer, "OffsetPosition", sop.Position); } WriteQuaternion(writer, "RotationOffset", sop.Rotation); WriteVector(writer, "Velocity", sop.Velocity); WriteVector(writer, "AngularVelocity", sop.AngularVelocity); WriteVector(writer, "Acceleration", sop.Acceleration); WriteValue(writer, "Description", prop.Description); writer.WriteStartElement("Color"); WriteFloat(writer, "R", sop.TextColor.R); WriteFloat(writer, "G", sop.TextColor.G); WriteFloat(writer, "B", sop.TextColor.B); WriteFloat(writer, "A", sop.TextColor.G); writer.WriteEndElement(); WriteValue(writer, "Text", sop.Text); WriteValue(writer, "SitName", prop.SitName); WriteValue(writer, "TouchName", prop.TouchName); WriteInt(writer, "LinkNum", linkNum); WriteEnum(writer, "ClickAction", sop.ClickAction); WriteShape(writer, sop, sop.Properties, sop.PrimData, options); WriteVector(writer, "Scale", sop.Scale); WriteValue(writer, "UpdateFlag", "0"); WriteVector(writer, "SitTargetOrientation", Vector3.UnitZ); WriteVector(writer, "SitTargetPosition", Vector3.Zero); WriteVector(writer, "SitTargetPositionLL", Vector3.Zero); WriteQuaternion(writer, "SitTargetOrientationLL", Quaternion.Identity); WriteInt(writer, "ParentID", sop.ParentID); WriteDate(writer, "CreationDate", sop.Properties.CreationDate); WriteEnum(writer, "Category", sop.Properties.Category); WriteInt(writer, "SalePrice", sop.Properties.SalePrice); WriteEnum(writer, "ObjectSaleType", sop.Properties.SaleType); WriteInt(writer, "OwnershipCost", sop.Properties.OwnershipCost); WriteUUID(writer, "GroupID", sop.GroupID, options); UUID ownerID = options.ContainsKey("wipe-owners") ? UUID.Zero : sop.OwnerID; WriteUserUUID(writer, "OwnerID", ownerID, options); UUID lastOwnerID = options.ContainsKey("wipe-owners") ? UUID.Zero : prop.LastOwnerID; WriteUserUUID(writer, "LastOwnerID", lastOwnerID, options); var perms = prop.Permissions; if (!options.Contains("sameperm") || options.Contains("fullperm")) { perms = Permissions.FullPermissions; } WriteEnum(writer, "BaseMask", Reperm(perms.BaseMask, options)); WriteEnum(writer, "OwnerMask", Reperm(perms.OwnerMask, options)); WriteEnum(writer, "GroupMask", Reperm(perms.GroupMask, options)); WriteEnum(writer, "EveryoneMask", Reperm(perms.EveryoneMask, options)); WriteEnum(writer, "NextOwnerMask", Reperm(perms.NextOwnerMask, options)); WriteFlags(writer, "Flags", sop.Flags, options); WriteUUID(writer, "CollisionSound", sop.Sound, options); WriteFloat(writer, "CollisionSoundVolume", sop.SoundGain); if (sop.MediaURL != null) { WriteValue(writer, "MediaUrl", sop.MediaURL); } WriteBytes(writer, "TextureAnimation", sop.TextureAnim.GetBytes()); WriteBytes(writer, "ParticleSystem", sop.ParticleSys.GetBytes()); /* * WES(writer,"PayPrice0", sop.PayPrice[0]); * WES(writer,"PayPrice1", sop.PayPrice[1]); * WES(writer,"PayPrice2", sop.PayPrice[2]); * WES(writer,"PayPrice3", sop.PayPrice[3]); * WES(writer,"PayPrice4", sop.PayPrice[4]); */ writer.WriteEndElement(); }
internal bool ExportPrim0(BotClient Client, SimObject exportPrim, OutputDelegate Failure, ImportSettings settings) { if (IsSkipped(exportPrim, settings)) { return(false); } Simulator CurSim = exportPrim.GetSimulator(); //settings.CurSim = CurSim; WorldObjects.EnsureSelected(exportPrim.LocalID, CurSim); string pathStem = Path.Combine(dumpDir, exportPrim.ID.ToString()); if (settings.Contains("task") || showsMissingOnly) { exportPrim.StartGetTaskInventory(); } if (settings.Contains("wait")) { var waitUntil = DateTime.Now.AddSeconds(10); bool needsLoop = true; while (needsLoop && waitUntil > DateTime.Now) { needsLoop = false; if (exportPrim.Properties == null || CogbotHelpers.IsNullOrZero(exportPrim.Properties.OwnerID)) { needsLoop = true; } if (settings.Contains("task")) { var ti = exportPrim.TaskInventory; if (ti == null) { needsLoop = true; } } } if (needsLoop) { Success("needs loop " + named(exportPrim)); string bissues = exportPrim.MissingData; if (!string.IsNullOrEmpty(bissues) && !settings.Allows(bissues, exportPrim)) { Failure("Cant wait out the Issues " + bissues + ": " + named(exportPrim)); if (LocalFailures == 0) { LocalFailures++; } // return; } } } string issues = exportPrim.MissingData; if (!string.IsNullOrEmpty(issues) && !settings.Allows(issues, exportPrim)) { Failure("Issues " + issues + " " + named(exportPrim)); if (LocalFailures == 0) { LocalFailures++; } //return false; } //ImportCommand.PrimToCreate ptc = ImportCommand.Running.APrimToCreate(exportPrim.ID); //ptc._prim = exportPrim.Prim; bool passedOK = true; if (settings.Contains("llsd")) { SaveLLSD(Client, pathStem, exportPrim, Failure, settings); } if (exportPrim.IsRoot && (true || exportPrim.Children.Count > 0)) { if (settings.Contains("link")) { SaveLinksetInfo(Client, pathStem, exportPrim, Failure, settings); } string exportFile = pathStem + ".link"; //lock (fileWriterLock) if (File.Exists(exportFile)) { foreach (var c in exportPrim.Children) { var ch = ExportPrim(Client, c, Failure, settings); if (!ch) { passedOK = false; } } } } if (settings.Contains("task")) { if (!SaveTaskInv(settings, Client, pathStem, exportPrim, Failure)) { passedOK = false; } // ImportCommand.PrimToCreate ptc = ImportCommand.Running.APrimToCreate(exportPrim.ID); // if (!ptc.EnsureTaskInv()) return false; } if (!settings.Contains("dep")) { return(passedOK); } AddRelatedTextures(exportPrim); SaveRelatedAssets(pathStem, exportPrim, Failure); return(passedOK); }
private void DoTodo(ImportSettings settings) { foreach (UUID mustExport in LockInfo.CopyOf(MustExport)) { if (!MissingLINK(mustExport) && !MissingLLSD(mustExport) && !MissingTASK(mustExport)) { if (APrimToCreate(mustExport).EnsureTaskInv(true)) { lock (MustExport) { MustExport.Remove(mustExport); continue; } } } var o = ExportCommand.GetSimObjectFromUUID(mustExport); settings.Add("llsd"); settings.Add("task"); settings.Add("taskobj"); settings.Add("dep"); settings.Add("links"); bool tlsls = settings.Contains("tasklsl"); settings.Add("tasklsl"); if (o!=null)Exporting.ExportPrim(Client, o, WriteLine, settings); } }
private void UploadAllAssets(ImportSettings arglist) { bool sameIds = arglist.Contains("sameid"); int uploaded = 0; int reuploaded = 0; int seenAsset = 0; HashSet<ItemToCreate> ItemsToCreate = LocalScene.Assets; bool alwayReupload = arglist.Contains("reup"); Success("Uploading assets... sameIds=" + sameIds); var au = GetAssetUploadsFolder(); if (CogbotHelpers.IsNullOrZero(au)) { Success("Cant get AssetUploads folder"); return; } foreach (var file in Directory.GetFiles(ExportCommand.assetDumpDir, "*.*")) { if (file.EndsWith(".object") || file.EndsWith(".simasset") || file.EndsWith(".rzi")) { continue; } string sid = file; AssetType assetType = AssetType.Unknown; foreach (var ate in ArchiveConstants.ASSET_TYPE_TO_EXTENSION) { string ateValue = ate.Value; if (file.EndsWith(ateValue)) { assetType = ate.Key; sid = Path.GetFileName(file.Substring(0, file.Length - ateValue.Length)); break; } } if (assetType == AssetType.Unknown) { if (file.EndsWith(".jp2")) { assetType = AssetType.Texture; sid = Path.GetFileName(file.Substring(0, file.Length - ".jp2".Length)); } if (file.EndsWith(".ogg")) { assetType = AssetType.Sound; sid = Path.GetFileName(file.Substring(0, file.Length - ".ogg".Length)); } } if (assetType == AssetType.Unknown) { Failure("Cant guess assetyype for " + file); continue; } seenAsset++; UUID oldID = UUID.Parse(sid); ItemToCreate itc = FindItemToCreate(oldID, assetType, sameIds); itc.LLSDFilename = file; ItemsToCreate.Add(itc); } foreach (ItemToCreate itc in ItemsToCreate) { if (itc.PassNumber == 1) { EnsureUploaded(itc, alwayReupload, ref uploaded, ref reuploaded); } } foreach (ItemToCreate itc in ItemsToCreate) { if (itc.PassNumber == 2) { itc.ReplaceAll(); EnsureUploaded(itc, alwayReupload, ref uploaded, ref reuploaded); } } Success("Uploaded assets=" + uploaded + " seenAssets=" + seenAsset + " reuploaded=" + reuploaded); }
public static void ReplaceLSLText(string dir, string before, string after, ImportSettings arglist) { int changed = 0; int seenAsset = 0; HashSet<ItemToCreate> ItemsToCreate = LocalScene.Assets; bool alwayReupload = arglist.Contains("reup"); foreach (var file in Directory.GetFiles(dir, "*.lsl")) { seenAsset++; string readfile = File.ReadAllText(file); if (!readfile.Contains(before)) continue; readfile = readfile.Replace(before,after); changed++; File.WriteAllText(file,readfile); } Importing.Success("ReplaceLSLText seenAssets=" + seenAsset + " changed=" + changed); }
private void UploadAllAssets(ImportSettings arglist) { bool sameIds = arglist.Contains("sameid"); int uploaded = 0; int reuploaded = 0; int seenAsset = 0; HashSet <ItemToCreate> ItemsToCreate = LocalScene.Assets; bool alwayReupload = arglist.Contains("reup"); Success("Uploading assets... sameIds=" + sameIds); var au = GetAssetUploadsFolder(); if (CogbotHelpers.IsNullOrZero(au)) { Success("Cant get AssetUploads folder"); return; } foreach (var file in Directory.GetFiles(ExportCommand.assetDumpDir, "*.*")) { if (file.EndsWith(".object") || file.EndsWith(".simasset") || file.EndsWith(".rzi")) { continue; } string sid = file; AssetType assetType = AssetType.Unknown; foreach (var ate in ArchiveConstants.ASSET_TYPE_TO_EXTENSION) { string ateValue = ate.Value; if (file.EndsWith(ateValue)) { assetType = ate.Key; sid = Path.GetFileName(file.Substring(0, file.Length - ateValue.Length)); break; } } if (assetType == AssetType.Unknown) { if (file.EndsWith(".jp2")) { assetType = AssetType.Texture; sid = Path.GetFileName(file.Substring(0, file.Length - ".jp2".Length)); } if (file.EndsWith(".ogg")) { assetType = AssetType.Sound; sid = Path.GetFileName(file.Substring(0, file.Length - ".ogg".Length)); } } if (assetType == AssetType.Unknown) { Failure("Cant guess assetyype for " + file); continue; } seenAsset++; UUID oldID = UUID.Parse(sid); ItemToCreate itc = FindItemToCreate(oldID, assetType, sameIds); itc.LLSDFilename = file; ItemsToCreate.Add(itc); } foreach (ItemToCreate itc in ItemsToCreate) { if (itc.PassNumber == 1) { EnsureUploaded(itc, alwayReupload, ref uploaded, ref reuploaded); } } foreach (ItemToCreate itc in ItemsToCreate) { if (itc.PassNumber == 2) { itc.ReplaceAll(); EnsureUploaded(itc, alwayReupload, ref uploaded, ref reuploaded); } } Success("Uploaded assets=" + uploaded + " seenAssets=" + seenAsset + " reuploaded=" + reuploaded); }
public CmdResult Execute(string[] args, UUID fromAgentID, OutputDelegate WriteLine) { Client.Self.Movement.Camera.Far = 1023; Client.Self.Movement.SendUpdate(true); Exporting = this; IsExporting = true; var CurSim = Client.Network.CurrentSim; RegionHandle = CurSim.Handle; haveBeenTo.AddPoint(TheSimAvatar.SimPosition); AttemptSitMover(); WorldObjects.MaintainSimObjectInfoMap = false; SimObjectImpl.AffordinancesGuessSimObjectTypes = false; WorldSystem.IgnoreKillObjects = true; inventoryHolder.Clear(); lslScripts.Clear(); successfullyExportedPrims.Clear(); const string hlp = @" Toplevel Directives // todo = shows what must be done for export to be complete (suggest adding verbose) // perms = shows what perms are going to be a problem (suggest adding verbose) // clear - clear the export dir // reset - reset the exporter state // cache - blow away asset cache // move - begin moving arround // nomove - stop moving arround // spec [spec] - do only prims meeting spec (default is 'spec $region') // incr - do only do what is 'todo' // nonincr - do things 'todo' but also 'redo' things already done // noperms = dont skip things when perms might be a problem // quietly = terser output // verbose = more verbose // request = will rerequest missing things like textures // force = will allow unequal LLSD files - this should only be used as last resort // users - users files // groups - groups files // terrain - terrain files // parcels - parcels files // estate - estate files (TODO) // siminfo - estate files (TODO) // llsd - llsd files // links - operate on linset // deps - operate on dependant assets // dl - operate on dependant downloads // tasks - save task files // taskobj - task objects // all = llsd tasks deps links (dl and taskobj not included) "; if (args == null || args.Length == 0) return Failure(hlp); string[] nargs = { "$region" }; ImportSettings arglist = new ImportSettings { CurSim = Client.Network.CurrentSim, GroupID = Client.Self.ActiveGroup }; settings = arglist; if (args[0]=="hhp") { args = new string[] { "taskobjs", "nobuf", "all", "spec", "f0a89a9f-3f33-b2aa-2829-eaeec3d08b82" }; } foreach (string s in args) { arglist.Add(s); } if (arglist.Contains("error")) return WriteErrors(args); if (arglist.Contains("help")) return Success(hlp); if (args.Length > 1) { int specIndex = Array.IndexOf(args, "spec"); if (specIndex > 0) { nargs = Parser.SplitOff(args, specIndex + 1); } int fnd = Array.IndexOf(args, "move"); if (fnd > -1 && (fnd + 1 < args.Length)) { int mv; if (int.TryParse(args[fnd + 1], out mv)) { moveSleep = mv; if ((fnd + 2 < args.Length) && int.TryParse(args[fnd + 2], out mv)) { maxHeigth = mv; } } } } if (arglist.Contains("move")) { if (arglist.Contains("wps")) { AddRegionWaypoints(); } BeginMoving(); GiveStatus(); return Success("Began moving"); } if (arglist.Contains("nomove")) { StopMoving(); GiveStatus(); return Success("Stopped moving"); } quietly = arglist.Contains("quietly"); if (arglist.Contains("prim")) { arglist.Add("llsd"); arglist.Add("dep"); arglist.Add("link"); } if (arglist.Contains("all")) { arglist.Add("llsd"); arglist.Add("task"); arglist.Add("dep"); arglist.Add("link"); } needFiles = 0; taskobj = arglist.Contains("taskobj"); forced = arglist.Contains("force") || arglist.Contains("forced"); if (arglist.Contains("nonincr")) Incremental = false; if (arglist.Contains("incr")) Incremental = true; bool fileOnly = false; lock (fileWriterLock) { if (arglist.Contains("clear")) { KillAllUnpacked(WriteLine, true); PurgeExport(); arglist.Add("reset"); } if (!Directory.Exists(dumpDir)) Directory.CreateDirectory(dumpDir); if (!Directory.Exists(assetDumpDir)) Directory.CreateDirectory(assetDumpDir); if (!Directory.Exists(terrainDir)) Directory.CreateDirectory(terrainDir); if (!Directory.Exists(siminfoDir)) Directory.CreateDirectory(siminfoDir); if (arglist.Contains("cache")) { fileOnly = true; PurgeCache(); } } if (arglist.Contains("reset")) { slowlyExport.Clear(); lock (ToDownloadAssets) ToDownloadAssets.Clear(); lock (CompletedAssets) CompletedAssets.Clear(); lock (PrimWaitingLinkset) PrimWaitingLinkset.Clear(); lock (AllRelatedAssets) AllRelatedAssets.Clear(); lock (PrimDepsAssets) PrimDepsAssets.Clear(); lock (TaskAssetWaiting) TaskAssetWaiting.Clear(); lock (CompletedTaskItem) CompletedTaskItem.Clear(); #if OBJECTUNPACKER lock (TasksRezed) TasksRezed.Clear(); #endif GiveStatus(); return Success("Reset SimExport State"); } if (fileOnly) { GiveStatus(); return Success("Manipulated filesystem"); } if (arglist.Contains("cleanup")) { return CleanupAfterExport(fromAgentID, WriteLine); } if (arglist.Contains("killtasks")) { KillAllUnpacked(WriteLine, true); return SuccessOrFailure(); } IsExporting = true; FolderCalled("TaskInvHolder"); //string file = args[args.Length - 1]; int used; List<SimObject> PS = WorldSystem.GetPrimitives(nargs, out used); if (IsEmpty(PS)) return Failure("Cannot find objects from " + string.Join(" ", args)); showsStatus = arglist.Contains("statu"); showPermsOnly = arglist.Contains("perm"); skipPerms = !arglist.Contains("obeyperm"); showsMissingOnly = arglist.Contains("todo"); if (showsMissingOnly) quietly = true; verbosely = arglist.Contains("verbose"); if (verbosely && !arglist.Contains("quietly")) quietly = false; int missing = 0; var canExport = new List<SimObject>(); int objects = 0; if (arglist.Contains("terrain")) { SaveTerrainHeight(arglist); StartTerrainDownload(arglist); } if (arglist.Contains("parcel")) { SaveParcelInfoCommand(arglist); } bool primsAtAll = arglist.Contains("link") || arglist.Contains("task") || arglist.Contains("llsd") || arglist.Contains("taskobj") || arglist.Contains("all"); bool wasShouldBeMoving = shouldBeMoving; if (primsAtAll) { shouldBeMoving = false; } if (arglist.Contains("nobuf")) { PSBuf.Clear(); } PSBuf.AddRange(PS); lock (Importing.MustExport) { foreach (UUID id in LockInfo.CopyOf(Importing.MustExport)) { var o = WorldObjects.GetSimObjectFromUUID(id); if (o != null) PSBuf.Add(o); } } foreach (var P in PSBuf) { if (!primsAtAll) break; if (string.IsNullOrEmpty(IsComplete(P.ID, false, false, arglist))) continue; // skip attachments and avatars if (IsSkipped(P, arglist)) continue; if (!P.HasPrim) { if (!quietly) Failure("Missing Prim: " + named(P)); continue; } if (P.RegionHandle != RegionHandle) continue; Vector3 sp; if (!P.TryGetSimPosition(out sp)) continue; objects++; string issues = P.MissingData; if (!string.IsNullOrEmpty(issues) && !arglist.Allows(issues, P)) { missing++; if (!quietly) Failure("Issues " + issues + " " + named(P)); continue; } bool exportPossible = checkPerms(Client, P, showPermsOnly ? (OutputDelegate)LocalFailure : SilientFailure, false) || skipPerms; if (exportPossible) { SnagUsers(P); canExport.Add(P); } } Success("Can export " + canExport.Count + " of " + objects); if (showPermsOnly) return Success("Shown perms"); foreach (var P in canExport) { if (!primsAtAll) break; if (P is SimAvatar) continue; // skip attachments if (P.Parent is SimAvatar) continue; string issues = P.MissingData; if (!string.IsNullOrEmpty(issues) && !arglist.Allows(issues, P)) { continue; } //if (exportedPrims.Contains(P)) continue; LocalFailures = 0; PrimDepsAssets.Clear(); ExportPrim(Client, P, LocalFailure, arglist); if (P.IsRoot) { float pSimPositionZ = P.SimPosition.Z; if (pSimPositionZ > maxHeigth) { maxHeigth = pSimPositionZ + 10; } seenObjectsAt.AddPoint(P.SimPosition); } if (LocalFailures == 0) { if (!successfullyExportedPrims.Contains(P)) successfullyExportedPrims.Add(P); } } ExportRelatedAssets(); if (showsStatus) { arglist.Add("link"); arglist.Add("task"); arglist.Add("llsd"); } if (arglist.Contains("link")) { // lock (PrimWaitingLinkset) { foreach (var pa in LockInfo.CopyOf(PrimWaitingLinkset)) { var exportPrim = pa.Value.O; if (verbosely) Failure("Awaiting Linkset " + named(exportPrim)); if (arglist.Contains("request")) { RequestLinksetInfo(Client, Path.Combine(dumpDir, exportPrim.ID.ToString()), exportPrim, WriteLine, arglist); } } } } if (arglist.Contains("task")) { lock (TaskAssetWaiting) { foreach (var pa in LockInfo.CopyOf(TaskAssetWaiting)) { UUID assetID = pa.Value.SourceItem.AssetUUID; if (!CogbotHelpers.IsNullOrZero(assetID)) { if (CompletedAssets.Contains(assetID)) { int count = TaskAssetWaiting.Count; TaskAssetWaiting.Remove(pa.Key); if (TaskAssetWaiting.Count != count - 1) { Failure("VERY BAD!"); } } } if (verbosely) Failure("Awaiting TaskAsset " + pa.Value); if (arglist.Contains("request")) { pa.Value.Request(); } } } } ExportRelatedAssets(); foreach (var assetID in LockInfo.CopyOf(ToDownloadAssets)) { PingAssetCache(assetID); } if (arglist.Contains("dl")) { foreach (var assetID in LockInfo.CopyOf(ToDownloadAssets)) { AssetType assetType = assetTypeOf(assetID); if (verbosely) Failure("Awaiting DL " + assetID + " " + assetType); if (arglist.Contains("request")) { StartAssetDownload(null, assetID, assetType); } } } if (arglist.Contains("user")) { RequestUsersAndGroups(); } if (arglist.Contains("siprim")) { foreach (SimObject o in LockInfo.CopyOf(SIPrims)) { if (o.Prim.ParentID == 0) { Client.Inventory.RequestDeRezToInventory(o.LocalID, DeRezDestination.AgentInventoryCopy, FolderCalled("UseSIForCompleteness"), UUID.Random()); } else { Failure("Child SIPrim " + o); } } } Success("Missing PrimData: " + missing); Success("Started XFERS " + ToDownloadCalledAssets.Count + " assets"); shouldBeMoving = wasShouldBeMoving; GiveStatus(); if (primsAtAll) { shouldBeMoving = wasShouldBeMoving; } return Success("Done"); }
private int ImportTaskFiles0(ImportSettings importSettings, bool createObjects) { //if (IsLocalScene) return 0; DateTime lastProgressNotice = DateTime.Now; int incomplete = 0; var agentSyncFolderHolder = Exporting.FolderCalled("TaskInvHolder"); int created = 0; foreach (var file in Directory.GetFiles(ExportCommand.dumpDir, "*.task")) { string fileUUID = Path.GetFileNameWithoutExtension(Path.GetFileName(file)); var ptc = APrimToCreate(UUID.Parse(fileUUID)); if (++created % 25 == 0) { WriteLine("tasked " + created); } if (ptc.PackedInsideNow) { continue; } // if (ptc.TaskInvComplete) continue; if ((ptc.Prim.RegionHandle != importSettings.CurSim.Handle) && importSettings.Contains("CheckRegion")) { KillID(ptc.OldID); continue; } string taskDataS = File.ReadAllText(file); if (string.IsNullOrEmpty(taskDataS) || taskDataS.Length < 30) { ptc.TaskInvComplete = true; continue; } ptc.CreateWorkflow(agentSyncFolderHolder); if (!ptc.LoadTaskOSD(WriteLine)) { //Failure("FAILED: LoadOSD " + ptc); incomplete++; continue; } if (!ptc.SyncToAgentFolder(WriteLine, createObjects)) { //Failure("FAILED: SyncToAgentFolder " + ptc); if (ptc.succeeded == 0) { continue; } } if (!ptc.SyncToObject(WriteLine, createObjects)) { //Failure("FAILED: SyncToObject " + ptc); if (ptc.succeeded == 0) { continue; } } if (!ptc.Complete) { Failure("INCOMPLETE: " + ptc); incomplete++; } else { Success("COMPLETE: " + ptc); } if (!IsLocalScene) { Success("............"); } if (lastProgressNotice.AddSeconds(30) < DateTime.Now) { lastProgressNotice = DateTime.Now; WriteLine("Task created " + created + " incomplete=" + incomplete); } } return(incomplete); }
private void RequestMissingIDs(ImportSettings settings) { ExportCommand.IsExporting = true; foreach (MissingItemInfo itemInfo in MissingFromExport) { var ex = ExportCommand.Exporting; if (itemInfo.AssetType == AssetType.Unknown) { Failure("MISSING STILL: " + itemInfo); continue; } Success("Requesting: " + itemInfo); if (itemInfo.AssetType == AssetType.Landmark) { Client.Grid.RequestRegionHandle(itemInfo.MissingID); continue; } if (itemInfo.AssetType == AssetType.EnsembleStart) { if (settings.Contains("requestaccts")) Client.Groups.RequestGroupName(itemInfo.MissingID); continue; } if (itemInfo.AssetType == AssetType.CallingCard) { if (settings.Contains("requestaccts")) Client.Avatars.RequestAvatarName(itemInfo.MissingID); continue; } ex.AddRelated(itemInfo.MissingID, itemInfo.AssetType); } }
private static Enum Reperm(PermissionMask mask, ImportSettings settings) { if (settings.Contains("sameperms")) return mask; if (settings.Contains("+xfer+copy")) return mask | PermissionMask.Copy | PermissionMask.Transfer; return PermissionMask.All; }
internal bool ExportPrim0(BotClient Client, SimObject exportPrim, OutputDelegate Failure, ImportSettings settings) { if (IsSkipped(exportPrim, settings)) return false; Simulator CurSim = exportPrim.GetSimulator(); //settings.CurSim = CurSim; WorldObjects.EnsureSelected(exportPrim.LocalID, CurSim); string pathStem = Path.Combine(dumpDir, exportPrim.ID.ToString()); if (settings.Contains("task") || showsMissingOnly) { exportPrim.StartGetTaskInventory(); } if (settings.Contains("wait")) { var waitUntil = DateTime.Now.AddSeconds(10); bool needsLoop = true; while (needsLoop && waitUntil > DateTime.Now) { needsLoop = false; if (exportPrim.Properties == null || CogbotHelpers.IsNullOrZero(exportPrim.Properties.OwnerID)) { needsLoop = true; } if (settings.Contains("task")) { var ti = exportPrim.TaskInventory; if (ti == null) { needsLoop = true; } } } if (needsLoop) { Success("needs loop " + named(exportPrim)); string bissues = exportPrim.MissingData; if (!string.IsNullOrEmpty(bissues) && !settings.Allows(bissues ,exportPrim)) { Failure("Cant wait out the Issues " + bissues + ": " + named(exportPrim)); if (LocalFailures == 0) LocalFailures++; // return; } } } string issues = exportPrim.MissingData; if (!string.IsNullOrEmpty(issues) && !settings.Allows(issues, exportPrim)) { Failure("Issues " + issues + " " + named(exportPrim)); if (LocalFailures == 0) LocalFailures++; //return false; } //ImportCommand.PrimToCreate ptc = ImportCommand.Running.APrimToCreate(exportPrim.ID); //ptc._prim = exportPrim.Prim; bool passedOK = true; if (settings.Contains("llsd")) { SaveLLSD(Client, pathStem, exportPrim, Failure, settings); } if (exportPrim.IsRoot && (true || exportPrim.Children.Count > 0)) { if (settings.Contains("link")) SaveLinksetInfo(Client, pathStem, exportPrim, Failure, settings); string exportFile = pathStem + ".link"; //lock (fileWriterLock) if (File.Exists(exportFile)) { foreach (var c in exportPrim.Children) { var ch = ExportPrim(Client, c, Failure, settings); if (!ch) passedOK = false; } } } if (settings.Contains("task")) { if (!SaveTaskInv(settings, Client, pathStem, exportPrim, Failure)) passedOK = false; // ImportCommand.PrimToCreate ptc = ImportCommand.Running.APrimToCreate(exportPrim.ID); // if (!ptc.EnsureTaskInv()) return false; } if (!settings.Contains("dep")) return passedOK; AddRelatedTextures(exportPrim); SaveRelatedAssets(pathStem, exportPrim, Failure); return passedOK; }
public CmdResult Execute(string[] args, UUID fromAgentID, OutputDelegate WriteLine) { Client.Self.Movement.Camera.Far = 1023; Client.Self.Movement.SendUpdate(true); Exporting = this; IsExporting = true; var CurSim = Client.Network.CurrentSim; RegionHandle = CurSim.Handle; haveBeenTo.AddPoint(TheSimAvatar.SimPosition); AttemptSitMover(); WorldObjects.MaintainSimObjectInfoMap = false; SimObjectImpl.AffordinancesGuessSimObjectTypes = false; WorldSystem.IgnoreKillObjects = true; inventoryHolder.Clear(); lslScripts.Clear(); successfullyExportedPrims.Clear(); const string hlp = @" Toplevel Directives // todo = shows what must be done for export to be complete (suggest adding verbose) // perms = shows what perms are going to be a problem (suggest adding verbose) // clear - clear the export dir // reset - reset the exporter state // cache - blow away asset cache // move - begin moving arround // nomove - stop moving arround // spec [spec] - do only prims meeting spec (default is 'spec $region') // incr - do only do what is 'todo' // nonincr - do things 'todo' but also 'redo' things already done // noperms = dont skip things when perms might be a problem // quietly = terser output // verbose = more verbose // request = will rerequest missing things like textures // force = will allow unequal LLSD files - this should only be used as last resort // users - users files // groups - groups files // terrain - terrain files // parcels - parcels files // estate - estate files (TODO) // siminfo - estate files (TODO) // llsd - llsd files // links - operate on linset // deps - operate on dependant assets // dl - operate on dependant downloads // tasks - save task files // taskobj - task objects // all = llsd tasks deps links (dl and taskobj not included) "; if (args == null || args.Length == 0) { return(Failure(hlp)); } string[] nargs = { "$region" }; ImportSettings arglist = new ImportSettings { CurSim = Client.Network.CurrentSim, GroupID = Client.Self.ActiveGroup }; settings = arglist; if (args[0] == "hhp") { args = new string[] { "taskobjs", "nobuf", "all", "spec", "f0a89a9f-3f33-b2aa-2829-eaeec3d08b82" }; } foreach (string s in args) { arglist.Add(s); } if (arglist.Contains("error")) { return(WriteErrors(args)); } if (arglist.Contains("help")) { return(Success(hlp)); } if (args.Length > 1) { int specIndex = Array.IndexOf(args, "spec"); if (specIndex > 0) { nargs = Parser.SplitOff(args, specIndex + 1); } int fnd = Array.IndexOf(args, "move"); if (fnd > -1 && (fnd + 1 < args.Length)) { int mv; if (int.TryParse(args[fnd + 1], out mv)) { moveSleep = mv; if ((fnd + 2 < args.Length) && int.TryParse(args[fnd + 2], out mv)) { maxHeigth = mv; } } } } if (arglist.Contains("move")) { if (arglist.Contains("wps")) { AddRegionWaypoints(); } BeginMoving(); GiveStatus(); return(Success("Began moving")); } if (arglist.Contains("nomove")) { StopMoving(); GiveStatus(); return(Success("Stopped moving")); } quietly = arglist.Contains("quietly"); if (arglist.Contains("prim")) { arglist.Add("llsd"); arglist.Add("dep"); arglist.Add("link"); } if (arglist.Contains("all")) { arglist.Add("llsd"); arglist.Add("task"); arglist.Add("dep"); arglist.Add("link"); } needFiles = 0; taskobj = arglist.Contains("taskobj"); forced = arglist.Contains("force") || arglist.Contains("forced"); if (arglist.Contains("nonincr")) { Incremental = false; } if (arglist.Contains("incr")) { Incremental = true; } bool fileOnly = false; lock (fileWriterLock) { if (arglist.Contains("clear")) { KillAllUnpacked(WriteLine, true); PurgeExport(); arglist.Add("reset"); } if (!Directory.Exists(dumpDir)) { Directory.CreateDirectory(dumpDir); } if (!Directory.Exists(assetDumpDir)) { Directory.CreateDirectory(assetDumpDir); } if (!Directory.Exists(terrainDir)) { Directory.CreateDirectory(terrainDir); } if (!Directory.Exists(siminfoDir)) { Directory.CreateDirectory(siminfoDir); } if (arglist.Contains("cache")) { fileOnly = true; PurgeCache(); } } if (arglist.Contains("reset")) { slowlyExport.Clear(); lock (ToDownloadAssets) ToDownloadAssets.Clear(); lock (CompletedAssets) CompletedAssets.Clear(); lock (PrimWaitingLinkset) PrimWaitingLinkset.Clear(); lock (AllRelatedAssets) AllRelatedAssets.Clear(); lock (PrimDepsAssets) PrimDepsAssets.Clear(); lock (TaskAssetWaiting) TaskAssetWaiting.Clear(); lock (CompletedTaskItem) CompletedTaskItem.Clear(); #if OBJECTUNPACKER lock (TasksRezed) TasksRezed.Clear(); #endif GiveStatus(); return(Success("Reset SimExport State")); } if (fileOnly) { GiveStatus(); return(Success("Manipulated filesystem")); } if (arglist.Contains("cleanup")) { return(CleanupAfterExport(fromAgentID, WriteLine)); } if (arglist.Contains("killtasks")) { KillAllUnpacked(WriteLine, true); return(SuccessOrFailure()); } IsExporting = true; FolderCalled("TaskInvHolder"); //string file = args[args.Length - 1]; int used; List <SimObject> PS = WorldSystem.GetPrimitives(nargs, out used); if (IsEmpty(PS)) { return(Failure("Cannot find objects from " + string.Join(" ", args))); } showsStatus = arglist.Contains("statu"); showPermsOnly = arglist.Contains("perm"); skipPerms = !arglist.Contains("obeyperm"); showsMissingOnly = arglist.Contains("todo"); if (showsMissingOnly) { quietly = true; } verbosely = arglist.Contains("verbose"); if (verbosely && !arglist.Contains("quietly")) { quietly = false; } int missing = 0; var canExport = new List <SimObject>(); int objects = 0; if (arglist.Contains("terrain")) { SaveTerrainHeight(arglist); StartTerrainDownload(arglist); } if (arglist.Contains("parcel")) { SaveParcelInfoCommand(arglist); } bool primsAtAll = arglist.Contains("link") || arglist.Contains("task") || arglist.Contains("llsd") || arglist.Contains("taskobj") || arglist.Contains("all"); bool wasShouldBeMoving = shouldBeMoving; if (primsAtAll) { shouldBeMoving = false; } if (arglist.Contains("nobuf")) { PSBuf.Clear(); } PSBuf.AddRange(PS); lock (Importing.MustExport) { foreach (UUID id in LockInfo.CopyOf(Importing.MustExport)) { var o = WorldObjects.GetSimObjectFromUUID(id); if (o != null) { PSBuf.Add(o); } } } foreach (var P in PSBuf) { if (!primsAtAll) { break; } if (string.IsNullOrEmpty(IsComplete(P.ID, false, false, arglist))) { continue; } // skip attachments and avatars if (IsSkipped(P, arglist)) { continue; } if (!P.HasPrim) { if (!quietly) { Failure("Missing Prim: " + named(P)); } continue; } if (P.RegionHandle != RegionHandle) { continue; } Vector3 sp; if (!P.TryGetSimPosition(out sp)) { continue; } objects++; string issues = P.MissingData; if (!string.IsNullOrEmpty(issues) && !arglist.Allows(issues, P)) { missing++; if (!quietly) { Failure("Issues " + issues + " " + named(P)); } continue; } bool exportPossible = checkPerms(Client, P, showPermsOnly ? (OutputDelegate)LocalFailure : SilientFailure, false) || skipPerms; if (exportPossible) { SnagUsers(P); canExport.Add(P); } } Success("Can export " + canExport.Count + " of " + objects); if (showPermsOnly) { return(Success("Shown perms")); } foreach (var P in canExport) { if (!primsAtAll) { break; } if (P is SimAvatar) { continue; } // skip attachments if (P.Parent is SimAvatar) { continue; } string issues = P.MissingData; if (!string.IsNullOrEmpty(issues) && !arglist.Allows(issues, P)) { continue; } //if (exportedPrims.Contains(P)) continue; LocalFailures = 0; PrimDepsAssets.Clear(); ExportPrim(Client, P, LocalFailure, arglist); if (P.IsRoot) { float pSimPositionZ = P.SimPosition.Z; if (pSimPositionZ > maxHeigth) { maxHeigth = pSimPositionZ + 10; } seenObjectsAt.AddPoint(P.SimPosition); } if (LocalFailures == 0) { if (!successfullyExportedPrims.Contains(P)) { successfullyExportedPrims.Add(P); } } } ExportRelatedAssets(); if (showsStatus) { arglist.Add("link"); arglist.Add("task"); arglist.Add("llsd"); } if (arglist.Contains("link")) { // lock (PrimWaitingLinkset) { foreach (var pa in LockInfo.CopyOf(PrimWaitingLinkset)) { var exportPrim = pa.Value.O; if (verbosely) { Failure("Awaiting Linkset " + named(exportPrim)); } if (arglist.Contains("request")) { RequestLinksetInfo(Client, Path.Combine(dumpDir, exportPrim.ID.ToString()), exportPrim, WriteLine, arglist); } } } } if (arglist.Contains("task")) { lock (TaskAssetWaiting) { foreach (var pa in LockInfo.CopyOf(TaskAssetWaiting)) { UUID assetID = pa.Value.SourceItem.AssetUUID; if (!CogbotHelpers.IsNullOrZero(assetID)) { if (CompletedAssets.Contains(assetID)) { int count = TaskAssetWaiting.Count; TaskAssetWaiting.Remove(pa.Key); if (TaskAssetWaiting.Count != count - 1) { Failure("VERY BAD!"); } } } if (verbosely) { Failure("Awaiting TaskAsset " + pa.Value); } if (arglist.Contains("request")) { pa.Value.Request(); } } } } ExportRelatedAssets(); foreach (var assetID in LockInfo.CopyOf(ToDownloadAssets)) { PingAssetCache(assetID); } if (arglist.Contains("dl")) { foreach (var assetID in LockInfo.CopyOf(ToDownloadAssets)) { AssetType assetType = assetTypeOf(assetID); if (verbosely) { Failure("Awaiting DL " + assetID + " " + assetType); } if (arglist.Contains("request")) { StartAssetDownload(null, assetID, assetType); } } } if (arglist.Contains("user")) { RequestUsersAndGroups(); } if (arglist.Contains("siprim")) { foreach (SimObject o in LockInfo.CopyOf(SIPrims)) { if (o.Prim.ParentID == 0) { Client.Inventory.RequestDeRezToInventory(o.LocalID, DeRezDestination.AgentInventoryCopy, FolderCalled("UseSIForCompleteness"), UUID.Random()); } else { Failure("Child SIPrim " + o); } } } Success("Missing PrimData: " + missing); Success("Started XFERS " + ToDownloadCalledAssets.Count + " assets"); shouldBeMoving = wasShouldBeMoving; GiveStatus(); if (primsAtAll) { shouldBeMoving = wasShouldBeMoving; } return(Success("Done")); }