Пример #1
0
		/// <summary>
		/// Initializes a new instance.
		/// </summary>
		/// <param name="caseSensitiveNames">Whether the table and column names in this collection
		/// are case sensitive or not.</param>
		public Schema(
			bool caseSensitiveNames = Core.Schema.DEFAULT_CASESENSITIVE_NAMES)
		{
			_CaseSensitiveNames = caseSensitiveNames;
			if ((_Aliases = CreateAliasCollection()) == null)
				throw new CannotCreateException("Cannot create a collection of aliases.");

			_Members = new EntryList(caseSensitiveNames);
		}
Пример #2
0
 public CASEntry(int APIversion, EventHandler handler, FacialRegionFlags facialRegion, EntryList geomEntries, EntryList boneEntries,
                 DependentList <TGIBlock> ParentTGIBlocks = null)
     : base(APIversion, handler)
 {
     this._ParentTGIBlocks = ParentTGIBlocks;
     this.facialRegion     = facialRegion;
     this.geomEntries      = new EntryList(handler, geomEntries, _ParentTGIBlocks);
     this.boneEntries      = new EntryList(handler, boneEntries, _ParentTGIBlocks);
 }
Пример #3
0
        protected override void Parse(Stream s)
        {
            BinaryReader r = new BinaryReader(s);

            tag = r.ReadUInt32();
            if (checking)
            {
                if (tag != (uint)FOURCC("VPXY"))
                {
                    throw new InvalidDataException(String.Format("Invalid Tag read: '{0}'; expected: 'VPXY'; at 0x{1:X8}", FOURCC(tag), s.Position));
                }
            }
            version = r.ReadUInt32();
            if (checking)
            {
                if (version != 4)
                {
                    throw new InvalidDataException(String.Format("Invalid Version read: 0x{0:X8}; expected 0x00000004; at 0x{1:X8}", version, s.Position));
                }
            }

            long tgiPosn = r.ReadUInt32() + s.Position;
            long tgiSize = r.ReadUInt32();

            entryList = new EntryList(OnRCOLChanged, s);
            tc02      = r.ReadByte();
            if (checking)
            {
                if (tc02 != 2)
                {
                    throw new InvalidDataException(String.Format("Invalid TC02 read: 0x{0:X2}; expected 0x02; at 0x{1:X8}", tc02, s.Position));
                }
            }
            bounds = new BoundingBox(requestedApiVersion, handler, s);
            unused = r.ReadBytes(4);
            if (checking)
            {
                if (unused.Length != 4)
                {
                    throw new EndOfStreamException(String.Format("Unused: expected 4 bytes, read {0}.", unused.Length));
                }
            }
            modular = r.ReadByte();
            if (modular != 0)
            {
                ftptIndex = r.ReadInt32();
            }
            else
            {
                ftptIndex = 0;
            }

            tgiBlockList = new TGIBlockList(OnRCOLChanged, s, tgiPosn, tgiSize, ignoreTgiSize: true);

            entryList.ParentTGIBlocks = tgiBlockList;
        }
