Пример #1
0
        public override object ExecuteAction(BaseActionItem actionItem)
        {
            switch (actionItem.Action)
            {
            case NodeActions.Open:
                OpenActionResult oar = new OpenActionResult();
                oar.Source = File.ReadAllText(this.Url);
                oar.Url    = this.Url;
                var els = this.Url.Split('.');
                oar.Language = els[els.Length - 1];
                return(oar);

            case NodeActions.ExternalOpen:
                //for this we only need the path
                return(this.Url);

            //for plugins always return the real object
            case NodeActions.Plugin:
                if (_file != null)
                {
                    return(_file);
                }
                else
                {
                    return(null);
                }

            default:
                return(null);
            }
        }
Пример #2
0
        public override object ExecuteAction(BaseActionItem actionItem)
        {
            switch (actionItem.Action)
            {
            case NodeActions.Open:
                if (base.SPObject != null)
                {
                    OpenActionResult oar = new OpenActionResult();
                    oar.Source   = this.SPObject.ToString();
                    oar.Language = "csharp";
                    return(oar);
                }
                else
                {
                    return(null);
                }

            case NodeActions.ExternalOpen:
                if (!string.IsNullOrEmpty(base.Url))
                {
                    return(base.RootNode.NodeConnector.Endpoint + base.Url);
                }
                else
                {
                    return(null);
                }

            default:
                return(null);
            }
        }
Пример #3
0
        public override object ExecuteAction(BaseActionItem actionItem)
        {
            GithubConnector connector = (GithubConnector)this.RootNode.NodeConnector;

            switch (actionItem.Action)
            {
            case NodeActions.Open:
                OpenActionResult oar = new OpenActionResult();
                oar.Source = connector.GetSource(this.Url);
                var els = this.Url.Split('.');
                oar.Language = els[els.Length - 1];
                return(oar);

            case NodeActions.Save:

                return(connector.GetSource(this.Url));

            case NodeActions.Copy:
                if (actionItem.Name == "Copy link")
                {
                    return(this._file.html_url);
                }
                else
                {
                    return(null);
                }


            default:
                return(null);
            }
        }
Пример #4
0
        public override object GetDefaultSource()
        {
            OpenActionResult oar = new OpenActionResult();

            oar.Source = File.ReadAllText(this.Url);
            oar.Url    = this.Url;
            var els = this.Url.Split('.');

            oar.Language = els[els.Length - 1];
            return(oar);
        }
Пример #5
0
        public override object GetDefaultSource()
        {
            GithubConnector  connector = (GithubConnector)this.RootNode.NodeConnector;
            OpenActionResult oar       = new OpenActionResult();

            oar.Source = connector.GetSource(this.Url);
            var els = this.Url.Split('.');

            oar.Language = els[els.Length - 1];
            return(oar);
        }
Пример #6
0
        public override object ExecuteAction(BaseActionItem actionItem)
        {
            switch (actionItem.Action)
            {
            case NodeActions.Open:
                if (base.SPObject != null)
                {
                    HtmlNode         node = (HtmlNode)base.SPObject;
                    OpenActionResult oar  = new OpenActionResult();
                    oar.Source   = node.OuterHtml;
                    oar.Language = "html";
                    return(oar);
                }
                else
                {
                    return(null);
                }

            default:
                return(null);
            }
        }