Example #1
0
        public bool Match(XMLLuaSearchTableConstructor req, TableConstructor real)
        {
            Logger.Debug($"table_constructor");
            if (req.Values.Count != real.Values.Count)
            {
                return(false);
            }
            for (var i = 0; i < req.Values.Count; i++)
            {
                var value = req.Values[i];
                var found = false;

                foreach (var kv in real.Values)
                {
                    if ((value.Key == null || Match(value.Key, kv.Key)) && (value.Value == null || Match(value.Value, kv.Value)))
                    {
                        found = true;
                        break;
                    }
                }
                if (!found)
                {
                    return(false);
                }
            }
            SetSelectionIfSelected(real.Span, req);
            return(true);
        }
Example #2
0
    public static TableConstructor instance()
    {
        if (_instance != null)
        {
            return(_instance);
        }

        _instance = FindObjectOfType <TableConstructor>();

        if (_instance == null)
        {
            GameObject resourceObject = Resources.Load <GameObject>("TableConstructor");
            if (resourceObject != null)
            {
                GameObject instanceObject = Instantiate(resourceObject);
                _instance = instanceObject.GetComponent <TableConstructor>();
                DontDestroyOnLoad(instanceObject);
            }
            else
            {
                Debug.Log("Resource does not have a definition for TableConstructor");
            }
        }
        return(_instance);
    }
    private void ClickedBehaviour()
    {
        Debug.Log("Selected");
        gameController.SetIsPieceClicked();

        gameController.SetClickedPiece(gameObject);

        TableConstructor tableConstructor = TableConstructor.instance();

        List <List <Piece> > checkersPiecesPositions = gameController.GetCurrentTable().GetPiecesPosition();

        bool checkObjectController = true;
        int  indexOfList           = 0;

        while (checkObjectController)
        {
            if (checkersPiecesPositions[indexOfList].Contains(gameObject.GetComponent <Piece>()))
            {
                pieceRow              = indexOfList;
                pieceColumn           = checkersPiecesPositions[indexOfList].IndexOf(gameObject.GetComponent <Piece>());
                checkObjectController = false;
            }
            else if (indexOfList == checkersPiecesPositions.Count - 1)
            {
                checkObjectController = false;
            }
            else
            {
                indexOfList++;
            }
        }
        gameController.SetCurrentClickedPiece(gameObject.GetComponent <Piece>());
        gameController.SetOldPieceClickedPosition(pieceRow, pieceColumn);
        List <Piece> isPieceObligatedToEat = gameController.GetListOfPiecesAbleToEat();
    }
Example #4
0
        static LuaArguments EvalExpression(IExpression Expression, LuaContext Context)
        {
            if (Expression is NumberLiteral)
            {
                return(Lua.Return(((NumberLiteral)Expression).Value));
            }
            else if (Expression is StringLiteral)
            {
                return(Lua.Return(((StringLiteral)Expression).Value));
            }
            else if (Expression is NilLiteral)
            {
                return(Lua.Return(LuaObject.Nil));
            }
            else if (Expression is BoolLiteral)
            {
                return(Lua.Return(((BoolLiteral)Expression).Value));
            }
            else if (Expression is BinaryExpression)
            {
                BinaryExpression exp = (BinaryExpression)Expression;
                return(Lua.Return(EvalBinaryExpression(exp, Context)));
            }
            else if (Expression is UnaryExpression)
            {
                UnaryExpression exp = (UnaryExpression)Expression;
                return(Lua.Return(EvalUnaryExpression(exp, Context)));
            }
            else if (Expression is Variable)
            {
                Variable var = (Variable)Expression;
                return(Lua.Return(EvalVariable(var, Context)));
            }
            else if (Expression is FunctionCall)
            {
                FunctionCall call = (FunctionCall)Expression;
                return(EvalFunctionCall(call, Context));
            }
            else if (Expression is TableAccess)
            {
                TableAccess taccess = (TableAccess)Expression;
                return(Lua.Return(EvalTableAccess(taccess, Context)));
            }
            else if (Expression is FunctionDefinition)
            {
                FunctionDefinition fdef = (FunctionDefinition)Expression;
                return(Lua.Return(EvalFunctionDefinition(fdef, Context)));
            }
            else if (Expression is TableConstructor)
            {
                TableConstructor tctor = (TableConstructor)Expression;
                return(Lua.Return(EvalTableConstructor(tctor, Context)));
            }
            else if (Expression is VarargsLiteral)
            {
                return(Context.Varargs);
            }

            return(Lua.Return());
        }
    public void OnMouseDown()
    {
        gameController = GameController.instance();
        Debug.Log(gameObject.GetComponent <BoardPiece>().IsPlayable());

        if (gameController.GetIsPieceClicked())
        {
            TableConstructor tableConstructor = TableConstructor.instance();

            if (gameObject.GetComponent <BoardPiece>().IsPlayable())
            {
                if (gameController.GetMandatoryEat() == true)
                {
                    gameController.SetNewBoardPosition(gameObject.GetComponent <BoardPiece>());
                    gameController.UpdateGameObjectBlockedDueMandatoryEat();
                    gameObject.GetComponent <BoardPiece>().SetPlayable();
                    gameController.DoesAIMustPlay();
                }
                else
                {
                    gameController.SetNewBoardPosition(gameObject.GetComponent <BoardPiece>());
                    gameController.UpdateGameObject();
                    gameController.DoesAIMustPlay();
                }
            }
        }
    }
