Esempio n. 1
0
        private void CheckInstallModule()
        {
            string pageNames        = string.Empty;
            string usermodules      = string.Empty;
            string templateName     = TemplateName;
            string templatePath     = Decide.IsTemplateDefault(templateName.Trim()) ? Utils.GetTemplatePath_Default(templateName) : Utils.GetTemplatePath(templateName);
            string authorDetailPath = string.Format("{0}/themedetails.xml", templatePath);

            if (File.Exists(authorDetailPath))
            {
                XmlDocument doc            = SageFrame.Templating.xmlparser.XmlHelper.LoadXMLDocument(authorDetailPath);
                XmlNode     node           = doc.SelectSingleNode("themedetail/notinstallmoduleList");
                string      pageModuleList = string.Empty;
                if (node != null)
                {
                    int         notinstallModule = 0;
                    XmlNodeList nodeListCount    = doc.GetElementsByTagName("notinstallmodules");
                    notinstallModule = nodeListCount.Count;
                    if (notinstallModule > 0)
                    {
                        notinstallmoduleWrapper.Visible = true;
                    }
                }
            }
        }
Esempio n. 2
0
    public static int SavePreset(string TemplateName, string ActiveTheme, string ActiveWidth, List <PresetKeyValue> lstLayouts, int portalID)
    {
        List <KeyValue> lstLyts = new List <KeyValue>();

        foreach (PresetKeyValue kvp in lstLayouts)
        {
            lstLyts.Add(new KeyValue(kvp.Key, kvp.Value));
        }
        PresetInfo PresetObj = new PresetInfo();

        PresetObj.ActiveTheme = ActiveTheme;
        PresetObj.ActiveWidth = ActiveWidth;
        PresetObj.lstLayouts  = lstLyts;
        string presetPath = Decide.IsTemplateDefault(TemplateName.Trim()) ? Utils.GetPresetPath_DefaultTemplate(TemplateName) : Utils.GetPresetPath(TemplateName);
        string pagepreset = presetPath + "/" + TemplateConstants.PagePresetFile;

        presetPath += "/" + "pagepreset.xml";
        int presetstatus = 0;

        try
        {
            PresetHelper.WritePreset(presetPath, PresetObj);
            return(presetstatus);
        }
        catch (Exception)
        {
            throw;
        }
        finally
        {
            AppErazer.ClearSysHash(ApplicationKeys.ActivePagePreset + "_" + portalID);
            SageFrame.Common.CacheHelper.Clear("PresetList");
        }
    }
Esempio n. 3
0
    public static void DeleteTheme(string TemplateName, string ThemeName)
    {
        string target_dir = Decide.IsTemplateDefault(TemplateName) ? Utils.GetTemplatePath_Default(TemplateName) : Utils.GetTemplatePath(TemplateName);
        string theme_dir  = target_dir + "/Themes/" + ThemeName;

        Utils.DeleteDirectory(theme_dir);
    }
Esempio n. 4
0
    public static string GenerateWireFrame(string FilePath, string TemplateName)
    {
        try
        {
            //Check For Default Layout
            BlockParser.CheckFilePath(FilePath.ToLower());
            List <XmlTag> lstXmlTags   = new List <XmlTag>();
            XmlParser     parser       = new XmlParser();
            string        templatePath = Decide.IsTemplateDefault(TemplateName.Trim()) ? Utils.GetTemplatePath_Default(TemplateName) : Utils.GetTemplatePath(TemplateName);
            string        filePath     = FilePath.ToLower().Equals("core") ? string.Format("{0}/Layouts/standard/All.xml", Utils.GetTemplatePath_Default("Default")) : string.Format("{0}/layouts/{1}.xml", templatePath, FilePath);

            lstXmlTags = parser.GetXmlTags(filePath, "layout/section");
            List <XmlTag>       lstWrappers = parser.GetXmlTags(filePath, "layout/wrappers");
            ModulePaneGenerator wg          = new ModulePaneGenerator();
            return(wg.GenerateHTML(lstXmlTags, lstWrappers, 0));
        }
        catch (Exception)
        {
            if (FilePath.ToLower().Equals("core"))
            {
                return("<div class='sfMessage sfErrormsg'>Invalid XML document<input type='button' class='sfResetCore' id='btnReset' value='Reset Core'/></div>");
            }
            else
            {
                return("<div class='sfMessage sfErrormsg'>Invalid XML document</div>");
            }
        }
    }
