public bool RemoveIniFromRegister() { WinRegistry ureg = new WinRegistry(); bool result = ureg.DeleteKey("attempts") && ureg.DeleteKey("proxy") && ureg.DeleteKey("host") && ureg.DeleteKey("port") && ureg.DeleteKey("defaultAuth") && ureg.DeleteKey("domain") && ureg.DeleteKey("user") && ureg.DeleteKey("password") && ureg.DeleteKey("mode") && ureg.DeleteKey("locallog") && ureg.DeleteKey("clock") && ureg.DeleteKey("autodir") && ureg.DeleteKey("movefile") && ureg.DeleteKey("moveafter") && ureg.DeleteKey("target") && ureg.DeleteKey("procdir") && ureg.DeleteKey("interval") && ureg.DeleteKey("wstartup") && ureg.DeleteKey("interval") && ureg.DeleteKey("imgtype") && ureg.DeleteKey("jpgquality") && ureg.DeleteKey("legend") && ureg.DeleteKey("ntpserver") && ureg.DeleteKey("ntpport") && ureg.DeleteKey("perscreen") && ureg.DeleteKey("signature") && ureg.DeleteKey("serialkey") && ureg.DeleteKey("customer") && ureg.DeleteKey("customerMN") && ureg.DeleteKey("customerDueDate") && ureg.DeleteKey("wstartup") && ureg.DeleteKey("licaddress") && ureg.DeleteKey("server") && ureg.DeleteKey("serverport") && ureg.DeleteKey("clientport"); if (ureg.KeyExists("customer")) { ureg.DeleteKey("UdyatTrial"); } if (ureg.KeyExists("UdyatRegister")) { ureg.DeleteKey("UdyatRegister"); } if (ureg.KeyExists("MacSalt")) { ureg.DeleteKey("MacSalt"); } if (ureg.KeyExists("customerWord")) { ureg.DeleteKey("customerWord"); } return(result); }
private bool ReadIniInFromRegister() { WinRegistry ureg = new WinRegistry(); try { attempts = ureg.Read("attempts"); proxy = ureg.Read("proxy").ToUpper(); proxyHost = ureg.Read("host"); port = ureg.Read("port"); defaultAuth = ureg.Read("defaultAuth").ToUpper(); domain = ureg.Read("domain"); user = ureg.Read("user"); password = ureg.Read("password"); modeType = ureg.Read("mode"); locallog = ureg.Read("locallog").ToUpper(); clock = ureg.Read("clock"); autodir = ureg.Read("autodir").ToUpper(); movefile = ureg.Read("movefile").ToUpper(); moveafter = ureg.Read("moveafter"); target = ureg.Read("target").ToUpper(); procdir = Util.AddBackslashInPath(ureg.Read("procdir")); interval = ureg.Read("interval"); imgtype = ureg.Read("imgtype"); jpgquality = ureg.Read("jpgquality"); legend = ureg.Read("legend").ToUpper(); ntpserver = ureg.Read("ntpserver"); ntpport = ureg.Read("ntpport"); perscreen = ureg.Read("perscreen").ToUpper(); signature = ureg.Read("signature").ToUpper(); serialKey = ureg.Read("serialkey").ToUpper(); customer = ureg.Read("customer").ToString(); customerMN = ureg.Read("customerMN").ToString(); customerWord = ureg.Read("customerWord").ToString(); customerDueDate = ureg.Read("customerDueDate").ToString(); wstartup = ureg.Read("wstartup").ToUpper(); licaddress = ureg.Read("licaddress").ToUpper(); trialLicense = "false"; if (ureg.KeyExists("UdyatTrial")) { trialLicense = ureg.Read("UdyatTrial"); } serverHost = ureg.Read("server").ToString(); serverPort = ureg.Read("serverport").ToString(); clientPort = ureg.Read("clientport").ToString(); return(true); } catch { return(false); } }
private string GetLastSerialkey() { WinRegistry ureg = new WinRegistry(); try { if (ureg.KeyExists("serialkey")) { return(ureg.Read("serialkey")); } } catch { return(""); } return(""); }
private bool IsIniInRegister() { WinRegistry ureg = new WinRegistry(); return(ureg.KeyExists("attempts") && ureg.KeyExists("proxy") && ureg.KeyExists("host") && ureg.KeyExists("port") && ureg.KeyExists("defaultAuth") && ureg.KeyExists("domain") && ureg.KeyExists("user") && ureg.KeyExists("password") && ureg.KeyExists("mode") && ureg.KeyExists("locallog") && ureg.KeyExists("clock") && ureg.KeyExists("autodir") && ureg.KeyExists("movefile") && ureg.KeyExists("moveafter") && ureg.KeyExists("target") && ureg.KeyExists("procdir") && ureg.KeyExists("interval") && ureg.KeyExists("wstartup") && ureg.KeyExists("interval") && ureg.KeyExists("imgtype") && ureg.KeyExists("jpgquality") && ureg.KeyExists("legend") && ureg.KeyExists("ntpserver") && ureg.KeyExists("ntpport") && ureg.KeyExists("perscreen") && ureg.KeyExists("signature") && ureg.KeyExists("serialkey") && //ureg.KeyExists("customer") && //ureg.KeyExists("customerMN") && //ureg.KeyExists("customerDueDate") && ureg.KeyExists("wstartup") && ureg.KeyExists("licaddress") && ureg.KeyExists("server") && ureg.KeyExists("serverport") && ureg.KeyExists("clientport")); }
/// <summary> /// Lê o arquivo .INI /// </summary> public bool ReadIniFile() { // Abre o arquivo de configuração (se existir) INIFile iniFile = new INIFile(AppDomain.CurrentDomain.BaseDirectory + INIFILE_NAME); try { // CONNECTION attempts = iniFile.Read("CONNECTION", "attempts").ToUpper(); proxy = iniFile.Read("CONNECTION", "proxy").ToUpper(); proxyHost = iniFile.Read("CONNECTION", "host"); port = iniFile.Read("CONNECTION", "port"); defaultAuth = iniFile.Read("CONNECTION", "defaultAuth").ToUpper(); domain = iniFile.Read("CONNECTION", "domain"); user = iniFile.Read("CONNECTION", "user"); password = iniFile.Read("CONNECTION", "password"); // EXECUTION modeType = iniFile.Read("EXECUTION", "mode"); locallog = iniFile.Read("EXECUTION", "locallog").ToUpper(); clock = iniFile.Read("EXECUTION", "clock"); autodir = iniFile.Read("EXECUTION", "autodir").ToUpper(); movefile = iniFile.Read("EXECUTION", "movefile").ToUpper(); moveafter = iniFile.Read("EXECUTION", "moveafter"); target = iniFile.Read("EXECUTION", "target").ToUpper(); procdir = Util.AddBackslashInPath(iniFile.Read("EXECUTION", "procdir")); wstartup = iniFile.Read("EXECUTION", "wstartup").ToUpper(); // CAPTURE interval = iniFile.Read("CAPTURE", "interval"); imgtype = iniFile.Read("CAPTURE", "imgtype"); jpgquality = iniFile.Read("CAPTURE", "jpgquality"); legend = iniFile.Read("CAPTURE", "legend").ToUpper(); ntpserver = iniFile.Read("CAPTURE", "ntpserver"); ntpport = iniFile.Read("CAPTURE", "ntpport"); perscreen = iniFile.Read("CAPTURE", "perscreen").ToUpper(); signature = iniFile.Read("CAPTURE", "signature").ToUpper(); // COSTUMER serialKey = iniFile.Read("CUSTOMER", "serialkey").ToString(); licaddress = iniFile.Read("CUSTOMER", "licaddress").ToString(); // P2P serverHost = iniFile.Read("P2P", "server"); serverPort = iniFile.Read("P2P", "serverport"); clientPort = iniFile.Read("P2P", "clientport"); // Variáveis que são gravadas somente ao ativar uma licença WinRegistry ureg = new WinRegistry(); if (ureg.KeyExists("customer")) { customer = ureg.Read("customer").ToString(); } if (ureg.KeyExists("customerMN")) { customerMN = ureg.Read("customerMN").ToString(); } if (ureg.KeyExists("customerWord")) { customerWord = ureg.Read("customerWord").ToString(); } if (ureg.KeyExists("UdyatTrial")) { trialLicense = ureg.Read("UdyatTrial").ToString(); } return(true); } catch { return(false); } }