// 복구 콘솔 자동 로그인
    internal string RecoveryLogin()
    {
        string sPath = Path.GetTempPath() + "RecoveryConsoleAutoLogin.inf";
        ClassZ z     = new ClassZ();

        z.RunCommand(@"secedit /export /cfg " + sPath);
        string[] sContents = File.ReadAllLines(sPath);
        string   Reconsole = "";

        for (int i = 0; i < sContents.Length; i++)
        {
            if (sContents[i].Contains("SecurityLevel"))
            {
                Reconsole = sContents[i].Substring(sContents[i].Length - 1);
            }
        }
        File.Delete(sPath);
        if (Reconsole == "0")
        {
            Reconsole = "Remember";
        }
        else if (Reconsole == "1")
        {
            Reconsole = "Not Remember";
        }
        else
        {
            Reconsole = "Unknown: " + Reconsole;
        }
        return(Reconsole);
    }
示例#2
0
    internal string GetBootInfo()
    {
        string result = null;

        try
        {
            ClassZ z         = new ClassZ();
            string OSInfo    = z.RunCommand("%windir%" + @"\sysnative\bcdedit /enumACTIVE"); // 횔성 상태의 BCD 항목 확인
            int    BootCount = 0;
            var    lines     = new Regex(@"\r\n|\n|\r", RegexOptions.Singleline).Split(OSInfo);
            // 1줄 뵬로 나누기
            string boot = "";
            foreach (var line in lines)
            {     // 끝까지 반복
                if (line.Contains("description") && !line.Contains("Windows BootManager"))
                { // description이 Windows Boot Manager인 경우 제외하고 모두!
                    if (boot != "")
                    {
                        boot = boot + ", " + line.Remove(0, 20).Trim();             // 기존 boot 설정되었다면 / 새 항목 쓰기
                    }
                    else
                    {
                        boot = line.Remove(0, 20).Trim(); // 첫 항목인 경우 바로 추가
                    }
                    BootCount++;                          // 부팅 영역 개수 +1
                }
            }
            result += BootCount + " (" + boot + ")";
        }
        catch
        {
            result = "Not found";
        }
        return(result);
    }