Don't have an account? Register now to chat, post, use our tools, and much more.
Latest Headlines
Online Users
There are 122 users online: 6 members, 92 guests and 24 bots. Members: BinaryZyzzyva. Bots: VoilaBot (2), Spinn3r (1), MSN/Bing (2), Googlebot (19).
RSS & Social Media
SAX
You must log in to view the SAX chat widget
|
| Author |
Message |
|
souvik1997

Guru-in-Training

Joined: 19 Apr 2010 Posts: 2870
|
Posted: 08 Nov 2011 08:08:46 am Post subject: Doors CS SDK GUI |
|
|
Editor's Note: Added Cemetech Archives download link.
Download:
Doors CS SDK GUI
I made a rather simple GUI for the Doors CS SDK in C# yesterday, and it seems to be pretty functional. To run it, place this in the root of your Doors CS SDK folder (the folder in which your asm/ and basic/ folders are located), and put this in your asm/ folder. xcompile.bat is basically the same thing as compile.bat, except it returns values if the assembling was successful or not. Also, to use the "Send to WabbitEmu" feature, make sure WabbitEmu.exe is also in the same folder as DCSSDK.exe. The "Send to Calculator" feature doesn't do anything yet, though.
EDIT: Make sure you back up your ASM source files before trying my program. _________________ CALCnet Tournament-38%
deviantArt
 |
|
| Back to top |
|
|
KermMartian

Site Admin

Joined: 14 Mar 2005 Posts: 55884 Location: Earth, Sol, Milky Way
|
Posted: 08 Nov 2011 09:00:49 am Post subject: |
|
|
Oooh, this sounds pretty neat! When you choose to Open File, does an Assemble or Compile option appear? Thanks for working on this.  _________________
 |
|
| Back to top |
|
|
qazz42

Vampire Killer

Joined: 07 Apr 2010 Posts: 4179
|
Posted: 08 Nov 2011 09:20:37 am Post subject: |
|
|
of course, now I am inclined to do the same thing souvik
Nice job with this program, Souvik, works great for me so far. I don't see why I didn't think of doing something like this with my new System.IO knowledge.... Also, Kerm, what happens is that once you select the file, it instantly tries to compile.
edit: By the way, would it be too troubling for you if I could possibly have the source of the program? Just so I can look and play around with it _________________
 |
|
| Back to top |
|
|
souvik1997

Guru-in-Training

Joined: 19 Apr 2010 Posts: 2870
|
Posted: 08 Nov 2011 09:32:20 am Post subject: |
|
|
| qazz42 wrote: | of course, now I am inclined to do the same thing souvik
Nice job with this program, Souvik, works great for me so far. I don't see why I didn't think of doing something like this with my new System.IO knowledge.... Also, Kerm, what happens is that once you select the file, it instantly tries to compile.
edit: By the way, would it be too troubling for you if I could possibly have the source of the program? Just so I can look and play around with it |
Sure, you can have the source. My C# skills are terrible, though. _________________ CALCnet Tournament-38%
deviantArt
 |
|
| Back to top |
|
|
qazz42

Vampire Killer

Joined: 07 Apr 2010 Posts: 4179
|
Posted: 08 Nov 2011 09:35:01 am Post subject: |
|
|
I have been working with C# for quite a while now, if I see anything I could correct, i'll tell you. (doubt I am at that level though...) _________________
 |
|
| Back to top |
|
|
souvik1997

Guru-in-Training

Joined: 19 Apr 2010 Posts: 2870
|
|
| Back to top |
|
|
_player1537

Guru-in-Training

Joined: 25 Nov 2009 Posts: 2958
|
Posted: 08 Nov 2011 10:07:11 pm Post subject: |
|
|
No Microsoft prefixes for you, huh? It looks like it was pretty well made for the language, though I can't help but think it would work better as a Tcl/Tk script. It'd be nice if, in the future, it would remember where your WabbitEmu.exe is, and what your last file(s) were. _________________ http://tanner.myserverathome.com
 |
|
| Back to top |
|
|
souvik1997

Guru-in-Training

