public void Serialize(MySpace.Common.IO.IPrimitiveWriter writer) { writer.Write(this.totalCount); writer.Write(cacheDataList.Count); // List count if (cacheDataList.Count > 0) { writer.Write(cacheDataList[0].IndexId.Length); writer.Write(cacheDataList[0].Id.Length); foreach (CacheData cd in cacheDataList) { writer.Write(cd.IndexId); writer.Write(cd.Id); if (cd.Data == null) { writer.Write((int)0); } else { writer.Write(cd.Data.Length); writer.Write(cd.Data); } writer.Write( new SmallDateTime(cd.CreateTimestamp).TicksInt32); writer.Write(cd.CacheTypeId); } } }
private void OnMouseDown() { if (eventIndex == Dialogue.nowIndex && canClick && MySpace.IsInArea2D(gameObject, MyPlayer.GetPlayer(), 2.0f)) { MyObject.SetObjectActive("Canvas/Option"); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["offSiteMySpace"] != null) { try { MySpace myspaceClient = (MySpace)Session["offSiteMySpace"]; var user = (BasicProfile)JsonConvert.Import(typeof(BasicProfile), myspaceClient.GetCurrentUser()); Dictionary <string, string> profileFields = new Dictionary <string, string>(); // Add Items to UserProfile Class which are to be featched in user profile profileFields.Add("fields", "aboutme,age,birthday,books,children,gender,interests,lookingfor,movies,music,profilesong,relationshipstatus,religion,sexualorientation,status,mszodiacsign,currentlocation"); var profile = (UserProfile)JsonConvert.Import(typeof(UserProfile), myspaceClient.GetPerson(user.UserId.ToString(), profileFields)); Session["UserID"] = user.UserId; imageProfile.ImageUrl = user.LargeImage; lblAge.Text = profile.person.age; lblCity.Text = profile.person.currentlocation.locality; lblCountry.Text = profile.person.currentlocation.country; lblGender.Text = profile.person.gender; lblMarital.Text = profile.person.relationshipstatus; lblName.Text = user.Name; lblProfileUrl.Text = user.WebUri; lblRegion.Text = profile.person.sexualorientation; PopulateFriends(myspaceClient, user.UserId); } catch (Exception ex) { divPhotos.InnerHtml = "An Error occured: " + ex.Message; } } }
public void Serialize(MySpace.Common.IO.IPrimitiveWriter writer) { if (ErrorQueues != null) { writer.Write(true); writer.Write(ErrorQueues.Keys.Count); foreach (string key in ErrorQueues.Keys) { writer.Write(key); Dictionary<string, MessageQueue> groupQueue = ErrorQueues[key]; if (groupQueue != null) { writer.Write(true); writer.Write(groupQueue.Keys.Count); if (groupQueue.Keys.Count > 0) { foreach (string serviceName in groupQueue.Keys) { writer.Write(serviceName); writer.Write(groupQueue[serviceName],false); } } } else { writer.Write(false); } } } else { writer.Write(false); } }
private void PopulatePhotos(MySpace myspaceClient, int userId) { var photos = (UserPhotos)JsonConvert.Import(typeof(UserPhotos), myspaceClient.GetAllPhotos(userId)); if (photos.Count > 0) { StringBuilder sb = new StringBuilder(); sb.Append("<table>"); int i = 0; foreach (var photo in photos.Photos) { if (i % 3 == 0) { sb.Append("<tr>"); } sb.Append(string.Format("<td><img src='{0}' </td></td>", photo.SmallImageUri)); if (i % 3 == 0) { sb.Append("</tr>"); } i++; } sb.Append("</table>"); divPhotos.InnerHtml = sb.ToString(); } }
private void PopulateUserProfile() { if (State.OAuthOpenID != null) { var verifier = Request.QueryString["oauth_verifier"]; var myspaceClient = new MySpace(Constants.ConsumerKey, Constants.ConsumerSecret, State.OAuthOpenID.RequestToken, string.Empty, true, verifier);; var user = (BasicProfile)JsonConvert.Import(typeof(BasicProfile), myspaceClient.GetCurrentUser()); Dictionary <string, string> profileFields = new Dictionary <string, string>(); // Add Items to UserProfile Class which are to be featched in user profile profileFields.Add("fields", "aboutme,age,birthday,books,children,gender,interests,lookingfor,movies,music,profilesong,relationshipstatus,religion,sexualorientation,status,mszodiacsign"); var profile = (UserProfile)JsonConvert.Import(typeof(UserProfile), myspaceClient.GetPerson(user.UserId.ToString(), profileFields)); Session["UserID"] = user.UserId; imageProfile.ImageUrl = user.LargeImage; lblAge.Text = profile.person.age; lblCity.Text = profile.person.currentlocation.locality; lblCountry.Text = profile.person.currentlocation.country; lblGender.Text = profile.person.gender; lblMarital.Text = profile.person.relationshipstatus; lblName.Text = user.Name; lblProfileUrl.Text = user.WebUri; lblRegion.Text = profile.person.sexualorientation; PopulatePhotos(myspaceClient, user.UserId); } }
public static bool Owns(Vec3 position) { if (position.FloorInt3 == ID.XYZ) { return(true); } return(MySpace.Contains(position)); }
public void Serialize(MySpace.Common.IO.IPrimitiveWriter writer) { //DataType writer.Write((byte)dataType); //SortBy writer.Write((byte)sortBy); }
private void Update() { if (MySpace.IsInArea2D(MyPlayer.GetPlayer(), gameObject, 2.0f)) { if ((MyPlayer.GetPlayer().transform.position.x - transform.position.x) * direction >= 0.0f) { MyPlayer.GetPlayer().transform.position = new Vector3(transform.position.x, MyPlayer.GetPlayer().transform.position.y, MyPlayer.GetPlayer().transform.position.z); } } }
private static void Main(String[] args) { MySpace[] Spaces = new MySpace[] { new MySpace(3, 4, 5), new MySpace(3, 4, 5), new MySpace(7, 8, 9), new MySpace(2, 3, 3), new MySpace(3, 4, 2) }; }
public override void Serialize(MySpace.Common.IO.IPrimitiveWriter writer) { base.Serialize(writer); if (data == null) { writer.Write((ushort)0); } else { writer.Write((ushort)data.Length); writer.Write(data); } }
//------------ public virtual void OnBeforeLoad(MySpace.DataMining.DistributedObjects.LoadOutput output) { List<byte> keybuf = new List<byte>(128); List<byte> valuebuf = new List<byte>(128); for (int i = 0; i < 20; i++) { keybuf.Clear(); Entry.ToBytesAppend(i, keybuf); valuebuf.Clear(); Entry.ToBytesAppend(42, valuebuf); output.Add(ByteSlice.Create(keybuf), ByteSlice.Create(valuebuf)); } }
private void PopulatePhotos(MySpace myspaceClient, int userId) { var photos = (UserPhotos)JsonConvert.Import(typeof(UserPhotos), myspaceClient.GetAllPhotos(userId)); if (photos.Count > 0) { divPhotos.InnerHtml = "<ul>"; foreach (var photo in photos.Photos) { divPhotos.InnerHtml += string.Format("<li><img src='{0}' </></li>", photo.SmallImageUri); } divPhotos.InnerHtml += "</ul>"; } }
public static double Area(MySpace a, MySpace b, MySpace c) { double s1; double s2; double s3; double sin; double cos; s1 = Math.Sqrt(Math.Pow(a.X - b.X, 2) + Math.Pow(a.Y - b.Y, 2) + Math.Pow(a.Z - b.Z, 2)); s2 = Math.Sqrt(Math.Pow(c.X - b.X, 2) + Math.Pow(c.Y - b.Y, 2) + Math.Pow(c.Z - b.Z, 2)); s3 = Math.Sqrt(Math.Pow(a.X - c.X, 2) + Math.Pow(a.Y - c.Y, 2) + Math.Pow(a.Z - c.Z, 2)); cos = (Math.Pow(s1, 2) + Math.Pow(s2, 2) - Math.Pow(s3, 2)); sin = Math.Sqrt(1 - Math.Pow(cos, 2)); return(1 / 2 * s1 * s2 * sin); }
public override void Deserialize(MySpace.Common.IO.IPrimitiveReader reader) { base.Deserialize(reader); ushort count = reader.ReadUInt16(); if (count > 0) { string key; byte[] value; for (int i = 0; i < count; i++) { key = reader.ReadString(); value = reader.ReadBytes(reader.ReadUInt16()); sortFields.Add(key, value); } } }
public ActionResult Favorites() { SpaceController sc = new SpaceController(); List <UserSpace> userSpaces = UnSpaceDbController.GetUserSpaces(User.Identity.Name); List <MySpace> mySpaces = new List <MySpace>(); int count = 0; foreach (UserSpace u in userSpaces) { MySpace addSpace = new MySpace(); addSpace.Name = u.Name; addSpace.furnList = sc.GetSavedSpaceFurn(u); addSpace.Id = u.Id.ToString(); mySpaces.Add(addSpace); count++; } return(View(mySpaces)); }
protected void UploadButton_Click(object sender, EventArgs e) { if (FileUploadControl.HasFile) { try { if (FileUploadControl.PostedFile.ContentType == "image/jpeg") { if (FileUploadControl.PostedFile.ContentLength < 1024000) { if (Session["offSiteMySpace"] != null) { MySpace myspaceClient = (MySpace)Session["offSiteMySpace"]; if (Session["UserID"] != null) { string userId = Convert.ToString(Session["UserID"]); MySpaceID.SDK.Models.RoaApi.UserAlbums albums = (MySpaceID.SDK.Models.RoaApi.UserAlbums)JsonConvert.Import(typeof(MySpaceID.SDK.Models.RoaApi.UserAlbums), myspaceClient.GetAlbums(userId)); if (albums != null) { string albumid = albums.entry[0].album.id; myspaceClient.AddPhoto(userId, albumid, "Test Photo From App", FileUploadControl.FileBytes); StatusLabel.Text = "Upload status: File uploaded!"; } } } } else { StatusLabel.Text = "Upload status: The file has to be less than 1000 kb!"; } } else { StatusLabel.Text = "Upload status: Only JPEG files are accepted!"; } } catch (Exception ex) { StatusLabel.Text = "Upload status: The file could not be uploaded. The following error occured: " + ex.Message; } } }
private void PopulateUserProfile() { try { var requestTokenKey = Session["requesttokenkey"].ToString(); var requestTokenSecret = Session["requesttokensecret"].ToString(); var verifier = Request.QueryString["oauth_verifier"]; MySpace offSiteMySpace = new MySpace(Constants.ConsumerKey, Constants.ConsumerSecret, requestTokenKey, requestTokenSecret, true, verifier); Session["accesstokenkey"] = offSiteMySpace.OAuthTokenKey; Session["accesstokensecret"] = offSiteMySpace.OAuthTokenSecret; Application["accesstokensecret"] = offSiteMySpace.OAuthTokenSecret; Session["offSiteMySpace"] = offSiteMySpace; var user = (BasicProfile)JsonConvert.Import(typeof(BasicProfile), offSiteMySpace.GetCurrentUser()); Dictionary <string, string> profileFields = new Dictionary <string, string>(); // Add Items to UserProfile Class which are to be featched in user profile profileFields.Add("fields", "aboutme,age,birthday,books,children,gender,interests,lookingfor,movies,music,profilesong,relationshipstatus,religion,sexualorientation,status,mszodiacsign,currentlocation"); var profile = (UserProfile)JsonConvert.Import(typeof(UserProfile), offSiteMySpace.GetPerson(user.UserId.ToString(), profileFields)); offSiteMySpace.GetVideosCategory(user.UserId.ToString(), "11"); ExtendedP.Text = "My Books are : " + ConvertStringArrayToStringJoin(profile.person.books) + "<br/> Intrests:" + ConvertStringArrayToStringJoin(profile.person.interests) + "<br/> Movies I Like:" + ConvertStringArrayToStringJoin(profile.person.movies) + "<br/> My Music:" + ConvertStringArrayToStringJoin(profile.person.music) + "<br/> Relationship Status:" + profile.person.relationshipstatus; Session["UserID"] = user.UserId; imageProfile.ImageUrl = user.LargeImage; lblAge.Text = profile.person.age; lblCity.Text = profile.person.currentlocation.locality; lblCountry.Text = profile.person.currentlocation.country; lblGender.Text = profile.person.gender; lblMarital.Text = profile.person.relationshipstatus; lblName.Text = user.Name; lblProfileUrl.Text = user.WebUri; lblRegion.Text = profile.person.sexualorientation; } catch (Exception ex) { ExtendedP.Text = "An Error occured: " + ex.Message; } }
public override void Serialize(MySpace.Common.IO.IPrimitiveWriter writer) { base.Serialize(writer); if (sortFields == null || sortFields.Count == 0) { writer.Write((ushort)0); } else { writer.Write((ushort)sortFields.Count); foreach (KeyValuePair<string/*Indexname*/, byte[]/*Value*/> kvp in sortFields) { writer.Write(kvp.Key); writer.Write((ushort)kvp.Value.Length); writer.Write(kvp.Value); } } }
public ActionResult ListSpaces() { MySpace fakedata1 = new MySpace(); EtsyItem fakefurn1 = new EtsyItem(); fakefurn1.Listing_Id = "621428887"; fakefurn1.Title = "Heritage Edition Antique 1930'"; fakefurn1.Price = "$550.00"; fakefurn1.Item_Width = "12"; fakefurn1.Item_Length = "40"; fakefurn1.Item_Height = "15"; fakefurn1.Item_Dimensions_unit = ""; fakefurn1.ImageThumbUrl = ""; fakefurn1.ImageFullUrl = $"https:www.etsy.com/listing/621428887/heritage-edition-antique-1930s-theater?"; fakedata1.furnList.Add(fakefurn1); List <MySpace> newDummy = new List <MySpace>(); newDummy.Add(fakedata1); return(View(newDummy)); }
private void PopulateFriends(MySpace myspaceClient, int userId) { var friends = (FriendsProfile)JsonConvert.Import(typeof(FriendsProfile), myspaceClient.GetFriends(userId.ToString())); if (friends.TotalResults > 0) { StringBuilder sb = new StringBuilder(); sb.Append("<table>"); foreach (var friend in friends.entry) { sb.Append("<tr>"); sb.Append(string.Format("<td><img src='{0}'/> </td>", friend.person.thumbnailUrl)); sb.Append(string.Format("<td>Name: {0}<br/>Status: {1}<br/>Web Url: {2}</td>", friend.person.displayName, friend.person.status, friend.person.profileUrl)); sb.Append("</tr>"); } sb.Append("</table>"); divPhotos.InnerHtml = sb.ToString(); } }
private void PopulateVideos(MySpace myspaceClient, string userId) { var videos = (MySpaceID.SDK.Models.RoaApi.UserMediaItems)JsonConvert.Import(typeof(MySpaceID.SDK.Models.RoaApi.UserMediaItems), myspaceClient.GetVideos(userId)); if (videos.TotalResults > 0) { StringBuilder sb = new StringBuilder(); sb.Append("<table>"); foreach (var video in videos.entry) { sb.Append("<tr>"); sb.Append(string.Format("<td><img src='{0}'/> </td>", video.mediaItem.thumbnailUrl)); sb.Append(string.Format("<td>Title: {0}<br/>Video Url: {1}</td>", video.mediaItem.title, video.mediaItem.url)); sb.Append("</tr>"); } sb.Append("</table>"); divPhotos.InnerHtml = sb.ToString(); } }
public void Deserialize(MySpace.Common.IO.IPrimitiveReader reader, int version) { if (reader.ReadBoolean()) { int groupsCount = reader.ReadInt32(); ErrorQueues = new Dictionary<string, Dictionary<string, MessageQueue>>(groupsCount); for (int i = 0; i < groupsCount; i++) { string group = reader.ReadString(); if(reader.ReadBoolean()) { int serviceCount = reader.ReadInt32(); Dictionary<string, MessageQueue> groupQueues = new Dictionary<string, MessageQueue>(serviceCount); for (int j = 0; j < serviceCount; j++) { string serviceName = reader.ReadString(); groupQueues.Add(serviceName, reader.Read<MessageQueue>()); } ErrorQueues.Add(group, groupQueues); } } } }
private void LoggedIn() { this.MySpace = new MySpace(Constants.ConsumerKey, Constants.ConsumerSecret, Session["OAuthRequestToken"].ToString(), string.Empty, true, Session["varifier"].ToString()); var user = (BasicProfile)JsonConvert.Import(typeof(BasicProfile), MySpace.GetCurrentUser()); Session["userID"] = this.UserId = user.UserId; Dictionary <string, string> profileFields = new Dictionary <string, string>(); profileFields.Add("fields", "aboutme,age,birthday,books,children,gender,interests,lookingfor,movies,music,profilesong,relationshipstatus,religion,sexualorientation,status,mszodiacsign"); this.ExtendedProfile = (UserProfile)JsonConvert.Import(typeof(UserProfile), this.MySpace.GetPerson(this.UserId.ToString(), profileFields)); //this.Friends = (FriendProfile)JsonConvert.Import(typeof(FriendProfile), this.MySpace.GetFriends(this.UserId.ToString(), profileFields)); Dictionary <string, string> resultformat = new Dictionary <string, string>(); resultformat.Add("format", "xml"); this.FriendActivities = XDocument.Parse(this.MySpace.GetFriendsActivities(this.UserId.ToString(), resultformat)); }
protected void UploadButton_Click(object sender, EventArgs e) { if (FileUploadControl.HasFile) { try { { if (FileUploadControl.PostedFile.ContentLength < 10240000) { if (Session["offSiteMySpace"] != null) { MySpace myspaceClient = (MySpace)Session["offSiteMySpace"]; if (Session["UserID"] != null) { string userId = Convert.ToString(Session["UserID"]); var roaApi = myspaceClient; roaApi.AddVideo(userId, "Test", "tags", 11, "en-US", "Test Photo From App", FileUploadControl.FileBytes); StatusLabel.Text = "Upload status: File uploaded!"; } } } else { StatusLabel.Text = "Upload status: The file has to be less than 10000 kb!"; } } } catch (Exception ex) { StatusLabel.Text = "Upload status: The file could not be uploaded. The following error occured: " + ex.Message; } } }
public void Serialize(MySpace.Common.IO.IPrimitiveWriter writer) { if (this.CacheListId == null || this.CacheListId.Length <= 0) { writer.Write((int)0); } else { writer.Write(this.CacheListId.Length); writer.Write(this.CacheListId); } writer.Write(this.PageSize); writer.Write(this.PageNum); writer.Write(this.ReversePagedQuery); writer.Write(this.VirtualListCount); writer.Write(this.PrimaryId); }
public void Serialize(MySpace.Common.IO.IPrimitiveWriter writer) { if (this.CacheListId == null || this.CacheListId.Length <= 0) { writer.Write((int)0); } else { writer.Write(this.CacheListId.Length); writer.Write(this.CacheListId); } if ((this.cacheListNodeIds != null) && (this.cacheListNodeIds.Length > 0)) { writer.Write(this.cacheListNodeIds.Length); SerializeList(writer); } else { writer.Write((int)0); } writer.Write(this.VirtualListCount); writer.Write(this.PrimaryId); }
/// <summary> /// Update the space and particle velocity/direction /// </summary> private int UpdateSpaceAndParticles(double factor) { fSpaceTemp = new MySpace[WORLD_BLOCKS, WORLD_BLOCKS, WORLD_BLOCKS]; int count = 0; float force; #region STEP: All particles changes the room structure Parallel.ForEach(fParticles, particle => { int blockX = (int)((particle.Position.X + HALF_WORLD_SIZE) * PARTICLE_TO_WORLD); int blockY = (int)((particle.Position.Y + HALF_WORLD_SIZE) * PARTICLE_TO_WORLD); int blockZ = (int)((particle.Position.Z + HALF_WORLD_SIZE) * PARTICLE_TO_WORLD); if (blockX < 1 || blockY < 1 || blockZ < 1 || blockX >= WORLD_BLOCKS_MAX || blockY >= WORLD_BLOCKS_MAX || blockZ >= WORLD_BLOCKS_MAX) { particle.Remove = true; } else { force = particle.Mass;// * factor? force *= 0.1f; float force70 = 0.7f * force; float force50 = 0.5f * force; fSpace[blockX - 1, blockY, blockZ].ForcePositiveX += force; fSpace[blockX + 1, blockY, blockZ].ForceNegativeX += force; fSpace[blockX, blockY - 1, blockZ].ForcePositiveY += force; fSpace[blockX, blockY + 1, blockZ].ForceNegativeY += force; fSpace[blockX, blockY, blockZ - 1].ForcePositiveZ += force; fSpace[blockX, blockY, blockZ + 1].ForceNegativeZ += force; fSpace[blockX - 1, blockY - 1, blockZ].ForcePositiveX += force70; fSpace[blockX - 1, blockY - 1, blockZ].ForcePositiveY += force70; fSpace[blockX + 1, blockY - 1, blockZ].ForceNegativeX += force70; fSpace[blockX + 1, blockY - 1, blockZ].ForcePositiveY += force70; fSpace[blockX - 1, blockY + 1, blockZ].ForcePositiveX += force70; fSpace[blockX - 1, blockY + 1, blockZ].ForceNegativeY += force70; fSpace[blockX + 1, blockY + 1, blockZ].ForceNegativeX += force70; fSpace[blockX + 1, blockY + 1, blockZ].ForceNegativeY += force70; fSpace[blockX - 1, blockY, blockZ - 1].ForcePositiveX += force70; fSpace[blockX - 1, blockY, blockZ - 1].ForcePositiveZ += force70; fSpace[blockX + 1, blockY, blockZ - 1].ForceNegativeX += force70; fSpace[blockX + 1, blockY, blockZ - 1].ForcePositiveZ += force70; fSpace[blockX - 1, blockY, blockZ + 1].ForcePositiveX += force70; fSpace[blockX - 1, blockY, blockZ + 1].ForceNegativeZ += force70; fSpace[blockX + 1, blockY, blockZ + 1].ForceNegativeX += force70; fSpace[blockX + 1, blockY, blockZ + 1].ForceNegativeZ += force70; fSpace[blockX, blockY - 1, blockZ - 1].ForcePositiveY += force70; fSpace[blockX, blockY - 1, blockZ - 1].ForcePositiveZ += force70; fSpace[blockX, blockY + 1, blockZ - 1].ForceNegativeY += force70; fSpace[blockX, blockY + 1, blockZ - 1].ForcePositiveZ += force70; fSpace[blockX, blockY - 1, blockZ + 1].ForcePositiveY += force70; fSpace[blockX, blockY - 1, blockZ + 1].ForceNegativeZ += force70; fSpace[blockX, blockY + 1, blockZ + 1].ForceNegativeY += force70; fSpace[blockX, blockY + 1, blockZ + 1].ForceNegativeZ += force70; fSpace[blockX - 1, blockY - 1, blockZ - 1].ForcePositiveX += force50; fSpace[blockX - 1, blockY - 1, blockZ - 1].ForcePositiveY += force50; fSpace[blockX - 1, blockY - 1, blockZ - 1].ForcePositiveZ += force50; fSpace[blockX + 1, blockY - 1, blockZ - 1].ForceNegativeX += force50; fSpace[blockX + 1, blockY - 1, blockZ - 1].ForcePositiveY += force50; fSpace[blockX + 1, blockY - 1, blockZ - 1].ForcePositiveZ += force50; fSpace[blockX - 1, blockY + 1, blockZ - 1].ForcePositiveX += force50; fSpace[blockX - 1, blockY + 1, blockZ - 1].ForceNegativeY += force50; fSpace[blockX - 1, blockY + 1, blockZ - 1].ForcePositiveZ += force50; fSpace[blockX + 1, blockY + 1, blockZ - 1].ForceNegativeX += force50; fSpace[blockX + 1, blockY + 1, blockZ - 1].ForceNegativeY += force50; fSpace[blockX + 1, blockY + 1, blockZ - 1].ForcePositiveZ += force50; fSpace[blockX - 1, blockY - 1, blockZ + 1].ForcePositiveX += force50; fSpace[blockX - 1, blockY - 1, blockZ + 1].ForcePositiveY += force50; fSpace[blockX - 1, blockY - 1, blockZ + 1].ForceNegativeZ += force50; fSpace[blockX + 1, blockY - 1, blockZ + 1].ForceNegativeX += force50; fSpace[blockX + 1, blockY - 1, blockZ + 1].ForcePositiveY += force50; fSpace[blockX + 1, blockY - 1, blockZ + 1].ForceNegativeZ += force50; fSpace[blockX - 1, blockY + 1, blockZ + 1].ForcePositiveX += force50; fSpace[blockX - 1, blockY + 1, blockZ + 1].ForceNegativeY += force50; fSpace[blockX - 1, blockY + 1, blockZ + 1].ForceNegativeZ += force50; fSpace[blockX + 1, blockY + 1, blockZ + 1].ForceNegativeX += force50; fSpace[blockX + 1, blockY + 1, blockZ + 1].ForceNegativeY += force50; fSpace[blockX + 1, blockY + 1, blockZ + 1].ForceNegativeZ += force50; } count++; }); #endregion #region STEP: Copy SPACE to TEMP Parallel.For(1, WORLD_BLOCKS_MAX, x => { for (int y = 1; y < WORLD_BLOCKS_MAX; y++) { for (int z = 1; z < WORLD_BLOCKS_MAX; z++) { float forceX = fSpace[x, y, z].ForcePositiveX - fSpace[x, y, z].ForceNegativeX; float forceY = fSpace[x, y, z].ForcePositiveY - fSpace[x, y, z].ForceNegativeY; float forceZ = fSpace[x, y, z].ForcePositiveZ - fSpace[x, y, z].ForceNegativeZ; if (forceX > 0) { fSpaceTemp[x, y, z].ForcePositiveX = forceX; } else { fSpaceTemp[x, y, z].ForceNegativeX = -forceX; } if (forceY > 0) { fSpaceTemp[x, y, z].ForcePositiveY = forceY; } else { fSpaceTemp[x, y, z].ForceNegativeY = -forceY; } if (forceZ > 0) { fSpaceTemp[x, y, z].ForcePositiveZ = forceZ; } else { fSpaceTemp[x, y, z].ForceNegativeZ = -forceZ; } count++; } } }); #endregion #region STEP: Every location affects it neighbours Parallel.For(1, WORLD_BLOCKS_MAX, x => { for (int y = 1; y < WORLD_BLOCKS_MAX; y++) { for (int z = 1; z < WORLD_BLOCKS_MAX; z++) { fSpace[x, y, z].ForcePositiveX = 0; fSpace[x, y, z].ForcePositiveY = 0; fSpace[x, y, z].ForcePositiveZ = 0; fSpace[x, y, z].ForceNegativeX = 0; fSpace[x, y, z].ForceNegativeY = 0; fSpace[x, y, z].ForceNegativeZ = 0; for (int dx = -1; dx < 2; dx++) { for (int dy = -1; dy < 2; dy++) { for (int dz = -1; dz < 2; dz++) { float fx = fSpaceTemp[x + dx, y + dy, z + dz].ForcePositiveX - fSpaceTemp[x + dx, y + dy, z + dz].ForceNegativeX; float fy = fSpaceTemp[x + dx, y + dy, z + dz].ForcePositiveY - fSpaceTemp[x + dx, y + dy, z + dz].ForceNegativeY; float fz = fSpaceTemp[x + dx, y + dy, z + dz].ForcePositiveZ - fSpaceTemp[x + dx, y + dy, z + dz].ForceNegativeZ; if (fx > 0) { fSpace[x, y, z].ForcePositiveX += fx; } else { fSpace[x, y, z].ForceNegativeX -= fx; } if (fy > 0) { fSpace[x, y, z].ForcePositiveY += fy; } else { fSpace[x, y, z].ForceNegativeY -= fy; } if (fz > 0) { fSpace[x, y, z].ForcePositiveZ += fz; } else { fSpace[x, y, z].ForceNegativeZ -= fz; } } } } float m = 1 / 27f; fSpace[x, y, z].ForcePositiveX *= m; fSpace[x, y, z].ForcePositiveY *= m; fSpace[x, y, z].ForcePositiveZ *= m; fSpace[x, y, z].ForceNegativeX *= m; fSpace[x, y, z].ForceNegativeY *= m; fSpace[x, y, z].ForceNegativeZ *= m; count++; } } }); for (int i = 0; i < WORLD_BLOCKS; i++) { for (int j = 0; j < WORLD_BLOCKS; j++) { fSpace[i, j, 0] = new MySpace(); fSpace[i, j, WORLD_BLOCKS_MAX] = new MySpace(); fSpace[i, 0, j] = new MySpace(); fSpace[i, WORLD_BLOCKS_MAX, j] = new MySpace(); fSpace[0, i, j] = new MySpace(); fSpace[WORLD_BLOCKS_MAX, i, j] = new MySpace(); } } #endregion #region STEP: Change velocity of every particle fTotalMass = 0; foreach (Particle particle in fParticles) { int blockX = (int)((particle.Position.X + HALF_WORLD_SIZE) * PARTICLE_TO_WORLD); int blockY = (int)((particle.Position.Y + HALF_WORLD_SIZE) * PARTICLE_TO_WORLD); int blockZ = (int)((particle.Position.Z + HALF_WORLD_SIZE) * PARTICLE_TO_WORLD); if (blockX < 1 || blockY < 1 || blockZ < 1 || blockX >= WORLD_BLOCKS_MAX || blockY >= WORLD_BLOCKS_MAX || blockZ >= WORLD_BLOCKS_MAX) { particle.Remove = true; } else { fTotalMass += particle.Mass; float forceX = fSpace[blockX, blockY, blockZ].ForcePositiveX - fSpace[blockX, blockY, blockZ].ForceNegativeX; float forceY = fSpace[blockX, blockY, blockZ].ForcePositiveY - fSpace[blockX, blockY, blockZ].ForceNegativeY; float forceZ = fSpace[blockX, blockY, blockZ].ForcePositiveZ - fSpace[blockX, blockY, blockZ].ForceNegativeZ; float effect = 0.01f;// 0.01f / particle.Mass; forceX *= effect; forceY *= effect; forceZ *= effect; particle.Velocity.X += (float)(fGravitationEffect * factor * forceX); particle.Velocity.Y += (float)(fGravitationEffect * factor * forceY); particle.Velocity.Z += (float)(fGravitationEffect * factor * forceZ); } count++; } #endregion #region Update position of every particle for (int i = 0; i < fParticles.Count; i++) { Particle particle = fParticles[i]; if (particle.Remove) { fParticles.RemoveAt(i--); } else { particle.Position.X += Convert.ToSingle(factor * particle.Velocity.X); particle.Position.Y += Convert.ToSingle(factor * particle.Velocity.Y); particle.Position.Z += Convert.ToSingle(factor * particle.Velocity.Z); } count++; } #endregion return(count); }
// ---------------------------------------------------------------- // Initialize // ---------------------------------------------------------------- public ExitSpot(Board _boardRef, ExitSpotData data) { base.InitializeAsBoardObject(_boardRef, data); // Tell my BoardSpace I'm on it! MySpace.SetMyExitSpot(this); }
public void Deserialize(MySpace.Common.IO.IPrimitiveReader reader, int version) { this.cacheListId = reader.ReadBytes(reader.ReadInt32()); int count = reader.ReadInt32(); if (version >= 2) { if (count > 0) { this.cacheListNodeIds = new byte[count][]; DeserializeListV2(reader, count); } this.VirtualListCount = reader.ReadInt32(); if (version >= 3) this.PrimaryId = reader.ReadInt32(); } else { if (count > 0) { this.cacheListNodeIds = new byte[count][]; DeserializeListV1(reader, count); } } }
public void Deserialize(MySpace.Common.IO.IPrimitiveReader reader, int version) { this.ContainsCacheListNode = reader.ReadBoolean(); this.ListExists = reader.ReadBoolean(); this.ListMetadata = reader.ReadBytes(reader.ReadInt32()); this.CacheListTotalCount = reader.ReadInt32(); int count = reader.ReadInt32(); if (version >= 2) { this.CacheList = DeserializeListV2(reader, count); this.VirtualListCount = reader.ReadInt32(); } else { this.CacheList = DeserializeListV1(reader, count); } }
private void SerializeList(MySpace.Common.IO.IPrimitiveWriter writer) { foreach (CacheListNode node in this.CacheList) { if (node.NodeId == null || node.NodeId.Length <= 0) { writer.Write((int)0); } else { writer.Write(node.NodeId.Length); writer.Write(node.NodeId); } if (node.Data == null || node.Data.Length <= 0) { writer.Write((int)0); } else { writer.Write(node.Data.Length); writer.Write(node.Data); } writer.Write(node.TimestampTicks); } }
private void Event() { target = MyPlayer.GetPlayer(); switch (triggerPointName) { case "ComeDown": { if (MySpace.IsInArea2D(gameObject, target, 0.15f)) { MyObject.SetObjectActive("Canvas/ComeDown"); } else { MyObject.SetObjectActive("Canvas/ComeDown", false); } break; } case "ComeUp": { if (MySpace.IsInArea2D(gameObject, target, 0.15f)) { MyObject.SetObjectActive("Canvas/ComeUp"); } else { MyObject.SetObjectActive("Canvas/ComeUp", false); } break; } case "ExitHome": { if (Dialogue.nowIndex >= 15) { if (MySpace.IsInArea2D(gameObject, target, 0.4f)) { MyObject.SetObjectActive("Canvas/ExitHome"); } else { MyObject.SetObjectActive("Canvas/ExitHome", false); } } break; } case "GoHome": { if (target.name == "YangYi" && Dialogue.nowIndex >= 5 && !target.GetComponent <PlayerStatus>().isInCarrier) { if (MySpace.IsInArea2D(gameObject, target, 0.4f)) { MyObject.SetObjectActive("Canvas/GoHome"); } else { MyObject.SetObjectActive("Canvas/GoHome", false); } } break; } case "UpDown_01": { float deltaX = target.transform.position.x - transform.position.x; if (deltaX > 0 && deltaX < 1.0f) { if (nowTime == 0.0f) { target.GetComponent <SpriteRenderer>().enabled = false; target.GetComponent <PlayerController>().enabled = false; } nowTime += Time.deltaTime; if (nowTime >= 3.0f) { target.GetComponent <SpriteRenderer>().enabled = true; nowTime = 0.0f; nowFloorNum = (nowFloorNum + 1) % 2; if (nowFloorNum == 0) { target.transform.position = new Vector3(transform.position.x, -0.3f, -0.2f); } else if (nowFloorNum == 1) { target.transform.position = new Vector3(transform.position.x, 2.1f, -0.2f); } target.GetComponent <PlayerController>().SetDirection(-1); target.GetComponent <PlayerController>().enabled = true; } } break; } } }
public override void Deserialize(MySpace.Common.IO.IPrimitiveReader reader, int version) { Deserialize(reader); }
public void Deserialize(MySpace.Common.IO.IPrimitiveReader reader) { Deserialize(reader, CurrentVersion); }
// ---------------------------------------------------------------- // Doers // ---------------------------------------------------------------- public void UpdateIsOn() { IsOn = MySpace.HasBeamSansSource(ChannelID); }
public void Deserialize(MySpace.Common.IO.IPrimitiveReader reader, int version) { this.CacheListId = reader.ReadBytes(reader.ReadInt32()); this.CacheListNodeId = reader.ReadBytes(reader.ReadInt32()); if(version>=2) this.virtualListCount = reader.ReadInt32(); if (version >= 3) this.PrimaryId = reader.ReadInt32(); }
// ---------------------------------------------------------------- // Doers // ---------------------------------------------------------------- override public void AddMyFootprint() { MySpace.SetMyOccupant(this); }
override public void RemoveMyFootprint() { MySpace.RemoveMyOccupant(this); }
public double Distance(MySpace cm1, MySpace cm2) { double distance = Math.Sqrt(Math.Pow((cm1.X - cm2.X), 2) + Math.Pow((cm1.Y - cm2.Y), 2) + Math.Pow((cm1.Z - cm2.Z), 2)); return(distance); }
public void Print(MySpace cm) { Console.WriteLine("坐标X的值为" + cm.X + "坐标Y的值为" + cm.Y + "坐标Z的值为" + cm.Z); }
/// <summary> /// Update the space and particle velocity/direction /// </summary> private int UpdateSpaceAndParticles(double factor) { int count = 0; float force; // ----------------------------------------------------------------------- // STEP: All particles changes the room structure // ----------------------------------------------------------------------- Parallel.ForEach(fParticles, particle => { int blockX = (int)((particle.Position.X + HALF_WORLD_SIZE) * PARTICLE_TO_WORLD); int blockY = (int)((particle.Position.Y + HALF_WORLD_SIZE) * PARTICLE_TO_WORLD); if (blockX < 1 || blockY < 1 || blockX >= WORLD_BLOCKS_MAX || blockY >= WORLD_BLOCKS_MAX) { particle.Remove = true; } else { force = particle.Mass;// * factor? force *= 0.1f; float force70 = 0.7f * force; fSpace[blockX - 1, blockY].ForceRight += force; fSpace[blockX + 1, blockY].ForceLeft += force; fSpace[blockX, blockY - 1].ForceUp += force; fSpace[blockX, blockY + 1].ForceDown += force; fSpace[blockX - 1, blockY - 1].ForceRight += force70; fSpace[blockX - 1, blockY - 1].ForceUp += force70; fSpace[blockX + 1, blockY - 1].ForceLeft += force70; fSpace[blockX + 1, blockY - 1].ForceUp += force70; fSpace[blockX - 1, blockY + 1].ForceRight += force70; fSpace[blockX - 1, blockY + 1].ForceDown += force70; fSpace[blockX + 1, blockY + 1].ForceLeft += force70; fSpace[blockX + 1, blockY + 1].ForceDown += force70; } count++; }); // ----------------------------------------------------------------------- // STEP: Copy SPACE to TEMP // ----------------------------------------------------------------------- fSpaceTemp = new MySpace[WORLD_BLOCKS, WORLD_BLOCKS]; Parallel.For(1, WORLD_BLOCKS_MAX, x => { for (int y = 1; y < WORLD_BLOCKS_MAX; y++) { float forceX = fSpace[x, y].ForceRight - fSpace[x, y].ForceLeft; float forceY = fSpace[x, y].ForceUp - fSpace[x, y].ForceDown; if (forceX > 0) { fSpaceTemp[x, y].ForceRight = forceX; } else { fSpaceTemp[x, y].ForceLeft = -forceX; } if (forceY > 0) { fSpaceTemp[x, y].ForceUp = forceY; } else { fSpaceTemp[x, y].ForceDown = -forceY; } count++; } }); for (int i = 0; i < WORLD_BLOCKS; i++) { fSpaceTemp[0, i] = new MySpace(); fSpaceTemp[WORLD_BLOCKS_MAX, i] = new MySpace(); fSpaceTemp[i, 0] = new MySpace(); fSpaceTemp[i, WORLD_BLOCKS_MAX] = new MySpace(); } // ----------------------------------------------------------------------- // STEP: Update every location with forces from neighbours // ----------------------------------------------------------------------- Parallel.For(1, WORLD_BLOCKS_MAX, x => { for (int y = 1; y < WORLD_BLOCKS_MAX; y++) { fSpace[x, y].ForceRight = 0; fSpace[x, y].ForceLeft = 0; fSpace[x, y].ForceUp = 0; fSpace[x, y].ForceDown = 0; for (int dx = -1; dx < 2; dx++) { for (int dy = -1; dy < 2; dy++) { float fx = fSpaceTemp[x + dx, y + dy].ForceRight - fSpaceTemp[x + dx, y + dy].ForceLeft; float fy = fSpaceTemp[x + dx, y + dy].ForceUp - fSpaceTemp[x + dx, y + dy].ForceDown; if (fx > 0) { fSpace[x, y].ForceRight += fx; } else { fSpace[x, y].ForceLeft -= fx; } if (fy > 0) { fSpace[x, y].ForceUp += fy; } else { fSpace[x, y].ForceDown -= fy; } } } float m = 1 / 10f; fSpace[x, y].ForceRight *= m; fSpace[x, y].ForceLeft *= m; fSpace[x, y].ForceUp *= m; fSpace[x, y].ForceDown *= m; count++; } }); for (int i = 0; i < WORLD_BLOCKS; i++) { fSpace[0, i] = new MySpace(); fSpace[WORLD_BLOCKS_MAX, i] = new MySpace(); fSpace[i, 0] = new MySpace(); fSpace[i, WORLD_BLOCKS_MAX] = new MySpace(); } // ----------------------------------------------------------------------- // STEP: Room changes velocity of all particles // ----------------------------------------------------------------------- fTotalMass = 0; foreach (Particle particle in fParticles) { int blockX = (int)((particle.Position.X + HALF_WORLD_SIZE) * PARTICLE_TO_WORLD); int blockY = (int)((particle.Position.Y + HALF_WORLD_SIZE) * PARTICLE_TO_WORLD); if (blockX < 1 || blockY < 1 || blockX >= WORLD_BLOCKS_MAX || blockY >= WORLD_BLOCKS_MAX) { particle.Remove = true; } else { fTotalMass += particle.Mass; float forceX = fSpace[blockX, blockY].ForceRight - fSpace[blockX, blockY].ForceLeft; float forceY = fSpace[blockX, blockY].ForceUp - fSpace[blockX, blockY].ForceDown; float effect = 0.0100f; forceX *= effect; forceY *= effect; particle.Velocity.X += (float)(fGravitationEffect * factor * forceX); particle.Velocity.Y += (float)(fGravitationEffect * factor * forceY); } count++; } // ----------------------------------------------------------------------- // STEP: Update position of all particles // ----------------------------------------------------------------------- for (int i = 0; i < fParticles.Count; i++) { Particle particle = fParticles[i]; if (particle.Remove) { fParticles.RemoveAt(i--); } else { particle.Position.X += Convert.ToSingle(factor * particle.Velocity.X); particle.Position.Y += Convert.ToSingle(factor * particle.Velocity.Y); } count++; } return(count); }
private static void SerializeList(MySpace.Common.IO.IPrimitiveWriter writer, IList<CacheData> list) { int count = 0; if (list != null && list.Count > 0) { count = list.Count; writer.Write(count); CacheData cacheData; for (int i = 0; i < count; i++) { cacheData = list[i]; writer.Write(cacheData.Id.Length); writer.Write(cacheData.Id); if (cacheData.Data == null) { writer.Write((int)0); } else { writer.Write(cacheData.Data.Length); writer.Write(cacheData.Data); } writer.Write(new SmallDateTime(cacheData.CreateTimestamp).TicksInt32); writer.Write(cacheData.CacheTypeId); } } else { writer.Write(count); } }
public override void Deserialize(MySpace.Common.IO.IPrimitiveReader reader) { base.Deserialize(reader); ushort Count = reader.ReadUInt16(); if (Count > 0) { data = reader.ReadBytes(Count); } }
public void Serialize(MySpace.Common.IO.IPrimitiveWriter writer) { writer.Write(indexId.Length); writer.Write(indexId); SerializeList(writer, cacheDataList); SerializeList(writer, cacheDataDeleteList); }
public void Serialize(MySpace.Common.IO.IPrimitiveWriter writer) { writer.Write(this.ContainsCacheListNode); writer.Write(this.ListExists); if (this.ListMetadata == null || this.ListMetadata.Length <= 0) { writer.Write((int)0); } else { writer.Write(this.ListMetadata.Length); writer.Write(this.ListMetadata); } writer.Write(this.CacheListTotalCount); writer.Write(this.CacheList.Count); if (this.CacheList.Count > 0) { SerializeList(writer); } writer.Write(this.VirtualListCount); }
private static List<CacheData> DeserializeList(MySpace.Common.IO.IPrimitiveReader reader, byte[] indexId) { int count = reader.ReadInt32(); List<CacheData> list = new List<CacheData>(); if (count > 0) { for (int i = 0; i < count; i++) { list.Add(new CacheData( indexId, reader.ReadBytes(reader.ReadInt32()), reader.ReadBytes(reader.ReadInt32()), new SmallDateTime(reader.ReadInt32()).FullDateTime, reader.ReadInt32() )); } } return list; }
private static List<CacheListNode> DeserializeListV2(MySpace.Common.IO.IPrimitiveReader reader, int count) { List<CacheListNode> list = new List<CacheListNode>(); if (count > 0) { for (int i = 0; i < count; i++) { list.Add(new CacheListNode( reader.ReadBytes(reader.ReadInt32()), // nodeId reader.ReadBytes(reader.ReadInt32()), // data reader.ReadInt32())); // timestamp } } return list; }
public void Deserialize(MySpace.Common.IO.IPrimitiveReader reader) { indexId = reader.ReadBytes(reader.ReadInt32()); cacheDataList = DeserializeList(reader, indexId); cacheDataDeleteList = DeserializeList(reader, indexId); }
void Activate() //激活触发器 { GameObject target = MyPlayer.GetPlayer(); if (MySpace.IsInArea2D(target, gameObject, 0.4f)) { gameObject.SetActive(false); switch (eventName) { case "DriveDog": { MyObject.SetObjectActive("Canvas/Dialogue"); //激活对话框 break; } case "NightFall": { MyObject.SetObjectActive("Canvas/Aside"); MyObject.SetObjectActive("PropSet/Taxi"); MyObject.SetObjectActive("NPC/Huskie", false); WeatherManager.Alternate(); break; } case "TakeCar": { MyObject.SetObjectActive("Canvas/Dialogue"); //激活对话框 break; } case "FeelCold": { MyObject.SetObjectActive("Canvas/Dialogue"); break; } case "Faint": { MyObject.Find("NPC/Puppy").GetComponent <PlayerStatus>().Faint(); MyObject.SetObjectActive("NPC/Girl"); break; } case "FirstInGirlHome": { MyObject.SetObjectActive("Canvas/Dialogue"); break; } case "SeeGirlFather": { MyObject.SetObjectActive("Canvas/Aside"); WeatherManager.Alternate(); MyObject.SetObjectActive("NPC/Father"); MyObject.SetObjectActive("NPC/Mother"); MyObject.Find("NPC/Puppy").GetComponent <PlayerController>().SetDirection(1); break; } case "CallGirl": { MyObject.Find("NPC/Girl").GetComponent <GirlBehaviour>().SetStatus(1); break; } case "FatherMoveToSleep": { MyObject.Find("NPC/Father").GetComponent <FatherBehaviour>().SetStatus(0); break; } case "MotherLeaveHome": { MyObject.Find("NPC/Mother").GetComponent <MotherBehaviour>().SetStatus(0); break; } case "FollowGirlTerminal": { MyObject.SetObjectActive("Canvas/Dialogue"); break; } case "ReturnBedroom": { MyObject.Find("NPC/Girl").GetComponent <GirlBehaviour>().SetStatus(2); break; } case "GirlSleep": { MyObject.Find("GirlHome/GirlBed").GetComponent <FurnitureBehaviour>().ChangeSprite(1); MyObject.SetObjectActive("NPC/Girl", false); break; } case "PuppySleep": { MyObject.Find("NPC/Puppy").GetComponent <PlayerStatus>().Faint(); Invoke("ActiveAside", 2.0f); Invoke("PuppyWakeUp", 2.0f); break; } case "EncounterThief": { MyObject.SetObjectActive("NPC/Thief"); MyObject.SetObjectActive("Canvas/Dialogue"); break; } case "EncounterStranger": { MyObject.SetObjectActive("Canvas/Dialogue"); Invoke("GetBack", 2.0f); break; } case "HuskieSleep": { MyObject.Find("NPC/Huskie").transform.position = new Vector3(13.4f, -0.08f, -0.05f); MyObject.Find("NPC/Huskie").GetComponent <PlayerStatus>().Faint(); MyObject.SetObjectActive("NPC/DreamYang"); MyObject.Find("NPC/DreamYang").GetComponent <DreamYangBehaviour>().SetStatus(0); MyObject.SetObjectActive("Canvas/Dialogue"); break; } case "SnowStop": { MyObject.SetObjectActive("Canvas/Aside"); MyObject.Find("SnowSet").GetComponent <SnowManager>().ShutdownAllChildren(); break; } case "YangShout": { MyObject.SetObjectActive("Canvas/Dialogue"); break; } case "SeeHuskie": { MyObject.SetObjectActive("Canvas/Dialogue"); break; } case "ApprochHuskie": { MyObject.Find("NPC/Huskie").GetComponent <HuskieBehaviour>().enabled = true; MyObject.Find("NPC/Huskie").GetComponent <HuskieBehaviour>().SetStatus(1); break; } default: { break; } } } }
private void getSearchResults(string textToSearch, int type) { if (Session["offSiteMySpace"] != null) { MySpace os = (MySpace)Session["offSiteMySpace"]; Dictionary <string, string> ht = new Dictionary <string, string>(); ht.Add("count", "20"); SearchResultVideos searchResult = new SearchResultVideos(); SearchResultImages searchResultImages = new SearchResultImages(); SearchResultPeople searchResultPeople = new SearchResultPeople(); switch (type) { case 1: searchResult = (SearchResultVideos)JsonConvert.Import(typeof(SearchResultVideos), os.SearchVideos(txtSearch.Text, ht)); break; case 2: searchResultImages = (SearchResultImages)JsonConvert.Import(typeof(SearchResultImages), os.SearchImages(txtSearch.Text, ht)); break; case 3: searchResultPeople = (SearchResultPeople)JsonConvert.Import(typeof(SearchResultPeople), os.SearchPeople(txtSearch.Text, ht)); break; default: break; } if (searchResult.TotalResults > 0) { StringBuilder sb = new StringBuilder(); sb.Append("<table>"); foreach (var result in searchResult.entry) { sb.Append("<tr>"); sb.Append(string.Format("<td><img src='{0}' /></td>", result.thumbnailUrl)); sb.Append(string.Format("<td>Title: {0}<br/>Video URL: <a href='{1}'>Click here to View</a><br/>Categories: {2}<br/>Description: {3}<br/></td>", result.title, result.videoUrl, result.categories, result.description)); sb.Append("</tr>"); } sb.Append("</table>"); dvReslut.InnerHtml = sb.ToString(); } else if (searchResultImages.TotalResults > 0) { StringBuilder sb = new StringBuilder(); sb.Append("<table>"); foreach (var result in searchResultImages.entry) { sb.Append("<tr>"); sb.Append(string.Format("<td><img src='{0}' /></td>", result.thumbnailUrl)); sb.Append(string.Format("<td>Title: {0}<br/>Image URL: <a href='{1}'>Click here to View</a><br/></td>", result.displayName, result.imageUrl)); sb.Append("</tr>"); } sb.Append("</table>"); dvReslut.InnerHtml = sb.ToString(); } else if (searchResultPeople.TotalResults > 0) { StringBuilder sb = new StringBuilder(); sb.Append("<table>"); foreach (var result in searchResultPeople.entry) { sb.Append("<tr>"); sb.Append(string.Format("<td><img src='{0}' /></td>", result.thumbnailUrl)); sb.Append(string.Format("<td>Name: {0}<br/>Gender: {1}<br/>Location: {2}<br/>Profile URL: {3}<br/></td>", result.displayName, result.gender, result.location, result.profileUrl)); sb.Append("</tr>"); } sb.Append("</table>"); dvReslut.InnerHtml = sb.ToString(); } } }
private void DeserializeListV2(MySpace.Common.IO.IPrimitiveReader reader, int count) { for (int i = 0; i < count; i++) { this.cacheListNodeIds[i] = reader.ReadBytes(reader.ReadInt32()); } }
public ActionResult MakeNewSpace() { thisSpace = new MySpace(); return(RedirectToAction("Index")); }
private void SerializeList(MySpace.Common.IO.IPrimitiveWriter writer) { for (int i = 0; i < this.cacheListNodeIds.Length; i++) { writer.Write(this.cacheListNodeIds[i].Length); writer.Write(this.cacheListNodeIds[i]); } }
public void Serialize(MySpace.Common.IO.IPrimitiveWriter writer) { //IndexExists writer.Write(indexExists); //IndexSize writer.Write(indexSize); //Metadata if (metadata == null || metadata.Length == 0) { writer.Write((ushort)0); } else { writer.Write((ushort)metadata.Length); writer.Write(metadata); } //ResultItemList if (resultItemList == null || resultItemList.Count == 0) { writer.Write(0); } else { writer.Write(resultItemList.Count); foreach (ResultItem resultItem in resultItemList) { resultItem.Serialize(writer); } } //ExceptionInfo writer.Write(exceptionInfo); //VirtualCount writer.Write(virtualCount); }
public void Deserialize(MySpace.Common.IO.IPrimitiveReader reader, int version) { this.CacheListId = reader.ReadBytes(reader.ReadInt32()); this.PageSize = reader.ReadInt32(); this.PageNum = reader.ReadInt32(); this.ReversePagedQuery = reader.ReadBoolean(); if(version>=2) this.VirtualListCount = reader.ReadInt32(); if (version >= 3) this.PrimaryId = reader.ReadInt32(); }
public void Deserialize(MySpace.Common.IO.IPrimitiveReader reader, int version) { //IndexExists indexExists = reader.ReadBoolean(); //IndexSize indexSize = reader.ReadInt32(); //Metadata ushort len = reader.ReadUInt16(); if (len > 0) { metadata = reader.ReadBytes(len); } //ResultItemList int listCount = reader.ReadInt32(); resultItemList = new List<ResultItem>(listCount); if (listCount > 0) { ResultItem resultItem; for (int i = 0; i < listCount; i++) { resultItem = new ResultItem(); resultItem.Deserialize(reader); resultItemList.Add(resultItem); } } //ExceptionInfo exceptionInfo = reader.ReadString(); //VirtualCount if (version >= 2) { virtualCount = reader.ReadInt32(); } }
public void Deserialize(MySpace.Common.IO.IPrimitiveReader reader) { reader.Response = SerializationResponse.Unhandled; }
public static void ValidateAppendMany(MySpace.DataMining.DistributedObjects5.Hashtable dht) { // Validate... foreach (byte[] xx in MANY) { if (dht[xx].Length != 200 * 3 * 3) // Looped 200 times, appending 3 chars from 3 threads. { throw new Exception("Bad appends in multiple threads"); } } }