Esempio n. 5
0
    public static int UpdateLayout(string FilePath, string Xml, string TemplateName)
    {
        int status = 0;

        TemplateName = TemplateName.Trim();
        if (!Utils.ContainsXmlHeader(Xml))
        {
            Xml = string.Format("<?xml version=\"1.0\" encoding=\"utf-8\"?>{0}", Xml);
        }
        if (Decide.IsXmlInputValid(Xml))
        {
            string templatePath = Decide.IsTemplateDefault(TemplateName) ? Utils.GetTemplatePath_Default(TemplateName) : Utils.GetTemplatePath(TemplateName);
            //string filePath = string.Format("{0}/layouts/{1}.xml",templatePath,FilePath);
            string filePath = FilePath.ToLower().Equals("core") ? string.Format("{0}/Layouts/standard/All.xml", Utils.GetTemplatePath_Default("Default")) : string.Format("{0}/layouts/{1}.xml", templatePath, FilePath);

            using (StreamWriter sw = new StreamWriter(filePath))
            {
                sw.Write(Xml);
            }
            CreateLayoutControls(TemplateName, filePath);
        }
        else
        {
            status = 1;
        }
        return(status);
    }
    private void GetNotInstallModules()
    {
        string pageNames        = string.Empty;
        string usermodules      = string.Empty;
        string templateName     = TemplateName;
        string templatePath     = Decide.IsTemplateDefault(templateName.Trim()) ? Utils.GetTemplatePath_Default(templateName) : Utils.GetTemplatePath(templateName);
        string authorDetailPath = string.Format("{0}/themedetails.xml", templatePath);

        if (File.Exists(authorDetailPath))
        {
            XmlDocument doc              = SageFrame.Templating.xmlparser.XmlHelper.LoadXMLDocument(authorDetailPath);
            XmlNode     node             = doc.SelectSingleNode("themedetail/notinstallmoduleList");
            string      pageModuleList   = string.Empty;
            int         notinstallModule = 0;
            if (node != null)
            {
                XmlNodeList nodeListCount = doc.GetElementsByTagName("notinstallmodules");
                notinstallModule = nodeListCount.Count;
            }
            if (notinstallModule > 0)
            {
                StringBuilder html = new StringBuilder();
                html.Append("<a class='notinstallmodulelink' target='_Blank' href=" + GetHostURL() + "/Admin/Modules.aspx" + " >Modules <span>" + notinstallModule + "</span><div class='noinstallmodulecount'>You have " + notinstallModule + " modules to be install. </div></a>");
                ltrnotinstallModules.Text = html.ToString();
            }
        }
    }