Example #6
0
 /// <summary>
 /// Rekonstruiert diese Beschreibung zur Erstellung einer SI Tabelle.
 /// </summary>
 /// <param name="buffer">Ein Speicherbereich, in dem die Tabelle rekonstruiert wird.</param>
 protected override void CreatePayload(TableConstructor buffer)
 {
     // Forward
     foreach (SubtitleInfo info in Subtitles)
     {
         info.CreatePayload(buffer);
     }
 }
Example #7
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="buffer"></param>
 protected override void CreatePayload(TableConstructor buffer)
 {
     // Process all
     foreach (LanguageItem item in Languages)
     {
         item.CreatePayload(buffer);
     }
 }
Example #8
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="buffer"></param>
 protected override void CreatePayload(TableConstructor buffer)
 {
     // Forward
     foreach (TeletextItem item in Items)
     {
         item.CreatePayload(buffer);
     }
 }
        /// <summary>
        /// Rekonstruiert eine VideoText Beschreibung.
        /// </summary>
        /// <param name="buffer">Sammelt Detailbeschreibungen.</param>
        internal void CreatePayload(TableConstructor buffer)
        {
            // The language
            buffer.AddLanguage(ISOLanguage);

            // Code field
            buffer.Add((byte)((MagazineNumber & 0x7) | (((int)Type) << 3)));
            buffer.Add(PageNumberBCD);
        }
Example #10
0
        /// <summary>
        /// Creates the lua code variable table.
        /// </summary>
        /// <param name="dte">The DTE.</param>
        /// <param name="parent">The parent.</param>
        /// <param name="name">The name.</param>
        /// <param name="type">The type.</param>
        /// <param name="access">The access.</param>
        /// <param name="variable">The variable.</param>
        /// <returns></returns>
        public static LuaCodeVariable CreateLuaCodeVariableTable(
            DTE dte, CodeElement parent, string name,
            LuaType type, vsCMAccess access, TableConstructor variable)
        {
            var result = new LuaCodeVariableTable(dte, parent, name,
                                                  access, variable);

            return(result);
        }
Example #11
0
 /// <summary>
 /// Creates the lua code variable table.
 /// </summary>
 /// <param name="dte">The DTE.</param>
 /// <param name="parent">The parent.</param>
 /// <param name="name">The name.</param>
 /// <param name="type">The type.</param>
 /// <param name="isLocal">if set to <c>true</c> [is local].</param>
 /// <param name="variable">The variable.</param>
 /// <returns></returns>
 public static LuaCodeVariable CreateLuaCodeVariableTable(
     DTE dte, CodeElement parent, string name,
     LuaType type, bool isLocal, TableConstructor variable)
 {
     return(CreateLuaCodeVariableTable(dte, parent, name,
                                       type,
                                       isLocal ? vsCMAccess.vsCMAccessPrivate : vsCMAccess.vsCMAccessProject,
                                       variable));
 }
