示例#1
0
    public Form1()
    {
      _ecosystem = CorpusExplorerEcosystem.Initialize();
      _ecosystem.ProjectNew();

      InitializeComponent();
    }
        public void DownShowsNextInHistory()
        {
            var view     = new DummyTerminalView(s => new SizeD(s.Length, 1));
            var terminal = new TerminalController(view, new SizeD(1, 1), int.MaxValue, m_promptSpan, m_promptWrapSpan, m_promptOutputSpan, m_promptOutputWrapSpan);

            terminal.LineEntered += (s, lea) => terminal.WriteOutput("out: " + lea.Line);
            terminal.CharsPerLine = m_prompt.Length + 5;

            "aa\r".ForEach(c => terminal.CharTyped(c));
            "bb\r".ForEach(c => terminal.CharTyped(c));
            "cc\r".ForEach(c => terminal.CharTyped(c));
            "dd".ForEach(c => terminal.CharTyped(c));  //current line

            terminal.ControlKeyPressed(TerminalKey.Up, TerminalKeyModifiers.None);
            terminal.ControlKeyPressed(TerminalKey.Up, TerminalKeyModifiers.None);
            terminal.ControlKeyPressed(TerminalKey.Up, TerminalKeyModifiers.None);
            terminal.ControlKeyPressed(TerminalKey.Down, TerminalKeyModifiers.None);

            DrawingInfo info = terminal.GetCurrentPageDrawingInfo(50);

            var lines = CoreTestHelpers.GetLinesAsText(info);

            Assert.AreEqual(m_prompt + "bb", lines[lines.Count - 1], "Incorrect history item shown");
        }
示例#3
0
        public async Task BalanceGet_ShouldGetIdAndReturnModelAsync()
        {
            // Arrange
            var terminalServiceMock = new Mock <TerminalService>(null, null, null);

            terminalServiceMock.Setup(p => p.GetCreditCardDetailsByIdAsync(TEST_CARD.Id)).ReturnsAsync(TEST_BALANCE_VIEW);
            var sessionManagerMock = new Mock <ITerminalSessionManager>();

            sessionManagerMock.Setup(p => p.GetSessionCardId(It.IsAny <HttpContext>())).Returns(TEST_CARD.Id);
            var terminalController = new TerminalController(terminalServiceMock.Object, null, sessionManagerMock.Object);

            // Act
            var result = await terminalController.Balance();

            // Assert
            Assert.NotNull(result);
            var viewResult = Assert.IsAssignableFrom <ViewResult>(result);

            Assert.NotNull(viewResult.Model);
            var viewModel = Assert.IsAssignableFrom <CreditCardBalanceViewModel>(viewResult.Model);

            Assert.Equal(TEST_BALANCE_VIEW, viewModel);
            sessionManagerMock.Verify(p => p.GetSessionCardId(It.IsAny <HttpContext>()), Times.Once);
        }
示例#4
0
        public static async Task LoadOtherStuffAsync()
        {
            // Start off a list of tasks we need to run before we can continue startup
            await Task.Run(async() =>
            {
                await Task.WhenAll(
                    DrivesManager.EnumerateDrivesAsync(),
                    CloudDrivesManager.EnumerateDrivesAsync(),
                    LibraryManager.EnumerateLibrariesAsync(),
                    NetworkDrivesManager.EnumerateDrivesAsync(),
                    WSLDistroManager.EnumerateDrivesAsync(),
                    SidebarPinnedController.InitializeAsync()
                    );
                await Task.WhenAll(
                    AppSettings.DetectQuickLook(),
                    TerminalController.InitializeAsync(),
                    JumpList.InitializeAsync(),
                    ExternalResourcesHelper.LoadOtherThemesAsync()
                    );
            });

            // Check for required updates
            new AppUpdater().CheckForUpdatesAsync();
        }
示例#5
0
    BuffController buffController;          // для инита бафов при одетом шмоте в функции InitItemInInventory()

    void Start()
    {
        instance = this;
        //DontDestroyOnLoad(transform.gameObject);
        // еслт какое-то окно активно, запретить управление
        actionWindow       = Global.Component.GetActionWindowController();
        dialogWindow       = Global.Component.GetDialogueManager();
        actionPanel        = Global.Component.GetActionPanelController();
        playerMovement     = Global.Obj.GetPlayerGameObject().GetComponent <PlayerMovement>();
        terminalController = Global.Component.GetTerminalController();
        buffController     = Global.Component.GetBuffController();

        InitCells();
        InitItemInInventory();
        currentHand = left_hand_btn;

        SetHandColor();
        // отресовка всех одетых вещей
        UpdateAllEqupment();

        SetBagCellList();
        SetSellList();
        SetInvCellList();
    }