Joined: 19 Apr 2010 Posts: 2870
|
Posted: 08 Nov 2011 10:13:09 pm Post subject: |
|
|
I'm thinking of making a set-up "wizard" that downloads the SDK from Cemetech and sets it up for you, to make it even easier. I'll try to make it remember WabbitEmu's location and the previously assembled files as well. _________________ CALCnet Tournament-38%
deviantArt
 |
|
| Back to top |
|
|
KermMartian

Site Admin

Joined: 14 Mar 2005 Posts: 55884 Location: Earth, Sol, Milky Way
|
Posted: 08 Nov 2011 10:15:02 pm Post subject: |
|
|
That's a great idea! I think you should definitely do that. And as far as C# corrections, perhaps Merthsoft might have some feedback. _________________
 |
|
| Back to top |
|
|
Spyro543

Member

Joined: 17 Sep 2011 Posts: 131 Location: Ohio
|
|
| Back to top |
|
|
KermMartian

Site Admin

Joined: 14 Mar 2005 Posts: 55884 Location: Earth, Sol, Milky Way
|
Posted: 09 Nov 2011 10:41:56 am Post subject: |
|
|
| _player1537 wrote: | | I can't help but think it would work better as a Tcl/Tk script. | Why do you say that? Wouldn't that require users to install much more stuff than just distributing a .exe compiled from the C# program? _________________
 |
|
| Back to top |
|
|
qazz42

Vampire Killer

Joined: 07 Apr 2010 Posts: 4179
|
|
| Back to top |
|
|
benryves

Cemetech Expert

Joined: 12 Aug 2008 Posts: 1361 Location: London, United Kingdom
|
Posted: 09 Nov 2011 03:37:56 pm Post subject: |
|
|
You claim that your "C# skills are terrible" - the most important thing is getting something to work, so they can't be all that terrible - good job. Bearing that in mind, here are some things I spotted in a quick look through your source code:
Code: int a = (int)openFileDialog1.ShowDialog();
if (a == 1)
The whole point of enums is to assign meaningful names to integral constants, so turning it into an integer and comparing against a magic number is a strange thing indeed:
Code: if (openFileDialog1.ShowDialog() == DialogResult.OK)
The use of backslashes in file paths is not a great plan, either; it leads to ugly code (either "folder\\path" or @"folder\path") and won't work on operating systems that don't use the backslash as the path separator (e.g. Linux). Use Path.Combine to build up paths:
Code: File.Copy(fileName, rootDirPath+"\\asm\\source\\" + filename2, true);
// should be:
File.Copy(fileName, Path.Combine(rootDirPath, "asm", "source", filename2), true);
In a similar vein, don't use the string manipulation routines to parse paths - the Path class is a better bet as it produces clearer code and is less work for you:
Code: String[] fileArray = fileName.Split('\\');
String filename2 = fileArray[fileArray.Length - 1];
// should be:
string filename2 = Path.GetFileName(fileName);
// and this:
String[] files2Array = filename2.Split('.');
String filename3 = files2Array[0];
// should be:
string filename3 = Path.GetFileNameWithoutExtension(fileName);
I'd recommend using exceptions for structured error handling rather than return codes; I'm sure I don't need to tell you what's wrong with this idiom:
Code: try
{
// something that may fail
}
catch { }
Meaningful variable names are very useful to producing clean code - just because the default name for a control is button1 doesn't mean you can't change it. \\asm\\source\\ |
|
| Back to top |
|
|
souvik1997

Guru-in-Training

Joined: 19 Apr 2010 Posts: 2870
|
Posted: 09 Nov 2011 04:57:03 pm Post subject: |
|
|
Thanks for the corrections, benryves. I'll be sure to change that when I get home. _________________ CALCnet Tournament-38%
deviantArt
 |
|
| Back to top |
|
|
_player1537

Guru-in-Training