Example #12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LuaCodeVariableTable"/> class.
 /// </summary>
 /// <param name="dte"></param>
 /// <param name="parentElement"></param>
 /// <param name="name"></param>
 /// <param name="access"></param>
 /// <param name="variable"></param>
 public LuaCodeVariableTable(DTE dte, CodeElement parentElement, string name, vsCMAccess access,
                             TableConstructor variable)
     : base(dte, parentElement, name, new LuaCodeTypeRef(
                dte, LuaDeclaredType.Table), access,
            new Variable(variable.Location) { Identifier = new Identifier(variable.Location) })
 {
     childObjects = new LuaCodeElements(dte, this);
     astNode      = variable;
     parent       = parentElement;
 }
Example #13
0
        public async Task <LuaArguments> EvaluateTableConstructor(TableConstructor constructor, LuaState state, CancellationToken token = default)
        {
            var table      = LuaObject.CreateTable();
            var keyCounter = (int?)1;

            for (var index = 0; index < constructor.Values.Count; index++)
            {
                var addAll = keyCounter.HasValue && index == constructor.Values.Count - 1;
                var kv     = constructor.Values[index];

                // Get the key.
                LuaObject key;

                if (kv.Key == null)
                {
                    if (addAll)
                    {
                        key = LuaNil.Instance;
                    }
                    else if (keyCounter.HasValue)
                    {
                        key = keyCounter.Value;
                        keyCounter++;
                    }
                    else
                    {
                        continue;
                    }
                }
                else
                {
                    key = await _engine.EvaluateExpression(kv.Key, state, token).FirstAsync();

                    keyCounter = null;
                    addAll     = false;
                }

                // Get the value.
                var value = await _engine.EvaluateExpression(kv.Value, state, token);

                if (addAll)
                {
                    for (var i = 0; i < value.Length; i++)
                    {
                        table.NewIndexRaw(keyCounter.Value + i, value[i]);
                    }
                }
                else
                {
                    table.NewIndexRaw(key, value[0]);
                }
            }

            return(Lua.Args(table));
        }
        public void DataGridFill()
        {
            if (taskIndex == 0)
            {
                taskChars.Clear();
                for (int i = 0; i < checkBoxes.Count; i++)
                {
                    if (checkBoxes[i].IsChecked == true)
                    {
                        taskChars.Add((char)checkBoxes[i].Content);
                    }
                }
                tableConstructor = new TableConstructor();
                tableConstructor.makeFirstList(taskChars);
                tableConstructor.makeCheckList(taskChars);
                dataGrid.ItemsSource = tableConstructor.taskVerbs1;

                taskIndex++;
            }
            else if (taskIndex == 1 && CanTurnPage())
            {
                tableConstructor.makeSecondList(taskChars);
                dataGrid.ItemsSource = tableConstructor.taskVerbs2;
                EditColumnsWidth();
                taskIndex++;
            }
            else if (taskIndex == 2 && CanTurnPage())
            {
                tableConstructor.makeThirdList(taskChars);
                dataGrid.ItemsSource = tableConstructor.taskVerbs3;
                EditColumnsWidth();
                taskIndex++;
            }
            else if (taskIndex == 3 && CanTurnPage())
            {
                tableConstructor.makeFourthList(taskChars);
                dataGrid.ItemsSource = tableConstructor.taskVerbs4;
                EditColumnsWidth();
                taskIndex++;
            }
            else if (taskIndex == 4 && CanTurnPage())
            {
                MessageBox.Show("Well done! Mission is complete");
                taskIndex = 0;

                comboBox.Visibility = Visibility.Visible;
                lettersL.Visibility = Visibility.Visible;
                startBtn.Visibility = Visibility.Visible;
                quitBtn.Visibility  = Visibility.Visible;

                dataGrid.Visibility     = Visibility.Hidden;
                nextBtn.Visibility      = Visibility.Hidden;
                quitBtn_Copy.Visibility = Visibility.Hidden;
            }
        }
