public LogStack(TerminalConfig config)
 {
     this.config = config;
     logTypes    = new List <LogType>();
     logTitles   = new List <string>();
     logStacks   = new List <string>();
 }
Exemple #2
0
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        TerminalConfig tc = target as TerminalConfig;

        GUILayout.Space(25);

        if (GUILayout.Button("Reset ENV"))
        {
            tc.ResetENV();
        }
        ;

#if UNITY_EDITOR_WIN
        if (GUILayout.Button("Generate VFS jsons"))
        {
            string           cmd   = "C:\\Users\\Zotti\\Documents\\0_UNITY\\HackOp_wh1t3_lily\\Helper\\VFSGenerator.py";
            ProcessStartInfo start = new ProcessStartInfo();
            start.FileName               = "C:\\Users\\Zotti\\AppData\\Local\\Programs\\Python\\Python39\\python.exe";
            start.Arguments              = string.Format("{0}", cmd);
            start.UseShellExecute        = false;
            start.RedirectStandardOutput = true;
            Process.Start(start);

            UnityEngine.Debug.Log("VFS file generated");
        }
#else
        UnityEngine.Debug.LogWarning("Some TerminalConfig Inspector functions are available only for Windows Unity Editor");
#endif
    }
Exemple #3
0
        public string GenerateSettings()
        {
            var json  = File.ReadAllText(WtSettings);
            var cfg   = TerminalConfig.FromJson(json);
            var hosts = SSHParser.MapHosts();

            if (cfg.Profiles.HasValue)
            {
                var profileMaster = cfg.Profiles.Value;
                var profiles      = profileMaster.ProfilesObject;

                foreach (var host in hosts)
                {
                    var name = $"{host.Key} (SSH)";
                    if (profiles.List.Any((x) => x.Name == name))
                    {
                        continue;
                    }
                    var list = new ProfileList()
                    {
                        Guid        = "{" + Guid.NewGuid().ToString() + "}",
                        Commandline = $"ssh {host.Key}",
                        Name        = name,
                        CloseOnExit = CloseOnExitEnum.Always
                    };
                    profiles.List.Add(list);
                }
                cfg.Profiles = profiles;
            }

            return(cfg.ToJson());
        }
Exemple #4
0
 void Awake()
 {
     instance = this;
     if (config == null) config = Resources.Load<TerminalConfig>("Config/ZSH");
     if (mobileTouchCount <= 0) mobileTouchCount = 4;
     autoCompIndex = 0;
     autoCompList = new List<string>();
     terminalMethods = new TerminalMethods();
     inputHandler = new TerminalInputHandler(this);
     terminalGui = new TerminalGUI(this);
 }
 public TerminalGUI(Terminal terminal)
 {
     this.terminal                    = terminal;
     this.config                      = terminal.config;
     terminalStyle                    = new GUIStyle();
     terminalStyle.font               = config.font;
     terminalStyle.fontSize           = 16;
     terminalStyle.richText           = true;
     terminalStyle.normal.textColor   = config.commandColor;
     terminalStyle.hover.textColor    = config.autoCompleteHoverColor;
     terminalStyle.active.textColor   = config.autoCompleteHoverColor;
     terminalStyle.onHover.textColor  = config.autoCompleteHoverColor;
     terminalStyle.onActive.textColor = config.autoCompleteHoverColor;
 }
Exemple #6
0
 void Awake()
 {
     DontDestroyOnLoad(gameObject);
     if (config == null)
     {
         config = Resources.Load <TerminalConfig>("Config/ZSH");
     }
     if (mobileTouchCount <= 0)
     {
         mobileTouchCount = 4;
     }
     AutoCompIndex   = 0;
     AutoCompList    = new List <string>();
     terminalMethods = new TerminalMethods();
     inputHandler    = new TerminalInputHandler(this);
     terminalGui     = new TerminalGUI(this);
     logStack        = new LogStack(config);
 }
