Exemple #1
0
		/// <summary>
		/// Writes all information about Phalanger and external PHP modules to output.
		/// </summary>
		/// <param name="output">An output where to write information.</param>
		/// <param name="sections">A mask of sections which to write.</param>
		public static void Write(Sections/*!*/ sections, TextWriter/*!*/ output)
		{
			output.Write(htmlPrologue);
			output.Write(htmlStyle, htmlCss);

			if ((sections & Sections.General) != 0)
			{
				WriteLogo(output);
			}

			if ((sections & (Sections.Configuration | Sections.General)) != 0)
			{
				output.Write("<h2>");
				output.Write(CoreResources.GetString("info_config"));
				output.Write("</h2>");
				WriteConfiguration(output);
			}

			if ((sections & Sections.Credits) != 0)
			{
				output.Write("<h2>");
				output.Write(CoreResources.GetString("info_credits"));
				output.Write("</h2>");
				WriteCredits(output);
			}

			if ((sections & Sections.Extensions) != 0)
			{
				output.Write("<h2>");
				output.Write(CoreResources.GetString("info_loaded_extensions"));
				output.Write("</h2>");
				// TODO: loaded extensions
			}

			if ((sections & Sections.Environment) != 0)
			{
				output.Write("<h2>");
				output.Write(CoreResources.GetString("info_environment_variables"));
				output.Write("</h2>");
				WriteEnvironmentVariables(output);
			}

			if ((sections & Sections.Variables) != 0)
			{
				output.Write("<h2>");
				output.Write(CoreResources.GetString("info_global_variables"));
				output.Write("</h2>");
				WriteGlobalVariables(output);
			}

			if ((sections & Sections.License) != 0)
			{
				output.Write("<h2>");
				output.Write(CoreResources.GetString("info_license"));
				output.Write("</h2>");
				WriteLicense(output);
			}

			output.Write(htmlEpilogue);
		}
        /// <summary>
        /// Decrypts configuration sections.
        /// </summary>
        /// <param name="filename">App.config/Web.config filename.</param>
        /// <param name="sections">Sections enum value.</param>
        /// <returns>Returns the configuration file path.</returns>
        private string DecryptSections(string filename, Sections sections)
        {
            var configuration = ConfigurationManager.OpenExeConfiguration(filename);
            if (sections.HasFlag(Sections.ConnectionStrings))
            {
                var connectionStringsSection = configuration.GetSection("connectionStrings") as ConnectionStringsSection;
                if (IsSectionAvailable(connectionStringsSection, Direction.Decrypt))
                {
                    connectionStringsSection.SectionInformation.UnprotectSection();
                    connectionStringsSection.SectionInformation.ForceSave = true;
                }
            }

            if (sections.HasFlag(Sections.AppSettings))
            {
                var appSettingsSection = configuration.GetSection("appSettings") as AppSettingsSection;
                if (IsSectionAvailable(appSettingsSection, Direction.Decrypt))
                {
                    appSettingsSection.SectionInformation.UnprotectSection();
                    appSettingsSection.SectionInformation.ForceSave = true;
                }
            }
            configuration.Save();
            return configuration.FilePath;
        }
    protected void ddlAssesment_SelectedIndexChanged(object sender, EventArgs e)
    {
        try
        {
            int stdOID = Convert.ToInt32(ViewState["STDOID"]);
            int stuOID = Convert.ToInt32(Session["STUOID"]);
            //string  stdOID = (string)ViewState["STDOID"];

            string strSectionName = null;
            strSectionName = ddlAssesment.SelectedItem.ToString();
            //PopulateSection(strSectionName, stdOID);
            //PopulateSectionNoScore(ddlAssesment.Text.ToString(), stdOID);

            PopulateSection(strSectionName, lblID.Text);
            PopulateSectionNoScore(ddlAssesment.Text.ToString(), lblID.Text);

            //This Code for Risk Calculation
            int AOID = new Sections().GetAssessmentOIDByAssessmentName(strSectionName);
            this.BindRiskCalculation(AOID, stdOID);
            Answer ans = new Answer();
            ans = ans.CheckBannerID_Answer(lblID.Text, AOID);
            if (ans.CreatedDate != null)
            {
                lblDate.Text = ans.CreatedDate.ToShortDateString();
            }

        }
        catch (Exception ex)
        { }
    }
        /// <summary>
        /// Sets the parameters from the list of arguments.
        /// </summary>
        /// <param name="args">List of arguments.</param>
        private void SetParameter(string[] args)
        {
            this.Direction = Direction.None;
            var direction = args.FirstOrDefault(p => p.ToLower() == "/e" || p.ToLower() == "/d");
            if (!String.IsNullOrWhiteSpace(direction))
            {
                switch (direction)
                {
                    case "/e":
                        this.Direction = Direction.Encrypt;
                        break;

                    case "/d":
                        this.Direction = Direction.Decrypt;
                        break;
                }
            }

            var filename = args.FirstOrDefault(p => p.ToLower().StartsWith("/c:"));
            if (!String.IsNullOrWhiteSpace(filename))
                this.Filename = filename.Replace("/c:", "");

            this.Sections = Sections.None;
            foreach (var arg in args.Where(p => !p.ToLower().StartsWith("/")))
            {
                ConsoleApp.Sections result;
                this.Sections |= Enum.TryParse(arg, true, out result) ? result : Sections.None;
            }
        }
 private Sections ConvertStringToSections(string encoded)
 {
     Sections retval = new Sections();
     string[] sections = encoded.Split(new string[] { SectionDelimiter.ToString() }, StringSplitOptions.None);
     foreach (var section in sections)
     {
         string[] pairs = section.Split(new string[] { SectionPairDelimiter.ToString() }, StringSplitOptions.None);
         retval.Add(pairs[0], this.ConvertStringToEntries(pairs[1]));
     }
     return retval;
 }
Exemple #6
0
        public void TestMethod1()
        {
            Sections s = new Sections();

            s.Add(new Section("test1"));
            s.Add(new Section("test2"));
            s.Add(new Section("test3"));

            foreach (Section ss in s)
            {
                Console.WriteLine(ss.Name);
            }
        }
Exemple #7
0
    public void OpenTab(Sections zSection)
    {
        CloseAllTabs(zSection);

        switch (zSection)
        {
            case Sections.Attributes: Attributes.Open(); break;
            case Sections.Modifiers: Modifiers.Open(); break;
            case Sections.Powers: Powers.Open(); break;
            case Sections.Notes: Notes.Open(); break;
        }

        AppManager.Instance.SoundManager.Play("Pick");
    }
        public void ICanSerializeAndDeserializeProcDetailData()
        {
            Sections procData = new Sections();
            string[] args = new string[] { "a", "b", "c" };
            IDictionary<string, string> vars = new Dictionary<string, string>() { { "a", "1" }, { "b", "2" }, { "c", "3" } };
            ProcDetails procDetails = new ProcDetails(args);
            procData.Add(ProcDetails.CommandLineArguments, Entries.MakeEntries(args));
            procData.Add(ProcDetails.EnvironmentVariables, new Entries(vars));
            procData.Add(ProcDetails.CoreSiteSettings, new Entries(vars));
            procData.Add(ProcDetails.HiveSiteSettings, new Entries(vars));
            procData.Add(ProcDetails.MapRedSiteSettings, new Entries(vars));

            SectionsSerializer ser = new SectionsSerializer();
            var content = ser.Serialize(procData);
            Sections deserialized = ser.Deserialize(content);
            Help.DoNothing(deserialized);
            Help.DoNothing(procDetails);
        }
        public IEnumerable<Media> GetData(Sections section, int count)
        {
            var applicableBooks = _bookService.GetAll(section) ?? Enumerable.Empty<Book>();
            var applicableSongs = _songService.GetAll(section) ?? Enumerable.Empty<Song>();
            var applicableMovies = _movieService.GetAll(section) ?? Enumerable.Empty<Movie>();

            foreach (var book in applicableBooks)
            {
                yield return book;
            }
            foreach (var movie in applicableMovies)
            {
                yield return movie;
            }
            foreach (var song in applicableSongs)
            {
                yield return song;
            }
        }
Exemple #10
0
    protected void btnDeleteSection_Click(object sender, EventArgs e)
    {
        Sections sec = new Sections();
        Question ques=new Question ();
        Assessment ass = new Assessment();
        AnswerDetail ansDetail = new AnswerDetail();
        CVTCMenu menu=new CVTCMenu ();
        QuestionResponse qr=new QuestionResponse ();
        int sectOID = Convert.ToInt32(Request.QueryString["soid"].ToString());
        int AssOID = sec.GetAssessmentOIDBySectionOID(sectOID);
        if (ass.GetAssessmentStatusByOID(Convert.ToInt32(AssOID)) == 1)
        {
            LabelMessage.Text = "This group can not be deleted.It has been Locked";
            return;
        }
        else
        {
            string menuURL = "pg/assessment/section.aspx?soid=" + sectOID + "";
            //Delete from AnswerDetails and Question Table by SectionOID
            bool DeleteFromAnswerDetail=ansDetail.DeleteAnswerDetailBySectionOID(sectOID);
            Collection<Question> qList = new Collection<Question>();
            qList = ques.GetQuestionOIDBySectionOID(sectOID);
            foreach (Question q in qList )
            {
                qr.DeleteQuestionBySectionOID(q.QuestionOID);
            }
            bool DeleteFromQuestion = ques.DeleteQuestionBySectionOID(sectOID);
            bool DeleteFromMenu = menu.DeleteMenuByMenuURL(menuURL);
            bool DeleteFromSection = sec.DeleteSectionBySectionOID(sectOID);
            if (DeleteFromSection && DeleteFromMenu)
            {

                InitializeQuestion(sectOID);
                LabelMessage.Text = "This question group has been deleted successfully";
            }
            else
            {
                LabelMessage.Text = "This question group can not be deleted.Please try again..";
            }
            ButtonRefresh_Click(null, null);
        }
    }
Exemple #11
0
        private ExecutableImage(Stream sourceStream, bool ownStream)
        {
            _disposed = false;
            _stream = sourceStream;
            _own_stream = ownStream;
            _calc = null;

            _dos_header = null;
            _dos_stub = null;
            _nt_headers = null;
            _section_table = null;
            _sections = null;

            _is_32bit = false;
            _is_64bit = false;
            _is_clr = false;
            _is_signed = false;

            Load();
        }
Exemple #12
0
        private ExeReader(Stream sourceStream, bool ownStream)
        {
            if (!sourceStream.CanRead)
                throw new IOException("Cannot read from stream.");

            if (!sourceStream.CanSeek)
                throw new IOException("Cannot seek in stream.");

            _disposed = false;
            _stream = sourceStream;
            _own_stream = ownStream;

            _dos_header = null;
            _dos_stub = null;
            _nt_headers = null;
            _section_table = null;
            _sections = null;

            is_32bit = false;
            is_64bit = false;
            is_clr = false;
        }
 internal virtual void VisitSections(Sections sections) { }
