public void Visit(BinaryType type)
 {
     Flatbuf.Binary.StartBinary(Builder);
     Result = FieldType.Build(
         Flatbuf.Type.Binary,
         Flatbuf.Binary.EndBinary(Builder));
 }
Exemplo n.º 2
0
        public AdditionalTypeInfo(DeserializeReader reader, BinaryType binaryType)
        {
            switch (binaryType)
            {
            case BinaryType.Primitive:
                Info = new AdditionalInfoPrimitiveType(reader);
                break;

            case BinaryType.SystemClass:
                Info = new AdditionalInfoSystemClass(reader);
                break;

            case BinaryType.Class:
                Info = new AdditionalInfoClassTypeInfo(reader);
                break;

            case BinaryType.PrimitiveArray:
                Info = new AdditionalInfoPrimitiveType(reader);
                break;

            case BinaryType.String:
            case BinaryType.Object:
            case BinaryType.ObjectArray:
            case BinaryType.StringArray:
                break;

            default:
                throw new InvalidStructureException("Unknown member type");
            }
        }
Exemplo n.º 3
0
        /// <summary>
        ///     The visit binary.
        /// </summary>
        /// <param name="b">
        ///     The b.
        /// </param>
        /// <returns>
        ///     The <see cref="Expression" />.
        /// </returns>
        protected override Expression VisitBinary(BinaryExpression expression)
        {
            BinaryType op;

            if (!BinaryType.TryParse(expression.NodeType.ToString(), out op))
            {
                if (expression.NodeType == ExpressionType.OrElse)
                {
                    op = BinaryType.Or;
                }
                else if (expression.NodeType == ExpressionType.AndAlso)
                {
                    op = BinaryType.And;
                }
                else
                {
                    throw new Exception(expression.NodeType.ToString());
                }
            }

            var node = new QNode()
            {
                Type = NodeType.Binary, Value = op
            };

            this.Visit(expression.Left);
            node.Left = this.Context.Pop();
            this.Visit(expression.Right);
            node.Right = this.Context.Pop();

            this.Context.Push(node);

            return(expression);
        }
Exemplo n.º 4
0
		// Copy constructor for debugger proxy
		private MessagePackString( MessagePackString other )
		{
			this._encoded = other._encoded;
			this._decoded = other._decoded;
			this._decodingError = other._decodingError;
			this._type = other._type;
		}
Exemplo n.º 5
0
        public static String BinaryTypeToString(this BinaryType binaryType)
        {
            switch (binaryType)
            {
            case BinaryType.SCS_32BIT_BINARY:
                return("32-bit Windows-based application");

            case BinaryType.SCS_64BIT_BINARY:
                return("64-bit Windows-based application");

            case BinaryType.SCS_DOS_BINARY:
                return("MS-DOS-based application");

            case BinaryType.SCS_OS216_BINARY:
                return("16-bit OS/2-based application");

            case BinaryType.SCS_POSIX_BINARY:
                return("POSIX-based application");

            case BinaryType.SCS_WOW_BINARY:
                return("16-bit Windows-based application");

            default:
                return("Unknown");
            }
        }
Exemplo n.º 6
0
 private StatementList GetBinaryTestStructure(BinaryType binaryType)
 {
     return(new StatementList()
     {
         Statements = new List <Statement>()
         {
             new SelectStatement()
             {
                 SelectElements = new List <Expressions.SelectExpression>()
                 {
                     new SelectScalarExpression()
                     {
                         Expression = new BinaryExpression()
                         {
                             Left = new ColumnReference()
                             {
                                 Identifiers = new List <string>()
                                 {
                                     "c1"
                                 }
                             },
                             Right = new StringLiteral()
                             {
                                 Value = "a"
                             },
                             Type = binaryType
                         }
                     }
                 }
             }
         }
     });
 }
Exemplo n.º 7
0
		public MessagePackString( string decoded )
		{
			Contract.Assert( decoded != null, "decoded != null" );

			this._decoded = decoded;
			this._type = BinaryType.String;
		}
Exemplo n.º 8
0
 // Copy constructor for debugger proxy
 private MessagePackString(MessagePackString other)
 {
     this._encoded       = other._encoded;
     this._decoded       = other._decoded;
     this._decodingError = other._decodingError;
     this._type          = other._type;
 }
