/// <summary> /// Produces a code minifiction of JS assets by using Dean Edwards' Packer /// </summary> /// <param name="assets">Set of JS assets</param> /// <returns>Set of JS assets with minified text content</returns> public IList <IAsset> Minify(IList <IAsset> assets) { if (assets == null) { throw new ArgumentNullException( nameof(assets), string.Format(CoreStrings.Common_ArgumentIsNull, nameof(assets)) ); } if (assets.Count == 0) { return(assets); } var assetsToProcessing = assets.Where(a => a.IsScript && !a.Minified).ToList(); if (assetsToProcessing.Count == 0) { return(assets); } PackingOptions options = CreatePackingOptions(); using (var jsPacker = new JsPacker(_createJsEngineInstance, options)) { foreach (var asset in assetsToProcessing) { InnerMinify(asset, jsPacker); } } return(assets); }
public void PackToMessage(Packer packer, PackingOptions options) { packer.PackArrayHeader(3); packer.PackString(Code); packer.Pack(FieldNo); packer.Pack(Arg); }
/// <summary> /// The pack to message. /// </summary> /// <param name="packer"> /// The packer. /// </param> /// <param name="options"> /// The options. /// </param> /// <exception cref="NotImplementedException"> /// </exception> public void PackToMessage(Packer packer, PackingOptions options) { // Serialize type name of the data object packer.Pack(this.TypeName); // Serialize the data object itself as a byte array packer.Pack(this.dataObject.GetData()); }
public new void PackToMessage(Packer packer, PackingOptions options) { packer.PackArrayHeader(5); packer.PackString(Code); packer.Pack(FieldNo); packer.Pack(Position); packer.Pack(Offset); packer.PackString(Arg); }
public void PackToMessage(Packer packer, PackingOptions options) { packer.PackMapHeader(_bodyParts.Count); foreach (var part in _bodyParts) { packer.Pack(part.Key); packer.Pack(part.Value); } }
public void PackToMessage(Packer packer, PackingOptions options) { packer.PackMapHeader(2); packer.Pack("__type"); packer.Pack("MetaField"); packer.Pack("fieldId"); packer.Pack(FieldId); }
/// <summary> /// Creates a packing options /// </summary> /// <returns>Packing options</returns> private PackingOptions CreatePackingOptions() { var options = new PackingOptions { ShrinkVariables = ShrinkVariables, Base62Encode = Base62Encode }; return(options); }
public void PackToMessage(Packer packer, PackingOptions options) { packer.PackMapHeader(2); packer.PackString("Action"); packer.PackString("SayHello"); packer.PackString("Name"); packer.PackString(Name); }
public void PackToMessage(Packer packer, PackingOptions options) { packer.PackMapHeader(2); packer.PackString("Action"); packer.PackString("SendMessage"); packer.PackString("Message"); packer.PackString(Message); }
public void PackToMessage(Packer packer, PackingOptions options) { packer.PackMapHeader(3); packer.PackString("graphName"); packer.Pack(this.graphName); packer.PackString("graphObjName"); packer.Pack(this.graphObjName); packer.PackString("killSession"); packer.Pack(this.killSession); }
public override void PackToMessage(Packer packer, PackingOptions options) { PackHeader(packer); packer.PackMapHeader(2); packer.Pack((byte)TarantoolKey.Space); packer.Pack(SpaceId); packer.Pack((byte)TarantoolKey.Tuple); packer.Pack(Tuple); }
public override void PackToMessage(Packer packer, PackingOptions options) { PackHeader(packer); packer.PackMapHeader(2); packer.Pack((byte)TarantoolKey.Expression); packer.Pack(Expression); packer.Pack((byte)TarantoolKey.Tuple); // ReSharper disable once ExceptionNotDocumented packer.PackArray(Args); }
public override void PackToMessage(Packer packer, PackingOptions options) { PackHeader(packer); packer.PackMapHeader(2); packer.Pack((byte)TarantoolKey.UserName); packer.Pack(Username); packer.Pack((byte)TarantoolKey.Tuple); packer.PackArrayHeader(2); packer.Pack("chap-sha1"); packer.Pack(Scramble); }
public void PackToMessage(Packer packer, PackingOptions options) { // Pack fields are here: // First, record total fields size. packer.PackArrayHeader(2); packer.Pack(this.Id); packer.PackString(this.Name); // ...Instead, you can pack as map as follows: // packer.PackMapHeader( 2 ); // packer.Pack( "Id" ); // packer.Pack( this.Id ); // packer.Pack( "Name" ); // packer.Pack( this.Name ); }
public override void PackToMessage(Packer packer, PackingOptions options) { PackHeader(packer); packer.PackMapHeader(3); packer.Pack((byte)TarantoolKey.Space); packer.Pack(SpaceId); packer.Pack((byte)TarantoolKey.Index); packer.Pack(IndexId); packer.Pack((byte)TarantoolKey.Key); packer.PackArray(Key); }
public void PackToMessage(Packer packer, PackingOptions options) { packer.PackArrayHeader(_fields.Count); foreach (var field in _fields) { if (field is string) { packer.PackString(field.ToString()); } else { packer.Pack(field); } } }
public override void PackToMessage(Packer packer, PackingOptions options) { PackHeader(packer); packer.PackMapHeader(3); packer.Pack((byte)TarantoolKey.Space); packer.Pack(SpaceId); packer.Pack((byte)TarantoolKey.Tuple); packer.Pack(Tuple); packer.Pack((byte)TarantoolKey.UpsertOps); packer.PackArrayHeader(UpdateOperations.Count()); foreach (var operation in UpdateOperations) { operation.PackToMessage(packer, options); } }
public void PackToMessage(Packer packer, PackingOptions options) { packer.PackMapHeader(this.inSession ? 4 : 6) .PackString("channel") .Pack(Channel.MsgPack) .PackString("inSession") .Pack(this.inSession) .PackString("isolate") .Pack(this.isolate) .PackString("transaction") .Pack(this.transaction); if (!this.inSession) { packer.PackString("graphName") .PackString(this.graphName) .PackString("graphObjName") .PackString(this.graphObjName); } }
/// <summary> /// Produces a code minifiction of JS asset by using Dean Edwards' Packer /// </summary> /// <param name="asset">JS asset</param> /// <returns>JS asset with minified text content</returns> public IAsset Minify(IAsset asset) { if (asset == null) { throw new ArgumentException(CoreStrings.Common_ValueIsEmpty, "asset"); } if (asset.Minified) { return(asset); } PackingOptions options = CreatePackingOptions(); using (var jsPacker = new JsPacker(_createJsEngineInstance, options)) { InnerMinify(asset, jsPacker); } return(asset); }
/// <summary> /// Use msgpack to compress the data /// </summary> /// <param name="packer"> /// The msgpack packer /// </param> /// <param name="options"> /// msgpack packing options /// </param> public void PackToMessage(Packer packer, PackingOptions options) { packer.PackArrayHeader(this.Values.Count); foreach (object obj in this.Values) { if (obj.GetType() == typeof(string)) { string temp = (string)obj; packer.PackString(temp, Encoding.GetEncoding("UTF-8")); } else if (obj.GetType() == typeof(Single)) { float temp = (Single)obj; packer.Pack <float>(temp); } else if (obj.GetType() == typeof(int)) { int temp = (Int32)obj; packer.Pack(temp); } } }
/// <summary> /// Use msgpack to compress the data /// </summary> /// <param name="packer"> /// The msgpack packer /// </param> /// <param name="options"> /// msgpack packing options /// </param> public void PackToMessage(Packer packer, PackingOptions options) { packer.PackArrayHeader(this.Values.Count); foreach (MessagePackObject obj in this.Values) { if (obj.IsTypeOf(typeof(string)) == true) { string temp = obj.AsStringUtf8(); packer.PackString(temp); } else if (obj.IsTypeOf(typeof(Single)) == true) { float temp = obj.AsSingle(); packer.Pack <float>(temp); } else if (obj.IsTypeOf(typeof(int)) == true) { int temp = obj.AsInt32(); packer.Pack(temp); } } }
public TexturePacker(TR2Level level, ITextureClassifier classifier = null) { TileWidth = 256; TileHeight = 256; MaximumTiles = 16; Options = new PackingOptions { FillMode = PackingFillMode.Vertical, OrderMode = PackingOrderMode.Height, Order = PackingOrder.Descending, GroupMode = PackingGroupMode.None, StartMethod = PackingStartMethod.EndTile }; Level = level; _levelClassifier = classifier == null ? string.Empty : classifier.GetClassification(); _allTextures = new List <AbstractIndexedTRTexture>(); if (Level != null) { _allTextures.AddRange(LoadObjectTextures()); _allTextures.AddRange(LoadSpriteTextures()); _allTextures.Sort(new TRTextureReverseAreaComparer()); for (int i = 0; i < Level.NumImages; i++) { TexturedTile tile = AddTile(); tile.BitmapGraphics = GetTileBitmap(i); tile.AllowOverlapping = true; // Allow initially for the likes of Opera House - see tile 3 [128, 128] } foreach (AbstractIndexedTRTexture texture in _allTextures) { _tiles[texture.Atlas].AddTexture(texture); } } }
public override void PackToMessage(Packer packer, PackingOptions options) { PackHeader(packer); packer.PackMapHeader(6); packer.Pack((byte)TarantoolKey.Space); packer.Pack(SpaceId); packer.Pack((byte)TarantoolKey.Index); packer.Pack(IndexId); packer.Pack((byte)TarantoolKey.Limit); packer.Pack(Limit); packer.Pack((byte)TarantoolKey.Offset); packer.Pack(Offset); packer.Pack((byte)TarantoolKey.Iterator); packer.Pack((uint)Iterator); packer.Pack((byte)TarantoolKey.Key); packer.PackArray(Key); }
/// <summary> /// Produces a code minifiction of JS asset by using Dean Edwards' Packer /// </summary> /// <param name="asset">JS asset</param> /// <returns>JS asset with minified text content</returns> public IAsset Minify(IAsset asset) { if (asset == null) { throw new ArgumentNullException( nameof(asset), string.Format(CoreStrings.Common_ArgumentIsNull, nameof(asset)) ); } if (asset.Minified) { return(asset); } PackingOptions options = CreatePackingOptions(); using (var jsPacker = new JsPacker(_createJsEngineInstance, options)) { InnerMinify(asset, jsPacker); } return(asset); }
public void PackToMessage(Packer packer, PackingOptions options) { packer.Pack((byte)RequestType); PackToMessageCore(packer); }
public abstract void PackToMessage(Packer packer, PackingOptions options);
/// <summary> /// Packs the candidate to a MessagePack objects /// This method should not be called directly, use serialize instead. /// </summary> /// <param name="packer">The packer</param> /// <param name="options">The packer options</param> public void PackToMessage(Packer packer, PackingOptions options) { // pack the header for the amount of items in the map packer.PackMapHeader(MapCount); packer.Pack("DCS"); packer.Pack(Dcs); packer.Pack("DAC"); packer.Pack(Dac); packer.Pack("DAD"); packer.Pack(Dad); packer.Pack("DBD"); packer.Pack(Dbd.ToString(DateFormat, CultureInfo.InvariantCulture)); packer.Pack("DBB"); packer.Pack(Dbb.ToString(DateFormat, CultureInfo.InvariantCulture)); packer.Pack("DBC"); packer.Pack((int)Dbc); packer.Pack("DAY"); packer.Pack(Day.AnsiFormat()); packer.Pack("DAU"); packer.Pack(Dau.AnsiFormat); packer.Pack("DAG"); packer.Pack(Dag); packer.Pack("DAI"); packer.Pack(Dai); packer.Pack("DAJ"); packer.Pack(Daj); packer.Pack("DAK"); packer.Pack(Dak.AnsiFormat); packer.Pack("DCG"); packer.Pack(Dcg); // pack image packer.Pack("ZAA"); var imageConverter = new ImageConverter(); packer.Pack((byte[])imageConverter.ConvertTo(Image, typeof(byte[]))); // pack fingerprint packer.Pack("ZAB"); if (Fingerprint.Image != null) { var afis = new AfisEngine(); var p = new Person(Fingerprint); afis.Extract(p); } if (Fingerprint.AsIsoTemplate != null) { packer.Pack(Fingerprint.AsIsoTemplate); } }
public void PackToMessage(Packer packer, PackingOptions options) { packer.PackArrayHeader(1); packer.PackString(Dummy); }