Exemple #14
0
        /// <summary>
        /// Reads the APP1 section containing Exif metadata.
        /// </summary>
        private void ReadExifAPP1()
        {
            // Find the APP1 section containing Exif metadata
            exifApp1 = Sections.Find(a => (a.Marker == JPEGMarker.APP1) &&
                                     a.Header.Length >= 6 &&
                                     (Encoding.ASCII.GetString(a.Header, 0, 6) == "Exif\0\0"));

            // If there is no APP1 section, add a new one after the last APP0 section (if any).
            if (exifApp1 == null)
            {
                int insertionIndex = Sections.FindLastIndex(a => a.Marker == JPEGMarker.APP0);
                if (insertionIndex == -1)
                {
                    insertionIndex = 0;
                }
                insertionIndex++;
                exifApp1 = new JPEGSection(JPEGMarker.APP1);
                Sections.Insert(insertionIndex, exifApp1);
                if (BitConverterEx.SystemByteOrder == BitConverterEx.ByteOrder.LittleEndian)
                {
                    ByteOrder = BitConverterEx.ByteOrder.LittleEndian;
                }
                else
                {
                    ByteOrder = BitConverterEx.ByteOrder.BigEndian;
                }
                return;
            }

            byte[] header = exifApp1.Header;
            SortedList <int, IFD> ifdqueue = new SortedList <int, IFD>();

            makerNoteOffset = 0;

            // TIFF header
            int tiffoffset = 6;

            if (header[tiffoffset] == 0x49 && header[tiffoffset + 1] == 0x49)
            {
                ByteOrder = BitConverterEx.ByteOrder.LittleEndian;
            }
            else if (header[tiffoffset] == 0x4D && header[tiffoffset + 1] == 0x4D)
            {
                ByteOrder = BitConverterEx.ByteOrder.BigEndian;
            }
            else
            {
                throw new NotValidExifFileException();
            }

            // TIFF header may have a different byte order
            BitConverterEx.ByteOrder tiffByteOrder = ByteOrder;
            if (BitConverterEx.LittleEndian.ToUInt16(header, tiffoffset + 2) == 42)
            {
                tiffByteOrder = BitConverterEx.ByteOrder.LittleEndian;
            }
            else if (BitConverterEx.BigEndian.ToUInt16(header, tiffoffset + 2) == 42)
            {
                tiffByteOrder = BitConverterEx.ByteOrder.BigEndian;
            }
            else
            {
                throw new NotValidExifFileException();
            }

            // Offset to 0th IFD
            int ifd0offset = (int)BitConverterEx.ToUInt32(header, tiffoffset + 4, tiffByteOrder, BitConverterEx.SystemByteOrder);

            ifdqueue.Add(ifd0offset, IFD.Zeroth);

            BitConverterEx conv        = new BitConverterEx(ByteOrder, BitConverterEx.SystemByteOrder);
            int            thumboffset = -1;
            int            thumblength = 0;
            int            thumbtype   = -1;

            // Read IFDs
            while (ifdqueue.Count != 0)
            {
                int ifdoffset  = tiffoffset + ifdqueue.Keys[0];
                IFD currentifd = ifdqueue.Values[0];
                ifdqueue.RemoveAt(0);

                // Field count
                ushort fieldcount = conv.ToUInt16(header, ifdoffset);
                for (short i = 0; i < fieldcount; i++)
                {
                    // Read field info
                    int    fieldoffset = ifdoffset + 2 + 12 * i;
                    ushort tag         = conv.ToUInt16(header, fieldoffset);
                    ushort type        = conv.ToUInt16(header, fieldoffset + 2);
                    uint   count       = conv.ToUInt32(header, fieldoffset + 4);
                    byte[] value       = new byte[4];
                    Array.Copy(header, fieldoffset + 8, value, 0, 4);

                    // Fields containing offsets to other IFDs
                    if (currentifd == IFD.Zeroth && tag == 0x8769)
                    {
                        int exififdpointer = (int)conv.ToUInt32(value, 0);
                        ifdqueue.Add(exififdpointer, IFD.EXIF);
                    }
                    else if (currentifd == IFD.Zeroth && tag == 0x8825)
                    {
                        int gpsifdpointer = (int)conv.ToUInt32(value, 0);
                        ifdqueue.Add(gpsifdpointer, IFD.GPS);
                    }
                    else if (currentifd == IFD.EXIF && tag == 0xa005)
                    {
                        int interopifdpointer = (int)conv.ToUInt32(value, 0);
                        ifdqueue.Add(interopifdpointer, IFD.Interop);
                    }

                    // Save the offset to maker note data
                    if (currentifd == IFD.EXIF && tag == 37500)
                    {
                        makerNoteOffset = conv.ToUInt32(value, 0);
                    }

                    // Calculate the bytes we need to read
                    uint baselength = 0;
                    if (type == 1 || type == 2 || type == 7)
                    {
                        baselength = 1;
                    }
                    else if (type == 3)
                    {
                        baselength = 2;
                    }
                    else if (type == 4 || type == 9)
                    {
                        baselength = 4;
                    }
                    else if (type == 5 || type == 10)
                    {
                        baselength = 8;
                    }
                    uint totallength = count * baselength;

                    // If field value does not fit in 4 bytes
                    // the value field is an offset to the actual
                    // field value
                    int fieldposition = 0;
                    if (totallength > 4)
                    {
                        fieldposition = tiffoffset + (int)conv.ToUInt32(value, 0);
                        value         = new byte[totallength];
                        Array.Copy(header, fieldposition, value, 0, totallength);
                    }

                    // Compressed thumbnail data
                    if (currentifd == IFD.First && tag == 0x201)
                    {
                        thumbtype   = 0;
                        thumboffset = (int)conv.ToUInt32(value, 0);
                    }
                    else if (currentifd == IFD.First && tag == 0x202)
                    {
                        thumblength = (int)conv.ToUInt32(value, 0);
                    }

                    // Uncompressed thumbnail data
                    if (currentifd == IFD.First && tag == 0x111)
                    {
                        thumbtype = 1;
                        // Offset to first strip
                        if (type == 3)
                        {
                            thumboffset = (int)conv.ToUInt16(value, 0);
                        }
                        else
                        {
                            thumboffset = (int)conv.ToUInt32(value, 0);
                        }
                    }
                    else if (currentifd == IFD.First && tag == 0x117)
                    {
                        thumblength = 0;
                        for (int j = 0; j < count; j++)
                        {
                            if (type == 3)
                            {
                                thumblength += (int)conv.ToUInt16(value, 0);
                            }
                            else
                            {
                                thumblength += (int)conv.ToUInt32(value, 0);
                            }
                        }
                    }

                    // Create the exif property from the interop data
                    ExifProperty prop = ExifPropertyFactory.Get(tag, type, count, value, ByteOrder, currentifd, Encoding);
                    Properties.Add(prop);
                }

                // 1st IFD pointer
                int firstifdpointer = (int)conv.ToUInt32(header, ifdoffset + 2 + 12 * fieldcount);
                if (firstifdpointer != 0)
                {
                    ifdqueue.Add(firstifdpointer, IFD.First);
                }
                // Read thumbnail
                if (thumboffset != -1 && thumblength != 0 && Thumbnail == null)
                {
                    if (thumbtype == 0)
                    {
                        using (MemoryStream ts = new MemoryStream(header, tiffoffset + thumboffset, thumblength))
                        {
                            Thumbnail = ImageFile.FromStream(ts);
                        }
                    }
                }
            }
        }
 /// <summary>
 /// To add the section of the layout based on ZCRMSection class instance.
 /// </summary>
 /// <param name="section">ZCRMSection class instance</param>
 public void AddSection(ZCRMSection section)
 {
     Sections.Add(section);
 }
