示例#1
0
 // Start is called before the first frame update
 void Start()
 {
     hammerSound      = GetComponent <AudioSource>();
     myAnimator       = GetComponent <Animator>();
     myParticleSystem = GetComponent <ParticleSystem>();
     pipeManager      = GetComponentInParent <PipeManager>();
 }
示例#2
0
    void StartResolve()
    {
        if (GenerateDone)
        {
            contenerResult.ClearDataPipe();
        }

        List <int> listCuts = new List <int>();

        foreach (var item in vBoxContainer.GetChildren())
        {
            switch (item)
            {
            case ButtonDebit2 buttonDebit when buttonDebit.length != null:
                for (int i = 1; i <= buttonDebit.qt; i++)
                {
                    listCuts.Add((int)buttonDebit.length);
                }
                break;
            }
        }

        int.TryParse(lineEditLengthBase.Text, out int lengthbase);
        int.TryParse(lineEditCutSize.Text, out int cutSize);

        pipeManager = new PipeManager(lineEditDescription.Text, lengthbase + cutSize, listCuts, cutSize);

        pipeManager.Process();

        contenerResult.Show();
        contenerResult.FillDataPipe(pipeManager.GetEnumerable());

        GenerateDone = true;
    }
示例#3
0
    void StartResolve()
    {
        GD.Print("has been resolve");

        List <int> listCut = new List <int>();

        foreach (var item in vBoxContainer.GetChildren())
        {
            switch (item)
            {
            case ButtonDebit buttonDebit when buttonDebit.length != null:
                listCut.Add((int)buttonDebit.length);
                break;
            }
        }

        pipeManager = new PipeManager(lineEdit.Text, 6005, listCut, 5);

        pipeManager.Process();
        foreach (var pipe in pipeManager.GetEnumerable())
        {
            String cutString = $"{lineEdit.Text} : ";
            foreach (var cut in pipe)
            {
                cutString += cut.ToString();
                cutString += "-";
            }
            GD.Print(cutString);
        }
    }
        /// <summary>
        /// Parse the given string and replace any
        /// available templates by their runtime values
        /// </summary>
        private static string ParseDefaultAnswerText(int questionId, string currentDefaultText, VoterAnswersData.VotersAnswersDataTable voterAnswersState, string languageCode)
        {
            currentDefaultText = new PipeManager().PipeValuesInText(questionId, currentDefaultText, voterAnswersState, languageCode);
            string str = new Regex(@"#{2}((\S)+)#{2}").Match(currentDefaultText).Groups[1].ToString();

            if ((str.Length > 0) && (HttpContext.Current != null))
            {
                currentDefaultText = (HttpContext.Current.Request[str] == null) ? string.Empty : HttpContext.Current.Request[str];
                return(currentDefaultText);
            }
            string str2 = new Regex(@"%{2}((\S)+)%{2}").Match(currentDefaultText).Groups[1].ToString();

            if ((str2.Length > 0) && (HttpContext.Current != null))
            {
                currentDefaultText = (HttpContext.Current.Request.ServerVariables[str2] == null) ? string.Empty : HttpContext.Current.Request.ServerVariables[str2];
                return(currentDefaultText);
            }
            string str3 = new Regex(@"@{2}((\S)+)@{2}").Match(currentDefaultText).Groups[1].ToString();

            if ((str3.Length > 0) && (HttpContext.Current != null))
            {
                currentDefaultText = (HttpContext.Current.Session[str3] == null) ? string.Empty : HttpContext.Current.Session[str3].ToString();
                return(currentDefaultText);
            }
            string str4 = new Regex(@"&{2}((\S)+)&{2}").Match(currentDefaultText).Groups[1].ToString();

            if ((str4.Length > 0) && (HttpContext.Current != null))
            {
                currentDefaultText = (HttpContext.Current.Request.Cookies[str4] == null) ? string.Empty : HttpContext.Current.Request.Cookies[str4].Value.ToString();
                return(currentDefaultText);
            }
            return(currentDefaultText);
        }
示例#5
0
 public AsyncSemaphoreContainer(
     IAsyncContainer <M, R> container,
     string semaphoreName)
 {
     _container = container;
     _semaphore = PipeManager.GetSemaphore(semaphoreName);
 }
