Beispiel #1
0
 // Use this for initialization
 void Start()
 {
     stage          = 1;
     keywordManager = GetComponent <KeywordManager>();
     uni.Play();
     Debug.Log("Sag: yes");
 }
Beispiel #2
0
        void rptContents_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                var ltlTitle = e.Item.FindControl("ltlTitle") as Literal;

                var functionID  = TranslateUtils.EvalInt(e.Item.DataItem, "ID");
                var keywordType = EKeywordTypeUtils.GetEnumType(ddlKeywordType.SelectedValue);
                var pageTitle   = KeywordManager.GetFunctionName(keywordType, functionID);

                var clickString = string.Empty;

                if (Request.QueryString["itemIndex"] != null)
                {
                    clickString =
                        $@"window.parent.{jsMethod}({itemIndex}, '{EKeywordTypeUtils.GetValue(keywordType)}', {functionID}, '{pageTitle}');{JsUtils
                            .OpenWindow.HIDE_POP_WIN}";
                }
                else
                {
                    clickString =
                        $@"window.parent.{jsMethod}('{EKeywordTypeUtils.GetValue(keywordType)},{functionID},{pageTitle}');{JsUtils
                            .OpenWindow.HIDE_POP_WIN}";
                }

                ltlTitle.Text = $@"
<div class=""alert alert-success pull-left"" style=""margin:5px;padding-right:14px; cursor:pointer;"" onclick=""{clickString}"">
    <strong style=""color: #468847"">{pageTitle}</strong>
</div>";
            }
        }
        public static void Highlighting(RichTextBox richTextBox, DatabaseType databaseType, bool keepPosition = true, int?startIndex = null, int?stopIndex = null)
        {
            int start = richTextBox.SelectionStart;

            var dataTypes = DataTypeManager.GetDataTypeSpecifications(databaseType).Select(item => item.Name);
            var keywords  = KeywordManager.GetKeywords(databaseType);
            var functions = FunctionManager.GetFunctionSpecifications(databaseType).Select(item => item.Name).Except(keywords);

            string dataTypesRegex = $@"\b({string.Join("|", dataTypes)})\b";
            string keywordsRegex  = $@"\b({string.Join("|", keywords)})\b";
            string functionsRegex = $@"\b({string.Join("|", functions)})\b";
            string stringRegex    = $@"(['][^'^(^)]*['])";

            Highlighting(richTextBox, dataTypesRegex, RegexOptions.IgnoreCase, Color.Blue);
            Highlighting(richTextBox, keywordsRegex, RegexOptions.IgnoreCase, Color.Blue);
            Highlighting(richTextBox, functionsRegex, RegexOptions.IgnoreCase, ColorTranslator.FromHtml("#FF00FF"));
            Highlighting(richTextBox, stringRegex, RegexOptions.IgnoreCase, Color.Red);

            string commentString = databaseType == DatabaseType.MySql ? "#" : "--";
            string commentRegex  = $@"({commentString}).*[\n]?";

            Highlighting(richTextBox, commentRegex, RegexOptions.IgnoreCase, Color.Green);

            richTextBox.SelectionStart  = keepPosition ? start : 0;
            richTextBox.SelectionLength = 0;
            richTextBox.Focus();
        }
