Author Topic: Read exe with a reflector  (Read 3093 times)

0 Members and 1 Guest are viewing this topic.

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4076
Read exe with a reflector
« on: August 30, 2007, 03:22:42 PM »
I dont even know if this is possible, but if I have an exe that another employee wrote for me in C#, but lost the source files when his computer was upgraded, can anyone open it and create new source files?  Its a simple little app that deletes files over 2 weeks old off the server.
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

MickD

  • King Gator
  • Posts: 3666
  • (x-in)->[process]->(y-out) ... simples!
Re: Read exe with a reflector
« Reply #1 on: August 30, 2007, 06:22:47 PM »
I think Kerry has posted some links in this forum re reflection app's and code converters.
A quick search brought up this -> http://www.remotesoft.com/salamander/
I think you can download a demo or even upload a file for testing that may get you out of trouble in the short term.
"Programming is really just the mundane aspect of expressing a solution to a problem."
- John Carmack

"Short cuts make long delays,' argued Pippin.”
- J.R.R. Tolkien

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8858
  • AKA Daniel
Re: Read exe with a reflector
« Reply #2 on: August 31, 2007, 06:37:04 AM »
Yes you can ... use this one

http://www.aisto.com/roeder/dotnet/
« Last Edit: August 31, 2007, 06:44:11 AM by Danielm103 »

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Read exe with a reflector
« Reply #3 on: August 31, 2007, 08:13:09 AM »

David,
Per Daniel's link, The 'Reflector for .NET ' by Lutz Roeder is pretty good. I may have a look at Salamander too ..
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4076
Re: Read exe with a reflector
« Reply #4 on: August 31, 2007, 10:42:35 AM »
Cool, I will check those out
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4076
Re: Read exe with a reflector
« Reply #5 on: August 31, 2007, 03:37:48 PM »
The Reflector for .Net by Roeder is awesome!! :-) :-) :-) :-) :-)
I opened my exe and got everything I wanted, changed a path, recompiled and its on its way
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4076
Re: Read exe with a reflector
« Reply #6 on: August 31, 2007, 03:38:30 PM »
By the way, I also learned how to get reg values to make the job of updating easier.  Now I just edit a regkey to tell it what folder to check and delete from
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4076
Re: Read exe with a reflector
« Reply #7 on: August 31, 2007, 03:42:12 PM »
Code: [Select]
using System;
using System.IO;
using System.IO.IsolatedStorage;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using Microsoft.Win32;

namespace DelOceScans
{
    class DelOceScans
    {
        DateTime T = System.DateTime.Now;

        public DelOceScans()
        {
        }

        public static void Main(string[] args)
        {
            DelOceScans o = new DelOceScans();
            int fc = o.GetNumFldrsToChk();
            for(int i = 1; i <= fc; i++)
            {
                string f = "Folder" + i.ToString();
                f = o.GetFolderToChk(f);
                o.CleanFiles(f);
                o.CheckSubFolders(f);
            }
        }

        public void DelEmptyFolder(string Fldr)
        {
            string[] dirs = System.IO.Directory.GetDirectories(Fldr);
            string[] fls = System.IO.Directory.GetFiles(Fldr);
            if ((dirs.GetLength(0) == 0) && (fls.GetLength(0) == 0))
                System.IO.Directory.Delete(Fldr);
        }

        public void CheckSubFolders(string Fldr)
        {
            string[] dirs = System.IO.Directory.GetDirectories(Fldr);
            foreach (string d in dirs)
            {
                CleanFiles(d);
                CheckSubFolders(d);
                DelEmptyFolder(d);
            }
        }

        public void CleanFiles(string Fldr)
        {
            string[] fls = System.IO.Directory.GetFiles(Fldr);
            foreach (string fl in fls)
            {
                FileInfo fi = new FileInfo(fl);
                TimeSpan ts = T - fi.LastWriteTime;
                if (ts.TotalDays >= 7)
                    System.IO.File.Delete(fl);
            }
        }

        public int GetNumFldrsToChk()
        {
            RegistryKey HKCU = Registry.CurrentUser;
            RegistryKey K = HKCU.OpenSubKey("Software\\TEP_Program_Settings\\ACAD_Fldr_Cleanup");
            if (K != null)
                return int.Parse(K.GetValue("NumFoldersToCheck").ToString());
            else
                return 0;
        }

        public string GetFolderToChk(string Fldr)
        {
            RegistryKey HKCU = Registry.CurrentUser;
            RegistryKey K = HKCU.OpenSubKey("Software\\TEP_Program_Settings\\ACAD_Fldr_Cleanup");
            if (K != null)
                return K.GetValue(Fldr).ToString();
            else
                return string.Empty;
        }
    }
}
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)