Ejemplo n.º 1
0
    /// <summary>
    /// Execute this command.
    /// </summary>
    /// <param name="variables">The variable list of the calling code.</param>
    public override void Execute(VariableList variables)
    {
      string[] processed = ProcessParameters(variables, Parameters);

      using (Process process = new Process())
      {
        process.StartInfo.FileName = processed[0];
        process.StartInfo.WorkingDirectory = processed[1];
        process.StartInfo.Arguments = processed[2];
        process.StartInfo.WindowStyle = (ProcessWindowStyle) Enum.Parse(typeof (ProcessWindowStyle), processed[3], true);
        process.StartInfo.CreateNoWindow = bool.Parse(processed[4]);
        process.StartInfo.UseShellExecute = bool.Parse(processed[5]);
        //process.PriorityClass               = ProcessPriorityClass.

        bool waitForExit = bool.Parse(processed[6]);
        bool forceFocus = bool.Parse(processed[7]);

        process.Start();

        // Give new process focus ...
        if (forceFocus && !process.StartInfo.CreateNoWindow &&
            process.StartInfo.WindowStyle != ProcessWindowStyle.Hidden)
        {
          //FocusForcer forcer = new FocusForcer(process.Id);
          //forcer.Start();
          //forcer.Force();
        }

        if (waitForExit)
          process.WaitForExit();
      }
    }
    /// <summary>
    /// Execute this command.
    /// </summary>
    /// <param name="variables">The variable list of the calling code.</param>
    public override void Execute(VariableList variables)
    {
      string[] processed = ProcessParameters(variables, Parameters);

      string windowID = processed[0];

      int window = (int) GUIWindow.Window.WINDOW_INVALID;

      try
      {
        window = (int) Enum.Parse(typeof (GUIWindow.Window), "WINDOW_" + windowID, true);
      }
      catch (ArgumentException)
      {
        // Parsing the window id as a GUIWindow.Window failed, so parse it as an int
      }

      if (window == (int) GUIWindow.Window.WINDOW_INVALID)
        int.TryParse(windowID, out window);

      if (window == (int) GUIWindow.Window.WINDOW_INVALID)
        throw new CommandStructureException(String.Format("Failed to parse Goto screen command window id \"{0}\"",
                                                          windowID));

      GUIGraphicsContext.ResetLastActivity();
      GUIWindowManager.SendThreadMessage(new GUIMessage(GUIMessage.MessageType.GUI_MSG_GOTO_WINDOW, 0, 0, 0, window, 0,
                                                        null));
    }
Ejemplo n.º 3
0
        protected ConstraintVar( Solver solver, Variable[] varList, VariableList[] varListList )
            : base(solver)
        {
            m_VariableList		= varList;
            m_VariableListList	= varListList;

            OnSet();
        }
Ejemplo n.º 4
0
    /// <summary>
    /// Execute this command.
    /// </summary>
    /// <param name="variables">The variable list of the calling code.</param>
    public override void Execute(VariableList variables)
    {
      string[] processed = ProcessParameters(variables, Parameters);

      int timeout = int.Parse(processed[2]);

      PopupMessage popup = new PopupMessage(processed[0], processed[1], timeout);
      popup.ShowDialog();
    }
Ejemplo n.º 5
0
        internal void DropEdge(GremlinVariable dropEdgeVariable)
        {
            var sourceProperty = dropEdgeVariable.GetVariableProperty(GremlinKeyword.EdgeSourceV);
            var edgeProperty   = dropEdgeVariable.GetVariableProperty(GremlinKeyword.EdgeID);
            GremlinDropVariable dropVariable = new GremlinDropEdgeVariable(sourceProperty, edgeProperty);

            VariableList.Add(dropVariable);
            TableReferences.Add(dropVariable);
            SetPivotVariable(dropVariable);
        }