Exemplo n.º 9
0
        /// <summary>
        /// Saves metadata for this session.
        /// </summary>
        /// <param name="typeId">Type ID.</param>
        /// <param name="typeName">Type name.</param>
        /// <param name="affKeyFieldName">Affinity key field name.</param>
        /// <param name="fields">Fields metadata.</param>
        internal void SaveMetadata(int typeId, string typeName, string affKeyFieldName, IDictionary <string, int> fields)
        {
            if (_metas == null)
            {
                BinaryType meta =
                    new BinaryType(typeId, typeName, fields, affKeyFieldName);

                _metas = new Dictionary <int, IBinaryType>(1);

                _metas[typeId] = meta;
            }
            else
            {
                IBinaryType meta;

                if (_metas.TryGetValue(typeId, out meta))
                {
                    IDictionary <string, int> existingFields = ((BinaryType)meta).FieldsMap();

                    foreach (KeyValuePair <string, int> field in fields)
                    {
                        if (!existingFields.ContainsKey(field.Key))
                        {
                            existingFields[field.Key] = field.Value;
                        }
                    }
                }
                else
                {
                    _metas[typeId] = new BinaryType(typeId, typeName, fields, affKeyFieldName);
                }
            }
        }
Exemplo n.º 10
0
        public MessagePackString(string decoded)
        {
            Contract.Assert(decoded != null, "decoded != null");

            this._decoded = decoded;
            this._type    = BinaryType.String;
        }
Exemplo n.º 11
0
 public BinaryExpression(SourceRange range, BinaryType type, Expression left, Expression right)
     : base(range)
 {
     Type  = type;
     Left  = left;
     Right = right;
 }
Exemplo n.º 12
0
        public static string ToStringRepresentation(this BinaryType binaryType)
        {
            switch (binaryType)
            {
            case BinaryType.Add:
                return("+");

            case BinaryType.Subtract:
                return("-");

            case BinaryType.Multiply:
                return("*");

            case BinaryType.ImpliedMultiply:
                return("*");

            case BinaryType.Divide:
                return("/");

            case BinaryType.Power:
                return("^");

            default:
                return("");
            }
        }
Exemplo n.º 13
0
        /// <summary>
        /// Updates or creates cached binary type holder.
        /// </summary>
        private void UpdateOrCreateBinaryTypeHolder(BinaryType meta)
        {
            BinaryTypeHolder holder;

            if (_metas.TryGetValue(meta.TypeId, out holder))
            {
                holder.Merge(meta);
                return;
            }

            lock (this)
            {
                if (_metas.TryGetValue(meta.TypeId, out holder))
                {
                    holder.Merge(meta);
                    return;
                }

                var metas0 = new Dictionary <int, BinaryTypeHolder>(_metas);

                holder = new BinaryTypeHolder(meta.TypeId, meta.TypeName, meta.AffinityKeyFieldName, meta.IsEnum, this);
                holder.Merge(meta);

                metas0[meta.TypeId] = holder;

                _metas = metas0;
            }
        }
            public void Visit(BinaryType type)
            {
                BinaryArray.Builder resultBuilder = new BinaryArray.Builder().Reserve(_baseDataTotalElementCount);

                for (int i = 0; i < _baseDataListCount; i++)
                {
                    List <int?>         dataList = _baseData[i];
                    BinaryArray.Builder builder  = new BinaryArray.Builder().Reserve(dataList.Count);

                    foreach (byte?value in dataList)
                    {
                        if (value.HasValue)
                        {
                            builder.Append(value.Value);
                            resultBuilder.Append(value.Value);
                        }
                        else
                        {
                            builder.AppendNull();
                            resultBuilder.AppendNull();
                        }
                    }
                    TestTargetArrayList.Add(builder.Build());
                }

                ExpectedArray = resultBuilder.Build();
            }
Exemplo n.º 15
0
        private void DecodeIfNeeded()
        {
            if (this._decoded != null)
            {
                return;
            }

            if (this._encoded == null)
            {
                return;
            }

            if (this._type != BinaryType.Unknwon)
            {
                return;
            }

            try
            {
                this._decoded = MessagePackConvert.DecodeStringStrict(this._encoded);
                this._type    = BinaryType.String;
            }
            catch (DecoderFallbackException ex)
            {
                this._decodingError = ex;
                this._type          = BinaryType.Blob;
            }
        }
