Replacing a PDF file for another in VS solution - c#

I have a PDF document in the downloads folder of my solution that needs updating. I have the new file to replace it, but I am not sure how to accomplish this.
This seems like it should be straight forward, however I am not seeing an obvious solution.
Any help will be appreciated.

First off remember to not be running the application...silly me.
Check the file out. Then click on the folder and select Add-->Existing Item.
Like I said, it should be fairly straight forward. Between running the application and not checking out the file first I stumbled around.

Related

How can Unity ignore FMOD Cache files when syncing with PlasticSCM?

My dev team is having an issue when trying to add certain files to the ignore.conf file for PlasticSCM. When we try to add the FMODStudioCache.asset and fmod_editor.log, among other FMOD related files, to this config file, they just continue to appear in Unity when receiving pushes and readying a push locally.
It has become very annoying to deal with because it doesn't seem to work as it is intended to. See below the lines we have tried to prevent it from showing up.
**/Assets/Plugins/FMOD/Cache/Editor/FMODStudioCache.asset
**/Assets/Plugins/FMOD/Resources/FMODStudioSettings.asset
fmod_editor.log
# Ignore the Cache folder since it is updated locally.
/[Aa]ssets/Plugins/FMOD/Cache/*
[Aa]ssets/Plugins/FMOD/Cache/*
Assets/Plugins/FMOD/Cache/*
Image link of Unity PlasticSCM with
Sorry, I don't have enough posts yet so it makes me use a link above!
Has anyone found a solution to this? We have tried to even add the files to the hidden config file too and that doesn't work either... Thanks in advance !
Edit: Spelling error in question.

Starting an executable with a custom configuration file

I am working on a simple C# project that calls for me to launch a program, pointing it at a custom configuration file. Specifically, I'm launching DOSBox with a custom config file that tells it what to do upon starting. I've used shortcuts before, and essentially this is what I put in the shortcut and it works perfectly.
"D:\Video Game Emulation\DOSBox\DOSBox.exe" "D:\Video Game Emulation\DOS Windows\GAMES\CUSTOM.CONF"
Now the program I'm writing is just a prettier way of launching a bunch of old DOS games through DOSBox, each with their own custom config. So in my button code, here's what I have.
Process.Start("D:\\Video Game Emulation\\DOSBox\\DOSBox.exe", "D:\\Video Game Emulation\\DOS Windows\\GAMES\\CUSTOM.CONF");
According to my understanding that is the proper way to start an executable and give it a custom option. However, that launches just fine, but doesn't pass in the config file properly. I also tried this.
Process.Start("D:\\Video Game Emulation\\DOSBox\\DOSBox.exe", -conf "D:\\Video Game Emulation\\DOS Windows\\GAMES\\CUSTOM.CONF");
With no luck either. Anyone know what I need to change in order for it to give DOSBox the custom configuration file properly?
Pass in the path as a string, so put your quotation marks in and test it.
Basically the reason is when checking Intellisense (spelling?), it shows an overload for Start(string fileName, string arguments).
So it wouldn't hurt to make sure you are passing strings into both.
Edit: I think I may have seen it before you edited your post. Did you have the quotation marks in the code?
OK, sorry it has taken so long to get back to this thread, but I've been quite busy. Thanks to help from dakre18, StarPilot, and Bearcat9428 I figured it out. It seems that the working directory has to be specified in the StartInfo in order for it to work. Things seem to work now. Thanks for all your help everyone!

Is it possible to disable file indexing in a specific directory?

I have a project with many many files (100k+) that I am processing. I would like to save some CPU time by disabling directory indexing, but I need to do it programmatically because this application will be used by multiple people with varying technological skillsets.
I wasn't sure where to start with this, so hopefully someone here can point me in the right direction!
I figured this out finally.
File.SetAttributes(Core.Main.pictureBox1.ImageLocation, FileAttributes.NotContentIndexed);
http://msdn.microsoft.com/en-us/library/system.io.fileattributes(v=vs.110).aspx

Cygwin Commands from Web Service ASP.NET C#

I want to execute a cygwin command from within a webservice.
Basically I want to use the "tail" command to strip off the first line of a file in C#.
Calling another program just to strip the first line of a file sounds like a very bad idea. You might want to try and just strip the first line in C#.
I've not personally dealt with huge text files before, so I did a bit of searching around;
Efficient way to delete a line from a text file
Basically, this one gives an answer you don't like, but if .NET 4 is an option memory-mapped files might help you out.
Are you looking to remove it or read it? If you want the first line of the file, you can just open the file stream (File.Open) and take the first line.
Normally Cygwin is installed in C:\CYGWIN so you should be able to run tail (from /usr/bin) by calling "C:\cygwin\usr\bin\tail.exe" from your code.
That said, you really should not be doing this at all. Just use a StreamReader properly. This question has a nice example to show how: Reading large text files with streams in C#

Visual studio 2010 empties the file on crash

I got a really bad problem while working on visual studio 2010. Accidently the power plug switched off and when I started the computer again the file was completly empty. I tried out following things:
I opened it in notepad and other couple of editors and it was empty.
I then opened it in Hex Editor. Hex editor shows that all bytes are set to 0.
I programatically read the file and it also showd all bytes set to 0.
Checked "Documents\Visual Studio 2010\Backup Files\" for my project and it was empty.
The file size is still showing in KBs but the code is completly gone.
Is there any possible way by which I can recover my code?
If there is not, can anyone suggest me a setting/patch taht should be there so that it never happens again.
Note: I already have Autorecover option set for every 5 minutes in IDE.
Update:
As suggested by Henok, If you have compiled and built the code at least once, you can reverse engineer the binary through reflector.
Doesn't look like it, to stop in future though, save and save often. Also look at using subversion like svn, or Git.
IIS has DLLs cached under C:\Windows\Microsoft.NET\v4.0.xyz\Temporary ASP.NET Files. Look for the dll and use a reflector. I use ILSpy.
Save often and use source control. I use C.V.S., personally.
It sounds like the I.D.E. had the file(s) open for writing at byte 0 when the computer went down, clearing everything out.
Beyond your software problems, I suggest you manage your power plug in such a way that it won't be accidentally switched off.
Same thing happened to me and thought I would post it here for those who would come here for answers.
If you have compiled and built the code at least once, you can reverse engineer the binary. Reflector did the trick for me.
Visual Studio still makes source files empty on sudden crashes, so I think I should share my solution.
Use any cloud file syncing service that supports file versions (for deleted files, too). Dropbox and Google Drive is what I can name. I randomly preferred Google Drive, though Dropbox can do all the same things.
I simply put my source tree in Google Drive, because it has file versions. My builds happen in Google Drive too, so there's much of unwanted traffic for big projects, but you can exclude some subfolders from syncing.
The drawback is that sometimes (in rare cases) Google Drive locks files and Visual Studio pops up "Save As..." dialog or some messages. You can usually close it, then save again successfuly. In very rare cases I had "The file is used by process" errors, and I had to restart Google Drive.

Categories