Example #15
0
        public void insert_data(Dictionary <string, int> hashMap)
        {
            String html = " ";

            FormConstructor  form  = new FormConstructor(this.sourcePath, this.targetPath + "/" + this.fileName, this.Objectname, this.Fobjects);
            TableConstructor table = new TableConstructor(this.sourcePath, this.targetPath + "/" + this.fileName, this.Objectname, this.Fobjects);
            JsConstructor    js    = new JsConstructor(this.sourcePath, this.targetPath + "/" + this.fileName, this.Objectname);

            html  = form.generate_form(hashMap);
            html += table.generate_table(hashMap);
            html += js.generateJs(hashMap);

            write_file(html);
        }
Example #16
0
        /// <summary>
        /// Creates LuaCodeVariableTable from TableConstructor node.
        /// </summary>
        /// <param name="constructor">TableConstructor node instance.</param>
        /// <param name="parentElement">Parent of LuaCodeVariable element.</param>
        /// <param name="name">Name of table.</param>
        /// <param name="isLocal">Indicates that element is declared locally.</param>
        /// <returns></returns>
        private LuaCodeVariable CreateTable(TableConstructor constructor, CodeElement parentElement,
                                            string name, bool isLocal)
        {
            var variable = LuaCodeElementFactory.CreateLuaCodeVariableTable
                               (dte, parentElement, name, LuaType.Table, isLocal, constructor);

            if (constructor.FieldList != null)
            {
                foreach (Field field in constructor.FieldList)
                {
                    RecurseFieldInTable(variable as LuaCodeVariableTable, field);
                }
            }
            return(variable);
        }
Example #17
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="buffer"></param>
        protected override void CreatePayload(TableConstructor buffer)
        {
            // Collected flags
            byte flags = 0;

            // Load flags
            if (m_HasComponentType)
            {
                flags |= 0x80;
            }
            if (m_HasBSID)
            {
                flags |= 0x40;
            }
            if (m_HasMainID)
            {
                flags |= 0x20;
            }
            if (m_HasAssociatedService)
            {
                flags |= 0x10;
            }

            // Write flags
            buffer.Add(flags);

            // Write all
            if (m_HasComponentType)
            {
                buffer.Add(m_ComponentType);
            }
            if (m_HasBSID)
            {
                buffer.Add(m_BSID);
            }
            if (m_HasMainID)
            {
                buffer.Add(m_MainID);
            }
            if (m_HasAssociatedService)
            {
                buffer.Add(m_AssociatedService);
            }

            // Load the additional information
            buffer.Add(m_AdditionalInformation);
        }
Example #18
0
        static LuaObject EvalTableConstructor(TableConstructor tctor, LuaContext Context)
        {
            Dictionary <LuaObject, LuaObject> table = new Dictionary <LuaObject, LuaObject>();
            int i = 0;

            foreach (KeyValuePair <IExpression, IExpression> pair in tctor.Values)
            {
                if (i == tctor.Values.Count - 1 && (pair.Value is FunctionCall || pair.Value is VarargsLiteral))
                // This is the last element, and this is a function call or varargs, thus we will add
                // every return value to the table
                {
                    LuaObject key = EvalExpression(pair.Key, Context)[0];
                    if (key.IsNumber)
                    {
                        LuaArguments values = EvalExpression(pair.Value, Context);

                        double k = key;
                        foreach (LuaObject v in values)
                        {
                            table.Add(k, v);
                            k++;
                        }
                    }
                    else
                    {
                        LuaObject value = EvalExpression(pair.Value, Context)[0];

                        table.Add(key, value);
                    }
                }
                else
                {
                    LuaObject key   = EvalExpression(pair.Key, Context)[0];
                    LuaObject value = EvalExpression(pair.Value, Context)[0];

                    table.Add(key, value);
                }
                i++;
            }
            return(LuaObject.FromTable(table));
        }
