/// <summary> /// Solo llamar cuando se quiera guardar /// </summary> /// <returns></returns> public string SaveableString(CommunityStatus projectStatus) { if (FirstSave) { returnableSaves--; } DatabaseObject.CommunityStatus = projectStatus; var ret = stateString(true); lastSavedState = stateHash(); return(ret); }
public void SaveProject(CommunityStatus communityStatus, bool showSplashConfirmation = true) { string fileString = workingProject.SaveableString(communityStatus); string newFileName; using (MemoryStream stream = new MemoryStream()) { var sw = new StreamWriter(stream, new UTF8Encoding()); sw.Write(fileString); sw.Flush(); stream.Seek(0, SeekOrigin.Begin); newFileName = GamesToGoEditor.HashBytes(stream.ToArray()); sw.Dispose(); } using (Stream fileStream = store.GetStream($"files/{newFileName}", FileAccess.Write, FileMode.Create)) { var sw = new StreamWriter(fileStream, new UTF8Encoding()); sw.Write(fileString); sw.Flush(); sw.Dispose(); } if (workingProject.DatabaseObject.File == null) { workingProject.DatabaseObject.File = new DatabaseFile { Type = "project", }; database.Add(workingProject.DatabaseObject); } else { store.Delete($"files/{workingProject.DatabaseObject.File.NewName}"); } workingProject.DatabaseObject.File.NewName = newFileName; database.SaveChanges(); workingProject.DatabaseObject.ImageRelationID = workingProject.Image.Value == null ? null : (int?)workingProject.DatabaseObject.Relations.First(r => r.File.NewName == workingProject.Image.Value.ImageName).RelationID; database.SaveChanges(); initialRelations = workingProject.DatabaseObject.Relations == null ? null : new List <FileRelation>(workingProject.DatabaseObject.Relations); Random random = new Random(); if (showSplashConfirmation) { splashOverlay.Show(@"Se ha guardado el proyecto localmente", new Colour4(randomNumber(), randomNumber(), randomNumber(), 255) /*new Colour4(80, 80, 80, 255)*/); } byte randomNumber() { return((byte)(random.NextDouble() * 255)); } }
public static CommunityPage getCommunities(CommunityStatus status) { throw new global::System.NotImplementedException("Communities.GetCommunities"); }
public String ToString() { return("Id - " + Id.ToString() + " Path - " + Path + " Name - " + Name + " CommunityStatus - " + CommunityStatus.ToString() + " SubscriptionStatus - " + SubscriptionStatus.ToString()); }
public void ChangeStatus(CommunityStatus status) { View.LoadTypes(Service.GetCommunitiesAvailableTypes(status)); LoadCommunities(View.CommunityFilters); }