Esempio n. 7
0
    public static int CreateLayout(string FilePath, string Xml, string TemplateName)
    {
        string templatePath = Decide.IsTemplateDefault(TemplateName.Trim()) ? Utils.GetTemplatePath_Default(TemplateName) : Utils.GetTemplatePath(TemplateName);
        string filePath     = templatePath + "/layouts/" + Utils.GetFileNameWithExtension(FilePath, "xml");
        int    status       = 0;

        try
        {
            if (Decide.IsXmlInputValid(Xml))
            {
                using (StreamWriter sw = new StreamWriter(filePath))
                {
                    if (!Utils.ContainsXmlHeader(Xml))
                    {
                        sw.Write("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
                    }
                    sw.Write(Xml);
                }
                CreateLayoutControls(TemplateName.Trim(), filePath);
            }
            else
            {
                status = 1;
            }
            return(status);
        }
        catch (Exception)
        {
            throw;
        }
    }
    private void CheckInstallModule()
    {
        string pageNames        = string.Empty;
        string usermodules      = string.Empty;
        string templateName     = TemplateName;
        string templatePath     = Decide.IsTemplateDefault(templateName.Trim()) ? Utils.GetTemplatePath_Default(templateName) : Utils.GetTemplatePath(templateName);
        string authorDetailPath = string.Format("{0}/themedetails.xml", templatePath);

        if (File.Exists(authorDetailPath))
        {
            XmlDocument doc            = SageFrame.Templating.xmlparser.XmlHelper.LoadXMLDocument(authorDetailPath);
            XmlNode     node           = doc.SelectSingleNode("themedetail/notinstallmoduleList");
            string      pageModuleList = string.Empty;
            if (node != null)
            {
                int         notinstallModule = 0;
                XmlNodeList nodeListList     = doc.GetElementsByTagName("notinstallmodules");
                notinstallModule = nodeListList.Count;
                if (notinstallModule > 0)
                {
                    foreach (XmlNode xn in nodeListList)
                    {
                        moduleList += xn.SelectSingleNode("ModuleName").InnerText + ",";
                    }
                }
            }
        }
        if (moduleList.Length > 0)
        {
            BindOnlineModules(moduleList);
        }
    }
Esempio n. 9
0
    public static string ReadFiles(string TemplateName, string FilePath)
    {
        XmlParser _parser  = new XmlParser();
        string    filePath = Decide.IsTemplateDefault(TemplateName) ? Utils.GetTemplatePath_Default(TemplateName) : Utils.GetTemplatePath(TemplateName);

        filePath = FilePath != "" ? filePath + "/" + FilePath : filePath;
        string html = XmlHelper.GetXMLString(filePath);

        return(html);
    }
Esempio n. 10
0
    public static void DeletePreset(string TemplateName, string Preset)
    {
        string presetPath = Decide.IsTemplateDefault(TemplateName) ? Utils.GetPresetPath_DefaultTemplate(TemplateName) : Utils.GetPresetPath(TemplateName);
        string pagepreset = presetPath + "/" + TemplateConstants.PagePresetFile;
        string target_dir = Decide.IsTemplateDefault(TemplateName) ? Utils.GetTemplateInfoFilePath_Default(TemplateName) : Utils.GetTemplateInfoFilePath(TemplateName);
        string preset_dir = target_dir + "/presets/" + Preset;

        Utils.DeleteFile(preset_dir);
        PresetHelper.DeletePresetFromPresetPages(Preset, pagepreset);
    }
    public static string CreateModernLayout(string FilePath, string Xml, string TemplateName, string ascx)
    {
        string templatePath = Decide.IsTemplateDefault(TemplateName.Trim()) ? Utils.GetTemplatePath_Default(TemplateName) : Utils.GetTemplatePath(TemplateName);
        string filePath     = templatePath + "/layouts/" + Utils.GetFileNameWithExtension(FilePath, "xml");
        int    status       = 0;

        try
        {
            //if (Decide.IsXmlInputValid(Xml))
            //{
            using (StreamWriter sw = new StreamWriter(filePath))
            {
                //if (!Utils.ContainsXmlHeader(Xml))
                //{
                //    sw.Write("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
                //}
                sw.Write(Xml);
            }

            string controlname = string.Format("{0}.ascx", FilePath);
            if (!File.Exists(templatePath + "/" + controlname))
            {
                FileStream fs = null;
                using (fs = File.Create(templatePath + "/" + controlname))
                {
                }
            }
            else
            {
                File.Delete(templatePath + "/" + controlname);
                FileStream fs = null;
                using (fs = File.Create(templatePath + "/" + controlname))
                {
                }
            }
            using (StreamWriter sw = new StreamWriter(templatePath + "/" + controlname))
            {
                sw.Write("<%@ Control Language=\"C#\" ClassName=\"" + FilePath + "\" %>");
                sw.Write(Environment.NewLine);
                sw.Write(ascx);
            }

            //}
            //else
            //{
            //    status = 1;
            //}
            return(FilePath);
        }
        catch (Exception)
        {
            throw;
        }
    }
Esempio n. 12
0
    public static PresetInfo GetPresetDetails(string TemplateName, int PortalID)
    {
        string presetPath = Decide.IsTemplateDefault(TemplateName.Trim()) ? Utils.GetPresetPath_DefaultTemplate(TemplateName) : Utils.GetPresetPath(TemplateName);

        presetPath += "/" + "pagepreset.xml";
        PresetInfo objPreset = new PresetInfo();

        try
        {
            objPreset = PresetHelper.LoadPresetDetails(presetPath);
            PageController    objPageController = new PageController();
            List <PageEntity> lstMenu           = objPageController.GetMenuFront(PortalID, false);
            foreach (PageEntity obj in lstMenu)
            {
                obj.ChildCount = lstMenu.Count(
                    delegate(PageEntity objMenu)
                {
                    return(objMenu.ParentID == obj.PageID);
                }
                    );
            }
            List <string>   lstPages  = new List <string>();
            List <KeyValue> lstLayout = new List <KeyValue>();
            foreach (KeyValue kvp in objPreset.lstLayouts)
            {
                string[]      arrPage    = kvp.Value.Split(',');
                List <string> lstNewPage = new List <string>();
                foreach (string page in arrPage)
                {
                    bool exists = lstMenu.Exists(
                        delegate(PageEntity obj)
                    {
                        return(obj.PageName.TrimStart('-') == page);
                    }
                        );
                    if (exists || page.ToLower() == "all")
                    {
                        lstNewPage.Add(page);
                    }
                }
                if (lstNewPage.Count > 0)
                {
                    lstLayout.Add(new KeyValue(kvp.Key, string.Join(",", lstNewPage.ToArray())));
                }
            }
            objPreset.lstLayouts = lstLayout;
            //PresetHelper.WritePreset(presetPath, objPreset);
            return(objPreset);
        }
        catch (Exception)
        {
            throw;
        }
    }
Esempio n. 13
0
    public static void DeleteLayout(string TemplateName, string Layout)
    {
        TemplateName = Utils.CleanString(TemplateName);
        string templatePath = Decide.IsTemplateDefault(TemplateName) ? Utils.GetTemplatePath_Default(TemplateName) : Utils.GetTemplatePath(TemplateName);
        string fileName     = Path.GetFileName(Layout);

        Layout = string.Format("{0}/layouts/{1}.xml", templatePath, Layout);
        string controlfile = string.Format("{0}/{1}.ascx", templatePath, Path.GetFileNameWithoutExtension(Layout));

        Utils.DeleteFile(controlfile);
        Utils.DeleteFile(Layout);
    }
Esempio n. 14
0
 public static void DeleteTemplate(string TemplateName)
 {
     try
     {
         string target_dir = Decide.IsTemplateDefault(TemplateName) ? Utils.GetTemplatePath_Default(TemplateName) : Utils.GetTemplatePath(TemplateName);
         Utils.DeleteDirectory(target_dir);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
    public static string LoadLayouts(string templateName)
    {
        string        filePath = Decide.IsTemplateDefault(templateName.Trim()) ? Utils.GetTemplatePath_Default(templateName) : Utils.GetTemplatePath(templateName);
        DirectoryInfo dir      = new DirectoryInfo(filePath + "/layouts");
        string        layouts  = string.Empty;

        foreach (FileInfo layout in dir.GetFiles())
        {
            string layoutName = layout.Name.Replace(".xml", "");
            layouts += ',' + layoutName;
        }
        return(layouts);
    }
    public static string SingleModernLayout(string templateName, string layoutName)
    {
        string filePath = Decide.IsTemplateDefault(templateName.Trim()) ? Utils.GetTemplatePath_Default(templateName) : Utils.GetTemplatePath(templateName);

        filePath = string.Format("{0}/layouts/{1}.xml", filePath, layoutName);
        string layoutValue = string.Empty;

        if (File.Exists(filePath))
        {
            CheckModernLayout(filePath, out layoutValue);
        }
        return(layoutValue);
    }
Esempio n. 17
0
    public static List <KeyValue> LoadLayout(string TemplateName)
    {
        string          filePath   = Decide.IsTemplateDefault(TemplateName.Trim()) ? Utils.GetTemplatePath_Default(TemplateName) : Utils.GetTemplatePath(TemplateName);
        DirectoryInfo   dir        = new DirectoryInfo(filePath + "/layouts");
        List <KeyValue> lstLayouts = new List <KeyValue>();

        foreach (FileInfo layout in dir.GetFiles())
        {
            lstLayouts.Add(new KeyValue(Path.GetFileNameWithoutExtension(layout.Name), layout.FullName));
        }
        lstLayouts.Insert(0, new KeyValue("Core", "Core"));
        return(lstLayouts);
    }
Esempio n. 18
0
        public IRCClient()
        {
            ReadLine  += Ping;
            ReadLine  += Identify;
            ReadLine  += DisplayLine;
            WriteLine += DisplayLine;

            Settings        = new IRCSettings();
            DecideCommand   = new Decide();
            UrlTitleCommand = new UrlTitle();

            ReadLine += DecideCommand.Process;
            ReadLine += UrlTitleCommand.Process;
        }
    public static bool IsModernLayout(string templateName, string layoutName)
    {
        string        templatePath    = Decide.IsTemplateDefault(templateName.Trim()) ? Utils.GetTemplatePath_Default(templateName) : Utils.GetTemplatePath(templateName);
        string        filePath        = layoutName.ToLower().Equals("core") ? string.Format("{0}/Layouts/standard/All.xml", Utils.GetTemplatePath_Default("Default")) : string.Format("{0}/layouts/{1}.xml", templatePath, layoutName);
        bool          ismodernLayout  = false;
        List <XmlTag> lstSectionNodes = new List <XmlTag>();
        XmlDocument   doc             = XmlHelper.LoadXMLDocument(filePath);//layout
        XmlElement    root            = doc.DocumentElement;

        if (root.Attributes["modern"] != null)
        {
            ismodernLayout = true;
        }
        return(ismodernLayout);
    }
Esempio n. 20
0
    public static List <KeyValue> GetThemes(string TemplateName)
    {
        string          themePath = Decide.IsTemplateDefault(TemplateName) ? Utils.GetThemePath_Default(TemplateName) : Utils.GetThemePath(TemplateName);
        DirectoryInfo   dir       = new DirectoryInfo(themePath);
        List <KeyValue> lstThemes = new List <KeyValue>();

        if (dir.Exists)
        {
            foreach (DirectoryInfo theme in dir.GetDirectories())
            {
                lstThemes.Add(new KeyValue(theme.Name, theme.FullName));
            }
        }
        return(lstThemes);
    }
Esempio n. 21
0
    public static List <PresetInfo> LoadActivePresets(string TemplateName)
    {
        string            presetPath       = Decide.IsTemplateDefault(TemplateName) ? Utils.GetPresetPath_DefaultTemplate(TemplateName) : Utils.GetPresetPath(TemplateName);
        List <PresetInfo> lstActivePresets = new List <PresetInfo>();
        string            pagepreset       = presetPath + "/" + TemplateConstants.PagePresetFile;

        if (File.Exists(pagepreset))
        {
            lstActivePresets = PresetHelper.ParsePreset(pagepreset, "pagepresets/page");
        }
        else
        {
            lstActivePresets.Add(PresetInfo.GetPresetPages("default", "*"));
        }
        return(lstActivePresets);
    }
Esempio n. 22
0
    public static List <KeyValue> GetPreviewImages(string TemplateName)
    {
        string          target_dir = Decide.IsTemplateDefault(TemplateName) ? Utils.GetTemplatePath_Default(TemplateName) : Utils.GetTemplatePath(TemplateName);
        string          imagePath  = target_dir + "/screenshots/";
        List <KeyValue> lstImages  = new List <KeyValue>();
        DirectoryInfo   dirInfo    = new DirectoryInfo(imagePath);

        foreach (FileInfo file in dirInfo.GetFiles())
        {
            string ext = Path.GetExtension(file.Name);
            if (ext == ".jpg" || ext == ".png" || ext == ".gif")
            {
                lstImages.Add(new KeyValue(file.Name, file.FullName));
            }
        }
        return(lstImages);
    }
Esempio n. 23
0
 public static string ReadXML(string filePath, string TemplateName)
 {
     try
     {
         string templatePath = Decide.IsTemplateDefault(TemplateName.Trim()) ? Utils.GetTemplatePath_Default(TemplateName) : Utils.GetTemplatePath(TemplateName);
         string fileName     = Path.GetFileName(filePath);
         filePath = filePath.ToLower().Equals("core") ? string.Format("{0}/Layouts/standard/All.xml", Utils.GetTemplatePath_Default("Default")) : string.Format("{0}/layouts/{1}.xml", templatePath, filePath);
         DataSet ds = new DataSet();
         ds.ReadXml(filePath);
         string s = ds.GetXml();
         return(s);
     }
     catch (Exception)
     {
         return("Couldn't Read the XML file. Make sure it is a valid xml");
     }
 }
Esempio n. 24
0
    public string LoadLayout()
    {
        string        filePath = Decide.IsTemplateDefault(TemplateName.Trim()) ? Utils.GetTemplatePath_Default(TemplateName) : Utils.GetTemplatePath(TemplateName);
        DirectoryInfo dir      = new DirectoryInfo(filePath + "/layouts");
        StringBuilder html     = new StringBuilder();

        foreach (FileInfo layout in dir.GetFiles())
        {
            string layoutName = layout.Name.Replace(".xml", "");
            html.Append("<option");
            html.Append(" value='");
            html.Append(layoutName);
            html.Append("'>");
            html.Append(layoutName);
            html.Append("</option>");
        }
        return(html.ToString());
    }
Esempio n. 25
0
            public static void Execute(ICollection <T> collection, Decide decide)
            {
                List <T> removed = new List <T>();

                foreach (T item in collection)
                {
                    if (decide(item))
                    {
                        removed.Add(item);
                    }
                }

                foreach (T item in removed)
                {
                    collection.Remove(item);
                }
                removed.Clear();
            }
Esempio n. 26
0
    public static List <KeyValue> LoadPresets(string TemplateName)
    {
        string          themePath  = Decide.IsTemplateDefault(TemplateName) ? Utils.GetPresetPath_DefaultTemplate(TemplateName) : Utils.GetPresetPath(TemplateName);
        DirectoryInfo   dir        = new DirectoryInfo(themePath);
        List <KeyValue> lstPresets = new List <KeyValue>();

        if (dir.Exists)
        {
            foreach (FileInfo preset in dir.GetFiles("*.xml"))
            {
                if (!Utils.CompareStrings(preset.Name, TemplateConstants.PagePresetFile))
                {
                    lstPresets.Add(new KeyValue(preset.Name, preset.FullName));
                }
            }
        }
        return(lstPresets);
    }
Esempio n. 27
0
    public void BindThemes()
    {
        string          themePath = Decide.IsTemplateDefault(TemplateName) ? Utils.GetThemePath_Default(TemplateName) : Utils.GetThemePath(TemplateName);
        List <KeyValue> lstThemes = new List <KeyValue>();

        if (Directory.Exists(themePath))
        {
            DirectoryInfo dir = new DirectoryInfo(themePath);
            foreach (DirectoryInfo theme in dir.GetDirectories())
            {
                lstThemes.Add(new KeyValue(theme.Name, theme.Name));
            }
        }
        lstThemes.Insert(0, new KeyValue("default", "default"));
        ddlThemes.DataSource    = lstThemes;
        ddlThemes.DataTextField = "Key";
        ddlThemes.DataTextField = "Value";
        ddlThemes.DataBind();
    }
Esempio n. 28
0
        public override Statistics run()
        {
            Environment env = new Environment();

            //dist for Create
            Uniform CreateDist = new Uniform(1, 5);

            //dist for Able
            Uniform AbleDist = new Uniform(4, 6);

            //dist for Baker
            Uniform BakerDist = new Uniform(2, 5);

            Distribution DistCreate = new Distribution(CreateDist);
            Distribution DistAble = new Distribution(AbleDist);
            Distribution DistBaker = new Distribution(BakerDist);

            Create create = new Create(env, 0, 100, DistCreate);

            Dispose dispose = new Dispose(env, 10);

            Queue SharedQueue = new Queue(env, 3);

            Resource Able = new Resource(env, 1, 1, DistAble, SharedQueue);

            Resource Baker = new Resource(env, 2, 1, DistBaker, SharedQueue);

            Decide decide = new Decide(env, 5);
            //Condition
            EQCond cond = new EQCond(0, Able, Actor.StateType.Idle);
            decide.AddCondition(cond, Able.AID);
            decide.AddElse(Baker.AID);

            create.Next_AID.Add("First", 5);
            Able.Next_AID.Add("First", 10);
            Baker.Next_AID.Add("First", 10);

            env.System_Time = new DateTime(1970, 1, 1, 0, 0, 0);
            env.Start_Time = new DateTime(1970, 1, 1, 0, 0, 0);

            env.Setup_Simulation();
            return env.Simulate();
        }
    public static List <string> ModernLayoutList(string templateName)
    {
        List <string> objLayoutList = new List <string>();
        string        filePath      = Decide.IsTemplateDefault(templateName.Trim()) ? Utils.GetTemplatePath_Default(templateName) : Utils.GetTemplatePath(templateName);
        DirectoryInfo dir           = new DirectoryInfo(filePath + "/layouts");
        string        layouts       = string.Empty;

        foreach (FileInfo layout in dir.GetFiles())
        {
            string fileName     = layout.FullName;
            string layoutValue  = string.Empty;
            bool   modernLayout = CheckModernLayout(fileName, out layoutValue);
            if (modernLayout)
            {
                objLayoutList.Add(layout.Name + ",,,," + layoutValue);
            }
        }
        return(objLayoutList);
    }
Esempio n. 30
0
    public static void CreateLayoutControls(string TemplateName, string filePath)
    {
        BlockParser.CheckFilePath();
        string templatePath        = Decide.IsTemplateDefault(TemplateName) ? Utils.GetTemplatePath_Default(TemplateName) : Utils.GetTemplatePath(TemplateName);
        string presetPath          = Decide.IsTemplateDefault(TemplateName) ? Utils.GetPresetPath_DefaultTemplate(TemplateName) : Utils.GetPresetPath(TemplateName);
        ModulePaneGenerator mg     = new ModulePaneGenerator();
        XmlParser           parser = new XmlParser();

        try
        {
            List <XmlTag> lstXmlTag   = parser.GetXmlTags(filePath, "layout/section");
            List <XmlTag> lstWrappers = parser.GetXmlTags(filePath, "layout/wrappers");
            string        html        = mg.GenerateHTML(lstXmlTag, lstWrappers, 2);
            //html = Utils.FormatHtmlOutput(html);
            string controlclass = Path.GetFileNameWithoutExtension(filePath);
            string controlname  = string.Format("{0}.ascx", controlclass);
            if (!File.Exists(templatePath + "/" + controlname))
            {
                FileStream fs = null;
                using (fs = File.Create(templatePath + "/" + controlname))
                {
                }
            }
            else
            {
                File.Delete(templatePath + "/" + controlname);
                FileStream fs = null;
                using (fs = File.Create(templatePath + "/" + controlname))
                {
                }
            }
            using (StreamWriter sw = new StreamWriter(templatePath + "/" + controlname))
            {
                sw.Write("<%@ Control Language=\"C#\" ClassName=" + controlclass + " %>");
                sw.Write(Environment.NewLine);
                sw.Write(html);
            }
        }
        catch (Exception)
        {
            throw;
        }
    }
Esempio n. 31
0
    public static List <FileEntity> GetFiles(string TemplateName, string FolderPath)
    {
        string filePath = Decide.IsTemplateDefault(TemplateName) ? Utils.GetTemplatePath_Default(TemplateName) : Utils.GetTemplatePath(TemplateName);

        filePath = FolderPath != "" ? filePath + "/" + FolderPath : filePath;
        List <FileEntity> lstFiles = new List <FileEntity>();

        if (Directory.Exists(filePath))
        {
            DirectoryInfo dir = new DirectoryInfo(filePath);
            foreach (DirectoryInfo folder in dir.GetDirectories())
            {
                lstFiles.Add(new FileEntity(folder.Name, folder.FullName, "", Path.HasExtension(folder.Name) ? false : true, Size(folder), folder.CreationTime.ToShortDateString()));
            }
            foreach (FileInfo file in dir.GetFiles())
            {
                lstFiles.Add(new FileEntity(file.Name, file.FullName, Path.GetExtension(file.Name), Path.HasExtension(file.Name) ? false : true, file.Length, file.CreationTime.ToShortDateString()));
            }
        }
        return(lstFiles);
    }
Esempio n. 32
0
        public void run()
        {
            Environment env = new Environment();

            //dist
            Uniform d = new Uniform(1, 1, 0);

            //dist1
            Uniform n = new Uniform(5, 5, 0);
            Distribution dist = new Distribution(d);
            Distribution dist1 = new Distribution(n);

            Create c = new Create(env, 0, 10, dist);

            Dispose di = new Dispose(env, 10);

            Queue q = new Queue(env, 3);
            q.Capacity = 10;
            Resource r = new Resource(env, 1, 1, dist1, q);

            Queue q2 = new Queue(env, 4);
            q2.Capacity = 5;
            Resource r2 = new Resource(env, 2, 1, dist1, q);

            Decide de = new Decide(env, 5);
            //Condition
            EQCond cond = new EQCond(0, r, Actor.StateType.Busy);
            de.AddCondition(cond, r2.AID);
            de.AddElse(r.AID);

            c.Next_AID.Add("First", 5);
            r.Next_AID.Add("First", 10);
            r2.Next_AID.Add("First", 10);

            env.System_Time = new DateTime(1970, 1, 1, 0, 0, 0);
            env.Start_Time = new DateTime(1970, 1, 1, 0, 0, 0);
            env.Setup_Simulation();
            env.Simulate();
            ///////
        }