Fan.Sys.Pod.doFind C# (CSharp) Méthode

doFind() public static méthode

public static doFind ( string name, bool check, FPod fpod ) : Pod
name string
check bool
fpod Fanx.Fcode.FPod
Résultat Pod
        public static Pod doFind(string name, bool check, FPod fpod)
        {
            try
              {
            lock (m_podsByName)
            {
              // TODO - .NET does not have soft references, so how could
              // we implement this?  See the Pod.java for the java impl.

              Pod pod = (Pod)m_podsByName[name];
              if (pod == null)
              {
            // if fpod is non-null, then we are "creating" this pod in
            // memory direct from the compiler, otherwise we need to
            // find the pod zip file and load it's meta-data
            if (fpod == null) fpod = readFPod(name);

            // sanity check
            if (fpod.m_podName != name)
              throw new Exception("Mismatched pod name b/w pod.def and pod zip filename: " + fpod.m_podName + " != " + name);

            // create the pod and register it
            pod = new Pod(fpod);
            m_podsByName[name] = pod;
              }
              return pod;
            }
              }
              catch (UnknownPodErr.Val e)
              {
            if (!check) return null;
            throw e;
              }
              catch (Exception e)
              {
            Err.dumpStack(e);
            if (!check) return null;
            throw UnknownPodErr.make(name, e).val;
              }
        }

Usage Example

Exemple #1
0
        //////////////////////////////////////////////////////////////////////////
        // Init Sys Pod
        //////////////////////////////////////////////////////////////////////////

        static Pod initSysPod()
        {
            try
            {
                return(Pod.doFind("sys", true, null));
            }
            catch (Exception e)
            {
                throw initFail("sysPod", e);
            }
        }