Ejemplo n.º 6
0
 public HeroClass(HeroType type = null)
 {
     Type      = new HeroType(HeroTypes.Class);
     Variables = new VariableList();
     if (type != null)
     {
         Type.Id = type.Id;
     }
     hasValue = false;
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Default ctor
 /// </summary>
 public MethodEntry(string name, string signature, string dexName, string dexSignature, int mapFileId)
 {
     this.name = name;
     this.signature = signature;
     this.dexName = dexName;
     this.dexSignature = dexSignature;
     this.mapFileId = mapFileId;
     variables  = new VariableList();
     parameters = new ParameterList();
 }
Ejemplo n.º 8
0
 /// <summary>
 /// XML ctor
 /// </summary>
 internal MethodEntry(XElement e)
 {
     name = e.GetAttribute("name");
     signature = e.GetAttribute("signature");
     dexName = e.GetAttribute("dname");
     dexSignature = e.GetAttribute("dsignature");
     mapFileId = int.Parse(e.GetAttribute("id") ?? "0");
     variables = new VariableList(e);
     parameters = new ParameterList(e);
 }
Ejemplo n.º 9
0
        internal void BothV(GremlinVariable lastVariable)
        {
            GremlinVariableProperty    sourceProperty = lastVariable.GetVariableProperty(GremlinKeyword.EdgeSourceV);
            GremlinVariableProperty    sinkProperty   = lastVariable.GetVariableProperty(GremlinKeyword.EdgeSinkV);
            GremlinBoundVertexVariable bothVertex     = new GremlinBoundVertexVariable(lastVariable.GetEdgeType(), sourceProperty, sinkProperty);

            VariableList.Add(bothVertex);
            TableReferences.Add(bothVertex);
            SetPivotVariable(bothVertex);
        }
Ejemplo n.º 10
0
        public VariableList[] Copy( VariableList[] other )
        {
            VariableList[] copy	= new VariableList[ other.Length ];
            for( int idx = 0; idx < other.Length; ++idx )
            {
                copy[ idx ]		= m_VarListList[ other[ idx ].Index ];
            }

            return copy;
        }
Ejemplo n.º 11
0
        public void ListVar_TestVariableUIType()
        {
            //Arrange
            VariableList variableList = new VariableList();

            //Act
            string varType = variableList.VariableUIType;

            //Assert
            Assert.IsTrue(varType.Contains("List"), "List Variable UI Type");
        }
Ejemplo n.º 12
0
        public void ListVar_TestVariableType()
        {
            //Arrange
            VariableList variableList = new VariableList();

            //Act
            string varType = variableList.VariableType;

            //Assert
            Assert.AreEqual("List", varType, "List Variable Type");
        }
    /// <summary>
    /// Execute this command.
    /// </summary>
    /// <param name="variables">The variable list of the calling code.</param>
    public override void Execute(VariableList variables)
    {
      string[] processed = ProcessParameters(variables, Parameters);

      Action.ActionType type = (Action.ActionType) Enum.Parse(typeof (Action.ActionType), processed[0]);
      float f1 = float.Parse(processed[1]);
      float f2 = float.Parse(processed[2]);

      Action action = new Action(type, f1, f2);
      GUIGraphicsContext.OnAction(action);
    }
Ejemplo n.º 14
0
 public void SetListVariable(string name, VariableList val)
 {
     if (val == null)
     {
         return;
     }
     lock (listvariables)
     {
         listvariables[name] = val;
     }
 }
Ejemplo n.º 15
0
        public void ListVar_TestFormulaNoList()
        {
            //Arrange
            VariableList variableList = new VariableList();

            //Act
            string formulaResult = variableList.GetFormula();

            //Assert
            Assert.AreEqual(string.Empty, formulaResult, "List Formula");
        }
Ejemplo n.º 16
0
        /// <summary>
        /// Execute this command.
        /// </summary>
        /// <param name="variables">The variable list of the calling code.</param>
        public override void Execute(VariableList variables)
        {
            string[] processed = ProcessParameters(variables, Parameters);

            Action.ActionType type = (Action.ActionType)Enum.Parse(typeof(Action.ActionType), processed[0]);
            float             f1   = float.Parse(processed[1]);
            float             f2   = float.Parse(processed[2]);

            Action action = new Action(type, f1, f2);

            GUIGraphicsContext.OnAction(action);
        }
        public string GetProjectPath()
        {
            string projectPath         = string.Empty;
            var    projectPathVariable = VariableList.Where(v => v.VariableName == "ProjectPath").SingleOrDefault();

            if (projectPathVariable != null)
            {
                projectPath = projectPathVariable.VariableValue.ToString();
            }

            return(projectPath);
        }
Ejemplo n.º 18
0
        /// <summary>
        /// Handles the <see cref="ButtonBase.Click"/> event for the "Add Variable" <see
        /// cref="Button"/>.</summary>
        /// <param name="sender">
        /// The <see cref="Object"/> where the event handler is attached.</param>
        /// <param name="args">
        /// A <see cref="RoutedEventArgs"/> object containing event data.</param>
        /// <remarks><para>
        /// <b>OnVariableAdd</b> displays a <see cref="Dialog.ChangeIdentifier"/> dialog, followed
        /// by a <see cref="Dialog.ChangeVariable"/> dialog, allowing the user to define a new
        /// variable. The new variable copies the properties of the first selected item in the
        /// "Variable" list view, if any; otherwise, it is created with default properties.
        /// </para><para>
        /// If the user confirmed both dialogs, <b>OnVariableAdd</b> adds the new variable to the
        /// "Variable" list view and to the <see cref="CurrentVariables"/> collection, and sets the
        /// <see cref="SectionTabItem.DataChanged"/> flag.</para></remarks>

        private void OnVariableAdd(object sender, RoutedEventArgs args)
        {
            args.Handled = true;

            // ask user for new variable ID
            var variables = CurrentVariables;
            var dialog    = new Dialog.ChangeIdentifier(CurrentDefaultId,
                                                        Global.Strings.TitleVariableIdEnter, variables.ContainsKey, false);

            dialog.Owner = MainWindow.Instance;
            if (dialog.ShowDialog() != true)
            {
                return;
            }

            // retrieve new variable ID
            string id = String.Intern(dialog.Identifier);

            // create new variable based on selected variable, if any
            VariableClass variable, selection = VariableList.SelectedItem as VariableClass;

            if (selection == null)
            {
                variable = VariableClass.Create(id, CurrentCategory);
            }
            else
            {
                variable    = (VariableClass)selection.Clone();
                variable.Id = id;
            }

            // let user make changes to new variable
            var variableDialog = new Dialog.ChangeVariable(variable)
            {
                Owner = MainWindow.Instance
            };

            if (variableDialog.ShowDialog() != true)
            {
                return;
            }

            // add variable to section table
            variables.Add(id, variable);

            // update list view and select new item
            VariableList.Items.Refresh();
            VariableList.SelectAndShow(variable);

            // broadcast data changes
            EnableListButtons();
            SectionTab.DataChanged = true;
        }
        public LocalVariable AddVariable(Symbol s)
        {
            if (pos.ContainsKey(s))
            {
                throw new SyntaxError(string.Format("Env: Redefined name {0}", s));
            }
            pos.Add(s, VariableList.Count);
            var ret = new LocalVariable(s.Name, this);

            VariableList.Add(ret);
            return(ret);
        }
Ejemplo n.º 20
0
        // Lua's productions allways take lists on both sides of the '='
        public override void Init(AstContext context, ParseTreeNode treeNode)
        {
            base.Init(context, treeNode);

            foreach (var parseTreeNode in treeNode.ChildNodes[0].ChildNodes)
                VariableList.Add(AddChild(String.Empty, parseTreeNode) as LuaNode);

            foreach (var parseTreeNode in treeNode.ChildNodes[2].ChildNodes)
                ExpressionList.Add(AddChild(String.Empty, parseTreeNode) as LuaNode);

            AsString = "(assignment)";
        }
Ejemplo n.º 21
0
        public void ListVar_TestResetIndexValueForEmptyList()
        {
            //Arrange
            List <string> lstTemp      = new List <string>();
            VariableList  variableList = new VariableList("TestList", lstTemp);

            //Act
            variableList.ResetValue();

            //Assert
            Assert.AreEqual(0, variableList.CurrentValueIndex, "On Reset Index Value repositioned to 0");
        }
Ejemplo n.º 22
0
        internal WMatchClause GetMatchClause()
        {
            var newMatchClause = new WMatchClause();

            foreach (var path in PathList)
            {
                if (path.EdgeVariable is GremlinFreeEdgeTableVariable && VariableList.Contains(path.EdgeVariable))
                {
                    newMatchClause.Paths.Add(path.ToMatchPath());
                }
            }
            return(newMatchClause.Paths.Count == 0 ? null : newMatchClause);
        }
Ejemplo n.º 23
0
        public void ListVar_TestFormulaForEmptyList()
        {
            //Arrange
            List <string> lstTemp               = new List <string>();
            VariableList  variableList          = new VariableList("TestList", lstTemp);
            string        formulaExpectedResult = String.Join(",", lstTemp.ToArray());

            //Act
            string formulaResult = variableList.GetFormula();

            //Assert
            Assert.AreEqual(formulaExpectedResult, formulaResult, "List Formula");
        }
Ejemplo n.º 24
0
        public string Visit(VariableList node)
        {
            var stringo = $"// Start {node.GetType()} \n";

            stringo += "\t\t.locals init (\n";
            for (int i = 0; i < node.children.Count; i++)
            {
                stringo += $"\t\t\t[{i}] int32 {node.children[i].AnchorToken.Lexeme}";
                stringo += i == node.children.Count - 1 ? "\n" : ",\n";
            }
            stringo += "\t\t)\n\n";
            return(stringo);
        }
Ejemplo n.º 25
0
 internal void Reset()
 {
     PivotVariable = null;
     Predicates    = null;
     VariableList.Clear();
     TableReferences.Clear();
     PathList.Clear();
     StepList.Clear();
     IsPopulateGremlinPath = false;
     CurrentContextPath    = null;
     ProjectVariablePropertiesList.Clear();
     ProjectedProperties.Clear();
 }
Ejemplo n.º 26
0
        public void ListVar_TestImageType()
        {
            //Arrange
            List <string> lstTemp = new List <string>();

            lstTemp.Add("Jupiter");
            VariableList variableList = new VariableList("TestList", lstTemp);

            //Act
            eImageType eImageType = variableList.Image;

            //Assert
            Assert.AreEqual(eImageType.VariableList, eImageType, "Image Type");
        }
Ejemplo n.º 27
0
        internal void OutE(GremlinVariable lastVariable, List <string> edgeLabels)
        {
            GremlinVariableProperty       sourceProperty = lastVariable.GetVariableProperty(GremlinKeyword.NodeID);
            GremlinVariableProperty       adjEdge        = lastVariable.GetVariableProperty(GremlinKeyword.EdgeAdj);
            GremlinVariableProperty       labelProperty  = lastVariable.GetVariableProperty(GremlinKeyword.Label);
            GremlinBoundEdgeTableVariable outEdgeTable   = new GremlinBoundEdgeTableVariable(sourceProperty, adjEdge, labelProperty, WEdgeType.OutEdge);

            VariableList.Add(outEdgeTable);
            TableReferences.Add(outEdgeTable);
            AddLabelPredicateForEdge(outEdgeTable, edgeLabels);

            AddPath(new GremlinMatchPath(lastVariable, outEdgeTable, null));
            SetPivotVariable(outEdgeTable);
        }
Ejemplo n.º 28
0
        protected ExpressionToBDD(ProbModel model)
        {
            this.allRowVars      = model.allRowVars;
            this.allColVars      = model.allColVars;
            this.allRowVarRanges = model.allRowVarRanges;
            this.varIdentities   = model.varIdentities;
            this.varList         = model.varList;
            this.varEncodings    = model.varEncodings;
            this.trans           = model.trans;
            this.start           = model.start;

            this.stateRewards = model.stateRewards;
            this.transRewards = model.transRewards;
        }
Ejemplo n.º 29
0
        public void ListVar_TestRandomGenerateAutoValueNotExists()
        {
            //Arrange
            List <string> lstTemp      = new List <string>();
            VariableList  variableList = new VariableList("TestList", lstTemp);

            variableList.RandomOrder = true;

            //Act
            variableList.GenerateAutoValue();

            //Assert
            Assert.IsFalse(lstTemp.Contains("Dummy"), "Random GenerateAutoValue");
        }
Ejemplo n.º 30
0
        public ProbModel(CUDDNode trans, CUDDNode start, List <CUDDNode> stateRewards, List <CUDDNode> transRewards, CUDDVars allRowVars, CUDDVars allColVars,
                         VariableList varList, CUDDNode allRowVarRanges, List <CUDDNode> varIdentities, List <CUDDNode> varEncodings)
        {
            this.trans        = trans;
            this.start        = start;
            this.stateRewards = stateRewards;
            this.transRewards = transRewards;

            this.allRowVars      = allRowVars;
            this.allColVars      = allColVars;
            this.varList         = varList;
            this.allRowVarRanges = allRowVarRanges;
            this.varIdentities   = varIdentities;
            this.varEncodings    = varEncodings;
        }
Ejemplo n.º 31
0
        private void AddListVariable(VariableStore vs, DataGridView dgv)
        {
            VariableList v       = new VariableList();
            string       varname = "";

            v = (VariableList)OpenVariableEditor(v, ref varname, true);
            if (v != null)
            {
                lock (vs.List)
                {
                    vs.List[varname] = v;
                }
                RefreshListVariables(vs, dgv);
            }
        }
Ejemplo n.º 32
0
        private void btnListAdd_Click(object sender, EventArgs e)
        {
            VariableList v       = new VariableList();
            string       varname = "";

            v = (VariableList)OpenVariableEditor(v, ref varname, true);
            if (v != null)
            {
                lock (plug.listvariables)
                {
                    plug.listvariables[varname] = v;
                }
                RefreshListVariables();
            }
        }
Ejemplo n.º 33
0
        internal void PopulateGremlinPath()
        {
            if (IsPopulateGremlinPath)
            {
                return;
            }

            GremlinPathVariable newVariable = new GremlinPathVariable(GetCurrAndChildGremlinStepList());

            VariableList.Add(newVariable);
            TableReferences.Add(newVariable);
            CurrentContextPath = newVariable;

            IsPopulateGremlinPath = true;
        }
Ejemplo n.º 34
0
        internal void BothE(GremlinVariable lastVariable, List <string> edgeLabels)
        {
            GremlinVariableProperty       sourceProperty = lastVariable.GetVariableProperty(GremlinKeyword.NodeID);
            GremlinVariableProperty       adjReverseEdge = lastVariable.GetVariableProperty(GremlinKeyword.ReverseEdgeAdj);
            GremlinVariableProperty       adjEdge        = lastVariable.GetVariableProperty(GremlinKeyword.EdgeAdj);
            GremlinVariableProperty       labelProperty  = lastVariable.GetVariableProperty(GremlinKeyword.Label);
            GremlinBoundEdgeTableVariable bothEdgeTable  = new GremlinBoundEdgeTableVariable(sourceProperty, adjEdge, adjReverseEdge, labelProperty,
                                                                                             WEdgeType.BothEdge);

            VariableList.Add(bothEdgeTable);
            TableReferences.Add(bothEdgeTable);
            AddLabelPredicateForEdge(bothEdgeTable, edgeLabels);

            SetPivotVariable(bothEdgeTable);
        }
Ejemplo n.º 35
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ShowGauges"/> class with the specified
        /// initially selected <see cref="ResourceClass"/> and <see cref="GaugeDisplay"/> flags.
        /// </summary>
        /// <param name="resource"><para>
        /// The identifier of the <see cref="ResourceClass"/> to select initially. Possible values
        /// include the pseudo-resources <see cref="ResourceClass.StandardMorale"/> and <see
        /// cref="ResourceClass.StandardStrength"/>.
        /// </para><para>-or-</para><para>
        /// A null reference to select the <see cref="ResourceClass.StandardStrength"/>
        /// pseudo-resource.</para></param>
        /// <param name="flags">
        /// A <see cref="GaugeDisplay"/> value indicating which display flags to select initially.
        /// </param>

        public ShowGauges(string resource, GaugeDisplay flags)
        {
            InitializeComponent();

            Resource      = resource;
            ResourceFlags = flags;

            // read specified display flags into check boxes
            NeverToggle.IsChecked  = String.IsNullOrEmpty(resource);
            AlwaysToggle.IsChecked = ((flags & GaugeDisplay.Always) != 0);
            StackToggle.IsChecked  = ((flags & GaugeDisplay.Stack) != 0);

            // adjust column width of Resource list view
            DependencyPropertyDescriptor.FromProperty(
                ListView.ActualWidthProperty, typeof(ListView))
            .AddValueChanged(VariableList, OnVariableWidthChanged);

            // show standard unit resources
            VariableList.Items.Add(ResourceClass.StandardStrength);
            VariableList.Items.Add(ResourceClass.StandardMorale);
            VariableList.AddSeparator();

            // show all scenario resources
            foreach (VariableClass variable in MasterSection.Instance.Variables.Resources.Values)
            {
                VariableList.Items.Add(variable);
            }

            // select specified resource, if any
            if (resource != null)
            {
                foreach (object item in VariableList.Items)
                {
                    VariableClass variable = item as VariableClass;
                    if (variable != null && variable.Id == resource)
                    {
                        VariableList.SelectAndShow(variable);
                        break;
                    }
                }
            }

            // select standard strength by default
            if (VariableList.SelectedItems.Count == 0)
            {
                VariableList.SelectAndShow(0);
            }
        }
    /// <summary>
    /// Execute this command.
    /// </summary>
    /// <param name="variables">The variable list of the calling code.</param>
    public override void Execute(VariableList variables)
    {
      string[] processed = ProcessParameters(variables, Parameters);

      GUIMessage.MessageType type = (GUIMessage.MessageType) Enum.Parse(typeof (GUIMessage.MessageType), processed[0]);
      int windowId = int.Parse(processed[1]);
      int senderId = int.Parse(processed[2]);
      int controlId = int.Parse(processed[3]);
      int param1 = int.Parse(processed[4]);
      int param2 = int.Parse(processed[5]);

      GUIMessage message = new GUIMessage(type, windowId, senderId, controlId, param1, param2, null);

      GUIGraphicsContext.ResetLastActivity();
      GUIWindowManager.SendThreadMessage(message);
    }
Ejemplo n.º 37
0
        public void ListVar_TestResetIndexValue()
        {
            //Arrange
            List <string> lstTemp = new List <string>();

            lstTemp.Add("Friend");
            lstTemp.Add("Love");
            VariableList variableList = new VariableList("TestList", lstTemp);

            //Act
            variableList.ResetValue();

            //Assert
            Assert.AreEqual(0, variableList.CurrentValueIndex, "On Reset Index Value repositioned to 0");
            Assert.AreEqual(lstTemp[0], variableList.Value, "Reset Index Value");
        }
Ejemplo n.º 38
0
        /// <summary>
        /// Execute this command.
        /// </summary>
        /// <param name="variables">The variable list of the calling code.</param>
        public override void Execute(VariableList variables)
        {
            string[] processed = ProcessParameters(variables, Parameters);

            GUIMessage.MessageType type = (GUIMessage.MessageType)Enum.Parse(typeof(GUIMessage.MessageType), processed[0]);
            int windowId  = int.Parse(processed[1]);
            int senderId  = int.Parse(processed[2]);
            int controlId = int.Parse(processed[3]);
            int param1    = int.Parse(processed[4]);
            int param2    = int.Parse(processed[5]);

            GUIMessage message = new GUIMessage(type, windowId, senderId, controlId, param1, param2, null);

            GUIGraphicsContext.ResetLastActivity();
            GUIWindowManager.SendThreadMessage(message);
        }
Ejemplo n.º 39
0
        public override void Deserialize(PackedStream_2 stream)
        {
            base.hasValue  = true;
            this.Variables = new VariableList();
            DeserializeClass class2 = new DeserializeClass(stream, 1);

            for (uint i = 0; i < class2.Count; i++)
            {
                ulong        num2;
                int          num5;
                HeroFieldDef definition;
                HeroAnyValue value2;
                uint         num3       = 0;
                int          variableId = 0;
                class2.ReadFieldData(out num2, ref num3, ref variableId, out num5);
                if (num5 == 2)
                {
                    continue;
                }
                HeroType     type  = new HeroType((HeroTypes)num3);
                DefinitionId field = new DefinitionId(num2);
                if (field.Definition != null)
                {
                    definition = field.Definition as HeroFieldDef;
                    HeroTypes types = definition.FieldType.Type;
                    if (types != HeroTypes.Enum)
                    {
                        if (types == HeroTypes.LookupList)
                        {
                            goto Label_0096;
                        }
                        if (types != HeroTypes.ScriptRef)
                        {
                            goto Label_009F;
                        }
                    }
                    type.Id = definition.FieldType.Id;
                }
                goto Label_009F;
Label_0096:
                type = definition.FieldType;
Label_009F:
                value2 = HeroAnyValue.Create(type);
                value2.Deserialize(stream);
                this.Variables.Add(new Variable(field, variableId, value2));
            }
        }
Ejemplo n.º 40
0
    /// <summary>
    /// Execute this command.
    /// </summary>
    /// <param name="variables">The variable list of the calling code.</param>
    public override void Execute(VariableList variables)
    {
      GUIDialogNotify dlgNotify =
        (GUIDialogNotify) GUIWindowManager.GetWindow((int) GUIWindow.Window.WINDOW_DIALOG_NOTIFY);
      if (dlgNotify == null)
        throw new CommandExecutionException("Failed to create GUIDialogNotify");

      string[] processed = ProcessParameters(variables, Parameters);

      int timeout = int.Parse(processed[2]);

      dlgNotify.Reset();
      dlgNotify.ClearAll();
      dlgNotify.SetHeading(processed[0]);
      dlgNotify.SetText(processed[1]);
      dlgNotify.TimeOut = timeout;

      dlgNotify.DoModal(GUIWindowManager.ActiveWindow);
    }
Ejemplo n.º 41
0
        public override string go()
        {
            SyntaxError error = null;
               string s = null;
               Lexema l = getToken();
               if (l.GetType().Name == "Var")
               {
               while ((l=getToken())!=null&&l.GetType().Name!="Endl")
               {
                   string type=l.GetType().Name;
                   if (type == "Begin")
                   {
                       addError(new EndlMissedError(), 0);
                       break;
                   }
                   lexems.Add(l);
               }
               if (l==null)
               {
                   addError(new EndlMissedError(), 0);
               }
               string result = "SEG1 SEGMENT\n";
               s = new VariableList(this).go();
               if (s == null)
               {
                   error = new VariableListMissedError();

               }
               else
               {
                   result += s+"\n";
                   result += "SEG1 ENDS\n";
                   s = result;
               }

            }

               return s;
        }
Ejemplo n.º 42
0
    /// <summary>
    /// Execute this command.
    /// </summary>
    /// <param name="variables">The variable list of the calling code.</param>
    public override void Execute(VariableList variables)
    {
      bool mpBasicHome = false;
      using (Settings xmlreader = new Settings(MPCommon.MPConfigFile))
        mpBasicHome = xmlreader.GetValueAsBool("general", "startbasichome", false);

      GUIGraphicsContext.ResetLastActivity();
      // Stop all media before suspending
      g_Player.Stop();

      GUIMessage msg;

      if (mpBasicHome)
        msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_GOTO_WINDOW, 0, 0, 0,
                             (int) GUIWindow.Window.WINDOW_SECOND_HOME, 0, null);
      else
        msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_GOTO_WINDOW, 0, 0, 0, (int) GUIWindow.Window.WINDOW_HOME, 0,
                             null);

      GUIWindowManager.SendThreadMessage(msg);

      WindowsController.ExitWindows(RestartOptions.Suspend, false);
    }