示例#6
0
文件: Form1.cs 项目: sora-jp/Terminal
 private void OnKeyPressed(object sender, KeyPressEventArgs e)
 {
     if (pendingReadLine && currentCommandProcess != null)
     {
         if (!currentCommandProcess.HasExited)
         {
             if (pendingReadLine)
             {
                 if (e.KeyChar == '\n')
                 {
                     PipeManager.SendMessage(new Message(MessageType.ReadLineResponse, currentReadLineString), currentCommandProcess);
                     pendingReadLine       = false;
                     currentReadLineString = "";
                 }
                 else
                 {
                     currentReadLineString += e.KeyChar.ToString();
                 }
             }
             //e.Handled = true;
             return;
         }
     }
     if (currentCommandString == null)
     {
         currentCommandString = "";
     }
     if (e.KeyChar == '\b' && currentCommandString.Length > 0)
     {
         currentCommandString = currentCommandString.Remove(currentCommandString.Length - 1, 1);
         return;
     }
     currentCommandString += e.KeyChar;
 }
示例#7
0
 private void Start()
 {
     land = transform.GetComponentInParent <Land>();
     land.SetBuilding(this);
     land.RemoveFunction(Land.LandFunction.buildBuilding); //一旦建立了建筑,就移除建立功能
     pipeManager = land.GetPipeManager();
     pipeManager.SetIfDenyForward(false);                  //建立建筑后,开启请求传递
 }
示例#8
0
 void Awake()
 {
     // + Set the pipeManager to an instance of the PipeManager class
     toggleManager = GameObject.Find("Toggles").GetComponent <ToggleManager> ();
     pipeManager   = GameObject.Find("GameManager").GetComponent <PipeManager> ();
     modelManager  = GetComponent <ModelManager> ();
     roundSystem   = GetComponent <RoundSystem> ();
 }
示例#9
0
	void Start()
	{
		if(_instance != null)
			throw new System.Exception("PipeManager is a singleton!");
		
		_instance = this;
		
		ClickManager.getInstance().registerDefaultRelease(this);
	}
示例#10
0
        public ModelFactory()
        {
            Dispatcher.CurrentDispatcher.ShutdownStarted += OnShutdownStarted;
            var fileOutputManager = new FileOutputManager(SettingsManager);

            ConsoleManager = new WinConsoleManager(SettingsManager, fileOutputManager);
            PortManager    = new PortManager(SettingsManager, ConsoleManager, _mainThreadRunner, _usbNotification);
            _pipeManager   = new PipeManager(PortManager, SettingsManager, ConsoleManager, _mainThreadRunner);
        }
示例#11
0
    private void Awake()
    {
        corkManager          = transform.GetComponentInChildren <CorkManager>();
        pipeManager          = transform.GetComponentInChildren <PipeManager>();
        waterLevelController = transform.GetComponentInChildren <WaterLevelController>();
        gameOverUI           = transform.GetComponentInChildren <GameOverController>();

        gameOverUI.gameObject.SetActive(false);
    }
 internal ServerNamedPipe(PipeManager manager, string name, uint outBuffer, uint inBuffer, int maxReadBytes, bool secure)
 {
     this.manager            = manager;
     PipeConnection          = new ServerPipeConnection(name, outBuffer, inBuffer, maxReadBytes, secure);
     PipeThread              = new Thread(new ThreadStart(PipeListener));
     PipeThread.IsBackground = true;
     PipeThread.Name         = "Pipe Thread " + this.PipeConnection.NativeHandle.ToString();
     LastAction              = DateTime.Now;
 }
示例#13
0
        public void Setup()
        {
            _containerMock = new Mock <IContainer>();
            _containerMock.Setup(x => x.GetInstance(It.IsAny <Type>())).Returns <Type>(Activator.CreateInstance);
            _pipeManager = new PipeManager(new IPipeSource[] { new PipeSource <TestPipe>(new Container()) });

            _dispatchQueueFactory = new DispatchQueueFactory(_pipeManager);

            _messageDispatcher = CreateAndStartDispatcher(_dispatchQueueFactory);
        }
        private void Initialize
        (
            PipeManager pipeManager
        )
        {
            _pipeManager = pipeManager;

            _pipePlacementConditions.Add(CellsDifferent);
            _pipePlacementConditions.Add(CellsAdjacent);
            _pipePlacementConditions.Add(NoExistingPipe);
        }
示例#15
0
 void IPlugin.Dispose()
 {
     if (PipeManager != null)
     {
         //only stop the server if this is the last instance!
         if (!BlnHasDuplicate)
         {
             PipeManager.StopServer();
         }
     }
 }
        protected void Restricted(
            int initialCount,
            string key)
        {
            if (_skipCurrentExecutor)
            {
                return;
            }

            PipeManager.SetSemaphore(initialCount, key);
            _currentContainer = new AsyncSemaphoreContainer <M, R>(_currentContainer, key);
        }
