private static int ParseEnumOptions(EnumOptions opts) { if (!opts.Match.HasValue) { foreach (var entry in DriverStoreEntry.Entries) { Console.WriteLine($"{entry}\n"); } return(0); } try { foreach (var item in opts.Items) { foreach (var entry in DriverStoreEntry.Entries.Where(p => p.GetType().GetProperty(opts.Match.ToString()).GetValue(p, null).Equals(item))) { Console.WriteLine($"{entry}\n"); } } } catch (ArgumentException ae) { Console.WriteLine($"Error: {ae.Message}"); return(1); } return(0); }
public void SelectOption(int value) { //Loop through the values. for (int i = 0; i < EnumOptions.Count; i++) { //If the enum option value is this value if (EnumOptions[i].Value == value) { //Select it. cmbxSelections.SelectedIndex = i; //Return out of this function return; } } //Otherwise add the new read value mEnumOption enumOption = new mEnumOption(); //Set the name enumOption.Name = "<unknown>(" + value + ")"; //Set the value enumOption.Value = value; //Add it to the list EnumOptions.Add(enumOption); //Add it to the comboBox cmbxSelections.Items.Add(enumOption.Name); //Select it cmbxSelections.SelectedIndex = cmbxSelections.Items.Count - 1; }
public SerializationContext() { DateTimeOptions = new DateTimeOptions(); EnumOptions = new EnumOptions(); ArrayOptions = new ArrayOptions(); MapOptions = new MapOptions(); JsonOptions = new JsonOptions(); TypeHandlers = new TypeHandlers(this); }
internal EnumIdListImpl(EnumOptions opts, IEnumerable ie) { if (ie == null) { ienum = new ArrayList(0).GetEnumerator(); } else { IEnumerator ienum = ie.GetEnumerator(); this.ienum = ienum == null ? new ArrayList(0).GetEnumerator() : ienum; } this.opts = opts; done = !MoveNext(); }
public void SelectOption(int value) { for (int i = 0; i < EnumOptions.Count; i++) { if (EnumOptions[i].Value == value) { cmbxOptions.SelectedIndex = i; return; } } mEnumOption item = new mEnumOption { Name = "<unknown>(" + value + ")", Value = value }; EnumOptions.Add(item); cmbxOptions.Items.Add(item.Name); cmbxOptions.SelectedIndex = cmbxOptions.Items.Count - 1; }
Dictionary <string, string> DumpOptions(FileDescriptorProto source, EnumOptions options) { var optionsKv = new Dictionary <string, string>(); if (options == null) { return(optionsKv); } if (options.allow_aliasSpecified) { optionsKv.Add("allow_alias", options.allow_alias ? "true" : "false"); } if (options.deprecatedSpecified) { optionsKv.Add("deprecated", options.deprecated ? "true" : "false"); } DumpOptionsMatching(source, ".google.protobuf.EnumOptions", options, optionsKv); return(optionsKv); }
public void Options(EnumOptions Option) { switch (Option) { case EnumOptions.Insert: { InsertUserMenu(); break; } case EnumOptions.GetAll: { GetAllUserMenu(); break; } case EnumOptions.Delete: { DeleteUserMenu(); break; } case EnumOptions.Update: { UpdateUserMenu(); break; } default: break; } }
/// <summary>Helper: create a new instance to deserializing into</summary> public static EnumOptions DeserializeLength(Stream stream, int length) { EnumOptions instance = new EnumOptions(); DeserializeLength(stream, length, instance); return instance; }
/// <summary>Helper: put the buffer into a MemoryStream and create a new instance to deserializing into</summary> public static EnumOptions Deserialize(byte[] buffer) { EnumOptions instance = new EnumOptions(); using (var ms = new MemoryStream(buffer)) Deserialize(ms, instance); return instance; }
/// <summary>Helper: create a new instance to deserializing into</summary> public static EnumOptions Deserialize(Stream stream) { EnumOptions instance = new EnumOptions(); Deserialize(stream, instance); return instance; }
/// <summary>Helper: Serialize into a MemoryStream and return its byte array</summary> public static byte[] SerializeToBytes(EnumOptions instance) { using (var ms = new MemoryStream()) { Serialize(ms, instance); return ms.ToArray(); } }
/// <summary>Helper: Serialize with a varint length prefix</summary> public static void SerializeLengthDelimited(Stream stream, EnumOptions instance) { var data = SerializeToBytes(instance); global::SilentOrbit.ProtocolBuffers.ProtocolParser.WriteUInt32(stream, (uint)data.Length); stream.Write(data, 0, data.Length); }
/// <summary>Serialize the instance into the stream</summary> public static void Serialize(Stream stream, EnumOptions instance) { // Key for field: 2, Varint stream.WriteByte(16); global::SilentOrbit.ProtocolBuffers.ProtocolParser.WriteBool(stream, instance.AllowAlias); if (instance.UninterpretedOption != null) { foreach (var i999 in instance.UninterpretedOption) { // Key for field: 999, LengthDelimited stream.Write(new byte[]{186, 62}, 0, 2); using (var ms999 = new MemoryStream()) { Google.protobuf.UninterpretedOption.Serialize(ms999, i999); // Length delimited byte array uint ms999Length = (uint)ms999.Length; global::SilentOrbit.ProtocolBuffers.ProtocolParser.WriteUInt32(stream, ms999Length); stream.Write(ms999.GetBuffer(), 0, (int)ms999Length); } } } }
/// <summary>Helper: create a new instance to deserializing into</summary> public static EnumOptions DeserializeLengthDelimited(Stream stream) { EnumOptions instance = new EnumOptions(); DeserializeLengthDelimited(stream, instance); return instance; }
/// <summary>Serialize the instance into the stream</summary> public static void Serialize(Stream stream, EnumOptions instance) { var msField = global::SilentOrbit.ProtocolBuffers.ProtocolParser.Stack.Pop(); // Key for field: 2, Varint stream.WriteByte(16); global::SilentOrbit.ProtocolBuffers.ProtocolParser.WriteBool(stream, instance.AllowAlias); if (instance.UninterpretedOption != null) { foreach (var i999 in instance.UninterpretedOption) { // Key for field: 999, LengthDelimited stream.WriteByte(186); stream.WriteByte(62); msField.SetLength(0); Google.Protobuf.UninterpretedOption.Serialize(msField, i999); // Length delimited byte array uint length999 = (uint)msField.Length; global::SilentOrbit.ProtocolBuffers.ProtocolParser.WriteUInt32(stream, length999); msField.WriteTo(stream); } } global::SilentOrbit.ProtocolBuffers.ProtocolParser.Stack.Push(msField); }
public FilterEditViewModel() { AvailableFilterTypes = EnumOptions.AllDataFilterTypes().Select(SelectorItemForEnum).ToList(); }
/// <summary> /// Constructor /// </summary> /// <param name="enumOption"></param> public RelationalModelComparator(EnumOptions enumOption) { _enumOption = enumOption; }
public EnumConversionExtension(EnumOptions options) { this.opts = options; }
public DisplayFormatViewModel() { AvailableFilterTypes = EnumOptions.AllDisplayFormatTypes().Select(SelectorItemForEnum).ToList(); }