Ejemplo n.º 43
0
 /// <summary>
 /// Execute this command.
 /// </summary>
 /// <param name="variables">The variable list of the calling code.</param>
 public override void Execute(VariableList variables)
 {
   string[] processed = ProcessParameters(variables, Parameters);
   int port = int.Parse(processed[1]);
   SendWOL(processed[0], port, processed[2]);
 }
 /// <summary>
 /// Execute this command.
 /// </summary>
 /// <param name="variables">The variable list of the calling code.</param>
 public override void Execute(VariableList variables)
 {
   if (!Application.SetSuspendState(PowerState.Hibernate, false, false))
     throw new CommandExecutionException("Hibernate command refused");
 }
Ejemplo n.º 45
0
 private void AddVariables(VariableList variables, int indent)
 {
     foreach (Variable variable in variables)
     {
         string name;
         if (variable.Field.Definition != null)
         {
             name = variable.Field.Definition.Name;
         }
         else
         {
             name = string.Format("0x{0:X}", variable.Field.Id);
         }
         ListViewItem item = this.listViewVariables.Items.Add(name);
         item.IndentCount = indent;
         item.SubItems.Add(variable.Value.Type.ToString());
         this.SetValueText(variable.Value, indent, item);
         item.Tag = variable;
     }
 }
