C# Help

Started by G_G, September 15, 2009, 12:18:13 am

Previous topic - Next topic

Blizzard

STILL under development? O_o Geez, one would expect that they finally made some progress. But at least they are still working on it.

Yeah, that's true with the open source-closed source problem. MS did release .NET 1.0 as open standard, but they never did it for 2.0 or later so it's understandable why there are problems. But at least they have an interface they can implement even though the inner implementation might not be that good. (Maybe I should join the Mono dev team O_o)
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

fugibo

Quote from: Blizzard on September 28, 2009, 04:48:39 am
STILL under development? O_o Geez, one would expect that they finally made some progress. But at least they are still working on it.

Yeah, that's true with the open source-closed source problem. MS did release .NET 1.0 as open standard, but they never did it for 2.0 or later so it's understandable why there are problems. But at least they have an interface they can implement even though the inner implementation might not be that good. (Maybe I should join the Mono dev team O_o)


You've got a slight misunderstanding about OSS - it's not really "done" until it implements every feature it can as stable and fast as it can on every platform it can. In other words, it's constantly "under development," which doesn't mean that no progress has been made, just that "not everything is finished yet."

Blizzard

No, I got it wrong before that. I thought that they weren't doing anything before my post. As I said, at least they get something done even if the progress is quite slow.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

G_G

October 04, 2009, 11:59:52 pm #43 Last Edit: October 05, 2009, 12:26:14 am by game_guy
Okay I had a cool idea, now I got it to work for the most part. You all know I'm making a browser so this is what I decided I'll be releasing updates for it alot so I made an updater. The farthest I got was it actually downloading but I cant get it to extract the zip

Anyhelp on extracting a zip file?

EDIT:
Okay well remembering google is my friend I googled it and figured it out. So now when my web browser is released it'll come with am automatic updater. :D AWESOMNESS!!

fugibo

Quote from: game_guy on October 04, 2009, 11:59:52 pm
Okay I had a cool idea, now I got it to work for the most part. You all know I'm making a browser so this is what I decided I'll be releasing updates for it alot so I made an updater. The farthest I got was it actually downloading but I cant get it to extract the zip

Anyhelp on extracting a zip file?

EDIT:
Okay well remembering google is my friend I googled it and figured it out. So now when my web browser is released it'll come with am automatic updater. :D AWESOMNESS!!


Too bad that that functionality breaks the instant you change webhosts.

Blizzard

I wonder how www.chaos-project.com was able to always remain the same regardless who the actual webhost was. Hm, hm. What a big mystery that is. And I wonder even more what URLs are good for.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

G_G

October 05, 2009, 02:59:03 pm #46 Last Edit: October 05, 2009, 05:23:38 pm by game_guy
hmmm hmm so many questions hmm hmm
@lf: I used a url and it works perfectly. Downloads it, then extracts the zip file, then closes the browser so updates can take place.

EDIT:
Okay just a question..so I have my file on my host, now how would I like make it go to another host to get the file, if the firsthost is down? Here's my code.

WebClient download = new WebClient();
byte[] filedata = download.DownloadData("first host here");
FileStream file = File.Create(Application.StartupPath + "\\update.zip");
file.Write(filedata, 0, filedata.Length);
file.close();


Now last night my host was down so it couldnt download the file, so I want it to be able to go to another host if it cant access the first. Is it possible? if so how?

Ryex

October 06, 2009, 02:16:22 am #47 Last Edit: October 06, 2009, 02:17:26 am by Ryexander
so I'm building a RMX-OS GUI (just as kind of a learning exsperience)

here's the code
Spoiler: ShowHide

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
   public partial class RMX_OS_GUI : Form
   {
       string filePath = "";
       public RMX_OS_GUI()
       {
           InitializeComponent();
       }

       private void spathbutton_Click(object sender, EventArgs e)
       {
           
           openFileDialog.Title = "Server File Location";
           if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
           {
               filePath = openFileDialog.FileName;
               spathstb.Text = filePath;
           }
       }

       private void openFileDialog1_FileOk(object sender, CancelEventArgs e)
       {

       }

       private void spathstb_TextChanged(object sender, EventArgs e)
       {
           filePath = spathstb.Text;
       }

       private void run_server_button_Click(object sender, EventArgs e)
       {
           if (filePath != "")
           {
               RmxosProcess.EnableRaisingEvents = true;
               RmxosProcess.StartInfo.FileName = filePath;
               RmxosProcess.Start();

           }
       }

   }
}



browsing for the file path and saving it to filePath works fine it's when i press the run button

this code is exacuted

