Example #1
0
        public string GlobalCompile()
        {
            string[] FileText     = System.IO.File.ReadAllLines(FileName);
            string   FileNamePath = "";

            if (FileName.Split('/').Length > 1)
            {
                FileNamePath = FileName.Remove(FileName.Length - FileName.Split('/')[FileName.Split('/').Length - 1].Length - 1);
            }
            else
            {
                FileNamePath = FileName.Remove(FileName.Length - FileName.Split('\\')[FileName.Split('\\').Length - 1].Length - 1);
            }
            string[]   ConfigLines   = System.IO.File.ReadAllLines(FileNamePath + "/config.bk");
            string[]   DataLines     = {};
            WebProject CurrenProject = new WebProject();

            CurrenProject.ProjectStopWatch.Start();
            if (System.IO.File.Exists(FileNamePath + "/data.bk"))
            {
                DataLines = System.IO.File.ReadAllLines(FileNamePath + "/data.bk");
                for (int i = 0; i < DataLines.Length; i++)
                {
                    string[] LocalLine = SyntaxTools.GetNewLine(DataLines[i]).Split('=');
                    CurrenProject.AddData(LocalLine[0], LocalLine[1]);
                }
            }
            this.HTML_Path = FileNamePath + ConfigLines[0].Split('=')[1];
            VerifyFolder(this.HTML_Path);
            this.CSS_Path = FileNamePath + ConfigLines[1].Split('=')[1];
            VerifyFolder(this.CSS_Path);
            bool Started = false;

            WebObject.Base CurrentObject = new WebObject.Base("default", CurrenProject, "", "");
            FileLines = new List <string>();
            AddFileLines(FileText, FileNamePath);
            for (int i = 0; i < FileLines.Count; i++)
            {
                string[] LinesWords = FileLines[i].Split(' ');

                if (LinesWords[0] == "page")
                {
                    CurrentObject = new WebObject.Page(LinesWords[1], CurrenProject, HTML_Path, CSS_Path);
                    Started       = true;
                }
                else if (LinesWords[0] == "object")
                {
                    if (LinesWords[1].Split(':').Length > 1)
                    {
                        string[] LocalWords = LinesWords[1].Split(':');
                        CurrentObject = new WebObject.Base(LocalWords[0], CurrenProject, HTML_Path, CSS_Path);
                        foreach (WebObject.Base LocalObject in CurrenProject.ObjectList)
                        {
                            if (LocalObject.GetName() == LocalWords[1])
                            {
                                CurrentObject.CSS.SetAllProp(LocalObject, LocalObject.CSS.GetAllProp());
                            }
                        }
                    }
                    else
                    {
                        CurrentObject = new WebObject.Base(LinesWords[1], CurrenProject, HTML_Path, CSS_Path);
                    }
                    Started = true;
                }
                else if (Started && LinesWords[0] == "end")
                {
                    CurrentObject.CompileObject();
                    CurrenProject.ObjectList.Add(CurrentObject);
                    Started = false;
                }
                else if (Started)
                {
                    CurrentObject.AddLine(FileLines[i]);
                }
            }
            CurrenProject.DisplayCompileTime();
            return("ExitCode = 0");
        }
Example #2
0
        public static void Group(string Name, string[] Arguments, WebObject.Base CurrentObject, WebProject CurrentProject)
        {
            WebObject.Base ArrayObject = Tools.FindWebObjectByName(Arguments[1], CurrentObject.LocalObjectList);
            List <string>  DataArray   = new List <string>();

            foreach (string Data in ArrayObject.ArrayDatas)
            {
                DataArray.Add(Data);
            }
            WebObject.Base        MasterClass  = Tools.FindWebObjectByName(Arguments[0], CurrentObject.CurrentProject.ObjectList);
            List <WebObject.Base> ChildObjects = new List <WebObject.Base>();

            foreach (string LocalData in DataArray)
            {
                WebObject.Base NewObject = Tools.CreateWebObject(Name + DataArray.IndexOf(LocalData), MasterClass, MasterClass.HTML_Path, MasterClass.CSS_Path);
                NewObject.ClassName = MasterClass.GetName();
                Tools.SetEmbemdedProp(Arguments[2], NewObject, CurrentProject);
                Tools.SetEmbemdedProp(LocalData, NewObject, CurrentProject);
                CurrentObject.LocalObjectList.Add(NewObject);
            }
        }
Example #3
0
 public static void SetEmbemdedProp(string LocalData, WebObject.Base NewObject, WebProject CurrentProject)
 {
     //string NewLine = SyntaxTools.GetNewLine(LocalData);
     string[] LocalPropList = LocalData.Split('|');
     if (LocalPropList.Length > 0)
     {
         foreach (string LocalProp in LocalPropList)
         {
             string[] TestString = LocalData.Split('#');
             if (LocalProp == "-")
             {
             }
             else if (TestString[0].Split('.').Length > 1 && GetPropPos(LocalProp.Split('#')[0]) == -1)
             {
                 string[]       Words            = LocalProp.Split('.');
                 WebObject.Base ChildObject      = Tools.FindWebObjectByName(Words[0], NewObject.LocalObjectList);
                 string[]       Prop             = Words[1].Split('#');
                 int            CurrentPropIndex = GetPropPos(Prop[0]);
                 Console.WriteLine(LocalData + " " + Prop[0]);
                 string PropValue = Tools.GetProcessedValue(Prop[1], NewObject);
                 Console.WriteLine("Words[1] = " + Words[1] + " PropValue = " + PropValue);
                 if (CurrentPropIndex > -1)
                 {
                     NewObject.HTML.PropertiesValue[CurrentPropIndex] = Words[1];
                 }
                 string PropName = Prop[0];
                 Type   LangType = CurrentProject.LangTools.PropType(PropName);
                 CurrentProject.LangTools.SetLangObjectValue(LangType, ChildObject, PropName, PropValue);
             }
             else
             {
                 string[] Words     = LocalProp.Split('#');
                 string   PropValue = Tools.GetProcessedValue(Words[1], NewObject);
                 Console.WriteLine("Words[1] = " + Words[1] + " PropValue = " + PropValue);
                 int CurrentPropIndex = GetPropPos(Words[0]);
                 if (CurrentPropIndex > -1)
                 {
                     NewObject.HTML.PropertiesValue[CurrentPropIndex] = PropValue;
                 }
                 string PropName = Words[0];
                 Type   LangType = CurrentProject.LangTools.PropType(PropName);
                 CurrentProject.LangTools.SetLangObjectValue(LangType, NewObject, PropName, PropValue);
             }
         }
     }
 }