Ejemplo n.º 1
0
        public static DefineableAction Parse(string s)
        {
            s = s.Trim();
            DefineableAction action = new DefineableAction();

            if (s.StartsWith("https") || s.StartsWith("www"))
            {
                action.type = DefineableActionType.URL;
                action.data = s;
            }
            else if (s.StartsWith("tag::"))
            {
                action.type = DefineableActionType.SET_TAG;
                action.data = s.Replace("tag::", "");
            }
            else if (s.StartsWith("shader="))
            {
                action.type = DefineableActionType.SET_SHADER;
                action.data = s.Replace("shader=", "");
            }
            else if (s.Contains("="))
            {
                action.type = DefineableActionType.SET_PROPERTY;
                action.data = s;
            }
            return(action);
        }
Ejemplo n.º 2
0
        public static DefineableAction Parse(string s)
        {
            s = s.Trim();
            DefineableAction action = new DefineableAction();

            if (s.StartsWith("http", StringComparison.Ordinal) || s.StartsWith("www", StringComparison.Ordinal))
            {
                action.type = DefineableActionType.URL;
                action.data = s;
            }
            else if (s.StartsWith("tag::", StringComparison.Ordinal))
            {
                action.type = DefineableActionType.SET_TAG;
                action.data = s.Replace("tag::", "");
            }
            else if (s.StartsWith("shader=", StringComparison.Ordinal))
            {
                action.type = DefineableActionType.SET_SHADER;
                action.data = s.Replace("shader=", "");
            }
            else if (s.Contains("="))
            {
                action.type = DefineableActionType.SET_PROPERTY;
                action.data = s;
            }
            else if (Regex.IsMatch(s, @"\w+(\.\w+)"))
            {
                action.type = DefineableActionType.OPEN_EDITOR;
                action.data = s;
            }
            return(action);
        }
Ejemplo n.º 3
0
        public ThryHeaderDrawer(string end, string keyword, string buttonText, string buttonHover, string buttonAction, float isHideable)
        {
            this.end     = end;
            this.keyword = keyword;

            button        = new ButtonData();
            button.text   = buttonText;
            button.hover  = buttonHover;
            button.action = DefineableAction.ParseDrawerParameter(buttonAction);

            this.isHideable = isHideable == 1;
        }
Ejemplo n.º 4
0
        public static DefineableAction ParseDrawerParameter(string s)
        {
            s = s.Trim();
            DefineableAction action = new DefineableAction();

            if (s.StartsWith("youtube#"))
            {
                action.type = DefineableActionType.URL;
                action.data = "https://www.youtube.com/watch?v=" + s.Substring(8);
            }
            return(action);
        }
Ejemplo n.º 5
0
 // value,property1=value1,property2=value2
 public static PropertyValueAction Parse(string s)
 {
     s = s.Trim();
     string[] parts = s.Split(',');
     if (parts.Length > 0)
     {
         PropertyValueAction propaction = new PropertyValueAction();
         propaction.value = parts[0];
         List <DefineableAction> actions = new List <DefineableAction>();
         for (int i = 1; i < parts.Length; i++)
         {
             actions.Add(DefineableAction.Parse(parts[i]));
         }
         propaction.actions = actions.ToArray();
         return(propaction);
     }
     return(null);
 }