Beispiel #4
0
        public string GetFunctionOrChannelOrContentSelectScript(WebMenuInfo menuInfo)
        {
            if (ENavigationTypeUtils.Equals(menuInfo.NavigationType, ENavigationType.Function))
            {
                if (menuInfo.FunctionId > 0)
                {
                    var functionName = KeywordManager.GetFunctionName(EKeywordTypeUtils.GetEnumType(menuInfo.KeywordType), menuInfo.FunctionId);
                    return($@"selectKeyword(""{menuInfo.KeywordType},{menuInfo.FunctionId},{functionName}"")");
                }
            }
            else if (ENavigationTypeUtils.Equals(menuInfo.NavigationType, ENavigationType.Site))
            {
                if (menuInfo.ContentId > 0)
                {
                    var tableStyle = NodeManager.GetTableStyle(PublishmentSystemInfo, menuInfo.ChannelId);
                    var tableName  = NodeManager.GetTableName(PublishmentSystemInfo, menuInfo.ChannelId);

                    var contentInfo = DataProvider.ContentDao.GetContentInfo(tableStyle, tableName, menuInfo.ContentId);

                    var pageUrl = PageUtilityWX.GetContentUrl(PublishmentSystemInfo, contentInfo);

                    return
                        ($@"contentSelect(""{contentInfo.Title}"", ""{menuInfo.ChannelId}"", ""{menuInfo.ContentId}"", ""{pageUrl}"")");
                }
                else if (menuInfo.ChannelId > 0)
                {
                    var nodeNames = NodeManager.GetNodeNameNavigation(PublishmentSystemId, menuInfo.ChannelId);
                    var pageUrl   = PageUtilityWX.GetChannelUrl(PublishmentSystemInfo, NodeManager.GetNodeInfo(PublishmentSystemId, menuInfo.ChannelId));
                    return($"selectChannel('{nodeNames}', '{menuInfo.ChannelId}', '{pageUrl}');");
                }
            }

            return(string.Empty);
        }
    void Awake()
    {
        keyWordManager = GetComponent <KeywordManager> ();

        /* TODO: DEVELOPER CODING EXERCISE 3.a */

        // 3.a: Create a new DictationRecognizer and assign it to dictationRecognizer variable.
        dictationRecognizer = new DictationRecognizer();

        // 3.a: Register for dictationRecognizer.DictationHypothesis and implement DictationHypothesis below
        // This event is fired while the user is talking. As the recognizer listens, it provides text of what it's heard so far.
        dictationRecognizer.DictationHypothesis += DictationRecognizer_DictationHypothesis;

        // 3.a: Register for dictationRecognizer.DictationResult and implement DictationResult below
        // This event is fired after the user pauses, typically at the end of a sentence. The full recognized string is returned here.
        dictationRecognizer.DictationResult += DictationRecognizer_DictationResult;

        // 3.a: Register for dictationRecognizer.DictationComplete and implement DictationComplete below
        // This event is fired when the recognizer stops, whether from Stop() being called, a timeout occurring, or some other error.
        dictationRecognizer.DictationComplete += DictationRecognizer_DictationComplete;

        // 3.a: Register for dictationRecognizer.DictationError and implement DictationError below
        // This event is fired when an error occurs.
        dictationRecognizer.DictationError += DictationRecognizer_DictationError;

        // Query the maximum frequency of the default microphone. Use 'unused' to ignore the minimum frequency.
        int unused;

        Microphone.GetDeviceCaps(deviceName, out unused, out samplingRate);

        // Use this string to cache the text currently displayed in the text box.
        textSaid = new StringBuilder();
    }
    private void RegisterCommands()
    {
        KeywordManager keywordManager = Camera.main.GetComponent <KeywordManager>();

        if (keywordManager != null)
        {
            Debug.Log("[HololensAvatarLogic:Start] updating keyword listeners");
            foreach (KeywordManager.KeywordAndResponse kna in keywordManager.KeywordsAndResponses)
            {
                switch (kna.Keyword.ToLower())
                {
                case "reset":
                    kna.Response.AddListener(this.CommandUnlockKinectCalibration);
                    break;

                case "place":
                    kna.Response.AddListener(this.CommandLockKinectCalibration);
                    break;

                case "next":
                    kna.Response.AddListener(this.CommandNext);
                    break;

                case "back":
                    kna.Response.AddListener(this.CommandPrevious);
                    break;
                }
            }
        }
        else
        {
            Debug.LogWarning("[KinectCalibrationPlane:Start] Didn't locate KeywordManager");
        }
    }
Beispiel #7
0
        public void ReFresh(object sender, EventArgs e)
        {
            try
            {
                if (!string.IsNullOrEmpty(ddlKeywordType.SelectedValue))
                {
                    spContents.ControlToPaginate = rptContents;
                    spContents.ConnectionString  = BaiRongDataProvider.ConnectionString;

                    var keywordType = EKeywordTypeUtils.GetEnumType(ddlKeywordType.SelectedValue);

                    spContents.SelectCommand = KeywordManager.GetFunctionSqlString(PublishmentSystemID, keywordType);

                    spContents.ItemsPerPage    = 50;
                    spContents.SortField       = "ID";
                    spContents.SortMode        = SortMode.DESC;
                    rptContents.ItemDataBound += new RepeaterItemEventHandler(rptContents_ItemDataBound);

                    spContents.DataBind();

                    phFunction.Visible = rptContents.Items.Count > 0;
                }
            }
            catch (Exception ex)
            {
                PageUtils.RedirectToErrorPage(ex.Message);
            }
        }
