/// <summary>
	/// Sets the parameters of the bullet
	/// </summary>
	/// <param name="targetPosition">Target position.</param>
	/// <param name="ioClass">The game InputOutput class.</param>
	/// <param name="explodes">If set to <c>true</c> explodes upon reaching target.</param>
	/// <param name="recallOnFinish">If set to <c>true</c> changes bulletsComplete (in ioClass) to true on finish.</param>
	/// <param name="waitSeconds">Wait seconds before beginning to move.</param>
	/// <param name="explosionPrefab">Explosion Gameobject prefab.</param>
	public void setParameters(Vector3 targetPosition, InputOutput ioClass, bool explodes, bool recallOnFinish, float waitSeconds, GameObject explosionPrefab) {
		this.targetPosition = targetPosition;
		this.ioClass = ioClass;
		this.explodes = explodes;
		this.recallOnFinish = recallOnFinish;
		this.waitSeconds = waitSeconds;
		this.explosionPrefab = explosionPrefab;
	}
	public EventSystem eventSystem; //Added by Alisdair 14/9/14

	void Start()
	{
		//Create a reference to the Game
		gameController = GameObject.FindWithTag ("GameController").GetComponent<Game>();
		
		//Create a reference to the GameController's InputHandler
		inputHandlerController = GameObject.FindWithTag ("GameController").GetComponent<InputHandler> ();
		ioController = GameObject.FindWithTag ("GameController").GetComponent<InputOutput> ();

		//Find the event system Added By Alisdair 14/9/14
		eventSystem = GameObject.FindWithTag ("EventSystem").GetComponent<EventSystem>();
	}