Exemple #7
0
    void Awake()
    {
        instance = this;
        if (config == null)
        {
            config = Resources.Load <TerminalConfig>("Config/ZSH");
        }
        terminalStyle                  = new GUIStyle();
        terminalStyle.font             = config.font;
        terminalStyle.fontSize         = 16;
        terminalStyle.normal.textColor = config.commandColor;
        var assembly = System.AppDomain.CurrentDomain.Load("Assembly-CSharp");

        methods = assembly
                  .GetTypes()
                  .SelectMany(x => x.GetMethods())
                  .Where(y => y.GetCustomAttributes(true).OfType <CommandAttribute>().Any())
                  .ToDictionary(z => z.Name);
    }
    public TerminalGUI(Terminal terminal)
    {
        this.terminal                    = terminal;
        this.config                      = terminal.config;
        terminalStyle                    = new GUIStyle();
        terminalStyle.font               = config.font;
        terminalStyle.fontSize           = 16;
        terminalStyle.richText           = true;
        terminalStyle.normal.textColor   = config.commandColor;
        terminalStyle.hover.textColor    = config.autoCompleteHoverColor;
        terminalStyle.active.textColor   = config.autoCompleteHoverColor;
        terminalStyle.onHover.textColor  = config.autoCompleteHoverColor;
        terminalStyle.onActive.textColor = config.autoCompleteHoverColor;

        texture2D = new Texture2D(2, 2);
        texture2D.SetPixels(0, 0, texture2D.width, texture2D.height, new Color[] { config.backgroundColor, config.backgroundColor, config.backgroundColor, config.backgroundColor });
        texture2D.wrapMode = TextureWrapMode.Repeat;
        texture2D.Apply();

        terminalStyle.normal.background = texture2D;
    }
Exemple #9
0
        public static (bool, string) GenerateSettings(string file)
        {
            if (!File.Exists(file))
            {
                Log.Warning("Skipped terminal settings update because '{file}' doesn't exist", file);
                return(false, string.Empty); // If the file doesn't exist that's okay
            }
            var json  = File.ReadAllText(file);
            var cfg   = TerminalConfig.FromJson(json);
            var hosts = SSHParser.MapHosts();

            if (cfg.Profiles.HasValue)
            {
                var profileMaster = cfg.Profiles.Value;
                var profiles      = profileMaster.ProfilesObject;

                foreach (var host in hosts)
                {
                    var name = $"{host.Key} (SSH)";
                    if (profiles.List.Any((x) => x.Name == name))
                    {
                        continue;
                    }
                    var list = new ProfileList()
                    {
                        Guid        = "{" + Guid.NewGuid().ToString() + "}",
                        Commandline = $"ssh {host.Key}",
                        Name        = name,
                        CloseOnExit = CloseOnExitEnum.Always
                    };
                    profiles.List.Add(list);
                }
                cfg.Profiles = profiles;
            }

            return(true, cfg.ToJson());
        }
 public void TestGetMACAddress()
 {
     var _systemConfig = new SystemConfig();
     var config        = new TerminalConfig(_systemConfig);
     var macAddress    = config.MacAddress;
 }