Beispiel #8
0
    // private int counter; // for keyboard input

    // Use this for initialization
    void Start()
    {
        stage          = 1;
        keywordManager = GetComponent <KeywordManager>();
        FotoPanik.SetActive(false);
        Debug.Log("Sag: blackout / ready");
    }
Beispiel #9
0
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            if (Page.IsPostBack && Page.IsValid)
            {
                var selectedStep = 0;
                if (PhStep1.Visible)
                {
                    selectedStep = 1;
                }
                if (selectedStep == 1)
                {
                    var isConflict       = false;
                    var conflictKeywords = string.Empty;
                    if (!string.IsNullOrEmpty(TbKeywords.Text))
                    {
                        if (_scenceId > 0)
                        {
                            var actInfo = DataProviderWx.CouponActDao.GetActInfo(_scenceId);
                            isConflict = KeywordManager.IsKeywordUpdateConflict(PublishmentSystemId, actInfo.KeywordId, TbKeywords.Text, out conflictKeywords);
                        }
                        else
                        {
                            isConflict = KeywordManager.IsKeywordInsertConflict(PublishmentSystemId, TbKeywords.Text, out conflictKeywords);
                        }
                    }

                    if (isConflict)
                    {
                        FailMessage($"触发关键词“{conflictKeywords}”已存在,请设置其他关键词");
                        PhStep1.Visible = true;
                    }
                }
            }
        }
Beispiel #10
0
        public void ReFresh(object sender, EventArgs e)
        {
            try
            {
                if (!string.IsNullOrEmpty(DdlKeywordType.SelectedValue))
                {
                    SpContents.ControlToPaginate = RptContents;

                    var keywordType = EKeywordTypeUtils.GetEnumType(DdlKeywordType.SelectedValue);

                    SpContents.SelectCommand = KeywordManager.GetFunctionSqlString(PublishmentSystemId, keywordType);

                    SpContents.ItemsPerPage    = 50;
                    SpContents.SortField       = "ID";
                    SpContents.SortMode        = SortMode.DESC;
                    RptContents.ItemDataBound += rptContents_ItemDataBound;

                    SpContents.DataBind();

                    PhFunction.Visible = RptContents.Items.Count > 0;
                }
            }
            catch (Exception ex)
            {
                PageUtils.RedirectToErrorPage(ex.Message);
            }
        }
Beispiel #11
0
        public static string GetNavigationUrl(PublishmentSystemInfo publishmentSystemInfo, ENavigationType navigationType, EKeywordType keywordType, int functionID, int channelID, int contentID, string url)
        {
            var navigationUrl = string.Empty;

            if (navigationType == ENavigationType.Url)
            {
                navigationUrl = url;
            }
            else if (navigationType == ENavigationType.Function)
            {
                navigationUrl = KeywordManager.GetFunctionUrl(publishmentSystemInfo, keywordType, functionID);
            }
            else if (navigationType == ENavigationType.Site)
            {
                if (contentID > 0)
                {
                    var tableStyle = NodeManager.GetTableStyle(publishmentSystemInfo, channelID);
                    var tableName  = NodeManager.GetTableName(publishmentSystemInfo, channelID);

                    var contentInfo = DataProvider.ContentDao.GetContentInfo(tableStyle, tableName, contentID);

                    navigationUrl = PageUtilityWX.GetContentUrl(publishmentSystemInfo, contentInfo);
                }
                else if (channelID > 0)
                {
                    var nodeNames = NodeManager.GetNodeNameNavigation(publishmentSystemInfo.PublishmentSystemId, channelID);
                    navigationUrl = PageUtilityWX.GetChannelUrl(publishmentSystemInfo, NodeManager.GetNodeInfo(publishmentSystemInfo.PublishmentSystemId, channelID));
                }
            }

            return(navigationUrl);
        }
Beispiel #12
0
    /*
     * stage = 1 // Angst Intro
     * stage = 2 // Ängste sortieren
     * stage = 3 // Pyramide fertig
     */

    // Use this for initialization
    void Start()
    {
        keywordManager = GetComponent <KeywordManager>();
        stage          = 1;
        Steine.SetActive(false);
        intro.Play();
        Debug.Log("Sag: okay");
    }
Beispiel #13
0
        public void Setup()
        {
            var config = new LibraryConfig();

            config.Assembly = "NRobot.Server.Test";
            config.TypeName = Typename;
            _keywordManager = new KeywordManager();
            _keywordManager.AddLibrary(config);
        }