Exemplo n.º 16
0
        /// <summary>
        /// Put binary types to Grid.
        /// </summary>
        /// <param name="types">Binary types.</param>
        internal void PutBinaryTypes(ICollection <BinaryType> types)
        {
            DoOutOp(OpMeta, stream =>
            {
                BinaryWriter metaWriter = _marsh.StartMarshal(stream);

                metaWriter.WriteInt(types.Count);

                foreach (var meta in types)
                {
                    BinaryType meta0 = meta;

                    metaWriter.WriteInt(meta0.TypeId);
                    metaWriter.WriteString(meta0.TypeName);
                    metaWriter.WriteString(meta0.AffinityKeyFieldName);

                    IDictionary <string, int> fields = meta0.GetFieldsMap();

                    metaWriter.WriteInt(fields.Count);

                    foreach (var field in fields)
                    {
                        metaWriter.WriteString(field.Key);
                        metaWriter.WriteInt(field.Value);
                    }

                    metaWriter.WriteBoolean(meta.IsEnum);
                }

                _marsh.FinishMarshal(metaWriter);
            });

            _marsh.OnBinaryTypesSent(types);
        }
Exemplo n.º 17
0
 public static object ReadType(this System.IO.BinaryReader reader, out BinaryType type)
 {
     type = (BinaryType)reader.ReadInt32();
     if (type == BinaryType.String)
     {
         return(reader.ReadString());
     }
     else if (type == BinaryType.Int)
     {
         return(reader.ReadInt32());
     }
     else if (type == BinaryType.Double)
     {
         return(reader.ReadDouble());
     }
     else if (type == BinaryType.Bool)
     {
         return(reader.ReadBoolean());
     }
     else if (type == BinaryType.Enum)
     {
         return(reader.ReadString());
     }
     return(null);
 }
Exemplo n.º 18
0
        public MessagePackString(string decoded)
        {
#if !UNITY
            Contract.Assert(decoded != null, "decoded != null");
#endif // !UNITY
            this._decoded = decoded;
            this._type    = BinaryType.String;
        }
Exemplo n.º 19
0
		public MessagePackString( string decoded )
		{
#if !UNITY_ANDROID && !UNITY_IPHONE
			Contract.Assert( decoded != null );
#endif // !UNITY_ANDROID && !UNITY_IPHONE
			this._decoded = decoded;
			this._type = BinaryType.String;
		}
Exemplo n.º 20
0
		public MessagePackString( string decoded )
		{
#if !UNITY
			Contract.Assert( decoded != null, "decoded != null" );
#endif // !UNITY
			this._decoded = decoded;
			this._type = BinaryType.String;
		}
Exemplo n.º 21
0
 public MessagePackString(byte[] encoded, bool isBinary)
 {
     this._encoded = encoded;
     this._type    = isBinary ? BinaryType.Blob : BinaryType.Unknwon;
     if (isBinary)
     {
         this._decodingError = IsBinary;
     }
 }
Exemplo n.º 22
0
 public static string ToBinary(this string text, BinaryType type, bool fullTranslate)
 {
     switch (type)
     {
         case BinaryType.ascii:
         default:
             return text.ToAscii(fullTranslate);
     }
 }
Exemplo n.º 23
0
		public MessagePackString( byte[] encoded, bool isBinary )
		{
			Contract.Assert( encoded != null, "encoded != null" );

			this._encoded = encoded;
			this._type = isBinary ? BinaryType.Blob : BinaryType.Unknwon;
			if ( isBinary )
			{
				this._decodingError = IsBinary;
			}
		}
Exemplo n.º 24
0
        public void Equals()
        {
            BinaryType type = (BinaryType)NHibernateUtil.Binary;

            byte[] expected      = Encoding.UTF8.GetBytes("ghij1`23%$");
            byte[] expectedClone = Encoding.UTF8.GetBytes("ghij1`23%$");

            Assert.IsTrue(type.IsEqual(expected, expected));
            Assert.IsTrue(type.IsEqual(expected, expectedClone));
            Assert.IsFalse(type.IsEqual(expected, GetByteArray(15)));
        }
Exemplo n.º 25
0
        public MessagePackString(byte[] encoded, bool isBinary)
        {
            Contract.Assert(encoded != null, "encoded != null");

            this._encoded = encoded;
            this._type    = isBinary ? BinaryType.Blob : BinaryType.Unknwon;
            if (isBinary)
            {
                this._decodingError = IsBinary;
            }
        }
