public Interface(Namespace parentNamespace, XmlBindings.Interface xmlData, Overrides.XmlBindings.Interface overrides, Dictionary<string, QualifiableType> typeDictionary) { Debug.Assert(xmlData.Name.StartsWith("I")); string unprefixed = xmlData.Name.Substring(1); m_stylizedName = Formatter.Prefix + unprefixed; m_innerName = "I" + parentNamespace.ApiName + unprefixed; m_nativeNameOfInheritanceParent = xmlData.Extends; if (overrides != null && overrides.IsProjectedAsAbstract) { m_stylizedName = "I" + Formatter.Prefix + unprefixed; } m_methods = new List<Method>(); foreach (XmlBindings.Method xmlMethod in xmlData.Methods) { Method m = new Method(xmlMethod); m_methods.Add(m); } typeDictionary[parentNamespace.RawName + "::" + xmlData.Name] = this; }
public D2DTypes(XmlBindings.D2DTypes xmlData, Overrides.XmlBindings.Settings overrides, Dictionary<string, QualifiableType> typeDictionary, OutputDataTypes outputDataTypes) { const Namespace globalNamespace = null; // Using null as the namespace parameter indicates the global namespace. m_primitiveList = new List<Primitive>(); foreach(XmlBindings.Primitive p in xmlData.Primitives) { Overrides.XmlBindings.Primitive overridePrimitive = null; if (overrides != null) overridePrimitive = overrides.Primitives.Find(x => x.Name == p.Name); m_primitiveList.Add(new Primitive(p, overridePrimitive, typeDictionary)); } m_structList = new List<Struct>(); foreach (XmlBindings.Struct s in xmlData.Structs) { Overrides.XmlBindings.Struct overrideStruct = null; if (overrides != null) overrideStruct = overrides.Structs.Find(x => x.Name == s.Name); m_structList.Add(new Struct(globalNamespace, s, overrideStruct, typeDictionary, outputDataTypes)); } m_namespaceList = new List<Namespace>(); foreach (XmlBindings.Namespace n in xmlData.Namespaces) { Overrides.XmlBindings.Namespace overrideNamespace = null; if (overrides != null) overrideNamespace = overrides.Namespaces.Find(x => x.Name == n.Name); m_namespaceList.Add(new Namespace(n, overrideNamespace, overrides.RootNamespace.Value, typeDictionary, outputDataTypes)); } }
public Namespace(XmlBindings.Namespace xmlData, Overrides.XmlBindings.Namespace overrides, string rootProjectedNamespace, Dictionary<string, QualifiableType> typeDictionary, OutputDataTypes outputDataTypes) { m_rawName = xmlData.Name; if (overrides != null && overrides.NameOverride != null) { m_apiName = overrides.NameOverride; } else { m_apiName = xmlData.Name; } m_enums = new List<Enum>(); foreach (XmlBindings.Enum enumXml in xmlData.Enums) { Overrides.XmlBindings.Enum overridesEnum = null; if (overrides != null) overridesEnum = overrides.Enums.Find(x => x.Name == enumXml.Name); m_enums.Add(new Enum(this, rootProjectedNamespace, enumXml, overridesEnum, typeDictionary, outputDataTypes)); } m_structs = new List<Struct>(); foreach (XmlBindings.Struct structXml in xmlData.Structs) { Overrides.XmlBindings.Struct overridesStruct = null; if (overrides != null) overridesStruct = overrides.Structs.Find(x => x.Name == structXml.Name); m_structs.Add(new Struct(this, structXml, overridesStruct, typeDictionary, outputDataTypes)); } m_interfaces = new List<Interface>(); foreach (XmlBindings.Interface interfaceXml in xmlData.Interfaces) { Overrides.XmlBindings.Interface overridesInterface = null; if (overrides != null) overridesInterface = overrides.Interfaces.Find(x => x.Name == interfaceXml.Name); m_interfaces.Add(new Interface(this, interfaceXml, overridesInterface, typeDictionary)); } foreach (XmlBindings.Typedef t in xmlData.Typedefs) { // In the types XML, often times types are declared as one type, // then typedefs to something else, and referenced thereafter // as that second type. And so, typedefs must be handled here. // // In the XML, the 'Name' field in each typedef is unqualified, // but the 'From' field is qualified. // For example, <Typedef Name="COLOR_F" From="D2D::COLOR_F"/> // // So, the entries are added to the type dictionary here // under the qualified name. // string qualified = xmlData.Name + "::" + t.Name; typeDictionary[qualified] = typeDictionary[t.From]; } }
public Primitive(XmlBindings.Primitive xmlData, Overrides.XmlBindings.Primitive overrides, Dictionary<string, QualifiableType> typeDictionary) { m_name = xmlData.Name; typeDictionary[m_name] = this; m_projectedName = m_name; if(overrides != null && overrides.ProjectedNameOverride != null) { m_projectedName = overrides.ProjectedNameOverride; } }
public Interface(Namespace parentNamespace, XmlBindings.Interface xmlData, Overrides.XmlBindings.Interface overrides, Dictionary<string, QualifiableType> typeDictionary) { Debug.Assert(xmlData.Name.StartsWith("I")); string unprefixed = xmlData.Name.Substring(1); m_stylizedName = Formatter.Prefix + unprefixed; m_innerName = "I" + parentNamespace.ApiName + unprefixed; if(overrides != null && overrides.IsProjectedAsAbstract) { m_stylizedName = "I" + Formatter.Prefix + unprefixed; } typeDictionary[parentNamespace.RawName + "::" + xmlData.Name] = this; }
public EnumValue(XmlBindings.EnumValue xmlData, Overrides.XmlBindings.EnumValue overrides) { m_nativeName = xmlData.Name; m_stylizedName = Formatter.StylizeNameFromUnderscoreSeparators(xmlData.Name); m_shouldProject = true; if (overrides != null) { if (overrides.ProjectedNameOverride != null) { m_stylizedName = overrides.ProjectedNameOverride; } m_shouldProject = overrides.ShouldProject; } m_valueExpression = GetValueExpression(xmlData); }
public IOverrides GetOverrides() { var part = GetPart(); var overrides = new Overrides(); if (!string.IsNullOrEmpty(part.FaviconUrl)) overrides.FaviconUri = CreateUri(part.FaviconUrl); overrides.StylesheetUris = CreateUris(part.StylesheetUrisJson); overrides.CustomStyles = CreateCustomResource(part.CustomStylesIsSaved, CustomStylesPath); overrides.HeadScriptUris = CreateUris(part.HeadScriptUrisJson); overrides.CustomHeadScript = CreateCustomResource(part.CustomHeadScriptIsSaved, CustomHeadScriptPath); overrides.FootScriptUris = CreateUris(part.FootScriptUrisJson); overrides.CustomFootScript = CreateCustomResource(part.CustomFootScriptIsSaved, CustomFootScriptPath); overrides.CustomPlacementContent = part.CustomPlacementContent; return overrides; }
private void Overrides_GridUpdated(object sender, EventArgs e) { Overrides.Rehash(); }
public bool HasExplicitValue(string key) { return(Overrides.ContainsKey(key)); }
private void Initialize() { Children.Clear(); if (Instance == null) { return; } //DataContext = Instance; if (Instance == null) { return; } var props = Instance.GetType().GetProperties(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.SetProperty | System.Reflection.BindingFlags.GetProperty); foreach (var item in props) { string displayName = item.Name; IPropertyOverride propOverride = null; if (Overrides != null) { propOverride = Overrides.Where(o => o.PropertyName == displayName).FirstOrDefault(); } BindingMode bindingMode = item.CanWrite ? BindingMode.TwoWay : BindingMode.OneWay; displayName = System.Text.RegularExpressions.Regex.Replace(displayName, "(?<!^)([A-Z][a-z]|(?<=[a-z])[A-Z])", " $1", RegexOptions.Compiled).Trim(); TextBlock text = new TextBlock() { Text = displayName }; if (item.PropertyType != typeof(bool)) { Children.Add(text); } if (item.PropertyType == typeof(bool)) { CheckBox cb = new CheckBox(); cb.Content = displayName; cb.DataContext = Instance; cb.SetBinding(CheckBox.IsCheckedProperty, new Binding(item.Name) { Mode = bindingMode }); cb.IsEnabled = item.CanWrite; Children.Add(cb); } else if (item.PropertyType == typeof(double) || item.PropertyType == typeof(string) || item.PropertyType == typeof(float) || item.PropertyType == typeof(int) || item.PropertyType == typeof(long)) { if (propOverride is SliderOverride) { var po = (SliderOverride)propOverride; Slider slider = new Slider() { HorizontalAlignment = HorizontalAlignment.Stretch }; slider.Minimum = po.MinValue; slider.Maximum = po.MaxValue; if (po.StepValue > 0) { slider.SmallChange = po.StepValue; } else if (item.PropertyType == typeof(int) || item.PropertyType == typeof(long)) { slider.SmallChange = 1; } var binding = new Binding(item.Name) { Mode = bindingMode }; if (po.Delay > 0) { binding.Delay = binding.Delay; } slider.DataContext = Instance; slider.IsEnabled = item.CanWrite; slider.SetBinding(Slider.ValueProperty, binding); Children.Remove(text); Grid g = new Grid(); g.Children.Add(text); TextBlock tb = new TextBlock() { HorizontalAlignment = HorizontalAlignment.Right, FontSize = 9 }; tb.DataContext = Instance; tb.SetBinding(TextBlock.TextProperty, new Binding(item.Name) { Mode = BindingMode.OneWay, StringFormat = "0.0" }); g.Children.Add(tb); Children.Add(g); Children.Add(slider); } else { TextBox tb = new TextBox() { HorizontalAlignment = HorizontalAlignment.Stretch }; tb.IsEnabled = item.CanWrite; tb.DataContext = Instance; tb.SetBinding(TextBox.TextProperty, new Binding(item.Name) { Mode = bindingMode }); Children.Add(tb); } } else if (item.PropertyType == typeof(string) || item.PropertyType == typeof(Uri)) { TextBox tb = new TextBox() { HorizontalAlignment = HorizontalAlignment.Stretch }; tb.IsEnabled = item.CanWrite; tb.DataContext = Instance; tb.SetBinding(TextBox.TextProperty, new Binding(item.Name) { Mode = bindingMode }); Children.Add(tb); } else if (item.PropertyType.IsEnum) { ComboBox cb = new ComboBox() { HorizontalAlignment = HorizontalAlignment.Stretch }; cb.IsEnabled = item.CanWrite; cb.ItemsSource = Enum.GetValues(item.PropertyType); cb.DataContext = Instance; cb.SetBinding(ComboBox.SelectedItemProperty, new Binding(item.Name) { Mode = bindingMode }); Children.Add(cb); } else if (item.PropertyType.IsClass) { PropertyGrid pg = new PropertyGrid(); //pg.SetBinding(FrameworkElement.DataContextProperty, new PropertyItem) pg.DataContext = Instance; pg.SetBinding(PropertyGrid.InstanceProperty, new Binding(item.Name) { Mode = BindingMode.OneWay }); Children.Add(pg); } else { TextBox tb = new TextBox() { HorizontalAlignment = HorizontalAlignment.Stretch }; tb.DataContext = Instance; tb.SetBinding(TextBox.TextProperty, new Binding(item.Name) { Mode = bindingMode }); tb.IsReadOnly = true; tb.Foreground = System.Windows.Media.Brushes.Gray; Children.Add(tb); } } }
/// <summary> /// Returns an <see cref="System.Collections.IEnumerator"/> that can iterate /// through a collection. /// </summary> /// <remarks> /// <p> /// The returned <see cref="System.Collections.IEnumerator"/> is the /// <see cref="System.Collections.IEnumerator"/> exposed by the /// <see cref="Oragon.Spring.Objects.Factory.Support.MethodOverrides.Overrides"/> /// property. /// </p> /// </remarks> /// <returns> /// An <see cref="System.Collections.IEnumerator"/> that can iterate through a /// collection. /// </returns> public IEnumerator GetEnumerator() { return(Overrides.GetEnumerator()); }
/// <summary> /// Get the relative path to a special folder for a platform /// </summary> /// <param name="ns">Game namespace</param> /// <param name="platform">Platform folder</param> /// <param name="folder">Platform's folder. Must only have one folder flag set.</param> /// <param name="overrides">Optional set of overrides to use. Can be null.</param> /// <returns>Relative path to the folder</returns> public static string GetRelativePath(Namespace ns, Platform platform, PlatformFolder folder, Overrides overrides) { string dir_path; if (overrides != null && overrides.GetOverride(folder, out dir_path)) { return(dir_path); } else { return(GetRelativePath(ns, platform, folder)); } }
/// <summary> /// Obtains the configuration for a given silo. /// </summary> /// <param name="siloName">Silo name.</param> /// <param name="siloNode">NodeConfiguration associated with the specified silo.</param> /// <returns>true if node was found</returns> public bool TryGetNodeConfigurationForSilo(string siloName, out NodeConfiguration siloNode) { return(Overrides.TryGetValue(siloName, out siloNode)); }
public TestOverridesSource(Overrides overrides = null) { Overrides = overrides ?? new Overrides(); }
/// <summary> /// Create or get the path to a special folder for a platform /// </summary> /// <param name="ns">Game namespace</param> /// <param name="platform">Platform folder</param> /// <param name="folder">Platform's folder. Must only have one folder flag set.</param> /// <param name="overrides">Optional set of overrides to use. Can be null.</param> /// <returns>Path to the folder</returns> public static string CreatePlatformFolder(Namespace ns, Platform platform, PlatformFolder folder, Overrides overrides) { return CreatePlatformFolder(ns, platform, folder, overrides, true); }
/// <summary> /// Checks for what overridden platform folders exist /// </summary> /// <param name="ns">Game namespace</param> /// <param name="platform">Platform folder</param> /// <param name="overrides"></param> /// <returns>Flagged PlatformFolder of all existing folders</returns> public static PlatformFolder CheckPlatformFolders(Namespace ns, Platform platform, Overrides overrides) { return(PlatformFolder.AllFolders); // TODO: do me }
private static async Task RenewAsync(Overrides overrides, ILogger log, CancellationToken cancellationToken, ExecutionContext executionContext) { // internal storage (used for letsencrypt account metadata) IStorageProvider storageProvider = new AzureBlobStorageProvider(Environment.GetEnvironmentVariable("AzureWebJobsStorage"), "letsencrypt"); IConfigurationProcessor processor = new ConfigurationProcessor(); var configurations = await LoadConfigFilesAsync(storageProvider, processor, log, cancellationToken, executionContext); IAuthenticationService authenticationService = new AuthenticationService(storageProvider); var az = new AzureHelper(); var tokenProvider = new AzureServiceTokenProvider(); var keyVaultClient = new KeyVaultClient(new KeyVaultClient.AuthenticationCallback(tokenProvider.KeyVaultTokenCallback)); var storageFactory = new StorageFactory(az); var renewalOptionsParser = new RenewalOptionParser(az, keyVaultClient, storageFactory, log); var certificateBuilder = new CertificateBuilder(); IRenewalService renewalService = new RenewalService(authenticationService, renewalOptionsParser, certificateBuilder, log); var stopwatch = new Stopwatch(); // TODO: with lots of certificate renewals this could run into function timeout (10mins) // with 30 days to expiry (default setting) this isn't a big problem as next day all finished certs are skipped // user will only get email <= 14 days before expiry so acceptable for now var errors = new List <Exception>(); foreach ((var name, var config) in configurations) { using (log.BeginScope($"Working on certificates from {name}")) { foreach (var cert in config.Certificates) { stopwatch.Restart(); var hostNames = string.Join(";", cert.HostNames); cert.Overrides = overrides ?? Overrides.None; try { var result = await renewalService.RenewCertificateAsync(config.Acme, cert, cancellationToken); switch (result) { case RenewalResult.NoChange: log.LogInformation($"Certificate renewal skipped for: {hostNames} (no change required yet)"); break; case RenewalResult.Success: log.LogInformation($"Certificate renewal succeeded for: {hostNames}"); break; default: throw new ArgumentOutOfRangeException(result.ToString()); } } catch (Exception e) { log.LogError(e, $"Certificate renewal failed for: {hostNames}!"); errors.Add(e); } log.LogInformation($"Renewing certificates for {hostNames} took: {stopwatch.Elapsed}"); } } } if (!configurations.Any()) { log.LogWarning("No configurations where processed, refere to the sample on how to set up configs!"); } if (errors.Any()) { throw new AggregateException("Failed to process all certificates", errors); } }
/// <summary> /// Create or get the path to a file /// </summary> /// <param name="ns">Game namespace</param> /// <param name="platform">Platform folder</param> /// <param name="folder">Platform's folder. Must only have one folder flag set.</param> /// <param name="file">File name</param> /// <param name="ext">File extension</param> /// <param name="overrides">Optional set of overrides to use. Can be null.</param> /// <param name="create">True if we should create the path on disk if it doesn't exist already</param> /// <returns>Path to the file</returns> public static string CreatePlatformFile(Namespace ns, Platform platform, PlatformFolder folder, string file, string ext, Overrides overrides, bool create) { string file_path = string.Format("{0}{1}.{2}", CreatePlatformFolder(ns, platform, folder, overrides), file, ext); if (create && !File.Exists(file_path)) { File.Create(file_path).Close(); } return(file_path); }
/// <summary> /// Create or get the path to a file /// </summary> /// <param name="ns">Game namespace</param> /// <param name="platform">Platform folder</param> /// <param name="folder">Platform's folder. Must only have one folder flag set.</param> /// <param name="file">File name</param> /// <param name="ext">File extension</param> /// <param name="overrides">Optional set of overrides to use. Can be null.</param> /// <returns>Path to the file</returns> public static string CreatePlatformFile(Namespace ns, Platform platform, PlatformFolder folder, string file, string ext, Overrides overrides) { return(CreatePlatformFile(ns, platform, folder, file, ext, overrides, true)); }
/// <summary> /// Create or get the path to a special folder for a platform /// </summary> /// <param name="ns">Game namespace</param> /// <param name="platform">Platform folder</param> /// <param name="folder">Platform's folder. Must only have one folder flag set.</param> /// <param name="overrides">Optional set of overrides to use. Can be null.</param> /// <param name="create">True if we should create the path on disk if it doesn't exist already</param> /// <returns>Path to the folder</returns> public static string CreatePlatformFolder(Namespace ns, Platform platform, PlatformFolder folder, Overrides overrides, bool create) { string dir_path; if (overrides != null && overrides.GetOverride(folder, out dir_path)) { if (create && !Directory.Exists(dir_path)) { Directory.CreateDirectory(dir_path); } return(dir_path); } else { return(CreatePlatformFolder(ns, platform, folder)); } }
/// <summary> /// Create or get the path to a special folder for a platform /// </summary> /// <param name="ns">Game namespace</param> /// <param name="platform">Platform folder</param> /// <param name="folder">Platform's folder. Must only have one folder flag set.</param> /// <param name="overrides">Optional set of overrides to use. Can be null.</param> /// <returns>Path to the folder</returns> public static string CreatePlatformFolder(Namespace ns, Platform platform, PlatformFolder folder, Overrides overrides) { return(CreatePlatformFolder(ns, platform, folder, overrides, true)); }
private async Task RenewAsync( Overrides overrides, ExecutionContext executionContext, CancellationToken cancellationToken) { if (overrides != null && overrides.DomainsToUpdate == null) { // users could pass null parameter overrides.DomainsToUpdate = new string[0]; } var configurations = await _configurationLoader.LoadConfigFilesAsync(executionContext, cancellationToken); var stopwatch = new Stopwatch(); // with lots of certificate renewals this could run into function timeout (10mins) // with 30 days to expiry (default setting) this isn't a big problem as next day all unfinished renewals are continued // user will only get email <= 14 days before expiry so acceptable for now var errors = new List <Exception>(); foreach ((var name, var config) in configurations) { using (_logger.BeginScope($"Working on certificates from {name}")) { foreach (var cert in config.Certificates) { stopwatch.Restart(); var hostNames = string.Join(";", cert.HostNames); cert.Overrides = overrides ?? Overrides.None; try { var result = await _renewalService.RenewCertificateAsync(config.Acme, cert, cancellationToken); switch (result) { case RenewalResult.NoChange: _logger.LogInformation($"Certificate renewal skipped for: {hostNames} (no change required yet)"); break; case RenewalResult.Success: _logger.LogInformation($"Certificate renewal succeeded for: {hostNames}"); break; default: throw new ArgumentOutOfRangeException(result.ToString()); } } catch (Exception e) { _logger.LogError(e, $"Certificate renewal failed for: {hostNames}!"); errors.Add(e); } _logger.LogInformation($"Renewing certificates for {hostNames} took: {stopwatch.Elapsed}"); } } } if (!configurations.Any()) { _logger.LogWarning("No configurations where processed, refere to the sample on how to set up configs!"); } if (errors.Any()) { throw new AggregateException("Failed to process all certificates", errors); } }
/// <summary> /// Get the relative path to a special folder for a platform /// </summary> /// <param name="ns">Game namespace</param> /// <param name="platform">Platform folder</param> /// <param name="folder">Platform's folder. Must only have one folder flag set.</param> /// <param name="overrides">Optional set of overrides to use. Can be null.</param> /// <returns>Relative path to the folder</returns> public static string GetRelativePath(Namespace ns, Platform platform, PlatformFolder folder, Overrides overrides) { string dir_path; if (overrides != null && overrides.GetOverride(folder, out dir_path)) return dir_path; else return GetRelativePath(ns, platform, folder); }
public SignZeroParityFlag(bool initialValue) { this.overrides = new Overrides(initialValue); this.result = default; }
/// <summary> /// Create or get the path to a file /// </summary> /// <param name="ns">Game namespace</param> /// <param name="platform">Platform folder</param> /// <param name="folder">Platform's folder. Must only have one folder flag set.</param> /// <param name="file">File name</param> /// <param name="ext">File extension</param> /// <param name="overrides">Optional set of overrides to use. Can be null.</param> /// <returns>Path to the file</returns> public static string CreatePlatformFile(Namespace ns, Platform platform, PlatformFolder folder, string file, string ext, Overrides overrides) { return CreatePlatformFile(ns, platform, folder, file, ext, overrides, true); }
public Point GetCharOffset(char c) => Overrides?.FirstOrDefault(x => x.Chars.Contains(c))?.GetOffset() ?? Point.Empty;
static bool Prefix(ref string value) { Overrides.RaiseDonationKeyChangeEvent(value); return(true); }
public int GetCharWidth(char c) => GetWhiteSpace(c)?.Width ?? Overrides?.FirstOrDefault(x => x.Chars.Contains(c))?.Width ?? CharWidth;
public static void Load() { Culture = new CultureInfo("en-US", false); Culture.NumberFormat.NumberDecimalSeparator = "."; Culture.NumberFormat.NumberGroupSeparator = ","; /* Load localization files */ string defLang = Config.GetAppSetting <string>("DefaultLanguage"); if (defLang == null) { defLang = "ENU"; } if (Client.IsOSI) { Ultima.Files.ReLoadDirectory(); Ultima.Files.LoadMulPath(); } if (!Language.Load(defLang)) { MessageBox.Show( $"WARNING: Razor was unable to load the file Language/Razor_lang.{defLang}\n.", "Language Load Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } m_Running = true; /* Load settings from configuration file */ Ultima.Files.SetMulPath(Config.GetAppSetting <string>("UODataDir")); Client.Instance.ClientEncrypted = Config.GetAppSetting <int>("ClientEncrypted") == 1; Client.Instance.ServerEncrypted = Config.GetAppSetting <int>("ServerEncrypted") == 1; Language.LoadCliLoc(); /* Initialize engine */ SplashScreen.Message = LocString.Initializing; Initialize(typeof(Engine).Assembly); /* Load Profile */ SplashScreen.Message = LocString.LoadingLastProfile; Config.LoadCharList(); Overrides.Load(); if (!Config.LoadLastProfile()) { MessageBox.Show( "The selected profile could not be loaded, using default instead.", "Profile Load Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } /* Start client */ SplashScreen.Message = LocString.LoadingClient; string clientPath = Ultima.Files.GetFilePath("client.exe"); if (clientPath == null || !File.Exists(clientPath)) { MessageBox.Show(SplashScreen.Instance, $"Unable to find the client specified.\n\"{(clientPath != null ? clientPath : "-null-")}\"", "Could Not Find Client", MessageBoxButtons.OK, MessageBoxIcon.Stop); SplashScreen.End(); return; } var result = Client.Instance.LaunchClient(clientPath); if (result != Client.Loader_Error.SUCCESS) { MessageBox.Show(SplashScreen.Instance, String.Format("Unable to launch the client specified. (Error: {1})\n \"{0}\"", clientPath != null ? clientPath : "-null-", result), "Could Not Start Client", MessageBoxButtons.OK, MessageBoxIcon.Stop); SplashScreen.End(); return; } string addr = Config.GetAppSetting <string>("LastServer"); int port = Config.GetAppSetting <int>("LastPort"); IPAddress ip = Resolve(addr); if (ip == IPAddress.None || port == 0) { MessageBox.Show(SplashScreen.Instance, Language.GetString(LocString.BadServerAddr), "Bad Server Address", MessageBoxButtons.OK, MessageBoxIcon.Stop); SplashScreen.End(); return; } Client.Instance.SetConnectionInfo(ip, port); SplashScreen.Message = LocString.WaitingForClient; }
/// <summary> /// True if there is a default or explicit value for the given key. /// </summary> /// <param name="key">The Key.</param> /// <returns>True if found.</returns> public bool HasSetting(string key) { Guard.AgainstNullAndEmpty(nameof(key), key); return(Overrides.ContainsKey(key) || Defaults.ContainsKey(key)); }
/// <summary> /// Adds the supplied <paramref name="theOverride"/> to the overrides contained /// within this instance. /// </summary> /// <param name="theOverride"> /// The <see cref="Oragon.Spring.Objects.Factory.Support.MethodOverride"/> to be /// added. /// </param> public void Add(MethodOverride theOverride) { Overrides.Add(theOverride); }
/// <summary> /// True if there is an explicit value for the given key. /// </summary> /// <param name="key">The Key.</param> /// <returns>True if found.</returns> public bool HasExplicitValue(string key) { Guard.AgainstNullAndEmpty(nameof(key), key); return(Overrides.ContainsKey(key)); }
static bool Prefix(ref WebProxy value) { Overrides.RaiseProxyChangeEvent(value); return(true); }
public string ToPrettyString() { return("Assignment {" + ($"\n{nameof(Id)}: {Id}," + $"\n{nameof(Name)}: {Name}," + $"\n{nameof(Description)}: {Description}," + $"\n{nameof(CreatedAt)}: {CreatedAt}," + $"\n{nameof(UpdatedAt)}: {UpdatedAt}," + $"\n{nameof(DueAt)}: {DueAt}," + $"\n{nameof(LockAt)}: {LockAt}," + $"\n{nameof(UnlockAt)}: {UnlockAt}," + $"\n{nameof(HasOverrides)}: {HasOverrides}," + $"\n{nameof(AllDates)}: {AllDates?.ToPrettyString()}," + $"\n{nameof(CourseId)}: {CourseId}," + $"\n{nameof(HtmlUrl)}: {HtmlUrl}," + $"\n{nameof(SubmissionsDownloadUrl)}: {SubmissionsDownloadUrl}," + $"\n{nameof(AssignmentGroupId)}: {AssignmentGroupId}," + $"\n{nameof(DueDateRequired)}: {DueDateRequired}," + $"\n{nameof(AllowedExtensions)}: {AllowedExtensions?.ToPrettyString()}," + $"\n{nameof(MaxNameLength)}: {MaxNameLength}," + $"\n{nameof(TurnitinEnabled)}: {TurnitinEnabled}," + $"\n{nameof(VeriCiteEnabled)}: {VeriCiteEnabled}," + $"\n{nameof(TurnitinSettings)}: {TurnitinSettings}," + $"\n{nameof(GradeGroupStudentsIndividually)}: {GradeGroupStudentsIndividually}," + $"\n{nameof(ExternalToolTagAttributes)}: {ExternalToolTagAttributes}," + $"\n{nameof(PeerReviews)}: {PeerReviews}," + $"\n{nameof(AutomaticPeerReviews)}: {AutomaticPeerReviews}," + $"\n{nameof(PeerReviewCount)}: {PeerReviewCount}," + $"\n{nameof(PeerReviewsAssignAt)}: {PeerReviewsAssignAt}," + $"\n{nameof(IntraGroupPeerReviews)}: {IntraGroupPeerReviews}," + $"\n{nameof(GroupCategoryId)}: {GroupCategoryId}," + $"\n{nameof(NeedsGradingCount)}: {NeedsGradingCount}," + $"\n{nameof(NeedsGradingCountBySection)}: {NeedsGradingCountBySection?.ToPrettyString()}," + $"\n{nameof(Position)}: {Position}," + $"\n{nameof(PostToSis)}: {PostToSis}," + $"\n{nameof(IntegrationId)}: {IntegrationId}," + $"\n{nameof(IntegrationData)}: {IntegrationData}," + $"\n{nameof(Muted)}: {Muted}," + $"\n{nameof(PointsPossible)}: {PointsPossible}," + $"\n{nameof(SubmissionTypes)}: {SubmissionTypes.ToPrettyString()}," + $"\n{nameof(HasSubmittedSubmissions)}: {HasSubmittedSubmissions}," + $"\n{nameof(GradingType)}: {GradingType}," + $"\n{nameof(GradingStandardId)}: {GradingStandardId}," + $"\n{nameof(Published)}: {Published}," + $"\n{nameof(Unpublishable)}: {Unpublishable}," + $"\n{nameof(OnlyVisibleToOverrides)}: {OnlyVisibleToOverrides}," + $"\n{nameof(LockedForUser)}: {LockedForUser}," + $"\n{nameof(LockInfo)}: {LockInfo}," + $"\n{nameof(LockExplanation)}: {LockExplanation}," + $"\n{nameof(QuizId)}: {QuizId}," + $"\n{nameof(AnonymousSubmissions)}: {AnonymousSubmissions}," + $"\n{nameof(DiscussionTopic)}: {DiscussionTopic}," + $"\n{nameof(FreezeOnCopy)}: {FreezeOnCopy}," + $"\n{nameof(Frozen)}: {Frozen}," + $"\n{nameof(FrozenAttributes)}: {FrozenAttributes?.ToPrettyString()}," + $"\n{nameof(Submission)}: {Submission}," + $"\n{nameof(UseRubricForGrading)}: {UseRubricForGrading}," + $"\n{nameof(RubricSettings)}: {RubricSettings}," + $"\n{nameof(Rubric)}: {Rubric?.ToPrettyString()}," + $"\n{nameof(AssignmentVisibility)}: {AssignmentVisibility?.ToPrettyString()}," + $"\n{nameof(Overrides)}: {Overrides?.ToPrettyString()}," + $"\n{nameof(OmitFromFinalGrade)}: {OmitFromFinalGrade}," + $"\n{nameof(ModeratedGrading)}: {ModeratedGrading}," + $"\n{nameof(GraderCount)}: {GraderCount}," + $"\n{nameof(FinalGraderId)}: {FinalGraderId}," + $"\n{nameof(GraderCommentsVisibleToGraders)}: {GraderCommentsVisibleToGraders}," + $"\n{nameof(GradersAnonymousToGraders)}: {GradersAnonymousToGraders}," + $"\n{nameof(GraderNamesVisibleToFinalGrader)}: {GraderNamesVisibleToFinalGrader}," + $"\n{nameof(AnonymousGrading)}: {AnonymousGrading}," + $"\n{nameof(AllowedAttempts)}: {AllowedAttempts}").Indent(4) + "\n}"); }
public bool HasSetting(string key) { return(Overrides.ContainsKey(key) || Defaults.ContainsKey(key)); }
public Struct(Namespace parentNamespace, XmlBindings.Struct xmlData, Overrides.XmlBindings.Struct overrideData, Dictionary<string, QualifiableType> typeDictionary, OutputDataTypes outputDataTypes) { if (parentNamespace != null) { m_rawName = parentNamespace.ApiName + "_" + xmlData.Name; typeDictionary[parentNamespace.RawName + "::" + xmlData.Name] = this; } else { m_rawName = xmlData.Name; typeDictionary[xmlData.Name] = this; } m_stylizedName = Formatter.Prefix + Formatter.StylizeNameFromUnderscoreSeparators(xmlData.Name); if(overrideData != null) { if(overrideData.Guid != null) { m_guid = overrideData.Guid; } if(overrideData.ProjectedNameOverride != null) { if (overrideData.ShouldProject) m_stylizedName = Formatter.Prefix + overrideData.ProjectedNameOverride; else m_stylizedName = overrideData.ProjectedNameOverride; } if(overrideData.IdlNamespaceQualifier != null) { m_idlTypeNameQualifier = overrideData.IdlNamespaceQualifier; } } m_idlInterfaceName = "I" + m_stylizedName; m_structFields = new List<StructField>(); foreach(XmlBindings.StructField structXmlData in xmlData.Fields) { m_structFields.Add(new StructField(structXmlData)); } if (xmlData.Extends != null) { m_extendsTypeName = xmlData.Extends; // Note: the Extends field is already qualified. See D2DTypes.xml. Example: Extends="D2D1::IImage" QualifiableType parentType = typeDictionary[m_extendsTypeName]; Struct parentAsStruct = parentType as Struct; // Structs should only be deriving from struct types m_structFields.InsertRange(0, parentAsStruct.Fields); Debug.Assert(parentAsStruct.ExtendsTypeName == null); // Multiple levels in the hierarchy are not supported at this time. } // For the time being, unions are not output (they are very uncommon). bool usesUnions = xmlData.Fields == null; // Structs in the global namespace are defined as aliases only. By convention, only structs in a namespace are output. if (parentNamespace != null && !usesUnions && (overrideData != null && overrideData.ShouldProject)) { outputDataTypes.AddStruct(this); } }
/********** value check ************/ public bool IsValuesAvailable() { Overrides overrides = bean.overrides; bool b1 = overrides.layer_height.default_value >= RNG_layerHeight.low && overrides.layer_height.default_value <= RNG_layerHeight.high; bool b2 = overrides.wall_thickness.default_value >= RNG_wallThickness.low && overrides.wall_thickness.default_value <= RNG_wallThickness.high; bool b3 = overrides.top_thickness.default_value >= RNG_topThickness.low && overrides.top_thickness.default_value <= RNG_topThickness.high; bool b4 = overrides.bottom_thickness.default_value >= RNG_bottomThickness.low && overrides.bottom_thickness.default_value <= RNG_bottomThickness.high; bool b5 = overrides.infill_sparse_density.default_value >= RNG_infillDesnsity.low && overrides.infill_sparse_density.default_value <= RNG_infillDesnsity.high; bool b6 = overrides.speed_print.default_value >= RNG_PrintAndTravelSpeed.low && overrides.speed_print.default_value <= RNG_PrintAndTravelSpeed.high; bool b7 = overrides.speed_infill.default_value >= RNG_PrintAndTravelSpeed.low && overrides.speed_infill.default_value <= RNG_PrintAndTravelSpeed.high; bool b8 = overrides.speed_wall_0.default_value >= RNG_PrintAndTravelSpeed.low && overrides.speed_wall_0.default_value <= RNG_PrintAndTravelSpeed.high; bool b9 = overrides.speed_wall_x.default_value >= RNG_PrintAndTravelSpeed.low && overrides.speed_wall_x.default_value <= RNG_PrintAndTravelSpeed.high; bool b10 = overrides.speed_topbottom.default_value >= RNG_PrintAndTravelSpeed.low && overrides.speed_topbottom.default_value <= RNG_PrintAndTravelSpeed.high; bool b11 = overrides.speed_travel.default_value >= RNG_PrintAndTravelSpeed.low && overrides.speed_travel.default_value <= RNG_PrintAndTravelSpeed.high; bool b22 = overrides.speed_print_layer_0.default_value >= RNG_PrintAndTravelSpeed.low && overrides.speed_print_layer_0.default_value <= RNG_PrintAndTravelSpeed.high; bool b23 = overrides.speed_travel_layer_0.default_value >= RNG_PrintAndTravelSpeed.low && overrides.speed_travel_layer_0.default_value <= RNG_PrintAndTravelSpeed.high; bool b12 = overrides.material_print_temperature.default_value >= RNG_printTemp.low && overrides.material_print_temperature.default_value <= RNG_printTemp.high; bool b13 = overrides.material_print_temperature_layer_0.default_value >= RNG_printTempInitialLayer.low && overrides.material_print_temperature_layer_0.default_value <= RNG_printTempInitialLayer.high; bool b14 = overrides.material_final_print_temperature.default_value >= RNG_finalPrintTemp.low && overrides.material_final_print_temperature.default_value <= RNG_finalPrintTemp.high; bool b15 = overrides.material_diameter.default_value >= RNG_diameter.low && overrides.material_diameter.default_value <= RNG_diameter.high; bool b16 = overrides.material_flow.default_value >= RNG_flow.low && overrides.material_flow.default_value <= RNG_flow.high; bool b17 = true; bool b18 = true; //if retraction_enable, then check range if (overrides.retraction_enable.default_value) { b17 = overrides.retraction_amount.default_value >= RNG_retractDis.low && overrides.retraction_amount.default_value <= RNG_retractDis.high; b18 = overrides.retraction_speed.default_value >= RNG_retractSpeed.low && overrides.retraction_speed.default_value <= RNG_retractSpeed.high; } bool b19 = overrides.layer_height_0.default_value >= RNG_layerHeight_0.low && overrides.layer_height_0.default_value <= RNG_layerHeight_0.high; bool b20 = overrides.initial_layer_line_width_factor.default_value >= RNG_initial_layer_line_width_factor.low && overrides.initial_layer_line_width_factor.default_value <= RNG_initial_layer_line_width_factor.high; bool b21 = true; //if retraction_enable and retraction_hop_enabled, then check range if (overrides.retraction_enable.default_value && overrides.retraction_hop_enabled.default_value) { b21 = overrides.retraction_hop.default_value >= RNG_z_hop_height.low && overrides.retraction_hop.default_value <= RNG_z_hop_height.high; } return(b1 && b2 && b3 && b4 && b5 && b6 && b7 && b8 && b9 && b10 && b11 && b12 && b13 && b14 && b15 && b16 && b17 && b18 && b19 && b20 && b21 && b22 && b23); }
/// <summary> /// Get the relative path to a file /// </summary> /// <param name="ns">Game namespace</param> /// <param name="platform">Platform folder</param> /// <param name="folder">Platform's folder. Must only have one folder flag set.</param> /// <param name="file">File name</param> /// <param name="ext">File extension</param> /// <param name="overrides">Optional set of overrides to use. Can be null.</param> /// <returns>Relative path to the file</returns> public static string GetRelativePath(Namespace ns, Platform platform, PlatformFolder folder, string file, string ext, Overrides overrides) { return(string.Format("{0}{1}.{2}", GetRelativePath(ns, platform, folder, overrides), file, ext)); }
public static void SetupBlackLookFeel() { _overrides = Overrides.Black; string styleSetPath;// = string.Format(@"{0}\Application_Config\AppStyleSet.isl", DIRECTORIES.S_DRIVE); styleSetPath = @"c:\AppStyleset.isl"; if (System.IO.File.Exists(styleSetPath)) Infragistics.Win.AppStyling.StyleManager.Load(styleSetPath); }
public static unsafe void Install(PluginHeader *plugin) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); AppDomain.CurrentDomain.AssemblyResolve += (sender, e) => { string[] fields = e.Name.Split(','); string name = fields[0]; string culture = fields[2]; if (name.EndsWith(".resources") && !culture.EndsWith("neutral")) { return(null); } AssemblyName askedassembly = new AssemblyName(e.Name); bool isdll = File.Exists(Path.Combine(RootPath, askedassembly.Name + ".dll")); return(Assembly.LoadFile(Path.Combine(RootPath, askedassembly.Name + (isdll ? ".dll" : ".exe")))); }; SplashScreen.Start(); m_ActiveWnd = SplashScreen.Instance; Client.Init(false); if (!(Client.Instance as ClassicUOClient).Install(plugin)) { Process.GetCurrentProcess().Kill(); return; } // load ultimasdk before or the Language.Load will throw the cliloc not found warning every time you run cuo string clientPath = ((OnGetUOFilePath)Marshal.GetDelegateForFunctionPointer(plugin->GetUOFilePath, typeof(OnGetUOFilePath)) )(); // just replicating the static .ctor Ultima.Files.ReLoadDirectory(); Ultima.Files.LoadMulPath(); Ultima.Files.SetMulPath(clientPath); Ultima.Multis.PostHSFormat = UsePostHSChanges; Client.Instance.ClientEncrypted = false; Client.Instance.ServerEncrypted = false; /* Load localization files */ if (!Language.Load("ENU")) { SplashScreen.End(); MessageBox.Show( "WARNING: Razor was unable to load the file Language/Razor_lang.ENU\n.", "Language Load Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } m_Running = true; Language.LoadCliLoc(); /* Initialize engine */ SplashScreen.Message = LocString.Initializing; Initialize(typeof(Engine).Assembly); /* Load Profile */ SplashScreen.Message = LocString.LoadingLastProfile; Config.LoadCharList(); Overrides.Load(); if (!Config.LoadLastProfile()) { MessageBox.Show( "The selected profile could not be loaded, using default instead.", "Profile Load Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } SplashScreen.Message = LocString.WaitingForClient; SplashScreen.End(); Thread t = new Thread(() => { RunUI(); }); t.SetApartmentState(ApartmentState.STA); t.IsBackground = true; t.Start(); }
private static void ApplyEffectOverrides(Effects.Effect effect, Overrides.XmlBindings.Effect effectOverride, Dictionary<string, QualifiableType> typeDictionary) { effect.Overrides = effectOverride; // Override the effect name? if (effectOverride.ProjectedNameOverride != null) { effect.ClassName = effectOverride.ProjectedNameOverride; } // Override input names? foreach (var inputOverride in effectOverride.Inputs) { var input = effect.Inputs.InputsList.Find(p => p.Name == inputOverride.Name); input.Name = inputOverride.ProjectedNameOverride; } foreach (var propertyOverride in effectOverride.Properties) { var property = effect.Properties.Find(p => p.Name == propertyOverride.Name); if (property != null) { // Override settings of an existing property. if (propertyOverride.ProjectedNameOverride != null) { property.Name = propertyOverride.ProjectedNameOverride; } if (propertyOverride.DefaultValueOverride != null) { var defaultProperty = property.Properties.Single(p => p.Name == "Default"); defaultProperty.Value = propertyOverride.DefaultValueOverride; } property.IsHidden = propertyOverride.IsHidden; property.ConvertRadiansToDegrees = propertyOverride.ConvertRadiansToDegrees; } if (property == null || propertyOverride.IsHandCoded) { // Add a custom property that is part of our API surface but not defined by D2D. effect.Properties.Add(new Effects.Property { Name = propertyOverride.ProjectedNameOverride ?? propertyOverride.Name, TypeNameIdl = string.IsNullOrEmpty(propertyOverride.Type) ? property.TypeNameIdl : propertyOverride.Type, IsHandCoded = true }); // If we are masking a real D2D property with an alternative // hand-coded version, mark the real D2D property as hidden. if (property != null) { property.IsHidden = true; } } } }
public Enum(Namespace parentNamespace, XmlBindings.Enum xmlData, Overrides.XmlBindings.Enum overrides, Dictionary<string, QualifiableType> typeDictionary, OutputDataTypes outputDataTypes) { m_stylizedName = Formatter.Prefix + Formatter.StylizeNameFromUnderscoreSeparators(xmlData.Name); if (parentNamespace != null) { m_rawName = parentNamespace.ApiName + "_" + xmlData.Name; typeDictionary[parentNamespace.RawName + "::" + xmlData.Name] = this; } else { // // Namespace of NULL indicates the global namespace. // These types aren't D2D types, and their full native name is // exactly what's in the name field (no need to prepend anything). // m_rawName = xmlData.Name; typeDictionary[xmlData.Name] = this; } m_isFlags = xmlData.IsFlags; m_enumValues = new List<EnumValue>(); foreach (XmlBindings.EnumValue valueXml in xmlData.EnumValues) { Overrides.XmlBindings.EnumValue overridesEnumValue = null; if (overrides != null) overridesEnumValue = overrides.Values.Find(x => x.Name == valueXml.Name); m_enumValues.Add(new EnumValue(valueXml, overridesEnumValue)); } bool shouldProject = false; if(overrides != null) { shouldProject = overrides.ShouldProject; if(overrides.ProjectedNameOverride != null) { m_stylizedName = Formatter.Prefix + overrides.ProjectedNameOverride; } } // Enums in the global namespace are defined as aliases only. By convention, only enums in a namespace are output. if (parentNamespace != null && shouldProject) { outputDataTypes.AddEnum(this); } }
/// <summary> /// Get the relative path to a file /// </summary> /// <param name="ns">Game namespace</param> /// <param name="platform">Platform folder</param> /// <param name="folder">Platform's folder. Must only have one folder flag set.</param> /// <param name="file">File name</param> /// <param name="ext">File extension</param> /// <param name="overrides">Optional set of overrides to use. Can be null.</param> /// <returns>Relative path to the file</returns> public static string GetRelativePath(Namespace ns, Platform platform, PlatformFolder folder, string file, string ext, Overrides overrides) { return string.Format("{0}{1}.{2}", GetRelativePath(ns, platform, folder, overrides), file, ext); }
/// <summary> /// Checks for what overridden platform folders exist /// </summary> /// <param name="ns">Game namespace</param> /// <param name="platform">Platform folder</param> /// <param name="overrides"></param> /// <returns>Flagged PlatformFolder of all existing folders</returns> public static PlatformFolder CheckPlatformFolders(Namespace ns, Platform platform, Overrides overrides) { return PlatformFolder.AllFolders; // TODO: do me }
/// <summary> /// Create or get the path to a special folder for a platform /// </summary> /// <param name="ns">Game namespace</param> /// <param name="platform">Platform folder</param> /// <param name="folder">Platform's folder. Must only have one folder flag set.</param> /// <param name="overrides">Optional set of overrides to use. Can be null.</param> /// <param name="create">True if we should create the path on disk if it doesn't exist already</param> /// <returns>Path to the folder</returns> public static string CreatePlatformFolder(Namespace ns, Platform platform, PlatformFolder folder, Overrides overrides, bool create) { string dir_path; if (overrides != null && overrides.GetOverride(folder, out dir_path)) { if (create && !Directory.Exists(dir_path)) Directory.CreateDirectory(dir_path); return dir_path; } else return CreatePlatformFolder(ns, platform, folder); }
public static void SetupJamesPurple() { _overrides = Overrides.Purple; Infragistics.Win.AppStyling.StyleManager.Load(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("SI.Controls.InfraStyleSheets.JamesPurple.isl")); }
/// <summary> /// Create or get the path to a file /// </summary> /// <param name="ns">Game namespace</param> /// <param name="platform">Platform folder</param> /// <param name="folder">Platform's folder. Must only have one folder flag set.</param> /// <param name="file">File name</param> /// <param name="ext">File extension</param> /// <param name="overrides">Optional set of overrides to use. Can be null.</param> /// <param name="create">True if we should create the path on disk if it doesn't exist already</param> /// <returns>Path to the file</returns> public static string CreatePlatformFile(Namespace ns, Platform platform, PlatformFolder folder, string file, string ext, Overrides overrides, bool create) { string file_path = string.Format("{0}{1}.{2}", CreatePlatformFolder(ns, platform, folder, overrides), file, ext); if (create && !File.Exists(file_path)) File.Create(file_path).Close(); return file_path; }
public static void ClearLookFeel() { _overrides = null; Infragistics.Win.AppStyling.StyleManager.Reset(); }
public Viewpoint(string name, ViewSettings settings, LayerMask visibleLayers, LayerMask lockedLayers, Overrides overrides = (Overrides)(-1), Action postAction = null) { this.name = name; this.settings = settings; this.visibleLayers = visibleLayers; this.lockedLayers = lockedLayers; this.overrides = overrides; this.postAction = postAction; }
public static void SetupNoirModerneLookFeel() { _overrides = Overrides.Black; Infragistics.Win.AppStyling.StyleManager.Load(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("SI.Controls.InfraStyleSheets.NoirModerne.isl")); }