示例#6
0
 public BrowserAPI(TerminalController terminalController)
 {
     terminalCtrl = terminalController;
 }
示例#7
0
        public Terminal()
        {
            InitializeComponent();

            terminal = new TerminalController();
        }
    void Start()
    {
        //reads the game objects into memory
        TextAsset text = Resources.Load <TextAsset>("Default/Text/InitSceneLoad/GameScene");

        if (text != null)
        {
            StringReader strReader = new StringReader(text.text);

            string line = strReader.ReadLine();

            while (line != null)
            {
                if (!line.Equals("") && !line.StartsWith("~"))
                {
                    SceneResouces.loadResources(line);
                }

                line = strReader.ReadLine();
            }
        }
        else
        {
            throw new Exception("txt not found");
        }

        Terminal firstTerminal = new Terminal("First Test Terminal", new Clock(1f));

        LogicChip emptyGraph = new LogicChip(100, 100, "Empty Graph");

        firstTerminal.addExtension(emptyGraph);


        Terminal emptyTerminal = new Terminal("Blank Graphs", new Clock(2f));

        for (int i = 0; i < 4; i++)
        {
            LogicChip tempEmptyGraph = new LogicChip(500, 500, "Graph No." + (i + 1));
            emptyTerminal.addExtension(tempEmptyGraph);
        }

        //emptyTerminal.addExtension(new TInput("H"));

        List <Terminal> terms = new List <Terminal>();

        terms.Add(firstTerminal);
        terms.Add(emptyTerminal);

        GameObject terminalManagerGO = new GameObject("Terminal Manager");

        this.terminalManager = terminalManagerGO.AddComponent <TerminalManager>();

        Terminal[] terminals = new Terminal[] { firstTerminal, emptyTerminal };

        foreach (Terminal terminal in terminals)
        {
            GameObject         go = new GameObject(terminal.Name);
            TerminalController terminalController = go.AddComponent <TerminalController>();
            terminalController.setUp(terminal);
            this.terminalManager.addTerminalController(terminalController);
        }
    }
示例#9
0
文件: CommandDB.cs 项目: 41ross/sza
        public List <string> GetActionStatus(string[] param)
        {
            TerminalController terminalController = Global.Component.GetTerminalController();
            PCController       pcController       = terminalController.GetCurrentPc();
            List <GameObject>  peripherals        = pcController.peripherals;

            if (param.Length > 1)
            {
                if (param[1] == "-status")
                {
                    string enabledStatus = "printer status ( enabled )";
                    string paperStatus   = "";

                    foreach (var item in peripherals)
                    {
                        if (item.tag == "printer")
                        {
                            if (item.GetComponent <PrinterController>().isPaperInside())
                            {
                                paperStatus = "paper status ( present )";
                            }
                            else
                            {
                                paperStatus = "paper status ( no paper )";
                            }
                        }
                        else
                        {
                            return(new List <string>()
                            {
                                "printer status ( enabled )"
                            });
                        }
                    }

                    return(new List <string>()
                    {
                        enabledStatus, paperStatus
                    });
                }

                if (param[1] == "-s")
                {
                    if (param.Length == 2)
                    {
                        return(new List <string>()
                        {
                            "Document not selected.", "use: printer -s [ docname ]"
                        });
                    }
                    else if (param.Length == 3)
                    {
                        if (isPrinterPresent(peripherals))
                        {
                            if (pcController.currentMemory.docs.ContainsKey(param[2]))
                            {
                                Item item = pcController.currentMemory.docs[param[2]];
                                PrinterController printerController = GetPrinterFromPeref(peripherals);
                                printerController.itemToPrint = item;

                                return(new List <string>()
                                {
                                    "Document uploaded successfully."
                                });
                            }
                            else
                            {
                                return(new List <string>()
                                {
                                    "Incorect document name."
                                });
                            }
                        }
                        else
                        {
                            return(new List <string>()
                            {
                                "printer status ( disabled )"
                            });
                        }
                    }
                    else if (param.Length > 3)
                    {
                        return(new List <string>()
                        {
                            "incorect command syntax", "use: printer -s [ docname ]"
                        });
                    }
                }

                if (param[1] == "-r")
                {
                    if (isPrinterPresent(peripherals))
                    {
                        PrinterController printerController = GetPrinterFromPeref(peripherals);

                        if (printerController.itemToPrint)
                        {
                            if (!printerController.isPaperInside())
                            {
                                return(new List <string>()
                                {
                                    "printer interrupted", "paper status ( no paper )"
                                });
                            }

                            printerController.OnPrinterClick();

                            return(new List <string>()
                            {
                                "the printer finished successfully"
                            });
                        }
                        else
                        {
                            return(new List <string>()
                            {
                                "document not uploaded", "use: printer -s [docname]"
                            });
                        }
                    }
                    else
                    {
                        return(new List <string>()
                        {
                            "printer status ( disabled )"
                        });
                    }
                }
            }

            return(new List <string>()
            {
                "use with flags -status -s", "for more information use help"
            });
        }