Example #19
0
        /// <summary>
        /// Creates LuaCodeVariableTable from TableConstructor node.
        /// </summary>
        /// <param name="constructor">TableConstructor node instance.</param>
        /// <param name="parentElement">Parent of LuaCodeVariable element.</param>
        /// <param name="identifier">TableConstructor identifier.</param>
        /// <param name="isLocal">Indicates that element is declared locally.</param>
        /// <returns></returns>
        private LuaCodeVariable CreateTable(TableConstructor constructor, CodeElement parentElement,
                                            Identifier identifier, bool isLocal)
        {
            var variable = (LuaCodeVariableTable)LuaCodeElementFactory.CreateLuaCodeVariableTable
                               (dte, parentElement, identifier.Name,
                               LuaType.Table, isLocal, constructor);

            variable.IdentifierLocation      = PrepareLocation(identifier.Location, constructor.Location);
            variable.IdentifierLocation.eCol = variable.IdentifierLocation.sCol + identifier.Name.Length;

            //var location = variable.IdentifierLocation;
            //Trace.WriteLine(String.Format("LuaCodeVariableTable Location: StartCol-{0} StartLine-{1} EndCol-{2} EndLine-{3}", location.sCol, location.sLin, location.eCol, location.eLin));
            if (constructor.FieldList != null)
            {
                foreach (Field field in constructor.FieldList)
                {
                    RecurseFieldInTable(variable, field);
                }
            }
            return(variable);
        }
    public void ConstructPieces()
    {
        piecesPosition  = new List <List <Piece> >();
        whitePiecesList = new List <Piece>();
        darkPiecesList  = new List <Piece>();

        TableConstructor tableContructorInstance = TableConstructor.instance();

        board        = tableContructorInstance.GetBoard();
        playbleBoard = tableContructorInstance.GetPlaybleArea();

        int          totalPieces          = board.GetSizeOfTable() * 3;
        int          columnValue          = 0;
        int          placeController      = totalPieces;
        int          rowValue             = 0;
        List <Piece> auxiliarPiecesList   = StartEmptyList();
        GameObject   pieceWhiteGameObject = Resources.Load <GameObject>("PieceWhite");
        GameObject   pieceBlackGameObject = Resources.Load <GameObject>("PieceBlack");


        while (placeController > 0)
        {
            if (tableContructorInstance.GetPlaybleArea()[rowValue][columnValue].IsPlayable())
            {
                if (rowValue < (tableContructorInstance.GetPlaybleArea().Count / 2 - 1))
                {
                    GameObject newPiece = Instantiate(pieceWhiteGameObject);
                    newPiece.name = (rowValue.ToString() + " " + columnValue.ToString());
                    newPiece.transform.position = tableContructorInstance.GetPlaybleArea()[rowValue][columnValue].transform.position;
                    tableContructorInstance.SetPlaybleTile(rowValue, columnValue);
                    newPiece.GetComponent <Piece>().SetKing(false);
                    newPiece.GetComponent <Piece>().SetIsUp(false);
                    newPiece.GetComponent <Piece>().SetBlackColor(false);
                    newPiece.GetComponent <Piece>().SetIsAvaiableToEat(true);
                    whitePiecesList.Add(newPiece.GetComponent <Piece>());
                    newPiece.GetComponent <MeshRenderer>().material = whiteMaterial;
                    board.UpdatePiecesPositionList(rowValue, columnValue, newPiece.GetComponent <Piece>());
                    placeController--;
                    auxiliarPiecesList[columnValue] = newPiece.GetComponent <Piece>();
                    totalWhitePieces++;
                }
                else if (rowValue > (tableContructorInstance.GetPlaybleArea().Count / 2))
                {
                    GameObject newPiece = Instantiate(pieceBlackGameObject);
                    newPiece.name = (rowValue.ToString() + " " + columnValue.ToString());
                    newPiece.transform.position = tableContructorInstance.GetPlaybleArea()[rowValue][columnValue].transform.position;
                    newPiece.GetComponent <Piece>().SetKing(false);
                    newPiece.GetComponent <Piece>().SetIsUp(true);
                    tableContructorInstance.SetPlaybleTile(rowValue, columnValue);
                    newPiece.GetComponent <Piece>().SetBlackColor(true);
                    newPiece.GetComponent <Piece>().SetIsAvaiableToEat(true);
                    darkPiecesList.Add(newPiece.GetComponent <Piece>());
                    newPiece.GetComponent <MeshRenderer>().material = grayMaterial;
                    board.UpdatePiecesPositionList(rowValue, columnValue, newPiece.GetComponent <Piece>());
                    placeController--;
                    auxiliarPiecesList[columnValue] = newPiece.GetComponent <Piece>();
                    totalBlackPieces++;
                }
            }

            if (columnValue < tableContructorInstance.GetPlaybleArea()[0].Count - 1)
            {
                columnValue++;
            }

            if (placeController % (tableContructorInstance.GetPlaybleArea()[0].Count / 2) == 0 && (!tableContructorInstance.GetPlaybleArea()[rowValue][columnValue].IsPlayable()))
            {
                if (rowValue < tableContructorInstance.GetPlaybleArea().Count)
                {
                    rowValue++;
                    piecesPosition.Add(auxiliarPiecesList);
                    auxiliarPiecesList = StartEmptyList();
                }
                columnValue = 0;
            }
        }
    }
