コード例 #1
0
        public static string Save(MachineProfile profile)
        {
            string log  = Machine.WriteProfileData(profile);
            string path = Path.Combine(ProfileDirectory, profile.Name + ".json");

            Directory.CreateDirectory(ProfileDirectory);
            File.WriteAllText(path, JsonConvert.SerializeObject(profile));

            return(log);
        }
コード例 #2
0
        private static void WriteDefaultFiles(MachineProfile profile)
        {
            DirectoryInfo dir =
                Directory.CreateDirectory(Path.Combine(profile.ProfileRoot, "configs", "cpu", "extensions"));

            CopyDir(VMCORE_DEFAULT_LIB_PATH, dir.FullName);



            DirectoryInfo biosDir =
                Directory.CreateDirectory(Path.Combine(profile.ProfileRoot, "bios"));

            CopyDir(VMCORE_DEFAULT_BIOS_DIR, biosDir.FullName);
        }
コード例 #3
0
        public static string WriteProfileData(MachineProfile profile)
        {
            WriteDefaultFiles(profile);
            ProcessStartInfo psi = new ProcessStartInfo(
                VIS_EXECUTABLE,
                $"--root {profile.ProfileRoot} write-default"
                );

            psi.RedirectStandardOutput = true;
            psi.CreateNoWindow         = true;
            psi.UseShellExecute        = false;
            Process p = Process.Start(psi);

            p.WaitForExit();
            return(p.StandardOutput.ReadToEnd());
        }
コード例 #4
0
        public static Machine Create(MachineProfile profile)
        {
            ProcessStartInfo psi = new ProcessStartInfo(
                VIS_EXECUTABLE,
                $"--root {profile.ProfileRoot} run -run:i {profile.BiosPath} {profile.StartArguments}"
                );

            psi.WorkingDirectory = profile.ProfileRoot;
            return(new Machine(
                       profile,
                       () =>
            {
                Process p = Process.Start(psi);
                p.EnableRaisingEvents = true;

                return p;
            }));
        }
コード例 #5
0
 private Machine(MachineProfile profile, Func <Process> proc)
 {
     Profile       = profile;
     m_ProcSpawner = proc;
 }