示例#1
0
    public void LinkCells(Cell cellA, Cell cellB)
    {
        LinkObject linkObject = GameManager.Instance.CreateLinkQuad(cellA, cellB);

        cellA.AddLinkCell(cellB, linkObject);
        cellB.AddLinkCell(cellA, linkObject);
    }
示例#2
0
 private void ProcessLink(LinkObject link)
 {
     if (link.Url.AbsolutePath.Contains("indeed"))
     {
         IndeedHandler.ProcessLink(link);
     }
 }
示例#3
0
 public void AddLinkCell(Cell cell, LinkObject linkObject)
 {
     if (!nextCells.ContainsKey(cell))
     {
         nextCells.Add(cell, linkObject);
     }
 }
示例#4
0
        void HyperlinkClick(object obj)
        {
            LinkObject link = obj as LinkObject;

            // 激活的是当前默认的浏览器
            System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(link.LinkUrl));
        }
示例#5
0
        public void LinkObjectWithMetadaShouldSerializeMetaAttribute()
        {
            var l = LinkObject.Empty(LinkType.ToOne);

            l.Meta.MyMeta = "foo";
            JToken json = l.ToJson();

            Assert.AreEqual("foo", (string)json["meta"]["my-meta"]);
        }
示例#6
0
 public static void ProcessLink(LinkObject link)
 {
     if (IsIndeedInsideLink(link.Url))
     {
         //
     }
     //var htmlDoc = HTMLHandler.GetHtml(url.Url.AbsoluteUri);
     //DatabaseHandler.SaveWebData(link.Key, link.Value, htmlDoc);
 }
示例#7
0
        public static void LoadFrom(string[] assemblyDirs, string scriptfilename, out List <ActionElement> elements, out List <ActionElementLink> links)
        {
            elements = null;
            links    = null;
            using (TaskScriptParser parser = new TaskScriptParser(assemblyDirs))
            {
                ArgAutoBingdingEnvironment env = null;
                parser.FromTaskScriptFile(scriptfilename, out env);
                if (env == null || env.ActionArgSettings == null || env.ActionArgSettings.Length == 0)
                {
                    throw new Exception("脚本文件\"" + scriptfilename + "\"为空。");
                }
                Dictionary <int, ActionElement>            eles     = new Dictionary <int, ActionElement>();
                Dictionary <LinkObject, ActionElementLink> linkObjs = new Dictionary <LinkObject, ActionElementLink>();
                foreach (ActionArgCollection action in env.ActionArgSettings)
                {
                    ActionElement ele = GetActionElement(action);
                    eles.Add(action.Id, ele);
                    //
                    foreach (ActionArg arg in action.ActionArgs)
                    {
                        switch (arg.ArgType)
                        {
                        case enumArgType.Value:
                            break;

                        case enumArgType.Var:
                            break;

                        case enumArgType.Ref:
                            LinkObject lnkObj = GetLinkObject(linkObjs, action.Id, arg.RefActionId);
                            if (lnkObj != null)     //添加一条函数映射关系
                            {
                            }
                            else
                            {
                                ActionElement     refActionElement = GetActionElement(arg.RefActionId, eles);
                                ActionElementLink actionLnk        = new ActionElementLink(refActionElement, ele);
                                linkObjs.Add(new LinkObject(action.Id, arg.RefActionId), actionLnk);
                            }
                            break;
                        }
                    }
                }
                elements = new List <ActionElement>(eles.Values.ToArray());
                links    = new List <ActionElementLink>(linkObjs.Values.ToArray());
            }
        }
示例#8
0
        private void OpenClaimObjectsWindow(object o)
        {
            //new viewmodel for new window
            LinkObjectViewModel = new LinkObjectViewModel {
                DatabaseObjects = new ObservableCollection <AssignableDatabaseObject>()
            };
            //Get the objects which were marked in the unclaimed grid on the main window and add them to new vm collection
            UnclaimedResultsGridViewModel.UnclaimedRecords.Where(x => x.IsAssign).ForEach(y => LinkObjectViewModel.DatabaseObjects.Add(y));
            //new window
            var linkWindow = new LinkObject {
                DataContext = LinkObjectViewModel
            };

            linkWindow.Show();
            LinkObjectViewModel.LinkObjectsChanged += HandleObjectsLinked;
        }
 public void CheckLinkObject(RaycastHit hit)
 {
     if (hit.collider.gameObject.GetComponent <LinkObject>() != null)
     {
         linkObject  = hit.collider.gameObject.GetComponent <LinkObject>();
         clickToLink = true;
         linkstring  = linkObject.linkString;
         websiteUI.ShowLinkText(linkObject.linkMessage);
     }
     else
     {
         linkObject  = null;
         clickToLink = false;
         safty       = true;
     }
 }