Пример #4
0
    public static MemoryStream GenerateEntryDetailsSummary(Registration reg, Guid paymentGroupId)
    {
        EntryList entries = EntryList.GetEntryList(paymentGroupId, reg.Id, "");

        PdfReader pdfReader = null;

        PdfStamper pdfStamper    = null;
        AcroFields pdfFormFields = null;

        List <MemoryStream> memoryStreamPdfStamperList = new List <MemoryStream>();

        int rowcounter = 0;

        foreach (Entry entry in entries)
        {
            MemoryStream memoryStreamPdfStamper = null;
            pdfReader = new PdfReader(System.Configuration.ConfigurationSettings.AppSettings["PdfTemplateLocation"] + "ENTRY DETAILS.pdf");
            memoryStreamPdfStamper = new MemoryStream();
            pdfStamper             = new PdfStamper(pdfReader, memoryStreamPdfStamper);
            pdfFormFields          = pdfStamper.AcroFields;


            // Form filling
            ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


            PopulateFeeRow(rowcounter, pdfFormFields, entry.Campaign, entry.Amount, 0, 1, false, "");

            pdfFormFields.SetField("ENTRY ID", entry.Serial);
            pdfFormFields.SetField("CAMPAIGN TITLE", entry.Campaign);
            pdfFormFields.SetField("CLIENT NAME", entry.Client);
            pdfFormFields.SetField("BRAND NAME", entry.Brand);
            pdfFormFields.SetField("CATEGORY", entry.CategoryPSDetail);

            rowcounter++;

            pdfStamper.FormFlattening     = true;
            pdfStamper.Writer.CloseStream = false;
            pdfStamper.Close();

            memoryStreamPdfStamperList.Add(memoryStreamPdfStamper);
        }


        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        MemoryStream docstream = CreatePdfDoc(memoryStreamPdfStamperList);

        foreach (MemoryStream memoryStreamPdfStamper in memoryStreamPdfStamperList)
        {
            memoryStreamPdfStamper.Dispose();
        }

        docstream.Position = 0;
        return(docstream);
    }
Пример #5
0
    private IEnumerator Refresh()
    {
        EntryList.RefreshTrackedPos();
        yield return(new WaitForSeconds(2f));

        if (RefreshRadar)
        {
            StartCoroutine(Refresh());
        }
    }
Пример #6
0
 private void Start()
 {
     optionList = new EntryList <OptionEntry>(options.Length);
     for (int i = 0; i < options.Length; i++)
     {
         optionList.CreateEntry(options[i].transform);
         options[i].UpdateUI();
     }
     optionMenu.SetActive(false);
 }
Пример #7
0
        private async Task UpdateEntryList(RaffleEntry entry)
        {
            // TODO: Replace Console.WriteLine with ILogger
            Console.WriteLine($"{DateTime.Now}: Adding {entry.MessageSid} to the entry list");
            await Task.Run(() => EntryList.Add(entry));

            Console.WriteLine($"{DateTime.Now}: Adding {entry.MessageSid} to the entry list");
            ToggleEnabledButtons(false, true, true);
            StateHasChanged();
        }
Пример #8
0
        protected override void OnNoClick(Game g, Widget w)
        {
            game.Gui.DisposeOverlay(this);
            EntryList denied = PluginLoader.Denied;

            if (IsAlways(w) && !denied.Has(Plugin))
            {
                denied.Add(Plugin);
            }
        }
Пример #9
0
    /// <summary>
    /// Add secret emag functionality to radar
    /// </summary>
    private void AddEmagItems()
    {
        EntryList.AddItems(MapIconType.Human, GetObjectsOf <PlayerScript>(player => !player.IsDeadOrGhost));
        EntryList.AddItems(MapIconType.Ian, GetObjectsOf <CorgiAI>());
        EntryList.AddItems(MapIconType.Nuke, GetObjectsOf <Nuke>());

        RescanElements();

        StartRefresh();
    }
Пример #10
0
        protected override void OnNoClick(Game g, Widget w)
        {
            CloseOverlay();
            EntryList denied = PluginLoader.Denied;

            if (IndexOfWidget(w) >= 2 && !denied.Has(Metadata))
            {
                denied.Add(Metadata);
            }
        }
Пример #11
0
 protected async Task StartRaffle()
 {
     Console.WriteLine($"{DateTime.Now}: Starting the Raffle");
     Modal.Show("Confirm Raffle Start", typeof(raffler.Pages.StartRaffleConfirmation));
     EntryList.Clear();
     Console.WriteLine($"{DateTime.Now}: Started the Raffle");
     //ToggleEnabledButtons(false, true, true);
     StateHasChanged();
     await Task.CompletedTask;
 }
