public BaseBindableField(IBind bind) { if (bind.ValueType != typeof(TValue)) { throw new ArgumentException($"{bind.ValueType} != {typeof(TValue)}"); } _bind = bind; }
public EnumProcessor(IBind generator, string overrides) { if (generator == null) throw new ArgumentNullException("generator"); if (overrides == null) throw new ArgumentNullException("overrides"); Generator = generator; Overrides = overrides; }
public void WriteBindings(IBind generator) { //1. Generator = generator; //2. InitBindings(); //my Extension //3. WriteBindings(generator.Delegates, generator.Wrappers, generator.Enums); }
/// <summary> /// Closes and resets the dialog. /// </summary> private void Exit() { if (Open) { BindManager.BlacklistMode = SeBlacklistModes.None; HudMain.EnableCursor = false; Open = false; CallbackFunc?.Invoke(); CallbackFunc = null; bind = null; } }
/// <summary> /// Tries to register a bind using the given name and the given key combo. /// </summary> public bool TryRegisterBind(string bindName, out IBind bind, IReadOnlyList <string> combo) { string[] uniqueControls = combo?.GetUnique(); IControl[] newCombo = null; bind = null; if (combo == null || TryGetCombo(uniqueControls, out newCombo)) { return(TryRegisterBind(bindName, out bind, newCombo)); } return(false); }
/** * Creates a Bind in a given Model as a blank node. * @param model the Model to create the Bind in * @param variable the Variable to assign * @param expression the expression * @return a new Bind instance */ public static IBind createBind(SpinProcessor model, IVariable variable, INode expression) { IBind bind = (IBind)model.CreateResource(SP.ClassBind).As(typeof(BindImpl)); if (variable != null) { bind.AddProperty(SP.PropertyVariable, variable); } if (expression != null) { bind.AddProperty(SP.PropertyExpression, expression); } return(bind); }
public EnumProcessor(IBind generator, string overrides) { if (generator == null) { throw new ArgumentNullException("generator"); } if (overrides == null) { throw new ArgumentNullException("overrides"); } Generator = generator; Overrides = overrides; }
/// <summary> /// Opens the rebind dialog for the control at the specified position. /// </summary> private void UpdateBindInternal(IBind bind, int bindPos, Action CallbackFunc = null) { BindManager.BlacklistMode = SeBlacklistModes.AllKeys; HudMain.EnableCursor = true; stopwatch.Restart(); Open = true; newControl = null; this.bind = bind; this.CallbackFunc = CallbackFunc; combo = bind.GetCombo(); controlIndex = MathHelper.Clamp(bindPos, 0, combo.Count); }
public static void RegisterSystem(ISystem system, IBind bind, int priority = 0) { Action systemUpdate = system.OnUpdate; /* Unsubscribe method when binding ends */ bind?.Bind(() => { if (system is IDisposableSystem disposable) { disposable.OnStop(); } Scheduler.OnUpdate.Unsubscribe(systemUpdate, true); }); Scheduler.OnUpdate.Subscribe(systemUpdate, priority); }
public DocProcessor(IBind generator) { if (generator == null) throw new ArgumentNullException(); Generator = generator; foreach (string file in Directory.GetFiles(Settings.DocPath).Concat( Directory.GetFiles(Settings.FallbackDocPath))) { var name = Path.GetFileName(file); if (!DocumentationFiles.ContainsKey(name)) { DocumentationFiles.Add(name, file); } } }
private static void UpdateBind(string bindName, string[] controls) { IBind bind = BvBinds.ModifierGroup.GetBind(bindName); if (bind == null) { bind = BvBinds.MainGroup.GetBind(bindName); } if (bind == null) { ExceptionHandler.SendChatMessage("Error: The bind specified could not be found."); } else { bind.TrySetCombo(controls, true, false); } }
public DocProcessor(IBind generator) { if (generator == null) { throw new ArgumentNullException(); } Generator = generator; foreach (string file in Directory.GetFiles(Settings.DocPath).Concat( Directory.GetFiles(Settings.FallbackDocPath))) { var name = Path.GetFileName(file); if (!DocumentationFiles.ContainsKey(name)) { DocumentationFiles.Add(name, file); } } }
private static string GetBindString(IBind bind) { IList <IControl> combo = bind.GetCombo(); string bindString = ""; for (int n = 0; n < combo.Count; n++) { if (n != combo.Count - 1) { bindString += combo[n].DisplayName + " + "; } else { bindString += combo[n].DisplayName; } } return(bindString); }
/// <summary> /// Replaces current bind combos with combos based on the given <see cref="BindDefinition"/>[]. Does not register new binds. /// </summary> public bool TryLoadBindData(IReadOnlyList <BindDefinition> bindData) { List <IControl> oldUsedControls; List <List <IBind> > oldBindMap; bool bindError = false; if (bindData != null && bindData.Count > 0) { oldUsedControls = usedControls; oldBindMap = bindMap; UnregisterControls(); usedControls = new List <IControl>(bindData.Count); bindMap = new List <List <IBind> >(bindData.Count); foreach (BindDefinition bindDef in bindData) { IBind bind = GetBind(bindDef.name); if (bind != null && !bind.TrySetCombo(bindDef.controlNames, false, false)) { bindError = true; break; } } if (bindError) { UnregisterControls(); usedControls = oldUsedControls; bindMap = oldBindMap; ReregisterControls(); } else { return(true); } } return(false); }
/// <summary> /// Returns true if the bind at the given index is pressed. Whether IsPressed, /// IsNewPressed or IsPressedAndHeld is used depends on the enum. /// </summary> private bool IsBindPressed(Vector2I index, int memberEnum) { IBind bind = bindGroups[index.X][index.Y]; switch ((BindAccesssors)memberEnum) { case BindAccesssors.IsPressed: return(bind.IsPressed); case BindAccesssors.IsNewPressed: return(bind.IsNewPressed); case BindAccesssors.IsPressedAndHeld: return(bind.IsPressedAndHeld); case BindAccesssors.IsReleased: return(bind.IsReleased); } return(false); }
/// <summary> /// Tries to register a bind using the given name and the given key combo. /// </summary> public bool TryRegisterBind(string bindName, out IBind newBind, IReadOnlyList <IControl> combo) { newBind = null; if (!DoesBindExist(bindName)) { Bind bind = new Bind(bindName, keyBinds.Count, this); newBind = bind; keyBinds.Add(bind); if (combo != null && combo.Count > 0) { return(bind.TrySetCombo(combo, true, true)); } else { return(true); } } return(false); }
public void WriteBindings(IBind generator) { Generator = generator; WriteBindings(generator.Delegates, generator.Wrappers, generator.Enums); }
public Monad(IApplicative <X, CX, CFX, Y, CY> Applicative, IBind <X, CX, CFX, Y, CY> Bind) { this.Applicative = Applicative; this.Bind = Bind; }
public void WriteBindings(IBind generator) { WriteBindings(generator.Delegates, generator.Wrappers, generator.Enums); }
/// <summary> /// Returns or sets the member associated with the given enum of the bind at the given index . /// </summary> private object GetOrSetBindMember(Vector2I index, object data, int memberEnum) { IBind bind = bindGroups[index.X][index.Y]; switch ((BindAccesssors)memberEnum) { case BindAccesssors.Name: return(bind.Name); case BindAccesssors.Analog: return(bind.Analog); case BindAccesssors.Index: return(bind.Index); case BindAccesssors.IsPressed: return(bind.IsPressed); case BindAccesssors.IsNewPressed: return(bind.IsNewPressed); case BindAccesssors.IsPressedAndHeld: return(bind.IsPressedAndHeld); case BindAccesssors.OnNewPress: { var eventData = (MyTuple <bool, Action>)data; if (eventData.Item1) { bind.NewPressed += eventData.Item2; } else { bind.NewPressed -= eventData.Item2; } break; } case BindAccesssors.OnPressAndHold: { var eventData = (MyTuple <bool, Action>)data; if (eventData.Item1) { bind.PressedAndHeld += eventData.Item2; } else { bind.PressedAndHeld -= eventData.Item2; } break; } case BindAccesssors.OnRelease: { var eventData = (MyTuple <bool, Action>)data; if (eventData.Item1) { bind.Released += eventData.Item2; } else { bind.Released -= eventData.Item2; } break; } case BindAccesssors.GetCombo: return(bind.GetComboIndices()); case BindAccesssors.TrySetComboWithIndices: { var comboData = (MyTuple <IReadOnlyList <int>, bool, bool>)data; return(bind.TrySetCombo(comboData.Item1, comboData.Item2, comboData.Item3)); } case BindAccesssors.TrySetComboWithNames: { var comboData = (MyTuple <IReadOnlyList <string>, bool, bool>)data; return(bind.TrySetCombo(comboData.Item1, comboData.Item2, comboData.Item3)); } case BindAccesssors.ClearCombo: bind.ClearCombo(); break; case BindAccesssors.ClearSubscribers: bind.ClearSubscribers(); break; } return(null); }
/// <summary> /// Constructs a <see cref="IMonad"/> predicated on supplied data /// </summary> /// <param name="apply">A realization of the <see cref="IApply"/> typeclass </param> /// <param name="bind">A realization of the <see cref="IBind"/> typeclass </param> /// <typeparam name="X">The function domain</typeparam> /// <typeparam name="CX">A domain container</typeparam> /// <typeparam name="CFX">A function container</typeparam> /// <typeparam name="CY">A codomain container</typeparam> /// <typeparam name="Y">The function codomain</typeparam> public static IMonad <X, CX, CFX, Y, CY> make <X, CX, CFX, Y, CY>(IApplicative <X, CX, CFX, Y, CY> apply, IBind <X, CX, CFX, Y, CY> bind) where CX : IContainer <X> where CFX : IContainer <Func <X, Y> > where CY : IContainer <Y> => new Monad <X, CX, CFX, Y, CY>(apply, bind);
/// <summary> /// Opens the rebind dialog for the control at the specified position. /// </summary> public static void UpdateBind(IBind bind, int bindPos, Action CallbackFunc = null) => instance.UpdateBindInternal(bind, bindPos, CallbackFunc);
static void Main(string[] arguments) { Debug.Listeners.Clear(); Debug.Listeners.Add(new TextWriterTraceListener(Console.Out)); Debug.AutoFlush = true; Trace.Listeners.Clear(); Trace.Listeners.Add(new TextWriterTraceListener(Console.Out)); Trace.AutoFlush = true; Console.WriteLine("OpenGL binding generator {0} for OpenTK.", System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString()); Console.WriteLine("For comments, bugs and suggestions visit http://opentk.sourceforge.net"); //Console.WriteLine(" - the OpenTK team ;-)"); Console.WriteLine(); try { foreach (string a in arguments) { if (a.StartsWith("--") || a.StartsWith("-") || a.StartsWith("/")) { string[] b = a.Split(new char[] { '-', ':', '=' }, StringSplitOptions.RemoveEmptyEntries); switch (b[0]) { case "?": case "help": ShowHelp(); return; case "in": case "input": Settings.InputPath = b[1]; break; case "out": case "output": Settings.OutputPath = b[1]; break; case "mode": string arg = b[1].ToLower(); mode = arg == "gl" ? GeneratorMode.GL2 : arg == "gl2" ? GeneratorMode.GL2 : arg == "gl3" ? GeneratorMode.GL3 : arg == "wgl" ? GeneratorMode.Wgl : arg == "glu" ? GeneratorMode.Glu : arg == "glx" ? GeneratorMode.Glx : GeneratorMode.Unknown; if (mode == GeneratorMode.Unknown) throw new ArgumentException(String.Format("Mode {0} unknown.", arg)); break; case "namespace": case "ns": Settings.OutputNamespace = b[1]; break; case "class": Settings.OutputClass = b[1]; break; case "gl": Settings.GLClass = b[1]; break; case "legacy": case "o": case "option": Settings.Compatibility |= b[1].ToLower().Contains("tao") ? Settings.Legacy.Tao : Settings.Legacy.None; Settings.Compatibility |= b[1].ToLower().Contains("enums") ? Settings.Legacy.NoAdvancedEnumProcessing : Settings.Legacy.None; Settings.Compatibility |= b[1].ToLower().Contains("safe") ? Settings.Legacy.NoPublicUnsafeFunctions : Settings.Legacy.None; //Settings.Compatibility |= b[1].ToLower().Contains("novoid") ? Settings.Legacy.TurnVoidPointersToIntPtr : Settings.Legacy.None; Settings.Compatibility |= b[1].ToLower().Contains("permutations") ? Settings.Legacy.GenerateAllPermutations : Settings.Legacy.None; Settings.Compatibility |= b[1].ToLower().Contains("enums_in_class") ? Settings.Legacy.NestedEnums : Settings.Legacy.None; break; default: throw new ArgumentException( String.Format("Argument {0} not recognized. Use the '/?' switch for help.", a) ); } } } } catch (NullReferenceException e) { Console.WriteLine("Argument error ({0}). Please use the '-?' switch for help.", e.ToString()); return; } catch (ArgumentException e) { Console.WriteLine("Argument error ({0}). Please use the '-?' switch for help.", e.ToString()); return; } try { long ticks = System.DateTime.Now.Ticks; switch (mode) { case GeneratorMode.GL2: Generator = new Bind.GL2.Generator(); break; case GeneratorMode.Wgl: Generator = new Bind.Wgl.Generator(); break; case GeneratorMode.Glu: Generator = new Bind.Glu.Generator(); break; case GeneratorMode.Glx: Generator = new Bind.Glx.Generator(); break; case GeneratorMode.GL3: throw new NotImplementedException(String.Format("Mode {0} not implemented.", mode)); case GeneratorMode.Unknown: default: Console.WriteLine("Please specify a generator mode (use '-mode:gl2/gl3/glu/wgl/glx])'"); return; } Generator.Process(); ticks = System.DateTime.Now.Ticks - ticks; Console.WriteLine(); Console.WriteLine("Bindings generated in {0} seconds.", ticks / (double)10000000.0); Console.WriteLine(); //Console.WriteLine("Press any key to continue..."); Console.ReadKey(true); } catch (SecurityException e) { Console.WriteLine("Security violation \"{0}\" in method \"{1}\".", e.Message, e.Method); Console.WriteLine("This application does not have permission to take the requested actions."); } catch (NotImplementedException e) { Console.WriteLine(e.Message); Console.WriteLine("The requested functionality is not implemented yet."); } }
/// <summary> /// Tries to register a bind using the given name and the given key combo. public bool TryRegisterBind(string bindName, out IBind newBind) => TryRegisterBind(bindName, null, out newBind);
/// <inheritdoc /> public ITestcontainersBuilder <TDockerContainer> WithMount(string source, string destination) { var mounts = new IBind[] { new Mount(source, destination, AccessMode.ReadWrite) }; return(Build(this, Apply(mounts: mounts))); }
/// <summary> /// Tries to register a bind using the given name and the given key combo. /// </summary> public bool TryRegisterBind(string bindName, out IBind newBind, IReadOnlyList <int> combo) => TryRegisterBind(bindName, out newBind, GetCombo(combo));
static void Main(string[] arguments) { Debug.Listeners.Clear(); Debug.Listeners.Add(new TextWriterTraceListener(Console.Out)); Debug.AutoFlush = true; Trace.Listeners.Clear(); Trace.Listeners.Add(new TextWriterTraceListener(Console.Out)); Trace.AutoFlush = true; Console.WriteLine("OpenGL binding generator {0} for OpenTK.", Assembly.GetExecutingAssembly().GetName().Version.ToString()); Console.WriteLine("For comments, bugs and suggestions visit http://opentk.sourceforge.net"); Console.WriteLine(); string dirName = null; try { var split = new Regex(@"-\w+", RegexOptions.Compiled); foreach (var argument in arguments) { string a = argument.Replace("--", "-").Trim(); var match = split.Match(a); if (match.Success) { string opt = match.Value.Substring(1).Trim(); string val = a.Substring(match.Value.Length + 1).Trim(); switch (opt) { case "?": case "help": ShowHelp(); return; case "in": case "input": Settings.InputPath = val; break; case "out": case "output": Settings.OutputPath = val; break; case "include": Settings.IncludePath = val; break; case "l": case "lang": case "language": { string arg = val.ToLower(); if (arg == "cpp" || arg == "c++" || arg == "c") { Settings.Language = GeneratorLanguage.Cpp; Settings.DefaultOutputPath = "gl"; Settings.DefaultOutputNamespace = "OpenTK"; // Settings.DefaultLanguageTypeMapFile = "cpp.tm"; // Todo: create this file! Settings.EnumsNamespace = ""; Settings.NamespaceSeparator = "::"; Settings.DefaultKeywordEscapeCharacter = "_"; } else if (arg == "java") { Settings.Language = GeneratorLanguage.Java; Settings.DefaultOutputPath = "gl"; Settings.DefaultOutputNamespace = "com.opentk"; Settings.DefaultLanguageTypeMapFile = "java.tm"; Settings.EnumsNamespace = ""; Settings.NamespaceSeparator = "."; Settings.DefaultKeywordEscapeCharacter = "_"; } break; } case "mode": { string[] parts = val.Split(new char[] { '=' }, StringSplitOptions.RemoveEmptyEntries); if (parts.Length < 1) { throw new NotImplementedException(); } dirName = parts.Length > 1 ? parts[1] : ""; SetGeneratorMode(dirName, parts[0]); break; } case "namespace": case "ns": Settings.OutputNamespace = val; break; case "class": Settings.OutputClass = val; break; case "gl": Settings.GLClass = val; break; case "legacy": case "o": case "option": Settings.Compatibility |= val.ToLower() == "tao" ? Settings.Legacy.Tao : Settings.Legacy.None; Settings.Compatibility |= val.ToLower() == "simple_enums" ? Settings.Legacy.NoAdvancedEnumProcessing : Settings.Legacy.None; Settings.Compatibility |= val.ToLower() == "safe" ? Settings.Legacy.NoPublicUnsafeFunctions : Settings.Legacy.None; //Settings.Compatibility |= b[1].ToLower().Contains("novoid") ? Settings.Legacy.TurnVoidPointersToIntPtr : Settings.Legacy.None; Settings.Compatibility |= val.ToLower() == "permutations" ? Settings.Legacy.GenerateAllPermutations : Settings.Legacy.None; Settings.Compatibility |= val.ToLower() == "enums_in_class" ? Settings.Legacy.NestedEnums : Settings.Legacy.None; Settings.Compatibility |= val.ToLower() == "nodocs" ? Settings.Legacy.NoDocumentation : Settings.Legacy.None; Settings.Compatibility |= val.ToLower() == "keep_untyped_enums" ? Settings.Legacy.KeepUntypedEnums : Settings.Legacy.None; break; default: throw new ArgumentException( String.Format("Argument {0} not recognized. Use the '/?' switch for help.", a) ); } } } } catch (NullReferenceException e) { Console.WriteLine("Argument error ({0}). Please use the '-?' switch for help.", e.ToString()); return; } catch (ArgumentException e) { Console.WriteLine("Argument error ({0}). Please use the '-?' switch for help.", e.ToString()); return; } try { long ticks = DateTime.Now.Ticks; switch (mode) { case GeneratorMode.GL3: case GeneratorMode.GL2: Generator = new GL4Generator("OpenGL", dirName); break; case GeneratorMode.ES10: Generator = new ESGenerator("ES10", dirName); break; case GeneratorMode.ES11: Generator = new ESGenerator("ES11", dirName); break; case GeneratorMode.ES20: Generator = new ESGenerator("ES20", dirName); break; case GeneratorMode.ES30: Generator = new ESGenerator("ES30", dirName); break; case GeneratorMode.ES31: Generator = new ESGenerator("ES31", dirName); break; case GeneratorMode.CL10: Generator = new CLGenerator("CL10", dirName); break; case GeneratorMode.Unknown: default: Console.WriteLine("Please specify a generator mode (use '-mode:gl2/gl3/glu/wgl/glx])'"); return; } Generator.Process(); ISpecWriter writer = null; switch (Settings.Language) { case GeneratorLanguage.Cpp: writer = new CppSpecWriter(); break; case GeneratorLanguage.Java: writer = new JavaSpecWriter(); break; case GeneratorLanguage.CSharp: default: writer = new CSharpSpecWriter(); break; } writer.WriteBindings(Generator); ticks = DateTime.Now.Ticks - ticks; Console.WriteLine(); Console.WriteLine("Bindings generated in {0} seconds.", ticks / (double)10000000.0); Console.WriteLine(); if (Debugger.IsAttached) { Console.WriteLine("Press any key to continue..."); Console.ReadKey(true); } } catch (SecurityException e) { Console.WriteLine("Security violation \"{0}\" in method \"{1}\".", e.Message, e.Method); Console.WriteLine("This application does not have permission to take the requested actions."); } catch (NotImplementedException e) { Console.WriteLine(e.Message); Console.WriteLine("The requested functionality is not implemented yet."); } }
static void Main(string[] arguments) { Debug.Listeners.Clear(); Debug.Listeners.Add(new TextWriterTraceListener(Console.Out)); Debug.AutoFlush = true; Trace.Listeners.Clear(); Trace.Listeners.Add(new TextWriterTraceListener(Console.Out)); Trace.AutoFlush = true; Console.WriteLine("OpenGL binding generator {0} for OpenTK.", Assembly.GetExecutingAssembly().GetName().Version.ToString()); Console.WriteLine("For comments, bugs and suggestions visit http://opentk.sourceforge.net"); Console.WriteLine(); string dirName = null; try { foreach (string a in arguments) { if (a.StartsWith("--") || a.StartsWith("-") || a.StartsWith("/")) { string[] b = a.Split(new char[] { '-', '/', ':', '=' }, StringSplitOptions.RemoveEmptyEntries); switch (b[0]) { case "?": case "help": ShowHelp(); return; case "in": case "input": Settings.InputPath = string.Join(Path.DirectorySeparatorChar.ToString(), b.Skip(1).ToArray()); break; case "out": case "output": Settings.OutputPath = string.Join(Path.DirectorySeparatorChar.ToString(), b.Skip(1).ToArray()); break; case "mode": string arg = b[1].ToLower(); if (arg == "gl" || arg == "gl2") { mode = GeneratorMode.GL2; } else if (arg == "es10") { mode = GeneratorMode.ES10; } else if (arg == "es11") { mode = GeneratorMode.ES11; } else if (arg == "es20") { mode = GeneratorMode.ES20; } else if (arg == "cl" || arg == "cl10") { mode = GeneratorMode.CL10; } else { throw new NotImplementedException(); } if (b.Length > 2) { dirName = b[2]; } break; case "namespace": case "ns": Settings.OutputNamespace = b[1]; break; case "class": Settings.OutputClass = b[1]; break; case "gl": Settings.GLClass = b[1]; break; case "legacy": case "o": case "option": Settings.Compatibility |= b[1].ToLower() == "tao" ? Settings.Legacy.Tao : Settings.Legacy.None; Settings.Compatibility |= b[1].ToLower() == "simple_enums" ? Settings.Legacy.NoAdvancedEnumProcessing : Settings.Legacy.None; Settings.Compatibility |= b[1].ToLower() == "safe" ? Settings.Legacy.NoPublicUnsafeFunctions : Settings.Legacy.None; //Settings.Compatibility |= b[1].ToLower().Contains("novoid") ? Settings.Legacy.TurnVoidPointersToIntPtr : Settings.Legacy.None; Settings.Compatibility |= b[1].ToLower() == "permutations" ? Settings.Legacy.GenerateAllPermutations : Settings.Legacy.None; Settings.Compatibility |= b[1].ToLower() == "enums_in_class" ? Settings.Legacy.NestedEnums : Settings.Legacy.None; Settings.Compatibility |= b[1].ToLower() == "nodocs" ? Settings.Legacy.NoDocumentation : Settings.Legacy.None; Settings.Compatibility |= b[1].ToLower() == "keep_untyped_enums" ? Settings.Legacy.KeepUntypedEnums : Settings.Legacy.None; break; default: throw new ArgumentException( String.Format("Argument {0} not recognized. Use the '/?' switch for help.", a) ); } } } } catch (NullReferenceException e) { Console.WriteLine("Argument error ({0}). Please use the '-?' switch for help.", e.ToString()); return; } catch (ArgumentException e) { Console.WriteLine("Argument error ({0}). Please use the '-?' switch for help.", e.ToString()); return; } try { long ticks = DateTime.Now.Ticks; switch (mode) { case GeneratorMode.GL2: Generator = new Generator(); break; case GeneratorMode.ES10: Generator = new ESGenerator("ES10", dirName); break; case GeneratorMode.ES11: Generator = new ESGenerator("ES11", dirName); break; case GeneratorMode.ES20: Generator = new ESGenerator("ES20", dirName); break; case GeneratorMode.CL10: Generator = new CLGenerator("CL10", dirName); break; case GeneratorMode.Wgl: Generator = new Wgl.Generator(); break; case GeneratorMode.Glu: Generator = new Glu.Generator(); break; case GeneratorMode.Glx: Generator = new Glx.Generator(); break; case GeneratorMode.GL3: throw new NotImplementedException(String.Format("Mode {0} not implemented.", mode)); case GeneratorMode.Unknown: default: Console.WriteLine("Please specify a generator mode (use '-mode:gl2/gl3/glu/wgl/glx])'"); return; } Generator.Process(); ticks = DateTime.Now.Ticks - ticks; Console.WriteLine(); Console.WriteLine("Bindings generated in {0} seconds.", ticks / (double)10000000.0); Console.WriteLine(); } catch (SecurityException e) { Console.WriteLine("Security violation \"{0}\" in method \"{1}\".", e.Message, e.Method); Console.WriteLine("This application does not have permission to take the requested actions."); } catch (NotImplementedException e) { Console.WriteLine(e.Message); Console.WriteLine("The requested functionality is not implemented yet."); } }
public void Reset() { bindName.TextBoard.Clear(); bind = null; group = null; }
static void Main(string[] arguments) { Debug.Listeners.Clear(); Debug.Listeners.Add(new TextWriterTraceListener(Console.Out)); Debug.AutoFlush = true; Trace.Listeners.Clear(); Trace.Listeners.Add(new TextWriterTraceListener(Console.Out)); Trace.AutoFlush = true; Console.WriteLine("OpenGL binding generator {0} for OpenTK.", Assembly.GetExecutingAssembly().GetName().Version.ToString()); Console.WriteLine("For comments, bugs and suggestions visit http://opentk.sourceforge.net"); Console.WriteLine(); string dirName = null; try { foreach (string a in arguments) { if (a.StartsWith("--") || a.StartsWith("-") || a.StartsWith("/")) { string[] b = a.Split(new char[] { '-', '/', ':', '=' }, StringSplitOptions.RemoveEmptyEntries); switch (b[0]) { case "?": case "help": ShowHelp(); return; case "in": case "input": Settings.InputPath = string.Join(Path.DirectorySeparatorChar.ToString(), b.Skip(1).ToArray()); break; case "out": case "output": Settings.OutputPath = string.Join(Path.DirectorySeparatorChar.ToString(), b.Skip(1).ToArray()); break; case "mode": string arg = b[1].ToLower(); if (arg == "gl" || arg == "gl2") mode = GeneratorMode.GL2; else if (arg == "es10") mode = GeneratorMode.ES10; else if (arg == "es11") mode = GeneratorMode.ES11; else if (arg == "es20") mode = GeneratorMode.ES20; else if (arg=="cl" || arg == "cl10") mode = GeneratorMode.CL10; else throw new NotImplementedException(); if (b.Length > 2) dirName = b[2]; break; case "namespace": case "ns": Settings.OutputNamespace = b[1]; break; case "class": Settings.OutputClass = b[1]; break; case "gl": Settings.GLClass = b[1]; break; case "legacy": case "o": case "option": Settings.Compatibility |= b[1].ToLower() == "tao" ? Settings.Legacy.Tao : Settings.Legacy.None; Settings.Compatibility |= b[1].ToLower() == "simple_enums" ? Settings.Legacy.NoAdvancedEnumProcessing : Settings.Legacy.None; Settings.Compatibility |= b[1].ToLower() == "safe" ? Settings.Legacy.NoPublicUnsafeFunctions : Settings.Legacy.None; //Settings.Compatibility |= b[1].ToLower().Contains("novoid") ? Settings.Legacy.TurnVoidPointersToIntPtr : Settings.Legacy.None; Settings.Compatibility |= b[1].ToLower() == "permutations" ? Settings.Legacy.GenerateAllPermutations : Settings.Legacy.None; Settings.Compatibility |= b[1].ToLower() == "enums_in_class" ? Settings.Legacy.NestedEnums : Settings.Legacy.None; Settings.Compatibility |= b[1].ToLower() == "nodocs" ? Settings.Legacy.NoDocumentation : Settings.Legacy.None; Settings.Compatibility |= b[1].ToLower() == "keep_untyped_enums" ? Settings.Legacy.KeepUntypedEnums : Settings.Legacy.None; break; default: throw new ArgumentException( String.Format("Argument {0} not recognized. Use the '/?' switch for help.", a) ); } } } } catch (NullReferenceException e) { Console.WriteLine("Argument error ({0}). Please use the '-?' switch for help.", e.ToString()); return; } catch (ArgumentException e) { Console.WriteLine("Argument error ({0}). Please use the '-?' switch for help.", e.ToString()); return; } try { long ticks = DateTime.Now.Ticks; switch (mode) { case GeneratorMode.GL2: Generator = new Generator(); break; case GeneratorMode.ES10: Generator = new ESGenerator("ES10", dirName); break; case GeneratorMode.ES11: Generator = new ESGenerator("ES11", dirName); break; case GeneratorMode.ES20: Generator = new ESGenerator("ES20", dirName); break; case GeneratorMode.CL10: Generator = new CLGenerator("CL10", dirName); break; case GeneratorMode.Wgl: Generator = new Wgl.Generator(); break; case GeneratorMode.Glu: Generator = new Glu.Generator(); break; case GeneratorMode.Glx: Generator = new Glx.Generator(); break; case GeneratorMode.GL3: throw new NotImplementedException(String.Format("Mode {0} not implemented.", mode)); case GeneratorMode.Unknown: default: Console.WriteLine("Please specify a generator mode (use '-mode:gl2/gl3/glu/wgl/glx])'"); return; } Generator.Process(); ticks = DateTime.Now.Ticks - ticks; Console.WriteLine(); Console.WriteLine("Bindings generated in {0} seconds.", ticks / (double)10000000.0); Console.WriteLine(); } catch (SecurityException e) { Console.WriteLine("Security violation \"{0}\" in method \"{1}\".", e.Message, e.Method); Console.WriteLine("This application does not have permission to take the requested actions."); } catch (NotImplementedException e) { Console.WriteLine(e.Message); Console.WriteLine("The requested functionality is not implemented yet."); } }
public void SetBind(IBind bind, IBindGroup group) { this.bind = bind; this.group = group; UpdateBindText(); }
/// <summary> /// Returns true if the given list of controls conflicts with any existing binds. /// </summary> public bool DoesComboConflict(IReadOnlyList <IControl> newCombo, IBind exception = null) => DoesComboConflict(BindManager.GetComboIndices(newCombo), (exception != null) ? exception.Index : -1);
static void Main(string[] arguments) { Debug.Listeners.Clear(); Debug.Listeners.Add(new TextWriterTraceListener(Console.Out)); Debug.AutoFlush = true; Trace.Listeners.Clear(); Trace.Listeners.Add(new TextWriterTraceListener(Console.Out)); Trace.AutoFlush = true; Console.WriteLine("OpenGL binding generator {0} for OpenTK.", Assembly.GetExecutingAssembly().GetName().Version.ToString()); Console.WriteLine("For comments, bugs and suggestions visit http://opentk.sourceforge.net"); Console.WriteLine(); string dirName = null; try { var split = new Regex(@"-\w+", RegexOptions.Compiled); foreach (var argument in arguments) { string a = argument.Replace("--", "-").Trim(); var match = split.Match(a); if (match.Success) { string opt = match.Value.Substring(1).Trim(); string val = a.Substring(match.Value.Length + 1).Trim(); switch (opt) { case "?": case "help": ShowHelp(); return; case "in": case "input": Settings.InputPath = val; break; case "out": case "output": Settings.OutputPath = val; break; case "include": Settings.IncludePath = val; break; case "l": case "lang": case "language": { string arg = val.ToLower(); if (arg == "cpp" || arg == "c++" || arg == "c") { Settings.Language = GeneratorLanguage.Cpp; Settings.DefaultOutputPath = "gl"; Settings.DefaultOutputNamespace = "OpenTK"; // Settings.DefaultLanguageTypeMapFile = "cpp.tm"; // Todo: create this file! Settings.EnumsNamespace = ""; Settings.NamespaceSeparator = "::"; Settings.DefaultKeywordEscapeCharacter = "_"; } else if (arg == "java") { Settings.Language = GeneratorLanguage.Java; Settings.DefaultOutputPath = "gl"; Settings.DefaultOutputNamespace = "com.opentk"; Settings.DefaultLanguageTypeMapFile = "java.tm"; Settings.EnumsNamespace = ""; Settings.NamespaceSeparator = "."; Settings.DefaultKeywordEscapeCharacter = "_"; } break; } case "mode": { string[] parts = val.Split(new char[] { '=' }, StringSplitOptions.RemoveEmptyEntries); if (parts.Length < 1) throw new NotImplementedException(); dirName = parts.Length > 1 ? parts[1] : ""; SetGeneratorMode(dirName, parts[0]); break; } case "namespace": case "ns": Settings.OutputNamespace = val; break; case "class": Settings.OutputClass = val; break; case "gl": Settings.GLClass = val; break; case "legacy": case "o": case "option": Settings.Compatibility |= val.ToLower() == "tao" ? Settings.Legacy.Tao : Settings.Legacy.None; Settings.Compatibility |= val.ToLower() == "simple_enums" ? Settings.Legacy.NoAdvancedEnumProcessing : Settings.Legacy.None; Settings.Compatibility |= val.ToLower() == "safe" ? Settings.Legacy.NoPublicUnsafeFunctions : Settings.Legacy.None; //Settings.Compatibility |= b[1].ToLower().Contains("novoid") ? Settings.Legacy.TurnVoidPointersToIntPtr : Settings.Legacy.None; Settings.Compatibility |= val.ToLower() == "permutations" ? Settings.Legacy.GenerateAllPermutations : Settings.Legacy.None; Settings.Compatibility |= val.ToLower() == "enums_in_class" ? Settings.Legacy.NestedEnums : Settings.Legacy.None; Settings.Compatibility |= val.ToLower() == "nodocs" ? Settings.Legacy.NoDocumentation : Settings.Legacy.None; Settings.Compatibility |= val.ToLower() == "keep_untyped_enums" ? Settings.Legacy.KeepUntypedEnums : Settings.Legacy.None; break; default: throw new ArgumentException( String.Format("Argument {0} not recognized. Use the '/?' switch for help.", a) ); } } } } catch (NullReferenceException e) { Console.WriteLine("Argument error ({0}). Please use the '-?' switch for help.", e.ToString()); return; } catch (ArgumentException e) { Console.WriteLine("Argument error ({0}). Please use the '-?' switch for help.", e.ToString()); return; } try { long ticks = DateTime.Now.Ticks; switch (mode) { case GeneratorMode.GL3: case GeneratorMode.GL2: Generator = new GL4Generator("OpenGL", dirName); break; case GeneratorMode.ES10: Generator = new ESGenerator("ES10", dirName); break; case GeneratorMode.ES11: Generator = new ESGenerator("ES11", dirName); break; case GeneratorMode.ES20: Generator = new ESGenerator("ES20", dirName); break; case GeneratorMode.ES30: Generator = new ESGenerator("ES30", dirName); break; case GeneratorMode.ES31: Generator = new ESGenerator("ES31", dirName); break; case GeneratorMode.CL10: Generator = new CLGenerator("CL10", dirName); break; case GeneratorMode.Unknown: default: Console.WriteLine("Please specify a generator mode (use '-mode:gl2/gl3/glu/wgl/glx])'"); return; } Generator.Process(); ISpecWriter writer = null; switch (Settings.Language) { case GeneratorLanguage.Cpp: writer = new CppSpecWriter(); break; case GeneratorLanguage.Java: writer = new JavaSpecWriter(); break; case GeneratorLanguage.CSharp: default: writer = new CSharpSpecWriter(); break; } writer.WriteBindings(Generator); ticks = DateTime.Now.Ticks - ticks; Console.WriteLine(); Console.WriteLine("Bindings generated in {0} seconds.", ticks / (double)10000000.0); Console.WriteLine(); if (Debugger.IsAttached) { Console.WriteLine("Press any key to continue..."); Console.ReadKey(true); } } catch (SecurityException e) { Console.WriteLine("Security violation \"{0}\" in method \"{1}\".", e.Message, e.Method); Console.WriteLine("This application does not have permission to take the requested actions."); } catch (NotImplementedException e) { Console.WriteLine(e.Message); Console.WriteLine("The requested functionality is not implemented yet."); } }
static void Main(string[] arguments) { Debug.Listeners.Clear(); Debug.Listeners.Add(new TextWriterTraceListener(Console.Out)); Debug.AutoFlush = true; Trace.Listeners.Clear(); Trace.Listeners.Add(new TextWriterTraceListener(Console.Out)); Trace.AutoFlush = true; Console.WriteLine("OpenGL binding generator {0} for OpenTK.", System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString()); Console.WriteLine("For comments, bugs and suggestions visit http://opentk.sourceforge.net"); //Console.WriteLine(" - the OpenTK team ;-)"); Console.WriteLine(); try { foreach (string a in arguments) { if (a.StartsWith("--") || a.StartsWith("-") || a.StartsWith("/")) { string[] b = a.Split(new char[] { '-', ':', '=' }, StringSplitOptions.RemoveEmptyEntries); switch (b[0]) { case "?": case "help": ShowHelp(); return; case "in": case "input": Settings.InputPath = b[1]; break; case "out": case "output": Settings.OutputPath = b[1]; break; case "mode": string arg = b[1].ToLower(); mode = arg == "gl" ? GeneratorMode.GL2 : arg == "gl2" ? GeneratorMode.GL2 : arg == "gl3" ? GeneratorMode.GL3 : arg == "wgl" ? GeneratorMode.Wgl : arg == "glu" ? GeneratorMode.Glu : arg == "glx" ? GeneratorMode.Glx : GeneratorMode.Unknown; if (mode == GeneratorMode.Unknown) { throw new ArgumentException(String.Format("Mode {0} unknown.", arg)); } break; case "namespace": case "ns": Settings.OutputNamespace = b[1]; break; case "class": Settings.OutputClass = b[1]; break; case "gl": Settings.GLClass = b[1]; break; case "legacy": case "o": case "option": Settings.Compatibility |= b[1].ToLower().Contains("tao") ? Settings.Legacy.Tao : Settings.Legacy.None; Settings.Compatibility |= b[1].ToLower().Contains("enums") ? Settings.Legacy.NoAdvancedEnumProcessing : Settings.Legacy.None; Settings.Compatibility |= b[1].ToLower().Contains("safe") ? Settings.Legacy.NoPublicUnsafeFunctions : Settings.Legacy.None; //Settings.Compatibility |= b[1].ToLower().Contains("novoid") ? Settings.Legacy.TurnVoidPointersToIntPtr : Settings.Legacy.None; Settings.Compatibility |= b[1].ToLower().Contains("permutations") ? Settings.Legacy.GenerateAllPermutations : Settings.Legacy.None; Settings.Compatibility |= b[1].ToLower().Contains("enums_in_class") ? Settings.Legacy.NestedEnums : Settings.Legacy.None; break; default: throw new ArgumentException( String.Format("Argument {0} not recognized. Use the '/?' switch for help.", a) ); } } } } catch (NullReferenceException e) { Console.WriteLine("Argument error ({0}). Please use the '-?' switch for help.", e.ToString()); return; } catch (ArgumentException e) { Console.WriteLine("Argument error ({0}). Please use the '-?' switch for help.", e.ToString()); return; } try { long ticks = System.DateTime.Now.Ticks; switch (mode) { case GeneratorMode.GL2: Generator = new Bind.GL2.Generator(); break; case GeneratorMode.Wgl: Generator = new Bind.Wgl.Generator(); break; case GeneratorMode.Glu: Generator = new Bind.Glu.Generator(); break; case GeneratorMode.Glx: Generator = new Bind.Glx.Generator(); break; case GeneratorMode.GL3: throw new NotImplementedException(String.Format("Mode {0} not implemented.", mode)); case GeneratorMode.Unknown: default: Console.WriteLine("Please specify a generator mode (use '-mode:gl2/gl3/glu/wgl/glx])'"); return; } Generator.Process(); ticks = System.DateTime.Now.Ticks - ticks; Console.WriteLine(); Console.WriteLine("Bindings generated in {0} seconds.", ticks / (double)10000000.0); Console.WriteLine(); //Console.WriteLine("Press any key to continue..."); Console.ReadKey(true); } catch (SecurityException e) { Console.WriteLine("Security violation \"{0}\" in method \"{1}\".", e.Message, e.Method); Console.WriteLine("This application does not have permission to take the requested actions."); } catch (NotImplementedException e) { Console.WriteLine(e.Message); Console.WriteLine("The requested functionality is not implemented yet."); } }