Exemplo n.º 26
0
        public MessagePackString(byte[] encoded, bool isBinary)
        {
#if !UNITY
            Contract.Assert(encoded != null);
#endif // !UNITY
            this._encoded = encoded;
            this._type    = isBinary ? BinaryType.Blob : BinaryType.Unknwon;
            if (isBinary)
            {
                this._decodingError = IsBinary;
            }
        }
Exemplo n.º 27
0
		public MessagePackString( byte[] encoded, bool isBinary )
		{
#if !UNITY
			Contract.Assert( encoded != null );
#endif // !UNITY
			this._encoded = encoded;
			this._type = isBinary ? BinaryType.Blob : BinaryType.Unknwon;
			if ( isBinary )
			{
				this._decodingError = IsBinary;
			}
		}
Exemplo n.º 28
0
        public BinaryExpression(Expression left, Expression right, BinaryType type) : base(NodeType.Binary)
        {
            Left         = left;
            Right        = right;
            OperatorType = type;

            if (Left.ContainVariable || Right.ContainVariable)
            {
                ContainVariable = true;
            }

            Simplified = false;
        }
Exemplo n.º 29
0
        /// <summary>
        /// 判断EXE是否为64位程序
        /// </summary>
        /// <param name="exePath"></param>
        /// <returns></returns>
        public static bool IsExe64Bit(string exePath)
        {
            BinaryType exeType = BinaryType.SCS_32BIT_BINARY;

            if (GetBinaryType(exePath, out exeType))
            {
                if (exeType == BinaryType.SCS_64BIT_BINARY)
                {
                    return(true);
                }
            }

            return(false);
        }
Exemplo n.º 30
0
        public static PropertyValue ToPropertyUnion(this BinaryType binType, object value)
        {
            switch (binType)
            {
            case BinaryType.Bool:
                return(new PropertyValue((bool)value));

            case BinaryType.Double:
                return(new PropertyValue((double)value));

            case BinaryType.Int:
                return(new PropertyValue((int)value));

            default:
                return(new PropertyValue((string)value));
            }
        }
Exemplo n.º 31
0
        public static bool IsLeftAssociative(this BinaryType operatorType)
        {
            switch (operatorType)
            {
            case BinaryType.Add:
            case BinaryType.Subtract:
            case BinaryType.Multiply:
            case BinaryType.Divide:
            case BinaryType.ImpliedMultiply:
                return(true);

            case BinaryType.Power:
                return(false);

            default:
                return(true);
            }
        }
Exemplo n.º 32
0
        /// <summary>
        /// Callback invoked when metadata has been sent to the server and acknowledged by it.
        /// </summary>
        /// <param name="newMetas">Binary types.</param>
        public void OnBinaryTypesSent(IDictionary <int, IBinaryType> newMetas)
        {
            foreach (KeyValuePair <int, IBinaryType> metaEntry in newMetas)
            {
                BinaryType meta = (BinaryType)metaEntry.Value;

                IDictionary <int, Tuple <string, int> > mergeInfo =
                    new Dictionary <int, Tuple <string, int> >(meta.FieldsMap().Count);

                foreach (KeyValuePair <string, int> fieldMeta in meta.FieldsMap())
                {
                    int fieldId = BinaryUtils.FieldId(metaEntry.Key, fieldMeta.Key, null, null);

                    mergeInfo[fieldId] = new Tuple <string, int>(fieldMeta.Key, fieldMeta.Value);
                }

                _metas[metaEntry.Key].Merge(mergeInfo);
            }
        }
Exemplo n.º 33
0
        public static PropertyType BinaryTypeToPropertyType(BinaryType type)
        {
            switch (type)
            {
            case BinaryType.Int:
                return(PropertyType.Integer);

            case BinaryType.Double:
                return(PropertyType.Decimal);

            case BinaryType.Bool:
                return(PropertyType.Boolean);

            case BinaryType.Enum:
                return(PropertyType.Enum);

            default:
                return(PropertyType.String);
            }
        }
Exemplo n.º 34
0
        public static string LoadFile(string filePath)
        {
            string file = "";

            if (File.Exists(filePath))
            {
                using (BinaryReader reader = new BinaryReader(File.Open(filePath, FileMode.Open)))
                {
                    BinaryType type = (BinaryType)reader.ReadInt32();
                    if (type == BinaryType.String)
                    {
                        file = reader.ReadString();
                    }
                    else
                    {
                        file = "Error IncorrectFormat: File Formate";
                    }
                }
            }
            return(file);
        }