Пример #12
0
        protected override void OnParse(VoidPtr address)
        {
            hdr = *(CommonHeader *)address;
            bint *v      = (bint *)address;
            int   offset = 0;

            //Calculate the sizes of each section using their offsets,
            //in order of appearance
            int[] sizes = SakuraiArchiveNode.CalculateSizes(_root._dataSize, v, 26, false);

            //Parse all script-related data first
            ParseScripts(v, sizes);

            //These ICs need to be sorted into int and float arrays
            //Right now they're just a mess of values
            //The indices in the IC variable storage class
            _globalICs    = Parse <RawParamList>(v[0], 188);
            _globalsseICs = Parse <RawParamList>(v[1], 188);
            _ICs          = Parse <RawParamList>(v[2], 2204);
            _sseICs       = Parse <RawParamList>(v[3], 2204);
            //Entry action script offsets
            //Exit action script offsets
            //Flash overlay script offsets/flags
            _unk7          = Parse <EntryList <CommonUnk7Entry> >(v[7], 12);
            _unk8          = Parse <RawParamList>(v[8], 0x1A4);
            _itemSwingData = Parse <RawParamList>(v[9], 0x64);
            _unk10         = Parse <RawParamList>(v[10], 0x10);
            if ((offset = v[11]) > 0)
            {
                sListOffset *list = (sListOffset *)Address(offset);
                _unk11 = Parse <EntryList <Unknown11EntryNode> >(list->_startOffset, 12, (int)list->_listCount);
            }
            _unk12 = Parse <RawParamList>(v[12], 0x80);
            _unk13 = Parse <RawParamList>(v[13], 0x80);
            _unk14 = Parse <RawParamList>(v[14], 0x40);
            _unk15 = Parse <RawParamList>(v[15], 0x24);
            _unk16 = Parse <RawParamList>(v[16], 0x48);
            _ppMul = Parse <CmnPatternPowerMulNode>(v[17]);
            _unk18 = Parse <RawParamList>(v[18], 0x10);

            //Screen tint script offsets
            _legBones = Parse <CmnLegBonesNode>(v[21]);

            if ((offset = v[23]) > 0)
            {
                _unk23 = Parse <RawParamList>(*(bint *)Address(offset), 0xA8);
            }

            _unk24 = Parse <RawParamList>(v[24], 4);

            //Notes:

            //Unk12 and Unk13 are copies of the same parameters
            //with some different values
        }
Пример #13
0
        protected override void OnYesClick(Game g, Widget w)
        {
            game.Gui.DisposeOverlay(this);
            EntryList accepted = PluginLoader.Accepted;

            if (IsAlways(w) && !accepted.Has(Plugin))
            {
                accepted.Add(Plugin);
            }
            PluginLoader.Load(Plugin, true);
        }
Пример #14
0
        /// <summary>
        /// Initializes a new instance.
        /// </summary>
        /// <param name="caseSensitiveNames">Whether the table and column names in this collection
        /// are case sensitive or not.</param>
        public Schema(
            bool caseSensitiveNames = Core.Schema.DEFAULT_CASESENSITIVE_NAMES)
        {
            _CaseSensitiveNames = caseSensitiveNames;
            if ((_Aliases = CreateAliasCollection()) == null)
            {
                throw new CannotCreateException("Cannot create a collection of aliases.");
            }

            _Members = new EntryList(caseSensitiveNames);
        }
Пример #15
0
        protected override void OnYesClick(Game g, Widget w)
        {
            CloseOverlay();
            EntryList accepted = PluginLoader.Accepted;

            if (IndexOfWidget(w) >= 2 && !accepted.Has(Metadata))
            {
                accepted.Add(Metadata);
            }
            PluginLoader.Load(Metadata, true);
        }
Пример #16
0
        internal static List <string> LoadAll(Game game)
        {
            Utils.EnsureDirectory("plugins");

            Accepted = new EntryList("plugins", "accepted.txt");
            Denied   = new EntryList("plugins", "denied.txt");
            Accepted.Load();
            Denied.Load();

            return(LoadPlugins(game));
        }
Пример #17
0
        public void GetAllEntriesCountTest()
        {
            EntryList target = new EntryList();

            target.LoadEntries(null, "EntrySet01");

            int expected = 9;
            int actual   = target.GetAllEntriesCount();

            Assert.AreEqual(expected, actual);
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     Message.Text = "";
     //check your Page.IsPostBack to see if this is the
     //first presentation of the page (IsPostBack = false)
     if (!Page.IsPostBack)
     {
         EntryList.DataSource = entries;
         EntryList.DataBind();
     }
 }