示例#10
0
 public void addTerminalController(TerminalController controller)
 {
     this.terminalControllers.Add(controller);
 }
    public override void spawnContents(WindowController windowController, Transform contentPanel, Canvas canvas)
    {
        WindowManager.Instance.AllowSpawnWindows = false;

        //loads and instantiates the gui
        GameObject guiPrefab = (GameObject)SceneResouces.SceneObjects["Default"][typeof(GameObject)]["EmptyList"];
        GameObject gui       = GameObject.Instantiate(guiPrefab);

        gui.transform.SetParent(contentPanel, false);

        //gets the directories in order of creation
        string        path  = Application.dataPath + "/Default/Resources/Default/Saves";
        DirectoryInfo di    = new DirectoryInfo(path);
        List <string> order = di.EnumerateDirectories().OrderBy(d => d.CreationTime).Select(d => d.Name).ToList();

        //makes a button for each save
        GameObject buttonPrefab = (GameObject)SceneResouces.SceneObjects["Default"][typeof(GameObject)]["BasicButton"];
        Transform  display      = gui.transform.Find("Mask").Find("Display");

        //loops through all the terminals
        for (int i = 0; i < order.Count; i++)
        {
            int index = i;

            GameObject button = GameObject.Instantiate(buttonPrefab);
            button.transform.SetParent(display, false);

            LayoutElement le = button.AddComponent <LayoutElement>();
            le.minHeight     = 40;
            le.flexibleWidth = 1;

            Text text = button.transform.Find("Text").GetComponent <Text>();
            text.text = order[index];

            Button b = button.GetComponent <Button>();

            b.onClick.AddListener(() => {
                //gets rid of all the prexisting terminals
                this.terminalManager.clearTerminal();

                string selectedSave = path + "/" + order[index];
                selectedSave       += "/Terminals";
                string[] terminals  = Directory.GetDirectories(selectedSave);

                foreach (string terminalPath in terminals)
                {
                    //terminal creation
                    DirectoryInfo info = new DirectoryInfo(terminalPath);

                    string terJsonPath   = terminalPath + "/" + info.Name + ".json";
                    TerminalData terData = Save.loadJson <TerminalData>(terJsonPath);

                    Terminal terminal = terData.getTerminal(terminalPath);

                    //adds the terminal to the Terminal Manager
                    GameObject go = new GameObject(terminalPath);
                    TerminalController terminalController = go.AddComponent <TerminalController>();
                    terminalController.setUp(terminal);
                    terminalManager.addTerminalController(terminalController);
                }

                //clear all the windows
                WindowManager.Instance.removeAllWindows();
            });
        }
    }
示例#12
0
 private void ReloadTerminals(TerminalController controller)
 {
     Terminals        = controller.Model.Terminals;
     SelectedTerminal = controller.Model.GetDefaultTerminal();
 }
    private bool m_resolving;                       // Check if the player is currently resolving a critical error


    // ------------------------------------------
    // Start is called before update
    // ------------------------------------------
    void Start()
    {
        // Get the terminal controller script from the parent
        m_terminalManager = transform.parent.GetComponent <TerminalController>();
    }