Exemplo n.º 35
0
        public static int GetPrecedence(this BinaryType operatorType)
        {
            switch (operatorType)
            {
            case BinaryType.Add:
            case BinaryType.Subtract:
                return(1);

            case BinaryType.Multiply:
            case BinaryType.Divide:
                return(2);

            case BinaryType.ImpliedMultiply:
                return(3);

            case BinaryType.Power:
                return(4);

            default:
                return(1);
            }
        }
Exemplo n.º 36
0
    // Adapted from http://stackoverflow.com/a/4696857/2055880
    public PEInfo(string path)
    {
        uint         size;
        LOADED_IMAGE image;

        if (MapAndLoad(path, null, out image, true, true) && image.MappedAddress != IntPtr.Zero)
        {
            var imports = (IMAGE_IMPORT_DESCRIPTOR *)ImageDirectoryEntryToData((void *)image.MappedAddress, false, 1, out size);

            if (imports != null)
            {
                while (imports->OriginalFirstThunk != 0)
                {
                    _modules.Add(Marshal.PtrToStringAnsi(ImageRvaToVa(image.FileHeader, image.MappedAddress, imports->Name, IntPtr.Zero)));

                    ++imports;
                }
            }

            _binaryType = ((IMAGE_NT_HEADERS *)image.FileHeader)->FileHeader.Machine;
        }
    }
Exemplo n.º 37
0
 // Called by Settings.SelectBinaries to get:
 // * The required and optional binaries for the current build target and logging state;
 //   these get enabled.
 // * All binaries; any that weren't enabled in the previous step get disabled.
 public virtual IEnumerable <string> GetBinaryAssetPaths(BuildTarget buildTarget, BinaryType binaryType)
 {
     return(GetBinaryPaths(buildTarget, binaryType, "Assets"));
 }
Exemplo n.º 38
0
 public static string ToBinary(this string text, BinaryType type)
 {
     return ToBinary(text, type, true);
 }
Exemplo n.º 39
0
 /// <summary>
 /// Creates a new BinaryRegister
 /// </summary>
 /// <param name="type">the type of the operator</param>
 /// <param name="left">the left register (must be less than 16)</param>
 /// <param name="right">the right register (must be less than 16)</param>
 public BinaryRegister(BinaryType type, byte left, byte right)
     : base(type, left, right)
 {
 }
Exemplo n.º 40
0
        /// <summary>
        /// Parses a binary instruction (register and constant)
        /// </summary>
        /// <param name="op">The BinaryType for this instruction</param>
        /// <param name="indirectRight">True if the right argument is indirect (surrounded by brakets)</param>
        private void ParseBinary(BinaryType op, bool indirectRight = false)
        {
            // Parse left side
            byte left;
            ParseSmallSymbol(SymbolType.Register, out left);
            tokenizer.ConsumeToken(AssemblyTokenType.Comma);

            // Parse right side
            byte right;
            SymbolType type;

            if (indirectRight)
            {
                // Force register / constant depending on whether there are brakets
                if (tokenizer.Current.Type == AssemblyTokenType.BraketOpen)
                {
                    // Register
                    tokenizer.ConsumeToken();
                    type = ParseSmallSymbol(SymbolType.Register, out right);
                    tokenizer.ConsumeToken(AssemblyTokenType.BraketClose);
                }
                else
                {
                    //Constant
                    type = ParseSmallSymbol(SymbolType.Constant, out right);
                }
            }
            else
            {
                // Allow any token type
                type = ParseSmallSymbol(SymbolType.Constant | SymbolType.Register, out right);
            }

            // Add final statement
            if (type == SymbolType.Constant)
                AddInstruction(new BinaryConstant(op, left, right));
            else
                AddInstruction(new BinaryRegister(op, left, right));
        }
Exemplo n.º 41
0
 public TuningAction()
 {
     WizType = TuneWizardType.None;
     WizName = string.Empty;
     WizIdOrFilename = string.Empty;
     WizBinType = BinaryType.None;
     WizWhitelist = new string [] {};
     WizBlacklist = new string[] { };
     WizCode = string.Empty;
     WizAuth = string.Empty;
 }
