public static Actions createType(ActionTypes at) { if (!actionMap.ContainsKey(at)) { actionMap[at] = Resources.Load<Actions>("Actions/" + at.ToString()); } return actionMap[at]; }
public ScriptShowGui(string objectId, string actions, ActionTypes type) { id = objectId; action = actions; if(type == ActionTypes.Custom) { left = 70; icon = "custom"; } else if (type == ActionTypes.Examine) { icon = "examine"; } else if (type == ActionTypes.TalkTo) { down = 70; icon = "talkto"; } else if (type == ActionTypes.Use) { left = 70; down = 70; icon = "use"; } }
protected void ExtraModelToEntity(Autos entity, AutosModel model, ActionTypes actionType) { if (actionType == ActionTypes.Add) { entity.AutoMaterialRsps = new List<AutoMaterialRsp>(); var materialManager = GlobalConfiguration.Configuration.DependencyResolver.GetService<IMaterialsManager>(); foreach (var material in materialManager.GetEntities().Where(o => !o.DeleteDate.HasValue && o.IsForAuto).ToList()) { entity.AutoMaterialRsps.Add(new AutoMaterialRsp() { Amount = 0, Autos = entity, MaterialId = material.Id }); } entity.AutoInstrumentRsps = new List<AutoInstrumentRsp>(); var instrumentManager = GlobalConfiguration.Configuration.DependencyResolver.GetService<IInstrumentsManager>(); foreach (var instrument in instrumentManager.GetEntities().Where(o => !o.DeleteDate.HasValue && o.IsForAuto).ToList()) { entity.AutoInstrumentRsps.Add(new AutoInstrumentRsp() { Amount = 0, Autos = entity, InstrumentId = instrument.Id }); } } }
/// <summary> /// The Protected Constructor Of The Abstract Rule Class /// </summary> /// <param name="name">The Name Of The Rule</param> /// <param name="pattern">The Pattern To Be Used By The Rule</param> /// <param name="type">The Type Of The Rule according to the Enum</param> /// <param name="action">The Type Of The Actions according to the Enum</param> protected Rule(string name, string pattern, RuleTypes type, ActionTypes action) { this.name = name; this.pattern = pattern; this.type = (int) type; this.action = (int) action; NormalizationList = new Hashtable(); }
/// <summary> /// Initializes a new instance of the <see cref="ActionDefinition"/> class. /// </summary> /// <param name="guid">The unique identifier.</param> /// <param name="name">The name.</param> /// <param name="subject">The subject.</param> /// <param name="message">The message.</param> /// <param name="groupName">Name of the group.</param> /// <param name="actionType">Type of the action.</param> public ActionDefinition(Guid guid, string name, string subject, string message, string groupName, ActionTypes actionType) { Guid = guid; Name = name; Subject = subject; Message = message; GroupName = groupName; ActionType = actionType; }
protected void ExtraModelToEntity(User entity, UserModel model, ActionTypes actionType) { if (actionType == ActionTypes.Add) { entity.Password = StringHelper.GetMD5Hash(model.password); entity.Key = StringHelper.GetMD5Hash(String.Format("{0}_{1}", model.login, model.password)); } }
//time out is 5 for performance reasons public ConquestMission(bool ong, Vector3D loc, int start,ActionTypes missiont, int timeout = 0, bool isasteroid = false, IMyVoxelBase ast = null) { MissionType = missiont; Ongoing = ong; Location = loc; StartTime = start; IsAsteroid = isasteroid; this.timeout = r.Next((int) (timeout*.7),(int) (timeout*1.3)); asteroid = ast; }
/* END OF TAB LIST */ private void DrawTypeGrid(string title, List<ActionTypes> listToDraw) { GUILayout.Label(title); foreach (ActionTypes type in listToDraw) { if (GUILayout.RepeatButton(new GUIContent(type.ToString(), IconCacher.GetIcon<ActionTypes>(type), type.ToString())) && Event.current.type == EventType.Repaint) { actionToDrag = type; } } }
protected override void Validate(UserModel model, User entity, ActionTypes actionType) { if (!string.Equals(model.login, entity.Login, System.StringComparison.InvariantCultureIgnoreCase)) { if (Manager.GetByLogin(model.login) != null) ModelState.AddModelError("model.login", "login-unique"); } if (actionType == ActionTypes.Add) { if (string.IsNullOrEmpty(model.password)) ModelState.AddModelError("model.password", "required"); } }
public void SetAction(string type, string name, List<string> parameterList) { type = char.ToUpper(type[0]) + type.Substring(1); // check if type of action exists if (Enum.IsDefined(typeof(ActionTypes), type)) { // adds the current type of the trigger to the wanted type ( for easy acces ) actionType = (ActionTypes)Enum.Parse(typeof(ActionTypes), type); switch(actionType) { case ActionTypes.Move: // checks if key is valid, if not return null and if count is 2. if(parameterList.Count == 4 ) { Move move = new Move(parameterList[1],parameterList[2],parameterList[3]); move.name = name; action = (object)move; } else { CodeInputHandler.abortPlay("type failed ! check your action keyname -37 action.cs"); } break; default : CodeInputHandler.abortPlay("type failed !check your enum cases - 42 action.cs"); return; } ActionHandler.actionDictionary.Add(name,action); } else { // type is not one we know. CodeInputHandler.abortPlay("type failed ! check your trigger type - 54 action.cs "); } }
public void AddInspectorGUI() { if(null != mNodeArray) { mNodeArray.AddInspectorGUI(); } else { EditorGUILayout.LabelField("No states, please add one below"); } if( null == mNewStateName ) { mNewStateName = ""; } EditorGUILayout.Separator(); GUI.SetNextControlName("NewStateField"); mNewStateName = EditorGUILayout.TextField("add state", mNewStateName); actionType = (ActionTypes)EditorGUILayout.EnumPopup( "new action", actionType ); /* TreeNode newTreeNode = new TreeNode(); newTreeNode = (TreeNode)EditorGUILayout.ObjectField( "new node", newTreeNode, typeof(TreeNode), true );*/ if (Event.current.type == EventType.KeyUp) { if ((Event.current.keyCode == KeyCode.Return) && mEditingNewStateString && (mNewStateName.Length > 0) ) { Debug.Log("adding new state " + mNewStateName ); AddNewState(mNewStateName); EditorUtility.SetDirty(this); } mEditingNewStateString = (GUI.GetNameOfFocusedControl() == "NewStateField"); } }
protected override void ModelToEntity(WarehouseMaterialModel model, WarehouseMaterials entity, ActionTypes actionType) { entity.MaterialId = model.materialId; entity.MustAmount = model.mustAmount; if (actionType == ActionTypes.Add) { //todo delete //materialDeliveryRspManager.AddEntity(new MaterialDeliveryRsp() //{ // Amount = model.isAmount, // MaterialId = entity.MaterialId //}); } else if (actionType == ActionTypes.Update) { materialDeliveryRspManager.AddEntity(new MaterialDeliveryRsp() { Amount = model.isAmount - entity.IsAmount, MaterialId = entity.MaterialId, CreateDate = DateTime.Now, ChangeDate = DateTime.Now }); } else { //todo ? } entity.IsAmount = model.isAmount; }
protected override void ModelToEntity(CustomProductsModel model, CustomProducts entity, ActionTypes actionType) { entity.Name = model.name; entity.Price = model.price; entity.Auto = model.auto; entity.ProceedsAccountId = model.proceedsAccountId; }
public static UniAction GetActionInstanceByType(ActionTypes type) { return (UniAction)Activator.CreateInstance("Assembly-CSharp", "UniMaker.Actions.Action" + type.ToString()).Unwrap(); }
protected virtual void Validate(TModel model, TEntity entity, ActionTypes actionType) { }
protected void ExtraModelToEntity(RolePermissionRsp entity, RolePermissionRspModel model, ActionTypes actionType) { entity.Key = StringHelper.GetMD5Hash(String.Format("{0}_{1}", model.roleId, model.permissionId)); }
protected override void ModelToEntity(TermInstrumentModel model, TermInstruments entity, ActionTypes actionType) { entity.TermId = model.termId; entity.InstrumentId = model.instrumentId; entity.EmployeeId = model.employeeId; }
/// <summary> /// /// </summary> /// <param name="name"></param> /// <param name="pattern"></param> /// <param name="action"></param> public NRegexrule(string name, string pattern, ActionTypes action) : base(name, pattern, action) { }
/// <summary> /// Executes the gpg program with the correct command line args based on the selected crypto action /// and feeds the inputStream data to the program and returns the output data as an outputStream. /// </summary> /// <param name="action">Action to perform (sign, encrypt, etc).</param> /// <param name="inputStream">Input stream.</param> /// <param name="outputStream">Output stream.</param> private void ExecuteGpg(ActionTypes action, Stream inputStream, Stream outputStream) { string gpgErrorText = string.Empty; string gpgPath = GetGpgBinaryPath(); string gpgArgs = GetGpgArgs(action); // create a process info object with command line options ProcessStartInfo procInfo = new ProcessStartInfo(gpgPath, gpgArgs); // init the procInfo object procInfo.CreateNoWindow = true; procInfo.UseShellExecute = false; procInfo.RedirectStandardInput = true; procInfo.RedirectStandardOutput = true; procInfo.RedirectStandardError = true; try { // start the gpg process and get back a process start info object _proc = Process.Start(procInfo); _proc.StandardInput.WriteLine(_passphrase); _proc.StandardInput.Flush(); _outputStream = outputStream; _errorStream = new MemoryStream(); // set up threads to run the output stream and error stream asynchronously ThreadStart outputEntry = new ThreadStart(AsyncOutputReader); Thread outputThread = new Thread(outputEntry); outputThread.Name = "gpg stdout"; outputThread.Start(); ThreadStart errorEntry = new ThreadStart(AsyncErrorReader); Thread errorThread = new Thread(errorEntry); errorThread.Name = "gpg stderr"; errorThread.Start(); // copy the input stream to the process standard input object CopyStream(inputStream, _proc.StandardInput.BaseStream); _proc.StandardInput.Flush(); // close the process standard input object _proc.StandardInput.Close(); // wait for the process to return with an exit code (with a timeout variable) if (!_proc.WaitForExit(_timeout)) { throw new GpgException("A time out event occurred while executing the GPG program."); } if (!outputThread.Join(_timeout / 2)) { outputThread.Abort(); } if (!errorThread.Join(_timeout / 2)) { errorThread.Abort(); } // if the process exit code is not 0 then read the error text from the gpg.exe process if (_proc.ExitCode != 0 && !_ignoreErrors) { StreamReader rerror = new StreamReader(_errorStream); _errorStream.Position = 0; gpgErrorText = rerror.ReadToEnd(); } // key name is output to error stream so read from the error stream and write out // to the output stream if (action == ActionTypes.Import) { _errorStream.Position = 0; byte[] buffer = new byte[4048]; int count; while ((count = _errorStream.Read(buffer, 0, buffer.Length)) != 0) { outputStream.Write(buffer, 0, count); } } } catch (Exception exp) { throw new GpgException(String.Format(CultureInfo.InvariantCulture, "Error. Action: {0}. Command args: {1}", action.ToString(), procInfo.Arguments), exp); } finally { Dispose(); } // throw an exception with the error information from the gpg.exe process if (gpgErrorText.IndexOf("bad passphrase") != -1) { throw new GpgBadPassphraseException(gpgErrorText); } if (gpgErrorText.Length > 0) { throw new GpgException(gpgErrorText); } }
public ImportAction(ActionTypes type) { this.ActionType = type; }
void OnGUI() { if (Event.current.type == EventType.MouseDrag && (actionToDrag != ActionTypes.None)) { DragAndDrop.PrepareStartDrag(); DragAndDrop.SetGenericData("ActionTypes", actionToDrag); DragAndDrop.paths = null; DragAndDrop.objectReferences = new Object[0]; DragAndDrop.StartDrag(actionToDrag.ToString()); Event.current.Use(); } if (Event.current.type == EventType.DragExited) { actionToDrag = ActionTypes.None; } EditorGUILayout.BeginHorizontal(GUILayout.ExpandWidth(true)); scrollValue = EditorGUILayout.BeginScrollView(scrollValue, GUI.skin.box); switch (selectedTab) { case ActionTabTypes.TabTransform: DrawTransformTab(); break; } EditorGUILayout.EndScrollView(); EditorGUILayout.EndHorizontal(); }
private void SetOrderType(string[] args) { if (args.Length != 2) return; switch (args[1].ToLower().Trim()) { case "return": _currentOrder = ActionTypes.Return; Util.GetInstance().Log("[PlayerDrone.Update] updating order to " + args[1], orderlog); break; case "guard": _currentOrder = ActionTypes.Return; Util.GetInstance().Log("[PlayerDrone.Update] updating order to " + args[1], orderlog); break; case "sentry": if (_currentOrder != ActionTypes.Sentry) SentryLocation = Ship.GetPosition(); _currentOrder = ActionTypes.Sentry; Util.GetInstance().Log("[PlayerDrone.Update] updating order to " + args[1], orderlog); break; case "orbit": _currentOrder = ActionTypes.Orbit; Util.GetInstance().Log("[PlayerDrone.Update] updating order to " + args[1], orderlog); break; } }
/// <summary> /// The refresh. /// </summary> /// <param name="process"> /// The process. /// </param> /// <param name="action"> /// The action. /// </param> public void Refresh(ProcessEdit process, ProcessActionEdit action) { Model = action; ParentProcess = process; _actionType = Model.ActionType; RaisePropertyChanged(() => ActionType); UpdateAssignmentProperties(); }
private void ExecuteGPG(ActionTypes action, Stream inputStream, Stream outputStream) { string gpgErrorText = string.Empty; string gpgPath = GetGnuPGPath(); // create a process info object with command line options ProcessStartInfo procInfo = new ProcessStartInfo(gpgPath, GetCmdLineSwitches(action)); // init the procInfo object procInfo.CreateNoWindow = true; procInfo.UseShellExecute = false; procInfo.RedirectStandardInput = true; procInfo.RedirectStandardOutput = true; procInfo.RedirectStandardError = true; try { // start the gpg process and get back a process start info object _proc = Process.Start(procInfo); // push passphrase onto stdin with a CRLF _proc.StandardInput.WriteLine(_passphrase); _proc.StandardInput.Flush(); _outputStream = outputStream; _errorStream = new MemoryStream(); // set up threads to run the output stream and error stream asynchronously ThreadStart outputEntry = new ThreadStart(AsyncOutputReader); Thread outputThread = new Thread(outputEntry); outputThread.Name = "GnuPG Output Thread"; outputThread.Start(); ThreadStart errorEntry = new ThreadStart(AsyncErrorReader); Thread errorThread = new Thread(errorEntry); errorThread.Name = "GnuPG Error Thread"; errorThread.Start(); // copy the input stream to the process standard input object CopyStream(inputStream, _proc.StandardInput.BaseStream); _proc.StandardInput.Flush(); // close the process standard input object _proc.StandardInput.Close(); // wait for the process to return with an exit code (with a timeout variable) if (!_proc.WaitForExit(_timeout)) { throw new GpgException("A time out event occurred while executing the GPG program."); } if (!outputThread.Join(_timeout / 2)) outputThread.Abort(); if (!errorThread.Join(_timeout / 2)) errorThread.Abort(); // if the process exit code is not 0 then read the error text from the gpg.exe process if (_proc.ExitCode != 0) { StreamReader rerror = new StreamReader(_errorStream); _errorStream.Position = 0; gpgErrorText = rerror.ReadToEnd(); } } catch (Exception exp) { throw new GpgException(String.Format(CultureInfo.InvariantCulture, "An error occurred while trying to {0} data using GnuPG. GPG.EXE command switches used: {1}", action.ToString(), procInfo.Arguments), exp); } finally { Dispose(); } // throw an exception with the error information from the gpg.exe process if (gpgErrorText.IndexOf("bad passphrase") != -1) throw new GpgBadPassphraseException(gpgErrorText); if (gpgErrorText.Length > 0) throw new GpgException(gpgErrorText); }
private string GetCmdLineSwitches(ActionTypes action) { StringBuilder options = new StringBuilder(); if (_homePath != null && _homePath.Length != 0) { options.Append(String.Format(CultureInfo.InvariantCulture, "--homedir \"{0}\" ", _homePath)); } options.Append("--passphrase-fd 0 "); options.Append("--no-verbose --batch "); options.Append("--trust-model always "); switch (action) { case ActionTypes.Encrypt: if (_recipient == null && action == ActionTypes.Encrypt) { throw new GnuPGException("A Recipient is required before encrypting data. Please specify a valid recipient using the Recipient property on the GnuPG object."); } if (_outputType == OutputTypes.AsciiArmor) { options.Append("--armor "); } options.Append(String.Format(CultureInfo.InvariantCulture, "--recipient \"{0}\" --encrypt", _recipient)); break; case ActionTypes.Decrypt: options.Append("--decrypt "); break; case ActionTypes.Sign: options.Append("--sign "); break; case ActionTypes.Verify: options.Append("--verify "); break; } return options.ToString(); }
private string GetCmdLineSwitches(ActionTypes action) { StringBuilder options = new StringBuilder(); // set a home directory if the user specifies one if (_homePath != null && _homePath.Length != 0) options.Append(String.Format(CultureInfo.InvariantCulture, "--homedir \"{0}\" ", _homePath)); // read the passphrase from the standard input options.Append("--passphrase-fd 0 "); // turn off verbose statements options.Append("--no-verbose --batch "); // always use the trusted model so we don't get an interactive session with gpg.exe options.Append("--trust-model always "); // handle the action switch (action) { case ActionTypes.Encrypt: if (String.IsNullOrEmpty(_recipient)) throw new GpgException("A Recipient is required before encrypting data. Please specify a valid recipient using the Recipient property on the GnuPG object."); // check to see if the user wants ascii armor output or binary output (binary is the default mode for gpg) if (_outputType == OutputTypes.AsciiArmor) options.Append("--armor "); if (_signAndEncrypt) options.Append("--sign "); options.Append(String.Format(CultureInfo.InvariantCulture, "--recipient \"{0}\" --encrypt", _recipient)); break; case ActionTypes.Decrypt: // set local user if specified if (!String.IsNullOrEmpty(_localUser)) options.Append(String.Format(CultureInfo.InvariantCulture, "--local-user \"{0}\" ", _localUser)); options.Append("--decrypt"); break; case ActionTypes.Sign: // set local user if specified if (!String.IsNullOrEmpty(_localUser)) options.Append(String.Format(CultureInfo.InvariantCulture, "--local-user \"{0}\" ", _localUser)); switch (_outputSignatureType) { case OutputSignatureTypes.ClearText: options.Append("--clearsign"); break; case OutputSignatureTypes.Detached: options.Append("--detach-sign"); break; case OutputSignatureTypes.Signature: default: options.Append("--sign"); break; } break; case ActionTypes.Verify: options.Append("--verify"); break; } return options.ToString(); }
public LogAction(ActionTypes action, string description, Parameter[] parameters) { this.action = action; this.description = description; this.parameters = parameters; }
public Report(int nodeId, ActionTypes actionType, ObjectTypes objectType) { NodeId = nodeId; ActionType = actionType; ObjectType = objectType; }
private void ProcessNodes(bool selectedOnly, ActionTypes actionType) { DevExpress.XtraTreeList.TreeList treelist = null; switch (actionType) { case ActionTypes.Import: treelist = treeListTheirs; break; case ActionTypes.Remove: treelist = treeListMine; break; default: throw new NotImplementedException("ActionType not handled yet: " + actionType.ToString()); } int checkedImage = (int)TreeNodeImages.Checked; for (int i = treelist.Nodes.Count - 1; i >= 0; i--) { TreeListNode node = treelist.Nodes[i]; if (!selectedOnly || node.StateImageIndex == checkedImage) { switch (actionType) { case ActionTypes.Import: frmTemplateSyncWizard.MyProject.UserOptions.Add((Project.UserOption)node.Tag); break; case ActionTypes.Remove: frmTemplateSyncWizard.MyProject.UserOptions.Remove((Project.UserOption)node.Tag); break; default: throw new NotImplementedException("ActionType not handled yet: " + actionType.ToString()); } treelist.Nodes.Remove(node); } } //if (treelist.Nodes.Count == 0) //{ // switch (actionType) // { // case ActionTypes.Import: // splitContainer2.Panel1Collapsed = true; // break; // case ActionTypes.Remove: // splitContainer2.Panel2Collapsed = true; // break; // default: // throw new NotImplementedException("ActionType not handled yet: " + actionType.ToString()); // } //} }
private void ActionSelectionChanged(object sender, EventArgs e) { CheckedListBox.CheckedIndexCollection indexCollection = actionsCheckedListBox.CheckedIndices; this.actionsSelectionLabel.Text = string.Empty; this.actionTypeSelection = ActionTypes.None; foreach (int index in indexCollection) { switch (index) { case (0): this.actionsSelectionLabel.Text += "Send Auto-Reply Email to Sender\n"; this.actionTypeSelection = this.actionTypeSelection | ActionTypes.SendAutoReply; break; case (1): this.actionsSelectionLabel.Text += "Create Outlook Note\n"; this.actionTypeSelection = this.actionTypeSelection | ActionTypes.CreateNote; break; case (2): this.actionsSelectionLabel.Text += "Create Outlook Task\n"; this.actionTypeSelection = this.actionTypeSelection | ActionTypes.CreateTask; break; } } this.BuildWorkflow(WizardStep.Condition); ResetButtons(); }
protected abstract void ModelToEntity(TModel model, TEntity entity, ActionTypes actionType);
private void ProcessActivitySelection(ActionTypes actionType) { if (actionType == ActionTypes.None) return; ParallelActivity parallelActivity = null; // Check for multi activity selection if (actionType != ActionTypes.SendAutoReply & actionType != ActionTypes.CreateNote & actionType != ActionTypes.CreateTask) { parallelActivity = new ParallelActivity(); } // Process each selected activity if ((actionType & ActionTypes.SendAutoReply) == ActionTypes.SendAutoReply) ProcessAutoReplyEmailActivity(parallelActivity); if ((actionType & ActionTypes.CreateNote) == ActionTypes.CreateNote) ProcessOutlookNoteActivity(parallelActivity); if ((actionType & ActionTypes.CreateTask) == ActionTypes.CreateTask) ProcessOutlookTaskActivity(parallelActivity); // Add ParallelActivity to the workflow if (parallelActivity != null) { workflowDesigner.SequentialWorkflow.Activities.Add(parallelActivity); workflowDesigner.Host.RootComponent.Site.Container.Add(parallelActivity); } }
public UniAction(ActionTypes type) { Type = type; }
protected override void ModelToEntity(EmployeesModel model, Employees entity, ActionTypes actionType) { entity.Number = model.number; entity.AutoId = model.autoId; entity.Name = model.name; entity.FirstName = model.firstName; entity.Street = model.street; entity.Zip = model.zip; entity.City = model.city; entity.Country = model.country; entity.Phone = model.phone; entity.Mobile = model.mobile; entity.Fax = model.fax; entity.Email = model.email; entity.Comment = model.comment; entity.Color = model.color; }
internal static string CreateUriStringFromParameters(string component, ActionTypes type, string action, ResponseType responseType = ResponseType.JSON) { return(CreateUriStringFromParameters(component, type.ToString().ToLower(), action, responseType)); }
public SheetAction(ActionTypes actionType, byte[] data) : base(actionType) { Data = data; }
public static string GetActionTypeString(ActionTypes actionType) { string actionTypeString = string.Empty; switch (actionType) { //case ActionTypes.Tween: // actionTypeString = "Tween"; // break; case ActionTypes.BezierBy: actionTypeString = "Bezier By"; break; case ActionTypes.BezierTo: actionTypeString = "Bezier To"; break; case ActionTypes.Blink: actionTypeString = "Blink"; break; case ActionTypes.DelayTime: actionTypeString = "Delay Time"; break; case ActionTypes.EaseBackIn: actionTypeString = "Ease Back In"; break; case ActionTypes.EaseBackInOut: actionTypeString = "Ease Back In Out"; break; case ActionTypes.EaseBackOut: actionTypeString = "Ease Back Out"; break; case ActionTypes.EaseBounceIn: actionTypeString = "Ease Bounce In"; break; case ActionTypes.EaseBounceInOut: actionTypeString = "Ease Bounce In Out"; break; case ActionTypes.EaseBounceOut: actionTypeString = "Ease Bounce Out"; break; case ActionTypes.EaseElastic: actionTypeString = "Ease Elastic"; break; case ActionTypes.EaseElasticIn: actionTypeString = "Ease Elastic In"; break; case ActionTypes.EaseElasticInOut: actionTypeString = "Ease Elastic In Out"; break; case ActionTypes.EaseElasticOut: actionTypeString = "Ease Elastic Out"; break; case ActionTypes.EaseExponentialIn: actionTypeString = "Ease Exponential In"; break; case ActionTypes.EaseExponentialInOut: actionTypeString = "Ease Exponential In Out"; break; case ActionTypes.EaseExponentialOut: actionTypeString = "Ease Exponential Out"; break; case ActionTypes.EaseIn: actionTypeString = "Ease In"; break; case ActionTypes.EaseInOut: actionTypeString = "Ease In Out"; break; case ActionTypes.EaseOut: actionTypeString = "Ease Out"; break; case ActionTypes.EaseSineIn: actionTypeString = "Ease Sine In"; break; case ActionTypes.EaseSineInOut: actionTypeString = "Ease Sine In Out"; break; case ActionTypes.EaseSineOut: actionTypeString = "Ease Sine Out"; break; case ActionTypes.FadeIn: actionTypeString = "Fade In"; break; case ActionTypes.FadeOut: actionTypeString = "Fade Out"; break; case ActionTypes.FadeTo: actionTypeString = "Fade To"; break; case ActionTypes.Hide: actionTypeString = "Hide"; break; case ActionTypes.JumpBy: actionTypeString = "Jump By"; break; case ActionTypes.JumpTo: actionTypeString = "Jump To"; break; case ActionTypes.MoveBy: actionTypeString = "Move By"; break; case ActionTypes.MoveTo: actionTypeString = "Move To"; break; case ActionTypes.Place: actionTypeString = "Place"; break; case ActionTypes.Repeat: actionTypeString = "Repeat"; break; case ActionTypes.RepeatForever: actionTypeString = "Repeat Forever"; break; case ActionTypes.RotateAroundBy: actionTypeString = "Rotate Around By"; break; case ActionTypes.RotateBy: actionTypeString = "Rotate By"; break; case ActionTypes.RotateTo: actionTypeString = "Rotate To"; break; case ActionTypes.ScaleBy: actionTypeString = "Scale By"; break; case ActionTypes.ScaleTo: actionTypeString = "Scale To"; break; case ActionTypes.Show: actionTypeString = "Show"; break; case ActionTypes.Spawn: actionTypeString = "Spawn"; break; case ActionTypes.TintBy: actionTypeString = "Tint By"; break; case ActionTypes.TintTo: actionTypeString = "Tint To"; break; case ActionTypes.ToggleVisibility: actionTypeString = "Toggle Visibility"; break; } return(actionTypeString); }
protected override void ModelToEntity(AutoInstrumentRspModel model, AutoInstrumentRsp entity, ActionTypes actionType) { entity.AutoId = model.autoId; entity.InstrumentId = model.instrumentId; entity.Amount = model.amount; }
public ActionTable(ActionTypes[,] table) { Table = table; }
public InstallAction(ActionTypes type) { this.ActionType = type; }
protected override void ModelToEntity(OrderFilesModel model, OrderFiles entity, ActionTypes actionType) { entity.OrderId = model.orderId; entity.Comment = model.comment; if (actionType == ActionTypes.Add) { entity.FileName = model.fileName; } }
private string GetGpgArgs(ActionTypes action) { // validate input switch (action) { case ActionTypes.Encrypt: case ActionTypes.SignEncrypt: if (String.IsNullOrEmpty(_recipient)) { throw new GpgException("A Recipient is required before encrypting data. Please specify a valid recipient using the Recipient property on the GnuPG object."); } break; } StringBuilder options = new StringBuilder(); // set a home directory if the user specifies one if (!String.IsNullOrEmpty(_homePath)) { options.Append(String.Format(CultureInfo.InvariantCulture, "--homedir \"{0}\" ", _homePath)); } // tell gpg to read the passphrase from the standard input so we can automate providing it options.Append("--passphrase-fd 0 "); // if gpg cli version is >= 2.1 then instruct gpg not to prompt for a password // by specifying the pinetnry-mode argument GpgVersion ver = GetGpgVersion(); if ((ver.Major == 2 && ver.Minor >= 1) || ver.Major >= 3) { options.Append("--pinentry-mode loopback "); } // turn off verbose statements options.Append("--no-verbose "); // use batch mode and never ask or allow interactive commands. options.Append("--batch "); // always use the trusted model so we don't get an interactive session with gpg.exe options.Append("--trust-model always "); // if provided specify the key to use by local user name if (!String.IsNullOrEmpty(_localUser)) { options.Append(String.Format(CultureInfo.InvariantCulture, "--local-user {0} ", _localUser)); } // if provided specify the recipient key to use by recipient user name if (!String.IsNullOrEmpty(_recipient)) { options.Append(String.Format(CultureInfo.InvariantCulture, "--recipient {0} ", _recipient)); } // add any user specific options if provided if (!String.IsNullOrEmpty(_userOptions)) { options.Append(_userOptions); } // handle the action switch (action) { case ActionTypes.Encrypt: if (_outputType == OutputTypes.AsciiArmor) { options.Append("--armor "); } // if a filename needs to be embedded in the encrypted blob, set it if (!String.IsNullOrEmpty(_filename)) { options.Append(String.Format(CultureInfo.InvariantCulture, "--set-filename \"{0}\" ", _filename)); } options.Append("--encrypt "); break; case ActionTypes.Decrypt: options.Append("--decrypt "); break; case ActionTypes.Sign: switch (_outputSignatureType) { case OutputSignatureTypes.ClearText: options.Append("--clearsign "); break; case OutputSignatureTypes.Detached: options.Append("--detach-sign "); break; case OutputSignatureTypes.Signature: options.Append("--sign "); break; } break; case ActionTypes.SignEncrypt: if (_outputType == OutputTypes.AsciiArmor) { options.Append("--armor "); } // if a filename needs to be embedded in the encrypted blob, set it if (!String.IsNullOrEmpty(_filename)) { options.Append(String.Format(CultureInfo.InvariantCulture, "--set-filename \"{0}\" ", _filename)); } // determine which type of signature to generate switch (_outputSignatureType) { case OutputSignatureTypes.ClearText: options.Append("--clearsign "); break; case OutputSignatureTypes.Detached: options.Append("--detach-sign "); break; case OutputSignatureTypes.Signature: options.Append("--sign "); break; } break; case ActionTypes.Verify: options.Append("--verify "); break; case ActionTypes.Import: options.Append("--import "); break; } return(options.ToString()); }
private void AddAction(ActionTypes type, IMarketDataStorage storage, long transactionId) { _enumerators.Cache.ForEach(e => e.AddAction(type, storage, transactionId)); }
public DiscrepancyResolution(ActionTypes a, HTMLDocument i, HTMLDocument s = null) { action = a; input = i; secondary = s; }
private void ExecuteGPG(ActionTypes action, Stream inputStream, Stream outputStream) { string gpgErrorText = string.Empty; string gpgPath = GetGnuPGPath(); ProcessStartInfo procInfo = new ProcessStartInfo(gpgPath, GetCmdLineSwitches(action)); procInfo.CreateNoWindow = true; procInfo.UseShellExecute = false; procInfo.RedirectStandardInput = true; procInfo.RedirectStandardOutput = true; procInfo.RedirectStandardError = true; try { _proc = Process.Start(procInfo); _proc.StandardInput.WriteLine(_passphrase); _proc.StandardInput.Flush(); _outputStream = outputStream; _errorStream = new MemoryStream(); ThreadStart outputEntry = new ThreadStart(AsyncOutputReader); Thread outputThread = new Thread(outputEntry); outputThread.Name = "GnuPG Output Thread"; outputThread.Start(); ThreadStart errorEntry = new ThreadStart(AsyncErrorReader); Thread errorThread = new Thread(errorEntry); errorThread.Name = "GnuPG Error Thread"; errorThread.Start(); CopyStream(inputStream, _proc.StandardInput.BaseStream); _proc.StandardInput.Flush(); _proc.StandardInput.Close(); if (!_proc.WaitForExit(_timeout)) { throw new GnuPGException("A time out event occurred while executing the GPG program."); } if (!outputThread.Join(_timeout / 2)) { outputThread.Abort(); } if (!errorThread.Join(_timeout / 2)) { errorThread.Abort(); } if (_proc.ExitCode != 0) { StreamReader rerror = new StreamReader(_errorStream); _errorStream.Position = 0; gpgErrorText = rerror.ReadToEnd(); } } catch (Exception exp) { throw new GnuPGException(String.Format(CultureInfo.InvariantCulture, "An error occurred while trying to {0} data using GnuPG. GPG.EXE command switches used: {1}", action.ToString(), procInfo.Arguments), exp); } finally { Dispose(); } if (gpgErrorText.IndexOf("bad passphrase") != -1) { throw new GnuPGBadPassphraseException(gpgErrorText); } if (gpgErrorText.Length > 0) { throw new GnuPGException(gpgErrorText); } }
public static ActionTable FromStrategy(IBlackjackPlayer strategy) { var table = new ActionTypes[35, 10]; List<PlayerHand> hands = new List<PlayerHand>(); hands.Add(null); for (int dealer = 0; dealer < 10; dealer++) { DealerHand dealerHand = new DealerHand(); dealerHand.AddCard(new Card((Ranks)dealer)); for (int p = 0; p < 35; p++) { PlayerHand playerHand = new PlayerHand() { Player = strategy, Bet = 1 }; if (p < 10) { playerHand.AddCard(new Card((Ranks)p)); playerHand.AddCard(new Card((Ranks)p)); } else if (p < 19) { playerHand.AddCard(new Card(Ranks.Ace)); playerHand.AddCard(new Card((Ranks)(p - 10))); } else if (p < 26) { playerHand.AddCard(new Card(Ranks.Two)); playerHand.AddCard(new Card((Ranks)(p - 18))); } else { playerHand.AddCard(new Card(Ranks.Ten)); playerHand.AddCard(new Card((Ranks)(p - 26))); } hands[0] = playerHand; HandInfo info = new HandInfo() { DealerHand = dealerHand, HandToPlay = 0, PlayerHands = hands }; var hs = strategy.Hit(info) ? ActionTypes.Hit : ActionTypes.Stand; var type = hs; if (p < 10 && strategy.Split(info)) type = hs == ActionTypes.Hit ? ActionTypes.SplitOrHit : ActionTypes.SplitOrStand; else if (strategy.DoubleDown(info)) type = hs == ActionTypes.Hit ? ActionTypes.DoubleDownOrHit : ActionTypes.DoubleDownOrStand; table[p, dealer] = type; } } return new ActionTable(table); }
public static ActionTable FromStrategy(IBlackjackPlayer strategy) { var table = new ActionTypes[35, 10]; List <PlayerHand> hands = new List <PlayerHand>(); hands.Add(null); for (int dealer = 0; dealer < 10; dealer++) { DealerHand dealerHand = new DealerHand(); dealerHand.AddCard(new Card((Ranks)dealer)); for (int p = 0; p < 35; p++) { PlayerHand playerHand = new PlayerHand() { Player = strategy, Bet = 1 }; if (p < 10) { playerHand.AddCard(new Card((Ranks)p)); playerHand.AddCard(new Card((Ranks)p)); } else if (p < 19) { playerHand.AddCard(new Card(Ranks.Ace)); playerHand.AddCard(new Card((Ranks)(p - 10))); } else if (p < 26) { playerHand.AddCard(new Card(Ranks.Two)); playerHand.AddCard(new Card((Ranks)(p - 18))); } else { playerHand.AddCard(new Card(Ranks.Ten)); playerHand.AddCard(new Card((Ranks)(p - 26))); } hands[0] = playerHand; HandInfo info = new HandInfo() { DealerHand = dealerHand, HandToPlay = 0, PlayerHands = hands }; var hs = strategy.Hit(info) ? ActionTypes.Hit : ActionTypes.Stand; var type = hs; if (p < 10 && strategy.Split(info)) { type = hs == ActionTypes.Hit ? ActionTypes.SplitOrHit : ActionTypes.SplitOrStand; } else if (strategy.DoubleDown(info)) { type = hs == ActionTypes.Hit ? ActionTypes.DoubleDownOrHit : ActionTypes.DoubleDownOrStand; } table[p, dealer] = type; } } return(new ActionTable(table)); }
public void AddAction(ActionTypes type, IMarketDataStorage storage, long transactionId) { _actions.Add(Tuple.Create(type, storage, transactionId)); }
private void SaveCustomProperty() { switch (_refType) { case ReferenceType.ActionTypes: ActionType actionType; ActionTypes actionTypes = new ActionTypes(LoginSession.LoginUser); if (_id < 0) { actionType = actionTypes.AddNewActionType(); actionType.OrganizationID = _organizationID; actionType.Position = actionTypes.GetMaxPosition(_organizationID) + 1; } else { actionTypes.LoadByActionTypeID(_id); actionType = actionTypes[0]; } actionType.Description = textDescription.Text; actionType.Name = textName.Text; actionTypes.Save(); break; case ReferenceType.PhoneTypes: PhoneType phoneType; PhoneTypes phoneTypes = new PhoneTypes(LoginSession.LoginUser); if (_id < 0) { phoneType = phoneTypes.AddNewPhoneType(); phoneType.OrganizationID = _organizationID; phoneType.Position = phoneTypes.GetMaxPosition(_organizationID) + 1; } else { phoneTypes.LoadByPhoneTypeID(_id); phoneType = phoneTypes[0]; } phoneType.Description = textDescription.Text; phoneType.Name = textName.Text; phoneTypes.Save(); break; case ReferenceType.ProductVersionStatuses: ProductVersionStatus productVersionStatus; ProductVersionStatuses productVersionStatuses = new ProductVersionStatuses(LoginSession.LoginUser); if (_id < 0) { productVersionStatus = productVersionStatuses.AddNewProductVersionStatus(); productVersionStatus.OrganizationID = _organizationID; productVersionStatus.Position = productVersionStatuses.GetMaxPosition(_organizationID) + 1; } else { productVersionStatuses.LoadByProductVersionStatusID(_id); productVersionStatus = productVersionStatuses[0]; } productVersionStatus.Description = textDescription.Text; productVersionStatus.Name = textName.Text; productVersionStatus.IsDiscontinued = cbDiscontinued.Checked; productVersionStatus.IsShipping = cbShipping.Checked; productVersionStatuses.Save(); break; case ReferenceType.TicketSeverities: TicketSeverity ticketSeverity; TicketSeverities ticketSeverities = new TicketSeverities(LoginSession.LoginUser); if (_id < 0) { ticketSeverity = ticketSeverities.AddNewTicketSeverity(); ticketSeverity.OrganizationID = _organizationID; ticketSeverity.Position = ticketSeverities.GetMaxPosition(_organizationID) + 1; } else { ticketSeverities.LoadByTicketSeverityID(_id); ticketSeverity = ticketSeverities[0]; } ticketSeverity.Description = textDescription.Text; ticketSeverity.Name = textName.Text; ticketSeverities.Save(); break; case ReferenceType.TicketStatuses: TicketStatus ticketStatus; TicketStatuses ticketStatuses = new TicketStatuses(LoginSession.LoginUser); if (_id < 0) { ticketStatus = ticketStatuses.AddNewTicketStatus(); ticketStatus.OrganizationID = _organizationID; ticketStatus.TicketTypeID = _ticketTypeID; ticketStatus.Position = ticketStatuses.GetMaxPosition(_ticketTypeID) + 1; } else { ticketStatuses.LoadByTicketStatusID(_id); ticketStatus = ticketStatuses[0]; } ticketStatus.Description = textDescription.Text; ticketStatus.Name = textName.Text; ticketStatus.IsClosed = cbClosed.Checked; ticketStatuses.Save(); break; default: break; } }
/// <summary> /// /// </summary> /// <param name="name"></param> /// <param name="pattern"></param> /// <param name="action"></param> public IPRule(string name, string pattern, ActionTypes action) : base(name, pattern, RuleTypes.IPRule, action) { }
protected override void ModelToEntity(InvoicePaymentsModel model, InvoicePayments entity, ActionTypes actionType) { entity.InvoiceId = model.invoiceId; entity.Amount = model.amount; }
public LogAction(ActionTypes action, string description) : this(action, description, new Parameter[0]) { }
protected override void ModelToEntity(TermCostsModel model, TermCosts entity, ActionTypes actionType) { entity.TermId = model.termId; entity.Price = model.price; entity.Costs = model.costs; entity.ProceedsAccountId = model.proceedsAccountId; entity.Name = model.name; entity.ChangeDate = DateTime.Now; if (actionType == ActionTypes.Add) { entity.CreateDate = DateTime.Now; } }
public VariablesAction(ActionTypes actionType, byte[] before, byte[] after) : base(actionType) { Before = before; After = after; }
protected override void ModelToEntity(InvoiceStornosModel model, InvoiceStornos entity, ActionTypes actionType) { entity.Price = model.price; entity.ProceedsAccount = model.proceedsAccount; entity.InvoiceId = model.invoiceId; entity.FreeText = model.freeText; }
public void Update() { if (broadcastingBlock != null) { var temp = BroadcastingEnabled; BroadcastingEnabled = broadcastingBlock.IsWorking; if (temp != BroadcastingEnabled) { PlayAudioForBroadcastingChanged(); } } else { Sandbox.ModAPI.IMyGridTerminalSystem gridTerminal = MyAPIGateway.TerminalActionsHelper.GetTerminalSystemForGrid(MyEntity as IMyCubeGrid); List <Sandbox.ModAPI.Ingame.IMyTerminalBlock> blocks = new List <Sandbox.ModAPI.Ingame.IMyTerminalBlock>(); gridTerminal.SearchBlocksOfName(broadcasting, blocks); if (blocks.Count > 0) { broadcastingBlock = blocks.FirstOrDefault(); } } if (miningBlock != null) { var temp = MiningDronesEnabled; MiningDronesEnabled = miningBlock.IsWorking; if (temp != MiningDronesEnabled) { PlayAudioForMiningChanged(); } } else { Sandbox.ModAPI.IMyGridTerminalSystem gridTerminal = MyAPIGateway.TerminalActionsHelper.GetTerminalSystemForGrid(MyEntity as IMyCubeGrid); List <Sandbox.ModAPI.Ingame.IMyTerminalBlock> blocks = new List <Sandbox.ModAPI.Ingame.IMyTerminalBlock>(); gridTerminal.SearchBlocksOfName(mining, blocks); if (blocks.Count > 0) { miningBlock = blocks.FirstOrDefault(); } } if (formationBlock != null) { var temp = DroneMode.ToString(); DroneMode = formationBlock.IsWorking ? DroneModes.Fighter : DroneMode = DroneModes.AtRange; if (temp != DroneMode.ToString()) { PlayAudioForDroneModeChanged(); } } else { Sandbox.ModAPI.IMyGridTerminalSystem gridTerminal = MyAPIGateway.TerminalActionsHelper.GetTerminalSystemForGrid(MyEntity as IMyCubeGrid); List <Sandbox.ModAPI.Ingame.IMyTerminalBlock> blocks = new List <Sandbox.ModAPI.Ingame.IMyTerminalBlock>(); gridTerminal.SearchBlocksOfName(formation, blocks); if (blocks.Count > 0) { formationBlock = blocks.FirstOrDefault(); } } if (agressiveBlock != null) { var temp = Stance; Stance = agressiveBlock.IsWorking?Standing.Hostile:Stance = Standing.Passive; if (temp != Stance) { PlayAudioForStanceChanged(); } } else { Sandbox.ModAPI.IMyGridTerminalSystem gridTerminal = MyAPIGateway.TerminalActionsHelper.GetTerminalSystemForGrid(MyEntity as IMyCubeGrid); List <Sandbox.ModAPI.Ingame.IMyTerminalBlock> blocks = new List <Sandbox.ModAPI.Ingame.IMyTerminalBlock>(); gridTerminal.SearchBlocksOfName(agressive, blocks); if (blocks.Count > 0) { agressiveBlock = blocks.FirstOrDefault(); } } if (modeBlock != null) { var temp = StandingOrder; if (modeBlock.IsWorking) { StandingOrder = ActionTypes.Guard; } else { StandingOrder = ActionTypes.Sentry; } if (temp != StandingOrder) { PlayAudioForStandingOrderChanged(); } } else { Sandbox.ModAPI.IMyGridTerminalSystem gridTerminal = MyAPIGateway.TerminalActionsHelper.GetTerminalSystemForGrid(MyEntity as IMyCubeGrid); List <Sandbox.ModAPI.Ingame.IMyTerminalBlock> blocks = new List <Sandbox.ModAPI.Ingame.IMyTerminalBlock>(); gridTerminal.SearchBlocksOfName(mode, blocks); if (blocks.Count > 0) { modeBlock = blocks.FirstOrDefault(); } } if (onoffBlock != null) { var temp = DronesOnline; if (onoffBlock.IsWorking) { DronesOnline = true; } else { DronesOnline = false; } if (temp != DronesOnline) { PlayAudioForDronesOnlineChanged(); } } else { Sandbox.ModAPI.IMyGridTerminalSystem gridTerminal = MyAPIGateway.TerminalActionsHelper.GetTerminalSystemForGrid(MyEntity as IMyCubeGrid); List <Sandbox.ModAPI.Ingame.IMyTerminalBlock> blocks = new List <Sandbox.ModAPI.Ingame.IMyTerminalBlock>(); gridTerminal.SearchBlocksOfName(onoff, blocks); if (blocks.Count > 0) { onoffBlock = blocks.FirstOrDefault(); } } }
public void ReadFrom( GMBinaryReader aReader ) { int version = aReader.ReadInt32(); if ( version != FormatConstants.GMVersion50 && version != FormatConstants.GMVersion52 ) throw new Exceptions.UnsupportedVersion( aReader.BaseStream.Position, version ); Name = aReader.ReadString(); ID = aReader.ReadInt32(); IconData = aReader.ReadChunk(); Hidden = aReader.ReadInt32AsBool(); Advanced = aReader.ReadInt32AsBool(); if ( version == FormatConstants.GMVersion52 ) RegisteredOnly = aReader.ReadInt32AsBool(); else RegisteredOnly = false; Description = aReader.ReadString(); ListText = aReader.ReadString(); HintText = aReader.ReadString(); Kind = (ActionKinds) aReader.ReadInt32(); InterfaceKind = (InterfaceKinds) aReader.ReadInt32(); IsQuestion = aReader.ReadInt32AsBool(); IsApplyable = aReader.ReadInt32AsBool(); CanBeRelative = aReader.ReadInt32AsBool(); { int count = aReader.ReadInt32(); aReader.BaseStream.Position += 4; Arguments = new List<Argument>( count ); for ( int i = 0; i < count; i++ ) Arguments.Add( new Argument() { Caption = aReader.ReadString(), Kind = (ArgumentKinds) aReader.ReadInt32(), DefaultValue = aReader.ReadString(), Menu = aReader.ReadString() } ); for ( int i = 0; i < 8 - count; i++ ) { aReader.BaseStream.Position += aReader.ReadInt32() + 8; aReader.BaseStream.Position += aReader.ReadInt32() + 4; aReader.BaseStream.Position += aReader.ReadInt32() + 4; } } ExecutionType = (ActionTypes) aReader.ReadInt32(); Code = aReader.ReadString(); aReader.BaseStream.Position += 4; }
protected override void ModelToEntity(ProceedsAccountsModel model, ProceedsAccounts entity, ActionTypes actionType) { entity.Value = model.value; }