Exemplo n.º 1
0
        public void LoadData()
        {
            Data = new XMLparser();

            Terran = CreateTeranUnits();

            Data.Load(Terran);

            Data.LoadRaceBuilding(Terran);
            Data.LoadRaceUnit(Terran);

            Protoss = CreateProtossUnits();
            Data.Load(Protoss);

            Zerg = CreateZergUnits();
            Data.Load(Zerg);

            IsDataLoaded = true;
        }
Exemplo n.º 2
0
        //
        // GET: /DeviceLV/Details/5
        public string Details(int id)
        {
            XMLparser  result= new XMLparser();

            var db = new HefestoDevicesEntities();
            Device_Information device = new Device_Information();
            device = db.Device_Information.Find(id);

            result.Name = device.Device_Name;
            result.Email = device.Device_Email;
            result.Zone = device.Device_Zone;

            result.Id = device.Device_Id;
            result.Lat = (float) device.Device_Lat;
            result.Long =(float) device.DEvice_Long;
            result.Mode =(int) device.Device_Mode;
            result.Status = (int)device.Device_Status;

            return result.XMLresult("Value");
        }
Exemplo n.º 3
0
        //
        // GET: /DeviceLV/Details/5

        public string Details(int id)
        {
            XMLparser result = new XMLparser();

            var db = new HefestoDevicesEntities();
            Device_Information device = new Device_Information();

            device = db.Device_Information.Find(id);

            result.Name  = device.Device_Name;
            result.Email = device.Device_Email;
            result.Zone  = device.Device_Zone;

            result.Id     = device.Device_Id;
            result.Lat    = (float)device.Device_Lat;
            result.Long   = (float)device.DEvice_Long;
            result.Mode   = (int)device.Device_Mode;
            result.Status = (int)device.Device_Status;

            return(result.XMLresult("Value"));
        }
Exemplo n.º 4
0
        /// <summary>
        ///   To initial inner object
        /// </summary>
        /// <param name = "foundTagName">of found/current tag</param>
        private bool initInnerObjects(String foundTagName)
        {
            if (foundTagName == null)
            {
                return(false);
            }

            if (foundTagName.Equals(XMLConstants.MG_TAG_HELPTABLE))
            {
                Manager.Parser.setCurrIndex(Manager.Parser.getXMLdata().IndexOf(XMLConstants.TAG_CLOSE, Manager.Parser.getCurrIndex()) +
                                            1); //end of outer tad and its ">"
            }
            else if (foundTagName.Equals(XMLConstants.MG_TAG_HELPITEM))
            {
                int endContext = Manager.Parser.getXMLdata().IndexOf(XMLConstants.TAG_TERM, Manager.Parser.getCurrIndex());
                if (endContext != -1 && endContext < Manager.Parser.getXMLdata().Length)
                {
                    //last position of its tag
                    String tag = Manager.Parser.getXMLsubstring(endContext);
                    Manager.Parser.add2CurrIndex(tag.IndexOf(XMLConstants.MG_TAG_HELPITEM) +
                                                 XMLConstants.MG_TAG_HELPITEM.Length);

                    List <string> tokensVector = XMLparser.getTokens(Manager.Parser.getXMLsubstring(endContext), XMLConstants.XML_ATTR_DELIM);
                    fillHelpItem(tokensVector);
                    Manager.Parser.setCurrIndex(endContext + XMLConstants.TAG_TERM.Length); //to delete "/>" too
                    return(true);
                }
            }
            else if (foundTagName.Equals('/' + XMLConstants.MG_TAG_HELPTABLE))
            {
                Manager.Parser.setCurrIndex2EndOfTag();
                return(false);
            }
            else
            {
                Events.WriteErrorToLog("in Command.FillData() out of string bounds");
                return(false);
            }
            return(true);
        }
Exemplo n.º 5
0
        //
        // GET: /DeviceLV/
        public string Index()
        {
            string    listresult = "";
            XMLparser result     = new XMLparser();
            var       db         = new HefestoDevicesEntities();
            var       devices    = db.Device_Information.ToList();

            foreach (var device in devices)
            {
                result.Name  = device.Device_Name;
                result.Email = device.Device_Email;
                result.Zone  = device.Device_Zone;

                result.Id     = device.Device_Id;
                result.Lat    = (float)device.Device_Lat;
                result.Long   = (float)device.DEvice_Long;
                result.Mode   = (int)device.Device_Mode;
                result.Status = (int)device.Device_Status;
                listresult   += result.XMLresult("DeviceArray");
            }

            return(listresult);
        }
