public AliveControlService()
        {
            InitializeComponent();
            string path = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase);

            RegMan.SetProgramBase("AliveControl");
            LogMan.LogDirectory = path.Replace("file:\\", "");
            LogMan.StartLogging(LogMan.LogDirectory, "AliveControl");
            LogMan.AddLog("HUEAHOEIUHAEOIU");
            RegMan.Write("Path", path.Replace("file:\\", ""));
            LogMan.debugmode = true;
        }
        private void OnTimedEvent(object source, ElapsedEventArgs e)
        {
            mTimer.Stop();
            MachineData mdata = new MachineData();

            LogMan.AddLog("Fetching Smart");
            mdata.disks = tvstools.ReadSmart();
            GC.KeepAlive(mTimer);
            LogMan.AddLog("Fetching Network Devices");
            mdata.ethernets = tvstools.GetNetworkDevices();
            GC.KeepAlive(mTimer);
            LogMan.AddLog("Fetching Mount Points");
            mdata.mounts = tvstools.GetMountPoints();
            GC.KeepAlive(mTimer);
            mdata.UUID        = MachineUUID;
            mdata.UpTime      = tvstools.GetUpTime();
            mdata.Processor   = tvstools.GetProcessorName();
            mdata.OS          = tvstools.GetOSName();
            mdata.FreeMemory  = tvstools.GetFreeMemory();
            mdata.FreeSwap    = tvstools.GetFreeSwapMemory();
            mdata.TotalMemory = tvstools.GetTotalMemory();
            mdata.TotalSwap   = tvstools.GetTotalSwapMemory();
            mdata.Name        = Name;
            LogMan.AddDebug(mdata.ToJSON());

            GC.KeepAlive(mTimer);
            LogMan.AddLog("Sending data");
            if (API.SendMachine(mdata))
            {
                if (MachineUUID == null)
                {
                    MachineUUID = API.MachineUUID;
                    LogMan.AddLog("First time of this machine! Now the UUID is: " + MachineUUID);
                    RegMan.Write("MachineUUID", MachineUUID);
                }
                LogMan.AddLog("Data sent successfully!");
            }
            else
            {
                LogMan.AddLog("Fail sending machine data!");
            }
            mTimer.Start();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            if (sessionKey.Text.Length == 0)
            {
                MessageBox.Show("Sua chave de sessão está em branco!");
                return;
            }
            RegMan.Write("SessionKey", sessionKey.Text);
            RegMan.Write("Name", name.Text);
            String ServicePath = path + "\\AliveControlService.exe";

            try
            {
                ServiceInstaller.InstallAndStart("TVS AliveControl4", "TVS AliveControl4", ServicePath);
                MessageBox.Show("Serviço Instalado!");
            }
            catch (Exception)
            {
                MessageBox.Show("Erro ao instalar serviço!");
            }
        }