|
|
And with a response like that you are hoping for support from a bunch of volunteers. If you don't like the response he gives you then ignore him as you will probably be ignored in the future.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hello,
I have a probleme with the animation of my caracter. The animation run when my caracter stay put. I use Unity3D
<br />
using System.Collections;<br />
using System.Collections.Generic;<br />
using UnityEngine;<br />
<br />
public class PlayerMove : MonoBehaviour {<br />
<br />
private Animator anim;<br />
private CharacterController charController;<br />
private CollisionFlags collisionFlags = CollisionFlags.None;<br />
<br />
private float moveSpeed = 5f;<br />
private bool canMove;<br />
private bool finished_Movement = true;<br />
<br />
private Vector3 target_Pos = Vector3.zero;<br />
private Vector3 player_Move = Vector3.zero;<br />
<br />
private float player_ToPointDistance;<br />
<br />
private float gravity = 9.8f;<br />
private float height;<br />
<br />
void Awake () {<br />
anim = GetComponent<Animator> ();<br />
charController = GetComponent<CharacterController> ();<br />
}<br />
<br />
void Update () {<br />
MoveThePlayer ();<br />
charController.Move (player_Move);<br />
<br />
}<br />
<br />
void MoveThePlayer() {<br />
if (Input.GetMouseButtonDown (0)) {<br />
Ray ray = Camera.main.ScreenPointToRay (Input.mousePosition);<br />
RaycastHit hit;<br />
<br />
if (Physics.Raycast (ray, out hit)) {<br />
if(hit.collider is TerrainCollider) {<br />
<br />
player_ToPointDistance = Vector3.Distance (transform.position, hit.point);<br />
<br />
if (player_ToPointDistance >= 1.0f) {<br />
canMove = true;<br />
target_Pos = hit.point;<br />
}<br />
}<br />
<br />
}<br />
<br />
<br />
<br />
}<br />
<br />
if (canMove ) {<br />
anim.SetFloat ("Walk", 1.0f);<br />
<br />
Vector3 target_Temp = new Vector3 (target_Pos.x, transform.position.y, target_Pos.z);<br />
<br />
transform.rotation = Quaternion.Slerp (transform.rotation,<br />
Quaternion.LookRotation (target_Temp - transform.position),<br />
15.0f * Time.deltaTime);<br />
<br />
player_Move = transform.forward * moveSpeed * Time.deltaTime;<br />
<br />
if(Vector3.Distance (transform.position, target_Pos) <= 0.5f) {<br />
canMove = false;<br />
}<br />
<br />
} else {<br />
player_Move.Set (0f, 0f, 0f);<br />
anim.SetFloat ("walk", 0f);<br />
}<br />
<br />
}<br />
<br />
}<br />
<br />
If someone can help me I would be grateful
|
|
|
|
|
Too many "if's".
Just "move" in the Update to test that you can actually "move"; then add the "if's".
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
hello
i want to edit a file by c# string by this code
string text = File.ReadAllText(@"c:\a.txt", Encoding.UTF8);
string text1 = text.Replace("xx", XX");
File.WriteAllText(@"d:\a.txt", text1);
i want to search in string and when find example replace exam\ple and 4 word after exam\ple with exam\plexxxx
problem is i dont know what is the 4 word and i want replace.
i want any like * in windows seach.
in windows search * can support all character.
|
|
|
|
|
There is no wildcard support in the Replace method. You're going to have to write your own code to do search and replace with support for wildcards.
|
|
|
|
|
Sounds to me like a case for Regular expressions[^] Google will have lots of help.
Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012
|
|
|
|
|
Get the ".IndexOf" your "keyword".
Then "string.Split" the rest into tokens / words; delimited by space, coma, etc.
The first 4 tokens are your "any character words".
Replace that part of the string between the "keyword" and the last word.
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
Looks like homework to me. And I suspect (and hope) the teacher has been teaching you something and that something is how you are supposed to be doing this.
|
|
|
|
|
i want to to write a program to correct program by edit one of bad file
|
|
|
|
|
That's different: in that case you definitely need a different approach. Reading and treating an executable file as text will corrupt the file; what you end up with is not going to be a valid executable, because the "translation" from the on-disk binary to text loses information, and the when you write it that cannot be recovered.
You would need to read the file as binary, handle it as binary, and write it back as binary as well.
But you also don't want to use the root folder of any drive: the access is restricted and likely to become more restricted in future.
Why do you think a program has a "bad file" that a simple text replace will fix?
Sent from my Amstrad PC 1640
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
my file is text file and not executable
this text file edit by program every run it but i want change one number after "id-number="
i dont know id-number in file but i want to change by my id number.
|
|
|
|
|
If you don't know the number you are replacing, then you need to look closely at the file, and check that the sequence "id-number=" only appears where you want to change it - that looks like a XML or config file and it's not guaranteed to have just a single occurrence.
But changing that is a text file is trivial: a basic regex will do it:
public static Regex regex = new Regex(
"(?<=id-number=)\\d+",
RegexOptions.IgnoreCase
| RegexOptions.CultureInvariant
| RegexOptions.IgnorePatternWhitespace
| RegexOptions.Compiled
);
public static string regexReplace = "98765";
...
string result = regex.Replace(InputText,regexReplace);
Sent from my Amstrad PC 1640
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
i do it by replace method but i have a problem
look to this please
i have : id number="5421" note:5421 is different by any run program
and i want to replace by : id number="2223"
i can replace "idnumber=" by "idnumber="2223"" but 3 number of old idnumber add to my file and my file corrupt.
this file is xml and i comment it this number but program detect Extra numbers and not run.
i want a command to can select by this method
string text1 = text.Replace("hostport=\"****\"", "hostport=\"2262\"");
and * mean is all character support.
thank you for replay
|
|
|
|
|
You can't use String.Replace - it doesn't support wildcards at all, that's why Regular Expressions exist. Look at what I gave you and get a copy of Expresso[^] - it's free, and it examines and generates Regular expressions.
Sent from my Amstrad PC 1640
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
thank you
regex support and my problem solved
|
|
|
|
|
You're welcome!
Sent from my Amstrad PC 1640
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Hi, i have MVC website application that is working slow from the client side, when opening a page ii takes 5-10 seconds.
when i using the website on the server its working fast.
the server is working fine, there are no cpu or memory problems.
we are using local network that is working fine with other systems.
what can cause this problem? are there any network configuration that i can add to the web.config that can helps?
|
|
|
|
|
Sou you have a local network with a server and some clients and on one client the loading is slow while it is OK with the others?
Then it is a problem of that specific client.
It may be hardware related (switch, cables, network card) which should be indicated by other network operations being slow too.
The system may be also badly configured (e.g. by prioritising specific protocols).
Finally, it can be sourced by other tasks performing huge network transfers. Then the problem should be gone once these tasks are done.
In any case it is not related to C#. We can also provide no further help because we have no access to your systems. If you have a network administrator at your side, ask him for help.
|
|
|
|
|
Gurus,
I have a c# windows form application. There is a PictureBox within a Panel. An image is loaded in the PictureBox. I want the image to be zoomed the area user selects. The user will select by dragging using the left mouse button. What i did is on the mouse down event, i saved the x/y in a variable and in mouse move event i am drawing the rectangle plus i am recording the x/y of the current position in another variable. And in mouse up event, i create a rectangle of the size of the selection made. And i create a bitmap using the rectangle's width and height. Then I created a graphics object using the created bitmap. Then i use the DrawImage function to draw the image to the bitmap created and assigned to the PictureBox. But it always takes the x/y coordinates from 0,0.
Please help
Vinu
|
|
|
|
|
|
Hello Everyone!
I am using Visual C# to make a program, which compiles a code from string to export a new exe.
the first can update some configs for the second, when i try to run the second program i get this Exception:
The specified string is not in the form required for an e-mail address.
While the code is:
try
{
MailMessage mail = new MailMessage();
SmtpClient SmtpServer = new SmtpClient(""smtp.gmail.com"");
mail.From = new MailAddress(Config.username);
mail.To.Add(Config.toEmail);
mail.Subject = Config.subject; ;
mail.Body = text;
if (sendImage)
{
var stream = new MemoryStream();
img.Save(stream, ImageFormat.Jpeg);
stream.Position = 0;
mail.Attachments.Add(new Attachment(stream, ""image / jpg""));
}
SmtpServer.Port = Config.smtpPort;
SmtpServer.Credentials = new System.Net.NetworkCredential(Config.username, Config.password);
SmtpServer.EnableSsl = true;
SmtpServer.Send(mail);
Console.WriteLine(""Email has been sent!"");
}
catch (Exception e) { Console.WriteLine(e.Message); }
|
|
|
|
|
That's not valid C#: strings are delimited by a single double quote at each end, not two.
And that code does nothing with EXE files, it's to do with emails ...
Sent from my Amstrad PC 1640
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Member 13858110 wrote: <When i try the code alone, it works normally, while when i use to compile the code my self i get the error. It is not a compiler error, but an exception thrown at runtime.
mail.From = new MailAddress(Config.username);
mail.To.Add(Config.toEmail); One of those two isn't a valid email-address.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Tried to use email for both, but still the same error, while when i use Console.WriteLine(email, password); it shows the same as the ones ive written.
|
|
|
|