/// <summary> /// Check license correctness for available data fields (machine name, os user, expiry date) /// </summary> public LicenseState IsLicenseInfoCorrect() { var foundProblems = new LicenseState(); if (Environment.MachineName.ToLower() != HostName.ToLower()) { foundProblems.AddProblem(LicenseProblemType.WrongHost, "current:" + Environment.MachineName.ToLower() + "; licensed for:" + HostName.ToLower()); } var currentUserName = Environment.UserDomainName.ToLower() + @"\" + Environment.UserName.ToLower(); if (currentUserName != OsUserName.ToLower()) { foundProblems.AddProblem(LicenseProblemType.WrongUser, "current:" + currentUserName + "; licensed for:" + OsUserName.ToLower()); } return(foundProblems); }
public Dictionary <String, Object> GetAnsibleVariables() { var variables = new Dictionary <String, Object>(); variables.Add("server_hostname", HostName.ToLower()); variables.Add("server_cpu", CPU); variables.Add("server_ram", RAM); var diskArray = new Dictionary <String, Object> [ServerDisks.Count]; for (Int16 i = 0; i < ServerDisks.Count; i++) { diskArray[i] = GetAnsibleDiskVariables(ServerDisks.ElementAt(i)); } variables.Add("server_disks", diskArray); return(variables); }
public void Validate(ValidationResult result) { if (EntityHeader.IsNullOrEmpty(ListenerType)) { result.AddUserError("Listener Type is a Required Field."); return; } switch (ListenerType.Value) { case ListenerTypes.AMQP: if (string.IsNullOrEmpty(HostName)) { result.AddUserError("Host Name is required for Connecting to an AMQP Server."); } if (!Anonymous) { if (string.IsNullOrEmpty(UserName)) { result.AddUserError("User Name is Required to connect to your AMQP server for non-anonymous connections."); } if (string.IsNullOrEmpty(Password) && string.IsNullOrEmpty(SecurePasswordId)) { result.AddUserError("Password is Required to connect to your AMQP server for non-anonymous connections."); } } else { UserName = null; Password = null; } if (!AmqpSubscriptions.Any()) { result.AddUserError("Please ensure you provide at least one subscription (including wildcards * and #) that will be monitored for incoming messages."); } break; case ListenerTypes.AzureEventHub: if (HostName != null && HostName.ToLower().StartsWith("sb://")) { HostName = HostName.Substring(5); } if (string.IsNullOrEmpty(HostName)) { result.AddUserError("Host Name is required for Azure Event Hubs, this is the host name of your Event Hub without the sb:// protocol."); } if (string.IsNullOrEmpty(HubName)) { result.AddUserError("Hub Name is Required for an Azure Event Hub Listener."); } if (string.IsNullOrEmpty(AccessKey) && string.IsNullOrEmpty(SecureAccessKeyId)) { result.AddUserError("Access Key is Required for an Azure Event Hub listener."); } if (!string.IsNullOrEmpty(AccessKey) && !Utils.StringValidationHelper.IsBase64String(AccessKey)) { result.AddUserError("Access Key does not appear to be a Base 64 string and is likely incorrect."); } break; case ListenerTypes.AzureIoTHub: if (HostName != null && HostName.ToLower().StartsWith("sb://")) { HostName = HostName.Substring(5); } if (string.IsNullOrEmpty(HostName)) { result.AddUserError("Host Name is required for Azure IoT Hub, this is found in the Event Hub-compatible endpoint field on the Azure Portal."); } if (string.IsNullOrEmpty(ResourceName)) { result.AddUserError("Resource Name is require for Azure IoT Hub, this is found in the Event Hub-compatible name field on the Azure Portal."); } if (string.IsNullOrEmpty(AccessKeyName)) { result.AddUserError("Access Key Name is a required field for an Azure Serice Bus Listener."); } if (string.IsNullOrEmpty(AccessKey) && string.IsNullOrEmpty(SecureAccessKeyId)) { result.AddUserError("Access Key is Required for Azure IoT Event Hub."); } if (!string.IsNullOrEmpty(AccessKey) && !Utils.StringValidationHelper.IsBase64String(AccessKey)) { result.AddUserError("Access Key does not appear to be a Base 64 string and is likely incorrect."); } break; case ListenerTypes.AzureServiceBus: if (string.IsNullOrEmpty(HostName)) { result.AddUserError("Host Name is required for an Azure Service Bus Listener, this is the host name of your Event Hub without the sb:// protocol."); } if (HostName != null && HostName.ToLower().StartsWith("sb://")) { HostName = HostName.Substring(5); } if (string.IsNullOrEmpty(Queue)) { result.AddUserError("Queue Name is required for an Azure Service Bus Listener."); } if (string.IsNullOrEmpty(AccessKeyName)) { result.AddUserError("Access Key Name is a required field for an Azure Serice Bus Listener."); } if (string.IsNullOrEmpty(AccessKey) && string.IsNullOrEmpty(SecureAccessKeyId)) { result.AddUserError("Access Key is Required for an Azure IoT Service Bus Listener."); } if (!string.IsNullOrEmpty(AccessKey) && !Utils.StringValidationHelper.IsBase64String(AccessKey)) { result.AddUserError("Access Key does not appear to be a Base 64 string and is likely incorrect."); } break; case ListenerTypes.MQTTClient: if (string.IsNullOrEmpty(HostName)) { result.AddUserError("Host Name is required for Connecting to an MQTT Server."); } if (!Anonymous) { if (string.IsNullOrEmpty(UserName)) { result.AddUserError("User Name is Required to connect to your MQTT Broker for non-anonymous connections."); } if (string.IsNullOrEmpty(Password) && string.IsNullOrEmpty(SecurePasswordId)) { result.AddUserError("Password is Required to connect to your MQTT Broker for non-anonymous connections."); } } else { UserName = null; Password = null; } if (!ConnectToPort.HasValue) { result.AddUserError("Please provide a port that your MQTT Client will connect, usually 1883 or 8883 (SSL)."); } MqttSubscriptions.RemoveAll(sub => string.IsNullOrEmpty(sub.Topic)); if (!MqttSubscriptions.Any()) { result.AddUserError("Please ensure you provide at least one subscription (including wildcards + and #) that will be monitored for incoming messages."); } break; case ListenerTypes.WebSocket: if (string.IsNullOrEmpty(HostName)) { result.AddUserError("Host Name is required for an Azure Service Bus Listener, this is the host name of your Event Hub without the sb:// protocol."); } if (HostName != null && HostName.ToLower().StartsWith("wss://")) { HostName = HostName.Substring(5); } if (HostName != null && HostName.ToLower().StartsWith("ws://")) { HostName = HostName.Substring(4); } if (!string.IsNullOrEmpty(Path) && !Path.StartsWith("/")) { Path = "/" + Path; } if (!Anonymous) { if (string.IsNullOrEmpty(UserName)) { result.AddUserError("User Name is Required to be used to authenticate with your Web Socket Server."); } if (string.IsNullOrEmpty(Password) && string.IsNullOrEmpty(SecurePasswordId)) { result.AddUserError("Password is Required to be used to authenticate with your Web Socket Server.."); } } else { UserName = null; Password = null; } break; case ListenerTypes.MQTTListener: if (!Anonymous) { if (string.IsNullOrEmpty(UserName)) { result.AddUserError("User Name is Required to be used to authenticate MQTT clients authenticating with your broker."); } if (string.IsNullOrEmpty(Password) && string.IsNullOrEmpty(SecurePasswordId)) { result.AddUserError("Password is Required to be used to authenticate MQTT clients authenticating with your broker."); } } else { UserName = null; Password = null; } if (!ListenOnPort.HasValue) { result.AddUserError("Please provide a port that your MQTT listenr will listen for incoming messages, usually 1883."); } break; /* * case ListenerTypes.MQTTBroker: * break; * case ListenerTypes.RabbitMQ: * break; * case ListenerTypes.RabbitMQClient: * break;*/ case ListenerTypes.RawTCP: if (!ListenOnPort.HasValue) { result.AddUserError("Please provide a port that your TCP listenr will listen for incoming messages."); } break; case ListenerTypes.RawUDP: if (!ListenOnPort.HasValue) { result.AddUserError("Please provide a port that your UDP listenr will listen for incoming messages."); } break; case ListenerTypes.Rest: if (!ListenOnPort.HasValue) { result.AddUserError("Please provide a port that your REST listenr will listen for incoming messages, this is usually port 80 for HTTP and 443 for HTTPS."); } if (EntityHeader.IsNullOrEmpty(RestServerType)) { result.AddUserError("Allowable Connection Type is required for an REST Listener."); } if (!Anonymous) { if (string.IsNullOrEmpty(UserName)) { result.AddUserError("Anonymous connections are not enabled, you must provide a user name that will be used to connect to your REST endpoint."); } if (string.IsNullOrEmpty(Password) && string.IsNullOrEmpty(SecurePasswordId)) { result.AddUserError("Anonymous connections are not enabled, you must provide a password that will be used to connect to your REST endpoint."); } } else { UserName = null; Password = null; } break; } }
internal void InitFileServerInfo(TransferInfo transferInfo) { HostName = transferInfo.FileServerInfo.HostName; if (string.IsNullOrEmpty(HostName)) { throw new ApplicationException(FileServerIsNotSetting); } string localname = Dns.GetHostName(); _isLocalMachine = (HostName.ToLower() == localname.ToLower()); VirtualDirectory = transferInfo.FileServerInfo.VirtualDirectory; FileDirectory = transferInfo.FileServerInfo.FileDirectory; FileDirectory = string.IsNullOrEmpty(FileDirectory) ? "Accessories" : FileDirectory; ProtocolType = transferInfo.FileServerInfo.Connect; UploadPostUrl = transferInfo.FileServerInfo.UploadPostUrl; HostPort = int.Parse(transferInfo.FileServerInfo.Port); if (HostPort <= 0) { switch (ProtocolType.ToUpper()) { case "HTTP": HostPort = 80; break; case "FTP": HostPort = 21; break; } HostUrl = ProtocolType + @"://" + HostName; } else { HostUrl = ProtocolType + @"://" + HostName + ":" + HostPort; } ProtocolType = transferInfo.FileServerInfo.Connect; bool isUseProxy = TypeConvert.ToBool(transferInfo.FileServerProxy.IsUsed, false); _supportDebug = TypeConvert.ToBool(transferInfo.FileServerInfo.SupportDebug, true); _supportBorkenResume = TypeConvert.ToBool(transferInfo.FileServerInfo.SupportBrokenResume, true); if (isUseProxy) { if (_environment == null) { _environment = new WebEnvironment(); } _environment.UseProxy = true; _environment.ProxyUrl = transferInfo.FileServerProxy.UriAddress; int proxyPort = Int32.Parse(transferInfo.FileServerProxy.Port); if (proxyPort != 80 && proxyPort != 21) { _environment.ProxyUrl += ":" + proxyPort; } } bool isUserAuth = TypeConvert.ToBool(transferInfo.FileServerAuth.IsUsed, false); if (isUserAuth) { if (_environment == null) { _environment = new WebEnvironment(); } if (isUseProxy) { _environment.ProxyUsername = transferInfo.FileServerAuth.UserName; _environment.ProxyPassword = transferInfo.FileServerAuth.Password; } else { _environment.Username = transferInfo.FileServerAuth.UserName; _environment.Password = transferInfo.FileServerAuth.Password; } } }
public void SetValue(string SettingName, object Val) { try { var isSet = false; foreach (var env in Environments.Values) { foreach (var HostToCheck in env.Host) { if ((Url.ToLower().isWildCardMatch(HostToCheck.ToLower())) || (HostName.ToLower().isWildCardMatch(HostToCheck.ToLower()))) { if (env.Settings.ContainsKey(SettingName)) { env.Settings[SettingName] = Val; } isSet = true; break; } } } if ((!isSet) && (this.DefaultSettings.Settings.ContainsKey(SettingName))) { this.DefaultSettings.Settings[SettingName] = Val; } } catch (Exception) { } }
public object GetValue(string SettingName) { try { object retValue = null; if (this.DefaultSettings.Settings.ContainsKey(SettingName)) { retValue = this.DefaultSettings.Settings[SettingName]; } foreach (var env in Environments.Values) { foreach (var HostToCheck in env.Host) { if ((Url.ToLower().isWildCardMatch(HostToCheck.ToLower())) || (HostName.ToLower().isWildCardMatch(HostToCheck.ToLower()))) { if (env.Settings.ContainsKey(SettingName)) { retValue = env.Settings[SettingName]; } break; } } } return(retValue); } catch (Exception) { return(null); } }
private void searchedItems() { try { #region USing Binding to populate SearchedList = new List <DisplayDetails>(); if (DisplayGuestList.Count != 0) { LstSearch.ItemsSource = null; var serialNo = 0; string searchItem = txtSearchItem.Text.Trim().ToLower(); foreach (var item in DisplayGuestList) { FullName = item.GuestFullName; Company = item.GuestCompany; Email = item.GuestEmail; PhoneNumber = item.GuestPhoneNumber; HostName = item.GuestHostName; DateCheckedIn = item.GuestCheckInTime; Status = item.GuestStatus; InvitationCode = item.GuestCheckInCode; //There should be a field indicating if the code came from from the computer or assgned by a Host. This what I wanted to measure here string _FullName = FullName.ToLower(); string _Company = Company.ToLower(); string _Email = Email.ToLower(); string _PhoneNumber = PhoneNumber.ToLower(); string _HostName = HostName.ToLower(); if (chbFullName.IsChecked == true && _FullName.Contains(searchItem)) { serialNo += 1; SearchedList.Add(AddItemDetail(serialNo.ToString(), FullName, Company, Email, PhoneNumber, HostName, DateCheckedIn, item.GuestCheckOutTime, Status, InvitationCode, item.GuestSignature, item.GuestThumbPrint, item.Picture)); } else if (chbHostName.IsChecked == true && _HostName.Contains(searchItem)) { serialNo += 1; SearchedList.Add(AddItemDetail(serialNo.ToString(), FullName, Company, Email, PhoneNumber, HostName, DateCheckedIn, item.GuestCheckOutTime, Status, InvitationCode, item.GuestSignature, item.GuestThumbPrint, item.Picture)); } else if (chbCompany.IsChecked == true && _Company.Contains(searchItem)) { serialNo += 1; SearchedList.Add(AddItemDetail(serialNo.ToString(), FullName, Company, Email, PhoneNumber, HostName, DateCheckedIn, item.GuestCheckOutTime, Status, InvitationCode, item.GuestSignature, item.GuestThumbPrint, item.Picture)); } else if (chbEmail.IsChecked == true && _Email.Contains(searchItem)) { serialNo += 1; SearchedList.Add(AddItemDetail(serialNo.ToString(), FullName, Company, Email, PhoneNumber, HostName, DateCheckedIn, item.GuestCheckOutTime, Status, InvitationCode, item.GuestSignature, item.GuestThumbPrint, item.Picture)); } else if (chbPhoneNumber.IsChecked == true && _PhoneNumber.Contains(searchItem)) { serialNo += 1; SearchedList.Add(AddItemDetail(serialNo.ToString(), FullName, Company, Email, PhoneNumber, HostName, DateCheckedIn, item.GuestCheckOutTime, Status, InvitationCode, item.GuestSignature, item.GuestThumbPrint, item.Picture)); } } extraSearch(); if (SearchedList.Count != 0) { LstSearch.ItemsSource = null; LstSearch.ItemsSource = SearchedList; txtSearchListNo.Text = LstSearch.Items.Count.ToString(); } else { LstSearch.ItemsSource = null; MessageDialog msg = new MessageDialog("No Result Found"); txtSearchListNo.Text = ""; hideGridSearchPopulated(); msg.ShowAsync(); } //SerializeItems(); stackPanelFilter.Visibility = Visibility.Collapsed; showGridSearchPopulated(); //showPop(); } #endregion } catch (Exception ex) { MessageDialog msg = new MessageDialog(ex.Message + " Void - searchedItems()"); //msg.ShowAsync(); } }