Exemple #3
0
 private void buttonRestoreTrees_Click(object sender, EventArgs e)
 {
     try
     {
         workingTree.Clear();
         workingTree = (RedBlackTree <int>)InputOutput.LoadFromFile(GetWorkingTreeName() + ".dat");
         UpdateLabelCountOfTrees();
         toolStripStatusLabel1.Text = "Рабочее дерево было восстановлено";
     }
     catch (Exception ee)
     {
         MessageBox.Show(ee.Message, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         toolStripStatusLabel1.Text = ee.Message;
         UpdateLabelCountOfTrees();
     }
 }
        public void GetMarsRovers_TwoValidInput_TwoMarsRovers()
        {
            var test          = @"5 5
1 2 N
LMLMLMLMM
3 3 E
MMRMMRMRRM
";
            var expectedCount = 2;
            var sut           = new InputOutput(test);

            var actual = sut.GetMarsRovers();


            Assert.AreEqual(expectedCount, actual.Count);
        }
 public async Task <bool> ValidateConnection(InputOutput output, InputOutput input)
 {
     string[] startEnd = new[] { "START", "END" };
     if (output.GetType() == input.GetType() ||
         output.Action.Data.Id.Equals(input.Action.Data.Id) ||
         (startEnd.Contains(output.Action.Data.Id) && startEnd.Contains(input.Action.Data.Id)))
     {
         return(false);
     }
     try {
         await WebsocketManager.Instance.AddLogicItem(output.Action.Data.Id, input.Action.Data.Id, true);
     } catch (RequestFailedException) {
         return(false);
     }
     return(true);
 }
                // Update current enum according to FSTEnum
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
//ORIGINAL LINE: void updateEnum(final util.fst.BytesRefFSTEnum.InputOutput<FSTTermOutputs.TermData> pair)
                internal void updateEnum(InputOutput <FSTTermOutputs.TermData> pair)
                {
                    if (pair == null)
                    {
                        term_Renamed = null;
                    }
                    else
                    {
                        term_Renamed        = pair.input;
                        meta                = pair.output;
                        state.docFreq       = meta.DOC_FREQ;
                        state.totalTermFreq = meta.TOTAL_TERM_FREQ;
                    }
                    decoded     = false;
                    seekPending = false;
                }
        private void FromKeyBorad_Click(object sender, EventArgs e)
        {
            string line = inputTextBox.Text;

            //Console.WriteLine("line :" + line);
            alogrithm.Analyze(line);
            MessageBox.Show("运行完成");
            stackOutput.Clear();
            InputOutput.Clear();
            LogOutput.Clear();
            log                  = alogrithm.FetchOutput();
            outputLine           = 0;
            finishButton.Enabled = true;
            NextStep.Enabled     = true;
            //Thread.Sleep(500);
        }
        public void GetMarsRovers_OneValidInputAndEmptyLines_OneMarsRover()
        {
            var test          = @"5 5
1 2 N
LMLMLMLMM


";
            var expectedCount = 1;
            var sut           = new InputOutput(test);

            var actual = sut.GetMarsRovers();


            Assert.AreEqual(expectedCount, actual.Count);
        }
        public BitmapImage GetPreviewBitmapImage(int x, int y, InputOutput ioput)
        {
            System.Drawing.Bitmap bmp = GetPreviewBitmap(x, y, ioput);

            // Return as a BitmapImage
            MemoryStream ms = new MemoryStream();

            bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
            ms.Position = 0;
            BitmapImage bi = new BitmapImage();

            bi.BeginInit();
            bi.StreamSource = ms;
            bi.EndInit();
            return(bi);
        }
Exemple #10
0
        private void IOPart_Load(object sender, EventArgs e)
        {
            InputOutput IOControl = new InputOutput(DeviceRsDef.InputList, DeviceRsDef.OutputList);

            IOControl.TopLevel        = false;
            IOControl.FormBorderStyle = FormBorderStyle.None;
            IOControl.Size            = panelForIO.Size;
            IOControl.Parent          = panelForIO;
            IOControl.Dock            = DockStyle.Fill;
            IOControl.Show();
            IOControl.doubleBufferListview1.Columns[0].Width = panelForIO.Width / 2 / 5 * 1 - 15;
            IOControl.doubleBufferListview1.Columns[1].Width = panelForIO.Width / 2 / 5 * 3;
            IOControl.doubleBufferListview1.Columns[2].Width = panelForIO.Width / 2 / 5 * 1 - 10;
            IOControl.doubleBufferListview2.Columns[0].Width = panelForIO.Width / 2 / 5 * 1 - 15;
            IOControl.doubleBufferListview2.Columns[1].Width = panelForIO.Width / 2 / 5 * 3;
            IOControl.doubleBufferListview2.Columns[2].Width = panelForIO.Width / 2 / 5 * 1 - 10;
        }
Exemple #11
0
        static void Main(string[] args)
        {
            //string FileLocation = @"C:\Users\andika.r\source\repos\NameSorter\unsorted-names-list.txt";
            ResultModel result       = new ResultModel();
            string      Dir          = ConfigurationSettings.AppSettings.Get("Folder");
            string      FileLocation = Dir + "/unsorted-names-list.txt";
            SortingName sorting      = new SortingName();

            result = sorting.SortList(FileLocation);
            InputOutput io = new InputOutput();

            io.writeToText(result.Content);
            io.PrintToScreenConsole(result.Content);

            Console.WriteLine("Press anything to exit");
            Console.ReadLine();
        }
Exemple #12
0
        private void RunLeMP(IList <string> args, string inputCode, string inputPath)
        {
            var KnownOptions = LeMP.Compiler.KnownOptions;
            var sink         = MessageSink.FromDelegate(WriteMessage);
            var sourceFile   = new InputOutput((UString)inputCode, inputPath);
            var c            = new Compiler(sink, sourceFile);
            var options      = c.ProcessArguments(args, true, false);

            if (args.Count != 0)
            {
                sink.Error("Command line", "'{0}': Opening other source files is not supported", args[0]);
            }
            string _;

            if (options.TryGetValue("help", out _) || options.TryGetValue("?", out _))
            {
                var ms = new MemoryStream();
                LeMP.Compiler.ShowHelp(LeMP.Compiler.KnownOptions, new StreamWriter(ms));
                string output = Encoding.UTF8.GetString(ms.GetBuffer(), 0, (int)ms.Length);
                _outFileName = null;
                ShowOutput(output);
            }
            else
            {
                if (inputPath.EndsWith(".les", StringComparison.OrdinalIgnoreCase))
                {
                    c.MacroProcessor.PreOpenedNamespaces.Add(GSymbol.Get("LeMP.Prelude.Les"));
                }

                LempStarted = true;
                new Thread(() => {
                    try {
                        // Help user code send messages to error list via MessageSink.Default.
                        // `compileTime` already uses `using` to change the default sink to the
                        // macro context, but this doesn't work in macros or events because they
                        // execute after the `compileTime` or `macro` block has ended.
                        using (MessageSink.SetDefault(sink))
                            c.Run();
                        // Must get OutFileName after calling Run()
                        _outFileName = sourceFile.OutFileName;
                        ShowOutput(c.Output.ToString());
                    } finally { LempStarted = false; }
                }).Start();
            }
        }
        /// <summary>
        /// Encrypts a text to a picture and saves it
        /// </summary>
        /// <param name="openFilePath">Path from were the picture gets loaded</param>
        /// <param name="encryptText">The text which gets hidden in the picture</param>
        /// <param name="seed"></param>
        /// <param name="bits"></param>
        public async Task Encrypt(string openFilePath, string encryptText, int seed, int bits)
        {
            await WaitDialogHelper.ExecuteThreadAsync("Encrypt Message", () =>
            {
                string saveFilePath = RuntimeGlobals.ShowSaveFileDialog("PNG Image (*.png)|*.png", RuntimeGlobals.Settings.SavePath);

                if (string.IsNullOrEmpty(saveFilePath))
                {
                    return;
                }
                if (!InputOutput.CheckPathIsValidImage(saveFilePath))
                {
                    throw new FileFormatException();
                }
                if (saveFilePath.Equals(openFilePath))
                {
                    throw new FileLoadException();
                }

                var image = Interface.Encrypt((BitmapImage)ImageSource, ChannelUsage.Default, seed, encryptText);
                InputOutput.SaveImageToFile(saveFilePath, image);
                GC.Collect();
            }, exception =>
            {
                if (exception != null)
                {
                    if (exception is OutOfMemoryException)
                    {
                        ErrorHelper.Add(6, exception.Message, exception.StackTrace);
                    }
                    else if (exception is FileFormatException)
                    {
                        ErrorHelper.Add(4);
                    }
                    else if (exception is FileLoadException)
                    {
                        ErrorHelper.Add(5);
                    }
                    else
                    {
                        ErrorHelper.Add(3, exception.GetType() + "\n" + exception.Message, exception.StackTrace);
                    }
                }
            });
        }
        public void GetMarsRovers_TwoValidRoversInput_ExpectedOutput()
        {
            var test     = @"5 5
1 2 N
LMLMLMLMM
3 3 E
MMRMMRMRRM
";
            var expected = @"1 3 N
5 1 E
";

            var sut = new InputOutput(test);

            var actual = sut.GetOutput();

            Assert.AreEqual(expected, actual);
        }
        /// <summary>
        /// Corresponde a la funcion que cumple el boton Stats.
        /// </summary>
        /// <param name="sender">parametro requerido para el correcto funcionamiento del evento.</param>
        /// <param name="e">parametro requerido para el correcto funcionamiento del evento.</param>
        private void StatsButtonCallback(object sender, System.EventArgs e)
        {
            int[] ratings = InputOutput.GetRatings();

            if (ratings[0] == -1)
            {
                richTextBox1.Text += "No existen evaluaciones que analizar.\n";
                return;
            }

            int    timesEvaluated = ratings.Length;
            double average        = Utilities.GetAverage(ratings);
            int    bestRate       = Utilities.Max(ratings);
            int    worstRate      = Utilities.Min(ratings);

            RatingStatsWindow dialog = new RatingStatsWindow(average, worstRate, bestRate, timesEvaluated);
            var dialogResult         = dialog.ShowDialog();
        }
Exemple #16
0
 public MainPage()
 {
     this.InitializeComponent();
     Application.Current.Resuming += new EventHandler <Object>(App_Resuming);
     BackButton.Visibility         = Visibility.Collapsed;
     MyFrame.Navigate(typeof(PageEstado));
     Estado.IsSelected   = true;
     TitleTextBlock.Text = "Estado del Sistema";
     InputOutput.CargarConfiguracion();
     if (App.arduinoConectado)
     {
         StatConexion.Foreground = new SolidColorBrush(Windows.UI.Colors.Green);
     }
     else
     {
         StatConexion.Foreground = new SolidColorBrush(Windows.UI.Colors.Red);
     }
 }
Exemple #17
0
        public void SaveMap()
        {
            String loadPath = "city01.map";
            String savePath = "city01-saved.map";

            Assert.IsTrue(File.Exists(loadPath), "'" + loadPath + "' should exist, but doesn't.");
            Assert.IsFalse(File.Exists(savePath), "'" + savePath + "' should exist, but does.");

            Map myMap = InputOutput.ReadMap(loadPath);

            FileInfo saveFileInfo = new FileInfo(savePath);

            InputOutput.WriteMap(saveFileInfo, myMap);

            Assert.IsTrue(File.Exists(savePath));

            File.Delete(savePath);
        }
Exemple #18
0
        public int DeleteAddress()
        {
            int            response  = 0;
            Address        addr      = new Address();
            List <Address> addresses = new List <Address>();

            try
            {
                addr     = GetLastAddress();
                response = Delete(addr);

                if (response == 1)
                {
                    addresses    = GetAddresses();
                    addr         = addresses.OrderByDescending(a => a.StartDate).First();
                    addr.EndDate = DateTime.Parse("9999-12-31");

                    response = Update(addr);

                    if (response != 1)
                    {
                        throw new Exception("Update operation affected other than one row.");
                    }
                }
                else
                {
                    throw new Exception("Delete operation affected other than one row.");
                }
            }
            catch (Exception ex)
            {
                InputOutput logger = InputOutput.GetInstance();

                ex.Data.Add("Class:", "DataRepo");
                ex.Data.Add("Method:", "DeleteAddress()");
                ex.Data.Add("StartDate:", addr.StartDate);
                ex.Data.Add("EndDate:", addr.EndDate);
                ex.Data.Add("Address:", addr.Address1);

                logger.WriteLogFile(ex);
            }

            return(response);
        }
Exemple #19
0
        public void BinarySearch_LoadsEmptyTextFile_ReturnsEmptyDictionary()
        {
            WordExtractor extractor = new WordExtractor();

            string path1 = $"{AppDomain.CurrentDomain.BaseDirectory}TestFiles\\EmptyTextFile.txt";
            string text1 = InputOutput.ReadFile(path1);

            extractor.ExtractWordsFromTextFile(text1, path1);

            List <Word> list = extractor.GetCompoundedList();

            SearchEngine <Word> .QuickSort(list, 0, list.Count - 1);

            var result = SearchEngine <Word> .BinarySearch(list, true, "");

            Dictionary <string, int> expected = new Dictionary <string, int>();

            Assert.AreEqual(expected, result);
        }
Exemple #20
0
        public void BinarySearch_LoadsNull_ReturnsEmptyDictionary()
        {
            WordExtractor extractor = new WordExtractor();

            string path1 = null;
            string text1 = InputOutput.ReadFile(path1);

            extractor.ExtractWordsFromTextFile(text1, path1);

            List <Word> list = extractor.GetCompoundedList();

            SearchEngine <Word> .QuickSort(list, 0, list.Count - 1);

            var result = SearchEngine <Word> .BinarySearch(list, true, "could");

            Dictionary <string, int> expected = new Dictionary <string, int>();

            Assert.AreEqual(expected, result);
        }
Exemple #21
0
        public void WhenGetCustomerInfoRequestFromXMLString_ThenReturnCustomerInfoRequestObjectAndImages()
        {
            var path = Path.Combine(Directory.GetCurrentDirectory(), "Test");

            string[] files = InputOutput.ReadFilesFromFolder(path);

            Assert.AreEqual(1, files.Length);

            var file      = files[0];
            var xmlString = InputOutput.ReadFileContent(file);

            Assert.IsNotNull(xmlString);

            CustomerInfoRequest obj = Serializer.GetCustomerInfoRequest(xmlString);

            Assert.IsNotNull(obj);
            Assert.IsNotNull(obj.MatchedImage);
            Assert.IsNotNull(obj.capturedImage);
        }
Exemple #22
0
        public static double[][] GetAudioBuffers(int deviceId, InputOutput inputOutput, int channelCount, int bufferSize)
        {
            var buffers        = inputOutput == InputOutput.Input ? InputAudioBuffers : OutputAudioBuffers;
            var existingBuffer = buffers[deviceId];

            if (existingBuffer == null || existingBuffer.Length != channelCount || (channelCount > 0 && existingBuffer[0].Length != bufferSize))
            {
                var newBuf = new double[channelCount][];
                for (int i = 0; i < channelCount; i++)
                {
                    newBuf[i] = new double[bufferSize];
                }

                buffers[deviceId] = newBuf;
                existingBuffer    = newBuf;
            }

            return(existingBuffer);
        }
 private void finishButton_Click(object sender, EventArgs e)
 {
     while (outputLine < log[logKey].Count())
     {
         string output = log[logKey][outputLine];
         if (output[0] == '#')
         {
             string[] word = output.Replace("#", "").Split('_');
             stackOutput.AppendText(word[0] + "\r\n");
             InputOutput.AppendText(word[1] + "\r\n");
         }
         else
         {
             LogOutput.AppendText(log[logKey][outputLine] + "\r\n");
         }
         outputLine++;
     }
     NextStep.Enabled     = false;
     finishButton.Enabled = false;
 }
        // Create some courses, write them, and check against a dump.
        void CreateOcadFiles(OcadCreationSettings settings, string[] expectedOcadFiles, params RectangleF[] expectedPrintRectangles)
        {
            for (int i = 0; i < expectedOcadFiles.Length; ++i)
            {
                File.Delete(expectedOcadFiles[i]);
            }

            bool success = controller.CreateOcadFiles(settings);

            Assert.IsTrue(success);

            for (int i = 0; i < expectedOcadFiles.Length; ++i)
            {
                Map newMap = new Map(new GDIPlus_TextMetrics(), null);
                using (newMap.Write())
                    InputOutput.ReadFile(expectedOcadFiles[i], newMap);
                using (newMap.Read())
                    TestUtil.AssertEqualRect(expectedPrintRectangles[i], newMap.PrintArea, 0.02F, "ocad imported print area");
            }
        }
Exemple #25
0
            public void CanCallAsyncWithRefParameterNonQuery()
            {
                var ctx = CreateNonQuery(parms =>
                {
                    var parm = ((IDbDataParameter)parms[0]);
                    Assert.AreEqual(ParameterDirection.InputOutput, parm.Direction, "Not passed as InputOutput");
                    Assert.AreEqual(16, (int)parm.Value, "Ref parameter not passed to SP");
                    parm.Value = 42;
                });

                var toTest = new DynamicStoredProcedure(ctx, transformers, CancellationToken.None, TEST_TIMEOUT, DynamicExecutionMode.Asynchronous, false);

                var inputOutput = new InputOutput {
                    Value = 16
                };

                Call(toTest, inputOutput).Wait();

                Assert.AreEqual(42, inputOutput.Value, "Ref parameter not set.");
            }
Exemple #26
0
            public void CanExecuteAsyncWithRefParameterValue()
            {
                var ctx = CreatePeople(parms =>
                {
                    var parm = ((IDbDataParameter)parms[0]);
                    Assert.AreEqual(ParameterDirection.InputOutput, parm.Direction, "Not passed as InputOutput");
                    Assert.AreEqual(22, (int)parm.Value, "Ref parameter not passed to SP");
                    parm.Value = 42;
                }, "Bar", "Baz");

                var toTest = new DynamicStoredProcedure(ctx, transformers, CancellationToken.None, TEST_TIMEOUT, DynamicExecutionMode.Asynchronous, true);

                var inout = new InputOutput {
                    Value = 22
                };
                var people = GetPeople(toTest, inout).Result;

                Assert.AreEqual(42, inout.Value, "Ref parameter not set.");
                Assert.IsTrue(people.Select(p => p.FirstName).SequenceEqual(new[] { "Bar", "Baz" }));
            }
Exemple #27
0
        public IEnumerator RotationToLeftAndMoveForward([ValueSource(nameof(_inputOutputsTestCase))]
                                                        InputOutput testData)
        {
            Vector2 forwardDirection  = testData.Direction;
            float   directionToRotate = testData.Rotation;

            var player          = _gameObject;
            var defaultPosition = player.transform.position;

            _facadeToMove.SetAngleToRotate(directionToRotate);
            yield return(new WaitForSeconds(_microDelay));

            _facadeToMove.SetDirectionToMove(forwardDirection);
            yield return(new WaitForSeconds(_microDelay));

            var actualPosition = player.transform.position;

            Assert.AreEqual((defaultPosition.y < actualPosition.y), testData.PositiveYAxis);
            Assert.AreEqual((defaultPosition.x < actualPosition.x), testData.PositiveXAxis);
        }
Exemple #28
0
        //public event EventHandler Resize;

        public PageRiego()
        {
            this.InitializeComponent();            
            timerRiego.Interval = new TimeSpan(0, 0, 1);
            timerRiego.Tick += TimerRiego_Tick;
            PageRiego_cs.SizeChanged += PageRiego_Resize;
            BarRiego.Width = Window.Current.Bounds.Width - 150;
            
            if (App.arduinoConectado)
            {
                UpdateUI();
                if (BtnRegar.IsChecked == false)     // despues de actualizar UI, si el boton no esta presionado entonces no se esta regando
                {
                    InputOutput.ConfiguarControlador("Arduino riego");
                }
                else
                {
                    App.pageResuming = true;
                }
        }
Exemple #29
0
 /// <summary>
 /// Views fleet(s)
 /// </summary>
 /// <param name="parameters">(0): "all" | <see cref="int"/> branchNumber, (1): "all" | <see cref="int"/> fleetNumber</param>
 /// <returns></returns>
 internal static ReturnValue ViewFleet(IEnumerable <string> parameters)
 {
     if (parameters.ElementAtOrDefault(0).AllOrNullOrEmpty())
     {
         return(InputOutput.Print(string.Join("\n", from b in DatabaseObject.Branches
                                              from f in b.Fleets
                                              select f.ToString(false))));
     }
     else if (parameters.ElementAtOrDefault(0).IsValidIndex(DatabaseObject.Branches, out uint branchID))
     {
         Branch branch = DatabaseObject.Branches.ElementAt(branchID);
         return(parameters.ElementAtOrDefault(1).AllOrNullOrEmpty()
                                 ? InputOutput.Print(string.Join("\n", from f in branch.Fleets
                                                                 select f.ToString(false)))
                                 : parameters.ElementAtOrDefault(1).IsValidIndex(branch.Fleets, out uint fleetID)
                                         ? InputOutput.Print(branch.Fleets.ElementAt(fleetID).ToString(true))
                                         : ReturnValue.GetValue(ErrorCodeFlags.IsWrongArgument, null, 1));
     }
     return(ReturnValue.GetValue(ErrorCodeFlags.IsWrongArgument, null, 0));
 }
        public static InputOutput GenerateOutput(this InputOutput model)
        {
            var    result          = model;
            string filePath        = model.ContentCarousel.FilePath;
            string thumbnailImgSrc = filePath + "/" + model.ContentCarousel.Thumbnail;
            string title           = model.ContentCarousel.Title;
            string caption         = model.ContentCarousel.Caption;


            string rawHTML = "";

            rawHTML += "<div class=\"rect\">\n\t<div class=\"owl-carousel owl-theme\">\n\t\t<div class=\"item pl-1 pr-1\">\n\t\t\t<img src=\"img/" + thumbnailImgSrc + "\">\n\t\t</div>\n";
            rawHTML += "\t\t<div class=\"item\">\n\t\t\t<div class=\"textDescription titleCaption\">\n\t\t\t\t<span><strong>" + title + "</strong></span><br />\n\t\t\t\t<p>" + caption + "</p>\n\t\t\t</div>\n\t\t</div>\n";

            // For each slide
            for (int i = 0; i < model.ContentCarousel.Slides.Count; i++)
            {
                rawHTML += "\t<div class=\"item\">\n";
                // For each slide input
                for (int j = 0; j < model.ContentCarousel.Slides[i].Inputs.Count; j++)
                {
                    if (model.ContentCarousel.Slides[i].Inputs[j].Type == "Image")
                    {
                        rawHTML += "\t\t<div class=\"pl-1 pr-1 mb-2\">\n\t\t\t<img src=\"img/" + filePath + "/" + model.ContentCarousel.Slides[i].Inputs[j].Name + "\">\n\t\t</div>\n";
                    }
                    else if (model.ContentCarousel.Slides[i].Inputs[j].Type == "TextBox")
                    {
                        rawHTML += "\t\t<div class=\"textDescription mb-2\">\n";
                        rawHTML += "\t\t\t<p>" + model.ContentCarousel.Slides[i].Inputs[j].Name + "</p>\n";
                        rawHTML += "\t\t</div>\n";
                    }
                }
                rawHTML += "\t</div>\n";
            }


            rawHTML += "</div>\n";

            result.Output = rawHTML;
            return(result);
        }
Exemple #31
0
        public override async ValueTask <bool> WriteTagToPlcAsync(string value)
        {
            //Logger.LogTrace("WriteTagToPlcAsync: 1" + Name + " " + value);
            bool output = false;

            if (InputOutput.Equals("W") || InputOutput.Equals("RW"))
            {
                //Logger.LogTrace("WriteTagToPlcAsync: 2" + Name + " " + value);
                UpdateTagValue(value);
                var connection = (S7Connection)Connection;

                await Connection.WriteSemaphore.WaitAsync();

                try
                {
                    if (connection.WriteEnable)
                    {
                        //Logger.LogTrace("WriteTagToPlcAsync: 2" + Name + " " + value);
                        if (DataItemTag is null)
                        {
                            Logger.LogWarning("WriteTagToPlcAsync DataItemTag is null!");
                            return(false);
                        }

                        await connection.ClientWrite.WriteAsync(DataItemTag).ConfigureAwait(false);

                        output = true;
                    }
                }
                catch (Exception ex)
                {
                    Logger.LogError("WriteTagToPlcAsync: " + Name + " " + value + " " + ex.Message + " - " + ex.StackTrace);
                }
                finally
                {
                    Connection.WriteSemaphore.Release();
                }
            }

            return(output);
        }
 public void Open(InputOutput puckOutput, UnityAction confirmDialog, bool any, bool @true, bool @false)
 {
     Any.gameObject.SetActive(any);
     True.gameObject.SetActive(@true);
     False.gameObject.SetActive(@false);
     if (@true && !@false)
     {
         False.isOn = false;
         Any.isOn   = false;
         True.isOn  = true;
     }
     else if (@false && !@true)
     {
         True.isOn  = false;
         Any.isOn   = false;
         False.isOn = true;
     }
     InputOutput        = puckOutput;
     this.confirmDialog = confirmDialog;
     Open();
 }
Exemple #33
0
        public static IList<InputOutput> GetBatch(IList<InputOutput> set, int size, IRandomGenerator rand)
        {
            var batch = new InputOutput[size];

            for (var i = 0; i < size; i++)
                batch[i] = set[rand.Next(set.Count)];

            return batch;
        }
		private void GenerateCode(Command command, List<Command> insertList)
		{
			switch (command.name)
			{
				case "dcl_2d":
				case "dcl_cube":
				case "dcl_volume":
					//sampler ahoy

					string name = command.args[0][0];

					InputOutput sampler = new InputOutput();
					sampler.index = int.Parse(name.Substring(1));
					sampler.mapping = command.name.Substring(4).ToUpper();
					sampler.name = name;

					this.samplers.Add(sampler);
					return;
			}

			if (command.name == "dcl")
			{
				string type = "TEXCOORD";

				string name = command.args[0][0];

				if (name.EndsWith("_pp")) //xbox doens't support partial precision
					name = name.Substring(0, name.Length - 3);

				if ((profile == ShaderProfile.PS_2_0 ||
					profile == ShaderProfile.PS_2_A ||
					profile == ShaderProfile.PS_2_B) &&
					name.Length > 0 && name[0] == 'v')
				{
					type = "COLOR";
				}

				//pixel shader tex coord input
				inputs.Add(new InputOutput(name, type, int.Parse(name.Substring(1))));
				return;
			}

			if (command.name.StartsWith("dcl_"))
			{
				//vertex shader declare

				string name = command.name.Substring(4);

				if (name.EndsWith("_pp")) //xbox doens't support partial precision
					name = name.Substring(0, name.Length - 3);

				//last two digits may be a number
				int index = 0;
				if (name.Length > 0 && char.IsNumber(name[name.Length - 1]))
				{
					if (name.Length > 1 && char.IsNumber(name[name.Length - 2]))
					{
						index = int.Parse(name.Substring(name.Length - 2));
						name = name.Substring(0, name.Length - 2);
					}
					else
					{
						index = int.Parse(name[name.Length - 1].ToString());
						name = name.Substring(0, name.Length - 1);
					}
				}

				//if (command.args.Length != 1 || command.args[0].Length != 1)
				//    throw new Exception(); //will be caught, and shader will not be replaced

				InputOutput input = new InputOutput();
				input.mapping = name.ToUpper();
				input.index = index;
				input.size = 4;
				input.name = command.args[0][0];

				if (input.name.Length > 0 && input.name[0] == 'o')
					outputs.Add(input);
				else
					inputs.Add(input);
				return;
			}

			//everything else should be some form of shader op.
			//so run it through the ASM converter...


			if (ProcessCommand(ref command, insertList))
				insertList.Add(command);
		}
	void Start(){
		inputOutput = GameObject.Find("GameController").GetComponent<InputOutput>();
	}