示例#17
0
 private void Awake()
 {
     if (PipeManager.instance == null)
     {
         PipeManager.instance = this;
     }
     else if (PipeManager.instance != this)
     {
         Destroy(PipeManager.instance.gameObject);
         PipeManager.instance = this;
     }
     bSpawning = false;
 }
示例#18
0
    public void SetToLand(Land to)
    {
        toLand = to;
        Stretch(to.GetEdgePosition(fromLand.transform.position), true);

        toMan   = toLand.GetPipeManager();
        fromPos = fromLand.GetEdgePosition(toLand.transform.position);
        toPos   = toLand.GetEdgePosition(fromLand.transform.position);

        toMan.AddPipeFrom(this);
        fromMan.AddPipeTo(this);
        isBuilding = false;
    }
示例#19
0
    private void Initialize
    (
        InputManager inputManager,
        PipeManager pipeManager,
        TurnManager turnManager
    )
    {
        _inputManager = inputManager;
        _pipeManager  = pipeManager;
        _turnManager  = turnManager;

        _inputManager.OnHexCellTapped += HandleOnHexMapTapped;
    }
示例#20
0
    void initialPipeLayerSetup()
    {
        pipeSegments = new PipeManager[boardWidth, boardHeight];

        for (int i = 0; i < boardWidth; i++)
        {
            for (int j = 0; j < boardHeight; j++)
            {
                PipeManager newPipeSegment = spawnRandomPipeSegment(i, j);
                newPipeSegment.x   = i;
                newPipeSegment.y   = j;
                pipeSegments[i, j] = newPipeSegment;
            }
        }
    }
    private void Awake()
    {
        m_rigidbody = GetComponent <Rigidbody2D>();

        m_gm = GameObject.FindGameObjectWithTag("GameManager").GetComponent <GameManager>();
        m_gm.AddPlayer(gameObject);

        m_pm = m_gm.GetComponent <PipeManager>();

        fitness = 0;

        m_initialY = transform.position.y;

        m_jumpTimeCounter = m_jumpTime;
    }
示例#22
0
    // Use this for initialization
    void Awake()
    {
        pipeManager = GameObject.Find("GameManager").GetComponent <PipeManager> ();
        highLight   = GameObject.Find("GameManager").GetComponent <Highlight> ();
        toolManager = GameObject.Find("GameManager").GetComponent <ToolManager> ();

        modelManager  = GetComponent <ModelManager> ();
        roundManager  = GetComponent <RoundSystem> ();
        nodeManager   = GetComponent <NodeManager> ();
        groundManager = GetComponent <GroundManager>();
        toggleManager = GameObject.Find("Toggles").GetComponent <ToggleManager> ();

        sounds = GameObject.Find("AudioManager").GetComponent <Sounds> ();

        Bank = GetComponent <CashManager> ();
    }
示例#23
0
    PipeManager spawnRandomPipeSegment(int x, int y)
    {
        int         randomPipeTileIndex = selectRandomPipeTileIndex();
        GameObject  newTile             = Instantiate(myPrefabs.pipeSegment, new Vector3(x, y, -1), Quaternion.identity) as GameObject;
        PipeManager newPipeManager      = newTile.GetComponent <PipeManager>();

        newPipeManager.x        = x;
        newPipeManager.y        = y;
        newPipeManager.pipeTile = instantiatePipeTile(randomPipeTileIndex, x, y);


        newPipeManager.pipeTile.transform.parent = newTile.transform;
        newTile.transform.parent = transform;

        return(newPipeManager);
    }
示例#24
0
        private bool HandleLoadCommand(string argument)
        {
            //check global mutex
            bool blnHasDuplicate = false;

            try
            {
                blnHasDuplicate = !Program.GlobalChummerMutex.WaitOne(0, false);
            }
            catch (AbandonedMutexException ex)
            {
                Log.Error(ex);
                Utils.BreakIfDebug();
                blnHasDuplicate = true;
            }

            var thread = new Thread((myargument) =>
            {
                if (!blnHasDuplicate)
                {
                    var uptime = DateTime.UtcNow - Process.GetCurrentProcess().StartTime.ToUniversalTime();
                    if (uptime < TimeSpan.FromSeconds(2))
                    {
                        Thread.Sleep(TimeSpan.FromSeconds(1));
                    }
                }
                if (PipeManager != null)
                {
                    string msg = "Load:" + myargument;
                    Log.Trace("Sending argument to Pipeserver: " + msg);
                    PipeManager.Write(msg);
                }
            });

            thread.Start(argument);
            thread.Join();
            if (blnHasDuplicate)
            {
                Environment.ExitCode = -1;
                return(false);
            }
            else
            {
                return(true);
            }
        }
