zoukankan      html  css  js  c++  java
  • 吃鸡启动器

    using System;
    using System.IO;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

    using System.Threading.Tasks;
    using System.Diagnostics;
    using System.Management;
    using System.Windows.Forms;

    namespace ConsoleApp1
    {
    class Program
    {
    static void Main(string[] args)
    {
    string sSteam = getSteam() + "\Steam.exe";
    try
    {

    Process.Start(sSteam);
    }
    catch
    {
    MessageBox.Show("没有找到Steam.exe的位置");

    }



    }

    //获取steam的路径
    static string getSteam()
    {
    string sSteamDir = "";
    //获取本地磁盘
    DriveInfo[] aDr = DriveInfo.GetDrives();
    foreach (DriveInfo dd in aDr)
    {
    if (dd.DriveType == DriveType.Fixed)
    {

    sSteamDir = isSteam(dd.ToString().ToLower());
    if (sSteamDir != null)
    {
    return sSteamDir;
    }
    }
    }
    return null;
    }
    static string isSteam(string sDir)
    {
    string steam = "";
    DirectoryInfo dDir = new DirectoryInfo(sDir);
    if ((steam = isExists(sDir)) == null)
    {
    foreach (DirectoryInfo d in dDir.GetDirectories())
    {
    if ((steam = isExists(sDir + d.ToString())) != null)
    {
    return steam;
    }
    }

    }
    return null;


    }
    static string isExists(string d)
    {
    string steam = d + "\steam".ToLower();

    if (Directory.Exists(steam))
    {
    if (Directory.EnumerateDirectories(steam, "Steam.exe", SearchOption.AllDirectories).Any()==false)
    return steam;
    }
    return null;
    }


    }
    }

  • 相关阅读:
    JDBC事务管理
    JDBC常见操作
    Java集合之List接口
    Nginx+Keepalived+Lvs实现双机热备
    Nginx+Consul+Upsync实现动态负载均衡
    DNS域名解析概念
    WPF中实现两个窗口之间传值
    C# 重写(override)和覆盖(new)
    C# DateTime.Now函数
    WPF中在后台实现控件样式
  • 原文地址:https://www.cnblogs.com/bingxing/p/8612838.html
Copyright © 2011-2022 走看看