Example #21
0
        TableConstructor ParseTableConstruct(ParseTreeNode node)
        {
            if (node.Term.Name == "TableConstruct")
            {
                if (node.ChildNodes.Count == 0)
                {
                    return(new TableConstructor());
                }

                var child          = node.ChildNodes[0];
                TableConstructor t = new TableConstructor();

                while (true)
                {
                    if (child.ChildNodes.Count == 0)
                    {
                        break;
                    }

                    var value = child.ChildNodes[0];

                    if (value.ChildNodes.Count == 1)
                    {
                        t.Values.Add(new TableItem {
                            Value = ParseExpression(value.ChildNodes[0])
                        });
                    }
                    else
                    {
                        var prefix = value.ChildNodes[0];

                        var key = prefix.ChildNodes[0].Term.Name == "identifier"
                            ? new Ast.StringLiteral()
                        {
                            Value = prefix.ChildNodes[0].Token.ValueString
                        }
                            : ParseExpression(prefix.ChildNodes[0]);

                        var expr = value.ChildNodes[1];
                        var val  = ParseExpression(expr);

                        t.Values.Add(new TableItem
                        {
                            Key   = key,
                            Value = val
                        });
                    }

                    //child = child.ChildNodes[1].ChildNodes[0];
                    child = child.ChildNodes[1];
                    if (child.ChildNodes.Count == 0)
                    {
                        break;
                    }
                    child = child.ChildNodes[0];
                }

                return(t);
            }
            throw new Exception("Invalid TableConstruct node");
        }
Example #22
0
        /// <summary>
        /// Rekonstruiert eine VideoText Beschreibung.
        /// </summary>
        /// <param name="buffer">Sammelt Detailbeschreibungen.</param>
        internal void CreatePayload( TableConstructor buffer )
        {
            // The language
            buffer.AddLanguage( ISOLanguage );

            // Code field
            buffer.Add( (byte) ((MagazineNumber & 0x7) | (((int) Type) << 3)) );
            buffer.Add( PageNumberBCD );
        }
