DeleteFiles() public static method

public static DeleteFiles ( string mask ) : void
mask string
return void
Ejemplo n.º 1
0
        public static bool Compile(bool debug)
        {
            int       num1;
            ArrayList list1;

            Type[]     typeArray1;
            int        num2;
            MethodInfo info1;
            int        num3;

            Type[]     typeArray2;
            int        num4;
            MethodInfo info2;
            int        num5;

            ScriptCompiler.EnsureDirectory("Scripts/");
            ScriptCompiler.EnsureDirectory("Scripts/Output/");
            ScriptCompiler.DeleteFiles("Scripts.CS*.dll");
            ScriptCompiler.DeleteFiles("Scripts.VB*.dll");
            ScriptCompiler.DeleteFiles("Scripts*.dll");
            if (ScriptCompiler.m_AdditionalReferences.Count > 0)
            {
                ScriptCompiler.m_AdditionalReferences.Clear();
            }
            CompilerResults results1 = null;
            CompilerResults results2 = null;

            results1 = ScriptCompiler.CompileCSScripts(debug);
            if ((results1 == null) || !results1.Errors.HasErrors)
            {
                results2 = ScriptCompiler.CompileVBScripts(debug);
            }
            if ((((results1 == null) || !results1.Errors.HasErrors) && ((results2 == null) || !results2.Errors.HasErrors)) && ((results2 != null) || (results1 != null)))
            {
                num1 = 0;
                if ((results1 == null) || (results2 == null))
                {
                    ScriptCompiler.m_Assemblies = new Assembly[1];
                }
                else
                {
                    ScriptCompiler.m_Assemblies = new Assembly[2];
                }
                if (results1 != null)
                {
                    ScriptCompiler.m_Assemblies[num1++] = results1.CompiledAssembly;
                }
                if (results2 != null)
                {
                    ScriptCompiler.m_Assemblies[num1++] = results2.CompiledAssembly;
                }
                Console.Write("Scripts: Verifying...");
                Core.VerifySerialization();
                Console.WriteLine("done ({0} items, {1} mobiles)", Core.ScriptItems, Core.ScriptMobiles);
                list1 = new ArrayList();
                num1  = 0;
                while ((num1 < ScriptCompiler.m_Assemblies.Length))
                {
                    typeArray1 = ScriptCompiler.m_Assemblies[num1].GetTypes();
                    for (num2 = 0; (num2 < typeArray1.Length); ++num2)
                    {
                        info1 = typeArray1[num2].GetMethod("Configure", (BindingFlags.Public | BindingFlags.Static));
                        if (info1 != null)
                        {
                            list1.Add(info1);
                        }
                    }
                    ++num1;
                }
                list1.Sort(new CallPriorityComparer());
                for (num3 = 0; (num3 < list1.Count); ++num3)
                {
                    ((MethodInfo)list1[num3]).Invoke(null, null);
                }
                list1.Clear();
                World.Load();
                for (num1 = 0; (num1 < ScriptCompiler.m_Assemblies.Length); ++num1)
                {
                    typeArray2 = ScriptCompiler.m_Assemblies[num1].GetTypes();
                    for (num4 = 0; (num4 < typeArray2.Length); ++num4)
                    {
                        info2 = typeArray2[num4].GetMethod("Initialize", (BindingFlags.Public | BindingFlags.Static));
                        if (info2 != null)
                        {
                            list1.Add(info2);
                        }
                    }
                }
                list1.Sort(new CallPriorityComparer());
                for (num5 = 0; (num5 < list1.Count); ++num5)
                {
                    ((MethodInfo)list1[num5]).Invoke(null, null);
                }
                return(true);
            }
            return(false);
        }