⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 urljiggler.cs

📁 中文名:Windows Forms 程序设计 英文名:Windows Forms Programming in c# 作者: Chris Sells 翻译: 荣耀 蒋贤哲 出版社:人民
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Deployment.Application;
using System.Diagnostics;
using System.Security.Policy;
using System.Text;

namespace Wahoo {
  public static class UrlJiggler {

    public static string JiggleUrl(string url) {
      // Get update location
      Uri updateLocation = UpdateLocation;
      // Bail if not launched via ClickOnce
      if( updateLocation == null ) return url;
      // Extract the site from the update location
      string site = Site.CreateFromUrl(updateLocation.AbsoluteUri).Name;
      // Jiggle url
      UriBuilder jiggledUrl = new UriBuilder(url);
      jiggledUrl.Host = site;
      return jiggledUrl.ToString();
    }

    public static Uri UpdateLocation {
      get {
        // If launched via ClickOnce, return the update location
        if( ApplicationDeployment.IsNetworkDeployed ) {
          return ApplicationDeployment.CurrentDeployment.UpdateLocation;
        }
        return null;
      }
    }
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -