void ExtractUser() { Errors = ExtractKey <string[]>("errors"); if (!HasErrors) { CMUser = RawObject.ToObject <CMUser <CMUserProfile> >(); if (RawObject["profile"] != null) { CMUser.Profile = RawObject["profile"].ToObject <CMUserProfile>(); } // Because user id can come from different places depending on create, search, login if (!string.IsNullOrEmpty(CMUser.UserID) && CMUser.Profile != null && string.IsNullOrEmpty(CMUser.Profile.UserID)) { CMUser.Profile.UserID = CMUser.UserID; } else if (CMUser.Profile != null && !string.IsNullOrEmpty(CMUser.Profile.UserID) && string.IsNullOrEmpty(CMUser.UserID)) { CMUser.UserID = CMUser.Profile.UserID; } } else { CMUser = null; } }
private void Init() { canvasGroup = RawObject.AddComponent <CanvasGroup>(); notificationList = CreateChild <NotificationList>("notification-list"); { notificationList.Anchor = AnchorType.Fill; notificationList.Offset = Offset.Zero; notificationList.Scope = NotificationScope.Temporary; notificationList.OnDismiss += OnDismissed; } showAni = new Anime(); showAni.AddEvent(0f, () => Active = true); showAni.AnimateFloat(a => canvasGroup.alpha = a) .AddTime(0f, () => canvasGroup.alpha) .AddTime(0.25f, 1f) .Build(); hideAni = new Anime(); hideAni.AnimateFloat(a => canvasGroup.alpha = a) .AddTime(0f, () => canvasGroup.alpha) .AddTime(0.25f, 1f) .Build(); hideAni.AddEvent(hideAni.Duration, () => Active = false); OnEnableInited(); }
public async void SetCellData(RawObject raw, int count) { var sprite = await AssetsController.LoadAsset <Sprite>(raw.IconRef); SetRawIcon(sprite); SetRawText(count.ToString()); }
private void PopulateConversionTable() { var toUnicodeRef = RawObject.GetAttributeValue <PdfArray>("ToUnicode"); var toUnicodeObj = document.ObjectRoot.GetObjectByRef(toUnicodeRef); toUnicodeObj.ConvertContentToText(); ParseConversionTables(toUnicodeObj.TextContent); }
public PropertyReference[] GetProperties() { var type = RawObject.GetType(); var propertyInfos = type.GetProperties(); List <PropertyReference> toReturn = new List <PropertyReference>(); foreach (var propertyInfo in propertyInfos) { if (propertyInfo.GetIndexParameters().Any()) { // Ignore indexer properties continue; } var reference = new PropertyReference { Name = propertyInfo.Name, IsWritable = propertyInfo.CanWrite, IsReadable = propertyInfo.CanRead, TypeName = propertyInfo.PropertyType.FullName }; if (propertyInfo.CanRead) { var valueAsObject = propertyInfo.GetValue(RawObject); reference.ValueAsString = Convert.ToString(valueAsObject); } toReturn.Add(reference); } var fields = type .GetFields() .Select(x => new PropertyReference { Name = x.Name, TypeName = x.FieldType.FullName, ValueAsString = Convert.ToString(x.GetValue(RawObject)) }) .ToList(); toReturn.AddRange(fields); return(toReturn.ToArray()); }
private HitObject[] parseHitObjects() { String[] RawObjects = getContent("HitObjects"); List <HitObject> ParsedObjects = new List <HitObject>(); foreach (String RawObject in RawObjects) { String[] Parameters = RawObject.Split(','); HitObject Object = new HitObject(); HitObjectType Type = (HitObjectType)Int32.Parse(Parameters[3]); ColorIndex += (Type.HasFlag(HitObjectType.SkipColor3) ? 4 : 0) + (Type.HasFlag(HitObjectType.SkipColor2) ? 2 : 0) + (Type.HasFlag(HitObjectType.SkipColor1) ? 1 : 0) + (Type.HasFlag(HitObjectType.NewCombo) ? 1 : 0); Vector2 Vector = new Vector2(Int32.Parse(Parameters[0]) + 64, Int32.Parse(Parameters[1]) + 56); if (Type.HasFlag(HitObjectType.Circle)) { Object = new Circle(Type, Vector, Int32.Parse(Parameters[2]), Colors[ColorIndex % Colors.Length]); } else if (Type.HasFlag(HitObjectType.Slider)) { List <String> SliderParameters = new List <String>(); for (int i = 5; i < Parameters.Length; i++) { SliderParameters.Add(Parameters[i]); } int Time = Int32.Parse(Parameters[2]); Object = new Slider(Type, Vector, Time, Colors[ColorIndex % Colors.Length], new double[] { getBPMAt(Time), getSliderVelocityAt(Time) }, SliderParameters.ToArray()); } else if (Type.HasFlag(HitObjectType.Spinner)) { Object = new Spinner(Type, Vector, Int32.Parse(Parameters[2]), new Color(255, 255, 255), Int32.Parse(Parameters[5])); } ParsedObjects.Add(Object); } return(ParsedObjects.ToArray()); }
public override int GetHashCode() { return(RawObject.GetHashCode()); }
public override int GetHashCode() => RawObject.GetHashCode();
/// <summary> /// Fill basic font information /// </summary> protected void PopulateBasicInfo() { Name = RawObject.GetAttributeValue <PdfAtom>("BaseFont").AsString(); }
public void SetRawData(RawObject raw) { SetRawIcon(raw.IconRef); SetRawText(raw.GetCount().ToString()); }
/// <summary> /// 指定した名前の参照を取得します。 /// </summary> /// <param name="name">名前</param> /// <returns>参照</returns> public KecaknoahReference GetMemberReference(string name) => RawObject.GetMemberReference(name);
public void ViewMotionInfo(int n, int mn) { var hearing = DB.Appeals.FirstOrDefault(x => x.Id == n); if (hearing == null) { RespondRaw("Unknown hearing", 404); return; } var motion = hearing.Motions.FirstOrDefault(x => x.Id == mn); if (motion == null) { RespondRaw("Unknown motion", 404); return; } var attachments = new Div(); int attachmentIndex = 0; foreach (var attch in motion.Attachments) { attch.Attachment ??= DB.AppealsAttachments.FirstOrDefault(x => x.Id == attch.AttachmentId); var player = DB.Players.FirstOrDefault(x => x.Id == attch.Attachment.FiledBy); string relation = hearing.getRelationToCase(player); var div = new Div(id: attch.AttachmentId.ToString(), cls: "file file-" + relation.ToLower()) { Children = { new Paragraph($"Filed by {relation} {player.Name}") } }; if (hearing.isClerkOnCase(SelfPlayer)) { div.Children.Add(new Input("button", hearing.Sealed ? "Unseal" : "Seal") { OnClick = $"toggleSeal({attachmentIndex});" }); } div.Children.Add(new RawObject($"<iframe src='/chess/cases/{n}/motions/{mn}/{attch.AttachmentId}'></iframe>")); attachments.Children.Add(div); } var holding = new RawObject(""); if (motion.Holding != null) { string cls; if (motion.Denied) { cls = "denied"; } else if (motion.Granted) { cls = "granted"; } else { cls = ""; } holding = new RawObject($"<p class='{cls}'><strong>{motion.Holding}</strong> on {motion.HoldingDate:dd/MM/yyyy}</p>"); } string cj = hearing.isClerkOnCase(SelfPlayer) ? "<input type='button' class='cjdo' onclick='doThing()' value='Submit holding'>" : ""; ReplyFile("motion.html", 200, new Replacements(hearing) .Add("files", attachments) .Add("motion", motion) .Add("mholding", holding) .Add("chief", cj) .IfElse("canadd", motion.Granted || motion.Denied, "display: none;", "display: block") .Add("cjDoUrl", $"/chess/api/cases/{n}/motions/{mn}/holding") .Add("newpath", $"cases/{n}/motions/{mn}/files")); }
private void Init() { cellRecycler = new ManagedRecycler <NotificationCell>(CreateCell); canvasGroup = RawObject.AddComponent <CanvasGroup>(); }
private void Nestable2StringToHierarchy(string RawData, int?parentNode = null, int?outletId = null) { int bracesCounter = 0; List <int> CollectionId = new List <int>(); int startIndex = 0, endIndex = 0; List <string> objectList = new List <string>(); for (int i = 0; i < RawData.Length; i++) { if (RawData[i] == '{') { // Incrementing brace cout bracesCounter++; // Caching start index for getting substring if (bracesCounter == 1) { startIndex = i; } } else if (RawData[i] == '}') { // Decrementing brace cout bracesCounter--; // When brace count is 0, we have found an unit from same level if (bracesCounter == 0) { // Caching end index for getting substring endIndex = i; // Cutting substring from start index to end index objectList.Add(RawData.Substring(startIndex, (endIndex - startIndex) + 1)); } } } // Order by length so that we deal with recursion at the end of the road when we have already dealt with the rest of the ids objectList = objectList.OrderBy(x => x.Length).ToList(); foreach (string RawObject in objectList) { int categoryId = 0; if (RawObject.Contains("children")) { // Find the first occurance of c int elementBreakIndex = 0; for (int i = 0; i < RawObject.Length; i++) { if (RawObject[i] == 'c') { elementBreakIndex = i; break; } } // Cut from index 0 till first occurance of 'c' // Split it by ':' to get substring "id" and the id number seperated. // The number will always come at the second index of the array due to the format of the string // The result might have a ',' as a garbage. Simply replace that with empty space and trim to get the exact number string substrContainingId = RawObject.Substring(0, elementBreakIndex); substrContainingId = substrContainingId.Split(':')[1]; substrContainingId = substrContainingId.Replace(',', ' '); substrContainingId = substrContainingId.Replace('\n', ' '); substrContainingId = substrContainingId.Replace('\"', ' '); substrContainingId = substrContainingId.Replace('"', ' '); categoryId = int.Parse(substrContainingId.Trim()); var category = _categoryRepo.Get(categoryId); if (category.OutletId == outletId) { category.ParentCategoryId = parentNode; } _categoryRepo.Update(category); Nestable2StringToHierarchy(RawObject.Substring(1, RawObject.Length - 1), categoryId, outletId); } else { categoryId = int.Parse(RawObject.Remove(RawObject.Length - 1, 1).Remove(0, 1).Split(':')[1]); var category = _categoryRepo.Get(categoryId); if (category.OutletId == outletId) { category.ParentCategoryId = parentNode; } _categoryRepo.Update(category); } } }