Exemplo n.º 1
0
        //////////////////////////////////////////////////////////////////////////
        // Stub
        //////////////////////////////////////////////////////////////////////////

        public static void stub(string podName, DirectoryInfo outDir, bool verbose)
        {
            writeLine("    .NET Stub [" + podName + "]");

            string fanHome = SysProps.getProperty("fan.home");
            string podPath = fanHome + "\\lib\\fan\\" + podName + ".pod";
            string target  = new FileInfo(outDir + "\\" + podName + ".dll").FullName;

            if (verbose)
            {
                writeLine("  <- " + podPath);
                Pod    pod  = Pod.doFind(podName, true, null);
                List   list = pod.types();
                string pre  = "Fan." + FanUtil.upper(podName) + ".";
                for (int i = 0; i < list.sz(); i++)
                {
                    writeLine("  " + pre + (list.get(i) as Type).name());
                }
                writeLine("  -> " + target);
            }

            FStore store = new FStore(new ZipFile(podPath));
            FPod   fpod  = new FPod(podName, store);

            fpod.read();
            FTypeEmit.emitPod(fpod, false, target);
        }
Exemplo n.º 2
0
        public static FPod readFPod(string name)
        {
            FStore store = null;

            // handle sys specially for bootstrapping the VM
            if (name == "sys")
            {
                store = new FStore(new ZipFile(FileUtil.combine(Sys.m_podsDir, name + ".pod")));
            }

            // otherwise delegate to Env.cur to find the pod file
            else
            {
                FileSystemInfo file = null;
                Fan.Sys.File   f    = Env.cur().findPodFile(name);
                if (f != null)
                {
                    file = ((LocalFile)f).m_file;
                }

                // if null or doesn't exist then its a no go
                if (file == null || !file.Exists)
                {
                    throw UnknownPodErr.make(name).val;
                }

                // verify case since Windoze is case insensitive
                String actualName = file.Name; //getCanonicalFile().getName();
                actualName = actualName.Substring(0, actualName.Length - 4);
                if (actualName != name)
                {
                    throw UnknownPodErr.make("Mismatch case: " + name + " != " + actualName).val;
                }

                store = new FStore(new ZipFile(file.FullName));
            }

            // read in the FPod tables
            FPod fpod = new FPod(name, store);

            fpod.read();
            return(fpod);
        }