浏览代码

移除信息分类中的软件工具

yuzhengyang 8 年之前
父节点
当前提交
a006b2dce4
共有 2 个文件被更改,包括 0 次插入150 次删除
  1. 0 149
      Fork.Net/Y.Utils/WindowsUtils/InfoUtils/SoftwareTool.cs
  2. 0 1
      Fork.Net/Y.Utils/Y.Utils.csproj

+ 0 - 149
Fork.Net/Y.Utils/WindowsUtils/InfoUtils/SoftwareTool.cs

@@ -1,149 +0,0 @@
-using Microsoft.Win32;
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.IO;
-using System.Linq;
-using System.Text;
-using Y.Utils.DataUtils.Collections;
-
-namespace Y.Utils.WindowsUtils.InfoUtils
-{
-    [Obsolete]
-    public class SoftwareTool
-    {
-        /// <summary>
-        /// 存在控制面板
-        /// </summary>
-        /// <param name="name"></param>
-        /// <returns></returns>
-        public static bool ExistControl(string name)
-        {
-            if (GetControlList().Contains(name))
-                return true;
-            return false;
-        }
-        public static bool ExistControl(string[] names)
-        {
-            bool flag = false;
-            if (!ListTool.IsNullOrEmpty(names))
-            {
-                foreach (var n in names)
-                {
-                    if (ExistControl(n))
-                        return true;
-                }
-            }
-            return flag;
-        }
-        public static List<string> GetControlList()
-        {
-            List<string> result = new List<string>();
-            result.AddRange(GetControlList(Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall")));
-            result.AddRange(GetControlList(Registry.LocalMachine.OpenSubKey("SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall")));
-            result.AddRange(GetControlList(Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall")));
-            result.AddRange(GetControlList(Registry.CurrentUser.OpenSubKey("SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall")));
-            return result;
-        }
-        private static List<string> GetControlList(RegistryKey key)
-        {
-            List<string> result = new List<string>();
-            try
-            {
-                if (key != null)//如果系统禁止访问则返回null
-                {
-                    foreach (string SubKeyName in key.GetSubKeyNames())
-                    {
-                        //打开对应的软件名称
-                        RegistryKey SubKey = key.OpenSubKey(SubKeyName);
-                        if (SubKey != null)
-                        {
-                            String SoftwareName = SubKey.GetValue("DisplayName", "Nothing").ToString();
-                            //如果没有取到,则不存入动态数组
-                            if (SoftwareName != "Nothing")
-                            {
-                                result.Add(SoftwareName.Trim());
-                            }
-                        }
-                        SubKey?.Close();
-                    }
-                }
-                key?.Close();
-            }
-            catch { }
-            return result;
-        }
-        /// <summary>
-        /// 存在进程
-        /// </summary>
-        /// <param name="name"></param>
-        /// <returns></returns>
-        public static bool ExistProcess(string name)
-        {
-            try
-            {
-                var p = Process.GetProcessesByName(name);
-                if (p != null && p.Length == 0)
-                    return false;
-                else
-                    return true;
-            }
-            catch { }
-            return false;
-        }
-        public static bool ExistProcess(string[] names)
-        {
-            bool flag = false;
-            if (!ListTool.IsNullOrEmpty(names))
-            {
-                foreach (var n in names)
-                {
-                    if (ExistProcess(n))
-                        return true;
-                }
-            }
-            return flag;
-        }
-        /// <summary>
-        /// 存在文件
-        /// </summary>
-        /// <param name="name"></param>
-        /// <returns></returns>
-        public static bool ExistFile(string name)
-        {
-            if (File.Exists(name))
-                return true;
-            return false;
-        }
-        public static bool ExistFile(string[] names)
-        {
-            bool flag = false;
-            if (!ListTool.IsNullOrEmpty(names))
-            {
-                foreach (var n in names)
-                {
-                    if (ExistFile(n))
-                        return true;
-                }
-            }
-            return flag;
-        }
-        /// <summary>
-        /// 存在注册表项
-        /// </summary>
-        /// <param name="item"></param>
-        /// <param name="key"></param>
-        /// <returns></returns>
-        public static bool ExistRegist(string item, string key)
-        {
-            try
-            {
-                object obj = Registry.GetValue(item, key, null);
-                if (obj != null)
-                    return true;
-            }
-            catch { }
-            return false;
-        }
-    }
-}

+ 0 - 1
Fork.Net/Y.Utils/Y.Utils.csproj

@@ -139,7 +139,6 @@
     <Compile Include="DataUtils\DateTimeUtils\UnixTimeTool.cs" />
     <Compile Include="IOUtils\ImageUtils\ScreenCapture.cs" />
     <Compile Include="WindowsUtils\InfoUtils\ShortcutTool.cs" />
-    <Compile Include="WindowsUtils\InfoUtils\SoftwareTool.cs" />
     <Compile Include="WindowsUtils\InfoUtils\TaskSchedulerTool.cs" />
     <Compile Include="WindowsUtils\ProcessUtils\ProcessInfoTool.cs" />
     <Compile Include="WindowsUtils\ProcessUtils\ProcessTool.cs" />