Пример #1
0
        public override Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
        {
            var path = typeof(Module).Namespace.Replace("Material", "MudBlazor");

            if (string.Equals(context.TagName, "head", StringComparison.OrdinalIgnoreCase))
            {
                output.PostContent.AppendHtml(@$ "
<link href=" "_content/{path}/css/site.css" " rel=" "stylesheet" " />
Пример #2
0
        public override Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
        {
            var path = typeof(Module).Namespace;

            if (string.Equals(context.TagName, "head", StringComparison.OrdinalIgnoreCase))
            {
                output.PostContent.AppendHtml(@$ "
<link rel=" "shortcut icon" " type=" "image/x-icon" " href=" "_content/{path}/images/favicon.ico" ">
Пример #3
0
        public int HandleSepia(int x, int y, int w, int h, HttpListenerContext listenerContext)
        {
            link newR = (r, g, b) => (byte)Math.Min(((r * .393) + (g * .769) + (b * .189)), 255);
            link newG = (r, g, b) => (byte)Math.Min(((r * .349) + (g * .686) + (b * .168)), 255);
            link newB = (r, g, b) => (byte)Math.Min(((r * .272) + (g * .534) + (b * .131)), 255);

            return(handleWithFilter(x, y, w, h, listenerContext, newR, newG, newB, false));
        }
Пример #4
0
        /// <summary>
        /// 是否開啟快速提交模式
        /// </summary>
        /// <param name="requestMsg"></param>
        /// <param name="clientLink"></param>
        /// <returns></returns>
        private bool IsRapidCommit(DhcpV6Message requestMsg, link clientLink)
        {
            if ((requestMsg.HasOption(DhcpConstants.V6OPTION_RAPID_COMMIT) && DhcpServerPolicies.EffectivePolicyAsBoolean(requestMsg, clientLink, Property.SUPPORT_RAPID_COMMIT)))
            {
                return(true);
            }

            return(false);
        }
Пример #5
0
        public int HandleSepia(int x, int y, int w, int h, HttpListenerContext listenerContext)
        {
            link   newR  = c => Math.Min((int)((c.R * .393) + (c.G * .769) + (c.B * .189)), 255);
            link   newG  = c => Math.Min((int)((c.R * .349) + (c.G * .686) + (c.B * .168)), 255);
            link   newB  = c => Math.Min((int)((c.R * .272) + (c.G * .534) + (c.B * .131)), 255);
            filter sepia = c => Color.FromArgb(c.A, newR(c), newG(c), newB(c));

            return(handleWithFilter(x, y, w, h, listenerContext, sepia));
        }
Пример #6
0
        public ActionResult UpdateLink(int id)
        {
            link mylink = dbContext.link.Find(id);

            ViewBag.id    = mylink.id;
            ViewBag.title = mylink.title;
            ViewBag.url   = mylink.url;
            ViewBag.desc  = mylink.desc;
            return(View());
        }
Пример #7
0
        public ActionResult UpdateLinks(int id)
        {
            link link = LinkBLL.UpdateLinks(id);

            ViewBag.lid = link.id;
            ViewBag.tit = link.title;
            ViewBag.url = link.url;
            ViewBag.des = link.desc;
            return(View());
        }
Пример #8
0
 public ActionResult Edit([Bind(Include = "key,webLink,linkRole")] link link)
 {
     if (ModelState.IsValid)
     {
         db.Entry(link).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(link));
 }
Пример #9
0
 public ActionResult Edit(link link)
 {
     if (ModelState.IsValid)
     {
         db.Entry(link).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(link));
 }
Пример #10
0
        /**
         * Effective policy.
         *
         * @param link the link
         * @param prop the prop
         *
         * @return the string
         */
        public static string EffectivePolicy(link link, Property prop)
        {
            string policy = GetPolicy(link.policies, prop.Key());

            if (policy != null)
            {
                return(policy);
            }
            return(GlobalPolicy(prop));
        }
Пример #11
0
        public IActionResult Post([FromBody] link li)
        {
            var entity = _ctx.Links.Add(li);

            _ctx.SaveChanges();

            var lastId = _ctx.Links.OrderByDescending(h => h.id).First();

            return(Ok(lastId.id));
        }
Пример #12
0
        //
        // GET: /admin/Link/Delete/5

        public ActionResult Delete(int id = 0)
        {
            link link = db.link.Find(id);

            if (link == null)
            {
                return(HttpNotFound());
            }
            return(View(link));
        }
Пример #13
0
        public ActionResult Create([Bind(Include = "key,webLink,linkRole")] link link)
        {
            if (ModelState.IsValid)
            {
                db.links.Add(link);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(link));
        }
Пример #14
0
        public IHttpActionResult Getlink(int id)
        {
            link link = db.links.Find(id);

            if (link == null)
            {
                return(NotFound());
            }

            return(Ok(link));
        }
Пример #15
0
        public ActionResult Create(link link)
        {
            if (ModelState.IsValid)
            {
                db.link.Add(link);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(link));
        }
Пример #16
0
        public IHttpActionResult Postlink(link link)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.links.Add(link);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = link.link_id }, link));
        }
        /**
         * Build the list of PrefixBindingPools from the list of configured PrefixPools
         * for the given configuration Link container object. The list of PrefixBindingPools
         * starts with the filtered PrefixPools followed by non-filtered PrefixPools.
         *
         * @param link the configuration Link object
         *
         * @return the list of PrefixBindingPools (<? extends BindingPool>)
         *
         * @throws DhcpServerConfigException if there is a problem parsing a configured range
         */
        protected override List <BindingPool> BuildBindingPools(link link)
        {
            List <BindingPool> bindingPools = new List <BindingPool>();
            // Put the filtered pools first in the list of pools on this link
            List <linkFilter> linkFilters = link.linkFilters;

            foreach (linkFilter linkFilter in linkFilters)
            {
                List <v6PrefixPool> poolsType = linkFilter.v6PrefixPools;
                if (poolsType != null)
                {
                    // add the filtered pools to the mapped list
                    List <v6PrefixPool> pools = poolsType;
                    if ((pools != null) && pools.Count > 0)
                    {
                        foreach (v6PrefixPool pool in pools)
                        {
                            V6PrefixBindingPool abp = BuildV6BindingPool(pool, link, linkFilter);
                            bindingPools.Add(abp);
                        }
                    }
                    else
                    {
                        log.Error("PoolList is null for PoolsType: " + poolsType);
                    }
                }
                else
                {
                    log.Info("PoolsType is null for LinkFilter: " + linkFilter.name);
                }
            }

            // add the unfiltered pools to the mapped list
            List <v6PrefixPool> unpools = link.v6PrefixPools;

            if ((unpools != null) && unpools.Count > 0)
            {
                foreach (v6PrefixPool pool in unpools)
                {
                    V6PrefixBindingPool abp = BuildV6BindingPool(pool, link);
                    bindingPools.Add(abp);
                }
            }
            else
            {
                log.Error("PoolList is null for PoolsType");
            }

            ReconcilePools(bindingPools);

            return(bindingPools);
        }
Пример #18
0
        //Instantiates a new dhcp link.

        //@param subnet the subnet
        //@param link the link

        public DhcpLink(Subnet subnet, link link)
        {
            _subnet              = subnet;
            _link                = link;
            _msgConfigOptions    = new DhcpV6ConfigOptions(link.GetV6MsgConfigOptions());
            _iaNaConfigOptions   = new DhcpV6ConfigOptions(link.GetV6IaNaConfigOptions());
            _naAddrConfigOptions = new DhcpV6ConfigOptions(link.GetV6NaAddrConfigOptions());
            _iaTaConfigOptions   = new DhcpV6ConfigOptions(link.GetV6IaTaConfigOptions());
            _taAddrConfigOptions = new DhcpV6ConfigOptions(link.GetV6TaAddrConfigOptions());
            _iaPdConfigOptions   = new DhcpV6ConfigOptions(link.GetV6IaPdConfigOptions());
            _prefixConfigOptions = new DhcpV6ConfigOptions(link.GetV6PrefixConfigOptions());
            _v4ConfigOptions     = new DhcpV4ConfigOptions(link.GetV4ConfigOptions());
        }
Пример #19
0
        public static string GetHtml(string title, IList <DataRow> rows)
        {
            var sortedRows = rows.OrderByDescending(r => r.Favorite).ThenByDescending(r => r.LastVisit);
            var res        = @$ "
<html>
  <head>
      <meta charset=" "UTF-8" ">
      <link rel=" "stylesheet" " href=" "https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" " crossorigin=" "anonymous" ">
      <link rel=" "stylesheet" " href=" "https://unpkg.com/[email protected]/dist/bootstrap-table.min.css" ">
	    <link rel="     "stylesheet" " href=" "https://unpkg.com/[email protected]/dist/extensions/filter-control/bootstrap-table-filter-control.css" ">
    </head>
  <body>    
    <div class=" "page-header" "><h2 class=" "badge-Info pl-3" ">{title}<span class=" "badge badge-light m-3" ">{rows.Count}</span></h2></div>
Пример #20
0
 public DhcpLink(Subnet subnet, link link)
 {
     this.subnet         = subnet;
     this.link           = link;
     msgConfigOptions    = new DhcpV6ConfigOptions(link.v6MsgConfigOptions);
     iaNaConfigOptions   = new DhcpV6ConfigOptions(link.v6IaNaConfigOptions);
     naAddrConfigOptions = new DhcpV6ConfigOptions(link.v6NaAddrConfigOptions);
     iaTaConfigOptions   = new DhcpV6ConfigOptions(link.v6IaTaConfigOptions);
     taAddrConfigOptions = new DhcpV6ConfigOptions(link.v6TaAddrConfigOptions);
     iaPdConfigOptions   = new DhcpV6ConfigOptions(link.v6IaPdConfigOptions);
     prefixConfigOptions = new DhcpV6ConfigOptions(link.v6PrefixConfigOptions);
     v4ConfigOptions     = new DhcpV4ConfigOptions(link.v4ConfigOptions);
 }
        // Return types are IHttpActionResult for all except the Delete() method, which  void

        // GET: api/Customers
        /// <summary>
        /// All customers
        /// </summary>
        /// <returns>Collection of Customer objects, sorted</returns>
        public IHttpActionResult Get()
        {
            var c = m.CustomerGetAll();

            // Attention 06 - Original return value
            //return Ok(c);

            // Attention 07 - New return value, with link relations

            // First, transform the object graph into one that includes the link property
            var lc = m.mapper.Map <IEnumerable <CustomerBaseWithLinks> >(c);

            // Next, create a hypermedia representation package
            var hr = new MediaTypeExample();

            // Go through each item in the collection, and configure link relations
            foreach (var item in lc)
            {
                // Add a link to "self" (il is "item link")
                var il = new link();
                il.rel  = "self";
                il.href = $"/api/customers/{item.CustomerId}";
                item.links.Add(il);

                // Add a link to "collection" (cl is "collection link)
                var cl = new link();
                cl.rel  = "collection";
                cl.href = "/api/customers";
                item.links.Add(cl);

                // Add this updated item to the hypermedia representation package
                hr.data.Add(item);
            }

            // Finish off the configuration of the hypermedia representation...

            // How many items?
            hr.count = hr.data.Count;

            // Configure the link for the collection to refer to itself
            var l = new link();

            l.rel  = "self";
            l.href = "/api/customers";

            // Add it
            hr.links.Add(l);

            // Return the result
            return(Ok(hr));
        }
Пример #22
0
        /**
         * Build the list of V6AddressBindingPools from the list of configured V6AddressPools
         * for the given configuration Link container object. The list of V6AddressBindingPools
         * starts with the filtered AddressPools followed by non-filtered AddressPools.
         *
         * @param link the configuration Link object
         *
         * @return the list of V6AddressBindingPools (<? extends BindingPool>)
         *
         * @throws DhcpServerConfigException if there is a problem parsing a configured range
         */
        protected override List <BindingPool> BuildBindingPools(link link)
        {
            Debug.Assert(CheckIPIsUsed != null, "V6AddrBindingManager --BuildBindingPools-- CheckIPIsUsed = null");
            List <BindingPool> bindingPools = new List <BindingPool>();
            // Put the filtered pools first in the list of pools on this link
            List <linkFilter> linkFilters = link.linkFilters;

            if ((linkFilters != null) && linkFilters.Count > 0)
            {
                foreach (linkFilter linkFilter in linkFilters)
                {
                    List <v6AddressPool> pools = GetV6AddressPools(linkFilter);
                    if ((pools != null) && pools.Count > 0)
                    {
                        foreach (v6AddressPool pool in pools)
                        {
                            V6AddressBindingPool abp = BuildV6BindingPool(pool, link, linkFilter);
                            abp.CheckIPIsUsed = CheckIPIsUsed;
                            bindingPools.Add(abp);
                        }
                    }
                    //else
                    //{
                    //    log.Error("PoolList is null for PoolsType: " + linkFilter);
                    //}
                }
            }

            List <v6AddressPool> unpools = GetV6AddressPools(link);

            // add the unfiltered pools to the mapped list
            if ((unpools != null) && unpools.Count > 0)
            {
                foreach (v6AddressPool pool in unpools)
                {
                    V6AddressBindingPool abp = BuildV6BindingPool(pool, link);
                    bindingPools.Add(abp);
                }
            }
            //else
            //{
            //    log.Error("PoolList is null for PoolsType: " + poolsType);
            //}

            //TODO this is very dangerous if the server is managing
            //	    both NA and TA address pools because we'd delete
            //	    all the addresses in pools of the other type
            //		reconcilePools(bindingPools);

            return(bindingPools);
        }
Пример #23
0
        /// <summary>
        /// Sets an IP address as in-use in it's binding pool.
        /// </summary>
        /// <param name="link">link for the message</param>
        /// <param name="inetAddr">IP address to set used</param>
        protected void SetIpAsUsed(link link, IPAddress inetAddr)
        {
            BindingPool bindingPool = FindBindingPool(link, inetAddr, null);

            if (bindingPool != null)
            {
                bindingPool.SetUsed(inetAddr);
            }
            else
            {
                _log.Warn("Unable to set address used: No BindingPool found for IP=" +
                          inetAddr.ToString());
            }
        }
        /**
         * Build the list of V4AddressBindingPools from the list of configured V4AddressPools
         * for the given configuration link container object. The list of V4AddressBindingPools
         * starts with the filtered V4AddressPools followed by non-filtered V4AddressPools.
         *
         * @param link the configuration link object
         *
         * @return the list of V4AddressBindingPools (<? extends BindingPool>)
         *
         * @throws DhcpServerConfigException if there is a problem parsing a configured range
         */
        protected override List <BindingPool> BuildBindingPools(link link)
        {
            Debug.Assert(CheckIPIsUsed != null, "V4AddrBindingManagerImpl --BuildBindingPools-- CheckIPIsUsed = null");
            List <BindingPool> bindingPools = new List <BindingPool>();
            // Put the filtered pools first in the list of pools on this link
            List <linkFilter> linkFilters = link.linkFilters;

            if ((linkFilters != null) && linkFilters.Count > 0)
            {
                foreach (linkFilter linkFilter in linkFilters)
                {
                    List <v4AddressPool> pools = linkFilter.v4AddrPools;

                    if ((pools != null) && pools.Count > 0)
                    {
                        foreach (v4AddressPool pool in pools)
                        {
                            V4AddressBindingPool abp = BuildV4BindingPool(pool, link, linkFilter);
                            abp.CheckIPIsUsed = CheckIPIsUsed;
                            bindingPools.Add(abp);
                        }
                    }
                    else
                    {
                        log.Error("PoolList is null for PoolsType");
                    }
                }
            }
            // add the unfiltered pools to the mapped list
            List <v4AddressPool> unpools = link.v4AddrPools;

            if ((unpools != null) && unpools.Count > 0)
            {
                foreach (v4AddressPool pool in unpools)
                {
                    V4AddressBindingPool abp = BuildV4BindingPool(pool, link);
                    abp.CheckIPIsUsed = CheckIPIsUsed;
                    bindingPools.Add(abp);
                }
            }
            else
            {
                log.Error("PoolList is null for PoolsType");
            }


            ReconcilePools(bindingPools);

            return(bindingPools);
        }
Пример #25
0
        private void metroButton4_Click(object sender, EventArgs e)
        {
            if (ActiveMdiChild != null)
            {
                ActiveMdiChild.Close();
            }
            link newMDIChild = new link();

            // Set the Parent Form of the Child window.
            newMDIChild.MdiParent = this;
            // Display the new form.
            newMDIChild.Show();
            newMDIChild.Dock = DockStyle.Fill;
        }
Пример #26
0
        // GET: links/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            link link = db.links.Find(id);

            if (link == null)
            {
                return(HttpNotFound());
            }
            return(View(link));
        }
Пример #27
0
        public IHttpActionResult Deletelink(int id)
        {
            link link = db.links.Find(id);

            if (link == null)
            {
                return(NotFound());
            }

            db.links.Remove(link);
            db.SaveChanges();

            return(Ok(link));
        }
 protected V6StaticPrefixBinding BuildStaticBinding(v6PrefixBinding binding, link link)
 {
     try
     {
         IPAddress             inetAddr = IPAddress.Parse(binding.prefix);
         V6StaticPrefixBinding sb       = new V6StaticPrefixBinding(binding);
         SetIpAsUsed(link, inetAddr);
         return(sb);
     }
     catch (Exception ex)
     {
         log.Error("Invalid static binding address");
         throw new Exception("Invalid static binding address", ex);
     }
 }
Пример #29
0
        /**
         * Build the list of static bindings for the given link.
         *
         * @param link the link
         * @return the list of static bindings
         * @throws DhcpServerConfigException if the static binding is invalid
         */
        protected override List <StaticBinding> BuildStaticBindings(link link)
        {
            List <StaticBinding>    staticBindings = new List <StaticBinding>();
            List <v6AddressBinding> bindings       = GetV6AddressBindings(link);

            if ((bindings != null) && bindings.Count > 0)
            {
                foreach (v6AddressBinding binding in bindings)
                {
                    V6StaticAddressBinding sab = BuildV6StaticBinding(binding, link);
                    staticBindings.Add(sab);
                }
            }
            return(staticBindings);
        }
Пример #30
0
        internal static void VisualizeModelNode(this IModelNode?modelNode)
        {
            _ = modelNode ?? throw new ArgumentNullException(nameof(modelNode));
            var xml       = UserDifferencesHelper.GetUserDifferences(modelNode)[""];
            var prettyXml = new XmlFormatter().Format(xml);
            var encode    = WebUtility.HtmlEncode(prettyXml);
            var html      = @$ "
<html>
    <head>
        <link href='https://unpkg.com/[email protected]/themes/prism-okaidia.css' rel='stylesheet' />
    </head>
    <body style='background-color: #272822; color: #bbb; font-family: sans-serif; margin: 0; padding: 0;'>
        <h1 style='text-align: center; margin-top: .5rem'>XAF Layout Inspector</h1>
        <hr style='border: none; border-top: 1px solid #bbb;' />
        <pre><code class='language-xml'>{encode}</code></pre>
Пример #31
0
 static void Main(string[] args)
 {
     Console.WriteLine("Obtention des URLs en cours...");
     string urlApi = "http://localhost/crawler/api.php?type=getUrlsForRank&secure=7433a581389f5a55b83809bb07eefdf2d22a6e2b";
     WebClient client = new WebClient();
     string newUrls = client.DownloadString(urlApi);
     newUrls = newUrls.Replace(".", ",");
     Regex extractTotal = new Regex(@".+TOTAL-+([0-9]+)+-TOTAL");
     string counterOfUrlsString = extractTotal.Replace(newUrls, "$1");
     int counterOfUrls = Convert.ToInt32(counterOfUrlsString);
     Console.WriteLine("Nombre total d'URLs : " + counterOfUrlsString);
     string[] urlsClientDecomposed = newUrls.Split('~');
     link[] arrayUrls = new link[counterOfUrls];
     int i = 0;
     List<string> alreadyLinkTo = new List<string>();
     foreach (string urlsClient in urlsClientDecomposed)
     {
         if (i < counterOfUrls)
         {
             string[] elements = urlsClient.Split('-');
             string[] linksTo = elements[1].Split('|');
             Console.WriteLine("index" + i + " : id " + elements[0]);
             arrayUrls[i].id = Convert.ToInt32(elements[0]);
             int outLinksTemp = Convert.ToInt32(linksTo.Length);
             Console.WriteLine("index" + i + " : outLinks " + outLinksTemp);
             arrayUrls[i].linksFrom = Convert.ToInt32(outLinksTemp);
             Console.WriteLine("index" + i + " : pageRank " + elements[3]);
             arrayUrls[i].rank = Convert.ToDouble(elements[3]);
             foreach (string linkTo in linksTo)
             {
                 if (!(alreadyLinkTo.Contains(linkTo)) && linkTo != "")
                 {
                     Console.WriteLine("index" + i + " : link to " + linkTo);
                     alreadyLinkTo.Add(linkTo);
                 }
             }
             string[] stringLinksToThis = alreadyLinkTo.ToArray();
             int[] linksToThis = stringLinksToThis.Select(int.Parse).ToArray();
             arrayUrls[i].to = linksToThis;
             alreadyLinkTo = new List<string>();
         }
         i++;
     }
     int j = 0;
     link[] newArrayUrls = new link[arrayUrls.Length];
     while (j < 200)
     {
         newArrayUrls = pageRank(arrayUrls);
         arrayUrls = newArrayUrls;
         j++;
     }
     double sum = 0;
     string apiRankId = "";
     string apiRankRank = "";
     foreach (var arrayUrl in newArrayUrls)
     {
         string linksToFromThisUrl = "";
         foreach (var linksToFromThis in arrayUrl.to)
         {
             linksToFromThisUrl += linksToFromThis + ",";
         }
         linksToFromThisUrl = linksToFromThisUrl.Substring(0, linksToFromThisUrl.Length - 1);
         Console.WriteLine(arrayUrl.id + ": " + "\nLiens vers : " + linksToFromThisUrl + "\nPageRank : " + arrayUrl.rank + "\noutLinks : " + arrayUrl.linksFrom + "\n");
         apiRankId += arrayUrl.id + "-";
         apiRankRank += arrayUrl.rank + "-";
         sum += arrayUrl.rank;
     }
     Console.WriteLine("\n\nMoyenne : " + sum / arrayUrls.Length);
     apiRankRank = apiRankRank.Replace(",", ".");
     Console.WriteLine("Enregistrement des pageRanks obtenus en cours...");
     string urlApiSave = "";//this part of the API currently don't exist :/
     WebClient clientSave = new WebClient();
     string saveResult = clientSave.DownloadString(urlApiSave);
     Console.WriteLine("Appuyez sur une touche pour quitter...");
     Console.Read();
 }
Пример #32
0
        private bool initializeTables()
        {
            int source;
            int destination;
            int cost;
            double delay;
            string[] lines = File.ReadAllLines(fileName.Text);
            string[] splitLine;
            List<link> tmpList = new List<link>();
            Node tmpNode = new Node();
            HashSet<int> numNodes = new HashSet<int>();
            foreach (string line in lines)
            {
                splitLine = line.Split('\t');
                source = Convert.ToInt32(splitLine[0]);
                destination = Convert.ToInt32(splitLine[1]);
                cost = Convert.ToInt32(splitLine[2]);
                delay = Convert.ToDouble(splitLine[3]);
                link tmpLink = new link(source, destination, cost, delay);
                tmpList.Add(tmpLink);
                numNodes.Add(source);
                numNodes.Add(destination);
            }

            foreach (int num in numNodes)
            {
                tmpNode = new Node();
                tmpNode.setAddress(num);
                nodes.Add(num, tmpNode);
            }

            foreach (link tmpLink in tmpList)
            {
                nodes[tmpLink.source].addRoute(tmpLink.destination, tmpLink.cost, tmpLink.destination);
                nodes[tmpLink.source].addNeighbor(tmpLink.destination, tmpLink.cost, tmpLink.delay);

                nodes[tmpLink.destination].addRoute(tmpLink.source, tmpLink.cost, tmpLink.source);
                nodes[tmpLink.destination].addNeighbor(tmpLink.source, tmpLink.cost, tmpLink.delay);
            }
            tablesInit = true;
            return true;
        }
Пример #33
0
 private void AddLink(link Lnk)
 {
     MapElement el1 = ActiveMap.getById(Lnk.selementid1);
     MapElement el2 = ActiveMap.getById(Lnk.selementid2);
     MapVisualElement vEl1 = (MapVisualElement)el1.Tag;
     MapVisualElement vEl2 = (MapVisualElement)el2.Tag;
     if (el1 == null || el2 == null) { MessageBox.Show("ELEMENT NULL"); }
     Line ln = new Line();
     System.Drawing.Color cl = System.Drawing.ColorTranslator.FromHtml("#" + Lnk.color);
     ln.Stroke = new SolidColorBrush(Colors.Black);
     if (Lnk.drawtype == "4")
     {
         ln.StrokeDashArray = new DoubleCollection();
         ln.StrokeDashArray.Add(3);
         ln.StrokeDashArray.Add(2);
     }
     ln.X1 = el1.x + 30;
     ln.X2 = el2.x + 30;
     ln.Y1 = el1.y + 30;
     ln.Y2 = el2.y + 30;
     //ln.ToolTip = Lnk.drawtype;
     ln.StrokeThickness = 2;
     Lnk.Tag = ln;
     mapCanvas.Children.Add(ln);
     Canvas.SetZIndex(ln, 10);
 }
Пример #34
0
 static link[] pageRank(link[] arrayUrlsForRank)
 {
     link[] arrayUrlsRanked = new link[arrayUrlsForRank.Length];
     arrayUrlsForRank.CopyTo(arrayUrlsRanked, 0);
     int j = 0;
     while (j < arrayUrlsForRank.Length)
     {
         arrayUrlsRanked[j].rank = 0.15;
         j++;
     }
     int i = 0;
     foreach (var arrayUrl in arrayUrlsForRank)
     {
         int index = 0;
         foreach (int id in arrayUrl.to)
         {
             index = Array.FindIndex(arrayUrlsForRank, row => row.id == id);
             arrayUrlsRanked[index].rank += ( (arrayUrlsForRank[i].rank / arrayUrlsForRank[i].linksFrom) ) * 0.85;
         }
         i++;
     }
     return arrayUrlsRanked;
 }