Example #23
0
        /// <summary>
        /// Create a PMT for the program.
        /// </summary>
        /// <remarks>
        /// There will be a lot of randomly choosen values just to make the transport
        /// stream valid. Each audio stream will be reported as <i>german</i> and
        /// similiar defaults are attached to a teletext stream.
        /// </remarks>
        /// <returns>The table describing the related program.</returns>
        protected override byte[] CreateTable()
        {
            // Create buffer
            TableConstructor buffer = new TableConstructor();

            // Append to buffer
            buffer.Add((byte)(0xe0 | (PCRPID / 256)));
            buffer.Add((byte)(PCRPID & 0xff));
            buffer.Add(0xf0, 0x00);

            // All entries
            for (int ip = 0; ip < m_Streams.Count;)
            {
                // Load
                short       pid  = m_Streams[ip++];
                StreamTypes type = m_Type[pid];

                // Is teletext or audio
                bool ttx = (StreamTypes.TeleText == type);
                bool sub = !ttx && (StreamTypes.SubTitles == type);
                bool ac3 = !ttx && !sub && (StreamTypes.Private == type);
                bool aud = ac3 || (!ttx && !sub && (StreamTypes.Audio == type));

                // Append to buffer
                buffer.Add((ttx || sub) ? (byte)StreamTypes.Private : m_Encoding[pid]);
                buffer.Add((byte)(0xe0 | (pid / 256)));
                buffer.Add((byte)(pid & 0xff));
                buffer.Add(0xf0);

                // Length
                int lengthPos = buffer.CreateDynamicLength();

                // Create stream identifier
                buffer.Add(new StreamIdentifier((byte)ip));

                // Check for additional data
                if (ttx)
                {
                    // Create teletext descriptor
                    buffer.Add(new Teletext());
                }
                else if (sub)
                {
                    // Load descriptor list
                    SubtitleInfo[] subInfos = DVBSubtitles[pid];

                    // Create the descriptor
                    Subtitle subDescr = new Subtitle();

                    // Check mode
                    if ((null == subInfos) || (subInfos.Length < 1))
                    {
                        // Create a brand new pseudo entry
                        subDescr.Subtitles.Add(new SubtitleInfo("deu", EPG.SubtitleTypes.DVBNormal, 1, 1));
                    }
                    else
                    {
                        // Use as is
                        subDescr.Subtitles.AddRange(subInfos);
                    }

                    // Serialize to buffer
                    buffer.Add(subDescr);
                }
                else if (aud)
                {
                    // Load language
                    string language;
                    if (!m_AudioNames.TryGetValue(pid, out language))
                    {
                        language = "deu";
                    }

                    // Create language descriptor
                    ISOLanguage audioDescriptor = new ISOLanguage();

                    // Append language item
                    audioDescriptor.Languages.Add(new LanguageItem(language, ac3 ? EPG.AudioTypes.Undefined : EPG.AudioTypes.CleanEffects));

                    // Append to buffer
                    buffer.Add(audioDescriptor);

                    // Fill AC3 descriptor
                    if (ac3)
                    {
                        buffer.Add(new AC3());
                    }
                }

                // Finish
                buffer.SetDynamicLength(lengthPos);
            }

            // Report
            return(buffer.ToArray());
        }
Example #24
0
 public virtual void Visit(TableConstructor node)
 {
 }
Example #25
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="buffer"></param>
 protected override void CreatePayload(TableConstructor buffer)
 {
     // Process all
     foreach (LanguageItem item in Languages) item.CreatePayload(buffer);
 }
Example #26
0
		/// <summary>
		/// 
		/// </summary>
		/// <param name="buffer"></param>
		protected override void CreatePayload(TableConstructor buffer)
		{
			// Forward
			foreach (TeletextItem item in Items) item.CreatePayload(buffer);
		}
 /// <summary>
 ///
 /// </summary>
 /// <param name="buffer"></param>
 protected override void CreatePayload(TableConstructor buffer)
 {
     // Add
     buffer.Add(ComponentTag);
 }
Example #28
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="buffer"></param>
 protected override void CreatePayload(TableConstructor buffer)
 {
     // Add
     buffer.Add(ComponentTag);
 }
Example #29
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="buffer"></param>
        protected override void CreatePayload(TableConstructor buffer)
        {
            // Collected flags
            byte flags = 0;

            // Load flags
            if (m_HasComponentType) flags |= 0x80;
            if (m_HasBSID) flags |= 0x40;
            if (m_HasMainID) flags |= 0x20;
            if (m_HasAssociatedService) flags |= 0x10;

            // Write flags
            buffer.Add(flags);

            // Write all
            if (m_HasComponentType) buffer.Add(m_ComponentType);
            if (m_HasBSID) buffer.Add(m_BSID);
            if (m_HasMainID) buffer.Add(m_MainID);
            if (m_HasAssociatedService) buffer.Add(m_AssociatedService);

            // Load the additional information
            buffer.Add(m_AdditionalInformation);
        }
Example #30
0
 public void Visit(TableConstructor node)
 {
     VisitLuaFunction(node);
 }
Example #31
0
 /// <summary>
 /// Rekonstruiert diese Beschreibung zur Erstellung einer SI Tabelle.
 /// </summary>
 /// <param name="buffer">Ein Speicherbereich, in dem die Tabelle rekonstruiert wird.</param>
 protected override void CreatePayload(TableConstructor buffer)
 {
     // Forward
     foreach (SubtitleInfo info in Subtitles) info.CreatePayload(buffer);
 }