Пример #19
0
 ///<summary> Возвращает самую раннюю(позднюю) дату изменения файла из всех входящих элементов. </summary>
 public override DateTime GetDateModify(bool byLatest = false)
 {
     if (EntryList.Count == 0)
     {
         return(new DateTime());
     }
     if (byLatest)
     {
         return(EntryList.OrderBy(a => a.DateModify).LastOrDefault().DateModify);
     }
     return(EntryList.OrderBy(a => a.DateModify).FirstOrDefault().DateModify);
 }
Пример #20
0
        //---

        ///<summary> Возвращает самую раннюю(позднюю) дату создания файла из всех входящих элементов. </summary>
        public override DateTime GetDateCreate(bool byLatest = false)
        {
            if (EntryList.Count == 0)
            {
                return(new DateTime());
            }
            if (byLatest)
            {
                return(EntryList.OrderBy(a => a.DateCreate).Last().DateCreate);
            }
            return(EntryList.OrderBy(a => a.DateCreate).First().DateCreate);
        }
Пример #21
0
    protected void Page_Load(object sender, EventArgs e)
    {
        var entryList = EntryList.GetEntryList(Guid.Empty, Guid.Empty, "", StatusEntry.Completed).ToList();

        foreach (Entry entry in entryList)
        {
            string multiSingle      = "";
            string productSpecialty = "";
            string cat = "";

            if (entry.CategoryMarket == "MM")
            {
                multiSingle = "Multi Market";
            }
            else if (entry.CategoryMarket == "SM")
            {
                multiSingle = "Single Market";
            }

            if (entry.CategoryPS == "PSC")
            {
                productSpecialty = "Product & Services Category";
            }
            else if (entry.CategoryPS == "SC")
            {
                productSpecialty = "Specialty Category";
            }

            cat = entry.CategoryPSDetail.Replace("/", "");

            if (entry.CategoryMarket == "MM")
            {
                multiSingle = "Multi Market";
            }
            else if (entry.CategoryMarket == "SM")
            {
                multiSingle = "Single Market";
            }

            string From = From = System.Configuration.ConfigurationManager.AppSettings["storagePhysicalPath"].ToString() + "TempZip\\Files Export\\" + multiSingle + "\\" + productSpecialty + "\\" + cat + "\\" + entry.Serial + "\\";

            CheckFiles(entry);

            //if (Directory.Exists(From))
            //{
            //    //CopyAll(From, entry.Id);
            //}
            //else
            //{
            //    Response.Write("Error : Folder Not Found #### "+ From + " ####;<br>");
            //}
        }
    }
Пример #22
0
        /// <summary>
        /// Met à jour les tailles des entrées spécifiées.
        /// Ecrit directement dans le fichier
        /// </summary>
        /// <param name="idList">liste d'identifiants internes de fichiers</param>
        /// <param name="size1List">liste des tailles 1 à appliquer</param>
        /// <param name="size2List">liste des tailles 2 à appliquer</param>
        public void UpdateEntrySizes(Collection <uint> idList, Collection <uint> size1List, Collection <uint> size2List)
        {
            if (idList == null || size1List == null || size2List == null)
            {
                return;
            }

            // Parcours des entrées
            for (int i = 0; i < idList.Count; i++)
            {
                uint fileId = idList[i];
                uint size1  = size1List[i];
                uint size2  = size2List[i];

                // Récupération de l'entrée
                Entry e = EntryList[fileId];

                // Mise à jour de la structure
                e.firstSize  = size1;
                e.secondSize = size2;

                // Enregistrement dans le fichier
                BinaryWriter mapWriter = null;
                try
                {
                    // ANO_22 : on enlève l'attribut 'lecture seule' sur le fichier
                    File2.RemoveAttribute(FileName, FileAttributes.ReadOnly);

                    mapWriter = new BinaryWriter(new FileStream(FileName, FileMode.Open));
                    mapWriter.BaseStream.Seek(e.address, SeekOrigin.Begin);

                    // Taille 1
                    mapWriter.BaseStream.Seek(0x4, SeekOrigin.Current);
                    mapWriter.Write(BinaryTools.ToLittleEndian(size1));

                    // Taille 2
                    mapWriter.BaseStream.Seek(0x4, SeekOrigin.Current);
                    mapWriter.Write(BinaryTools.ToLittleEndian(size2));

                    // Mise à jour de la liste d'entrées
                    EntryList.Remove(fileId);
                    EntryList.Add(fileId, e);
                }
                finally
                {
                    if (mapWriter != null)
                    {
                        mapWriter.Close();
                    }
                }
            }
        }
