public VkLayerProperties(Raw* raw) { LayerName = VkHelpers.ToString(raw->layerName); SpecVersion = raw->specVersion; ImplementationVersion = raw->implementationVersion; Description = VkHelpers.ToString(raw->description); }
public void DynamicRawTest() { dynamic raw = new Raw(); raw.Name = "xyz"; Assert.AreEqual("xyz", raw.Name); }
private static AssetLibrarySet GetAssetLibrarySet(Raw.AssetLibrarySet raw) { return new AssetLibrarySet() { Id = raw.Id, Libraries = raw.Libraries.ToDictionary(kv => kv.Key, kv => GetAssetLibraryDefinition(kv)), }; }
private static AssetSublibraryDefinition GetAssetSublibraryDefinition(Raw.AssetSublibraryDefinition raw) { return new AssetSublibraryDefinition() { Description = raw.Description, Package = raw.Package, Assets = raw.Assets.ToList(), }; }
private static AssetLibraryManager GetAssetLibraryManager(Raw.AssetLibraryManager raw) { return new AssetLibraryManager() { Version = raw.Version, Configurations = raw.Configurations.ToDictionary(kv => kv.Key, kv => GetAssetLibraryConfiguration(kv)), Sets = raw.Sets.Select(s => GetAssetLibrarySet(s)).ToList(), }; }
public static Fragment Parse(String type, JToken json) { switch (type) { case "StructuredText": return(StructuredText.Parse(json)); case "Image": return(Image.Parse(json)); case "Link.web": return(WebLink.Parse(json)); case "Link.document": return(DocumentLink.Parse(json)); case "Link.file": return(FileLink.Parse(json)); case "Link.image": return(ImageLink.Parse(json)); case "Text": return(Text.Parse(json)); case "Select": return(Text.Parse(json)); case "Date": return(Date.Parse(json)); case "Timestamp": return(Timestamp.Parse(json)); case "Number": return(Number.Parse(json)); case "Color": return(Color.Parse(json)); case "Embed": return(Embed.Parse(json)); case "GeoPoint": return(GeoPoint.Parse(json)); case "Group": return(Group.Parse(json)); case "SliceZone": return(SliceZone.Parse(json)); default: return(json != null?Raw.Parse(json) : null); } }
/// <summary> /// Calculate the displayMode property /// </summary> /// <param name="ordering">Ordering Trend sample options</param> /// <param name="condense">Condense method options</param> /// <param name="stretch">Stretch method options</param> /// <param name="gapFill">Gap Fill Constant option (the number of missed samples that the user wants to gap fill)</param> /// <param name="badQuality">Last valid value option</param> /// <param name="raw">Raw data option</param> /// <returns>Options for formatting and calculating the samples of the query as an unsigned integer.</returns> public static uint Get( Ordering ordering = Ordering.OldestToNewest, Condense condense = Condense.Mean, Stretch stretch = Stretch.Step, uint gapFill = 0, BadQuality badQuality = BadQuality.Zero, Raw raw = Raw.None) { return((uint)ordering + (uint)condense + (uint)stretch + (gapFill * 4096) + (uint)badQuality + (uint)raw); }
public void Raw_Can_Serialize() { var raw = new Raw(); var stringBuilder = new StringBuilder(); var writer = XmlWriter.Create(stringBuilder); var xmlSerializer = new XmlSerializer(typeof(Raw)); xmlSerializer.Serialize(writer, raw); }
public override string ToString() { try { var s1 = Enum.GetName(typeof(VarSourceType), SourceType); var s2 = Enum.GetName(typeof(VarDataType), DataType); return($"{s1}-{s2}[{VariableID}]"); } catch { return("0x" + Raw.ToString("X8")); } }
public virtual async void OnRaw(IGatewayClient gatewayClient, string json) { await Task.Yield(); Raw?.Invoke(this, new ClientArgs <string> { GatewayClient = gatewayClient, Data = json }); }
internal WordAnalyResult SentenceAnaly() { if (ConfigBase.Default.IsTraceStack) { LogService.AnyLog("Stack", new StackTrace().GetFrame(0).GetMethod().ToString()); } WordAnalyResult result = new WordAnalyResult(); stops.Clear(); stops.Add(0);//开始值 //计算停止处 for (var fi = 0; fi < Raw.Length; fi++) { //句断符号停止 if (SentenceStopChars.Contains(Raw[fi])) { if (Raw[fi] != '.' || Raw[fi] == '.' && (fi == Raw.Length - 1 || Raw[fi++] == ' ')) { stops.Add(fi); } } } stops.Add(Raw.Length);//结束值 //截句 for (var fi = 1; fi < stops.Count; fi++) { var spi = stops[fi - 1]; if (spi > 0) { var splitword = Raw[spi]; //words.Add(splitword.ToString()); spi++; } var epi = stops[fi]; var sch = '\x0'; if (epi < Raw.Length) { sch = Raw[epi]; //epi++;//包含符号//注释后不包含符号 } var slen = epi - spi; if (slen < 1) { break; } var span = Raw.Slice(spi, slen); //$"P>{span.ToString()}".WriteInfoLine(); var words = new LinyeeNLWordAnalyzer(span, Enc, WordStopChars).WordAnaly(); var res = new Sentence(words, sch); sentences.Add(res);; } // return(result.SetData(sentences).SetOk()); }
public override long Seek(long offset, SeekOrigin origin) { if (m_Compressed) { long absPos = offset; if (origin == SeekOrigin.Current) { absPos += m_Uncomp.Position; } if (absPos < 0) { throw new Exception("Cannot seek past the begining of the stream."); } long pos = m_Uncomp.Position; m_Uncomp.Seek(0, SeekOrigin.End); while ((origin == SeekOrigin.End || absPos >= m_Uncomp.Length) && RawStream.Position < RawStream.Length) { int block = Raw.ReadInt32(); int ucLen = Raw.ReadInt32(); if (m_ReadBuff == null || m_ReadBuff.Length < block) { m_ReadBuff = new byte[block]; } if (m_CompBuff == null || m_CompBuff.Length < ucLen) { m_CompBuff = new byte[ucLen]; } else { ucLen = m_CompBuff.Length; } Raw.Read(m_ReadBuff, 0, block); ZLibError error = ZLib.uncompress(m_CompBuff, ref ucLen, m_ReadBuff, block); if (error != ZLibError.Z_OK) { throw new Exception("ZLib error uncompressing: " + error.ToString()); } m_Uncomp.Write(m_CompBuff, 0, ucLen); } m_Uncomp.Position = pos; return(m_Uncomp.Seek(offset, origin)); } else { return(RawStream.Seek(offset, origin)); } }
public override int Read(byte[] buffer, int offset, int count) { if (m_Compressed) { long pos = m_Uncomp.Position; m_Uncomp.Seek(0, SeekOrigin.End); while (pos + count > m_Uncomp.Length && RawStream.Position + 8 < RawStream.Length) { int block = Raw.ReadInt32(); int ucLen = Raw.ReadInt32(); if (block > 0x10000000 || block <= 0 || ucLen > 0x10000000 || ucLen <= 0) { break; } if (RawStream.Position + block > RawStream.Length) { break; } if (m_ReadBuff == null || m_ReadBuff.Length < block) { m_ReadBuff = new byte[block]; } if (m_CompBuff == null || m_CompBuff.Length < ucLen) { m_CompBuff = new byte[ucLen]; } else { ucLen = m_CompBuff.Length; } Raw.Read(m_ReadBuff, 0, block); ZLibError error = ZLib.uncompress(m_CompBuff, ref ucLen, m_ReadBuff, block); if (error != ZLibError.Z_OK) { throw new Exception("ZLib error uncompressing: " + error.ToString()); } m_Uncomp.Write(m_CompBuff, 0, ucLen); } m_Uncomp.Position = pos; return(m_Uncomp.Read(buffer, offset, count)); } else { return(RawStream.Read(buffer, offset, count)); } }
/* ############################################################################################### * Gets the top 100 coins (by marketcap) * * Arguments: none * */ internal async static Task <List <Top100card> > GetTop100() { int limit = 100; var currency = App.currency; var top100 = new List <Top100card>(); try { var resp = await Ioc.Default.GetService <ICryptoCompare>().GetTop100(currency, limit); var response = JsonSerializer.Deserialize <object>(resp.ToString()); var data = ((JsonElement)response).GetProperty("Data"); for (int i = 0; i < limit; i++) { var _coinInfo = data[i].GetProperty("CoinInfo"); var coinInfo = JsonSerializer.Deserialize <CoinInfo>(_coinInfo.ToString()); Raw raw = new Raw(); var rawExists = data[i].TryGetProperty("RAW", out var _raw); if (rawExists) { _raw = _raw.GetProperty(currency.ToUpperInvariant()); raw = JsonSerializer.Deserialize <Raw>(_raw.ToString()); } /// quick fixes coinInfo.ImageUrl = IconsHelper.GetIcon(coinInfo.Name); coinInfo.FavIcon = App.pinnedCoins.Contains(coinInfo.Name) ? "\uEB52" : "\uEB51"; coinInfo.ChangeFG = (raw.CHANGE24HOUR < 0) ? (SolidColorBrush)App.Current.Resources["pastelRed"] : (SolidColorBrush)App.Current.Resources["pastelGreen"]; //coinInfo.MarketCap = NumberHelper.AddUnitPrefix(raw.MKTCAP); //coinInfo.Volume = NumberHelper.AddUnitPrefix(raw.TOTALVOLUME24HTO); //raw.CHANGEPCT24HOUR = Math.Round(raw.CHANGEPCT24HOUR, 2); //raw.CHANGE24HOUR = NumberHelper.Rounder(raw.CHANGE24HOUR); //raw.PRICE = NumberHelper.Rounder(raw.PRICE); top100.Add(new Top100card() { CoinInfo = coinInfo, Raw = raw }); } top100.Sort((x, y) => y.Raw.MKTCAP.CompareTo(x.Raw.MKTCAP)); for (int i = 0; i < limit; i++) { top100[i].CoinInfo.Rank = i; } return(top100); } catch (Exception ex) { return(top100); } }
public QueryBuilder(Stream stream) { var reader = new StreamReader(stream); while (!reader.EndOfStream) { Raw = Raw + reader.ReadLine() + " "; } Raw = Raw.Trim(); InizializerValues(); }
protected string GetValue(string key) { if (Raw.ContainsKey(key)) { return(Raw[key]); } else { return(null); } }
public async Task <IActionResult> Create([Bind("RawId,RawName")] Raw raw) { if (ModelState.IsValid) { _context.Add(raw); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(raw)); }
private bool IncludeDecimal(int index) { if (!HasDecimal) { return(false); } var point = Raw.IndexOf('.'); return(index > point); }
private bool IncludeInteger(int index) { if (!HasDecimal) { return(true); } var point = Raw.IndexOf('.'); return(index <= point); }
public void ReplaceAt(UInt32 tag, WireType wireType, IReader reader, bool shouldNotify) { switch (tag) { case 0: this.UpdateAndNotify(0, Raw.Deserialize(reader, this.Path.GetNested(0)), shouldNotify); break; case 1: this.UpdateAndNotify(1, Attack.Deserialize(reader, this.Path.GetNested(1)), shouldNotify); break; default: reader.SkipToEnd(); break; } }
public override int GetHashCode() { int hash = 1; if (Raw.Length != 0) { hash ^= Raw.GetHashCode(); } if (Platform.Length != 0) { hash ^= Platform.GetHashCode(); } if (Os.Length != 0) { hash ^= Os.GetHashCode(); } if (OsVersion.Length != 0) { hash ^= OsVersion.GetHashCode(); } if (Engine.Length != 0) { hash ^= Engine.GetHashCode(); } if (EngineVersion.Length != 0) { hash ^= EngineVersion.GetHashCode(); } if (Browser.Length != 0) { hash ^= Browser.GetHashCode(); } if (BrowserVersion.Length != 0) { hash ^= BrowserVersion.GetHashCode(); } if (Localization.Length != 0) { hash ^= Localization.GetHashCode(); } if (Mobile != false) { hash ^= Mobile.GetHashCode(); } if (WalletCompatible != false) { hash ^= WalletCompatible.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
private RemainingCount CalculateRemainingCount(Raw.map_exboss[] data) { return new RemainingCount( CalculateRemainingCount( data.Where(x => !x.isLast).Max(x => x.ship.maxhp), data.Where(x => x.isLast).Max(x => x.ship.maxhp) ), CalculateRemainingCount( data.Where(x => !x.isLast).Min(x => x.ship.maxhp), data.Where(x => x.isLast).Min(x => x.ship.maxhp) )); }
public VkPhysicalDeviceProperties(Raw* raw) { ApiVersion = raw->apiVersion; DriverVersion = raw->driverVersion; VendorID = raw->vendorID; DeviceID = raw->deviceID; DeviceType = raw->deviceType; DeviceName = VkHelpers.ToString(raw->deviceName); PipelineCacheUUID = new VkUuid(raw->pipelineCacheUUID); Limits = new VkPhysicalDeviceLimits(&raw->limits); SparseProperties = new VkPhysicalDeviceSparseProperties(&raw->sparseProperties); }
public AddRawForm(Raw newRaw) { InitializeComponent(); controller = new AddRawController(); raw = newRaw; textBoxName.Text = newRaw.Name; textBoxGost.Text = newRaw.Gost; this.Text = "Изменение сырья"; textBoxName.BackColor = Color.White; saveButton.Enabled = true; saveButton.BackColor = Color.DarkOrange; }
public static List <Menu> GetOpenedMenus() { var data = Raw.GetOpenedMenus(); List <Menu> menus = new List <Menu>(); foreach (var i in data) { menus.Add(new Menu(i)); } return(menus); }
public ParseItemPacket(D2gsPacket packet) : base(packet.Raw) { Item = Parse(Raw.ToList()); Log.Verbose($"{BitConverter.ToString(Raw)}"); Log.Verbose($"(0x{packet.Type,2:X2}) Parse Item Packet:\n" + $"\tLevel {Item.Level}, {Item.Quality}" + $" { (Item.Ethereal ? "Ethereal" : "")}" + $"\t{ (Item.HasSockets ? $"Sockets: {Item.Sockets}" : "")}\n" + $"\t[{Item.Type}] " + $"{ (Item.IsIdentified ? "" : "Unidentified")} " + $"{Item.Name}\n" + $"\tItem ID: {Item.Id}\n" + $"\tAction: {Item.Action}\n" + $"\tContainer: {Item.Container}"); }
public Item(Raw.Collection.Item rawItem) { CollectionId = rawItem.CollId; Id = rawItem.ObjectId; if (rawItem.Image != null) { Image = new Uri("http:" + rawItem.Image); } Name = rawItem.Name; NumberOfPlays = rawItem.NumPlays; Subtype = rawItem.Subtype; if (rawItem.Thumbnail != null) { Thumbnail = new Uri("http:" + rawItem.Thumbnail); } Type = rawItem.ObjectType; YearPublished = rawItem.YearPublished; StatusLastModified = rawItem.Status.LastModified; AvailableForTrade = rawItem.Status.ForTrade != 0; OnWishlist = rawItem.Status.Wishlist != 0; Owned = rawItem.Status.Own != 0; Preordered = rawItem.Status.Preordered != 0; PreviouslyOwned = rawItem.Status.PrevOwned != 0; WantInTrade = rawItem.Status.Want != 0; WantToBuy = rawItem.Status.WantToBuy != 0; WantToPlay = rawItem.Status.WantToPlay != 0; if (rawItem.Stats != null) { MinimumPlayers = rawItem.Stats.MinPlayers; MaximumPlayers = rawItem.Stats.MaxPlayers; NumberOfOwners = rawItem.Stats.NumOwned; PlayingTime = TimeSpan.FromMinutes(rawItem.Stats.PlayingTime); if (rawItem.Stats.Rating != null) { AverageRating = rawItem.Stats.Rating.Average.value; BayesianAverageRating = rawItem.Stats.Rating.BayesAverage.value; Median = rawItem.Stats.Rating.Median.value; RatingStandardDeviation = rawItem.Stats.Rating.StdDev.value; UsersRatingThisItem = rawItem.Stats.Rating.UsersRated.value; Rankings = rawItem.Stats.Rating.Ranks.Select(r => new Ranking(r)).ToList(); float ratingFromThisUser; if (float.TryParse(rawItem.Stats.Rating.value, out ratingFromThisUser)) { RatingFromThisUser = ratingFromThisUser; } } } }
protected void SetValue(string key, string value) { if (value == null || value.Length == 0) { Raw.Remove(key); } else { Raw[key] = value; } ToURLChanged(); }
/// <summary> /// Peeks a string of length "length" from the remaining string but doesn´t consume it. /// Returns false if length exceeds the remaining string, otherwise true /// </summary> /// <param name="length">The length of the string to be peeked</param> /// <param name="s">Contains the peeked string, or "" if length exceeds the remaining string</param> /// <returns>True, if it succeded, false if not</returns> public bool Read(int length, out string s) { if (Index + length > StopIndex) { s = ""; return(false); } s = Raw.Substring(Index, length); return(true); }
internal WordAnalyResult ParagraphAnaly() { if (ConfigBase.Default.IsTraceStack) { LogService.AnyLog("Stack", new StackTrace().GetFrame(0).GetMethod().ToString()); } WordAnalyResult result = new WordAnalyResult(); stops.Clear(); stops.Add(0);//开始值 //计算停止处 for (var fi = 0; fi < Raw.Length; fi++) { //段落符号停止 if (ParagraphStopChars.Contains(Raw[fi])) { stops.Add(fi); } } stops.Add(Raw.Length);//结束值 //截段 for (var fi = 1; fi < stops.Count; fi++) { var spi = stops[fi - 1]; if (spi > 0) { var splitword = Raw[spi]; //words.Add(splitword.ToString()); spi++; } var epi = stops[fi]; //if (epi >= Raw.Length && paragraphs.Count > 0) //{ // break;//退出 //} //else if(epi< Raw.Length) //{ // epi++; //} var slen = epi - spi; if (slen < 1) { break; } var span = Raw.Slice(spi, slen); paragraphs.Add(new Paragraph(new LinyeeNLSentenceAnalyzer(span, Enc, SentenceStopChars, WordStopChars).SentenceAnaly())); } // return(result.SetData(paragraphs).SetOk()); }
public void ReplaceAt(UInt16 tag, WireType wireType, Reader reader, bool shouldNotify) { reader = !reader.Eof() ? reader : new Reader(new byte[] {}); switch (tag) { case 0: this.NotifyAndUpdate(0, Raw.Deserialize(reader, this.Path.Nested(0)), shouldNotify); break; case 1: this.NotifyAndUpdate(1, Attack.Deserialize(reader, this.Path.Nested(1)), shouldNotify); break; default: reader.Exhaust(); break; } }
public Jwt(string raw) { Raw = raw ?? throw new ArgumentNullException(nameof(raw)); string[] sections = Raw.Split('.'); if (sections.Length != 3) { throw new InvalidOperationException(); } Payload = EncodingUtils.Base64UrlDecodeUnpadded(sections[1]); IsSigned = !string.IsNullOrEmpty(sections[2]); }
public DalRaw MapToDal(Raw entity) { return(new DalRaw { Id = entity.id, Certificate = entity.certificate, DeliveryDate = entity.deliveryDate, Documentation = entity.documentation, CertificateImage = entity.certificateImage, IsValid = entity.isValid, Name = entity.name }); }
/// <summary> /// Peeks a string of length "length" from the remaining string and consumes it. /// Returns null if length exceeds the remaining string /// </summary> /// <param name="length">The length of the string to be peeked</param> /// <returns>The peeked string or null if length exceeds the remaining string</returns> public string Consume(int length) { if (length <= 0 || Index + length > StopIndex) { return(null); } string s = Raw.Substring(Index, length); Index += length; return(s); }
protected override void ExtractContent() { base.ExtractContent(); var posBegin = Raw.IndexOf("<div id=\"img-content\" class=\"rich_media_area_primary\">"); var posEnd = Raw.IndexOf("<div class=\"rich_media_area_primary sougou\" id=\"sg_tj\" style=\"display:none\">"); var tmpStr = Raw.Substring(posBegin, posEnd - posBegin); tmpStr.Trim(new char[] { ' ' }); Content = tmpStr; }
public LittleRawMaterialBean CreateLittleRawMaterialBean(Raw bean) { this.RawId = bean.RawId; this.Name = bean.Name; this.ParentRawId = bean.ParentRawId; this.CreateDatetime = bean.CreateDatetime; this.CreateBy = bean.CreateBy; this.Deleted = bean.Deleted; this.Status = bean.Status; this.UpdateDatetime = bean.UpdateDatetime; this.UpdateBy = bean.UpdateBy; return(this); }
public override int GetHashCode() { unchecked { var hashCode = Designation.GetHashCode(); hashCode = (hashCode * 397) ^ MeasurementMatchesRemaining; hashCode = (hashCode * 397) ^ PercentToNextTier.GetHashCode(); hashCode = (hashCode * 397) ^ Rank.GetHashCode(); hashCode = (hashCode * 397) ^ Raw.GetHashCode(); hashCode = (hashCode * 397) ^ Tier.GetHashCode(); return(hashCode); } }
/// <summary> /// </summary> /// <param name="raw"> </param> public ChatEntry(byte[] raw) { Bytes = raw; Raw = Encoding.UTF8.GetString(raw.ToArray()); var cut = (Raw.Substring(13, 1) == ":") ? 14 : 13; var cleaner = new ChatCleaner(raw, CultureInfo.CurrentUICulture, out JP); var cleaned = cleaner.Result; Line = XmlHelper.SanitizeXmlString(cleaned.Substring(cut)); Code = Raw.Substring(8, 4); Combined = String.Format("{0}:{1}", Code, Line); TimeStamp = UnixTimeStampToDateTime(Int32.Parse(Raw.Substring(0, 8), NumberStyles.HexNumber)); }
public Ranking(Raw.Rank rawRanking) { Type = rawRanking.Type; IdWithinType = rawRanking.Id; Name = rawRanking.Name; FriendlyName = rawRanking.FriendlyName; int position; if (int.TryParse(rawRanking.value, out position)) { Position = position; } float bayesianAverageRating; if (float.TryParse(rawRanking.BayesAverage, out bayesianAverageRating)) { BayesianAverageRating = bayesianAverageRating; } }
private static ItemBalancePartCollection GetItemBalancePartCollection( InfoDictionary<ItemTypeDefinition> itemTypes, Raw.ItemBalancePartCollection raw) { if (raw == null) { return null; } ItemTypeDefinition type = null; if (string.IsNullOrEmpty(raw.Type) == false) { if (itemTypes.ContainsKey(raw.Type) == false) { throw new KeyNotFoundException("could not find item type " + raw.Type); } type = itemTypes[raw.Type]; } return new ItemBalancePartCollection() { Type = type, Mode = raw.Mode, AlphaParts = raw.AlphaParts, BetaParts = raw.BetaParts, GammaParts = raw.GammaParts, DeltaParts = raw.DeltaParts, EpsilonParts = raw.EpsilonParts, ZetaParts = raw.ZetaParts, EtaParts = raw.EtaParts, ThetaParts = raw.ThetaParts, MaterialParts = raw.MaterialParts, }; }
public Video(Raw.Things.Video rawVideo) { Id = rawVideo.Id; Title = rawVideo.Title; Category = rawVideo.Category; Language = rawVideo.Language; Link = new Uri(rawVideo.Link); Username = rawVideo.Username; UserId = rawVideo.UserId; PostDate = rawVideo.PostDate; }
public Raw CreateRaw(BaseMaterialBean bean) { Raw beanBack= new Raw(); beanBack.RawId = bean.Id; beanBack.Name=bean.Name; beanBack.ParentRawId=bean.ParentRawId; beanBack.CreateDatetime=bean.CreateDatetime; beanBack.CreateBy=bean.CreateBy; beanBack.Deleted=bean.Deleted; beanBack.Status=bean.Status; beanBack.UpdateDatetime=bean.UpdateDatetime; beanBack.UpdateBy=bean.UpdateBy; return beanBack; }
private static WeaponBalancePartCollection GetWeaponBalancePartCollection( InfoDictionary<WeaponTypeDefinition> weaponTypes, Raw.WeaponBalancePartCollection raw) { if (raw == null) { return null; } WeaponTypeDefinition type = null; if (string.IsNullOrEmpty(raw.Type) == false) { if (weaponTypes.ContainsKey(raw.Type) == false) { throw new KeyNotFoundException("could not find weapon type '" + raw.Type + "'"); } type = weaponTypes[raw.Type]; } return new WeaponBalancePartCollection() { Type = type, Mode = raw.Mode, BodyParts = raw.BodyParts, GripParts = raw.GripParts, BarrelParts = raw.BarrelParts, SightParts = raw.SightParts, StockParts = raw.StockParts, ElementalParts = raw.ElementalParts, Accessory1Parts = raw.Accessory1Parts, Accessory2Parts = raw.Accessory2Parts, MaterialParts = raw.MaterialParts, }; }
public Poll(Raw.Things.Poll rawPoll) { Name = rawPoll.Name; Title = rawPoll.Title; Votes = rawPoll.TotalVotes; }
public bool AddRaw(Raw rw) { if (rw == null) { return false; } //添加 using (ChooseDishesEntities entities = new ChooseDishesEntities()) { try { entities.Raw.Add(rw); entities.SaveChanges(); return true; } catch (Exception e) { e.ToString(); return false; } } }
public unsafe FrameEdit(Bitmap bit, Rectangle rect, ushort[] palette, int centerx, int centery) { Center = new Point(centerx - rect.Left/**/, centery + bit.Height-rect.Bottom/**/); width = rect.Width/*bit.Width*/; height = rect.Height/*bit.Height*/; BitmapData bd = bit.LockBits(new Rectangle(0, 0, bit.Width/*width*/, bit.Height/*height*/), ImageLockMode.ReadOnly, PixelFormat.Format16bppArgb1555); int delta = bd.Stride >> 1; ushort* line = (ushort*)bd.Scan0 + rect.Top*delta; List<Raw> tmp = new List<Raw>(); int X = rect.Left/*0*/; for (int Y = rect.Top/*0*/; Y < rect.Bottom/*bit.Height*/; ++Y, line += delta) { ushort* cur = line; int i = 0; int j = 0; X = rect.Left/*0*/; while (i < rect.Right/*bit.Width*/) { i = X; for (i = X; i <= rect.Right/*bit.Width*/; ++i) { //first pixel set if (i < rect.Right/*bit.Width*/) { if (cur[i] != 0) break; } } if (i < rect.Right/*bit.Width*/) { for (j = (i + 1); j < rect.Right/*bit.Width*/; ++j) { //next non set pixel if (cur[j] == 0) break; } Raw raw = new Raw(); raw.run = j - i; raw.offx = j - raw.run - centerx; raw.offx += 512; raw.offy = Y - rect.Top/**/ - Center.Y/*centery*/ - rect.Height/*bit.Height*/; //raw.offy = Y - centery - bit.Height; raw.offy += 512; int r = 0; raw.data = new byte[raw.run]; while (r < raw.run) { ushort col = (ushort)(cur[r + i]); raw.data[r++] = GetPaletteIndex(palette, col); } tmp.Add(raw); X = j + 1; i = X; } } } RawData = tmp.ToArray(); bit.UnlockBits(bd); }
public FrameEdit(BinaryReader bin) { int xCenter = bin.ReadInt16(); int yCenter = bin.ReadInt16(); width = bin.ReadUInt16(); height = bin.ReadUInt16(); if (height == 0 || width == 0) return; int header; List<Raw> tmp = new List<Raw>(); while ((header = bin.ReadInt32()) != 0x7FFF7FFF) { Raw raw = new Raw(); header ^= DoubleXor; raw.run = (header & 0xFFF); raw.offy = ((header >> 12) & 0x3FF); raw.offx = ((header >> 22) & 0x3FF); int i = 0; raw.data = new byte[raw.run]; while (i < raw.run) { raw.data[i++] = bin.ReadByte(); } tmp.Add(raw); } RawData = tmp.ToArray(); Center = new Point(xCenter, yCenter); }
public VkExtensionProperties(Raw* raw) { ExtensionName = VkHelpers.ToString(raw->extensionName); SpecVersion = raw->specVersion; }
public VkDisplayModePropertiesKHR(Raw* raw, IVkInstance instance) { DisplayMode = new VkDisplayModeKHR(instance, raw->displayMode); Parameters = raw->parameters; }
public BGGCollection(Raw.Collection.Collection rawCollection) { TermsOfUse = rawCollection.TermsOfUse; Items = rawCollection.Items.Select(i => new Item(i)).ToList(); }
public bool DeleteRaw(int id) { if (id < 0) { return false; } using (ChooseDishesEntities entities = new ChooseDishesEntities()) { try { Raw booktype = new Raw() { RawId = id, }; DbEntityEntry<Raw> entry = entities.Entry<Raw>(booktype); entry.State = EntityState.Deleted; entities.SaveChanges(); return true; } catch (Exception e) { e.ToString(); return false; } } }
public bool UpdateRaw(Raw rw) { if (rw == null) { return false; } //修改 直接修改 using (ChooseDishesEntities entities = new ChooseDishesEntities()) { try { var type = entities.Raw.SingleOrDefault(bt => bt.RawId == rw.RawId); if (type != null) { type.ParentRawId = rw.ParentRawId; type.Deleted = rw.Deleted; type.Name = rw.Name; type.Status = rw.Status; type.UpdateBy = rw.UpdateBy; type.UpdateDatetime = rw.UpdateDatetime; entities.SaveChanges(); return true; } } catch (Exception e) { e.ToString(); return false; } return false; } }
public Link(Raw.Things.Link rawLink) { Type = rawLink.Type; Id = rawLink.Id; Name = rawLink.value; }
public Item(Raw.Things.Item rawItem) { Categories = rawItem.Links.Where(l => l.Type == "boardgamecategory").Select(l => new Link(l)).ToList(); Description = rawItem.Description; Id = rawItem.Id; if (rawItem.Image != null) { Image = new Uri("http:" + rawItem.Image); } Links = rawItem.Links.Select(l => new Link(l)).ToList(); MaximumPlayers = rawItem.MaxPlayers.value; MinimumAge = rawItem.MinAge.value; MinimumPlayers = rawItem.MinPlayers.value; if (rawItem.Thumbnail != null) { Thumbnail = new Uri("http:" + rawItem.Thumbnail); } Type = rawItem.Type; YearPublished = rawItem.YearPublished.value; if (rawItem.Names != null) { Names = rawItem.Names.Select(n => new Name(n)).ToList(); } if (rawItem.Polls != null) { Polls = rawItem.Polls.Select(p => new Poll(p)).ToList(); } if (rawItem.PlayingTime != null) { PlayingTime = TimeSpan.FromMinutes(rawItem.PlayingTime.value); } if (rawItem.Statistics != null) { AverageRating = rawItem.Statistics.Ratings.Average.value; AverageWeight = rawItem.Statistics.Ratings.AverageWeight.value; BayesAverageRating = rawItem.Statistics.Ratings.BayesAverage.value; Median = rawItem.Statistics.Ratings.Median.value; NumberOfComments = rawItem.Statistics.Ratings.NumComments.value; NumberOfWeights = rawItem.Statistics.Ratings.NumWeights.value; Rankings = rawItem.Statistics.Ratings.Ranks.Select(r => new Ranking(r)).ToList(); RatingStandardDeviation = rawItem.Statistics.Ratings.StdDev.value; UserWhoAreOfferingThisForTrade = rawItem.Statistics.Ratings.Trading.value; UsersWhoHaveRatedThis = rawItem.Statistics.Ratings.UsersRated.value; UsersWhoHaveThisOnTheirWishlist = rawItem.Statistics.Ratings.Wishing.value; UsersWhoOwnThis = rawItem.Statistics.Ratings.Owned.value; UserWhoWantThisInTrade = rawItem.Statistics.Ratings.Wanting.value; } if (rawItem.MarketplaceListings != null) { MarketplaceListings = rawItem.MarketplaceListings.Listings.Select(l => new MarketplaceListing(l)).ToList(); } if (rawItem.Videos != null) { Videos = rawItem.Videos.Videos.Select(v => new Video(v)).ToList(); } }
public Name(Raw.Things.Name rawName) { Type = rawName.Type; SortIndex = rawName.SortIndex; Value = rawName.value; }
public MarketplaceListing(Raw.Things.Listing rawListing) { if (rawListing.ListDate != null) { ListingDate = rawListing.ListDate.value; } if (rawListing.Price != null) { Currency = rawListing.Price.Currency; CurrencyValue = rawListing.Price.value; } if (rawListing.Condition != null) { Condition = rawListing.Condition.value; } if (rawListing.Notes != null) { Notes = rawListing.Notes.value; } if (rawListing.Link != null) { Link = new Uri(rawListing.Link.HRef); LinkTitle = rawListing.Link.Title; } }
public unsafe FrameEdit(Bitmap bit, ushort[] palette, int centerx, int centery) { Center = new Point(centerx, centery); width = bit.Width; height = bit.Height; BitmapData bd = bit.LockBits(new Rectangle(0, 0, width, height), ImageLockMode.ReadOnly, PixelFormat.Format16bppArgb1555); ushort* line = (ushort*)bd.Scan0; int delta = bd.Stride >> 1; List<Raw> tmp = new List<Raw>(); int X = 0; for (int Y = 0; Y < bit.Height; ++Y, line += delta) { ushort* cur = line; int i = 0; int j = 0; X = 0; while (i < bit.Width) { i = X; for (i = X; i <= bit.Width; ++i) { //first pixel set if (i < bit.Width) { if (cur[i] != 0) break; } } if (i < bit.Width) { for (j = (i + 1); j < bit.Width; ++j) { //next non set pixel if (cur[j] == 0) break; } Raw raw = new Raw(); raw.run = j - i; raw.offx = j - raw.run - centerx; raw.offx += 512; raw.offy = Y - centery - bit.Height; raw.offy += 512; int r = 0; raw.data = new byte[raw.run]; while (r < raw.run) { ushort col = (ushort)(cur[r + i]); raw.data[r++] = GetPaletteIndex(palette, col); } tmp.Add(raw); X = j + 1; i = X; } } } RawData = tmp.ToArray(); bit.UnlockBits(bd); }
public BaseMaterialBean CreateBaseMaterialBean(Raw bean) { this.Id = bean.RawId; this.Name = bean.Name; this.ParentRawId = bean.ParentRawId; this.CreateDatetime = bean.CreateDatetime; this.CreateBy = bean.CreateBy; this.Deleted = bean.Deleted; this.Status = bean.Status; this.UpdateDatetime = bean.UpdateDatetime; this.UpdateBy = bean.UpdateBy; return this; }
public BGGThings(Raw.Things.Things rawThings) { TermsOfUse = rawThings.TermsOfUse; Items = rawThings.Items.Select(i => new Item(i)).ToList(); }
public VkPhysicalDeviceLimits(Raw* raw) { MaxImageDimension1D = raw->maxImageDimension1D; MaxImageDimension2D = raw->maxImageDimension2D; MaxImageDimension3D = raw->maxImageDimension3D; MaxImageDimensionCube = raw->maxImageDimensionCube; MaxImageArrayLayers = raw->maxImageArrayLayers; MaxTexelBufferElements = raw->maxTexelBufferElements; MaxUniformBufferRange = raw->maxUniformBufferRange; MaxStorageBufferRange = raw->maxStorageBufferRange; MaxPushConstantsSize = raw->maxPushConstantsSize; MaxMemoryAllocationCount = raw->maxMemoryAllocationCount; MaxSamplerAllocationCount = raw->maxSamplerAllocationCount; BufferImageGranularity = raw->bufferImageGranularity; SparseAddressSpaceSize = raw->sparseAddressSpaceSize; MaxBoundDescriptorSets = raw->maxBoundDescriptorSets; MaxPerStageDescriptorSamplers = raw->maxPerStageDescriptorSamplers; MaxPerStageDescriptorUniformBuffers = raw->maxPerStageDescriptorUniformBuffers; MaxPerStageDescriptorStorageBuffers = raw->maxPerStageDescriptorStorageBuffers; MaxPerStageDescriptorSampledImages = raw->maxPerStageDescriptorSampledImages; MaxPerStageDescriptorStorageImages = raw->maxPerStageDescriptorStorageImages; MaxPerStageDescriptorInputAttachments = raw->maxPerStageDescriptorInputAttachments; MaxPerStageResources = raw->maxPerStageResources; MaxDescriptorSetSamplers = raw->maxDescriptorSetSamplers; MaxDescriptorSetUniformBuffers = raw->maxDescriptorSetUniformBuffers; MaxDescriptorSetUniformBuffersDynamic = raw->maxDescriptorSetUniformBuffersDynamic; MaxDescriptorSetStorageBuffers = raw->maxDescriptorSetStorageBuffers; MaxDescriptorSetStorageBuffersDynamic = raw->maxDescriptorSetStorageBuffersDynamic; MaxDescriptorSetSampledImages = raw->maxDescriptorSetSampledImages; MaxDescriptorSetStorageImages = raw->maxDescriptorSetStorageImages; MaxDescriptorSetInputAttachments = raw->maxDescriptorSetInputAttachments; MaxVertexInputAttributes = raw->maxVertexInputAttributes; MaxVertexInputBindings = raw->maxVertexInputBindings; MaxVertexInputAttributeOffset = raw->maxVertexInputAttributeOffset; MaxVertexInputBindingStride = raw->maxVertexInputBindingStride; MaxVertexOutputComponents = raw->maxVertexOutputComponents; MaxTessellationGenerationLevel = raw->maxTessellationGenerationLevel; MaxTessellationPatchSize = raw->maxTessellationPatchSize; MaxTessellationControlPerVertexInputComponents = raw->maxTessellationControlPerVertexInputComponents; MaxTessellationControlPerVertexOutputComponents = raw->maxTessellationControlPerVertexOutputComponents; MaxTessellationControlPerPatchOutputComponents = raw->maxTessellationControlPerPatchOutputComponents; MaxTessellationControlTotalOutputComponents = raw->maxTessellationControlTotalOutputComponents; MaxTessellationEvaluationInputComponents = raw->maxTessellationEvaluationInputComponents; MaxTessellationEvaluationOutputComponents = raw->maxTessellationEvaluationOutputComponents; MaxGeometryShaderInvocations = raw->maxGeometryShaderInvocations; MaxGeometryInputComponents = raw->maxGeometryInputComponents; MaxGeometryOutputComponents = raw->maxGeometryOutputComponents; MaxGeometryOutputVertices = raw->maxGeometryOutputVertices; MaxGeometryTotalOutputComponents = raw->maxGeometryTotalOutputComponents; MaxFragmentInputComponents = raw->maxFragmentInputComponents; MaxFragmentOutputAttachments = raw->maxFragmentOutputAttachments; MaxFragmentDualSrcAttachments = raw->maxFragmentDualSrcAttachments; MaxFragmentCombinedOutputResources = raw->maxFragmentCombinedOutputResources; MaxComputeSharedMemorySize = raw->maxComputeSharedMemorySize; MaxComputeWorkGroupCount = new VkUintVector3(raw->maxComputeWorkGroupCount); MaxComputeWorkGroupInvocations = raw->maxComputeWorkGroupInvocations; MaxComputeWorkGroupSize = new VkUintVector3(raw->maxComputeWorkGroupSize); SubPixelPrecisionBits = raw->subPixelPrecisionBits; SubTexelPrecisionBits = raw->subTexelPrecisionBits; MipmapPrecisionBits = raw->mipmapPrecisionBits; MaxDrawIndexedIndexValue = raw->maxDrawIndexedIndexValue; MaxDrawIndirectCount = raw->maxDrawIndirectCount; MaxSamplerLodBias = raw->maxSamplerLodBias; MaxSamplerAnisotropy = raw->maxSamplerAnisotropy; MaxViewports = raw->maxViewports; MaxViewportDimensions = new VkUintVector2(raw->maxViewportDimensions); ViewportBoundsRange = new VkVector2(raw->viewportBoundsRange); ViewportSubPixelBits = raw->viewportSubPixelBits; MinMemoryMapAlignment = raw->minMemoryMapAlignment; MinTexelBufferOffsetAlignment = raw->minTexelBufferOffsetAlignment; MinUniformBufferOffsetAlignment = raw->minUniformBufferOffsetAlignment; MinStorageBufferOffsetAlignment = raw->minStorageBufferOffsetAlignment; MinTexelOffset = raw->minTexelOffset; MaxTexelOffset = raw->maxTexelOffset; MinTexelGatherOffset = raw->minTexelGatherOffset; MaxTexelGatherOffset = raw->maxTexelGatherOffset; MinInterpolationOffset = raw->minInterpolationOffset; MaxInterpolationOffset = raw->maxInterpolationOffset; SubPixelInterpolationOffsetBits = raw->subPixelInterpolationOffsetBits; MaxFramebufferWidth = raw->maxFramebufferWidth; MaxFramebufferHeight = raw->maxFramebufferHeight; MaxFramebufferLayers = raw->maxFramebufferLayers; FramebufferColorSampleCounts = raw->framebufferColorSampleCounts; FramebufferDepthSampleCounts = raw->framebufferDepthSampleCounts; FramebufferStencilSampleCounts = raw->framebufferStencilSampleCounts; FramebufferNoAttachmentsSampleCounts = raw->framebufferNoAttachmentsSampleCounts; MaxColorAttachments = raw->maxColorAttachments; SampledImageColorSampleCounts = raw->sampledImageColorSampleCounts; SampledImageIntegerSampleCounts = raw->sampledImageIntegerSampleCounts; SampledImageDepthSampleCounts = raw->sampledImageDepthSampleCounts; SampledImageStencilSampleCounts = raw->sampledImageStencilSampleCounts; StorageImageSampleCounts = raw->storageImageSampleCounts; MaxSampleMaskWords = raw->maxSampleMaskWords; TimestampComputeAndGraphics = (bool)raw->timestampComputeAndGraphics; TimestampPeriod = raw->timestampPeriod; MaxClipDistances = raw->maxClipDistances; MaxCullDistances = raw->maxCullDistances; MaxCombinedClipAndCullDistances = raw->maxCombinedClipAndCullDistances; DiscreteQueuePriorities = raw->discreteQueuePriorities; PointSizeRange = new VkVector2(raw->pointSizeRange); LineWidthRange = new VkVector2(raw->lineWidthRange); PointSizeGranularity = raw->pointSizeGranularity; LineWidthGranularity = raw->lineWidthGranularity; StrictLines = (bool)raw->strictLines; StandardSampleLocations = (bool)raw->standardSampleLocations; OptimalBufferCopyOffsetAlignment = raw->optimalBufferCopyOffsetAlignment; OptimalBufferCopyRowPitchAlignment = raw->optimalBufferCopyRowPitchAlignment; NonCoherentAtomSize = raw->nonCoherentAtomSize; }