Exemplo n.º 1
0
        public AutoRun()
        {
            // including IWshRuntimeLibrary.dll in the .exe-project
            AppDomain.CurrentDomain.AssemblyResolve += (sender, args) =>
            {
                string resourceName = new AssemblyName(args.Name).Name + ".dll";
                string resource     = Array.Find(this.GetType().Assembly.GetManifestResourceNames(), element => element.EndsWith(resourceName));

                using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resource))
                {
                    Byte[] assemblyData = new Byte[stream.Length];
                    stream.Read(assemblyData, 0, assemblyData.Length);
                    return(Assembly.Load(assemblyData));
                }
            };



            this.appLink          = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;
            this.workingDirectory = Path.GetDirectoryName(Application.ExecutablePath);
            this.autoRunPath      = Environment.GetFolderPath(Environment.SpecialFolder.Startup);
            this.appName          = Path.GetFileNameWithoutExtension(this.appLink);
            this.appPath          = Path.GetDirectoryName(appLink);

            IWshRuntimeLibrary.FileSystemObject a = new IWshRuntimeLibrary.FileSystemObject();
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            WS.FileSystemObject fso = new WS.FileSystemObject();
            string cd = fso.GetAbsolutePathName(".");

            WS.Folder fld   = fso.GetFolder(cd);
            string    fname = fld.Name;

            /*
             * string[] files = Directory.GetFiles(".", "*.mp3");
             * foreach (string file in files)
             * {
             *  FileAttributes fa = File.GetAttributes(file);
             *
             * }*/
        }
Exemplo n.º 3
0
 // for init included IWshRuntimeLibrary.dll
 private void foo()
 {
     IWshRuntimeLibrary.FileSystemObject a = new IWshRuntimeLibrary.FileSystemObject();
 }