Пример #23
0
        protected static void GetMissingEntries()
        {
            DataTable dt = new DataTable();

            dt.Columns.Add("No");
            dt.Columns.Add("Entry Id");
            dt.Columns.Add("File Name");
            dt.Columns.Add("Original Size (MB)");
            dt.Columns.Add("Date");

            List <FileInfo> sortedFiles = new List <FileInfo>();

            var entryList = EntryList.GetEntryList(Guid.Empty, Guid.Empty, "", StatusEntry.Completed)
                            .OrderBy(m => m.DateSubmitted).ToList();

            var videFileList = new DirectoryInfo(System.Configuration.ConfigurationSettings.AppSettings["VideosFileFolder"].ToString()).GetFiles().ToList();

            int counter = 1;

            foreach (FileInfo file in videFileList)
            {
                string entryId = file.Name.Split('_')[0];

                Entry entry = null;

                try
                {
                    entry = entryList.Where(m => m.Serial.Equals(entryId)).Single();
                }
                catch { }

                if (entry != null)
                {
                    if (!FileExistsInAmazonS3(System.Configuration.ConfigurationSettings.AppSettings["AWSBucket_Original"], file.Name))
                    {
                        DataRow dr = dt.NewRow();

                        dr["No"]                 = counter.ToString();
                        dr["Entry Id"]           = entryId;
                        dr["File Name"]          = file.Name;
                        dr["Original Size (MB)"] = file.Length / 1048576;
                        dr["Date"]               = file.LastAccessTime;

                        dt.Rows.Add(dr);

                        counter++;
                    }
                }
            }

            CreateCSVFile(dt, System.Configuration.ConfigurationSettings.AppSettings["LogFileFolder"] + "Missing_Entry_List.csv");
        }
Пример #24
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Message.Text = "";
     if (!Page.IsPostBack)
     {
         //on the first presentation of the page
         if (entries.Count > 0)
         {
             EntryList.DataSource = entries;
             EntryList.DataBind();
         }
     }
 }
        /// <summary>
        /// Get the user id of the user with this email address, if any.
        /// </summary>
        /// <param name="username">the username to seek.</param>
        /// <returns>An id if available, else the empty string.</returns>
        public static string GetUserId(string username)
        {
            string result = string.Empty;

            EntryList list = GetEntryList("Users", $"users.user_name LIKE '%{MySqlEscape(username)}%'", 0, "id DESC", 0, false, new string[] { "id" });

            if (list?.entry_list != null && list.entry_list.Count() > 0)
            {
                result = list.entry_list[0].id;
            }

            return(result);
        }
