1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- using System;
- using System.IO;
- using System.Reflection;
- using System.Windows.Forms;
- using Update.Util;
- namespace Update.Config
- {
- /// <summary>
- /// 当前配置
- /// </summary>
- public static class AppConfig
- {
- private static string m_Temp;
- /// <summary>
- /// 获取系统临时目录 格式:C:\Users\Administrator\AppData\Local\Temp\
- /// </summary>
- public static string Temp
- {
- get
- {
- return m_Temp ?? (m_Temp = Path.GetTempPath());
- }
- }
- private static string m_AssemblyPath;
- /// <summary>
- /// 获取当前代码程序集的路径 格式:D:\xx系统\update.exe
- /// </summary>
- public static string AssemblyPath
- {
- get
- {
- return m_AssemblyPath ?? (m_AssemblyPath = Assembly.GetExecutingAssembly().Location);
- }
- }
- private static string m_ExecutablePath;
- /// <summary>
- /// 获取当前运行的exe的路径 格式:D:\xx系统\update.exe
- /// </summary>
- public static string ExecutablePath
- {
- get
- {
- return m_ExecutablePath ?? (m_ExecutablePath = Application.ExecutablePath);
- }
- }
- private static string m_ExecutableDirectory;
- /// <summary>
- /// 获取当前运行的exe的目录 格式:D:\xx系统\
- /// </summary>
- public static string ExecutableDirectory
- {
- get
- {
- return m_ExecutableDirectory ?? (m_ExecutableDirectory = AppDomain.CurrentDomain.BaseDirectory);
- }
- }
- private static string m_FileName;
- /// <summary>
- /// 获取当前运行的exe的名称 格式:update.exe
- /// </summary>
- public static string FileName
- {
- get
- {
- return m_FileName ?? (m_FileName = Path.GetFileName(ExecutablePath));
- }
- }
- private static string m_ExpectExecutablePath;
- /// <summary>
- /// 获取期望启动路径 格式:C:\Users\Administrator\AppData\Local\Temp\update.exe
- /// </summary>
- public static string ExpectExecutablePath
- {
- get
- {
- return m_ExpectExecutablePath ?? (m_ExpectExecutablePath = FilePathUtil.GetAbsolutePath(FileName, Temp));
- }
- }
- }
- }
|