Instant Own
March 28, 2024, 21:47:43
Welcome, Guest. Please login or register.

Login with username, password and session length
News: ioclan.tk domain remains.
 
  Home   Forum   Help Search Gallery Staff List Members Login Register  

The source!

Pages: [1]
  Print  
Author Topic: The source!  (Read 305 times)
0 Members and 1 Guest are viewing this topic.
diho
moderators
Active poster
*****

Awards: 21
Offline Offline

Posts: 107



View Profile
« on: February 20, 2010, 18:31:24 »

of course we want to make the source of the handler.exe public.
You may help with making it work better, but we trust you guys that you don't use it to make your own version of it. Smiley

So here you go:
 
It's written in CSharp ( C# )
handler.exe

Code:

using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using System.Diagnostics;



namespace alert
{
    class Program
    {
        static string ProcessInput(string s)
        {
            // TODO Verify and validate the input
            // string as appropriate for your application.
            return s;
        }

        static void Main(string[] args)
        {

            foreach (string s in args)
            {
                string ss = s.Replace("oacon://", "");
                string sss = ss.Replace("%20", " ");
                string ssss = sss.Replace("/", "");
               
               

                Console.WriteLine(ProcessInput(ssss));



                Process p = null;
                try
                {





                    p = new Process();


                    string Dir2 = AppDomain.CurrentDomain.BaseDirectory;






                    p.StartInfo.FileName = "openarena.exe";
                    p.StartInfo.Arguments = " + connect " + ssss;
                    p.StartInfo.WorkingDirectory = Dir2;


                    p.StartInfo.CreateNoWindow = false;
                    p.Start();
                    p.WaitForExit();



                }
                catch (Exception ex)
                {
                    Console.WriteLine("Exception Occurred :{0},{1}",
                              ex.Message, ex.StackTrace.ToString());
                }




            }

        }
    }
}


the oacon installer (oacon_install.exe) extracts 3 files:
add.reg
install.exe
handler.exe
And then it will exec install.exe

>> install.exe will change the add.reg to the path where handler.exe is.
>> install.exe will add add.reg to the registry.
>> install.exe will extract handler.exe to the openarena folder.

That's all Smiley

Here are the sources of add.reg and install.exe:

add.reg

Code:

REGEDIT4

[HKEY_CLASSES_ROOT\oacon]
@="URL:oacon Protocol"
"URL Protocol"=""

[HKEY_CLASSES_ROOT\oacon\DefaultIcon]
@="handler.exe"

[HKEY_CLASSES_ROOT\oacon\shell]

[HKEY_CLASSES_ROOT\oacon\shell\open]

[HKEY_CLASSES_ROOT\oacon\shell\open\command]
@="\"path-to-handler.exe" \"%1\""




Install.exe

Code:



using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Diagnostics;
using System.Windows.Forms;




namespace install
{
    class Program
    {
        static void Main(string[] args)
        {
           
           
            string sName1 = @"\add.reg";
            string sName2 = @"\handler.exe";

            string sDir = Directory.GetCurrentDirectory();
            string sDir1 = Directory.GetCurrentDirectory() + sName1;
            string sDir2 = Directory.GetCurrentDirectory() + sName2;

            string ss = sDir2.Replace("\\", "\\\\");
            string sss = ss + @"\";
           





     


                    string temp;

                    StringBuilder sb = new StringBuilder();

                    string[] file = File.ReadAllLines(sDir1);

                    foreach (string line in file)
                    {

                        if (line.Contains("path-to-handler.exe"))
                        {

                            temp = line.Replace("path-to-handler.exe", sss);

                            sb.Append(temp + "\r\n");

                            continue;

                        }

                        else

                            sb.Append(line + "\r\n");

                    }

                    File.WriteAllText(sDir1, sb.ToString());


                    Process regeditProcess = Process.Start("regedit.exe", "/s add.reg");
                    regeditProcess.WaitForExit();




             
           
        }
    }
}


« Last Edit: February 20, 2010, 19:05:55 by diho » Report Spam   Logged

Share on Facebook Share on Twitter

RMF
Clan leaders
Should i stop?
*****

Awards: 36
Offline Offline

Posts: 2246


Rest in pieces!


View Profile WWW
« Reply #1 on: February 20, 2010, 18:59:49 »

Here is my part of the project, written in the perfect noob language called GameMakerLanguage (GML) Wink
Code:
inoaf=file_exists("openarena.exe");
moveto="";

if(!inoaf){
    show_message("Please select the directory of openarena.exe in the following screen...");
    moveto=get_directory(""); //this shows a screen where you can select the directory
    if(moveto==""){
        show_message("No directory selected. If you want to install it, don't press cancel lol.");
        game_end();
        exit;
    }
    moveto+="\"; //the final backslash isn't included when selecting the directory so I add it manually
}

if(!file_exists(moveto+"openarena.exe")){
    if(  show_question("Wrong directory (openarena.exe is missing), try again?")  ){
        game_restart();
        exit;
    }else{
        game_end();
        exit;
    }
}

if(!inoaf){
    file_copy( "install.exe",  moveto+"install.exe ");
    file_copy( "add.reg",      moveto+"add.reg     ");
    file_copy( "handler.exe",  moveto+"handler.exe ");
}

execute_program(moveto+"install.exe","",1);

show_message("Succesfully installed!");

file_delete(moveto+"install.exe");
file_delete(moveto+"add.reg");
if(!inoaf){
    file_delete("install.exe");
    file_delete("add.reg");
    file_delete("handler.exe");
}

game_end();
exit;

This is all I typed. Via the GUI from Gamemaker I have included the three files from diho, which it unpacks before executing the program (overwriting files if they exist for if you have an old version).

Of course for this source the same as for diho:
Quote
You may help with making it work better, but we trust you guys that you don't use it to make your own version of it. Smiley
« Last Edit: February 20, 2010, 19:09:07 by RMF » Report Spam   Logged

^IO^RMF
Pages: [1]
  Print  
 
Jump to:  


+--ignore-
Powered by EzPortal
Bookmark this site! | Upgrade This Forum
SMF For Free - Create your own Forum

Powered by SMF | SMF © 2016, Simple Machines
Privacy Policy
Page created in 0.036 seconds with 24 queries.