public MResultModel GetAllSex() { List <EnumModel> listM = EnumManager.GetAllEnum(typeof(SexEnum)); return(MResultModel <List <EnumModel> > .GetSuccessResultM(listM, "查询成功")); }
public MResultModel GetAllPermissionsType() { List <EnumModel> listM = EnumManager.GetAllEnum(typeof(PermissionsTypesEnum)); return(MResultModel <List <EnumModel> > .GetSuccessResultM(listM, "查询成功")); }
private void FillEnum(IEnumerable <string> fields) { var entries = Enumerable.Repeat(TOPIC, 1).Concat(fields); EnumManager.UpdateEnum(EnumName, entries.First(), entries.ToArray()); }
private bool UpdateDevice() { FilterInfoCollection videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice); // update devices List <string> deviceName = videoDevices.Cast <FilterInfo>().Select(x => x.Name).ToList(); EnumManager.UpdateEnum(enumDevice, FInDevice[0].Name, deviceName.Count > 0 ? deviceName.ToArray() : new string[] { "None" }); List <string> videoFormatName = new List <string>(); List <string> resolutionName = new List <string>(); List <string> framerateName = new List <string>(); bool valid = false; FilterInfo filterInfo = videoDevices.Cast <FilterInfo>().ToList().Find(x => x.Name.Equals(FInDevice[0].Name)); if (filterInfo != null) { videoSource = new VideoCaptureDevice(filterInfo.MonikerString); // update formats videoFormatName = videoSource.VideoCapabilities.Select(x => x.MediaType).Distinct().ToList(); //videoFormatName.Insert(0, "Default"); List <VideoCapabilities> videoModeInfo = videoSource.VideoCapabilities.ToList().FindAll(y => y.MediaType.Equals(FInputs[0].IOObject[0].Name)).ToList(); if (videoModeInfo.Count > 0) { // update resolutions List <KeyValuePair <Tuple <int, int>, string> > resolution = videoModeInfo.Select(x => new KeyValuePair <Tuple <int, int>, string>(new Tuple <int, int>(x.FrameSize.Width, x.FrameSize.Height), x.FrameSize.Width + "x" + x.FrameSize.Height)).ToList(); resolutionName = resolution.Distinct().OrderBy(x => x.Key).Reverse().ToList().Select(x => x.Value).ToList(); //resolutionName.Insert(0, "Default"); List <int> framerate = new List <int>(); videoModeInfo = videoModeInfo.FindAll(x => (x.FrameSize.Width + "x" + x.FrameSize.Height).Equals(FInputs[1].IOObject[0].Name)); if (videoModeInfo.Count > 0) { int res = 0; int.TryParse(FInputs[2].IOObject[0].Name, out res); videoModeInfo.ForEach(delegate(VideoCapabilities vcap) { // forming fps int fps = vcap.MinimumFrameRate; int fpsMax = vcap.MaximumFrameRate; while (fps <= fpsMax) // step by 5 fps { if (!framerate.Contains(fps)) { framerate.Add(fps); } if (fps == fpsMax) { break; } if (fps % 5 != 0) { fps = 5 * (int)Math.Ceiling(((double)fps) / 5.0); // starting from 5 } else { fps += 5; } if (fps > fpsMax) { fps = fpsMax; } } if (framerate.Contains(res)) { videoSource.VideoResolution = vcap; videoSource.Framerate = res; valid = true; } }); framerate.Sort(); framerate.Reverse(); framerateName = framerate.ConvertAll(x => x.ToString()).ToList(); //framerateName.Insert(0, "Default"); } } } EnumManager.UpdateEnum(enumVideoFormat, FInputs[0].IOObject[0].Name, videoFormatName.Count > 0 ? videoFormatName.ToArray() : new string[] { "Default" }); EnumManager.UpdateEnum(enumResolution, FInputs[1].IOObject[0].Name, resolutionName.Count > 0 ? resolutionName.ToArray() : new string[] { "Default" }); EnumManager.UpdateEnum(enumFramerate, FInputs[2].IOObject[0].Name, framerateName.Count > 0 ? framerateName.ToArray() : new string[] { "Default" }); return(valid); }
public HttpRequestNode() { var s = new[] { "Ansi", "Ascii", "UTF8", "UTF32", "Unicode" }; EnumManager.UpdateEnum("HttpEncoding", "Ansi", s); }
public ModifyProduct() { this.InitializeComponent(); Status.ItemsSource = EnumManager.GetEnumList <GeneralStatusEnum>(); }
private void UpdateParticleSystemEnum() { EnumManager.UpdateEnum(ParticleSystemRegistry.PARTICLESYSTEM_ENUM, "", this.Keys.ToArray()); }
//called when data for any output pin is requested public void Evaluate(int SpreadMax) { if (FContextChanged) { if (FContextIn.PluginIO.IsConnected) { if (FContextIn[0] != null) { try { FGestureGenerator = new GestureGenerator(FContextIn[0]); FGestureGenerator.GestureRecognized += FGesture_GestureRecognized; FGestureGenerator.GestureProgress += FGesture_GestureProgress; //Write all possible gestures to the Output Pin var gestures = FGestureGenerator.EnumerateAllGestures(); EnumManager.UpdateEnum("OpenNIGestures", gestures[0], gestures); FGestureGenerator.StartGenerating(); FContextChanged = false; } catch (Exception ex) { FLogger.Log(ex); } } } else { CleanUp(); FContextChanged = false; } } if (FActiveGestureIn.IsChanged) { FUpdateGestures = true; } if (FGestureGenerator != null) { if (FEnabledIn.IsChanged) { if (FEnabledIn[0]) { FGestureGenerator.StartGenerating(); } else { FGestureGenerator.StopGenerating(); } } if (FGestureGenerator.IsDataNew) { //Check the Incomming gestures and try to add them to the Gesture generator if (FUpdateGestures) { //first remove all active gestures string[] ActiveGesture = FGestureGenerator.GetAllActiveGestures(); if (ActiveGesture.Length > 0) { foreach (string Gesture in ActiveGesture) { try { FGestureGenerator.RemoveGesture(Gesture); } catch (StatusException ex) { FLogger.Log(LogType.Error, String.Format("Cannot Remove Gesture: {0}", Gesture)); FLogger.Log(LogType.Message, ex.Message); } } } //add all gestures to the Gesture Generator foreach (var gesture in FActiveGestureIn) { try { FGestureGenerator.AddGesture(gesture.Name); } catch (StatusException ex) { FLogger.Log(LogType.Error, String.Format("Cannot Add Gesture: {0}", gesture)); FLogger.Log(LogType.Message, ex.Message); } } FUpdateGestures = false; } // Handle the Output Pins FGesturesRegOut.SliceCount = FGestureRecognized.Count; FGesturePositionOut.SliceCount = FGestureRecognized.Count; int Slice = 0; // Write the received Gestures with their endposition to the output foreach (KeyValuePair <Vector3D, string> item in FGestureRecognized) { FGesturesRegOut[Slice] = item.Value; FGesturePositionOut[Slice] = item.Key / 1000; Slice++; } FGestureRecognized.Clear(); } } else { FGesturesRegOut.SliceCount = 0; FGesturePositionOut.SliceCount = 0; } }
public void EnumManager_Should_Return_False_When_Parsing_Unknown_Strings() { SmallEnum parsedValue; Assert.IsFalse(EnumManager <SmallEnum> .TryParse("garbageValue", out parsedValue), "Parsing did not fail for garbage string"); }
public JsonResult ClassTypeDDL() { return(Json(EnumManager.GetEnumCollection(typeof(ClassType)), JsonRequestBehavior.AllowGet)); }
public void Evaluate(int SpreadMax) { if (FInRefresh[0] || FInFlags.IsChanged || firstRun) { firstRun = false; FOutStatus.SliceCount = 1; try { _BMDVideoOutputFlags flags = _BMDVideoOutputFlags.bmdVideoOutputFlagDefault; for (int i = 0; i < FInFlags.SliceCount; i++) { if (i == 0) { flags = FInFlags[i]; } else { flags |= FInFlags[i]; } } ModeRegister.Singleton.Refresh(flags); string firstKey = ModeRegister.Singleton.Modes.Keys.First(); EnumManager.UpdateEnum("DeckLinkOutputMode", firstKey, ModeRegister.Singleton.EnumStrings); FOutStatus[0] = "OK"; } catch (Exception e) { FOutStatus[0] = e.Message; } } if (FInMode.IsChanged) { FOutMode.SliceCount = SpreadMax; FOutWidth.SliceCount = SpreadMax; FOutHeight.SliceCount = SpreadMax; FOutFrameRate.SliceCount = SpreadMax; FOutStatus.SliceCount = SpreadMax; for (int slice = 0; slice < SpreadMax; slice++) { try { var modes = ModeRegister.Singleton.Modes; var selection = FInMode[slice]; if (!modes.ContainsKey(selection.Name)) { throw (new Exception("No valid mode selected (" + selection.Name + ")")); } var mode = modes[selection.Name]; FOutMode[slice] = new ModeRegister.ModeIndex(selection.Name); FOutWidth[slice] = mode.Width; FOutHeight[slice] = mode.Height; FOutFrameRate[slice] = mode.FrameRate; FOutStatus[slice] = "OK"; } catch (Exception e) { FOutStatus[slice] = e.Message; } } } }
public HDEHost() { // Set vvvv.exe path ExePath = Path.GetFullPath(Path.Combine(Path.GetDirectoryName((typeof(HDEHost).Assembly.Location)), @"..\..")); //add repository paths from commandline //from commandline var repoArg = "/package-repositories"; var packageRepositories = AssemblyLoader.ParseCommandLine(repoArg); //from args.txt var argsFile = Path.Combine(ExePath, "args.txt"); if (File.Exists(argsFile)) { var args = File.ReadAllText(argsFile).Split(' '); var sourcesIndex = Array.IndexOf(args, repoArg); if (sourcesIndex >= 0 && args.Length > sourcesIndex + 1) { var sourcesString = args[sourcesIndex + 1]; var repoPaths = sourcesString.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < repoPaths.Length; i++) { repoPaths[i] = repoPaths[i].Trim('"', '\\'); } packageRepositories = packageRepositories.Union(repoPaths).ToArray(); } } //make relative paths absolute for (int i = 0; i < packageRepositories.Length; i++) { if (Path.IsPathRooted(packageRepositories[i])) { packageRepositories[i] = Path.Combine(ExePath, packageRepositories[i]); } } AssemblyLoader.AddPackageRepositories(packageRepositories); //the built-in one if (Directory.Exists(PacksPath)) { AssemblyLoader.AddPackageRepository(PacksPath); } //the one where the user is supposed to install packages if (Directory.Exists(UserPacksPatch)) { AssemblyLoader.AddPackageRepository(UserPacksPatch); } // Set name to vvvv thread for easier debugging. Thread.CurrentThread.Name = "vvvv"; // Create a windows forms sync context (FileSystemWatcher runs asynchronously). SynchronizationContext.SetSynchronizationContext(new MySynchronizationContext()); // Register at least one ICommandHistory for top level element ISolution var mappingRegistry = new MappingRegistry(); mappingRegistry.RegisterMapping <ISolution, ICommandHistory, CommandHistory>(MapInstantiation.PerInstanceAndItsChilds); var location = Shell.CallerPath.ConcatPath(@"..\..\lib\nodes\plugins").ConcatPath("Solution.sln"); Solution = new Solution(location, mappingRegistry); EnumManager.SetHDEHost(this); Logger = new DefaultLogger(); IORegistry = new IORegistry(); // Will tell Windows Forms that a message loop is indeed running Application.RegisterMessageLoop(IsSendingMessages); }
private void FillEnum(string[] entries) { EnumManager.UpdateEnum(EnumName, entries[0], entries); }
public HDEHost() { // Set vvvv.exe path ExePath = Path.GetFullPath(Path.Combine(Path.GetDirectoryName((typeof(HDEHost).Assembly.Location)), @"..\..")); //add repository paths from commandline //from commandline var repoArg = "/package-repositories"; var packageRepositories = AssemblyProbing.ParseCommandLine(repoArg); //from args.txt var argsFile = Path.Combine(ExePath, "args.txt"); if (File.Exists(argsFile)) { var args = File.ReadAllText(argsFile); var repoPaths = args.Split(new string[] { "\r", "\r\n", "\n" }, StringSplitOptions.RemoveEmptyEntries) .Where(l => l.StartsWith(repoArg)) .SelectMany(r => r.Substring(repoArg.Length + 1).Trim('"').Split(';')); packageRepositories = packageRepositories.Union(repoPaths).ToArray(); } AssemblyProbing.AddPackageRepositories(packageRepositories); //the built-in one AssemblyProbing.AddPackageRepository(PacksPath); //the one where the user is supposed to install packages AssemblyProbing.AddPackageRepository(UserPacksPatch); // Set name to vvvv thread for easier debugging. Thread.CurrentThread.Name = "vvvv"; // Create a windows forms sync context (FileSystemWatcher runs asynchronously). var context = SynchronizationContext.Current; if (context == null) { // We need to create a user control to get a sync context. var control = new UserControl(); context = SynchronizationContext.Current; control.Dispose(); Debug.Assert(context != null, "SynchronizationContext not set."); } // Register at least one ICommandHistory for top level element ISolution var mappingRegistry = new MappingRegistry(); mappingRegistry.RegisterMapping <ISolution, ICommandHistory, CommandHistory>(MapInstantiation.PerInstanceAndItsChilds); var location = Shell.CallerPath.ConcatPath(@"..\..\lib\nodes\plugins").ConcatPath("Solution.sln"); Solution = new Solution(location, mappingRegistry); EnumManager.SetHDEHost(this); Logger = new DefaultLogger(); IORegistry = new IORegistry(); // Will tell Windows Forms that a message loop is indeed running Application.RegisterMessageLoop(IsSendingMessages); }
// Depending on your program structure, a static constructor might be an OK initalization point. static EnumManagerExample() { EnumManager <ResultState> .Initalize(); }
private void WorldFootballScoreEditor_Load(object sender, EventArgs e) { cbxKind.DataSource = EnumManager.ReadWorldFootballKind(); cbxKind.ValueMember = "ID"; cbxKind.DisplayMember = "NAME"; }
public int Run(string[] args) { try { _notification.Notify($"[{nameof(Kernel)}]: Started.", NotifyTo.CONSOLE, NotifyTo.FILE); var command = _commandParser.Parse(args); command.Notification = _notification; var result = command.Execute(); _notification.Notify($@"[{nameof(Kernel)}]: Completed. {command.Name}:{result}:{EnumManager<ReturnResults>.GetName(result)}", NotifyTo.CONSOLE, NotifyTo.FILE); return(result); } catch (Exception ex) { _notification.Notify(new Exception($"[{nameof(Kernel)}]: Run Failed! Use Help", ex), NotifyTo.CONSOLE, NotifyTo.FILE); _notification.Notify(ReturnResults.Fail.GetValueAsString(), NotifyTo.CONSOLE, NotifyTo.FILE); return(666); } }