public static Material Couleur2Material(EnumCouleurs color) { Material m = new Material(Shader.Find("Standard")); m.color = Convertion.Couleur2Color(color); return(m); }
/* * Método público para realizar consultas a la base de datos * */ public XmlDocument SelectRequest(string databaseType, string databaseName, XmlNode body) { XmlDocument xmldocument = new XmlDocument(); PluginMySQL mysql; PluginMongo mongo; switch (databaseType) { case ("mongodb"): mongo = new PluginMongo(databaseName); xmldocument = Convertion.JsonToXml(mongo.SelectRequest(body)); break; case ("mysql"): string username = getUser(databaseType, databaseName); string password = getPassword(databaseType, databaseName); if (username == null) { mysql = new PluginMySQL(databaseName); } else { mysql = new PluginMySQL(databaseName, username, password); } xmldocument = mysql.SelectRequest(body); break; } return(xmldocument); }
/// <summary> /// Simple function to add /// </summary> /// <remarks>Test code to ttry and reduce the amount of calls to the API</remarks> public async Task <bool> AddTestData() { if ((await _connection.Table <RecipeData>().ToListAsync()).Count == 0) { await _connection.InsertAsync(Convertion.ToRecipeData(Repository.result.results[0])); await _connection.InsertAsync(Convertion.ToRecipeData(Repository.result.results[0])); await _connection.InsertAsync(Convertion.ToRecipeData(Repository.result.results[0])); await _connection.InsertAsync(Convertion.ToRecipeData(Repository.result.results[0])); await _connection.InsertAsync(Convertion.ToRecipeData(Repository.result.results[0])); await _connection.InsertAsync(Convertion.ToRecipeData(Repository.result.results[0])); await _connection.InsertAsync(Convertion.ToRecipeData(Repository.result.results[0])); await _connection.InsertAsync(Convertion.ToRecipeData(Repository.result.results[0])); await _connection.InsertAsync(Convertion.ToRecipeData(Repository.result.results[0])); await _connection.InsertAsync(Convertion.ToRecipeData(Repository.result.results[0])); } return(true); }
new DqNumberingLevel(level.LevelText.Val) { Indent = level.GetFirstChild <PreviousParagraphProperties>()?.Indentation?.Left?.Value is string leftIndent ? Convertion.TwipToCm(int.Parse(leftIndent)) : (decimal?)null }; }
public static List <T> Read <T>(string _path, int _initCapacity = 256) where T : class, new() { List <T> result = new List <T>(_initCapacity); List <Convertion> convertion = new List <Convertion>(); var type = typeof(T); var fields = type.GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance); for (int i = 0; i < fields.Length; ++i) { if (Convertion.IsFieldCSVReadable(fields[i])) { convertion.Add(new Convertion(fields[i])); convertion.Sort(); } } using (var reader = new StreamReader(_path, System.Text.Encoding.Unicode)) { while (reader.Peek() != -1) { var loadedObject = new T(); for (int i = 0; i < convertion.Count; ++i) { convertion[i].ConvertAndSet(loadedObject, reader.ReadLine()); } result.Add(loadedObject); } return(result); } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { ScriptManager.RegisterStartupScript(this.Page, typeof(string), "Resize", "changeWidth.resizeWidth();", true); //Session["mrp_docNum"] = docnumber.ToString(); //Session["mrp_wrkLine"] = wrkflwln.ToString(); //string docnumber = Request.Params["DocNum"].ToString(); string docnumber = Session["mrp_docNum"].ToString(); int source = Convert.ToInt32(Session["mrp_source"]); string query = "SELECT dbo.tbl_MRP_List.DocNumber, dbo.tbl_MRP_List.MRPMonth, dbo.tbl_MRP_List.MRPYear, dbo.tbl_MRP_List.DateCreated, dbo.vw_AXEntityTable.NAME AS EntityName, dbo.vw_AXOperatingUnitTable.NAME AS BU, dbo.tbl_Users.Firstname, dbo.tbl_Users.Lastname, dbo.tbl_MRP_Status.StatusName FROM dbo.tbl_MRP_List LEFT OUTER JOIN dbo.vw_AXEntityTable ON dbo.tbl_MRP_List.EntityCode = dbo.vw_AXEntityTable.ID LEFT OUTER JOIN dbo.vw_AXOperatingUnitTable ON dbo.tbl_MRP_List.BUCode = dbo.vw_AXOperatingUnitTable.OMOPERATINGUNITNUMBER LEFT OUTER JOIN dbo.tbl_Users ON dbo.tbl_MRP_List.CreatorKey = dbo.tbl_Users.PK LEFT OUTER JOIN dbo.tbl_MRP_Status ON dbo.tbl_MRP_List.StatusKey = dbo.tbl_MRP_Status.PK WHERE DocNumber = '" + docnumber + "'"; SqlConnection conn = new SqlConnection(GlobalClass.SQLConnString()); conn.Open(); SqlCommand cmd = new SqlCommand(query, conn); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { DocNum.Text = reader["DocNumber"].ToString(); Month.Text = Convertion.INDEX_TO_MONTH(Convert.ToInt32(reader["MRPMonth"].ToString())); Year.Text = reader["MRPYear"].ToString(); Entity.Text = reader["EntityName"].ToString(); Department.Text = reader["BU"].ToString(); Status.Text = reader["StatusName"].ToString(); Creator.Text = EncryptionClass.Decrypt(reader["Firstname"].ToString()) + " " + EncryptionClass.Decrypt(reader["Lastname"].ToString()); DateCreated.Text = reader["DateCreated"].ToString(); } BindGrid(docnumber); } }
public void DoClient(TcpClient socket) { using (StreamReader sr = new StreamReader(socket.GetStream())) using (StreamWriter sw = new StreamWriter(socket.GetStream())) { string incommingStr = sr.ReadLine(); string[] input = incommingStr.Split(' '); string command = input[0]; double number = Convert.ToDouble(input[1]); string result = ""; if (command == "TOGRAM") { result = $"Result = {Convertion.ConvertToGram(number)} g"; } if (command == "TOOUNCES") { result = $"Result = {Convertion.ConvertToOunces(number)} oz"; } Console.WriteLine($"{command} {number}"); Console.WriteLine(result); sw.WriteLine(result); sw.Flush(); } }
public static void LeaveDataRaw(bool r_send, string[] data, byte[] r_packet, bool r_resend) { checkDatabase(); int resend = (r_resend) ? 1 : 0; int send = (r_send) ? 1 : 0; string packet = Convertion.ByteArrayToHexString(r_packet); string query = string.Format("INSERT INTO h_packet(type, placeid, deviceid, addr, ins, DATA, resend) VALUES({0},'{1}',{2},{3},'{4}','{5}','{6}',{7})", send, data[0], data[1], data[2], data[3], packet, resend); dbcmd = new MySqlCommand(query, dbconn); try { if (dbcmd.ExecuteNonQuery() == 1) { if (Server.DebugLevel > 2) { Server.print(2, "Communication history successfully left in the database."); } } else { Server.print(1, "LeaveDataRaw could not be reflected in the database.. " + query); } } catch (Exception e) { Server.print(1, "LeaveDataRaw could not be reflected in the database.. " + e + "\n" + query); } }
public void CloneWater(float viewportX, Vector2 origin) { Vector2 p = origin * CurrentCamera.GetXZoom(); int viewportSizeX = Mathf.FloorToInt(viewportX * CurrentCamera.GetXZoom()); Vector2 vecMin = Convertion.Location2World(p) * -1; Vector2 vecMax = Convertion.Location2World(new Vector2(p.x * -1 + viewportSizeX, p.y)); if (vecMin.x < 0) { i = (int)Mathf.Abs(vecMin.x / Chunk.size) + 1; i *= Chunk.size; foreach (Tuple <int, int> block in listLiquid) { if (block.Item1 > width - i) { Liquid.listMap[type].SetCell(block.Item1 - width - 1, height - block.Item2, map[block.Item1, block.Item2]); } } } if (vecMax.x >= World.size * Chunk.size) { i = (int)Mathf.Abs((vecMax.x - Chunk.size * World.size) / Chunk.size) + 1; i *= Chunk.size; foreach (Tuple <int, int> block in listLiquid) { if (block.Item1 < i) { Liquid.listMap[type].SetCell(width + block.Item1 + 1, height - block.Item2, map[block.Item1, block.Item2]); } } } }
List <ApplicationFileLocator> ParseAFL() { string parseData = ""; List <ApplicationFileLocator> response = new List <ApplicationFileLocator>(); ApplicationFileLocator afl; switch (ResponseMessageTemplateFormat) { case 1: parseData = data.Substring(4, data.Length - 4); break; case 2: int l = Convertion.HexToDecimal(data.Substring(data.IndexOf(Tags.ApplicationFileLocator) + 2, 2)) * 2; parseData = data.Substring(data.IndexOf(Tags.ApplicationFileLocator) + 4, l); break; } for (int i = 0; i <= parseData.Length - 1; i += 8) { afl = new ApplicationFileLocator(); afl.ShortFileIdentifier = parseData.Substring(i, 2); afl.StartRecord = parseData.Substring(i + 2, 2); afl.EndRecord = parseData.Substring(i + 4, 2); afl.NumberOfRecords = parseData.Substring(i + 6, 2); response.Add(afl); } return(response); }
public static void Spawn_Enemy(float x, float y) { Ennemy_Fly enemy1 = (Ennemy_Fly)enemy_fly.Instance(); instance.AddChild(enemy1); enemy1.Position = Convertion.World2Location(new Vector2(x, y)); }
///place un batiment selon les regles public static bool PlaceWithMouse(Building building, Vector2 mouse, bool right) { bool succeed = false; Vector2 mouseC = Convertion.Location2WorldFloor(mouse); if (right) { if (IsPlacableRight((int)mouseC.x, (int)mouseC.y, building.size, building.size)) { mouseC.x += building.size / 2; mouseC.y += building.size / 2; building.Place(mouseC); succeed = true; } } else { if (IsPlacableLeft((int)mouseC.x, (int)mouseC.y, building.size, building.size)) { mouseC.x -= building.size / 2 - 1; mouseC.y += building.size / 2; building.Place(mouseC); succeed = true; } } return(succeed); }
protected ClenilClass(string ClenilSpeedTag, string EndTimeTag, string IniTimeTag, EquipamentType typeEq) { this.ClenilSpeedTag = ClenilSpeedTag; this.EndTimeTag = EndTimeTag; this.IniTimeTag = IniTimeTag; this.eq = this.eqFact.ConstructEquipament(typeEq); this.convert = new Convertion(typeEq); }
/** * Procesamos la respuesta * */ public void ProcesarRespuesta(string response) { //Convertimos el string a xml XmlDocument xmlDoc = Convertion.stringToXml(response); //Volcamos a un archivo de configuración GuardarEnArchivoConfiguracion(xmlDoc); }
protected GlicerolClass(string GliQtyTag, string OutFlowStartTag, string OutFlowEndTag, EquipamentType typeEq) { this.GliQtyTag = GliQtyTag; this.OutFlowStartTag = OutFlowStartTag; this.OutFlowEndTag = OutFlowEndTag; this.eq = this.eqFact.ConstructEquipament(typeEq); this.convert = new Convertion(typeEq); }
public override void SetDirection(Vector2 inputVector) { if (inputVector.magnitude > 0) { direction = Convertion.VectorToCardinal2(inputVector); lastDirection = direction; } }
protected LobulesClass(string EndTimeTag, string IniTimeTag, string RpmLimit, string lobulesSpeedTag, EquipamentType typeEq) { this.EndTimeTag = EndTimeTag; this.IniTimeTag = IniTimeTag; this.RpmLimit = RpmLimit; this.lobulesSpeedTag = lobulesSpeedTag; this.eq = this.eqFact.ConstructEquipament(typeEq); this.convert = new Convertion(typeEq); }
public RecipeModel(Recipe recipe) { ImageURL = recipe.image; RecipeName = recipe.title; PrepTime = Convertion.ToReadableTime(recipe.readyInMinutes); PricePerServing = string.Format("${0} per serving", Math.Round((recipe.pricePerServing / 100), 2)); Steps = SortThroughSteps(recipe.analyzedInstructions[0].steps); Ingredients = recipe.extendedIngredients; }
protected ClenilStrong(string ClenilSpeedStrongTag, string EndTimeTag, string IniTimeTag, string RpmLimitTag, EquipamentType typeEq) { this.ClenilSpeedStrongTag = ClenilSpeedStrongTag; this.EndTimeTag = EndTimeTag; this.IniTimeTag = IniTimeTag; this.RpmLimitTag = RpmLimitTag; this.eq = this.eqFact.ConstructEquipament(typeEq); this.convert = new Convertion(typeEq); }
public void Binary2Decimal() { string input = "1001110001000"; string output = "5000"; Convertion n = new Convertion(); string actual = n.Binary2Decimal(input); Assert.AreEqual(output, actual); }
public BeginOfManipulation(EquipamentType typeEq, string OperationName, string Product) { this.eq = this.eqFact.ConstructEquipament(typeEq); this.OperationName = OperationName; this.prod = ProductClass.GetProductClass(); this.basicInfo = BasicInfoClass.GetBasicInfo(); this.errorlog = new ErrorLog(); this.convert = new Convertion(typeEq); this.logAction = new LogAction(); }
public static void SpawnLoot(Vector2 loc, Item.Type type, int amount) { IsInitLootTest("SpawnLoot"); Vector2 nloc = Convertion.World2Location(loc); Loot l = (Loot)GD.Load <PackedScene>("res://Assets/Objects/Autres/Loot.tscn").Instance(); l.setLoot(type, amount); l.Position = nloc; parent.AddChild(l); }
public static void Spawn(int x, int y) { Grass s = (Grass)GD.Load <PackedScene>("res://Assets/Objects/Autres/Grass/Grass.tscn").Instance(); Game.root.AddChild(s); s.Material = (Material)s.Material.Duplicate(); s.Material.Set("shader_param/x", x); s.Position = Convertion.World2Location(new Vector2(x, y)); s.x = x; s.y = y; }
public void Convert() { if (Convertion.Count == 0) { GetConvertion(); } if (Convertion.ContainsKey(WoWheadZoneID)) { C = Convertion[WoWheadZoneID][0]; Z = Convertion[WoWheadZoneID][1]; } }
/* * Método principal para procesar una respuesta * */ public string procesar(string document, Dictionary <string, Tuple <RsaKeyParameters, SymmetricAlgorithm> > keyPairClients) { //Convertimos el string a xml XmlDocument xmlDoc = Convertion.stringToXml(document); string respuesta = ""; this._messageRecieve.parserStartRecievedMessage(xmlDoc); if (this._messageRecieve.MessageType == Constants.CONEXION_A) { this._messageRecieve.ParserSourceMessage(xmlDoc); AlmacenarClavePublica(xmlDoc); //Aquí iria una funcion para quitar el cifrado asimetrico // cript.CheckKey(this._messageRecieve.Source, this._messageRecieve.Key); respuesta = responderConexion(); } else if (this._messageRecieve.MessageType == Constants.CONEXION_B) { this._messageRecieve.ParserSourceMessage(xmlDoc); this._publicKeyClient = keyPairClients[this._messageRecieve.Source].Item1; DesencriptarParteDelDocumentoAsimetrico(xmlDoc); AlmacenarClaveSimetrica(xmlDoc); respuesta = responderConexion(); } else { ///Source xmlDoc = DesencriptarSourceAsimetrico(xmlDoc); this._messageRecieve.ParserSourceMessage(xmlDoc); string usuario = this._messageRecieve.Source; this._publicKeyClient = keyPairClients[usuario].Item1; this._symmetricKey = keyPairClients[usuario].Item2; //Desencriptamos xmlDoc = DesencriptarParteDelDocumentoSimetrico(xmlDoc); //Parseamos el mensaje this._messageRecieve.parserMessageRecieve(xmlDoc); //Ejecutamos el proceso XmlDocument xmlDocResponse = this._process.ejecutar(this._messageRecieve); //Creamos la respuesta respuesta = responder(xmlDocResponse); } //Mostramos la respuesta en el log log.Info("\n" + respuesta + "\n"); return(respuesta); }
//protected void ProdCategory_Combo_Init(object sender, EventArgs e) //{ // ASPxComboBox combo = sender as ASPxComboBox; // combo.DataSource = MRPClass.ProCategoryTable(); // ListBoxColumn l_value = new ListBoxColumn(); // l_value.FieldName = "NAME"; // l_value.Caption = "CODE"; // l_value.Width = 100; // combo.Columns.Add(l_value); // ListBoxColumn l_text = new ListBoxColumn(); // l_text.FieldName = "DESCRIPTION"; // l_text.Width = 350; // combo.Columns.Add(l_text); // combo.ValueField = "NAME"; // combo.TextField = "DESCRIPTION"; // combo.DataBind(); // combo.TextFormatString = "{1}"; //} private void ProdCat_DataBind() { ASPxListBox list = ProdCat_ListBox as ASPxListBox; list.Columns.Clear(); list.Items.Clear(); string monthyear = MonthYear_Combo.Text; //if (!string.IsNullOrEmpty(monthyear) && ((MOPNum_Combo.Value != null) || (CheckboxAll.Checked))) //if ((!string.IsNullOrEmpty(monthyear) && MOPNum_Combo.Value != null) || (!string.IsNullOrEmpty(monthyear) && CheckboxAll.Checked)) if (!string.IsNullOrEmpty(monthyear)) { if (!string.IsNullOrEmpty(MOPNum_Combo.Text.ToString()) || CheckboxAll.Checked) { string[] strarr = monthyear.Split(' '); string month = strarr[0].ToString(); string year = strarr[1].ToString(); string docnum = ""; int monthindex = Convertion.MONTH_TO_INDEX(month); if (!string.IsNullOrEmpty(MOPNum_Combo.Text.ToString())) { docnum = MOPNum_Combo.Text.ToString(); } //MRPClass.PrintString("pass"); //MRPClass.PrintString(docnum); list.DataSource = MRPClass.ProCategoryTable_Filter_SelectItemPO(Convert.ToInt32(year), monthindex, docnum); ListBoxColumn l_value = new ListBoxColumn(); l_value.FieldName = "NAME"; l_value.Caption = "Code"; l_value.Width = 100; list.Columns.Add(l_value); ListBoxColumn l_text = new ListBoxColumn(); l_text.FieldName = "DESCRIPTION"; l_text.Caption = "Description"; l_text.Width = 350; list.Columns.Add(l_text); list.ValueField = "NAME"; list.TextField = "DESCRIPTION"; list.DataBind(); list.ItemStyle.Wrap = DevExpress.Utils.DefaultBoolean.True; list.ClientEnabled = true; } } }
public override void _Ready() { Vector2 p = GetViewportTransform().origin *CurrentCamera.GetXZoom(); Vector2 vecMin = Convertion.Location2World(p) * -1; prev_x_viewport = vecMin.x; GetNode <Sprite>("OUTLINE").Material = (Material)GetNode <Sprite>("OUTLINE").Material.Duplicate(); GetNode <Timer>("TimerEnergy").WaitTime = 1.0f; timerEnergyWaitTime = GetNode <Timer>("TimerEnergy").WaitTime; timer = GetNode <Timer>("Timer"); }
/** * Procesamos la respuesta * */ public void ProcesarRespuesta(string response) { //Convertimos el string a xml XmlDocument xmlDoc = Convertion.stringToXml(response); xmlDoc = DesencriptarSourceAsimetrico(xmlDoc); //Desencriptamos el mensaje DesencriptarParteDelDocumentoSimetrico(xmlDoc); //Parseamos el mensaje this._messageResponse.parserMessageRecieve(xmlDoc); }
public static object Convert(string value, XmlNode typeDesc) { string typeName = typeDesc.Attributes["type"].Value; Convertion convertion = null; if (converts.TryGetValue(typeName, out convertion)) { return(convertion(value, typeDesc)); } else { throw new Exception("Unknowed type: " + typeName); } }
public static void Spawn_Enemy_Randomly() { r = rand.Next(0, 2); positionPlayer = new Vector2(PlayerMouvements.GetX(), PlayerMouvements.GetY()); positionPlayer = Convertion.World2Location(positionPlayer); if (r == 1) { Spawn_Enemy(PlayerMouvements.GetX() + 10, PlayerMouvements.GetY() + 50); } else { Spawn_Enemy(PlayerMouvements.GetX() - 10, PlayerMouvements.GetY() + 50); } }