private Instruction CreateNewInstructionObject(InstructionsType instructionsType)
        {
            switch (instructionsType)
            {
            case InstructionsType.Atlas:
                return(new Atlas());

            case InstructionsType.Patch:
                return(new Patch());

            case InstructionsType.Shortcut:
                return(new Shortcut());

            case InstructionsType.UnpackCopy:
                return(new XmlUnpack());

            default:
                return(null);
            }
        }
示例#2
0
    public string SetHelperText(InstructionsType iType)
    {
        if (iType == InstructionsType.BlackBerrySocial)
        {
            return(@"<strong>Next2Friends Social for BlackBerry Pearl, Curve and Bold Supports OS: 4.5 (Excluding Bold) and above</strong><br/><br/><p>To find out which OS you are running, go to Options, then About. You will see the version starting with a 'v'.<br/><br/>If your BlackBerry doesn’t have the required OS installed, click <a href='http://na.blackberry.com/eng/support/downloads/download_sites.jsp'>here</a> to locate an upgrade.<br/><br/>Data Plan Support: GPRS, EDGE and WIFI.<br/><br/> <strong>If you plan to use your carrier data plan, you must set your Carrier APN to the correct values (CDMA Networks such as Verizon/Sprint do not require an APN value). You can find these values on your carrier's website. You can find the APN settings for your BlackBerry in Options, Advanced Options, TCP.</strong> <br/><br/> When your download begins, select 'Set Application Permissions' and set 'Allow' for each category. <br/><br/>If you choose to install using the BlackBerry Desktop Manager, you will need to go to 'Application Permissions' and set there after installation.<p>");
        }
        else if (iType == InstructionsType.BlackBerryLive)
        {
            return("<strong>Next2Friends Live for BlackBerry Pearl and Curve Supports OS: 4.5 and above</strong><br/><br/>To find out which OS you are running, go to Options, then About. You will see the version starting with a 'v'.<br/><br/>If your BlackBerry doesn’t have the required OS installed, click <a href='http://na.blackberry.com/eng/support/downloads/download_sites.jsp'>here</a> to locate an upgrade.<br/><br/>Data Plan Support: EDGE, 3G and WIFI.<br /><br />You must ensure that your video recording application (Next2Friends uses this location for buffer) is set to:<br /><br />media card/blackberry/videos<br /><br />or also known as:<br /><br />sdcard/blackberry/videos<br /><br />It should be set to the above by default, please ensure it is on your BlackBerry.<br /><br />If you plan to use your carrier data plan, you must set your Carrier APN to the correct values (CDMA Networks such as Verizon/Sprint do not require an APN value).You can find these values on your carrier's website. You can find the APN settings for your BlackBerry in Options, Advanced Options, TCP.<br /><br />When your download begins, select 'Set Application Permissions' and set 'Allow' for each category.<br /><br />If you choose to install using the BlackBerry Desktop Manager, you will need to go to 'Application Permissions' and set after installation. (Found in Options)<br /><br />Usage: After opening the Next2Friends Live Application from your BlackBerry, go to settings, enter your nickname and password. If you would like to use your WIFI connection, then make sure WIFI is selected. If you choose not to use your WIFI connection, then you must uncheck the WIFI checkbox. Now save and exit from settings.<br /><br />Select Broadcast, the Preview will open and the application will start broadcasting. Because Next2Friends Live for BlackBerry uses a buffer, It can take up to 5+ seconds before the stream appears on the Next2Friends website. To end your stream select the back button. You may now see a screen saying it is completing, this is the buffer clearing the data by pushing the rest of the broadcast to th site. You have just streamed with Next2Friends Live.<br /><br />On some Phones you will be presented with a screen to accept a change to the security timers, please accept with 'Yes'.<br /><br />Important note: Because the BlackBerry video system relies on a media card and is checking for active space so that the device can locally save the video upon stream complete. The length of your stream will be determined by how much space is available on your media card. By default, the BlackBerry devices will save all video locally. You can delete them manually from your media card to gain more space for streaming. The data is always streamed to Next2Friends and saved, but the device itself must know it has enough space to save any video as it is functioning.");
        }
        else if (iType == InstructionsType.Symbian)
        {
            return("<strong>Next2Friends Social for S40 and S60</strong><br/><br/> After installation, go to the App. Mgr, scroll to Next2Friends Social, select and choose 'Suite Settings' Set each item to 'Always Allow'");
        }
        else if (iType == InstructionsType.BlackBerryBold)
        {
            return(@"<strong>Next2Friends Live for BlackBerry BOLD</strong><br /><br />Data Plan Support: EDGE, 3G and WIFI.<br /><br />You must ensure that your video recording application (Next2Friends uses this location for buffer) is set to:<br /><br />media card/blackberry/videos<br /><br />or also known as:<br /><br />sdcard/blackberry/videos<br /><br />It should be set to the above by default, please ensure it is on your BlackBerry.<br /><br />If you plan to use your carrier data plan, you must set your Carrier APN to the correct values (CDMA Networks such as Verizon/Sprint do not require an APN value).You can find these values on your carrier's website. You can find the APN settings for your BlackBerry in Options, Advanced Options, TCP.<br /><br />When your download begins, select 'Set Application Permissions' and set 'Allow' for each category.<br /><br />If you choose to install using the BlackBerry Desktop Manager, you will need to go to 'Application Permissions' and set after installation. (Found in Options)<br /><br />Usage: After opening the Next2Friends Live Application from your BlackBerry, go to settings, enter your nickname and password. If you would like to use your WIFI connection, then make sure WIFI is selected. If you choose not to use your WIFI connection, then you must uncheck the WIFI checkbox. Now save and exit from settings.<br /><br />Select Broadcast, the Preview will open and the application will start broadcasting. Because Next2Friends Live for BlackBerry uses a buffer, It can take up to 5+ seconds before the stream appears on the Next2Friends website. To end your stream select the back button. You may now see a screen saying it is completing, this is the buffer clearing the data by pushing the rest of the broadcast to th site. You have just streamed with Next2Friends Live.<br /><br />On some Phones you will be presented with a screen to accept a change to the security timers, please accept with 'Yes'.<br /><br />Important note: Because the BlackBerry video system relies on a media card and is checking for active space so that the device can locally save the video upon stream complete. The length of your stream will be determined by how much space is available on your media card. By default, the BlackBerry devices will save all video locally. You can delete them manually from your media card to gain more space for streaming. The data is always streamed to Next2Friends and saved, but the device itself must know it has enough space to save any video as it is functioning.");
        }

        return(string.Empty);
    }