Exemple #11
0
        private void Page0177_Loaded(object sender, RoutedEventArgs e)
        {
            _pageVM.Clear();

            TerminalConfig config = _kernelService.TerminalDataCache["__TerminalConfig"] as TerminalConfig;

            _pageVM.BranchNo = config.BranchNo;

            if (_kernelService.TransactionDataCache.ContainsKey("__WEALTHY_SOURCE"))
            {
                _pageVM.WealthySourceDropdown = _kernelService.TransactionDataCache["__WEALTHY_SOURCE"] as WealthySourceDropdown;
            }
            else
            {
                _kernelService.Logger.Warn("__WEALTHY_SOURCE is not found!");
            }

            if (_kernelService.TransactionDataCache.ContainsKey(KioskDataCacheKey.PersonalData177))
            {
                string json    = _kernelService.TransactionDataCache[KioskDataCacheKey.PersonalData177].ToString();
                var    jsonObj = JsonConvert.DeserializeObject <Dictionary <string, string> >(json);

                _pageVM.WealthySource1        = jsonObj["WealthySource1"] == "Y";
                _pageVM.WealthySource1A       = jsonObj["WealthySource1A"] == "Y";
                _pageVM.WealthySource1B       = jsonObj["WealthySource1B"] == "Y";
                _pageVM.WealthySource1BDesc   = jsonObj["WealthySource1BDesc"];
                _pageVM.WealthySource2        = jsonObj["WealthySource2"] == "Y";
                _pageVM.WealthySource2A       = jsonObj["WealthySource2A"] == "Y";
                _pageVM.WealthySource2B       = jsonObj["WealthySource2B"] == "Y";
                _pageVM.WealthySource2C       = jsonObj["WealthySource2C"] == "Y";
                _pageVM.WealthySource2D       = jsonObj["WealthySource2D"] == "Y";
                _pageVM.WealthySource2E       = jsonObj["WealthySource2E"] == "Y";
                _pageVM.WealthySource2EDesc   = jsonObj["WealthySource2EDesc"];
                _pageVM.WealthySource3        = jsonObj["WealthySource3"] == "Y";
                _pageVM.WealthySource3A       = jsonObj["WealthySource3A"] == "Y";
                _pageVM.WealthySource3B       = jsonObj["WealthySource3B"] == "Y";
                _pageVM.WealthySource3C       = jsonObj["WealthySource3C"] == "Y";
                _pageVM.WealthySource3D       = jsonObj["WealthySource3D"] == "Y";
                _pageVM.WealthySource3E       = jsonObj["WealthySource3E"] == "Y";
                _pageVM.WealthySource4        = jsonObj["WealthySource4"] == "Y";
                _pageVM.WealthySource5        = jsonObj["WealthySource5"] == "Y";
                _pageVM.WealthySource6        = jsonObj["WealthySource6"] == "Y";
                _pageVM.WealthySource6Desc    = jsonObj["WealthySource6Desc"];
                _pageVM.StampRefNumber        = jsonObj["StampRefNumber"] == "Y";
                _pageVM.StampRefNumberDesc    = jsonObj["StampRefNumberDesc"];
                _pageVM.StampRefNumberEnabled = jsonObj["StampRefNumberEnabled"] == "Y";
                _pageVM.HasOldAccount         = jsonObj["HasOldAccount"] == "Y";
                _pageVM.AccountType           = jsonObj["HasOldAccount"];
                _pageVM.IsShowStampMsg        = jsonObj["IsShowStampMsg"] == "Y";
            }
            else
            {
                _pageVM.HasOldAccount = false;
                if (_kernelService.TransactionDataCache.ContainsKey("__WARN_ACCOUNT_DATA"))
                {
                    string json    = _kernelService.TransactionDataCache["__WARN_ACCOUNT_DATA"].ToString();
                    var    jsonObj = JsonConvert.DeserializeObject <Dictionary <string, string> >(json);

                    if (jsonObj.ContainsKey("oldAccResult"))
                    {
                        _pageVM.HasOldAccount    = jsonObj["oldAccResult"] == "Y" || jsonObj["oldAccResult"] == "P";
                        _pageVM.IsPreProcAccount = jsonObj["oldAccResult"] == "P";
                    }
                }

                if (_pageVM.HasOldAccount && _kernelService.TransactionDataCache.ContainsKey("__OLD_ACCOUNT_DATA"))
                {
                    string oldAccountData = _kernelService.TransactionDataCache["__OLD_ACCOUNT_DATA"].ToString();
                    var    oaData         = JsonConvert.DeserializeObject <Dictionary <string, string> >(oldAccountData);

                    _kernelService.Logger.Info("Page0177: " + oldAccountData);

                    foreach (string key in oaData.Keys)
                    {
                        switch (key)
                        {
                        case "ASSET_RESOURCE_1":
                        case "ASSET_RESOURCE_2":
                        case "ASSET_RESOURCE_3":
                            CheckWealthySource(oaData[key]);
                            break;

                        case "ASSET_RESOURCE_SUB_1":
                        {
                            string wsMajor = oaData["ASSET_RESOURCE_1"];
                            string wsOther = oaData["ASSET_RESOURCE_1_SUB_OTHER"];
                            CheckWealthySourceSub(wsMajor, oaData[key], wsOther);
                        }
                        break;

                        case "ASSET_RESOURCE_SUB_2":
                        {
                            string wsMajor = oaData["ASSET_RESOURCE_2"];
                            string wsOther = oaData["ASSET_RESOURCE_2_SUB_OTHER"];
                            CheckWealthySourceSub(wsMajor, oaData[key], wsOther);
                        }
                        break;

                        case "ASSET_RESOURCE_SUB_3":
                        {
                            string wsMajor = oaData["ASSET_RESOURCE_3"];
                            string wsOther = oaData["ASSET_RESOURCE_3_SUB_OTHER"];
                            CheckWealthySourceSub(wsMajor, oaData[key], wsOther);
                        }
                        break;

                        case "PBTRANSF":
                        {
                            _pageVM.StampRefNumber        = false;
                            _pageVM.StampRefNumberDesc    = "";
                            _pageVM.StampRefNumberEnabled = true;
                        }
                        break;

                        default:
                            break;
                        }
                    }
                }
                else
                {
                    _pageVM.StampRefNumberEnabled = false;
                    if (_pageVM.HasOldAccount)
                    {
                        _kernelService.Logger.Warn("__OLD_ACCOUNT_DATA is not found!");
                    }
                }

                if (_kernelService.TransactionDataCache.ContainsKey(KioskDataCacheKey.NewAccountType))
                {
                    string json    = _kernelService.TransactionDataCache[KioskDataCacheKey.NewAccountType].ToString();
                    var    jsonObj = JsonConvert.DeserializeObject <Dictionary <string, string> >(json);

                    _pageVM.AccountType    = jsonObj["accType"];
                    _pageVM.IsShowStampMsg = _pageVM.AccountType == "3";
                }
            }

            _pageVM.ResetTimer();
            _pageVM.StartTimer();
        }