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; }
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); }
internal bool SaveTaskInv(ImportSettings arglist, BotClient Client, string pathStem, SimObject exportPrim, OutputDelegate Failure) { string exportFile = pathStem + ".task"; if (Incremental || showsMissingOnly) { lock (fileWriterLock) if (File.Exists(exportFile)) { return(true); } } needFiles++; exportPrim.StartGetTaskInventory(); bool mightHaveTaskInv = exportPrim.TaskInventoryLikely; var ib = exportPrim.TaskInventory; if (ib == null || ib == SimObjectImpl.ERROR_TASK_INV) { bool canSee = checkPerms(Client, exportPrim, SilientFailure, false); bool canScript = checkPerms(Client, exportPrim, SilientFailure, true); if (!canSee) { if (!mightHaveTaskInv) { LogError(exportPrim, "!canSee TaskInv"); lock (fileWriterLock) File.WriteAllText(exportFile, "!canSee"); return(true); } Failure("Cant get/check TaskInv of " + named(exportPrim)); } Failure("NULL TaskInv for " + named(exportPrim)); if (!canScript) { LogError(exportPrim, "!canScript to get TaskInv"); lock (fileWriterLock) File.WriteAllText(exportFile, "!canScript"); return(true); } if (ib == SimObjectImpl.ERROR_TASK_INV) { LogError(exportPrim, "TaskInv Null once"); lock (fileWriterLock) File.WriteAllText(exportFile, "!error"); } return(true); } if (ib.Count == 0) { if (!exportPrim.InventoryEmpty) { if (verbosely) { Failure("ZEROITEM TaskInv for " + named(exportPrim)); } //return; } lock (fileWriterLock) File.WriteAllText(exportFile, ""); return(true); } if (ib.Count == 1) { if (ib[0].Name == "Contents" && ib[0] is InventoryFolder) { lock (fileWriterLock) File.WriteAllText(exportFile, ""); return(true); } } SaveTaskOSD(exportPrim.ID, ib); return(true); OSDArray contents = new OSDArray(); string TaskInvFailures = ""; bool hasObjects = false; foreach (InventoryBase b in ib) { if (b is InventoryObject) { hasObjects = true; break; } } bool wasShouldBeMoving = shouldBeMoving; shouldBeMoving = false; if (hasObjects && taskobj) { MoveCloseTo(exportPrim); } foreach (InventoryBase b in ib) { bool missing; OSDMap was = SaveEachTaskItem(arglist, Client, exportPrim, b, Failure, out missing); if (was != null) { contents.Add(was); } if (missing) { if (forced && false) { Failure("Missing but forced: " + was); } else { TaskInvFailures += was; } } } shouldBeMoving = wasShouldBeMoving; // TaskInvFailures = GetTaskInvFailures(Failure, exportPrim, Client, folderObject, contents, TaskInvFailures); if (showsMissingOnly) { Failure("NEED TASK for " + named(exportPrim)); return(false); } if (string.IsNullOrEmpty(TaskInvFailures)) { lock (fileWriterLock) File.WriteAllText(exportFile, OSDParser.SerializeLLSDXmlString(contents)); } else { Failure(string.Format("Skipping writting contents unil Items/Objects can be resolved: for {0}\n{1}", named(exportPrim), TaskInvFailures)); } var ptc = Importing.APrimToCreate(exportPrim.ID); return(ptc.EnsureTaskInv(false)); }
internal bool SaveTaskInv(ImportSettings arglist, BotClient Client, string pathStem, SimObject exportPrim, OutputDelegate Failure) { string exportFile = pathStem + ".task"; if (Incremental || showsMissingOnly) lock (fileWriterLock) if (File.Exists(exportFile)) return true; needFiles++; exportPrim.StartGetTaskInventory(); bool mightHaveTaskInv = exportPrim.TaskInventoryLikely; var ib = exportPrim.TaskInventory; if (ib == null || ib == SimObjectImpl.ERROR_TASK_INV) { bool canSee = checkPerms(Client, exportPrim, SilientFailure, false); bool canScript = checkPerms(Client, exportPrim, SilientFailure, true); if (!canSee) { if (!mightHaveTaskInv) { LogError(exportPrim, "!canSee TaskInv"); lock (fileWriterLock) File.WriteAllText(exportFile, "!canSee"); return true; } Failure("Cant get/check TaskInv of " + named(exportPrim)); } Failure("NULL TaskInv for " + named(exportPrim)); if (!canScript) { LogError(exportPrim, "!canScript to get TaskInv"); lock (fileWriterLock) File.WriteAllText(exportFile, "!canScript"); return true; } if (ib == SimObjectImpl.ERROR_TASK_INV) { LogError(exportPrim, "TaskInv Null once"); lock (fileWriterLock) File.WriteAllText(exportFile, "!error"); } return true; } if (ib.Count == 0) { if (!exportPrim.InventoryEmpty) { if (verbosely) Failure("ZEROITEM TaskInv for " + named(exportPrim)); //return; } lock (fileWriterLock) File.WriteAllText(exportFile, ""); return true; } if (ib.Count == 1) { if (ib[0].Name == "Contents" && ib[0] is InventoryFolder) { lock (fileWriterLock) File.WriteAllText(exportFile, ""); return true; } } SaveTaskOSD(exportPrim.ID, ib); return true; OSDArray contents = new OSDArray(); string TaskInvFailures = ""; bool hasObjects = false; foreach (InventoryBase b in ib) { if (b is InventoryObject) { hasObjects = true; break; } } bool wasShouldBeMoving = shouldBeMoving; shouldBeMoving = false; if (hasObjects && taskobj) MoveCloseTo(exportPrim); foreach (InventoryBase b in ib) { bool missing; OSDMap was = SaveEachTaskItem(arglist, Client, exportPrim, b, Failure, out missing); if (was != null) contents.Add(was); if (missing) { if (forced && false) { Failure("Missing but forced: " + was); } else { TaskInvFailures += was; } } } shouldBeMoving = wasShouldBeMoving; // TaskInvFailures = GetTaskInvFailures(Failure, exportPrim, Client, folderObject, contents, TaskInvFailures); if (showsMissingOnly) { Failure("NEED TASK for " + named(exportPrim)); return false; } if (string.IsNullOrEmpty(TaskInvFailures)) { lock (fileWriterLock) File.WriteAllText(exportFile, OSDParser.SerializeLLSDXmlString(contents)); } else { Failure(string.Format("Skipping writting contents unil Items/Objects can be resolved: for {0}\n{1}", named(exportPrim), TaskInvFailures)); } var ptc = Importing.APrimToCreate(exportPrim.ID); return ptc.EnsureTaskInv(false); }