Exemple #16
0
        private void Load()
        {
            string error_message = String.Empty;
            PreloadedInformation preload_info = TryPreload(_stream,out error_message);

            if (preload_info == null)
                throw new ExecutableImageException(error_message);

            ulong image_base = 0;

            if (preload_info.OptHeader32 != null)
                image_base = preload_info.OptHeader32.Value.ImageBase;

            if (preload_info.OptHeader64 != null)
                image_base = preload_info.OptHeader64.Value.ImageBase;

            _dos_header = new DOSHeader(this,preload_info.DOSHeader,image_base);
            _dos_stub = new DOSStub(this,preload_info.StubOffset,preload_info.StubSize,image_base);

            FileHeader file_header = new FileHeader(this,preload_info.FileHeader,_dos_stub.Location.FileOffset + _dos_stub.Location.FileSize + 4,image_base);
            OptionalHeader opt_header;

            if (preload_info.Is32Bit)
            {
                opt_header = new OptionalHeader32(this,preload_info.OptHeader32.Value,file_header.Location.FileOffset + file_header.Location.FileSize,image_base);
            }
            else
            {
                opt_header = new OptionalHeader64(this,preload_info.OptHeader64.Value,file_header.Location.FileOffset + file_header.Location.FileSize,image_base);
            }

            DataDirectoryCollection data_dirs = new DataDirectoryCollection(this,opt_header,preload_info.DataDirectories);

            _nt_headers = new NTHeaders(this,file_header.Location.FileOffset - 4,image_base,file_header,opt_header,data_dirs);
            _section_table = new SectionTable(this,preload_info.SectionHeaders,_nt_headers.Location.FileOffset + _nt_headers.Location.FileSize,image_base);
            _sections = new Sections(_section_table);

            _is_32bit = preload_info.Is32Bit;
            _is_64bit = preload_info.Is64Bit;
            _is_clr = preload_info.IsCLR;
            _is_signed = preload_info.IsSigned;
        }
        internal override void Dispose(bool disposing)
        {
            if (disposing)
            {
                // Free managed
                if (_sections != null && !_sections.IsDisposed)
                {
                    _sections.Dispose();
                    _sections = null;
                }

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

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

            base.Dispose(true);
        }
Exemple #18
0
Fichier : Uri.cs Projet : xored/f4
        //////////////////////////////////////////////////////////////////////////
        // Relativize
        //////////////////////////////////////////////////////////////////////////
        public Uri relTo(Uri baseUri)
        {
            if (!OpUtil.compareEQ(this.m_scheme,   baseUri.m_scheme) ||
              !OpUtil.compareEQ(this.m_userInfo, baseUri.m_userInfo) ||
              !OpUtil.compareEQ(this.m_host,     baseUri.m_host) ||
              !OpUtil.compareEQ(this.m_port,     baseUri.m_port))
            return this;

              // at this point we know we have the same scheme and auth, and
              // we're going to create a new URI which is a subset of this one
              Sections t = new Sections();
              t.query    = this.m_query;
              t.queryStr = this.m_queryStr;
              t.frag     = this.m_frag;

              // find divergence
              int d=0;
              int len = Math.Min(this.m_path.sz(), baseUri.m_path.sz());
              for (; d<len; ++d)
            if (!this.m_path.get(d).Equals(baseUri.m_path.get(d)))
              break;

              // if diverenge is at root, then no commonality
              if (d == 0)
              {
            // `/a/b/c`.relTo(`/`) should be `a/b/c`
            if (baseUri.m_path.isEmpty() && this.m_pathStr.StartsWith("/"))
            {
              t.path = this.m_path;
              t.pathStr = this.m_pathStr.Substring(1);
            }
            else
            {
              t.path = this.m_path;
              t.pathStr = this.m_pathStr;
            }
              }

              // if paths are exactly the same
              else if (d == this.m_path.sz() && d == baseUri.m_path.sz())
              {
            t.path = emptyPath();
            t.pathStr = string.Empty;
              }

              // create sub-path at divergence point
              else
              {
            // slice my path
            t.path = this.m_path.getRange(Range.makeInclusive(d, -1));

            // insert .. backup if needed
            int backup = baseUri.m_path.sz() - d;
            if (!baseUri.isDir()) backup--;
            while (backup-- > 0) t.path.insert(0, dotDot);

            // format the new path string
            t.pathStr = toPathStr(false, t.path, this.isDir());
              }

              return new Uri(t);
        }
Exemple #19
0
Fichier : Uri.cs Projet : xored/f4
        //////////////////////////////////////////////////////////////////////////
        // Plus
        //////////////////////////////////////////////////////////////////////////
        public Uri plus(Uri r)
        {
            // if r is more or equal as absolute as base, return r
              if (r.m_scheme != null) return r;
              if (r.m_host != null && this.m_scheme == null) return r;
              if (r.isPathAbs() && this.m_host == null) return r;

              // this algorthm is lifted straight from
              // RFC 3986 (5.2.2) Transform References;
              Uri baseUri = this;
              Sections t = new Sections();
              if (r.m_host != null)
              {
            t.setAuth(r);
            t.setPath(r);
            t.setQuery(r);
              }
              else
              {
            if (r.m_pathStr == null || r.m_pathStr == "")
            {
              t.setPath(baseUri);
              if (r.m_queryStr != null)
            t.setQuery(r);
              else
            t.setQuery(baseUri);
            }
            else
            {
              if (r.m_pathStr.StartsWith("/"))
            t.setPath(r);
              else
            merge(t, baseUri, r);
              t.setQuery(r);
            }
            t.setAuth(baseUri);
              }
              t.scheme = baseUri.m_scheme;
              t.frag   = r.m_frag;
              t.normalize();
              return new Uri(t);
        }
        public StorageForm()
        {
            Title = "Choose Storage";

            Sections.Add(new FileSystemsSection());
        }
Exemple #21
0
        public InspectionDetail(Sections selectedSection)
        {
            Title = "Inspection Checklist";

            SelectedFriendlyName = selectedSection.SectionFriendlyName;
            formService          = new FormService();

            CreateToolBar();
            CreateErrorLabel();

            //Get Form Instance
            formInstance     = formService.GetFormInstance(AppDataWallet.SelectedAssessmentMetadata.AssessmentTrackingNumber.ToString(), selectedSection.SectionFriendlyName);
            ValidationSchema = formInstance.ValidationSchema;

            //generate Layout Dynamically
            PageLayout = new StackLayout();

            StackLayout formNameLayout = new StackLayout();

            formNameLayout.Padding = new Thickness(25, 25, 0, 0);
            Label lblFormName = new Label();

            lblFormName.Text      = selectedSection.SectionDisplayName;
            lblFormName.TextColor = Color.FromHex("#000000");
            lblFormName.FontSize  = 30;
            formNameLayout.Children.Add(lblFormName);
            PageLayout.Children.Add(formNameLayout);

            questionNavigationButtonBarLayout             = new StackLayout();
            questionNavigationButtonBarLayout.Orientation = StackOrientation.Horizontal;
            questionNavigationButtonBarLayout.Padding     = new Thickness(25, 10, 10, 10);
            PageLayout.Children.Add(questionNavigationButtonBarLayout);

            //Create Button list for Navigation
            Button questionButton;

            foreach (FormGroup fg in formInstance.FormModelView.formgroups)
            {
                questionButton = new Button();
                questionButton.WidthRequest     = 80;
                questionButton.HeightRequest    = 80;
                questionButton.CornerRadius     = 40;
                questionButton.Margin           = new Thickness(0, 0, 20, 0);
                questionButton.BackgroundColor  = Color.FromHex("#EAEAEA");
                questionButton.Text             = fg.text;
                questionButton.TextColor        = Color.Black;
                questionButton.Clicked         += QuestionButton_Clicked;
                questionButton.CommandParameter = fg;
                questionNavigationButtonBarLayout.Children.Add(questionButton);
            }

            //Add Error Message
            PageLayout.Children.Add(lblErrorMessage);

            //Load First Question
            formGroup = formInstance.FormModelView.formgroups[0];
            LoadFirstQuestionByDefault(formGroup);

            ScrollView scrollView = new ScrollView();

            MessagingCenter.Subscribe <object, List <string> >(this, "PhotoMessageQuestion", async(sender, arg) =>
            {
                var photoAction = await DisplayActionSheet(arg[0], arg[1], arg[2], arg[3]);
                MessagingCenter.Send <object, string>(this, "PhotoMessageAnswer", photoAction);
            });

            //Final Page Content
            //Content = _pageLayout;
            //scrollView = new ScrollView();
            //Content = PageLayout;
            Content = new ScrollView
            {
                Content = PageLayout
            };
        }
Exemple #22
0
 private ActionResult NavigableView <TModel>(string formId, Sections section, Action <TModel, BsgDetail> mutator)
     where TModel : NavigableModel, new()
 {
     return(NavigableView(formId, null, section, mutator));
 }
Exemple #23
0
        /// <summary>
        /// Updates all subsections and/or movies contained in this section
        /// </summary>
        /// <param name="section"></param>
        /// <returns></returns>
        public override NodeResult Update()
        {
            string sectionUri = this.Uri;

            Configuration config = this.session.Config;

            #region Root

            if (sectionUri == Section.RootUri)
            {
                //Sections.Clear();

                //Section subSection = this.session.Get<Section>(Section.FeaturedUri);
                //subSection.Name = "Featured";
                //this.Sections.Add(subSection);

                this.state = NodeState.Complete;
                return(NodeResult.Success);
            }

            #endregion

            #region Featured

            if (sectionUri == Section.FeaturedUri)
            {
                Sections.Clear();

                Section subSection = this.session.Get <Section>(config.FeaturedJustAddedUri);
                subSection.Name = "Just Added";
                Sections.Add(subSection);

                subSection      = this.session.Get <Section>(config.FeaturedMostPopularUri);
                subSection.Name = "Most Popular";
                Sections.Add(subSection);

                subSection      = this.session.Get <Section>(config.FeaturedExclusiveUri);
                subSection.Name = "Exclusive";
                Sections.Add(subSection);

                subSection      = this.session.Get <Section>(config.FeaturedGenresUri);
                subSection.Name = "Genre";
                Sections.Add(subSection);

                subSection      = this.session.Get <Section>(config.FeaturedStudiosUri);
                subSection.Name = "Movie Studio";
                Sections.Add(subSection);

                this.state = NodeState.Complete;
                return(NodeResult.Success);
            }

            #endregion

            bool IsFtGenre  = sectionUri.StartsWith("urn://itunes/featured/genre/");
            bool IsFtStudio = sectionUri.StartsWith("urn://itunes/featured/studio/");

            string requestUri;
            if (IsFtGenre)
            {
                requestUri = config.FeaturedGenresUri;
            }
            else if (IsFtStudio)
            {
                requestUri = config.FeaturedStudiosUri;
            }
            else
            {
                requestUri = Uri;
            }

            string data = this.session.MakeRequest(requestUri);
            Sections.Clear();
            Movies.Clear();

            List <Movie> movies = new List <Movie>();
            movies = Movie.GetMoviesFromJsonData(session, data);

            #region Featured Genres

            if (Uri == config.FeaturedGenresUri)
            {
                var genres = (
                    from m in movies
                    select m.Genres[0]
                    ).Distinct();

                foreach (string genre in genres)
                {
                    string  genreUrn     = "urn://itunes/featured/genre/" + genre.ToLower().Replace(" ", "");
                    Section genreSection = this.session.Get <Section>(genreUrn);

                    if (genreSection.State == NodeState.Complete)
                    {
                        genreSection.Movies.Clear();
                    }

                    genreSection.Name = genre;
                    List <Movie> genresMovies = movies.FindAll(m => m.Genres[0] == genre);
                    genreSection.Movies.AddRange(genresMovies);
                    genreSection.state = NodeState.Complete;
                    Sections.Add(genreSection);
                }
                this.state = NodeState.Complete;
                return(NodeResult.Success);
            }

            #endregion

            #region Featured Studios

            else if (this.uri == config.FeaturedStudiosUri)
            {
                var studios = (
                    from m in movies
                    select m.Studio
                    ).Distinct();

                foreach (string studio in studios)
                {
                    string  studioUrn     = "urn://itunes/featured/studio/" + studio.ToLower().Replace(" ", "");
                    Section studioSection = this.session.Get <Section>(studioUrn);
                    studioSection.Name = studio;
                    List <Movie> studiosMovies = movies.FindAll(m => m.Studio == studio);
                    studioSection.Movies.AddRange(studiosMovies);
                    studioSection.state = NodeState.Complete;
                    Sections.Add(studioSection);
                }

                this.state = NodeState.Complete;
                return(NodeResult.Success);
            }
            #endregion

            #region Featured Subitems

            else if (sectionUri.StartsWith("urn://itunes/featured/genre/"))
            {
                movies = movies.FindAll(m => m.Genres[0] == this.Name);
            }
            else if (sectionUri.StartsWith("urn://itunes/featured/studio/"))
            {
                movies = movies.FindAll(m => m.Studio == this.Name);
            }

            #endregion

            Movies.AddRange(movies);
            this.state = NodeState.Complete;

            return(NodeResult.Success);
        }
 private ParameterEditorScintillaSection GetParameterOnLine(int lineNumber)
 {
     return(Sections.SingleOrDefault(s => s.IncludesLine(lineNumber)));
 }
Exemple #25
0
 /// <summary>
 /// Attempts to find the section containing the provided virtual address.
 /// </summary>
 /// <param name="rva">The virtual address.</param>
 /// <param name="section">The section that was found.</param>
 /// <returns><c>true</c> if the section was found, <c>false</c> otherwise.</returns>
 public bool TryGetSectionContainingRva(uint rva, out PESection section)
 {
     section = Sections.FirstOrDefault(s => s.ContainsRva(rva));
     return(section != null);
 }
Exemple #26
0
        /// <summary>
        /// Replaces the contents of the APP0 section with the JFIF properties.
        /// </summary>
        private bool WriteJFIFApp0()
        {
            // Which IFD sections do we have?
            Dictionary <ExifTag, ExifProperty> ifdjfefExisting = new Dictionary <ExifTag, ExifProperty>();

            foreach (ExifProperty prop in Properties)
            {
                if (prop.IFD == IFD.JFIF)
                {
                    ifdjfefExisting.Add(prop.Tag, prop);
                }
            }

            if (ifdjfefExisting.Count == 0)
            {
                // Nothing to write
                // It is OK for an Exif image to not have a JFIF APP0 segment
                if (jfifApp0 != null)
                {
                    Errors.Add(new ImageError(Severity.Info, "Removing unused JFIF APP0 segment."));
                    Sections.Remove(jfifApp0);
                    jfifApp0 = null;
                }
                return(false);
            }

            // Check and insert missing tags
            List <ExifProperty> ifdjfef = new List <ExifProperty>();

            // Version
            if (ifdjfefExisting.TryGetValue(ExifTag.JFIFVersion, out ExifProperty version))
            {
                ifdjfef.Add(version);
            }
            else
            {
                // default to JFIF version 1.02
                Errors.Add(new ImageError(Severity.Info, "Adding missing JFIF version tag."));
                ifdjfef.Add(new JFIFVersion(ExifTag.JFIFVersion, 1, 2));
            }

            // Units
            if (ifdjfefExisting.TryGetValue(ExifTag.JFIFUnits, out ExifProperty units))
            {
                ifdjfef.Add(units);
            }
            else
            {
                Errors.Add(new ImageError(Severity.Info, "Adding missing JFIF density unit tag."));
                ifdjfef.Add(new ExifEnumProperty <JFIFDensityUnit>(ExifTag.JFIFUnits, JFIFDensityUnit.None));
            }

            // X and Y densities
            if (ifdjfefExisting.TryGetValue(ExifTag.XDensity, out ExifProperty xdensity))
            {
                ifdjfef.Add(xdensity);
            }
            else
            {
                Errors.Add(new ImageError(Severity.Info, "Adding missing JFIF X density tag."));
                ifdjfef.Add(new ExifUShort(ExifTag.XDensity, 1));
            }
            if (ifdjfefExisting.TryGetValue(ExifTag.YDensity, out ExifProperty ydensity))
            {
                ifdjfef.Add(ydensity);
            }
            else
            {
                Errors.Add(new ImageError(Severity.Info, "Adding missing JFIF Y density tag."));
                ifdjfef.Add(new ExifUShort(ExifTag.YDensity, 1));
            }

            // Thumbnails pixel count
            if (ifdjfefExisting.TryGetValue(ExifTag.JFIFXThumbnail, out ExifProperty xthumbnail))
            {
                ifdjfef.Add(xthumbnail);
            }
            else
            {
                Errors.Add(new ImageError(Severity.Info, "Adding missing JFIF X thumbnail pixel count tag."));
                ifdjfef.Add(new ExifByte(ExifTag.JFIFXThumbnail, 0));
            }
            if (ifdjfefExisting.TryGetValue(ExifTag.JFIFYThumbnail, out ExifProperty ythumbnail))
            {
                ifdjfef.Add(ythumbnail);
            }
            else
            {
                Errors.Add(new ImageError(Severity.Info, "Adding missing JFIF Y thumbnail pixel count tag."));
                ifdjfef.Add(new ExifByte(ExifTag.JFIFYThumbnail, 0));
            }

            // JFIF thumbnail
            if (ifdjfefExisting.TryGetValue(ExifTag.JFIFThumbnail, out ExifProperty jfifThumbnail))
            {
                ifdjfef.Add(jfifThumbnail);
            }
            else
            {
                Errors.Add(new ImageError(Severity.Info, "Adding missing JFIF thumbnail tag."));
                ifdjfef.Add(new JFIFThumbnailProperty(ExifTag.JFIFThumbnail, new JFIFThumbnail(JFIFThumbnail.ImageFormat.JPEG, new byte[0])));
            }

            // Create a memory stream to write the APP0 section to
            using (MemoryStream ms = new MemoryStream())
            {
                // JFIF identifer
                ms.Write(Encoding.ASCII.GetBytes("JFIF\0"), 0, 5);

                // Write tags
                foreach (ExifProperty prop in ifdjfef)
                {
                    ExifInterOperability interop = prop.Interoperability;
                    byte[] data = interop.Data;
                    if (BitConverterEx.SystemByteOrder != BitConverterEx.ByteOrder.BigEndian && interop.TypeID == InterOpType.SHORT)
                    {
                        Array.Reverse(data);
                    }
                    ms.Write(data, 0, data.Length);
                }

                // Write APP0 header
                jfifApp0.Header = ms.ToArray();
            }
            return(true);
        }
Exemple #27
0
Fichier : Uri.cs Projet : xored/f4
 //////////////////////////////////////////////////////////////////////////
 // Java Constructors
 //////////////////////////////////////////////////////////////////////////
 private Uri(Sections x)
 {
     m_scheme   = x.scheme;
       m_userInfo = x.userInfo;
       m_host     = x.host;
       m_port     = x.port;
       m_pathStr  = x.pathStr;
       m_path     = x.path.ro();
       m_queryStr = x.queryStr;
       m_query    = x.query.ro();
       m_frag     = x.frag;
       m_str      = x.str != null ? x.str : new Encoder(this, false).encode();
 }
Exemple #28
0
 public virtual void VisitSections(Sections sections)
 {
 }
Exemple #29
0
Fichier : Uri.cs Projet : xored/f4
        public Uri plusQuery(Map q)
        {
            if (q == null || q.isEmpty()) return this;

              Map merge = m_query.dup().setAll(q);

              StringBuilder s = new StringBuilder(256);
              IDictionaryEnumerator en = merge.pairsIterator();
              while (en.MoveNext())
              {
            if (s.Length > 0) s.Append('&');
            string key = (string)en.Key;
            string val = (string)en.Value;
            appendQueryStr(s, key);
            s.Append('=');
            appendQueryStr(s, val);
              }

              Sections t = new Sections();
              t.scheme   = m_scheme;
              t.userInfo = m_userInfo;
              t.host     = m_host;
              t.port     = m_port;
              t.frag     = m_frag;
              t.pathStr  = m_pathStr;
              t.path     = m_path;
              t.query    = merge.ro();
              t.queryStr = s.ToString();
              return new Uri(t);
        }
        public QueryController(UserService service, UserQuery query) : base(UITableViewStyle.Grouped)
        {
            try {
                QueryId = query.Id;

                Title = query.Name;

                if (query.Name.Length == 0)
                {
                    Title = "Add Query";
                }

                _nameElement       = new TextFieldElement("Name", "Display Name", 70);
                _nameElement.Value = query.Name;
                _nameElement.TextField.AutocapitalizationType = UITextAutocapitalizationType.Words;
                _nameElement.TextField.AllEditingEvents      += HandleNameElementTextFieldAllEditingEvents;

                using (var repo = new Repo()) {
                    _feedElement = new QueryFeedElement(service, repo.GetFeed(query.FeedId));
                }

                _filterElement = new TextViewElement("Filter", 44 * 2);
                _filterElement.TextView.Font = UIFont.FromName("Courier-Bold", 16);
                _filterElement.TextView.AutocorrectionType = UITextAutocorrectionType.No;
                _filterElement.TextView.ContentInset       = new UIEdgeInsets(0, 0, 0, 0);
                _filterElement.TextView.Changed           += delegate {
                    try {
                        if (_filterElement.TextView.Text.Contains("\n"))
                        {
                            _filterElement.TextView.Text = _filterElement.TextView.Text.Replace("\n", " ").Trim();
                            _filterElement.TextView.ResignFirstResponder();
                        }
                    } catch (Exception err) {
                        Log.Error(err);
                    }
                };
                _filterElement.Value = query.Filter;

                _orderbyElement       = new TextFieldElement("Order", "Orderby Expression", 70);
                _orderbyElement.Value = query.OrderBy;

                var sec = new DialogSection();
                sec.Add(_nameElement);
                sec.Add(_feedElement);
                sec.Add(_filterElement);
                sec.Add(_orderbyElement);

                Sections.Add(sec);

                _helpElement = new ActionElement("Query Help", delegate {
                    var b = new BrowserController("Query Help", System.IO.File.ReadAllText("QueryHelp.html"));
                    NavigationController.PushViewController(b, true);
                });
                _helpSec = new DialogSection();
                _helpSec.Add(_helpElement);
                Sections.Add(_helpSec);

                _propsSec = new DialogSection("Properties");

                if (QueryId > 0)
                {
                    var delElement = new ActionElement("Delete Query", delegate {
                        _deleteAlert          = new UIAlertView("", "Are you sure you wish to delete the query " + Name + "?", null, "Cancel", "Delete");
                        _deleteAlert.Clicked += Handle_deleteAlertClicked;
                        _deleteAlert.Show();
                    });
                    var csec = new DialogSection();
                    csec.Add(delElement);
                    Sections.Add(csec);
                }

                NavigationItem.LeftBarButtonItem  = new UIBarButtonItem("Cancel", UIBarButtonItemStyle.Bordered, HandleCancelButton);
                NavigationItem.RightBarButtonItem = new UIBarButtonItem("Done", UIBarButtonItemStyle.Done, HandleDoneButton);
            } catch (Exception error) {
                Log.Error(error);
            }
        }
Exemple #31
0
Fichier : Uri.cs Projet : xored/f4
        static void merge(Sections t, Uri baseUri, Uri r)
        {
            bool baseIsAbs = baseUri.isPathAbs();
              bool baseIsDir = baseUri.isDir();
              bool rIsDir    = r.isDir();
              List rPath     = r.m_path;
              bool dotLast   = false;

              // compute the target path taking into account whether
              // the base is a dir and any dot segments in relative ref
              List tPath;
              if (baseUri.m_path.sz() == 0)
              {
            tPath = r.m_path;
              }
              else
              {
            tPath = baseUri.m_path.rw();
            if (!baseIsDir) tPath.pop();
            for (int i=0; i<rPath.sz(); ++i)
            {
              string rSeg = (string)rPath.get(i);
              if (rSeg == ".") { dotLast = true; continue; }
              if (rSeg == "..")
              {
            if (!tPath.isEmpty()) { tPath.pop(); dotLast = true; continue; }
            if (baseIsAbs) continue;
              }
              tPath.add(rSeg); dotLast = false;
            }
            //tPath = tPath;
              }

              t.path = tPath;
              t.pathStr = toPathStr(baseIsAbs, tPath, rIsDir || dotLast);
        }
 public GeneralModel(Sections sections)
 {
     Topics = sections.All;
 }
Exemple #33
0
    private void PopulateSection(string strname, string  StudentID)
    {
        int AssessmentOID=0;
        Sections section = new Sections();
        AssessmentOID = section.GetAssessmentOIDByAssessmentName(strname);
        Answer ans = new Answer();
        ans = ans.GetAnswerByAssessmentandStudentID(AssessmentOID, StudentID);
        if (ans != null)
        {
            lblDate.Text = Convert.ToString(ans.CreatedDate);

        }
        else
        {
            lblDate.Text = "";
        }
        GridViewSection.DataSource = section.GetSectionsWithScoreByAOID(AssessmentOID, lbtnID.Text.ToString());
        GridViewSection.DataBind();
    }
Exemple #34
0
        public bool Init(ushort?inputFieldID = null, Sections flags = Sections.ALL)
        {
            Flags = flags;
            Memory.SuppressDraw = true;
            var aw   = ArchiveWorker.Load(Memory.Archives.A_FIELD);
            var test = aw.GetListOfFiles();

            //TODO fix endless look on FieldID 50.
            ID = inputFieldID ?? Memory.FieldHolder.FieldID;
            var count = (Memory.FieldHolder.Fields?.Length ?? 0);

            if (ID >= count)
            {
                return(false);
            }
            FileName    = Memory.FieldHolder.GetString(ID);
            ArchiveName = test.FirstOrDefault(x => x.IndexOf(FileName, StringComparison.OrdinalIgnoreCase) >= 0);
            if (string.IsNullOrWhiteSpace(ArchiveName))
            {
                Memory.Log.WriteLine($"FileNotFound :: {ID} - {FileName.ToUpper()}");
                Mod = FieldModes.Disabled;
                return(false);
            }

            var fieldArchive = aw.GetArchive(ArchiveName);
            var listOfFiles  = fieldArchive.GetListOfFiles();

            string findString(string s) =>
            listOfFiles.FirstOrDefault(x => x.IndexOf(s, StringComparison.OrdinalIgnoreCase) >= 0);

            byte[] getFile(string s)
            {
                s = findString(s);
                return(!string.IsNullOrWhiteSpace(s) ? fieldArchive.GetBinaryFile(s) : null);
            }

            if (!flags.HasFlag(Sections.MIM | Sections.MAP) ||
                (Background = Background.Load(getFile(".mim"), getFile(".map"))) == null)
            {
                Mod = FieldModes.Disabled;
            }
            if (flags.HasFlag(Sections.CA | Sections.ID))
            {
                Cameras  = Cameras.CreateInstance(getFile(".ca"));
                WalkMesh = WalkMesh.Load(getFile(".ID"), Cameras);
            }

            //let's start with scripts
            var sJsm = findString(".jsm");
            var sSy  = findString(".sy");

            if (flags.HasFlag(Sections.JSM | Sections.SYM) && !string.IsNullOrWhiteSpace(sJsm) && (FileName != "test3"))
            {
                JSMObjects = Scripts.Jsm.File.Read(fieldArchive.GetBinaryFile(sJsm));

                if (Mod != FieldModes.NoJSM)
                {
                    if (!string.IsNullOrWhiteSpace(sSy))
                    {
                        var symObjects = Sym.Reader.FromBytes(fieldArchive.GetBinaryFile(sSy));

                        Services    = Initializer.GetServices();
                        EventEngine = ServiceId.Field[Services].Engine;
                        EventEngine.Reset();
                        for (var objIndex = 0; objIndex < JSMObjects.Count; objIndex++)
                        {
                            var obj         = JSMObjects[objIndex];
                            var fieldObject = new FieldObject(obj.Id, symObjects.GetObjectOrDefault(objIndex).Name);

                            foreach (var script in obj.Scripts)
                            {
                                fieldObject.Scripts.Add(script.ScriptId, script.Segment.GetExecuter());
                            }

                            EventEngine.RegisterObject(fieldObject);
                        }

                        Mod++;
                    }
                    else
                    {
                        Debug.WriteLine($"FileNotFound :: {FileName.ToUpper()}.sy");
                        //sy file might be optional.
                        //Mod = Field_modes.NoJSM;
                    }
                }
            }
            else
            {
                Mod = FieldModes.NoJSM;
                //goto end;
            }

            //if (flags.HasFlag(Sections.MCH))
            //{
            //    byte[] mchB = getFile(".mch");//Field character models
            //}

            //if (flags.HasFlag(Sections.ONE))
            //{
            //    byte[] oneB = getFile(".one");//Field character models container
            //}
            //if (flags.HasFlag(Sections.MSD))
            //{
            //    byte[] msdB = getFile(".msd");//dialogs
            //}
            if (flags.HasFlag(Sections.INF))
            {
                var infData = getFile(".inf");//gateways
                if (infData != null && infData.Length > 0)
                {
                    INF = INF.Load(infData);
                }
            }

            if (flags.HasFlag(Sections.TDW))
            {
                var tdwData = getFile(".tdw");//extra font
                if (tdwData != null && tdwData.Length > 0)
                {
                    TDW = new TDW(tdwData);
                }
            }

            if (flags.HasFlag(Sections.MSK))
            {
                var mskData = getFile(".msk");//movie cam
                if (mskData != null && mskData.Length > 0)
                {
                    MSK = new MSK(mskData);
                }
            }
            if (flags.HasFlag(Sections.RAT | Sections.MRT))
            {
                var ratData = getFile(".rat"); //battle on field
                var mrtData = getFile(".mrt"); //battle on field
                if (ratData != null && mrtData != null && ratData.Length > 0 && mrtData.Length > 0)
                {
                    MrtRat = new MrtRat(mrtData, ratData);
                }
            }
            //if (flags.HasFlag(Sections.PMD))
            //{
            //    byte[] pmdB = getFile(".pmd");//particle info
            //    if (pmdB != null && pmdB.Length > 4)
            //        using (FileStream fs = new FileStream(Path.Combine(Path.GetTempPath(),
            //            $"{Memory.FieldHolder.GetString()}.pmd"), FileMode.Create, FileAccess.Write, FileShare.ReadWrite))
            //            fs.Write(pmdB, 0, pmdB.Length);
            //}
            if (flags.HasFlag(Sections.PMP))
            {
                var pmpData = getFile(".pmp");//particle graphic?
                if (pmpData != null && pmpData.Length > 4)
                {
                    PMP = new PMP(pmpData);
                }
            }
            if (flags.HasFlag(Sections.SFX))
            {
                var sfxData = getFile(".sfx");//sound effects
                if (sfxData != null && sfxData.Length > 0)
                {
                    SFX = new SFX(sfxData);
                }
            }

            if (Mod == FieldModes.NoJSM && Background == null)
            {
                Mod = FieldModes.Disabled;
            }
            return(SFX != null || PMP != null || MrtRat != null || MSK != null || TDW != null || INF != null ||
                   JSMObjects != null || EventEngine != null || Cameras != null || WalkMesh != null ||
                   Background != null || Services != null);
        }
Exemple #35
0
 /// <summary>
 /// Attempts to find the section containing the provided file offset.
 /// </summary>
 /// <param name="fileOffset">The file offset.</param>
 /// <param name="section">The section that was found.</param>
 /// <returns><c>true</c> if the section was found, <c>false</c> otherwise.</returns>
 public bool TryGetSectionContainingOffset(uint fileOffset, out PESection section)
 {
     section = Sections.FirstOrDefault(s => s.ContainsFileOffset(fileOffset));
     return(section != null);
 }
Exemple #36
0
        public static Archive Load(ushort inputFieldID, Sections flags = Sections.ALL)
        {
            var r = new Archive();

            return(!r.Init(inputFieldID, flags) ? null : r);
        }
        protected int FromString(string value)
        {
            var element = Sections.FirstOrDefault().Elements.SingleOrDefault((e) => e.ToString() == value);

            return(Sections.FirstOrDefault().Elements.IndexOf(element));
        }
Exemple #38
0
        private void GetReportData()
        {
            DataSet           dsMaster      = new DataSet();
            EWA_CommonReports objEWA        = new EWA_CommonReports();
            BL_CommonReports  objBL         = new BL_CommonReports();
            string            RecSelFormula = string.Empty;

            objEWA.ViewName = "vwReportHeader";
            objEWA.OrgId    = Convert.ToInt32(Session["OrgId"]);
            dsMaster        = objBL.BL_BindReportsHeader(objEWA);

            if (Request.QueryString["ReportName"] != null)
            {
                string RptName = string.Empty;
                RptName = Request.QueryString["ReportName"].ToString();

                switch (RptName)
                {
                case "rptHandicapEmpList":
                {
                    ReportObj = new CMS.Forms.Reports.crHandicapEmpList();
                    dataset   = new DataSet();
                    dataset   = (DataSet)HttpContext.Current.Session["ReportData"];
                    ReportObj.SetDataSource(dataset.Tables[0]);
                    ReportObj.Subreports["crReportHeader.rpt"].SetDataSource(dsMaster);
                    ReportObj.Subreports["crReportHeader.rpt"].RecordSelectionFormula = "{vwReportHeader.OrganizationId}=" + HttpContext.Current.Session["OrgId"].ToString();
                    break;
                }

                case "rptHandicapStudList":
                {
                    ReportObj = new CMS.Forms.Reports.crHandicapStudList();
                    dataset   = new DataSet();
                    dataset   = (DataSet)HttpContext.Current.Session["ReportData"];
                    ReportObj.SetDataSource(dataset.Tables[0]);
                    ReportObj.Subreports["crReportHeader.rpt"].SetDataSource(dsMaster);
                    ReportObj.Subreports["crReportHeader.rpt"].RecordSelectionFormula = "{vwReportHeader.OrganizationId}=" + HttpContext.Current.Session["OrgId"].ToString();
                    break;
                }

                case "rptSportsStudList":
                {
                    ReportObj = new CMS.Forms.Reports.crSportsStudList();
                    dataset   = new DataSet();
                    dataset   = (DataSet)HttpContext.Current.Session["ReportData"];
                    ReportObj.SetDataSource(dataset.Tables[0]);
                    ReportObj.Subreports["crReportHeader.rpt"].SetDataSource(dsMaster);
                    ReportObj.Subreports["crReportHeader.rpt"].RecordSelectionFormula = "{vwReportHeader.OrganizationId}=" + HttpContext.Current.Session["OrgId"].ToString();
                    break;
                }

                case "rptGovernmentSchemes":
                {
                    ReportObj = new CMS.Forms.Reports.crGovernmentScheme();
                    dataset   = new DataSet();
                    dataset   = (DataSet)HttpContext.Current.Session["ReportData"];
                    ReportObj.SetDataSource(dataset.Tables[0]);
                    ReportObj.Subreports["crReportHeader.rpt"].SetDataSource(dsMaster);
                    ReportObj.Subreports["crReportHeader.rpt"].RecordSelectionFormula = "{vwReportHeader.OrganizationId}=" + HttpContext.Current.Session["OrgId"].ToString();
                    break;
                }

                case "crStudentList":
                {
                    ReportObj = new CMS.Forms.Reports.crStudentList();
                    dataset   = new DataSet();
                    dataset   = (DataSet)HttpContext.Current.Session["ReportData"];
                    ReportObj.SetDataSource(dataset.Tables[0]);
                    ReportObj.Subreports["crReportHeader.rpt"].SetDataSource(dsMaster);
                    ReportObj.Subreports["crReportHeader.rpt"].RecordSelectionFormula = "{vwReportHeader.OrganizationId}=" + HttpContext.Current.Session["OrgId"].ToString();
                    break;
                }

                case "crStudentAdmissionList":
                {
                    ReportObj = new CMS.Forms.Reports.crStudentAdmissionList();
                    dataset   = new DataSet();
                    dataset   = (DataSet)HttpContext.Current.Session["ReportData"];
                    ReportObj.SetDataSource(dataset.Tables[0]);
                    ReportObj.Subreports["crReportHeader.rpt"].SetDataSource(dsMaster);
                    ReportObj.Subreports["crReportHeader.rpt"].RecordSelectionFormula = "{vwReportHeader.OrganizationId}=" + HttpContext.Current.Session["OrgId"].ToString();
                    break;
                }

                case "crPurchaseOrder":
                {
                    ReportObj = new CMS.Forms.Reports.crPurchaseOrder();
                    dataset   = new DataSet();
                    dataset   = (DataSet)HttpContext.Current.Session["ReportData"];
                    ReportObj.SetDataSource(dataset.Tables[0]);
                    ReportObj.Subreports["crReportHeader.rpt"].SetDataSource(dsMaster);
                    ReportObj.Subreports["crReportHeader.rpt"].RecordSelectionFormula = "{vwReportHeader.OrganizationId}=" + HttpContext.Current.Session["OrgId"].ToString();
                    break;
                }

                default:
                    break;
                }

                if (null != ReportObj)
                {
                    crTableLogOnInfo = new TableLogOnInfo();
                    crConnectionInfo = new ConnectionInfo();

                    //Crystal Report Properties
                    //	CrystalDecisions.CrystalReports.Engine.Table crTable;
                    crConnectionInfo.ServerName   = DBServerName;
                    crConnectionInfo.DatabaseName = Database;
                    crConnectionInfo.UserID       = DBUserId;
                    crConnectionInfo.Password     = DBPassword;
                    crDatabase = ReportObj.Database;
                    crTables   = crDatabase.Tables;

                    foreach (CrystalDecisions.CrystalReports.Engine.Table crTable1 in crTables)
                    {
                        crTableLogOnInfo = crTable1.LogOnInfo;
                        crTableLogOnInfo.ConnectionInfo = crConnectionInfo;
                        crTable1.ApplyLogOnInfo(crTableLogOnInfo);
                    }

                    //'Set the sections collection with report sections

                    crSections = ReportObj.ReportDefinition.Sections;

                    //'Loop through each section and find all the report objects
                    //'Loop through all the report objects to find all subreport objects, then set the
                    //'logoninfo to the subreport

                    foreach (Section crSection in crSections)
                    {
                        crReportObjects = crSection.ReportObjects;
                        foreach (ReportObject crReportObject in crReportObjects)
                        {
                            if (crReportObject.Kind == ReportObjectKind.SubreportObject)
                            {
                                //'If you find a subreport, typecast the reportobject to a subreport object
                                crSubreportObject = (SubreportObject)crReportObject;

                                //'Open the subreport
                                subRepDoc = crSubreportObject.OpenSubreport(crSubreportObject.SubreportName);

                                crDatabase = subRepDoc.Database;
                                crTables   = crDatabase.Tables;

                                //'Loop through each table and set the connection info
                                //'Pass the connection info to the logoninfo object then apply the
                                //'logoninfo to the subreport

                                foreach (CrystalDecisions.CrystalReports.Engine.Table crTable in crTables)
                                {
                                    crConnectionInfo.ServerName   = DBServerName;
                                    crConnectionInfo.DatabaseName = Database;
                                    crConnectionInfo.UserID       = DBUserId;
                                    crConnectionInfo.Password     = DBPassword;

                                    crTableLogOnInfo = crTable.LogOnInfo;
                                    crTableLogOnInfo.ConnectionInfo = crConnectionInfo;
                                    crTable.ApplyLogOnInfo(crTableLogOnInfo);
                                    crTable.Location = crTable.Name;
                                }
                            }
                        }
                    }

                    CrystalReportViewer1.SeparatePages = true;
                    CrystalReportViewer1.Width         = 780;
                    CrystalReportViewer1.Height        = 600;

                    //ReportObj.DataDefinition.FormulaFields["CollegeName"].Text = "'" + CommonConstants.CollegeName + "'";
                    //ReportObj.DataDefinition.FormulaFields["CollegeAddress"].Text = "'" + CommonConstants.CollgeAddress + "'";

                    if (RecSelFormula != string.Empty)
                    {
                        ReportObj.RecordSelectionFormula = RecSelFormula;
                    }


                    CrystalReportViewer1.RefreshReport();
                    CrystalReportViewer1.ReportSource = ReportObj;

                    CrystalReportViewer1.RefreshReport();

                    //ReportObj.PrintToPrinter(1, false, 0, 0);
                    Session["ReportFormat"] = "PDF";
                    if (Session["ReportFormat"] != null)
                    {
                        if (Session["ReportFormat"].ToString() == "PDF")
                        {
                            System.IO.MemoryStream oStream;
                            oStream = (System.IO.MemoryStream)
                                      ReportObj.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
                            Response.Clear();
                            Response.Buffer      = true;
                            Response.ContentType = "application/pdf";
                            Response.BinaryWrite(oStream.ToArray());
                            Response.End();
                        }
                    }
                }
            }
        }
Exemple #39
0
        /// <summary>
        /// Reads the APP1 section containing Exif metadata.
        /// </summary>
        private void ReadExifAPP1()
        {
            // Find the APP1 section containing Exif metadata
            exifApp1 = Sections.Find(a => (a.Marker == JPEGMarker.APP1) &&
                                     a.Header.Length >= 6 &&
                                     (Encoding.ASCII.GetString(a.Header, 0, 6) == "Exif\0\0"));

            // If there is no APP1 section, add a new one after the last APP0 section (if any).
            if (exifApp1 == null)
            {
                int insertionIndex = Sections.FindLastIndex(a => a.Marker == JPEGMarker.APP0);
                if (insertionIndex == -1)
                {
                    insertionIndex = 0;
                }
                insertionIndex++;
                exifApp1 = new JPEGSection(JPEGMarker.APP1);
                Sections.Insert(insertionIndex, exifApp1);
                if (BitConverterEx.SystemByteOrder == BitConverterEx.ByteOrder.LittleEndian)
                {
                    ByteOrder = BitConverterEx.ByteOrder.LittleEndian;
                }
                else
                {
                    ByteOrder = BitConverterEx.ByteOrder.BigEndian;
                }
                return;
            }

            byte[] header = exifApp1.Header;
            SortedList <int, IFD> ifdqueue = new SortedList <int, IFD>();

            makerNoteOffset = 0;

            // TIFF header
            int tiffoffset = 6;

            if (header[tiffoffset] == 0x49 && header[tiffoffset + 1] == 0x49)
            {
                ByteOrder = BitConverterEx.ByteOrder.LittleEndian;
            }
            else if (header[tiffoffset] == 0x4D && header[tiffoffset + 1] == 0x4D)
            {
                ByteOrder = BitConverterEx.ByteOrder.BigEndian;
            }
            else
            {
                throw new NotValidExifFileException();
            }

            // TIFF header may have a different byte order
            BitConverterEx.ByteOrder tiffByteOrder = ByteOrder;
            if (BitConverterEx.LittleEndian.ToUInt16(header, tiffoffset + 2) == 42)
            {
                tiffByteOrder = BitConverterEx.ByteOrder.LittleEndian;
            }
            else if (BitConverterEx.BigEndian.ToUInt16(header, tiffoffset + 2) == 42)
            {
                tiffByteOrder = BitConverterEx.ByteOrder.BigEndian;
            }
            else
            {
                throw new NotValidExifFileException();
            }

            // Offset to 0th IFD
            if (header.Length - (tiffoffset + 4) >= 4)
            {
                int ifd0offset = (int)BitConverterEx.ToUInt32(header, tiffoffset + 4, tiffByteOrder, BitConverterEx.SystemByteOrder);
                ifdqueue.Add(ifd0offset, IFD.Zeroth);
            }

            BitConverterEx conv        = new BitConverterEx(ByteOrder, BitConverterEx.SystemByteOrder);
            int            thumboffset = -1;
            int            thumblength = 0;
            int            thumbtype   = -1;


            // Read IFDs
            while (ifdqueue.Count != 0)
            {
                int ifdoffset  = tiffoffset + ifdqueue.Keys[0];
                IFD currentifd = ifdqueue.Values[0];
                ifdqueue.RemoveAt(0);

                // Field count
                ushort fieldcount = conv.ToUInt16(header, ifdoffset);
                if (ifdoffset > header.Length - 1 || ifdoffset + 2 > header.Length)
                {
                    Errors.Add(new ImageError(Severity.Warning, $"IFD field count overflow for IFD {currentifd}."));
                    continue;
                }
                for (short i = 0; i < fieldcount; i++)
                {
                    // Read field info
                    int    fieldoffset = ifdoffset + 2 + 12 * i;
                    ushort tag         = conv.ToUInt16(header, fieldoffset);
                    ushort type        = conv.ToUInt16(header, fieldoffset + 2);
                    uint   count       = conv.ToUInt32(header, fieldoffset + 4);
                    byte[] value       = new byte[4];
                    if (fieldoffset + 8 + 4 > header.Length)
                    {
                        Errors.Add(new ImageError(Severity.Warning, $"Invalid IFD0 directory entry for tag {tag}."));
                        continue;
                    }
                    Array.Copy(header, fieldoffset + 8, value, 0, 4);

                    // Fields containing offsets to other IFDs
                    if (currentifd == IFD.Zeroth && tag == 0x8769)
                    {
                        int exififdpointer = (int)conv.ToUInt32(value, 0);
                        if (ifdqueue.ContainsKey(exififdpointer))
                        {
                            Errors.Add(new ImageError(Severity.Warning, "IFD queue already contains an Exif IFD pointer."));
                        }
                        else
                        {
                            ifdqueue.Add(exififdpointer, IFD.EXIF);
                        }
                    }
                    else if (currentifd == IFD.Zeroth && tag == 0x8825)
                    {
                        int gpsifdpointer = (int)conv.ToUInt32(value, 0);
                        if (ifdqueue.ContainsKey(gpsifdpointer))
                        {
                            Errors.Add(new ImageError(Severity.Warning, "IFD queue already contains a GPS IFD pointer."));
                        }
                        else
                        {
                            ifdqueue.Add(gpsifdpointer, IFD.GPS);
                        }
                    }
                    else if (currentifd == IFD.EXIF && tag == 0xa005)
                    {
                        int interopifdpointer = (int)conv.ToUInt32(value, 0);
                        if (ifdqueue.ContainsKey(interopifdpointer))
                        {
                            Errors.Add(new ImageError(Severity.Warning, "IFD queue already contains an Interop IFD pointer."));
                        }
                        else
                        {
                            ifdqueue.Add(interopifdpointer, IFD.Interop);
                        }
                    }

                    // Save the offset to maker note data
                    if (currentifd == IFD.EXIF && tag == 37500)
                    {
                        makerNoteOffset = conv.ToUInt32(value, 0);
                    }

                    // Calculate the bytes we need to read
                    uint baselength = 0;
                    if (type == 1 || type == 2 || type == 6 || type == 7)
                    {
                        baselength = 1;
                    }
                    else if (type == 3 || type == 8)
                    {
                        baselength = 2;
                    }
                    else if (type == 4 || type == 9)
                    {
                        baselength = 4;
                    }
                    else if (type == 5 || type == 10)
                    {
                        baselength = 8;
                    }
                    else // Unknown or invalid type
                    {
                        continue; // Skip and keep going
                    }
                    int totallength = (int)(count * baselength);
                    if (totallength < 0)
                    {
                        Errors.Add(new ImageError(Severity.Warning, $"Field length overflow for tag {tag}."));
                        continue;
                    }

                    // If field value does not fit in 4 bytes
                    // the value field is an offset to the actual
                    // field value
                    int fieldposition = 0;
                    if (totallength > 4)
                    {
                        fieldposition = tiffoffset + (int)conv.ToUInt32(value, 0);
                        if (fieldposition < 0)
                        {
                            Errors.Add(new ImageError(Severity.Warning, $"Field offset overflow for tag {tag}."));
                            continue;
                        }
                        else if (fieldposition > header.Length - 1)
                        {
                            Errors.Add(new ImageError(Severity.Warning, $"Field offset for tag {tag} exceeds header length."));
                            continue;
                        }
                        else if (fieldposition + totallength > header.Length)
                        {
                            Errors.Add(new ImageError(Severity.Warning, $"Field length for tag {tag} exceeds header length."));
                            continue;
                        }
                        else if (totallength > int.MaxValue)
                        {
                            Errors.Add(new ImageError(Severity.Warning, $"Field length for tag {tag} exceeds maximum allowed length."));
                            continue;
                        }

                        value = new byte[totallength];
                        Array.Copy(header, fieldposition, value, 0, totallength);
                    }

                    // Compressed thumbnail data
                    if (currentifd == IFD.First && tag == 0x201)
                    {
                        thumbtype   = 0;
                        thumboffset = (int)conv.ToUInt32(value, 0);
                    }
                    else if (currentifd == IFD.First && tag == 0x202)
                    {
                        thumblength = (int)conv.ToUInt32(value, 0);
                    }

                    // Uncompressed thumbnail data
                    if (currentifd == IFD.First && tag == 0x111)
                    {
                        thumbtype = 1;
                        // Offset to first strip
                        if (type == 3)
                        {
                            thumboffset = (int)conv.ToUInt16(value, 0);
                        }
                        else
                        {
                            thumboffset = (int)conv.ToUInt32(value, 0);
                        }
                    }
                    else if (currentifd == IFD.First && tag == 0x117)
                    {
                        thumblength = 0;
                        for (int j = 0; j < count; j++)
                        {
                            if (type == 3)
                            {
                                thumblength += (int)conv.ToUInt16(value, 0);
                            }
                            else
                            {
                                thumblength += (int)conv.ToUInt32(value, 0);
                            }
                        }
                    }

                    // Create the exif property from the interop data
                    ExifProperty prop = ExifPropertyFactory.Get(tag, type, count, value, ByteOrder, currentifd, Encoding);
                    Properties.Add(prop);
                }

                // 1st IFD pointer
                if (currentifd == IFD.Zeroth)
                {
                    int firstifdoffset = ifdoffset + 2 + 12 * fieldcount;
                    if (firstifdoffset + 4 <= header.Length)
                    {
                        int firstifdpointer = (int)conv.ToUInt32(header, firstifdoffset);
                        if (firstifdpointer != 0)
                        {
                            if (firstifdpointer + 2 <= header.Length)
                            {
                                ifdqueue.Add(firstifdpointer, IFD.First);
                            }
                            else
                            {
                                Errors.Add(new ImageError(Severity.Warning, $"Invalid first IFD pointer."));
                            }
                        }
                    }
                    else
                    {
                        Errors.Add(new ImageError(Severity.Warning, $"Invalid first IFD offset."));
                    }
                }
                // Read thumbnail
                if (thumboffset != -1 && thumblength != 0 && Thumbnail == null)
                {
                    if (thumbtype == 0)
                    {
                        // Ensure that the thumbnail length does not exceed header length
                        if (thumblength > header.Length - tiffoffset - thumboffset)
                        {
                            Errors.Add(new ImageError(Severity.Warning, $"Thumbnail size exceeds header length."));
                            Thumbnail = null;
                        }
                        else
                        {
                            Thumbnail = new byte[thumblength];
                            Array.Copy(header, tiffoffset + thumboffset, Thumbnail, 0, thumblength);
                        }
                    }
                }
            }
        }
Exemple #40
0
 internal virtual void VisitSections(Sections sections)
 {
 }
Exemple #41
0
 internal override void VisitSections(Sections sections)
 {
 }
 public List <News> GetAll(Sections sectionId)
 {
     throw new Exception("Operation Not Supported !");
 }
Exemple #43
0
        /// <summary>
        /// Parses the keyword «\section».
        /// </summary>
        private Section ParseSection(Sections sections)
        {
            Debug.Assert(sections != null);

            MoveToCode();
            AssertSymbol(Symbol.Section);

            Section section = null;
            try
            {
                section = sections.AddSection();

                ReadCode(); // read '[' or '{'
                if (Symbol == Symbol.BracketLeft)
                    ParseAttributes(section);

                AssertSymbol(Symbol.BraceLeft);

                // Consider the case that the keyword «\paragraph» can be omitted.
                if (IsParagraphContent())
                {
                    Paragraph paragraph = section.Elements.AddParagraph();
                    ParseParagraphContent(section.Elements, paragraph);
                }
                else
                {
                    ReadCode(); // read beyond '{'

                    // 1st parse headers and footers
                    while (IsHeaderFooter())
                        ParseHeaderFooter(section);

                    // 2nd parse all other stuff
                    ParseDocumentElements(section.Elements, Symbol.Section);
                }
                AssertSymbol(Symbol.BraceRight);
                ReadCode(); // read beyond '}'
            }
            catch (DdlParserException ex)
            {
                ReportParserException(ex);
                AdjustToNextBlock();
            }
            return section;
        }
Exemple #44
0
 public ElfSection GetSectionInfoByName(string sectionName)
 {
     return(Sections.FirstOrDefault(s => s.Name == sectionName));
 }
Exemple #45
0
Fichier : Uri.cs Projet : xored/f4
        public Uri pathOnly()
        {
            if (m_pathStr == null)
            throw Err.make("Uri has no path: " + this).val;

              if (m_scheme == null && m_userInfo == null && m_host == null &&
              m_port == null && m_queryStr == null && m_frag == null)
            return this;

              Sections t = new Sections();
              t.path     = this.m_path;
              t.pathStr  = this.m_pathStr;
              t.query    = emptyQuery();
              t.str      = this.m_pathStr;
              return new Uri(t);
        }
        public BuildSection GetSection(string name)
        {
            var section = _sections.FirstOrDefault(s => s.Name == name);

            if (section == null)
            {
                section      = new BuildSection();
                section.Name = name;

                switch (name)
                {
                // Executable code (free format)
                case PESectionNames.Text:
                    section.Priority        = 1000;
                    section.Characteristics =
                        SectionCharacteristics.ContainsCode |
                        SectionCharacteristics.MemExecute |
                        SectionCharacteristics.MemoryRead;
                    break;

                // Initialized data (free format)
                case PESectionNames.Data:
                case PESectionNames.SData:
                    section.Priority        = 2000;
                    section.Characteristics =
                        SectionCharacteristics.ContainsInitializedData |
                        SectionCharacteristics.MemoryRead |
                        SectionCharacteristics.MemoryWrite;
                    break;

                // Export tables
                case PESectionNames.EData:
                    section.Priority        = 3000;
                    section.Characteristics =
                        SectionCharacteristics.ContainsInitializedData |
                        SectionCharacteristics.MemoryRead;
                    break;

                // Import tables
                case PESectionNames.IData:
                    section.Priority        = 4000;
                    section.Characteristics =
                        SectionCharacteristics.ContainsInitializedData |
                        SectionCharacteristics.MemoryRead |
                        SectionCharacteristics.MemoryWrite;
                    break;

                // Exception information
                case PESectionNames.PData:
                    section.Priority        = 5000;
                    section.Characteristics =
                        SectionCharacteristics.ContainsInitializedData |
                        SectionCharacteristics.MemoryRead;
                    break;

                // Read-only initialized data
                case PESectionNames.RData:
                    section.Priority        = 6000;
                    section.Characteristics =
                        SectionCharacteristics.ContainsInitializedData |
                        SectionCharacteristics.MemoryRead;
                    break;

                // Thread-local storage
                case PESectionNames.Tls:
                    section.Priority        = 7000;
                    section.Characteristics =
                        SectionCharacteristics.ContainsInitializedData |
                        SectionCharacteristics.MemoryRead |
                        SectionCharacteristics.MemoryWrite;
                    break;

                // Resource directory
                case PESectionNames.Rsrc:
                    section.Priority        = 8000;
                    section.Characteristics =
                        SectionCharacteristics.ContainsInitializedData |
                        SectionCharacteristics.MemoryRead;
                    break;

                // Image relocations
                case PESectionNames.Reloc:
                    section.Priority        = 9000;
                    section.Characteristics =
                        SectionCharacteristics.ContainsInitializedData |
                        SectionCharacteristics.MemDiscardable |
                        SectionCharacteristics.MemoryRead;
                    break;

                default:
                    throw new NotImplementedException(string.Format("Section name '{0}' is not supported.", name));
                }

                Sections.Add(section, section.Priority);
            }

            return(section);
        }
Exemple #47
0
Fichier : Uri.cs Projet : xored/f4
        public Uri plusName(string name, bool asDir)
        {
            int size        = m_path.sz();
              bool isDir      = this.isDir() || m_path.isEmpty();
              int newSize     = isDir ? size + 1 : size;
              string[] temp   = (string[])m_path.toArray(new string[newSize]);
              temp[newSize-1] = name;

              Sections t = new Sections();
              t.scheme   = this.m_scheme;
              t.userInfo = this.m_userInfo;
              t.host     = this.m_host;
              t.port     = this.m_port;
              t.query    = emptyQuery();
              t.queryStr = null;
              t.frag     = null;
              t.path     = new List(Sys.StrType, temp);
              t.pathStr  = toPathStr(isAbs() || isPathAbs(), t.path, asDir);
              return new Uri(t);
        }
Exemple #48
0
 internal override void VisitSections(Sections sections)
 {
 }
Exemple #49
0
Fichier : Uri.cs Projet : xored/f4
 public Uri plusSlash()
 {
     if (isDir()) return this;
       Sections t = new Sections();
       t.scheme   = this.m_scheme;
       t.userInfo = this.m_userInfo;
       t.host     = this.m_host;
       t.port     = this.m_port;
       t.query    = this.m_query;
       t.queryStr = this.m_queryStr;
       t.frag     = this.m_frag;
       t.path     = this.m_path;
       t.pathStr  = this.m_pathStr + "/";
       return new Uri(t);
 }
 /// <summary>
 /// Write data to INI file. Section and Key bound by enum
 /// </summary>
 /// <param name="_Section"></param>
 /// <param name="_Key"></param>
 /// <param name="_Value"></param>
 public static void IniWriteValue(Sections _Section, Keys _Key, string _Value)
 {
     IniWriteValue(_Section.ToString(), _Key.ToString(), _Value);
 }
Exemple #51
0
Fichier : Uri.cs Projet : xored/f4
        public Uri relToAuth()
        {
            if (m_scheme == null && m_userInfo == null &&
              m_host == null && m_port == null)
            return this;

              Sections t = new Sections();
              t.path     = this.m_path;
              t.pathStr  = this.m_pathStr;
              t.query    = this.m_query;
              t.queryStr = this.m_queryStr;
              t.frag     = this.m_frag;
              return new Uri(t);
        }
Exemple #52
0
 public override void VisitSections(Sections sections)
 {
 }
Exemple #53
0
Fichier : Uri.cs Projet : xored/f4
        private Uri slice(Range range, bool forcePathAbs)
        {
            if (m_pathStr == null)
            throw Err.make("Uri has no path: " + this).val;

              int size = m_path.sz();
              int s = range.start(size);
              int e = range.end(size);
              int n = e - s + 1;
              if (n < 0) throw IndexErr.make(range).val;

              bool head = (s == 0);
              bool tail = (e == size-1);
              if (head && tail && (!forcePathAbs || isPathAbs())) return this;

              Sections t = new Sections();
              t.path = m_path.getRange(range);

              StringBuilder sb = new StringBuilder(m_pathStr.Length);
              if ((head && isPathAbs()) || forcePathAbs) sb.Append('/');
              for (int i=0; i<t.path.sz(); ++i)
              {
            if (i > 0) sb.Append('/');
            sb.Append(t.path.get(i));
              }
              if (t.path.sz() > 0 && (!tail || isDir())) sb.Append('/');
              t.pathStr = sb.ToString();

              if (head)
              {
            t.scheme   = m_scheme;
            t.userInfo = m_userInfo;
            t.host     = m_host;
            t.port     = m_port;
              }

              if (tail)
              {
            t.queryStr = m_queryStr;
            t.query    = m_query;
            t.frag     = m_frag;
              }
              else
              {
            t.query    = emptyQuery();
              }

              if (!head && !tail)
              {
            t.str = t.pathStr;
              }

              return new Uri(t);
        }
Exemple #54
0
 private bool AllSectionsAreValid()
 {
     return(Sections == null || Sections.All(s => s.IsValidForSubmission()));
 }
Exemple #55
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            GenerateCalendar();
            GenerateTaskOnCalendar();

            Student stu = new Student();
            //string  strOID = stu.GetFirstStudentID();
            int firstRowID = 1;
            string strOID = stu.GetStudentByRowID(firstRowID);
            ViewState["RowID"] = firstRowID;
            int StdOID = stu.GetStudentOIDByStudentBannerID(strOID);

            //dtStudents =

            ViewState["StuID"] = StdOID;

            string fassName = "";
            Sections sec = new Sections();
            Populate(Convert.ToString(strOID));
            populateDropdownList();
            fassName = sec.GetFirstAssessmentName();
            //PopulateSection(ddlAssesment.Text, Convert.ToInt32(StdOID));
            PopulateSection(ddlAssesment.Text, strOID);
            PopulateSectionNoScore(ddlAssesment.Text, strOID);
            Initialization();
            populateChart();
        }
    }