Beispiel #14
0
        public void ClassAccess_StaticClass()
        {
            var config    = new LibraryConfig();
            var kwmanager = new KeywordManager();

            config.Assembly = "NRobot.Server.Test";
            config.TypeName = "NRobot.Server.Test.Keywords.StaticClass";
            kwmanager.AddLibrary(config);
        }
Beispiel #15
0
        public void LoadAssembly_WithNullConfig()
        {
            //setup
            var config    = new LibraryConfig();
            var kwmanager = new KeywordManager();

            //load
            kwmanager.AddLibrary(config);
        }
Beispiel #16
0
    private IEnumerator RestartSpeechSystem(KeywordManager keywordToStart)
    {
        while (dictationRecognizer != null && dictationRecognizer.Status == SpeechSystemStatus.Running)
        {
            yield return(null);
        }

        keywordToStart.StartKeywordRecognizer();
    }
 /// <summary>
 /// Constructor
 /// </summary>
 public HttpService(XmlRpcService rpcService, KeywordManager keywordManager, int port)
 {
     _rpcService     = rpcService;
     _keywordManager = keywordManager;
     _port           = port;
     //setup http listener
     _listener = new HttpListener();
     _listener.Prefixes.Add(String.Format("http://*:{0}/", _port));
     _httpthread = null;
 }
Beispiel #18
0
 public void SetupIntellisence()
 {
     this.intellisenseSetuped = true;
     this.enableIntellisense  = true;
     this.keywords            = KeywordManager.GetKeywords(this.DatabaseType);
     this.builtinFunctions    = FunctionManager.GetFunctionSpecifications(this.DatabaseType);
     this.schemaInfo          = DataStore.GetSchemaInfo(this.DatabaseType);
     this.allWords            = SqlWordFinder.FindWords(this.DatabaseType, "");
     this.dbOwners            = this.allWords.Where(item => item.Type == SqlWordTokenType.Owner).Select(item => item.Text).ToList();
 }
Beispiel #19
0
        public void ClassAccess_InternalClass()
        {
            var config    = new LibraryConfig();
            var kwmanager = new KeywordManager();

            config.Assembly = "NRobot.Server.Test";
            config.TypeName = "NRobot.Server.Test.Keywords.InternalClass";
            kwmanager.AddLibrary(config);
            Assert.True(kwmanager.GetKeywordNamesForType("NRobot.Server.Test.Keywords.InternalClass").Length == 0);
        }
Beispiel #20
0
 void Start()
 {
     CustomMessages.Instance.MessageHandlers[CustomMessages.TestMessageID.AnchorRequest]  = this.ProcessAnchorRequest;
     CustomMessages.Instance.MessageHandlers[CustomMessages.TestMessageID.AnchorComplete] = this.ProcessAnchorComplete;
     CustomMessages.Instance.MessageHandlers[CustomMessages.TestMessageID.PlayerReady]    = this.SecondPlayerReadyCheck;
     SharingSessionTracker.Instance.SessionJoined += Instance_SessionJoined;
     pickup        = PickUpManager.Instance;
     healthDisplay = HealthDisplayBehavior.Instance;
     keyword       = KeywordManager.Instance;
     uiMgr         = GameObject.FindWithTag("GameUI").GetComponent <Game_UIManager>();
     gameEnded     = false;
 }
 public NRobotService(NRobotServerConfig config)
 {
     if (config == null)
     {
         throw new Exception("No configuration specified");
     }
     _config         = config;
     _keywordManager = new KeywordManager();
     _rpcService     = new XmlRpcService(_keywordManager);
     _httpservice    = new HttpService(_rpcService, _keywordManager, config.Port);
     LoadKeywords();
 }
Beispiel #22
0
 private IEnumerator RestartSpeechSystem(KeywordManager keywordToStart)
 {
     while (dictationRecognizer != null && dictationRecognizer.Status == SpeechSystemStatus.Running)
     {
         yield return(null);
     }
     if (PhraseRecognitionSystem.Status.ToString() == "Stopped")
     {
         PhraseRecognitionSystem.Restart();
     }
     keywordToStart.StartKeywordRecognizer();
 }
Beispiel #23
0
        public void LoadAssembly_WithUnknownType()
        {
            //setup
            var config    = new LibraryConfig();
            var kwmanager = new KeywordManager();

            //config
            config.Assembly = "NRobot.Server.Test";
            config.TypeName = "NRobot.Server.Test.Keywords.UnknownType";
            //load
            kwmanager.AddLibrary(config);
        }
