private static ReturnTypes ConditionThirsty(CharacterInstance ch, int conditionValue) { ReturnTypes retcode = ReturnTypes.None; if (ch.Level < LevelConstants.AvatarLevel && ch.CurrentClass != ClassTypes.Vampire) { color.set_char_color(ATTypes.AT_THIRSTY, ch); DescriptorAttribute attrib = ConditionTypes.Thirsty.GetAttribute <DescriptorAttribute>(); color.send_to_char(attrib.Messages[conditionValue * 2], ch); if (conditionValue < 2) { comm.act(ATTypes.AT_THIRSTY, attrib.Messages[(conditionValue * 2) + 1], ch, null, null, ToTypes.Room); if (conditionValue == 0) { ch.WorsenMentalState(ch.IsPKill() ? 1 : 2); retcode = ch.CauseDamageTo(ch, 2, (int)SkillNumberTypes.Undefined); } else { ch.WorsenMentalState(1); } } } return(retcode); }
/// <summary> /// Only gets called when adding new filters. Initialises variables and screens. /// </summary> /// <param name="parentForm"></param> /// <param name="parent"></param> /// <param name="returnType"></param> /// <param name="requiredFilterColumns"></param> private void Init(Form parentForm, ScriptObject parent, ReturnTypes returnType, List <Column> requiredFilterColumns) { // Reset the filters because they are static _existingFilter = _newFilter = null; Owner = parentForm; //this.Owner.ParentForm = parenForm; Owner.Cursor = Cursors.WaitCursor; InitializeComponent(); RequiredFilterColumns = requiredFilterColumns; ReturnType = returnType; BackColor = Slyce.Common.Colors.BackgroundColor; ucHeading1.Text = ""; Text = "Add New Filter"; IsAddingNewFilter = true; _parent = parent; Interfaces.Events.ShadeMainForm(); ResizeControls(); if (requiredFilterColumns.Count > 0) { foreach (Column column in requiredFilterColumns) { Filter.FilterColumn filterColumn = new Filter.FilterColumn(column, "And", "=", column.Alias); TheFilter.AddFilterColumn(filterColumn); } SetNewFilterName(); } InitContentItems(); Populate(); Owner.Cursor = Cursors.Default; }
/// <summary> /// 向表插入一行数据 /// </summary> /// <param name="t"></param> /// <param name="types"></param> /// <returns></returns> public int Insert(T t, ReturnTypes types) { var rel = sqlfactory.Insert <T>(t, types); //ClearCacheData(); return(rel); }
private static ReturnTypes ConditionBloodthirsty(CharacterInstance ch, int conditionValue) { ReturnTypes retcode = ReturnTypes.None; if (ch.Level < LevelConstants.AvatarLevel) { color.set_char_color(ATTypes.AT_BLOOD, ch); DescriptorAttribute attrib = ConditionTypes.Bloodthirsty.GetAttribute <DescriptorAttribute>(); color.send_to_char(attrib.Messages[conditionValue * 2], ch); if (conditionValue < 2) { comm.act(ATTypes.AT_HUNGRY, attrib.Messages[(conditionValue * 2) + 1], ch, null, null, ToTypes.Room); if (conditionValue == 0) { ch.WorsenMentalState(2); retcode = ch.CauseDamageTo(ch, ch.MaximumHealth / 20, (int)SkillNumberTypes.Undefined); } else { ch.WorsenMentalState(1); } } } return(retcode); }
/* * Function: PostAction(WebActions, WWWForm, ReturnTypes, function) * * Submits an action to the server * * Parameters: * * action - The desired action * form - The WWWForm to submit to the server * returnType - The type of data that needs to be returned * callback - A function pointer to the method that will manage the returned data * * See Also: * * - <PostAction(WebActions, function)> * - <PostAction(WebActions, ReturnTypes, function)> * - <PostAction(WebActions, WWWForm)> * - <PostAction(WebActions, WWWForm, function)> */ public void PostAction(WebActions action, WWWForm form, ReturnTypes returnType, Action <Hashtable> callback) { if ((int)action < Actions.Length && action >= 0) { if (_online) { if (useDev) { loadURL(devURL + Actions[(int)action], form, returnType, callback); } else { loadURL(baseURL + Actions[(int)action], form, returnType, callback); } } else { postOfflineAction(action, form, returnType, callback); } } else { Hashtable returnData = new Hashtable(); returnData["error"] = "Action " + action + " doesn't exist."; callback(returnData); } }
public override string ToString() { string methodString = ""; if (Modifiers.HasFlag(MethodModifiers.Static)) { methodString += $"{DeclaringType.ShortName}."; } methodString += Name; string argTypeString = string.Join(", ", Parameters.Select(a => a.Value.ShortName)); methodString += $"({argTypeString})"; if (GenericArguments.Count > 0) { string genArgTypeString = string.Join(", ", GenericArguments.Select(s => s.ShortName)); methodString += $"<{genArgTypeString}>"; } if (ReturnTypes.Count > 0) { string returnTypeString = string.Join(", ", ReturnTypes.Select(s => s.ShortName)); methodString += $" : {returnTypeString}"; } return(methodString); }
/* * Function: loadURL(string, WWWForm, ReturnTypes, callback) * * Posts a form to a URL and initiates callback when done * * Parameters: * * url - URL string * form - The WWWForm to submit * returnType - The type of data that needs to be returned * callback - A function pointer to the method that will manage the returned data * * See Also: * * - <loadURL(string, ReturnTypes, callback)> */ public void loadURL(string url, WWWForm form, ReturnTypes returnType, Action <Hashtable> callback) { StartCoroutine(loadURL(url, form)); while (!www.isDone) { } processReturnData(returnType); callback(returnData); Destroy(gameObject); }
/* * Function: processReturnData(ReturnTypes) * * Checks and formats the data that was returned from the server. * * Parameters: * * returnType - The type of data that needs to be returned */ private void processReturnData(ReturnTypes returnType) { returnData = new Hashtable(); if (www.error != null) { returnData["error"] = www.error; } else { switch (returnType) { case ReturnTypes.StringValue: returnData["data"] = www.text; break; case ReturnTypes.TextureValue: returnData["data"] = www.texture; break; case ReturnTypes.MovieValue: returnData["data"] = www.GetMovieTexture(); break; case ReturnTypes.XMLValue: XMLNode node; XMLReader parser = new XMLReader(); node = parser.read(www.text); if (node.tagName == "!DOCTYPE") { returnData["error"] = serverErrorMsg; } else if (node.tagName == "error") { foreach (XMLNode detail in node.children) { switch (detail.tagName) { case "description": returnData["error"] = detail.value; break; } } } else { returnData["data"] = node; } break; } } //complete = true; }
public override string ToString() { Tools.IndentationLevel++; var formatedReturnTypes = ReturnTypes.Equals("void") ? string.Empty : $" returns ({ReturnTypes}) "; var content = $"function {Name}({Parameters}) {Modifier}{formatedReturnTypes}{{\n".Tabulate() + $"{string.Join("\n", Expressions.Select(expression => expression.ToString()))}\n" + $"}}".Tabulate(); Tools.IndentationLevel--; return(content); }
private static void SetParameters(string[] args) { if (args.Length < 3) { outputFilePath = DEF_OUT_FILE_PATH; inputFilePath = DEF_IN_FILE_PATH; returnType = ReturnTypes.XML; } else { outputFilePath = args[1]; inputFilePath = args[0]; returnType = SetReturnType(args[2]); } }
/* * Function: loadURL(string, ReturnTypes, function) * * Posts to a url. This method can be used if you want to post to a URL that isn't a part of the Meta!Blast API. Any API calls should use PostAction. * * Parameters: * * url - The URL string to post to * returnType - The type of data that needs to be returned * callback - A function pointer to the method that will manage the returned data * * See Also: * * - <PostAction(WebActions, ReturnTypes, function)> */ void loadURL(string url, ReturnTypes returnType, Action <Hashtable> callback) { if ((int)returnType < System.Enum.GetValues(typeof(ReturnTypes)).Length&& returnType >= 0) { GameObject newStream = new GameObject("Stream"); Downloader newDownloader = newStream.AddComponent <Downloader>(); newStream.transform.parent = transform; newDownloader.loadURL(url, returnType, callback); } else { Hashtable returnData = new Hashtable(); returnData["error"] = "Return type " + returnType + " doesn't exist."; callback(returnData); } }
DemonTypes ( TypeDefinition joinPoint, MethodDefinition joinPointConstructor, TypeDefinition typeJoinPoint, MethodDefinition typeJoinPointConstructor, ParametersTypes parameters, ReturnTypes returns ) { JoinPoint = joinPoint; JoinPointConstructor = joinPointConstructor; TypeJoinPoint = typeJoinPoint; TypeJoinPointConstructor = typeJoinPointConstructor; Parameters = parameters; Returns = returns; }
private static void CreateAndFillOutputFile(College college, ReturnTypes returnType) { IOutputFileCreator fileCreator = null; switch (returnType) { case ReturnTypes.XML: fileCreator = new XmlOutputFileCreator(outputFilePath); break; default: Logger.CreateLogEntry("Brak implementacji dla typu " + returnType); break; } if (fileCreator != null) { fileCreator.CreateOutputFile(college); } }
/// <summary> /// Creates an image of the selection. /// Also confirms if QuickScreenshots is enabled. /// </summary> protected override void OnMouseUp(MouseEventArgs e) { if (_rectangleSelection.Width <= 0 || _rectangleSelection.Height <= 0) { return; } _image = new Bitmap(_rectangleSelection.Width, _rectangleSelection.Height, PixelFormat.Format32bppRgb); using (var gr = Graphics.FromImage(_image)) { gr.DrawImage(BackgroundImage, new Rectangle(0, 0, _image.Width, _image.Height), _rectangleSelection, GraphicsUnit.Pixel); } ReturnType = (ModifierKeys == Keys.Control) ? ReturnTypes.ToClipboard : ReturnTypes.Default; if (Settings.Default.QuickScreenshots) { DialogResult = DialogResult.OK; } }
public ReturnTypes GetSelectedFiles(ref int elemCount, IntPtr fileNumArray) { int arraySize = elemCount; log.Info("Get Selected called"); ReturnTypes res = 0; if (selectedItems == null) { collectorService.GetSelectedFiles(out selectedItems); } if (selectedItems.Count == 0) { selectedItems = null; return(T(CollectorState.NO_DATA)); } if (arraySize < selectedItems.Count) { elemCount = arraySize; } else { elemCount = selectedItems.Count; } Marshal.Copy(selectedItems.ToArray(), 0, fileNumArray, elemCount); selectedItems.RemoveRange(0, elemCount); if (selectedItems.Count == 0) { selectedItems = null; return(ReturnTypes.rtOK); } else { return(ReturnTypes.rtHasMoreData); } }
/* * Function: postOfflineAction * * Handles actions if module is offline. * * Parameters: * * action - The desired action * form - The WWWForm to submit to the server * returnType - The type of data that needs to be returned * callback - A function pointer to the method that will manage the returned data * * See Also: * * - <GoOffline> * - <PostAction(WebActions, WWWForm, ReturnTypes, function)> */ private void postOfflineAction(WebActions action, WWWForm form, ReturnTypes returnType, Action <Hashtable> callback) { if (offline == null) { offline = new Offline(); } switch (action) { case WebActions.GetQuestions: TextAsset questionsXML = (TextAsset)Resources.Load(Assets.Resources.Data.Questions); Hashtable data = GetQuestionDataFromXML(questionsXML.text); callback(data); break; default: Hashtable temp = new Hashtable(); temp["data"] = true; callback(temp); break; } }
/// <summary> /// Processes the hotkeys. /// </summary> protected override bool ProcessCmdKey(ref Message message, Keys keyData) { ReturnType = (ModifierKeys == Keys.Control) ? ReturnTypes.ToClipboard : ReturnTypes.Default; // Remove the control modifier from the keys var keys = (keyData & ~Keys.Control); if (keys == Keys.Escape) { DialogResult = DialogResult.Cancel; return(true); } else if (keys == Keys.C) { Settings.Default.ShowControls = !Settings.Default.ShowControls; _comboBoxScreen.Visible = Settings.Default.ShowControls; Invalidate(); return(true); } else if (keys == Keys.F) { _rectangleSelection = new Rectangle(0, 0, BackgroundImage.Width, BackgroundImage.Height); OnMouseUp(null); return(true); } else if (keys == Keys.Enter) { if (!Settings.Default.QuickScreenshots) { DialogResult = DialogResult.OK; } return(true); } return(true); }
public void ExportToTree( TextWriter writer, string currentIndent, string indent, out IEnumerable <IAnalysisItemView> exportChildren ) { var returnTypes = string.Join(", ", ReturnTypes.Select(t => { var sw = new StringWriter(); IEnumerable <IAnalysisItemView> dummy; t.ExportToTree(sw, "", indent, out dummy); return("(" + sw.ToString().Trim() + ")"); }).Distinct()); if (!string.IsNullOrEmpty(returnTypes)) { writer.WriteLine("{0}Overload: {1} -> {2}", currentIndent, Prototype, returnTypes); } else { writer.WriteLine("{0}Overload: {1}", currentIndent, Prototype); } exportChildren = null; }
public static bool PlaceCreature(Position centerPosition, Creature creature, bool extendedPos = false, bool forceLogin = false) { bool foundTile; bool placeInPZ; Tile tile = GetTile(centerPosition.X, centerPosition.Y, centerPosition.Z); if (tile != null) { placeInPZ = tile.Flags.HasFlag(TileFlags.ProtectionZone); ReturnTypes ret = tile.QueryAdd(0, creature, 1, CylinderFlags.IgnoreBlockItem); foundTile = forceLogin || ret == ReturnTypes.NoError; } else { placeInPZ = false; foundTile = false; } if (!foundTile) { List <Tuple <int, int> > relList = (extendedPos ? ExtendedRelList : NormalRelList); if (extendedPos) { relList.Shuffle(0, 5); relList.Shuffle(5, 6); } else { relList.Shuffle(); } foreach (Tuple <int, int> pos in relList) { Position tryPos = new Position((ushort)(centerPosition.X + pos.Item1), (ushort)(centerPosition.Y + pos.Item2), centerPosition.Z); tile = GetTile(tryPos.X, tryPos.Y, tryPos.Z); if (tile == null || (placeInPZ && !tile.Flags.HasFlag(TileFlags.ProtectionZone))) { continue; } if (tile.QueryAdd(0, creature, 1, CylinderFlags.None) == ReturnTypes.NoError) { if (!extendedPos || IsSightClear(centerPosition, tryPos, false)) { foundTile = true; break; } } } if (!foundTile) { return(false); } } int index = 0; uint flags = 0; Item toItem = null; //Cylinder* toCylinder = tile->queryDestination(index, *creature, &toItem, flags); //TODO //toCylinder->internalAddThing(creature); tile.InternalAddThing(creature); tile.AddCreature(creature); return(true); }
public PluginReturnValue(object value, ReturnTypes returnType) { Value = value; ReturnType = returnType; }
/* * Function: PostAction(WebActions, ReturnTypes, function) * * Submits an action to the server * * Parameters: * * action - The desired action * returnType - The type of data that needs to be returned * callback - A function pointer to the method that will manage the returned data * * See Also: * * - <PostAction(WebActions, function)> * - <PostAction(WebActions, WWWForm)> * - <PostAction(WebActions, WWWForm, function)> * - <PostAction(WebActions, WWWForm, ReturnTypes, function)> */ public void PostAction(WebActions action, ReturnTypes returnType, Action <Hashtable> callback) { PostAction(action, new WWWForm(), returnType, callback); }
/// <summary> /// 向表插入一行数据 /// </summary> /// <param name="t"></param> /// <param name="returnType"></param> /// <returns></returns> public static int Insert(T t, ReturnTypes returnType) { var rel = new DAL.CommonData <T>().Insert(t, returnType); return(rel); }
public int Insert(string sql, SqlConnection sqlconnection, SqlCommand command, SqlTransaction trans, SqlParameter[] parms, ReturnTypes returnType) { var rel = sqlfactory.Insert(sql, sqlconnection, command, trans, parms, returnType); //ClearCacheData(); return(rel); }
/// <summary> /// 插入一行数据(带事务) /// </summary> /// <param name="t"></param> /// <param name="sqlconnection"></param> /// <param name="command"></param> /// <param name="trans"></param> /// <param name="types"></param> /// <returns></returns> public int Insert(T t, SqlConnection sqlconnection, SqlCommand command, SqlTransaction trans, ReturnTypes types) { var rel = sqlfactory.Insert <T>(t, sqlconnection, command, trans, types); //ClearCacheData(); return(rel); }
public void SendCancelMessage(ReturnTypes message) { SendCancelMessage(ReturnTypeStringifier.Stringify(message)); }
/// <summary> /// Only gets called when adding new filters. Initialises variables and screens. /// </summary> /// <param name="parentForm"></param> /// <param name="parent"></param> /// <param name="returnType"></param> /// <param name="requiredFilterColumns"></param> private void Init(Form parentForm, ScriptObject parent, ReturnTypes returnType, List<Column> requiredFilterColumns) { // Reset the filters because they are static _existingFilter = _newFilter = null; Owner = parentForm; //this.Owner.ParentForm = parenForm; Owner.Cursor = Cursors.WaitCursor; InitializeComponent(); RequiredFilterColumns = requiredFilterColumns; ReturnType = returnType; BackColor = Slyce.Common.Colors.BackgroundColor; ucHeading1.Text = ""; Text = "Add New Filter"; IsAddingNewFilter = true; _parent = parent; Interfaces.Events.ShadeMainForm(); ResizeControls(); if (requiredFilterColumns.Count > 0) { foreach (Column column in requiredFilterColumns) { Filter.FilterColumn filterColumn = new Filter.FilterColumn(column, "And", "=", column.Alias); TheFilter.AddFilterColumn(filterColumn); } SetNewFilterName(); } InitContentItems(); Populate(); Owner.Cursor = Cursors.Default; }
/// <summary> /// Constructor for when called from Relationship wizard. /// </summary> /// <param name="parentForm"></param> /// <param name="parent"></param> /// <param name="returnType"></param> /// <param name="requiredFilterColumns"></param> public FormFilter2(Form parentForm, ScriptObject parent, ReturnTypes returnType, List <Column> requiredFilterColumns) { Init(parentForm, parent, returnType, requiredFilterColumns); }
public object ExecCommand(string queryKey, List <DbParam> values, ReturnTypes returnType) { var query = DataQueries.Queries[ConnectionTypes.ORACLE][queryKey]; var comm = _dnCon.CreateCommand(); var txn = _dnCon.BeginTransaction(IsolationLevel.ReadCommitted); comm.Transaction = txn; comm.BindByName = true; if (values != null) { foreach (var v in values) { var p = new OracleParameter(v.key, OracleDbType.Varchar2) { Direction = ParameterDirection.Input, Value = v.value }; comm.Parameters.Add(p); } } comm.CommandText = query; dynamic res = null; try { var reader = comm.ExecuteReader(); txn.Commit(); if (returnType == ReturnTypes.List || returnType == ReturnTypes.JsonString) { res = new List <Dictionary <string, object> >(); while (reader.Read()) { var row = new Dictionary <string, object>(); for (var i = 0; i < reader.FieldCount; i++) { row.Add(reader.GetName(i), reader[i] == DBNull.Value ? null : reader[i]); } res.Add(row); } if (returnType == ReturnTypes.JsonString) { reader.Close(); CloseConnection(); return(LitJson.JsonMapper.ToJson(res)); } } else if (returnType == ReturnTypes.DataTable) { res = new DataTable(); res.Load(reader); } reader.Close(); } catch (OracleException ex) { throw ex; } CloseConnection(); return(res); }
public override IAnalysisSet Call(Node node, AnalysisUnit unit, IAnalysisSet[] args, NameExpression[] keywordArgNames) => ReturnTypes.GetInstanceType();
/// <summary> /// Constructor for when called from Relationship wizard. /// </summary> /// <param name="parentForm"></param> /// <param name="parent"></param> /// <param name="returnType"></param> /// <param name="requiredFilterColumns"></param> public FormFilter2(Form parentForm, ScriptObject parent, ReturnTypes returnType, List<Column> requiredFilterColumns) { Init(parentForm, parent, returnType, requiredFilterColumns); }
public object ExecCommand(string queryKey, List <DbParam> values, ReturnTypes returnType) { var query = DataQueries.Queries[ConnectionTypes.MYSQL][queryKey]; var comm = _dnCon.CreateCommand(); if (values != null) { foreach (var v in values) { var p = new MySqlParameter(v.key, MySqlDbType.VarChar) { Direction = ParameterDirection.Input, Value = v.value }; comm.Parameters.Add(p); } } comm.CommandText = query; dynamic res = null; try { var reader = comm.ExecuteReader(); if (returnType == ReturnTypes.List || returnType == ReturnTypes.JsonString) { res = new List <Dictionary <string, object> >(); while (reader.Read()) { var row = new Dictionary <string, object>(); for (var i = 0; i < reader.FieldCount; i++) { row.Add(reader.GetName(i), reader[i] == DBNull.Value ? null : reader[i]); } res.Add(row); } if (returnType == ReturnTypes.JsonString) { reader.Close(); CloseConnection(); return(LitJson.JsonMapper.ToJson(res)); } } else if (returnType == ReturnTypes.DataTable) { res = new DataTable(); res.Load(reader); } reader.Close(); } catch (MySqlException ex) { throw ex; } CloseConnection(); return(res); }
public ReturnType(ReturnTypes returnType) { _ReturnType = returnType; }