Пример #26
0
        public void SetReplacement(IList <ReplacementEntry> indexList)
        {
            EntryList.Clear();
            foreach (ReplacementEntry Index in indexList)
            {
                EntryList.Add(Index);
            }

            if (listOptions.SelectedIndex < 0 && EntryList.Count > 0)
            {
                listOptions.SelectedIndex = 0;
            }
        }
        protected void Submit_Click(object sender, EventArgs e)
        {
            //the client side execution of your validation controls
            // is done by using Page.IsValid
            if (Page.IsValid)
            {
                //you may have logic testing to do
                //if you have a prompt line on your DDL, test for it
                //our entry form has a Terms acceptance test
                //  yes: save entry, add to collection and display
                //   no: message
                //the Term data will NOT be saved
                //the CheckAnswer will NOT be saved
                if (Terms.Checked)
                {
                    //need a new instance of CEntry
                    CEntry theEntry = new CEntry();

                    //need to fill/load the instance
                    theEntry.FirstName      = FirstName.Text;
                    theEntry.LastName       = LastName.Text;
                    theEntry.StreetAddress1 = StreetAddress1.Text;
                    theEntry.StreetAddress2 =
                        string.IsNullOrEmpty(StreetAddress2.Text) ? null: StreetAddress2.Text;
                    theEntry.City         = City.Text;
                    theEntry.Province     = Province.SelectedValue;
                    theEntry.PostalCode   = PostalCode.Text;
                    theEntry.EmailAddress = EmailAddress.Text;

                    //need to add the instance to my collection
                    Entries.Add(theEntry);

                    //Entries.Add(new CEntry(FirstName.Text,
                    //                        LastName.Text,
                    //                        StreetAddress1.Text,
                    //                        string.IsNullOrEmpty(StreetAddress2.Text) ? null : StreetAddress2.Text,
                    //                        City.Text,
                    //                        Province.SelectedValue,
                    //                        PostalCode.Text,
                    //                        EmailAddress.Text));

                    //need to display the collection
                    EntryList.DataSource = Entries;
                    EntryList.DataBind();
                }
                else
                {
                    Message.Text = "You did not agree to terms. Entry rejected.";
                }
            }
        }
Пример #28
0
    private IEnumerator Refresh()
    {
        if (State == TabState.Off)
        {
            yield break;
        }
        EntryList.RefreshTrackedPos();
        yield return(new WaitForSeconds(2f));

        if (RefreshRadar)
        {
            StartCoroutine(Refresh());
        }
    }
Пример #29
0
        protected void Submit_Click(object sender, EventArgs e)
        {
            //the client side execution of your validation controls
            //  is done by using Page.IsValid
            if (Page.IsValid)
            {
                //you may have logic testing to do
                //if you have a prompt line on your DDL, test for it
                //our entry form has a Terms acceptance test
                //  yes: save entry, add to collection, display
                //   no: message
                //the Term data and Check Answer data will NOT be saved
                if (Terms.Checked)
                {
                    //create new instance
                    //theEntry = new CEntry();

                    //load new instance with form data
                    //theEntry.FirstName = FirstName.Text;
                    //theEntry.LastName = LastName.Text;
                    //theEntry.StreetAddress1 = StreetAddress1.Text;
                    //theEntry.StreetAddress2 = string.IsNullOrEmpty(StreetAddress2.Text)? null: StreetAddress2.Text;
                    //theEntry.City = City.Text;
                    //theEntry.Province = Province.SelectedValue;
                    //theEntry.PostalCode = PostalCode.Text;
                    //theEntry.EmailAddress = EmailAddress.Text;


                    //add to collection
                    //Entries.Add(theEntry);

                    //using the greedy constructor, create,load,add in one statement
                    Entries.Add(new CEntry(FirstName.Text,
                                           LastName.Text,
                                           StreetAddress1.Text,
                                           string.IsNullOrEmpty(StreetAddress2.Text)? null: StreetAddress2.Text,
                                           City.Text,
                                           Province.SelectedValue,
                                           PostalCode.Text,
                                           EmailAddress.Text));

                    EntryList.DataSource = Entries;
                    EntryList.DataBind();
                }
                else
                {
                    Message.Text = "You did not agree to the contest entry terms. Entry rejected";
                }
            }
        }
Пример #30
0
        internal static List <string> LoadAll()
        {
            if (!Platform.DirectoryExists("plugins"))
            {
                Platform.DirectoryCreate("plugins");
            }

            Accepted = new EntryList("plugins", "accepted.txt");
            Denied   = new EntryList("plugins", "denied.txt");
            Accepted.Load();
            Denied.Load();

            return(LoadPlugins());
        }
