Пример #1
0
        public static void CopyFrom(this CompilerEngine dst, IConfigData src)
        {
            dst.Configuration = src.Configuration;
            dst.CsProject     = src.CsProject;
            dst.OutDir        = src.OutDir;
            dst.Referenced.Clear();
            dst.TranlationHelpers.Clear();
            dst.ReferencedPhpLibsLocations.Clear();

            // src and dest can be in different application domain
            // we need to add item by item
            foreach (var q in src.Referenced.ToArray())
            {
                dst.Referenced.Add(q);
            }
            foreach (var q in src.TranlationHelpers.ToArray())
            {
                dst.TranlationHelpers.Add(q);
            }
            foreach (var a in src.ReferencedPhpLibsLocations)
            {
                dst.ReferencedPhpLibsLocations.Add(a.Key, a.Value);
            }

            dst.BinaryOutputDir = src.BinaryOutputDir;
            Debug.Assert(dst.Referenced.Count == src.Referenced.Count);
            Debug.Assert(dst.TranlationHelpers.Count == src.TranlationHelpers.Count);
            Debug.Assert(dst.ReferencedPhpLibsLocations.Count == src.ReferencedPhpLibsLocations.Count);
        }
Пример #2
0
        private static void DoCompilation(ConfigData cfg, ref bool showUsage)
        {
            var showUsage1 = showUsage;

            CompilerEngine.ExecuteInSeparateAppDomain(
                ce =>
            {
                ce.Configuration = cfg.Configuration;
                ce.CsProject     = cfg.CsProject;
                ce.OutDir        = cfg.OutDir;
                ce.Referenced.Clear();
                ce.TranlationHelpers.Clear();
                ce.ReferencedPhpLibsLocations.Clear();

                // src and dest can be in different application domain
                // we need to add item by item
                ce.Set1(cfg.Referenced.ToArray(),
                        cfg.TranlationHelpers.ToArray(),
                        cfg.ReferencedPhpLibsLocations.Select(a => a.Key + "\n" + a.Value).ToArray()
                        );
                ce.BinaryOutputDir = cfg.BinaryOutputDir;
                Debug.Assert(ce.Referenced.Count == cfg.Referenced.Count);
                Debug.Assert(ce.TranlationHelpers.Count == cfg.TranlationHelpers.Count);
                Debug.Assert(ce.ReferencedPhpLibsLocations.Count == cfg.ReferencedPhpLibsLocations.Count);
                //ce.CopyFrom(aa);
                ce.Check();
                showUsage1 = false;
                ce.Compile();
            });
            showUsage = showUsage1;
        }