示例#10
0
        public IHttpActionResult Get()
        {
            var a  = StaticPersistentStore.Articles;
            var md = new TopLevelDocument <List <Article> >(a);

            md.GetMetaData().Add("response created", DateTime.Now);
            md.GetMetaData().Add("response created by", this.GetType());
            md.Links.Add("link1", new SimpleLink(new Uri("http://localhost")));

            md.Links.Add("link2", new SimpleLink(new Uri("http://localhost")));

            var complexLink = new LinkObject(new Uri("http://localhost/complex/"));

            complexLink.Meta.Add("linkmeta", "linkmetavalue");
            md.Links.Add("complexLink", complexLink);

            return(Ok(md));
        }
        public void TopLevelDocument_add_link_objects_ok()
        {
            // Arrange
            const string testString = "Test String";
            var          meta       = new MetaData();

            meta.Add("about", "this");
            var link       = new SimpleLink();
            var linkObject = new LinkObject {
                Link = link, Meta = meta
            };

            // Act
            var sut = new TopLevelDocument <string>(testString);

            sut.Links.Add("link2", linkObject);

            // Assert
            Assert.Same(linkObject, sut.Links["link2"]);
        }
示例#12
0
 public OnPropsLinkCreation(BuildingLink pBuilding, LinkObject cObj)
 {
     buildingStruct = pBuilding;
     obj            = cObj;
 }
