Esempio n. 1
0
 partial void DeleteDB_StringLiteral(DB_StringLiteral instance);
Esempio n. 2
0
		private void detach_DB_StringLiterals(DB_StringLiteral entity)
		{
			this.SendPropertyChanging();
			entity.DB_ILOpInfo = null;
		}
Esempio n. 3
0
 partial void UpdateDB_StringLiteral(DB_StringLiteral instance);
Esempio n. 4
0
 partial void InsertDB_StringLiteral(DB_StringLiteral instance);
Esempio n. 5
0
        /// <summary>
        /// Adds a new string literal of specified value to the string literals data block.
        /// </summary>
        /// <param name="value">The value of the string to add.</param>
        /// <param name="ilOpInfo">The ILOpInfo that is adding the string literal.</param>
        /// <returns>The ID (label) of the string.</returns>
        public string AddStringLiteral(string value, ILOpInfo ilOpInfo)
        {
            string stringID = Utils.GetMD5Hash(
                Encoding.UTF8.GetBytes(value));
            string label = Utils.FilterIdentifierForInvalidChars("StringLiteral_" + stringID);
            
            if (!StringLiteralsDataBlock.ASM.ToString().Contains(stringID))
            {
                Encoding xEncoding = Encoding.ASCII;

                var NumBytes = xEncoding.GetByteCount(value);
                var stringData = new byte[4 + NumBytes];
                Array.Copy(BitConverter.GetBytes(value.Length), 0, stringData, 0, 4);
                Array.Copy(xEncoding.GetBytes(value), 0, stringData, 4, NumBytes);

                //This is UTF-16 (Unicode)/ASCII text
                StringLiteralsDataBlock.ASM.AppendLine(string.Format("{0}:", label));
                //Put in type info as FOS_System.String type
                StringLiteralsDataBlock.ASM.AppendLine("dd STRING_TYPE_ID");
                //Put in string length bytes
                StringLiteralsDataBlock.ASM.Append("db ");
                for (int i = 0; i < 3; i++)
                {
                    StringLiteralsDataBlock.ASM.Append(stringData[i]);
                    StringLiteralsDataBlock.ASM.Append(", ");
                }
                StringLiteralsDataBlock.ASM.Append(stringData[3]);
                //Put in string characters (as words)
                StringLiteralsDataBlock.ASM.Append("\ndw ");
                for (int i = 4; i < (stringData.Length - 1); i++)
                {
                    StringLiteralsDataBlock.ASM.Append(stringData[i]);
                    StringLiteralsDataBlock.ASM.Append(", ");
                }
                StringLiteralsDataBlock.ASM.Append(stringData.Last());
                StringLiteralsDataBlock.ASM.AppendLine();

                if (DebugBuild)
                {
                    DB_StringLiteral dbStringLiteral = new DB_StringLiteral();
                    dbStringLiteral.Id = stringID;
                    if (ilOpInfo != null)
                    {
                        dbStringLiteral.ILOpInfoID = ilOpInfo.DBILOpInfo.Id;
                    }
                    dbStringLiteral.Value = value;
                    DebugDatabase.AddStringLiteral(dbStringLiteral);
                }
            }

            return label;
        }
Esempio n. 6
0
 /// <summary>
 /// Removes the specified string literal from the database.
 /// <para>To Do's: See <see cref="RemoveMethod"/>'s to do's.</para>
 /// </summary>
 /// <param name="aStringLiteral">The entry to remove.</param>
 /// <remarks>
 /// <para>
 /// For the moment this method does no more than just directly remove
 /// the entry from the database.
 /// </para>
 /// <para>
 /// <see cref="SubmitChanges"/> must be called at some point after this
 /// method for changes to actually be submitted to the database.
 /// </para>
 /// </remarks>
 public static void RemoveStringLiteral(DB_StringLiteral aStringLiteral)
 {
     DB.DB_StringLiterals.DeleteOnSubmit(aStringLiteral);
 }
Esempio n. 7
0
 /// <summary>
 /// Adds the pre-created string literal to the database. All the entries's
 /// required parameters (i.e. ones which cannot be null) should 
 /// be set.
 /// <para>To Do's: See <see cref="AddMethod"/>'s to do's.</para>
 /// </summary>
 /// <param name="aStringLiteral">The entry to add.</param>
 /// <remarks>
 /// <para>
 /// For the moment this method does no more than just directly add
 /// the entry to the database.
 /// </para>
 /// <para>
 /// <see cref="SubmitChanges"/> must be called at some point after this
 /// method for changes to actually be submitted to the database.
 /// </para>
 /// </remarks>
 public static void AddStringLiteral(DB_StringLiteral aStringLiteral)
 {
     DB.DB_StringLiterals.InsertOnSubmit(aStringLiteral);
 }