Beispiel #24
0
        public void LoadAssembly_GACAssembly()
        {
            //setup
            var config    = new LibraryConfig();
            var kwmanager = new KeywordManager();

            //config
            config.Assembly = "system, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089";
            config.TypeName = "System.Timers.Timer";
            //load
            kwmanager.AddLibrary(config);
        }
Beispiel #25
0
    /*
     * stage = 1 // start introduction
     * stage = 2 // ChooseGender
     * stage = 3 // ChooseOwl
     * stage = 4 // end introduction and set next scene
     */

    void Start()
    {
        stage          = 1;
        keywordManager = GetComponent <KeywordManager> ();
        //Debug.Log("Stage: " + stage);

        Eule.SetActive(false);
        EulenAuswahl.SetActive(false);

        start.Play();
        Debug.Log("Sag: yes, okay");
    }
Beispiel #26
0
        public void GetKeywordDocumentation_NoXMLFileLoaded()
        {
            var config = new LibraryConfig();

            config.Assembly = "NRobot.Server.Test";
            config.TypeName = "NRobot.Server.Test.Keywords.WithDocumentationClass";
            var keywordManager = new KeywordManager();

            keywordManager.AddLibrary(config);
            var keyword = keywordManager.GetKeyword(Typename, "MethodWithComments");

            Assert.IsTrue(String.IsNullOrEmpty(keyword.KeywordDocumentation));
        }
Beispiel #27
0
        public void LoadAssembly_WithUnknownXMLDocumentation()
        {
            //setup
            var config    = new LibraryConfig();
            var kwmanager = new KeywordManager();

            //config
            config.Assembly      = "NRobot.Server.Test";
            config.TypeName      = "NRobot.Server.Test.Keywords.TestKeywords";
            config.Documentation = "NRobot.Server.Test.Unknown.xml";
            //load
            kwmanager.AddLibrary(config);
        }
Beispiel #28
0
    void Awake()
    {
        CommunicatorOpen = false;

        openCommunicatorTooltipGameObject = Instantiate(OpenCommunicatorTooltip);

        openCommunicatorTooltipGameObject.transform.position = new Vector3(
            gameObject.transform.position.x + 0.1f,
            gameObject.transform.position.y + 0.05f,
            gameObject.transform.position.z - 0.05f);

        openCommunicatorTooltipGameObject.transform.parent = gameObject.transform;
        openCommunicatorTooltipGameObject.SetActive(false);

        keywordManager = GetComponent <KeywordManager>();
    }
Beispiel #29
0
    private void AddActiveKeywords(KeywordManager keywordManager)
    {
        // Convert the struct array into a dictionary, with the keywords as the keys and the methods as the values.
        responsesLookup = keywordManager.KeywordsAndResponses.ToDictionary(
            keywordAndResponse => keywordAndResponse.Keyword,
            keywordAndResponse => keywordAndResponse.Response);

        // Find which keywords have wired up responses in the editor and display only those.
        foreach (string keyword in responsesLookup.Keys)
        {
            if (responsesLookup[keyword].GetPersistentEventCount() != 0)
            {
                sb.AppendLine(keyword);
            }
        }
    }
Beispiel #30
0
    protected void Page_Load(object sender, EventArgs e)
    {
        IApplicationContext context = ContextRegistry.GetContext();

        _keywordManager = (KeywordManager)context.GetObject("keywordManager");

        cmdSave.Click  += cmdSave_Click;
        cmdSave2.Click += cmdSave_Click;

        siteList.SelectedItemChanged += siteList_SelectedItemChanged;

        if (!IsPostBack)
        {
            siteList.PopulatePageList();
            populateInitialKeywordList();
        }
    }
Beispiel #31
0
        public static void Main(string[] args)
        {
            int port;
            if(args.Length != 1 || !int.TryParse(args[0], out port))
            {
                Console.Error.WriteLine("Provide a valid port number as an argument.");
                return;
            }

            var keywordManager = new KeywordManager();
            TypeManager.Instance.AutoLoadedType += keywordManager.Register;

            var processor = new XmlRpcServer(keywordManager);
            server = new HttpServer(processor);
            server.Run(port);
            server.Dispose();
        }
Beispiel #32
0
 public Keyword(KeywordManager manager, MethodInfo info)
 {
     this.manager = manager;
     methodInfo = info;
 }
Beispiel #33
0
 public XmlRpcServer(KeywordManager keywordManager)
 {
     this.keywordManager = keywordManager;
 }