Exemplo n.º 6
0
        //
        // GET: /DeviceLV/
        public string Index()
        {
            string listresult="";
            XMLparser result = new XMLparser();
            var db = new HefestoDevicesEntities();
            var devices = db.Device_Information.ToList();

            foreach (var device in devices)
            {
                result.Name = device.Device_Name;
                result.Email = device.Device_Email;
                result.Zone = device.Device_Zone;

                result.Id = device.Device_Id;
                result.Lat = (float)device.Device_Lat;
                result.Long = (float)device.DEvice_Long;
                result.Mode = (int)device.Device_Mode;
                result.Status = (int)device.Device_Status;
                listresult += result.XMLresult("DeviceArray");
            }

            return listresult;
        }
Exemplo n.º 7
0
        /// <summary>
        ///   Fill member element helps by <helpitem> tag
        /// </summary>
        /// <param name = "tokensVector">attribute/value/...attribute/value/ vector</param>
        private void fillHelpItem(List <String> tokensVector)
        {
            //Since the first attribute is type of help. Extract this attribute to check type.
            int    j         = 0;
            string attribute = (tokensVector[j]);
            string valueStr  = (tokensVector[j + 1]);
            //Get and check the type of the help(Window\Internal\Prompt).
            string hlpType = XMLparser.unescape(valueStr);

            switch (hlpType)
            {
            case XMLConstants.MG_ATTR_HLP_TYP_TOOLTIP:
                ToolTipHelp tooltipHelp = new ToolTipHelp();
                for (j = 2; j < tokensVector.Count; j += 2)
                {
                    attribute = (tokensVector[j]);
                    valueStr  = (tokensVector[j + 1]);

                    if (attribute.Equals(XMLConstants.MG_ATTR_VALUE))
                    {
                        tooltipHelp.tooltipHelpText = valueStr;
                    }
                    else
                    {
                        Events.WriteErrorToLog(
                            string.Format("There is no such tag in <helptable><helpitem ..>.Insert case to HelpTable.FillHelpItem for {0}", attribute));
                    }
                }
                _helps.Add(tooltipHelp);
                break;

            case XMLConstants.MG_ATTR_HLP_TYP_PROMPT:
                PromptpHelp promptHelp = new PromptpHelp();
                for (j = 2; j < tokensVector.Count; j += 2)
                {
                    attribute = (tokensVector[j]);
                    valueStr  = (tokensVector[j + 1]);

                    if (attribute.Equals(XMLConstants.MG_ATTR_VALUE))
                    {
                        promptHelp.PromptHelpText = valueStr;
                    }
                    else
                    {
                        Events.WriteErrorToLog(
                            string.Format("There is no such tag in <helptable><helpitem ..>.Insert case to HelpTable.FillHelpItem for {0}", attribute));
                    }
                }
                _helps.Add(promptHelp);
                break;

            case XMLConstants.MG_ATTR_HLP_TYP_URL:
                URLHelp urlHelp = new URLHelp();
                for (j = 2; j < tokensVector.Count; j += 2)
                {
                    attribute = (tokensVector[j]);
                    valueStr  = (tokensVector[j + 1]);

                    if (attribute.Equals(XMLConstants.MG_ATTR_VALUE))
                    {
                        urlHelp.urlHelpText = valueStr;
                    }
                    else
                    {
                        Events.WriteErrorToLog(
                            string.Format("There is no such tag in <helptable><helpitem ..>.Insert case to HelpTable.FillHelpItem for {0}", attribute));
                    }
                }
                _helps.Add(urlHelp);
                break;

            case XMLConstants.MG_ATTR_HLP_TYP_INTERNAL:
                InternalHelp internalHelpWindowDetails = new InternalHelp();
                //Init Internal Help Window Details.
                for (j = 2; j < tokensVector.Count; j += 2)
                {
                    attribute = (tokensVector[j]);
                    valueStr  = (tokensVector[j + 1]);

                    if (attribute.Equals(XMLConstants.MG_ATTR_VALUE))
                    {
                        internalHelpWindowDetails.val = XMLparser.unescape(valueStr);
                    }
                    else if (attribute.Equals(XMLConstants.MG_ATTR_INTERNAL_HELP_NAME))
                    {
                        internalHelpWindowDetails.Name = valueStr;
                    }
                    else if (attribute.Equals(XMLConstants.MG_ATTR_INTERNAL_HELP_FRAMEX))
                    {
                        internalHelpWindowDetails.FrameX = Convert.ToInt32(XMLparser.unescape(valueStr));
                    }
                    else if (attribute.Equals(XMLConstants.MG_ATTR_INTERNAL_HELP_FRAMEY))
                    {
                        internalHelpWindowDetails.FrameY = Convert.ToInt32(XMLparser.unescape(valueStr));
                    }
                    else if (attribute.Equals(XMLConstants.MG_ATTR_INTERNAL_HELP_FRAMEDX))
                    {
                        internalHelpWindowDetails.FrameDx = Convert.ToInt32(XMLparser.unescape(valueStr));
                    }
                    else if (attribute.Equals(XMLConstants.MG_ATTR_INTERNAL_HELP_FRAMEDY))
                    {
                        internalHelpWindowDetails.FrameDy = Convert.ToInt32(XMLparser.unescape(valueStr));
                    }
                    else if (attribute.Equals(XMLConstants.MG_ATTR_INTERNAL_HELP_SIZEDX))
                    {
                        internalHelpWindowDetails.SizedX = Convert.ToInt32(XMLparser.unescape(valueStr));
                    }
                    else if (attribute.Equals(XMLConstants.MG_ATTR_INTERNAL_HELP_SIZEDY))
                    {
                        internalHelpWindowDetails.SizedY = Convert.ToInt32(XMLparser.unescape(valueStr));
                    }
                    else if (attribute.Equals(XMLConstants.MG_ATTR_INTERNAL_HELP_FACTORX))
                    {
                        internalHelpWindowDetails.FactorX = Convert.ToInt32(XMLparser.unescape(valueStr));
                    }
                    else if (attribute.Equals(XMLConstants.MG_ATTR_INTERNAL_HELP_FACTORY))
                    {
                        internalHelpWindowDetails.FactorY = Convert.ToInt32(XMLparser.unescape(valueStr));
                    }
                    else if (attribute.Equals(XMLConstants.MG_ATTR_INTERNAL_HELP_BORDERSTYLE))
                    {
                        internalHelpWindowDetails.Borderstyle = Convert.ToInt32(XMLparser.unescape(valueStr));
                    }
                    else if (attribute.Equals(XMLConstants.MG_ATTR_INTERNAL_HELP_WINSTYLE))
                    {
                        internalHelpWindowDetails.WinStyle = Convert.ToInt32(XMLparser.unescape(valueStr));
                    }
                    else if (attribute.Equals(XMLConstants.MG_ATTR_INTERNAL_HELP_FONT_TABLE_INDEX))
                    {
                        internalHelpWindowDetails.FontTableIndex = Convert.ToInt32(XMLparser.unescape(valueStr));
                    }
                    else
                    {
                        Events.WriteErrorToLog(
                            string.Format("There is no such tag in <helptable><helpitem ..>.Insert case to HelpTable.FillHelpItem for {0}", attribute));
                    }
                }

                //Add help object to collection.
                _helps.Add(internalHelpWindowDetails);
                break;

            case XMLConstants.MG_ATTR_HLP_TYP_WINDOWS:
                WindowsHelp wndHelpDetails = new WindowsHelp();

                //Init Windows Help Details.
                for (j = 2; j < tokensVector.Count; j += 2)
                {
                    attribute = (tokensVector[j]);
                    valueStr  = (tokensVector[j + 1]);

                    if (attribute.Equals(XMLConstants.MG_ATTR_WINDOWS_HELP_FILE))
                    {
                        wndHelpDetails.FilePath = valueStr;
                    }
                    else if (attribute.Equals(XMLConstants.MG_ATTR_WINDOWS_HELP_COMMAND))
                    {
                        wndHelpDetails.HelpCommand = (HelpComand)Convert.ToInt32(valueStr);
                    }
                    else if (attribute.Equals(XMLConstants.MG_ATTR_WINDOWS_HELP_KEY))
                    {
                        wndHelpDetails.HelpKey = XMLparser.unescape(valueStr);
                    }
                    else
                    {
                        Events.WriteErrorToLog(
                            string.Format("There is no such tag in <helptable><helpitem ..>.Insert case to HelpTable.FillHelpItem for {0}", attribute));
                    }
                }

                //Add help object to collection.
                _helps.Add(wndHelpDetails);
                break;
            }
        }