Exemplo n.º 42
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DBBinary"/> class.
 /// </summary>
 /// <param name="type">The type.</param>
 /// <param name="data">A buffer of byte data.</param>
 public DBBinary(BinaryType type, byte[] data)
 {
     Type = type;
     Buffer = data;
 }
Exemplo n.º 43
0
        /// <summary>
        /// Processes the Binary and Icon tables.
        /// </summary>
        /// <param name="writer">XmlWriter where the Intermediate should persist itself as XML.</param>
        /// <param name="binaryType">type of binary to process.</param>
        /// <param name="binaryName">Name of binary to process.</param>
        private void ProcessBinaryTable(XmlWriter writer, BinaryType binaryType, string binaryName)
        {
            if (!this.inputDatabase.TableExists(binaryType.ToString()))
            {
                return;
            }
            string query = String.Concat("SELECT * FROM `", binaryType.ToString(), "`");
            if (0 < binaryName.Length)
            {
                if (this.binariesProcessed.ContainsKey(binaryName))
                {
                    return;  // not an error because multiple controls can reference a binary/icon
                }
                query = String.Concat(query, " WHERE `Name`='", binaryName, "'");
            }

            using (View view = this.inputDatabase.OpenExecuteView(query))
            {
                if (this.exportBinaries)
                {
                    if ((BinaryType.Binary == binaryType && !this.binariesExported) ||
                        (BinaryType.Icon == binaryType && !this.iconsExported))
                    {
                        string binaryFileName = String.Concat(binaryType.ToString(), ".idt");
                        this.inputDatabase.Export(binaryType.ToString(), this.exportBasePath, binaryFileName);
                        File.Delete(Path.Combine(this.exportBasePath, binaryFileName));
                        if (BinaryType.Binary == binaryType)
                        {
                            this.binariesExported = true;
                        }
                        else if (BinaryType.Icon == binaryType)
                        {
                            this.iconsExported = true;
                        }
                    }
                }
                Record record;
                while (view.Fetch(out record))
                {
                    string name = record[(int)MsiInterop.Binary.Name];
                    if (this.binariesProcessed.ContainsKey(name))
                    {
                        continue;  // not an error because multiple controls can reference a property
                    }
                    else
                    {
                        this.binariesProcessed[name] = true;
                    }
                    string id = this.StripModuleId(name);
                    if (this.skipVSI && ("dirca_checkfx" == id.ToLower() || "vsdca_vsdlaunchconditions" == id.ToLower()))
                    {
                        this.core.OnMessage(WixWarnings.FilteringVSIStuff(null, WarningLevel.Major, "Binary", id.ToLower()));
                        continue;
                    }

                    if (null == writer)
                    {
                        writer = this.InitializeXmlTextWriter(Path.GetFullPath(Path.Combine(Path.Combine(this.outputFolder, "BaseLibrary"), String.Concat(binaryType.ToString(), ".wxs"))));
                        if (this.generateFragments)
                        {
                            // initalize the fragment
                            writer.WriteStartElement("Fragment");
                        }
                    }
                    writer.WriteStartElement(binaryType.ToString());
                    this.core.WriteAttributeString(writer, "Id", id);
                    this.core.WriteAttributeString(writer, "SourceFile", Path.Combine(binaryType.ToString(), String.Concat(id, ".ibd")));
                    writer.WriteEndElement();
                }

                if (this.generateFragments && null != writer)
                {
                    writer.WriteEndElement();
                }
            }
        }