示例#25
0
        protected override void OnClosing(CancelEventArgs e)
        {
            base.OnClosing(e);

            Hide();

            bool isNewVersion = CheckForNewVersion(false, false);

            mmApp.Configuration.ApplicationUpdates.AccessCount++;

            SaveSettings();

            if (!CloseAllTabs())
            {
                Show();
                e.Cancel = true;
                return;
            }

            if (mmApp.Configuration.UseSingleWindow)
            {
                PipeManager?.StopServer();

                if (App.Mutex != null)
                {
                    App.Mutex.Dispose();
                }
            }

            if (!isNewVersion &&
                mmApp.Configuration.ApplicationUpdates.AccessCount % 5 == 0 &&
                !UnlockKey.IsRegistered())
            {
                Hide();
                var rd = new RegisterDialog();
                rd.Owner = this;
                rd.ShowDialog();
            }

            mmApp.SendTelemetry("shutdown");

            e.Cancel = false;
        }
示例#26
0
文件: Form1.cs 项目: sora-jp/Terminal
        private void OnKeyDown(object sender, KeyEventArgs e)
        {
            if (pendingRead)
            {
                PipeManager.SendMessage(new Message(MessageType.ReadResponse, ((int)e.KeyCode).ToString()), currentCommandProcess);
                pendingRead        = false;
                e.Handled          = true;
                e.SuppressKeyPress = cancelKeyPress;
                cancelKeyPress     = false;
                return;
            }

            if (e.KeyCode == Keys.Enter && !commandRunning)
            {
                //e.Handled = true;
                string[] data = currentCommandString.Split(new char[] { ' ' }, 2);
                currentCommand     = data[0];
                currentCommandArgs = data.Length > 1 ? data[1] : "";
                //MessageBox.Show("Command: \"" + currentCommand + "\" with arguments: \"" + currentCommandArgs + "\"");
                currentCommandString = "";
                currentCommandArgs   = "";

                //if (currentCommand == "echo")
                //{
                //    TerminalWriteLine("Echo: " + currentCommandArgs, true);
                //    TerminalWrite("ROOT§" + Environment.MachineName + "> ");
                //}

                currentCommandProcess = Process.Start(new ProcessStartInfo(currentCommand, currentCommandArgs)
                {
                    RedirectStandardInput = true, RedirectStandardOutput = true, UseShellExecute = false, CreateNoWindow = true
                });
                commandRunning = true;
                commandWorkerThread.Start();
            }

            //MessageBox.Show("Keys: " + e.KeyData + " | ConsoleKey: " + ((ConsoleKey)Enum.Parse(typeof(ConsoleKey), e.KeyValue.ToString())).ToString());
        }
示例#27
0
 public DispatchQueueFactory(PipeManager pipeManager)
 {
     _pipeManager = pipeManager;
 }
示例#28
0
 private void Start()
 {
     pipeManager      = GetComponent <PipeManager>();
     resourcesManager = GetComponent <ResourcesManager>();
 }
示例#29
0
 private void Awake()
 {
     pipeManager = GameObject.Find("PipeManager").GetComponent <PipeManager>();
 }
示例#30
0
 public void SetUp()
 {
     _pipeSource  = new FakePipeSource();
     _pipeManager = new PipeManager(new[] { _pipeSource });
 }
示例#31
0
		internal ServerNamedPipe(string name, uint outBuffer, uint inBuffer, int maxReadBytes, bool secure, PipeManager manager) {
			PipeConnection = new ServerPipeConnection(name, outBuffer, inBuffer, maxReadBytes, secure);
			PipeThread = new Thread(new ThreadStart(PipeListener));
			PipeThread.IsBackground = true;
			PipeThread.Name = "Pipe Thread " + this.PipeConnection.NativeHandle.ToString();
			LastAction = DateTime.Now;
            this.manager = manager;
		}
示例#32
0
 public void Setup()
 {
     _pipeManager   = new PipeManager(new IPipeSource[0]);
     _dispatchQueue = new DispatchQueue(_pipeManager, 200, "Default");
 }