示例#13
0
    void LoadScreen(string mapid = "screen1")
    {
        currentmapid = mapid;
        bool trackable;
        bool firstload;

        if (ObjLog.ContainsKey(mapid))
        {
            firstload = false;
        }
        else
        {
            firstload = true;
            ObjLog.Add(mapid, new List <bool>());
        }

        List <bool> thislog    = ObjLog[mapid];
        int         trackobjid = 0;
        //mapid = "screen1";
        int k;
        int minx = -200;
        int maxx = 200;
        int minz = -200;
        int maxz = 200;

        //XmlNode mapnode = dunxml.GetElementById("screen0");
        foreach (XmlNode map in mapnodes)
        {
            if (map.Attributes["id"].Value == mapid)
            {
                //Debug.Log(map.InnerXml);
                List <string>     linktargs = new List <string>();
                List <int>        linkxid   = new List <int>();
                List <LinkObject> linklist  = new List <LinkObject>();
                foreach (XmlNode mapdetail in map.ChildNodes)
                {
                    if (mapdetail.Name == "grid")
                    {
                        k = int.Parse(mapdetail.Attributes["zpos"].Value);
                        string[] grid = ((mapdetail.InnerText.Replace(" ", "")).Trim()).Split('\n');

                        minz = -grid.Length + 1;
                        maxz = 0;
                        minx = 0;
                        maxx = grid[0].Length - 1;
                        int linknumber;
                        for (int i = 0; i < grid.Length; i++)
                        {
                            //Debug.Log(grid[i]);
                            for (int j = 0; j < grid[i].Length; j++)
                            {
                                if (grid[i].Length - 1 > maxx)
                                {
                                    maxx = grid[i].Length - 1;
                                }
                                GameObject nextobj;
                                if (int.TryParse(grid[i][j].ToString(), out linknumber))
                                {
                                    nextobj = Instantiate(linkobj, new Vector3(j, -i, k), Quaternion.identity, transform);
                                    LinkObject newlinkobj = nextobj.GetComponent <LinkObject>();
                                    newlinkobj.currentScreen  = mapid;
                                    newlinkobj.levelGenerator = this;
                                    newlinkobj.targetScreen   = grid[i][j].ToString();
                                    //newlinkobj.setdirection()
                                    linklist.Add(newlinkobj);
                                    if (linktargs.Contains(grid[i][j].ToString()))
                                    {
                                        newlinkobj.xidnum = linkxid[linktargs.IndexOf(grid[i][j].ToString())] + 1;
                                        linkxid[linktargs.IndexOf(grid[i][j].ToString())]++;
                                    }
                                    else
                                    {
                                        linktargs.Add(grid[i][j].ToString());
                                        linkxid.Add(0);
                                        newlinkobj.xidnum = 0;
                                    }
                                }
                                else
                                {
                                    bool addobj = true;
                                    trackable = false;
                                    nextobj   = SymbolToObject(grid[i][j].ToString(), SymbolLegend.ToArray(), out trackable);
                                    if (nextobj != null)
                                    {
                                        if (trackable)
                                        {
                                            if (firstload)
                                            {
                                                thislog.Add(true);
                                                //trackobjid++;
                                            }
                                            else
                                            {
                                                addobj = thislog[trackobjid];
                                            }
                                            trackobjid++;
                                        }
                                        if (addobj)
                                        {
                                            nextobj = Instantiate(nextobj, new Vector3(j, -i, k), Quaternion.identity, transform);
                                            if (trackable)
                                            {
                                                if (nextobj.tag == "Monster")
                                                {
                                                    nextobj.GetComponent <Monster>().SetID(trackobjid - 1);
                                                }
                                                else if (nextobj.tag == "Item")
                                                {
                                                    nextobj.GetComponent <Item>().SetID(trackobjid - 1);
                                                }
                                                else if (nextobj.tag == "LockDoor")
                                                {
                                                    nextobj.GetComponent <LockDoor>().SetID(trackobjid - 1);
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }

                foreach (XmlNode mapdetail in map.ChildNodes)
                {
                    string exitid;
                    string exittarget;
                    if (mapdetail.Name == "exit")
                    {
                        exitid     = mapdetail.Attributes["id"].Value;
                        exittarget = mapdetail.Attributes["target"].Value;
                        foreach (LinkObject newlinkobj in linklist)
                        {
                            if (newlinkobj.targetScreen == exitid)
                            {
                                newlinkobj.targetScreen = exittarget;
                                newlinkobj.SetDirection(mapdetail.Attributes["direction"].Value);
                            }
                        }
                    }
                }

                centerx = (maxx + minx) / 2;
                cameraScript.SetBoundaries(minx, maxx, minz, maxz);
            }
        }
        //Debug.Log(mapnode.InnerXml);
    }
示例#14
0
            public void ExtractOfficial(ref StringBuilder sb, ref List <LinkObject> linkList, string openingTag)
            {
                try
                {
                    string closingTag = "}}";

                    int p1 = -1;
                    for (int i = 0; i < sb.Length - closingTag.Length + 1; i++)
                    {
                        if ((p1 == -1) && (sb[i] == openingTag[0]))
                        {
                            for (int j = 1; j < openingTag.Length; j++)
                            {
                                if (sb[i + j] != openingTag[j])
                                {
                                    goto skip;
                                }
                            }
                            p1 = i;
                        }
                        else if ((p1 != -1) && (sb[i] == closingTag[0]))
                        {
                            for (int j = 1; j < closingTag.Length; j++)
                            {
                                if (sb[i + j] != closingTag[j])
                                {
                                    goto skip;
                                }
                            }
                            string urltitle = sb.ToString(p1 + openingTag.Length, i - p1 - openingTag.Length).Trim();

                            LinkObject link = new LinkObject();
                            //extract title, if available
                            int p2 = urltitle.IndexOf("|");
                            if (p2 != -1)
                            {
                                urltitle = urltitle.Remove(p2);
                            }
                            p2 = urltitle.IndexOf("l=");
                            if (p2 != -1)
                            {
                                urltitle = urltitle.Substring(2);
                            }
                            link.title = "Official homepage";
                            if (!urltitle.StartsWith("http"))
                            {
                                if (openingTag.Contains("dmoz"))
                                {
                                    link.title = urltitle.Replace("/", ": ").Replace("_", " ") + " - Open Directory"; urltitle = "http://www.dmoz.org/" + urltitle;
                                }
                                else
                                {
                                    urltitle = "http://" + urltitle;
                                }
                            }
                            //strip hash
                            link.url = StripHash(urltitle).Trim();


                            //prevent double
                            if (!linkList.Contains(link))
                            {
                                //internal links need to be extracted differently
                                link.isOfficial = true;
                                link.isExternal = true;
                                linkList.Add(link);
                            }

                            return;
                        }
                        skip :;
                    }
                }
                catch (Exception e)
                {
                    Trace.WriteLine(DateTime.UtcNow.ToString() + " " + "ExtractOfficial: " + e.Message);
                }
            }
示例#15
0
 /// <summary>
 /// Column Link class Constructor
 /// </summary>
 /// <param name="column">column number(From 0)</param>
 /// <param name="link">LinkObject</param>
 public ColumnLink(int column, LinkObject link)
 {
     Column = column;
     Link = link;
 }
示例#16
0
            public void ExtractVCite(ref StringBuilder sb, ref List <LinkObject> linkList, string wikipediaTitle)
            {
                try
                {
                    string openingTag1 = "{{cite";
                    string openingTag2 = "{{vcite";
                    string closingTag  = "}}";

                    int p1 = -1;
                    int l1 = 0;
                    for (int i = 0; i < sb.Length - closingTag.Length + 1; i++)
                    {
                        if ((p1 == -1) && (sb[i] == openingTag1[0])) //1. char is the same on tag1 and tag2
                        {
                            for (int j = 1; j < openingTag1.Length; j++)
                            {
                                if (sb[i + j] != openingTag1[j])
                                {
                                    goto next;
                                }
                            }
                            l1 = 7;
                            goto noskip;
next:
                            for (int j = 1; j < openingTag2.Length; j++)
                            {
                                if (sb[i + j] != openingTag2[j])
                                {
                                    goto skip;
                                }
                            }
                            l1          = 8;
                            noskip : p1 = i;
                        }
                        else if ((p1 != -1) && (sb[i] == closingTag[0]))
                        {
                            for (int j = 1; j < closingTag.Length; j++)
                            {
                                if (sb[i + j] != closingTag[j])
                                {
                                    goto skip;
                                }
                            }

                            //content between opening and closing tag
                            string urltitle = sb.ToString(p1 + l1, i - p1 - l1).Trim();

                            LinkObject link = new LinkObject();
                            //extract title, if available
                            int p2 = urltitle.IndexOf("|url=");
                            if (p2 != -1)
                            {
                                int p3 = urltitle.IndexOf("|", p2 + 1);
                                if (p3 != -1)
                                {
                                    //strip hash
                                    link.url = StripHash(urltitle.Substring(p2 + 5, p3 - p2 - 5)).Trim();
                                }
                            }

                            p2 = urltitle.IndexOf("|doi=");
                            if (p2 != -1)
                            {
                                int p3 = urltitle.IndexOf("|", p2 + 1);
                                if (p3 != -1)
                                {
                                    //strip hash
                                    if (String.IsNullOrEmpty(link.url))
                                    {
                                        link.url = "http://dx.doi.org/" + StripHash(urltitle.Substring(p2 + 5, p3 - p2 - 5)).Trim();
                                    }
                                }
                            }

                            p2 = urltitle.IndexOf("|pmid=");
                            if (p2 != -1)
                            {
                                int p3 = urltitle.IndexOf("|", p2 + 1);
                                if (p3 != -1)
                                {
                                    //strip hash
                                    if (String.IsNullOrEmpty(link.url))
                                    {
                                        link.url = "http://www.ncbi.nlm.nih.gov/pubmed/" + StripHash(urltitle.Substring(p2 + 6, p3 - p2 - 6)).Trim() + "?dopt=Abstract";
                                    }
                                }
                            }

                            p2 = urltitle.IndexOf("|pmc=");
                            if (p2 != -1)
                            {
                                int p3 = urltitle.IndexOf("|", p2 + 1);
                                if (p3 != -1)
                                {
                                    //strip hash
                                    if (String.IsNullOrEmpty(link.url))
                                    {
                                        link.url = "http://www.ncbi.nlm.nih.gov/pmc/articles/PMC" + StripHash(urltitle.Substring(p2 + 5, p3 - p2 - 5)).Trim() + "/";
                                    }
                                }
                            }

                            int p4 = urltitle.IndexOf("|title=");
                            if (p4 != -1)
                            {
                                int p5 = urltitle.IndexOf("|", p4 + 1);
                                if (p5 != -1)
                                {
                                    link.title = urltitle.Substring(p4 + 7, p5 - p4 - 7).Trim();
                                }
                            }

                            //prevent double
                            if (!String.IsNullOrEmpty(link.url) && !linkList.Contains(link))
                            {
                                //contains wikipedia title in domain
                                if (link.url.IndexOf("." + wikipediaTitle, StringComparison.OrdinalIgnoreCase) != -1)
                                {
                                    link.isOfficial = true;
                                }
                                link.isExternal = true;
                                linkList.Add(link);
                            }

                            i  = i + closingTag.Length;
                            p1 = -1;
                        }
                        skip :;
                    }
                }
                catch (Exception e)
                {
                    Trace.WriteLine(DateTime.UtcNow.ToString() + " " + "ExtractVCite: " + e.Message + " #" + sb.ToString() + "#");
                }
            }
        static StaticPersistentStore()
        {
            currentId = 1;

            Articles = new List <Article>();
            People   = new List <Person>();
            Comments = new List <Comment>();

            var article1 = new Article("JSON API paints my bikeshed!");
            var article2 = new Article("JSON API makes the tea!");

            var person1 = new Person("Dan", "Gebhardt", "dgeb");

            ((IObjectMetaDataContainer)person1).GetMetaData().Add("person created", DateTime.Now);
            ((IRelationshipMetaDataContainer)person1).GetMetaData().Add("relation for person created", DateTime.Now);
            var person2 = new Person("Rob", "Lang", "brainwipe");

            var comment1 = new Comment("First!");

            (comment1 as IRelationshipMetaDataContainer).GetMetaData().Add("relation for comment created", DateTime.Now);
            var comment2 = new Comment("I like XML Better");
            var comment3 = new Comment("First! More");
            var comment4 = new Comment("I like XML Better More");

            article1.Author = person1;
            article1.Comments.Add(comment1);
            article1.Comments.Add(comment2);
            article1.MoreComments.Add(comment3);
            article1.MoreComments.Add(comment4);
            article1.GetMetaData().Add("article created", DateTime.Now);

            article1.GetLinks().Add("simplelink", new SimpleLink(new Uri("http://localhost/simplelink")));

            var complexLink = new LinkObject(new Uri("http://localhost/complex/"));

            complexLink.Meta.Add("linkmeta", "linkmetavalue");
            article1.GetLinks().Add("complexLink", complexLink);

            article1.SingleTag = new Tag {
                Key = "tag key", Value = "single tag value"
            };
            article1.MoreTags.Add(new Tag {
                Key = "tag key (more)", Value = "tag value 1"
            });
            article1.MoreTags.Add(new Tag {
                Key = "tag key (more)", Value = "tag value 2"
            });
            article1.PublishedInYears.Add(1987);
            article1.PublishedInYears.Add(2001);
            article1.PublishedInYears.Add(2005);
            Articles.Add(article1);

            article2.Author = person2;
            Articles.Add(article2);

            People.Add(person1);
            People.Add(person2);

            comment1.Author = person1;
            comment2.Author = person2;

            Comments.Add(comment1);
            Comments.Add(comment2);
            Comments.Add(comment3);
            Comments.Add(comment4);
        }
示例#18
0
            public void ExtractLinks(ref StringBuilder sb, ref List <LinkObject> linkList, string wikipediaTitle)
            {
                try
                {
                    string openingTag = "[http";
                    string closingTag = "]";

                    int p1 = -1;
                    for (int i = 0; i < sb.Length - closingTag.Length + 1; i++)
                    {
                        if ((p1 == -1) && (sb[i] == openingTag[0]))
                        {
                            for (int j = 1; j < openingTag.Length; j++)
                            {
                                if (sb[i + j] != openingTag[j])
                                {
                                    goto skip;
                                }
                            }
                            p1 = i;
                        }
                        else if ((p1 != -1) && (sb[i] == closingTag[0]))
                        {
                            for (int j = 1; j < closingTag.Length; j++)
                            {
                                if (sb[i + j] != closingTag[j])
                                {
                                    goto skip;
                                }
                            }
                            string urltitle = sb.ToString(p1 + 1, i - p1 - 1).Trim();

                            LinkObject link = new LinkObject();
                            //extract title, if available
                            int p2 = urltitle.IndexOf(" ");
                            if (p2 == -1)
                            {
                                //strip hash
                                link.url   = StripHash(urltitle).Trim();
                                link.title = "";
                            }
                            else
                            {
                                //strip hash
                                link.url   = StripHash(urltitle.Substring(0, p2)).Trim();
                                link.title = urltitle.Substring(p2 + 1).Trim();
                            }
                            //prevent double
                            if (!linkList.Contains(link))
                            {
                                //contains wikipedia title in domain
                                if (link.url.IndexOf("." + wikipediaTitle, StringComparison.OrdinalIgnoreCase) != -1)
                                {
                                    link.isOfficial = true;
                                }
                                link.isExternal = true;
                                linkList.Add(link);
                            }

                            i = i + closingTag.Length;

                            p1 = -1;
                        }
                        skip :;
                    }
                }
                catch (Exception e)
                {
                    Trace.WriteLine(DateTime.UtcNow.ToString() + " " + "ExtractLinks error: " + e.Message + " #" + sb.ToString() + "#");
                }
            }