Exemplo n.º 44
0
        /// <summary>
        /// Parses a binary or icon element.
        /// </summary>
        /// <param name="node">Element to parse.</param>
        /// <param name="binaryType">"Binary" or "Icon" table type enum.</param>
        /// <returns>Identifier for the new row.</returns>
        private string ParseBinaryOrIconElement(XmlNode node, BinaryType binaryType)
        {
            SourceLineNumberCollection sourceLineNumbers = this.core.GetSourceLineNumbers(node);
            string id = null;
            string sourceFile = null;

            foreach (XmlAttribute attrib in node.Attributes)
            {
                switch (attrib.LocalName)
                {
                    case "Id":
                        id = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
                        break;
                    case "SourceFile":
                    case "src":
                        if (null != sourceFile)
                        {
                            this.core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name, "SourceFile", "src"));
                        }
                        sourceFile = this.core.GetAttributeValue(sourceLineNumbers, attrib);
                        break;
                    default:
                        this.core.UnexpectedAttribute(sourceLineNumbers, attrib);
                        break;
                }
            }
            if (null == id)
            {
                this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name, "Id"));
                id = CompilerCore.IllegalIdentifier;
            }
            else if (CompilerCore.IllegalIdentifier != id) // only check legal values
            {
                if (55 < id.Length)
                {
                    this.core.OnMessage(WixErrors.BinaryOrIconIdentifierTooLong(sourceLineNumbers, node.Name, "Id", id));
                }
                else if (!this.compilingProduct && 18 < id.Length) // if we're not doing a product then we can't be sure that a binary identifier over 18 characters will fit
                {
                    this.core.OnMessage(WixWarnings.BinaryOrIconIdentifierCannotBeModularized(sourceLineNumbers, node.Name, "Id", id));
                }
            }

            if (null == sourceFile)
            {
                this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name, "SourceFile"));
            }

            // find unexpected child elements
            foreach (XmlNode child in node.ChildNodes)
            {
                if (XmlNodeType.Element == child.NodeType)
                {
                    this.core.UnexpectedElement(node, child);
                }
            }

            Debug.Assert("Binary" == binaryType.ToString() || "Icon" == binaryType.ToString());
            Row row = this.core.CreateRow(sourceLineNumbers, binaryType.ToString());
            row[0] = id;
            row[1] = sourceFile;

            return id;
        }
Exemplo n.º 45
0
 private static extern bool GetBinaryType(string lpApplicationName,
                                          out BinaryType lpBinaryType);
Exemplo n.º 46
0
 public FileTuningAction(string name, string filename, BinaryType type, string [] whitelist, string [] blacklist, string code, string author, string msg)
 {
     WizName = name;
     WizIdOrFilename = filename;
     WizType = TuneWizardType.TuningFile;
     WizBinType = type;
     WizWhitelist = whitelist;
     WizBlacklist = blacklist;
     WizCode = code;
     WizAuth = author;
     WizMsg = msg;
 }
Exemplo n.º 47
0
 /// <summary>
 /// Creates a new Binary instruction
 /// </summary>
 /// <param name="type">the type of the instruction</param>
 /// <param name="left">the left register (must be less than 16)</param>
 /// <param name="right">the right register / constant</param>
 protected Binary(BinaryType type, byte left, byte right)
 {
     this.Type = type;
     this.Left = left;
     this.Right = right;
 }
Exemplo n.º 48
0
		private void DecodeIfNeeded()
		{
			if ( this._decoded != null )
			{
				return;
			}

			if ( this._encoded == null )
			{
				return;
			}

			if ( this._type != BinaryType.Unknwon )
			{
				return;
			}

			try
			{
				this._decoded = MessagePackConvert.DecodeStringStrict( this._encoded );
				this._type = BinaryType.String;
			}
			catch ( DecoderFallbackException ex )
			{
				this._decodingError = ex;
				this._type = BinaryType.Blob;
			}
		}
 /// <summary>
 /// Makes a BinaryConstant instruction
 /// </summary>
 /// <param name="instruction">instruction to make from</param>
 /// <param name="type">the type of instruction</param>
 /// <returns>the new BinaryConstant</returns>
 /// <remarks>
 /// Assumes the constant is stored in the lower 8 bits
 /// </remarks>
 protected BinaryConstant MakeBinaryConstant(int instruction, BinaryType type)
 {
     return new BinaryConstant(type, GetRegister1(instruction), (byte) instruction);
 }
Exemplo n.º 50
0
 /// <summary>
 /// Creates a new BinaryConstant
 /// </summary>
 /// <param name="type">the type of the operator</param>
 /// <param name="left">the left register (must be less than 16)</param>
 /// <param name="right">the right constant</param>
 public BinaryConstant(BinaryType type, byte left, byte right)
     : base(type, left, right)
 {
 }
 /// <summary>
 /// Makes a BinaryRegister instruction
 /// </summary>
 /// <param name="instruction">instruction to make from</param>
 /// <param name="type">the type of instruction</param>
 /// <returns>the new BinaryRegister</returns>
 protected BinaryRegister MakeBinaryRegister(int instruction, BinaryType type)
 {
     return new BinaryRegister(type, GetRegister1(instruction), GetRegister2(instruction));
 }