Joined: 25 Nov 2009 Posts: 2958
|
Posted: 09 Nov 2011 06:18:17 pm Post subject: |
|
|
| KermMartian wrote: | | _player1537 wrote: | | I can't help but think it would work better as a Tcl/Tk script. | Why do you say that? Wouldn't that require users to install much more stuff than just distributing a .exe compiled from the C# program? | Mostly because it seemed like it was just buttons, and (I assume) that Tcl has an easy way to execute programs and open files, which seems to be most of what this is. I had originally said Bash, simply because Bash is for opening files, but changed my mind since I wasn't sure if Tk worked in a non-hacky way in Bash. Also, I was saying that in a "It would be fun to write it on Linux" sort of way  _________________ http://tanner.myserverathome.com
 |
|
| Back to top |
|
|
souvik1997

Guru-in-Training

Joined: 19 Apr 2010 Posts: 2870
|
|
| Back to top |
|
|
qazz42

Vampire Killer

Joined: 07 Apr 2010 Posts: 4179
|
Posted: 09 Nov 2011 08:45:30 pm Post subject: |
|
|
hmmm, I am not familiar with downloading files with C#< but I would assume that you have to increase the Value property of the ProgressBar while the file is downloading. perhaps the amount of bytes of the file currently downloaded could be stored in a value, and as that value increases, so does the ProgressBar Value? _________________
 |
|
| Back to top |
|
|
benryves

Cemetech Expert

Joined: 12 Aug 2008 Posts: 1361 Location: London, United Kingdom
|
Posted: 09 Nov 2011 08:53:01 pm Post subject: |
|
|
I hope this makes sense; it assumes a button named "downloadSdk" and a progress bar named "downloadSdkProgress" with a Minimum of 0 and a Maximum of 100.
Code: WebClient sdkDownloader = null;
private void downloadSdk_Click(object sender, EventArgs e) {
// Are we currently downloading something?
if (sdkDownloader != null) {
System.Media.SystemSounds.Beep.Play();
return;
}
// Create a new WebClient to download the file.
sdkDownloader = new WebClient();
// We need to handle the "ProgressChanged" and "FileCompleted" events.
sdkDownloader.DownloadProgressChanged += new DownloadProgressChangedEventHandler(sdkDownloader_DownloadProgressChanged);
sdkDownloader.DownloadFileCompleted += new AsyncCompletedEventHandler(sdkDownloader_DownloadFileCompleted);
// Start downloading the file.
sdkDownloader.DownloadFileAsync(new Uri("http://i.imgur.com/bjxgb.jpg"), "image.jpg");
}
void sdkDownloader_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e) {
// Update the progress bar.
// See http://msdn.microsoft.com/en-us/library/ms171728.aspx for why BeginInvoke is a good idea.
BeginInvoke(new MethodInvoker(() => {
downloadSdkProgress.Value = e.ProgressPercentage;
}));
}
void sdkDownloader_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e) {
// Dispose the SDK downloader.
sdkDownloader.Dispose();
sdkDownloader = null;
MessageBox.Show("File downloaded!");
}
|
|
| Back to top |
|
|
KermMartian

Site Admin

Joined: 14 Mar 2005 Posts: 55884 Location: Earth, Sol, Milky Way
|
Posted: 10 Nov 2011 09:35:17 am Post subject: |
|
|
Interesting. I was curious how frequently the DownloadProgressChangedEvent fires, whether it's every byte, every relevant incoming packet, or some larger increment, but unfortunately I don't see much on that in the documentation. _________________
 |
|
| Back to top |
|
|
souvik1997

Guru-in-Training

Joined: 19 Apr 2010 Posts: 2870
|
Posted: 10 Nov 2011 10:12:26 pm Post subject: |
|
|
Woo, progress!
Download links:
DCSSDK.exe
Ionic.Zip.dll
Later, I'm going to merge the DLL and the EXE together with ILMerge, but as of right now you need to have the DLL in the same directory as DCSSDK.exe. Also, to re-run the setup wizard, go to %APPDATA%\dcssdk\ and delete settings.txt.
Edit: Creating desktop shortcuts doesn't work yet. _________________ CALCnet Tournament-38%
deviantArt
 |
|
| Back to top |
|
|
|
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.
» Go to Registration page
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
© Copyright 2000-2013 Cemetech & Kerm Martian :: Page Execution Time: 0.045840 seconds.
|