Jump to content
Xtreme .Net Talk

bpayne111

Avatar/Signature
  • Posts

    335
  • Joined

  • Last visited

Everything posted by bpayne111

  1. that's my whole issue... reduce redundancy while keeping accuracy files can be thousands of lines if i check it twice i would be wasting a lot of time and resources can i implement the checksum of a file to see if it has changed from the last time it was caught by filesystemwatcher? i never thought this would be so difficult thanks for the help brandon
  2. sorry i guess tha twas pretty generic... a template like the ones when you add a new item to a project. I have a windows form i'd like to add to it. thanks brandon
  3. ohh i thought that was the length of the filename whoops... can you think of any other ideas that would make this work flawless?
  4. all better Environment.NewLine is the answer i need. i searched some old posts to find it. thanks brandon
  5. now i know how i forgot it.... becuase it doesn't work in C#... arrrg what's the = to Chr(13) in C# thanks brandon
  6. chr(13) how could i forget an old favorite like that thanks
  7. I have a multiline text box which i would like to add multiline text to. i tried to accomplish this like so. private void WhoCares() { _textCreated += ("Public " + words[1] + " " + words[2] + "()\n {get{return " + words[2] + ";}/n + "set{ " + words[2] + "= value;}/n}"); txtProperties.Text = _textCreated; } the "/n" is not creating new lines though it is simply displayed in the text. am i going to have to edit the Lines[] property directly? that seems like a lot of work compared to /n..... is there a 3rd way? thanks brandon
  8. i remember someone stating it was possible to create your own templates. Is there a tuturial on how to do such a thing? Instead of making real world apps i keep getting stuck making tools to make real world apps faster.. i just can't help it. thanks brandon
  9. ohhh happy day i just discovered i can use c# and vb files in the same project that is by far my best solution becuase a few files are 1000 plus lines and objects in the vb file are being redeveloped in C#. so i think everything is good now will i come about any problems doing my project in 2 languages at once? i hope not because i sure do not want to re write thousands of lines of code. thanks brandon
  10. yes i've considered many ways of nullifying the extra event. The problem is i can not simply just use a string to see if it's the same file being used each time because the file might be edited twice in a row legitimatly. i've considered using the filename and the LastAccessTime or LastWriteTime property of a file. but even then i'm assuming that a file is never accessed or written too twice in the same minute. That's as fool proof as i can think to get it. There is a thing called Lightning chess and it is quite popular among players. Lightning chess games are usually less than 2 minutes long. Making it very possible to lose in less than a minute. If a game like that was played immediatly after any other game and the program being used Appended a file each time a game was completed. Then the game would not be recorded. My third idea to help kill that bug was to use the size of a file as a determining factor. The problem is i can't find a way to determine the file size (i'm embarassed to say that one). The only assumption with that idea is. A user edited the file manually, saved it, immeditatly saw the mistake and corrects it in a way that the file size does not change. If that situation happens in less than a minute once again the edit is missed. So i'll need a third stipulation to completly verify everything... but now i'm out of ideas besides completly checking every line of the file. Which is a very bad idea in this case because files can contain thousands of chess games at once. In case you've forgotten the Questions are HOW DO I RETRIVE THE FILE SIZE? WHAT ELSE CAN I CHECK TO MAKE IT FOOL PROOF? What's a chess nerd to do? brandon sorry it's so long of a post... just decided to break down what's going on to the fullest
  11. If i add a .dll file (add existing item, not a reference) to my new class library project. will all of the methods of the added library be included in my new library? i have user control and other classes developed in vb and now i'd like to add them to my new c# project but keep them all bundled in one nice file. thanks brandon
  12. The final goal is to have the FileSystemWatcher find new chess games and from it's methods add those games to a database (for now a text file is my temporary database). When a new chess game created... the created and changed events are both called twice... i'd like to stop that or at least make sure that i'm not being redundant with my file access. thanks brandon
  13. well what i found was that a change event occurs as well and calling my method during the change even worked fine. It turns out nullifying the 'double' call to the Created and Changed method is harder than i thought... i've considered some ways of dealing with it but all have a bug somewhere... is there a fool proof way of canceling the extra create and changed events? i'd like to learn the basics of threading... where should i start? thanks for the code that alone teaches me some about threading brandon
  14. bpayne111

    bin

    all is answered now thank you
  15. bpayne111

    bin

    thank you
  16. first off here's the code #region Declarations FileSystemWatcher _watcher = new FileSystemWatcher("C:\\" ,"*.pgn"); #endregion private void frmMain_Load(object sender, System.EventArgs e) { _watcher.IncludeSubdirectories = true; _watcher.EnableRaisingEvents = true; } private void _watcher_Created(object sender, System.IO.FileSystemEventArgs e) { StreamReader sr; StreamWriter sw; try { sr = new StreamReader(e.FullPath); sw = new StreamWriter("AutoCompiledChessGames",true); while (sr.Peek() != -1) { sw.WriteLine(sr.ReadLine()); } sr.Close(); sw.Close(); } catch (Exception err) { MessageBox.Show(err.Message); } } When this code is run and a .pgn file is created the _watcher_Created event fires twice (that's expected) i can get around that fairly easily... my problem though is that i get different exceptions thrown when i run this method. Sometimes i will get "FileNotFoundException" and sometimes i will get "This file is in use by another program" (Note a step through in the debugger works though; although it does call the event twice so my file is written twice.) it seems as if with the FileNotFoundException that the watcher is doing it's job so well that the file isn't actually created yet when the event fires. The second seems to be that the file is in the process of being written to so therefore cannot be accessed. My question is... How can i ensure that the file is ready to be read by my program. So that i can write it's data to my file. Is there a method that checks for a files status? looks like i'm hitting the books on this one i hope someone has some info for me thanks brandon
  17. bpayne111

    bin

    When filenames are used in code in vs.net projects, if they have no path included they go to the bin by default. I think that is wonderful but, when an application is distributed it brings an issue to mind. If i create a file with a filestream and set it's filename to "myfile.ext" obviously it goes to the bin but if i distribute this application where does it go? If it throws an exception in this case. What can i use to create the same effect on the distributed app? I vaguely rememebr the Application.Path method but i believe that was vb 6 or something. To take it a little deeper... Would throwing this file in the current users "My Documents" folder automatically be a bad idea? thanks brandon
  18. Ignore this *** ignore this**** i fixed it well more problems i began my project declaring a new file system watcher #region Declarations FileSystemWatcher _watcher = new FileSystemWatcher("c:\","*.pgn"); #endregion private void frmMain_Load(object sender, System.EventArgs e) { } the errors is in "c:\" the '\' is not acknoledged because it is used to format strings. how do i input the '\' char correctly in code? i'm hitting the help files now i know this is a simple bug and i should alraedy know how to fix it but i don't. brandon
  19. ok thanks guys i'll get started on it tonight and see what comes about thanks brandon
  20. so watching the entire root directory for one file type (in my case .pgn) all the time will not bog down the system? that is my biggest concern. If that is the case i can dump the whole user input completely. thanks brandon
  21. yes i was aware of having multile FileSystemWatchers. My concern is if i have some file system watchers watching the root directory and some folders won't that bog down my system a ton? i know nothing about threading. What would i do with the threads? and how would they help my app? thanks for the help your time is appreciated i'm trying to explore this program fully before diving in head first brandon
  22. Me.Close is vb's version of C#'s this.Close(); if you don't like the taskbar issue showing up when you open the form then change it's ShowInTaskbar property to False brandon
  23. you could put a frame around them ie put a frame around each radio button and text box combo... set the text boxes border to none and use the frames to mimic it. Or your could make your own user control. brandon
  24. whoops you meant in code... sorry dunno about that
  25. you can add a concatenated field to a dataset using the xml schema. there is a visual utility to do so add an E (element) to the dataset and make the text beside it 'fieldname' + 'fieldname' + 'field name the & character will not work you must use + brandon
×
×
  • Create New...