예제 #1
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            string       vfilePath = TemplateGC.RequestFile(FileKey, FileExt);
            string       filePath  = this.Page.Server.MapPath(vfilePath);
            StreamWriter sw        = new StreamWriter(filePath);

            sw.Write(CodeGenerator.Exec(this.Page, TemplateFile).Trim());
            sw.Close();
            this.Attributes.Add("SRC", vfilePath);
        }
예제 #2
0
        public static void StartGC(HttpApplicationState app, int seconds)
        {
            {
                if (Directory.Exists(TemplatePhysicalPath + "\\one"))
                {
                    Directory.Delete(TemplatePhysicalPath + "\\one", true);
                }
                if (Directory.Exists(TemplatePhysicalPath + "\\two"))
                {
                    Directory.Delete(TemplatePhysicalPath + "\\two", true);
                }
                fileCount = 0;
                useFolder = "One";
            }

            TemplateGC gc = new TemplateGC();

            app["TemplateGC"] = gc;
            Timer timer = new Timer(new TimerCallback(gc.GCTimerCallback), null, 0, seconds);

            app["TemplateGCTimer"] = timer;
        }