Ejemplo n.º 46
0
 /// <summary>
 /// Execute this command.
 /// </summary>
 /// <param name="variables">The variable list of the calling code.</param>
 public override void Execute(VariableList variables)
 {
   GUIGraphicsContext.OnAction(new Action(Action.ActionType.ACTION_EXIT, 0, 0));
 }
Ejemplo n.º 47
0
 /// <summary>
 /// Execute this command.
 /// </summary>
 /// <param name="variables">The variable list of the calling code.</param>
 public override void Execute(VariableList variables)
 {
   if (!Win32.WindowsExit(Win32.ExitWindows.LogOff, Win32.ShutdownReasons.FlagUserDefined))
     throw new CommandExecutionException("LogOff command refused");
 }
Ejemplo n.º 48
0
 /// <summary>
 /// Execute this command.
 /// </summary>
 /// <param name="variables">The variable list of the calling code.</param>
 public override void Execute(VariableList variables)
 {
   string[] processed = ProcessParameters(variables, Parameters);
   int timeout = int.Parse(processed[0]);
   Thread.Sleep(timeout);
 }
Ejemplo n.º 49
0
    /// <summary>
    /// Initializes a new instance of the <see cref="Processor"/> class.
    /// </summary>
    /// <param name="blastIrDelegate">The blast ir delegate.</param>
    /// <param name="blastIrPorts">The blast ir ports.</param>
    public Processor(BlastIrDelegate blastIrDelegate, string[] blastIrPorts)
    {
      _variables = new VariableList();

      _blastIrDelegate = blastIrDelegate;
      _blastIrPorts = blastIrPorts;
    }
Ejemplo n.º 50
0
 private static VariableList makeFromTable(DataTable tbl)
 {
     VariableList list = new VariableList();
     foreach (DataRow r in tbl.Rows)
     {
         list.Add(new Variable(r));
     }
     return list;
 }
 /// <summary>
 /// Execute this command.
 /// </summary>
 public override void Execute(VariableList variables)
 {
   variables.VariableClear();
 }