Пример #31
0
        public async static void CreateListItemView()
        {
            PageContain.Children.Clear();
            EntryList itemlist = new EntryList();

            itemlist.listview.ItemSelected += ItemSelected;
            itemlist.listview.ItemsSource   = await DataOperation.GetData();

            Label infolabel = new Label {
                Text = "schoen dich zu sehen"
            };

            PageContain.Children.Add(itemlist.viewcontain);
        }
Пример #32
0
		/// <summary>
		/// Invoked when disposing or finalizing this instance.
		/// </summary>
		/// <param name="disposing">True if the object is being disposed, false otherwise.</param>
		protected virtual void OnDispose(bool disposing)
		{
			if (disposing)
			{
				try
				{
					if (_Members != null)
					{
						var list = _Members.ToArray();
						foreach (var member in list) member.Dispose();
						Array.Clear(list, 0, list.Length);
					}

					if (_Aliases != null && !_Aliases.IsDisposed) _Aliases.Dispose();
				}
				catch { }
			}

			_Members = null;
			_Aliases = null;

			_IsDisposed = true;
		}
Пример #33
0
        public EntryData GetEntryData(string url) 
        {

            WebRequest request = WebRequest.Create(url);
            XmlDocument atomDoc = null;

            using (WebResponse response = request.GetResponse())
            {
                Stream atomStream = response.GetResponseStream();
                
                atomDoc = new XmlDocument();
                atomDoc.Load(atomStream);

                atomStream.Close();
                response.Close();
            }

            XmlNamespaceManager nsmanager = new XmlNamespaceManager(atomDoc.NameTable);
            nsmanager.AddNamespace("default", "http://www.w3.org/2005/Atom");

            EntryData entryData = new EntryData();

            EntryList entryList = new EntryList();
            entryData.EntryList = entryList;

            XmlNode updatedNode = atomDoc.SelectSingleNode("default:feed/default:updated", nsmanager);
            if (updatedNode != null)
            {
                // format 2009-12-24T05:53:20Z
                // format 2013-01-23T11:51:59-07:0 +0
                string dateString = updatedNode.InnerText;
                if (dateString.Contains("-07:0"))
                {
                    dateString = dateString.Replace("-07:0", " -7");
                }
                else
                {
                    dateString = dateString.Substring(0, dateString.Length - 1) + " +0";
                }
                DateTime updatedDate = DateParser.Parse(dateString, "yyyy'-'MM'-'dd'T'HH':'mm':'ss z");
                entryData.LastBuildDate = updatedDate;
            }

            XmlNodeList atomEntryNodeList = atomDoc.SelectNodes("default:feed/default:entry", nsmanager);

            if (atomEntryNodeList != null)
            {
                Console.WriteLine("LIST " + atomEntryNodeList.Count);

                foreach (XmlNode atomEntryNode in atomEntryNodeList)
                {
                    Entry entry = new Entry();

                    foreach (XmlNode childNode in atomEntryNode.ChildNodes)
                    {
                        if (childNode.Name == "title")
                        {
                            entry.Title = childNode.InnerText;
                        }
                        else if (childNode.Name == "id")
                        {
                            entry.ID = childNode.InnerText;
                        }
                        else if (childNode.Name == "content")
                        {
                            entry.Content = childNode.InnerText;
                        }
                        else
                        {
                            entry.Set(childNode.Name, childNode.InnerText);
                        }
                    }
                    entryList.Add(entry);
                }
            }
            return entryData;
        }
Пример #34
0
		/// <summary>
		/// Protected initializer required for custom serialization.
		/// </summary>
		protected Schema(SerializationInfo info, StreamingContext context)
		{
			_CaseSensitiveNames = info.GetBoolean("CaseSensitiveNames");
			_Aliases = info.GetExtended<IElementAliasCollection>("Aliases");

			_Members = new EntryList(_CaseSensitiveNames);
			int count = (int)info.GetValue("MembersCount", typeof(int));
			for (int i = 0; i < count; i++)
			{
				var member = info.GetExtended<ISchemaEntry>("Member" + i);
				_Members.Add(member);
			}
		}