示例#3
0
    public string SetHelperText(InstructionsType iType)
    {
        if (iType == InstructionsType.BlackBerrySocial)
        {
            return @"<strong>Next2Friends Social for BlackBerry Pearl, Curve and Bold Supports OS: 4.5 (Excluding Bold) and above</strong><br/><br/><p>To find out which OS you are running, go to Options, then About. You will see the version starting with a 'v'.<br/><br/>If your BlackBerry doesn’t have the required OS installed, click <a href='http://na.blackberry.com/eng/support/downloads/download_sites.jsp'>here</a> to locate an upgrade.<br/><br/>Data Plan Support: GPRS, EDGE and WIFI.<br/><br/> <strong>If you plan to use your carrier data plan, you must set your Carrier APN to the correct values (CDMA Networks such as Verizon/Sprint do not require an APN value). You can find these values on your carrier's website. You can find the APN settings for your BlackBerry in Options, Advanced Options, TCP.</strong> <br/><br/> When your download begins, select 'Set Application Permissions' and set 'Allow' for each category. <br/><br/>If you choose to install using the BlackBerry Desktop Manager, you will need to go to 'Application Permissions' and set there after installation.<p>";
        }
        else if (iType == InstructionsType.BlackBerryLive)
        {
            return "<strong>Next2Friends Live for BlackBerry Pearl and Curve Supports OS: 4.5 and above</strong><br/><br/>To find out which OS you are running, go to Options, then About. You will see the version starting with a 'v'.<br/><br/>If your BlackBerry doesn’t have the required OS installed, click <a href='http://na.blackberry.com/eng/support/downloads/download_sites.jsp'>here</a> to locate an upgrade.<br/><br/>Data Plan Support: EDGE, 3G and WIFI.<br /><br />You must ensure that your video recording application (Next2Friends uses this location for buffer) is set to:<br /><br />media card/blackberry/videos<br /><br />or also known as:<br /><br />sdcard/blackberry/videos<br /><br />It should be set to the above by default, please ensure it is on your BlackBerry.<br /><br />If you plan to use your carrier data plan, you must set your Carrier APN to the correct values (CDMA Networks such as Verizon/Sprint do not require an APN value).You can find these values on your carrier's website. You can find the APN settings for your BlackBerry in Options, Advanced Options, TCP.<br /><br />When your download begins, select 'Set Application Permissions' and set 'Allow' for each category.<br /><br />If you choose to install using the BlackBerry Desktop Manager, you will need to go to 'Application Permissions' and set after installation. (Found in Options)<br /><br />Usage: After opening the Next2Friends Live Application from your BlackBerry, go to settings, enter your nickname and password. If you would like to use your WIFI connection, then make sure WIFI is selected. If you choose not to use your WIFI connection, then you must uncheck the WIFI checkbox. Now save and exit from settings.<br /><br />Select Broadcast, the Preview will open and the application will start broadcasting. Because Next2Friends Live for BlackBerry uses a buffer, It can take up to 5+ seconds before the stream appears on the Next2Friends website. To end your stream select the back button. You may now see a screen saying it is completing, this is the buffer clearing the data by pushing the rest of the broadcast to th site. You have just streamed with Next2Friends Live.<br /><br />On some Phones you will be presented with a screen to accept a change to the security timers, please accept with 'Yes'.<br /><br />Important note: Because the BlackBerry video system relies on a media card and is checking for active space so that the device can locally save the video upon stream complete. The length of your stream will be determined by how much space is available on your media card. By default, the BlackBerry devices will save all video locally. You can delete them manually from your media card to gain more space for streaming. The data is always streamed to Next2Friends and saved, but the device itself must know it has enough space to save any video as it is functioning.";
        }
        else if (iType == InstructionsType.Symbian)
        {
            return "<strong>Next2Friends Social for S40 and S60</strong><br/><br/> After installation, go to the App. Mgr, scroll to Next2Friends Social, select and choose 'Suite Settings' Set each item to 'Always Allow'";
        }
		else if(iType == InstructionsType.BlackBerryBold)
		{
			return @"<strong>Next2Friends Live for BlackBerry BOLD</strong><br /><br />Data Plan Support: EDGE, 3G and WIFI.<br /><br />You must ensure that your video recording application (Next2Friends uses this location for buffer) is set to:<br /><br />media card/blackberry/videos<br /><br />or also known as:<br /><br />sdcard/blackberry/videos<br /><br />It should be set to the above by default, please ensure it is on your BlackBerry.<br /><br />If you plan to use your carrier data plan, you must set your Carrier APN to the correct values (CDMA Networks such as Verizon/Sprint do not require an APN value).You can find these values on your carrier's website. You can find the APN settings for your BlackBerry in Options, Advanced Options, TCP.<br /><br />When your download begins, select 'Set Application Permissions' and set 'Allow' for each category.<br /><br />If you choose to install using the BlackBerry Desktop Manager, you will need to go to 'Application Permissions' and set after installation. (Found in Options)<br /><br />Usage: After opening the Next2Friends Live Application from your BlackBerry, go to settings, enter your nickname and password. If you would like to use your WIFI connection, then make sure WIFI is selected. If you choose not to use your WIFI connection, then you must uncheck the WIFI checkbox. Now save and exit from settings.<br /><br />Select Broadcast, the Preview will open and the application will start broadcasting. Because Next2Friends Live for BlackBerry uses a buffer, It can take up to 5+ seconds before the stream appears on the Next2Friends website. To end your stream select the back button. You may now see a screen saying it is completing, this is the buffer clearing the data by pushing the rest of the broadcast to th site. You have just streamed with Next2Friends Live.<br /><br />On some Phones you will be presented with a screen to accept a change to the security timers, please accept with 'Yes'.<br /><br />Important note: Because the BlackBerry video system relies on a media card and is checking for active space so that the device can locally save the video upon stream complete. The length of your stream will be determined by how much space is available on your media card. By default, the BlackBerry devices will save all video locally. You can delete them manually from your media card to gain more space for streaming. The data is always streamed to Next2Friends and saved, but the device itself must know it has enough space to save any video as it is functioning.";				
		}

        return string.Empty;
    }
        public List <Instruction> CreateInstructionsList(string folderPath, InstructionsType instructionsType, string xmlSearchpath, Dictionary <string, string> originalPatchNames = null)
        {
            if (string.IsNullOrEmpty(folderPath))
            {
                throw new BadMemeException("FolderPath is null or empty");
            }
            if (string.IsNullOrEmpty(xmlSearchpath))
            {
                throw new BadMemeException("XmlSearchPath is null or empty");
            }

            if (!Directory.Exists(folderPath))
            {
                Logging.Info(LogOptions.ClassName, "Directory {0} does not exist, skip parsing");
                return(null);
            }

            //search for all files that we want to use to add to
            string[] filesList = FileUtils.FileSearch(folderPath, SearchOption.TopDirectoryOnly, false, false, @"*.xml", 50, 3, true);
            if (filesList == null)
            {
                Logging.Error(LogOptions.ClassName, "Failed to search for xml instruction files in directory {0}", folderPath);
                return(null);
            }

            List <Instruction> instructions = new List <Instruction>();

            //for each instruction xml file, add them
            Logging.Debug(LogOptions.ClassName, "Parsed {0} xml files from path {1}", filesList.Count(), folderPath);
            foreach (string file in filesList)
            {
                AddInstructionObjectsToList(file, instructions, instructionsType, xmlSearchpath, originalPatchNames);
            }

            return(instructions);
        }
        private void AddInstructionObjectsToList(string file, List <Instruction> instructions, InstructionsType instructionsType, string xmlSearchpath, Dictionary <string, string> originalPatchNames = null)
        {
            XDocument doc = XmlUtils.LoadXDocument(file, XmlLoadType.FromFile);

            if (doc == null)
            {
                Logging.Warning(LogOptions.ClassName, "Failed to parse xml file {0}", file);
                return;
            }

            //get all element objects like Patchs
            List <XPathNavigator> resultsList = XmlUtils.GetXNodesFromXpath(doc, xmlSearchpath);

            resultsList = resultsList.FindAll(result => result.NodeType == XPathNodeType.Element);

            foreach (XPathNavigator xPathNavigator in resultsList)
            {
                //now we have the main element like Patch. currently, each instruction part is an element
                Instruction instruction = CreateNewInstructionObject(instructionsType);
                XElement    element     = XElement.Parse(xPathNavigator.OuterXml);
                instruction.NativeProcessingFile = Path.GetFileName(file);
                if (originalPatchNames != null)
                {
                    instruction.ActualPatchName = originalPatchNames[Path.GetFileName(file)];
                }

                foreach (XElement instructionProperty in element.Elements())
                {
                    string instructionPropertyName = instructionProperty.Name.LocalName;
                    Type   instructionType         = instruction.GetType();
                    //we need to use a double for loop instead of contains because we need to compare by lower case (the legacy xml and code structure varies)
                    foreach (string property in instruction.PropertiesToSerialize())
                    {
                        string propertyLower = property.ToLower();
                        if (propertyLower.Equals(instructionPropertyName.ToLower()))
                        {
                            PropertyInfo propertyInfo = instructionType.GetProperty(property);
                            if (instructionProperty.HasElements && typeof(IEnumerable).IsAssignableFrom(propertyInfo.PropertyType) && !propertyInfo.PropertyType.Equals(typeof(string)))
                            {
                                //get the list object
                                IList listProperty = propertyInfo.GetValue(instruction) as IList;
                                //get the type of object inside that list
                                Type listObjectType = listProperty.GetType().GetInterfaces().Where(i => i.IsGenericType && i.GenericTypeArguments.Length == 1)
                                                      .FirstOrDefault(i => i.GetGenericTypeDefinition() == typeof(IEnumerable <>)).GenericTypeArguments[0];
                                foreach (XElement subElement in instructionProperty.Elements())
                                {
                                    if (listObjectType.IsValueType)
                                    {
                                        CommonUtils.SetObjectValue(listObjectType, subElement.Value, out object newObject);
                                        listProperty.Add(newObject);
                                    }
                                    //https://stackoverflow.com/a/2092912/3128017
                                    else if (listObjectType.Equals(typeof(string)))
                                    {
                                        listProperty.Add(subElement.Value);
                                    }
                                    else
                                    {
                                        Logging.Error(LogOptions.ClassName, "Unknown type of parse for instruction: {0}", listObjectType.ToString());
                                    }
                                }
                            }
                            else if (!string.IsNullOrWhiteSpace(instructionProperty.Value))
                            {
                                CommonUtils.SetObjectProperty(instruction, propertyInfo, instructionProperty.Value.Trim());
                            }
                            break;
                        }
                    }
                }

                //add to instructions list and create new object
                instructions.Add(instruction);
            }
        }
        public void AddInstructionObjectsToList(string file, List <Instruction> instructions, InstructionsType instructionsType, string xmlSearchpath)
        {
            if (!File.Exists(file))
            {
                throw new BadMemeException("file does not exist");
            }

            AddInstructionObjectsToList(file, instructions, instructionsType, xmlSearchpath, null);
        }