本文整理汇总了C#中Aurora.Framework.Classified类的典型用法代码示例。如果您正苦于以下问题:C# Classified类的具体用法?C# Classified怎么用?C# Classified使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Classified类属于Aurora.Framework命名空间,在下文中一共展示了Classified类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddClassified
public bool AddClassified (Classified classified)
{
bool success = m_localService.AddClassified (classified);
if (!success)
success = m_remoteService.AddClassified (classified);
return success;
}
示例2: FindClassified
public Classified FindClassified(UUID classifiedID)
{
Dictionary<string, object> sendData = new Dictionary<string, object>();
sendData["CLASSIFIEDID"] = classifiedID;
sendData["METHOD"] = "getclassified";
string reqString = ServerUtils.BuildXmlResponse(sendData);
try
{
string reply = SynchronousRestFormsRequester.MakeRequest("POST",
m_ServerURI + "/auroradata",
reqString);
if (reply != string.Empty)
{
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
if (replyData != null)
{
if (!replyData.ContainsKey("result"))
return null;
Dictionary<string, object>.ValueCollection replyvalues = replyData.Values;
Classified classified = null;
foreach (object f in replyvalues)
{
if (f is Dictionary<string, object>)
{
classified = new Classified((Dictionary<string, object>)f);
}
}
// Success
return classified;
}
else
m_log.DebugFormat("[AuroraRemoteProfileConnector]: GetClassified {0} received null response",
classifiedID);
}
}
catch (Exception e)
{
m_log.DebugFormat("[AuroraRemoteProfileConnector]: Exception when contacting server: {0}", e.Message);
}
return null;
}
示例3: AddClassified
public bool AddClassified(Classified classified)
{
object remoteValue = DoRemote(classified);
if (remoteValue != null || m_doRemoteOnly)
return remoteValue != null && (bool)remoteValue;
if (GetUserProfile(classified.CreatorUUID) == null)
return false;
//It might be updating, delete the old
QueryFilter filter = new QueryFilter();
filter.andFilters["ClassifiedUUID"] = classified.ClassifiedUUID;
GD.Delete("userclassifieds", filter);
List<object> values = new List<object>{
classified.Name.MySqlEscape(),
classified.Category,
classified.SimName.MySqlEscape(),
classified.CreatorUUID,
classified.ClassifiedUUID,
OSDParser.SerializeJsonString(classified.ToOSD()),
classified.ScopeID
};
return GD.Insert("userclassifieds", values.ToArray());
}
示例4: FindClassifieds
/// <summary>
/// Searches for classifieds
/// </summary>
/// <param name = "queryText"></param>
/// <param name = "category"></param>
/// <param name = "queryFlags"></param>
/// <param name = "StartQuery"></param>
/// <returns></returns>
public DirClassifiedReplyData[] FindClassifieds(string queryText, string category, uint queryFlags, int StartQuery)
{
QueryFilter filter = new QueryFilter();
filter.andLikeFilters["Name"] = "%" + queryText + "%";
if (int.Parse(category) != (int)DirectoryManager.ClassifiedCategories.Any) //Check the category
{
filter.andFilters["Category"] = category;
}
List<string> retVal = GD.Query(new string[1] { "*" }, "userclassifieds", filter, null, (uint)StartQuery, 50);
if (retVal.Count == 0)
{
return new DirClassifiedReplyData[0] { };
}
List<DirClassifiedReplyData> Data = new List<DirClassifiedReplyData>();
DirClassifiedReplyData replyData;
for (int i = 0; i < retVal.Count; i += 6)
{
//Pull the classified out of OSD
Classified classified = new Classified();
classified.FromOSD((OSDMap) OSDParser.DeserializeJson(retVal[i + 5]));
replyData = new DirClassifiedReplyData
{
classifiedFlags = classified.ClassifiedFlags,
classifiedID = classified.ClassifiedUUID,
creationDate = classified.CreationDate,
expirationDate = classified.ExpirationDate,
price = classified.PriceForListing,
name = classified.Name
};
//Check maturity levels
if ((replyData.classifiedFlags & (uint)DirectoryManager.ClassifiedFlags.Mature) == (uint)DirectoryManager.ClassifiedFlags.Mature)
{
if ((queryFlags & (uint)DirectoryManager.ClassifiedQueryFlags.Mature) == (uint)DirectoryManager.ClassifiedQueryFlags.Mature)
{
Data.Add(replyData);
}
}
else
{ //Its PG, add all
Data.Add(replyData);
}
}
return Data.ToArray();
}
示例5: GetClassifieds
public List<Classified> GetClassifieds (UUID ownerID)
{
List<Classified> classifieds = new List<Classified> ();
List<string> query = GD.Query (new string[1] { "OwnerUUID" }, new object[1] { ownerID }, "userclassifieds", "*");
for (int i = 0; i < query.Count; i+=6)
{
Classified classified = new Classified ();
classified.FromOSD ((OSDMap)OSDParser.DeserializeJson (query[i+5]));
classifieds.Add (classified);
}
return classifieds;
}
示例6: ClassifiedInfoUpdate
public void ClassifiedInfoUpdate(UUID queryclassifiedID, uint queryCategory, string queryName,
string queryDescription, UUID queryParcelID,
uint queryParentEstate, UUID querySnapshotID, Vector3 queryGlobalPos,
byte queryclassifiedFlags,
int queryclassifiedPrice, IClientAPI remoteClient)
{
IScenePresence p = remoteClient.Scene.GetScenePresence(remoteClient.AgentId);
if (p == null)
return; //Just fail
IMoneyModule money = p.Scene.RequestModuleInterface<IMoneyModule>();
if (money != null)
{
if (!money.Charge(remoteClient.AgentId, queryclassifiedPrice, "Add Classified"))
{
remoteClient.SendAlertMessage("You do not have enough money to complete this upload.");
return;
}
}
UUID creatorUUID = remoteClient.AgentId;
UUID classifiedUUID = queryclassifiedID;
uint category = queryCategory;
string name = queryName;
string description = queryDescription;
uint parentestate = queryParentEstate;
UUID snapshotUUID = querySnapshotID;
string simname = remoteClient.Scene.RegionInfo.RegionName;
Vector3 globalpos = queryGlobalPos;
byte classifiedFlags = queryclassifiedFlags;
int classifiedPrice = queryclassifiedPrice;
UUID parceluuid = p.CurrentParcelUUID;
string parcelname = "Unknown";
IParcelManagementModule parcelManagement =
remoteClient.Scene.RequestModuleInterface<IParcelManagementModule>();
if (parcelManagement != null)
{
ILandObject parcel = parcelManagement.GetLandObject(p.AbsolutePosition.X, p.AbsolutePosition.Y);
if (parcel != null)
{
parcelname = parcel.LandData.Name;
parceluuid = parcel.LandData.InfoUUID;
}
}
uint creationdate = (uint) Util.UnixTimeSinceEpoch();
uint expirationdate = (uint) Util.UnixTimeSinceEpoch() + (365*24*60*60);
Classified classified = new Classified
{
ClassifiedUUID = classifiedUUID,
CreatorUUID = creatorUUID,
CreationDate = creationdate,
ExpirationDate = expirationdate,
Category = category,
Name = name,
Description = description,
ParcelUUID = parceluuid,
ParentEstate = parentestate,
SnapshotUUID = snapshotUUID,
SimName = simname,
GlobalPos = globalpos,
ParcelName = parcelname,
ClassifiedFlags = classifiedFlags,
PriceForListing = classifiedPrice,
ScopeID = remoteClient.ScopeID
};
ProfileFrontend.AddClassified(classified);
}
示例7: GetClassifiedsInRegion
/// <summary>
/// Gets all classifieds in the given region
/// </summary>
/// <param name="regionName"></param>
/// <returns></returns>
public Classified[] GetClassifiedsInRegion(string regionName)
{
List<Classified> Classifieds = new List<Classified>();
List<string> retVal = GD.Query ("SimName", regionName, "userclassifieds", "*");
if (retVal.Count == 0)
return Classifieds.ToArray();
Classified classified = new Classified();
for (int i = 0; i < retVal.Count; i += 6)
{
//Pull the classified out of OSD
classified.FromOSD((OSDMap)OSDParser.DeserializeJson(retVal[i + 5]));
Classifieds.Add(classified);
classified = new Classified();
}
return Classifieds.ToArray();
}
示例8: RemoveClassifieds
/// <summary>
/// Remove classifieds from the search database
/// LOCAL Only, called by the profile service
/// </summary>
/// <param name="dictionary">objects of the dictionary are OSDMaps made from Classified</param>
public void RemoveClassifieds(Dictionary<string, object> dictionary)
{
//Remove all the UUIDs in the given dictionary from search
foreach (object o in dictionary.Values)
{
//Pull out the OSDMaps
OSDMap map = (OSDMap)o;
Classified c = new Classified();
c.FromOSD(map);
List<string> Keys = new List<string>();
Keys.Add("ClassifiedUUID");
List<object> Values = new List<object>();
Values.Add(c.ClassifiedUUID);
GD.Delete("profileclassifieds", Keys.ToArray(), Values.ToArray());
}
}
示例9: GetClassifiedByID
public Classified GetClassifiedByID(UUID id)
{
object remoteValue = DoRemote(id);
if (remoteValue != null || m_doRemoteOnly)
return (Classified)remoteValue;
QueryFilter filter = new QueryFilter();
Dictionary<string, object> where = new Dictionary<string, object>(1);
where.Add("ClassifiedUUID", id);
filter.andFilters = where;
List<string> retVal = GD.Query(new[] { "*" }, "userclassifieds", filter, null, null, null);
if ((retVal == null) || (retVal.Count == 0)) return null;
Classified classified = new Classified();
classified.FromOSD((OSDMap)OSDParser.DeserializeJson(retVal[6]));
return classified;
}
示例10: FindClassifieds
public List<DirClassifiedReplyData> FindClassifieds(string queryText, string category, uint queryFlags, int StartQuery, UUID scopeID)
{
object remoteValue = DoRemote(queryText, category, queryFlags, StartQuery, scopeID);
if (remoteValue != null || m_doRemoteOnly)
return (List<DirClassifiedReplyData>)remoteValue;
QueryFilter filter = new QueryFilter();
filter.andLikeFilters["Name"] = "%" + queryText + "%";
if (int.Parse(category) != (int)DirectoryManager.ClassifiedCategories.Any) //Check the category
filter.andFilters["Category"] = category;
if (scopeID != UUID.Zero)
filter.andFilters["ScopeID"] = scopeID;
List<string> retVal = GD.Query(new[] { "*" }, "userclassifieds", filter, null, (uint)StartQuery, 50);
if (retVal.Count == 0)
return new List<DirClassifiedReplyData>();
List<DirClassifiedReplyData> Data = new List<DirClassifiedReplyData>();
for (int i = 0; i < retVal.Count; i += 9)
{
//Pull the classified out of OSD
Classified classified = new Classified();
classified.FromOSD((OSDMap) OSDParser.DeserializeJson(retVal[i + 5]));
DirClassifiedReplyData replyData = new DirClassifiedReplyData
{
classifiedFlags = classified.ClassifiedFlags,
classifiedID = classified.ClassifiedUUID,
creationDate = classified.CreationDate,
expirationDate = classified.ExpirationDate,
price = classified.PriceForListing,
name = classified.Name
};
//Check maturity levels
if ((replyData.classifiedFlags & (uint)DirectoryManager.ClassifiedFlags.Mature) != (uint)DirectoryManager.ClassifiedFlags.Mature)
{
if ((queryFlags & (uint)DirectoryManager.ClassifiedQueryFlags.Mature) == (uint)DirectoryManager.ClassifiedQueryFlags.Mature)
Data.Add(replyData);
}
else
//Its Mature, add all
Data.Add(replyData);
}
return Data;
}
示例11: GetClassifieds
public List<Classified> GetClassifieds(UUID ownerID)
{
object remoteValue = DoRemote(ownerID);
if (remoteValue != null || m_doRemoteOnly)
return (List<Classified>)remoteValue;
QueryFilter filter = new QueryFilter();
filter.andFilters["OwnerUUID"] = ownerID;
List<string> query = GD.Query(new[] { "*" }, "userclassifieds", filter, null, null, null);
List<Classified> classifieds = new List<Classified>();
for (int i = 0; i < query.Count; i += 7)
{
Classified classified = new Classified();
classified.FromOSD((OSDMap) OSDParser.DeserializeJson(query[i + 5]));
classifieds.Add(classified);
}
return classifieds;
}
示例12: GetClassified
public Classified GetClassified(UUID queryClassifiedID)
{
object remoteValue = DoRemote(queryClassifiedID);
if (remoteValue != null || m_doRemoteOnly)
return (Classified)remoteValue;
QueryFilter filter = new QueryFilter();
filter.andFilters["ClassifiedUUID"] = queryClassifiedID;
List<string> query = GD.Query(new[] { "*" }, "userclassifieds", filter, null, null, null);
if (query.Count < 6)
{
return null;
}
Classified classified = new Classified();
classified.FromOSD((OSDMap) OSDParser.DeserializeJson(query[5]));
return classified;
}
示例13: GodClassifiedDelete
public void GodClassifiedDelete(UUID queryClassifiedID, IClientAPI remoteClient)
{
if (m_scene.Permissions.IsGod(remoteClient.AgentId))
{
IUserProfileInfo info = ProfileFrontend.GetUserProfile(remoteClient.AgentId);
if (info == null)
return;
if (info.Classifieds.ContainsKey(queryClassifiedID.ToString()))
{
OSDMap Classifieds = Util.DictionaryToOSD(info.Classifieds);
Classified oldClassified = new Classified(Util.OSDToDictionary((OSDMap)Classifieds[queryClassifiedID.ToString()]));
if (oldClassified.CreatorUUID != remoteClient.AgentId)
return;
info.Classifieds.Remove(queryClassifiedID.ToString());
ProfileFrontend.UpdateUserProfile(info);
}
}
}
示例14: ClassifiedInfoUpdate
public void ClassifiedInfoUpdate(UUID queryclassifiedID, uint queryCategory, string queryName, string queryDescription, UUID queryParcelID,
uint queryParentEstate, UUID querySnapshotID, Vector3 queryGlobalPos, byte queryclassifiedFlags,
int queryclassifiedPrice, IClientAPI remoteClient)
{
//Security check
IUserProfileInfo info = ProfileFrontend.GetUserProfile(remoteClient.AgentId);
if (info == null)
return;
if (info.Classifieds.ContainsKey(queryclassifiedID.ToString()))
{
OSDMap Classifieds = Util.DictionaryToOSD(info.Classifieds);
Classified oldClassified = new Classified(Util.OSDToDictionary((OSDMap)Classifieds[queryclassifiedID.ToString()]));
if (oldClassified.CreatorUUID != remoteClient.AgentId)
return;
info.Classifieds.Remove(queryclassifiedID.ToString());
}
UUID creatorUUID = remoteClient.AgentId;
UUID classifiedUUID = queryclassifiedID;
uint category = queryCategory;
string name = queryName;
string description = queryDescription;
uint parentestate = queryParentEstate;
UUID snapshotUUID = querySnapshotID;
string simname = remoteClient.Scene.RegionInfo.RegionName;
Vector3 globalpos = queryGlobalPos;
byte classifiedFlags = queryclassifiedFlags;
int classifiedPrice = queryclassifiedPrice;
ScenePresence p = m_scene.GetScenePresence(remoteClient.AgentId);
UUID parceluuid = p.currentParcelUUID;
string parcelname = "Unknown";
string pos_global = new Vector3(remoteClient.Scene.RegionInfo.RegionLocX * Constants.RegionSize + p.AbsolutePosition.X,
remoteClient.Scene.RegionInfo.RegionLocY * Constants.RegionSize + p.AbsolutePosition.Y,
p.AbsolutePosition.Z).ToString();
ILandObject parcel = m_scene.LandChannel.GetLandObject(p.AbsolutePosition.X, p.AbsolutePosition.Y);
if(parcel != null)
{
parcelname = parcel.LandData.Name;
parceluuid = parcel.LandData.InfoUUID;
}
uint creationdate = (uint)Util.UnixTimeSinceEpoch();
uint expirationdate = (uint)Util.UnixTimeSinceEpoch() + (365 * 24 * 60 * 60);
Classified classified = new Classified();
classified.ClassifiedUUID = classifiedUUID;
classified.CreatorUUID = creatorUUID;
classified.CreationDate = creationdate;
classified.ExpirationDate = expirationdate;
classified.Category = category;
classified.Name = name;
classified.Description = description;
classified.ParcelUUID = parceluuid;
classified.ParentEstate = parentestate;
classified.SnapshotUUID = snapshotUUID;
classified.SimName = simname;
classified.GlobalPos = globalpos;
classified.ParcelName = parcelname;
classified.ClassifiedFlags = classifiedFlags;
classified.PriceForListing = classifiedPrice;
info.Classifieds.Add(classified.ClassifiedUUID.ToString(), Util.DictionaryToOSD(classified.ToKeyValuePairs()));
ProfileFrontend.UpdateUserProfile(info);
}
示例15: GetClassifiedsInRegion
/// <summary>
/// Gets all classifieds in the given region
/// </summary>
/// <param name = "regionName"></param>
/// <returns></returns>
public Classified[] GetClassifiedsInRegion(string regionName)
{
QueryFilter filter = new QueryFilter();
filter.andFilters["SimName"] = regionName;
List<string> retVal = GD.Query(new string[] { "*" }, "userclassifieds", filter, null, null, null);
if (retVal.Count == 0)
{
return new Classified[0] { };
}
List<Classified> Classifieds = new List<Classified>();
Classified classified;
for (int i = 0; i < retVal.Count; i += 6)
{
classified = new Classified();
//Pull the classified out of OSD
classified.FromOSD((OSDMap) OSDParser.DeserializeJson(retVal[i + 5]));
Classifieds.Add(classified);
}
return Classifieds.ToArray();
}