示例#14
0
文件: CommandDB.cs 项目: 41ross/sza
        public List <string> GetActionStatus(string[] param)
        {
            TerminalController terminal     = Global.Component.GetTerminalController();
            PCController       pcController = terminal.GetCurrentPc();
            PlayerInfo         playerInfo   = Global.Component.GetPlayerInfo();
            AccauntController  accaunt      = Global.Component.GetAccauntController();


            if (param.Length == 4)
            {
                if (param[1] == "-login")
                {
                    if (pcController.currentMemory.isInAccauntEntered)
                    {
                        return(new List <string>()
                        {
                            "already logged in"
                        });
                    }

                    Debug.Log(playerInfo.accauntID == param[2]);
                    Debug.Log(playerInfo.accauntPass == param[3]);
                    if (playerInfo.accauntID == param[2] && playerInfo.accauntPass == param[3])
                    {
                        pcController.currentMemory.isInAccauntEntered = true;
                        return(new List <string>()
                        {
                            "logged in successfully"
                        });
                    }
                    else
                    {
                        return(new List <string>()
                        {
                            "incorrect accaunt id or password"
                        });
                    }
                }
            }
            if (param.Length == 2)
            {
                if (pcController.currentMemory.isInAccauntEntered)
                {
                    if (param[1] == "-b")
                    {
                        return(new List <string>()
                        {
                            "accaunt balance [ " + accaunt.GetAccautBalance() + " ]"
                        });
                    }
                    else if (param[1] == "-logout")
                    {
                        pcController.currentMemory.isInAccauntEntered = false;

                        return(new List <string>()
                        {
                            "logged out successfully"
                        });
                    }
                }
                else
                {
                    return(new List <string>()
                    {
                        "not logged in", "use -login [accauntID] [pass]"
                    });
                }
            }

            return(null);
        }
示例#15
0
文件: CommandDB.cs 项目: 41ross/sza
        public List <string> GetActionStatus(string[] param)
        {
            TerminalController terminal     = Global.Component.GetTerminalController();
            PCController       pcController = terminal.GetCurrentPc();

            if (param.Length == 2)
            {
                if (param[1] == "-status")
                {
                    if (pcController.disk != null)
                    {
                        return(new List <string>()
                        {
                            "disk status ( enabled )", pcController.disk.itemDescription
                        });
                    }
                    else
                    {
                        return(new List <string>()
                        {
                            "disk status ( disabled )"
                        });
                    }
                }
                else if (param[1] == "-out")
                {
                    if (pcController.disk != null)
                    {
                        PrefbDB    prefbDB         = Global.Component.GetPrefbDB();
                        GameObject itemPref        = prefbDB.GetItemPrefab();
                        string     discDescription = pcController.disk.itemDescription;

                        itemPref.GetComponent <ItemCell>().item         = pcController.disk;
                        itemPref.GetComponent <SpriteRenderer>().sprite = pcController.disk.itemSprite;
                        prefbDB.InstantiateItemPref(pcController.transform.position);


                        pcController.disk = null;

                        return(new List <string>()
                        {
                            "disk " + discDescription + " logged out successfully"
                        });
                    }
                    else
                    {
                        return(new List <string>()
                        {
                            "disk status ( disabled )"
                        });
                    }
                }
                else if (param[1] == "-c")
                {
                    if (pcController.disk != null)
                    {
                        List <string> docsName = new List <string>();
                        foreach (var item in pcController.disk.innerItems)
                        {
                            docsName.Add(item.itemDescription);
                        }

                        if (docsName.Count == 0)
                        {
                            return(new List <string>()
                            {
                                "Disk is empty"
                            });
                        }

                        return(docsName);
                    }
                    else
                    {
                        return(new List <string>()
                        {
                            "disk status ( disabled )"
                        });
                    }
                }
            }
            else if (param.Length == 3)
            {
                if (param[1] == "-cpy")
                {
                    if (pcController.disk != null)
                    {
                        foreach (var item in pcController.disk.innerItems)
                        {
                            if (item.itemDescription == param[2])
                            {
                                //если на компе есть тот же документ
                                foreach (var pcItem in pcController.currentMemory.docs)
                                {
                                    if (item.itemDescription == pcItem.Key)
                                    {
                                        return(new List <string>()
                                        {
                                            item.itemDescription + " is already exist"
                                        });
                                    }
                                }

                                pcController.currentMemory.docs.Add(item.itemDescription, item);

                                return(new List <string>()
                                {
                                    item.itemDescription + " copied successfully"
                                });
                            }
                        }
                    }
                    else
                    {
                        return(new List <string>()
                        {
                            "disk status ( disabled )"
                        });
                    }
                }
            }

            return(null);
        }
示例#16
0
 public DeviceServicesController(TerminalController terminalController){
     _terminalController = terminalController;
 }
 public TerminalInfoContent(TerminalController terminalController)
 {
     this.terminalController = terminalController;
 }
示例#18
0
 public bool removeTerminalController(TerminalController controller)
 {
     return(this.terminalControllers.Remove(controller));
 }
示例#19
0
 void Awake()
 {
     terminal_controller = GetComponent <TerminalController>();
 }