Exemple #56
0
 public override void CreateExportDocument()
 {
     Sections.Add(new SummarySection());
 }
Exemple #57
0
 private void PopulateSectionNoScore(string strname, string  StudentID)
 {
     int AssessmentOID=0;
     Sections section = new Sections();
     AssessmentOID = section.GetAssessmentOIDByAssessmentName(strname);
     GridViewScore.DataSource = section.GetSectionsWithNoScore(AssessmentOID, StudentID);
     GridViewScore.DataBind();
 }
 /// <summary>
 /// Gets a textual representation of the grid model - eg. to be used in Examine.
 /// </summary>
 /// <returns>An instance of <see cref="string"/> representing the value of the grid model.</returns>
 public virtual string GetSearchableText()
 {
     return(Sections.Aggregate(string.Empty, (current, section) => current + section.GetSearchableText()));
 }
Exemple #59
0
 /// <summary>Returns the section with the provided name if it's defined, or null</summary>
 public virtual Section GetSection(string name)
 {
     return(Sections.FirstOrDefault(section => section.Name == name));
 }
Exemple #60
0
        public bool Init(ushort?inputFieldID = null, Sections flags = Sections.ALL)
        {
            Flags = flags;
            Memory.SuppressDraw = true;
            ArchiveBase aw = ArchiveWorker.Load(Memory.Archives.A_FIELD);

            string[] test = aw.GetListOfFiles();
            //TODO fix endless look on FieldID 50.
            ID = inputFieldID ?? Memory.FieldHolder.FieldID;
            int count = (Memory.FieldHolder.fields?.Length ?? 0);

            if (ID >= count ||
                ID < 0)
            {
                return(false);
            }
            FileName    = Memory.FieldHolder.GetString(ID);
            ArchiveName = test.FirstOrDefault(x => x.IndexOf(FileName, StringComparison.OrdinalIgnoreCase) >= 0);
            if (string.IsNullOrWhiteSpace(ArchiveName))
            {
                Debug.WriteLine($"FileNotFound :: {ID} - {FileName.ToUpper()}");
                Mod = Field_modes.DISABLED;
                return(false);
            }

            ArchiveBase fieldArchive = aw.GetArchive(ArchiveName);

            string[] filelist = fieldArchive.GetListOfFiles();
            string findstr(string s) =>
            filelist.FirstOrDefault(x => x.IndexOf(s, StringComparison.OrdinalIgnoreCase) >= 0);

            byte[] getfile(string s)
            {
                s = findstr(s);
                if (!string.IsNullOrWhiteSpace(s))
                {
                    return(fieldArchive.GetBinaryFile(s));
                }
                else
                {
                    return(null);
                }
            }

            if (!flags.HasFlag(Sections.MIM | Sections.MAP) || (Background = Background.Load(getfile(".mim"), getfile(".map"))) == null)
            {
                Mod = Field_modes.DISABLED;
            }
            if (flags.HasFlag(Sections.CA | Sections.ID))
            {
                Cameras  = Cameras.Load(getfile(".ca"));
                WalkMesh = WalkMesh.Load(getfile(".id"), Cameras);
            }

            //let's start with scripts
            string s_jsm = findstr(".jsm");
            string s_sy  = findstr(".sy");

            if (flags.HasFlag(Sections.JSM | Sections.SYM) && !string.IsNullOrWhiteSpace(s_jsm) && (FileName != "test3"))
            {
                //try
                //{
                jsmObjects = Scripts.Jsm.File.Read(fieldArchive.GetBinaryFile(s_jsm));
                //}
                //catch (Exception e)
                //{
                //   Debug.WriteLine(e);
                //Mod = Field_modes.NOJSM;
                //}
                if (Mod != Field_modes.NOJSM)
                {
                    Sym.GameObjects symObjects;
                    if (!string.IsNullOrWhiteSpace(s_sy))
                    {
                        symObjects = Sym.Reader.FromBytes(fieldArchive.GetBinaryFile(s_sy));

                        services    = Initializer.GetServices();
                        EventEngine = ServiceId.Field[services].Engine;
                        EventEngine.Reset();
                        for (int objIndex = 0; objIndex < jsmObjects.Count; objIndex++)
                        {
                            Scripts.Jsm.GameObject obj         = jsmObjects[objIndex];
                            FieldObject            fieldObject = new FieldObject(obj.Id, symObjects.GetObjectOrDefault(objIndex).Name);

                            foreach (Scripts.Jsm.GameScript script in obj.Scripts)
                            {
                                fieldObject.Scripts.Add(script.ScriptId, script.Segment.GetExecuter());
                            }

                            EventEngine.RegisterObject(fieldObject);
                        }

                        Mod++;
                    }
                    else
                    {
                        Debug.WriteLine($"FileNotFound :: {FileName.ToUpper()}.sy");
                        //sy file might be optional.
                        //Mod = Field_modes.NOJSM;
                    }
                }
            }
            else
            {
                Mod = Field_modes.NOJSM;
                //goto end;
            }

            //if (flags.HasFlag(Sections.MCH))
            //{
            //    byte[] mchb = getfile(".mch");//Field character models
            //}

            //if (flags.HasFlag(Sections.ONE))
            //{
            //    byte[] oneb = getfile(".one");//Field character models container
            //}
            //if (flags.HasFlag(Sections.MSD))
            //{
            //    byte[] msdb = getfile(".msd");//dialogs
            //}
            if (flags.HasFlag(Sections.INF))
            {
                byte[] infb = getfile(".inf");//gateways
                if (infb != null && infb.Length > 0)
                {
                    inf = INF.Load(infb);
                }
            }

            if (flags.HasFlag(Sections.TDW))
            {
                byte[] tdwb = getfile(".tdw");//extra font
                if (tdwb != null && tdwb.Length > 0)
                {
                    tdw = new TDW(tdwb);
                }
            }

            if (flags.HasFlag(Sections.MSK))
            {
                byte[] mskb = getfile(".msk");//movie cam
                if (mskb != null && mskb.Length > 0)
                {
                    msk = new MSK(mskb);
                }
            }
            if (flags.HasFlag(Sections.RAT | Sections.MRT))
            {
                byte[] ratb = getfile(".rat"); //battle on field
                byte[] mrtb = getfile(".mrt"); //battle on field
                if (ratb != null && mrtb != null && ratb.Length > 0 && mrtb.Length > 0)
                {
                    MrtRat = new MrtRat(mrtb, ratb);
                }
            }
            //if (flags.HasFlag(Sections.PMD))
            //{
            //    byte[] pmdb = getfile(".pmd");//particle info
            //    if (pmdb != null && pmdb.Length > 4)
            //        using (FileStream fs = new FileStream(Path.Combine(Path.GetTempPath(),
            //            $"{Memory.FieldHolder.GetString()}.pmd"), FileMode.Create, FileAccess.Write, FileShare.ReadWrite))
            //            fs.Write(pmdb, 0, pmdb.Length);
            //}
            if (flags.HasFlag(Sections.PMP))
            {
                byte[] pmpb = getfile(".pmp");//particle graphic?
                if (pmpb != null && pmpb.Length > 4)
                {
                    pmp = new PMP(pmpb);
                }
            }
            if (flags.HasFlag(Sections.SFX))
            {
                byte[] sfxb = getfile(".sfx");//sound effects
                if (sfxb != null && sfxb.Length > 0)
                {
                    sfx = new SFX(sfxb);
                }
            }

            if (Mod == Field_modes.NOJSM && Background == null)
            {
                Mod = Field_modes.DISABLED;
            }
            if (sfx == null &&
                pmp == null &&
                MrtRat == null &&
                msk == null &&
                tdw == null &&
                inf == null &&
                jsmObjects == null &&
                EventEngine == null &&
                Cameras == null &&
                WalkMesh == null &&
                Background == null &&
                services == null)
            {
                return(false);
            }
            return(true);
        }