MCPcopy Create free account
hub / github.com/M2Team/NanaBox / TryReloadVirtualMachine

Method TryReloadVirtualMachine

NanaBox/MainWindow.cpp:686–999  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

684}
685
686void NanaBox::MainWindow::TryReloadVirtualMachine()
687{
688 std::string ConfigurationFileContent =
689 ::ReadAllTextFromUtf8TextFile(this->m_ConfigurationFilePath);
690
691 NanaBox::VirtualMachineConfiguration Configuration =
692 NanaBox::DeserializeConfiguration(ConfigurationFileContent);
693
694 if (this->m_Configuration.MemorySize != Configuration.MemorySize)
695 {
696 try
697 {
698 NanaBox::ComputeSystemUpdateMemorySize(
699 this->m_VirtualMachine,
700 Configuration.MemorySize);
701 this->m_Configuration.MemorySize =
702 Configuration.MemorySize;
703 }
704 catch (...)
705 {
706
707 }
708 }
709
710 if (0 != ::_stricmp(
711 this->m_Configuration.ComPorts.ComPort1.c_str(),
712 Configuration.ComPorts.ComPort1.c_str()))
713 {
714 try
715 {
716 if (this->m_Configuration.ComPorts.ComPort1.empty())
717 {
718 NanaBox::ComputeSystemAddComPort(
719 this->m_VirtualMachine,
720 0,
721 Configuration.ComPorts.ComPort1);
722 }
723 else if (Configuration.ComPorts.ComPort1.empty())
724 {
725 NanaBox::ComputeSystemRemoveComPort(
726 this->m_VirtualMachine,
727 0,
728 Configuration.ComPorts.ComPort1);
729 }
730 else
731 {
732 NanaBox::ComputeSystemUpdateComPort(
733 this->m_VirtualMachine,
734 0,
735 Configuration.ComPorts.ComPort1);
736 }
737
738 this->m_Configuration.ComPorts.ComPort1 =
739 Configuration.ComPorts.ComPort1;
740 }
741 catch (...)
742 {
743

Callers 1

OnCommandMethod · 0.95

Calls 3

DisconnectMethod · 0.80

Tested by

no test coverage detected