private void run_server_button_Click(object sender, EventArgs e)
       {
           if (filePath != "")
           {
               RmxosProcess.EnableRaisingEvents = true;
               RmxosProcess.StartInfo.FileName = filePath;
               RmxosProcess.Start();

           }
       }

the problem is that the ruby prompt just flashes up or a fraction of a second and disappears (closes as if the file didn't have any puts commands)
is there a way to get it to really run the server?

and yes I've learned all that in a few hours for those who were wondering
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

Blizzard

Try adding "ruby " before the filepath.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Ryex

nope I even tried this

private void run_server_button_Click(object sender, EventArgs e)
        {
            if (filePath != "")
            {
                RmxosProcess.EnableRaisingEvents = true;
                RmxosProcess.StartInfo.Arguments = filePath;
                RmxosProcess.StartInfo.WorkingDirectory = "C:\ruby\bin";
                RmxosProcess.StartInfo.FileName = "ruby.exe";
                RmxosProcess.Start();

            }
        }


started the ruby.exe and then passed the file name as a parameter
same effect

also if you type
C:\ruby\bin\ruby.exe C:\Users\Ben\Desktop\Remexos Server\RMX-OS.rb
into the windows run prompt the same thing happens... strange
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

Blizzard

Are you sure that RMX-OS is running normally on your PC?
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

G_G

Ryex here's what you could do.
private void launchserver_Click(object sender, System.EventArgs e){
System.Diagnostics.Process.Start(Application.StartupPath + "\\RMX-OS.rb");
}

That'll run the rb script, as long as the rmx-os thing is in the same folder as the application.
I tested it and it should just run it right away.

Ryex

lol one when the window opened and closed i saw a glips of text so using my considerable screen capture skills i was able to read it it wasn't my program at all but for some reason calling it that way in c# means it is unable to find the cfg.ini file so it closes! now to figure out how to fix that...
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

G_G

October 06, 2009, 06:13:50 pm #53 Last Edit: October 06, 2009, 07:39:43 pm by game_guy
hmm wierd because it ran for me I dunno I'll look into it a bit more

EDIT:

The program is in the same folder as the script right? and the cfg.ini and everything else?

Ryex

October 06, 2009, 08:00:21 pm #54 Last Edit: October 06, 2009, 08:23:54 pm by Ryexander
I haven't tried your code yet so i'll see if it works

EDIT: your code dose work G_G

also dose any one know how to check if a process is running?
ie if the ruby.exe file is running or the RMX-OS.rb file is open some where the latter preferably
I also need to know how to test if a file exists like Filetest.exist? in ruby
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

G_G

MessageBox.Show("", "", MessageBoxButtons.YesNo);


That brings up a message box with buttons that have Yes and No.
How do I check to see which button was pressed?

Ryex

ok I now know how to file test and apparently testing for if the RMX-OS.rb file is open won't work
at least not with this code

try
            {

                FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Write,
                FileShare.None);
                fs.Close();
                serverRunState = false;
                serverRunStateLabel.Text = "Not Running";
                serverRunStateLabel.ForeColor = Color.Red;
                serverRunTested = true;
            }
            catch (FileNotFoundException)
            {
                //what to do now?
                serverRunState = false;
                serverFileState = false;
                serverFileStateLabel.Text = "Not Found";
                serverRunStateLabel.Text = "Not Running";
                serverRunStateLabel.ForeColor = Color.Red;
                serverFileStateLabel.ForeColor = Color.Red;
                serverRunTested = true;
            }
            catch (UnauthorizedAccessException)
            {
                serverRunState = true;
                serverRunStateLabel.Text = "Running";
                serverRunStateLabel.ForeColor = Color.Green;
                serverRunTested = true;
            }
            serverRunTested = true;

I think i might just give up on that one
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

G_G

If you needed to see if it was already running do this.
First add this at top
using System.Diagnostics;

then where it says name, place the process

public bool IsProcessOpen(string name)
{
                if (clsProcess.ProcessName.Contains(name))
                {
                        return true;
                }
        }
        return false;
}

Ryex

yes but i can only test for ruby.exe not the RMX-OS.rb, and the ruby.exe could be running and number of ruby programs not the the RMX-OS server
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

G_G


Boolean running = true;
private void launchserver_Click(object sender, System.EventArgs e){
System.Diagnostics.Process.Start(Application.StartupPath + "\\RMX-OS.rb");
}
public bool IsProcessOpen(string name)
{
               if (clsProcess.ProcessName.Contains(name))
               {
                       if (boolean == true)
                       {
                           return true;
                        }
               }
       }
       running = false;
       return false;
}

K hang on I'm going to try and put something together real fast