read config
parent
a150ce2898
commit
09297af80e
17
prebuild.xml
17
prebuild.xml
|
@ -2,18 +2,18 @@
|
|||
<Project frameworkVersion="v4_6" name="RegionImages" path="addon-modules/RegionImages/src" type="Exe">
|
||||
<Configuration name="Debug">
|
||||
<Options>
|
||||
<OutputPath>../../bin/</OutputPath>
|
||||
<OutputPath>../../../bin/</OutputPath>
|
||||
<AllowUnsafe>true</AllowUnsafe>
|
||||
</Options>
|
||||
</Configuration>
|
||||
<Configuration name="Release">
|
||||
<Options>
|
||||
<OutputPath>../../bin/</OutputPath>
|
||||
<OutputPath>../../../bin/</OutputPath>
|
||||
<AllowUnsafe>true</AllowUnsafe>
|
||||
</Options>
|
||||
</Configuration>
|
||||
|
||||
<ReferencePath>../../bin/</ReferencePath>
|
||||
<ReferencePath>../../../bin/</ReferencePath>
|
||||
|
||||
<Reference name="System"/>
|
||||
<Reference name="System.Core"/>
|
||||
|
@ -21,12 +21,11 @@
|
|||
<Reference name="System.Data"/>
|
||||
<Reference name="System.Drawing"/>
|
||||
<Reference name="System.Runtime.Remoting"/>
|
||||
<Reference name="Nini" path="../../bin/"/>
|
||||
<Reference name="log4net" path="../../bin/"/>
|
||||
<Reference name="XMLRPC" path="../../bin/"/>
|
||||
<Reference name="MySql.Data" path="../../bin/"/>
|
||||
<Reference name="OpenMetaverseTypes" path="../../bin/"/>
|
||||
<Reference name="OpenMetaverse" path="../../bin/"/>
|
||||
<Reference name="Nini.dll" path="../../../bin/"/>
|
||||
<Reference name="log4net.dll" path="../../../bin/"/>
|
||||
<Reference name="MySql.Data.dll" path="../../../bin/"/>
|
||||
<Reference name="OpenMetaverseTypes.dll" path="../../../bin/"/>
|
||||
<Reference name="OpenMetaverse.dll" path="../../../bin/"/>
|
||||
<Reference name="OpenSim.Region.Framework"/>
|
||||
<Reference name="OpenSim.Framework"/>
|
||||
<Reference name="OpenSim.Framework.Console"/>
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Services.Connectors;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
@ -19,7 +18,7 @@ namespace GetRegionTextures
|
|||
class GetRegionTextures
|
||||
{
|
||||
private static MySqlConnection m_mySQLConnection = null;
|
||||
private static String m_assetURL = "http://172.21.0.150:5738/assets/";
|
||||
private static String m_assetURL = "http://127.0.0.1:8002/assets/";
|
||||
|
||||
private static List<UUID> m_assets = new List<UUID>();
|
||||
|
||||
|
@ -60,20 +59,53 @@ namespace GetRegionTextures
|
|||
return returnData;
|
||||
}
|
||||
|
||||
public static Stream GenerateStreamFromString(string s)
|
||||
{
|
||||
var stream = new MemoryStream();
|
||||
var writer = new StreamWriter(stream);
|
||||
writer.Write(s);
|
||||
writer.Flush();
|
||||
stream.Position = 0;
|
||||
return stream;
|
||||
}
|
||||
|
||||
static void Main(string[] args)
|
||||
{
|
||||
if (!File.Exists("config-include/GridCommon.ini"))
|
||||
if(File.Exists("ffmpeg.exe"))
|
||||
{
|
||||
Console.WriteLine("Cant find ffmpeg.exe");
|
||||
Console.ReadLine();
|
||||
return;
|
||||
}
|
||||
|
||||
IConfigSource source = new IniConfigSource("config-include/GridCommon.ini");
|
||||
String config = "";
|
||||
|
||||
if (File.Exists("OpenSim.ini"))
|
||||
config += File.ReadAllText("OpenSim.ini") + "\n";
|
||||
|
||||
if (File.Exists("config-include/GridCommon.ini"))
|
||||
config += File.ReadAllText("config-include/GridCommon.ini") + "\n";
|
||||
|
||||
IConfigSource source = new IniConfigSource(GenerateStreamFromString(config));
|
||||
source.ExpandKeyValues();
|
||||
|
||||
if (source.Configs["DatabaseService"] == null)
|
||||
return;
|
||||
|
||||
if (source.Configs["HGAssetService"] == null)
|
||||
return;
|
||||
|
||||
|
||||
if (source.Configs["DatabaseService"].GetString("ConnectionString", null) == null)
|
||||
return;
|
||||
|
||||
if (source.Configs["HGAssetService"].GetString("HomeURI", "http://127.0.0.1:8002") == null)
|
||||
return;
|
||||
|
||||
m_assetURL = source.Configs["HGAssetService"].GetString("HomeURI", "http://127.0.0.1:8002") + "/assets/";
|
||||
|
||||
Console.WriteLine("AssetServer URL: " + m_assetURL);
|
||||
|
||||
m_mySQLConnection = new MySqlConnection(source.Configs["DatabaseService"].GetString("ConnectionString", null));
|
||||
m_mySQLConnection.Open();
|
||||
|
||||
|
|
168
src/IDTools.cs
168
src/IDTools.cs
|
@ -1,168 +0,0 @@
|
|||
using OpenMetaverse;
|
||||
using OpenMetaverse.Assets;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GetRegionTextures
|
||||
{
|
||||
class IDTools
|
||||
{
|
||||
public static void addToList(ref List<String> _list, List<String> _input)
|
||||
{
|
||||
foreach (String _entry in _input)
|
||||
{
|
||||
addToList(ref _list, _entry);
|
||||
}
|
||||
}
|
||||
|
||||
public static void addToList(ref List<String> _list, List<TaskInventoryItemElement> _input)
|
||||
{
|
||||
foreach (TaskInventoryItemElement _entry in _input)
|
||||
{
|
||||
addToList(ref _list, _entry.AssetID.UUID);
|
||||
}
|
||||
}
|
||||
|
||||
public static void addToList(ref List<String> _list, String _input)
|
||||
{
|
||||
if (_input == "00000000-0000-0000-0000-000000000000")
|
||||
return;
|
||||
|
||||
if (_input == null)
|
||||
return;
|
||||
|
||||
if (!_list.Contains(_input))
|
||||
_list.Add(_input);
|
||||
}
|
||||
|
||||
public static List<String> getUUIDListFromTexturEntry(String _base64)
|
||||
{
|
||||
List<String> _ausgabe = new List<string>();
|
||||
try
|
||||
{
|
||||
PrimObject obj = new PrimObject();
|
||||
|
||||
byte[] teData = Convert.FromBase64String(_base64);
|
||||
obj.Textures = new Primitive.TextureEntry(teData, 0, teData.Length);
|
||||
|
||||
foreach (Primitive.TextureEntryFace _face in obj.Textures.FaceTextures)
|
||||
{
|
||||
if (_face != null)
|
||||
{
|
||||
_ausgabe.Add(_face.TextureID.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(Exception error)
|
||||
{
|
||||
Console.WriteLine("Cant decode textur data: " + error.Message);
|
||||
}
|
||||
return _ausgabe;
|
||||
}
|
||||
|
||||
public static List<String> getUUIDListFromString(String _xml)
|
||||
{
|
||||
AppDomain.CurrentDomain.SetData("REGEX_DEFAULT_MATCH_TIMEOUT", TimeSpan.FromSeconds(10));
|
||||
List<String> _ausgabe = new List<string>();
|
||||
String _regex = @"[0-9A-Za-z]{8}-[0-9A-Za-z]{4}-[0-9A-Za-z]{4}-[0-9A-Za-z]{4}-[0-9A-Za-z]{12}";
|
||||
|
||||
try
|
||||
{
|
||||
Regex _suche = new Regex(_regex);
|
||||
MatchCollection _funde = _suche.Matches(_xml);
|
||||
|
||||
foreach (Match _f in _funde)
|
||||
{
|
||||
String _value = _f.Value.ToUpper().Trim();
|
||||
if (_value.Length < 75 && _value.Length > 10)
|
||||
{
|
||||
if (!_ausgabe.Contains(_value))
|
||||
{
|
||||
_ausgabe.Add(_value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception _e)
|
||||
{
|
||||
Console.WriteLine(_e.ToString());
|
||||
Thread.Sleep(1000);
|
||||
}
|
||||
|
||||
return _ausgabe;
|
||||
}
|
||||
|
||||
|
||||
public static List<String> getIDListFromSceneObjectGroup(SceneObjectGroup _group)
|
||||
{
|
||||
List<String> _returnList = new List<string>();
|
||||
|
||||
if (_group.RootPart.SceneObjectPart.CollisionSound != null)
|
||||
{
|
||||
if (_group.RootPart.SceneObjectPart.CollisionSound.UUID != null)
|
||||
addToList(ref _returnList, _group.RootPart.SceneObjectPart.CollisionSound.UUID);
|
||||
}
|
||||
|
||||
if (_group.RootPart.SceneObjectPart.SoundID != null)
|
||||
{
|
||||
if (_group.RootPart.SceneObjectPart.SoundID.UUID != null)
|
||||
addToList(ref _returnList, _group.RootPart.SceneObjectPart.SoundID.UUID);
|
||||
}
|
||||
|
||||
if (_group.RootPart.SceneObjectPart.Shape.SculptTexture != null)
|
||||
{
|
||||
if (_group.RootPart.SceneObjectPart.Shape.SculptTexture.UUID != null)
|
||||
addToList(ref _returnList, _group.RootPart.SceneObjectPart.Shape.SculptTexture.UUID);
|
||||
}
|
||||
|
||||
if (_group.RootPart.SceneObjectPart.Shape != null)
|
||||
{
|
||||
if (_group.RootPart.SceneObjectPart.Shape.TextureEntry != null)
|
||||
addToList(ref _returnList, getUUIDListFromTexturEntry(_group.RootPart.SceneObjectPart.Shape.TextureEntry));
|
||||
}
|
||||
|
||||
if (_group.RootPart.SceneObjectPart.TaskInventory != null)
|
||||
addToList(ref _returnList, _group.RootPart.SceneObjectPart.TaskInventory);
|
||||
|
||||
if (_group.OtherParts != null)
|
||||
{
|
||||
foreach (PartElement _sope in _group.OtherParts)
|
||||
{
|
||||
if (_sope.SceneObjectPart.CollisionSound != null)
|
||||
{
|
||||
if (_sope.SceneObjectPart.CollisionSound.UUID != null)
|
||||
addToList(ref _returnList, _sope.SceneObjectPart.CollisionSound.UUID);
|
||||
}
|
||||
|
||||
if (_sope.SceneObjectPart.SoundID != null)
|
||||
{
|
||||
if (_sope.SceneObjectPart.SoundID.UUID != null)
|
||||
addToList(ref _returnList, _sope.SceneObjectPart.SoundID.UUID);
|
||||
}
|
||||
|
||||
if (_sope.SceneObjectPart.Shape.SculptTexture != null)
|
||||
{
|
||||
if (_sope.SceneObjectPart.Shape.SculptTexture.UUID != null)
|
||||
addToList(ref _returnList, _sope.SceneObjectPart.Shape.SculptTexture.UUID);
|
||||
}
|
||||
|
||||
if (_sope.SceneObjectPart.Shape != null)
|
||||
{
|
||||
if (_sope.SceneObjectPart.Shape.TextureEntry != null)
|
||||
addToList(ref _returnList, getUUIDListFromTexturEntry(_sope.SceneObjectPart.Shape.TextureEntry));
|
||||
}
|
||||
|
||||
if (_sope.SceneObjectPart.TaskInventory != null)
|
||||
addToList(ref _returnList, (_sope.SceneObjectPart.TaskInventory));
|
||||
}
|
||||
}
|
||||
|
||||
return _returnList;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,85 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace GetRegionTextures
|
||||
{
|
||||
[Serializable()]
|
||||
[XmlRoot]
|
||||
public class SceneObjectGroup
|
||||
{
|
||||
[XmlElement("RootPart", typeof(RootPartElement))]
|
||||
public RootPartElement RootPart { get; set; }
|
||||
|
||||
[XmlArray("OtherParts")]
|
||||
[XmlArrayItem("Part")]
|
||||
public PartElement[] OtherParts { get; set; }
|
||||
}
|
||||
|
||||
[XmlRoot]
|
||||
public class RootPartElement
|
||||
{
|
||||
[XmlElement("SceneObjectPart", typeof(SceneObjectPartElement))]
|
||||
public SceneObjectPartElement SceneObjectPart { get; set; }
|
||||
}
|
||||
|
||||
[XmlRoot]
|
||||
public class PartElement
|
||||
{
|
||||
[XmlElement("SceneObjectPart", typeof(SceneObjectPartElement))]
|
||||
public SceneObjectPartElement SceneObjectPart { get; set; }
|
||||
}
|
||||
|
||||
[XmlRoot]
|
||||
public class SceneObjectPartElement
|
||||
{
|
||||
[XmlElement("Name", typeof(String))]
|
||||
public String Name { get; set; }
|
||||
|
||||
[XmlElement("Shape", typeof(ShapeElement))]
|
||||
public ShapeElement Shape { get; set; }
|
||||
|
||||
[XmlElement("CollisionSound", typeof(UUIDEntry))]
|
||||
public UUIDEntry CollisionSound { get; set; }
|
||||
|
||||
[XmlElement("SoundID", typeof(UUIDEntry))]
|
||||
public UUIDEntry SoundID { get; set; }
|
||||
|
||||
[XmlArray("TaskInventory")]
|
||||
[XmlArrayItem("TaskInventoryItem")]
|
||||
public List<TaskInventoryItemElement> TaskInventory { get; set; }
|
||||
}
|
||||
|
||||
[XmlRoot]
|
||||
public class TaskInventoryItemElement
|
||||
{
|
||||
[XmlElement("Name", typeof(String))]
|
||||
public String Name { get; set; }
|
||||
|
||||
[XmlElement("AssetID", typeof(UUIDEntry))]
|
||||
public UUIDEntry AssetID { get; set; }
|
||||
}
|
||||
|
||||
[XmlRoot]
|
||||
public class ShapeElement
|
||||
{
|
||||
[XmlElement("TextureEntry", typeof(String))]
|
||||
public String TextureEntry { get; set; }
|
||||
|
||||
[XmlElement("ExtraParams", typeof(String))]
|
||||
public String ExtraParams { get; set; }
|
||||
|
||||
[XmlElement("SculptTexture", typeof(UUIDEntry))]
|
||||
public UUIDEntry SculptTexture { get; set; }
|
||||
}
|
||||
|
||||
[XmlRoot]
|
||||
public class UUIDEntry
|
||||
{
|
||||
[XmlElement("UUID", typeof(String))]
|
||||
public String UUID { get; set; }
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue