예제 #1
0
        public int AddUpdateFormat2Detail(int tID, Format2 det)
        {
            IMRDataContext context    = new IMRDataContext();
            PDFDetail      pdfDetails = null;
            bool           addNew     = false;

            if (context.PDFDetails.Where(fdet => fdet.TreatmentID == tID).Any())
            {
                pdfDetails = context.PDFDetails.Single(fdet => fdet.TreatmentID == tID);
            }

            if (pdfDetails == null)
            {
                addNew     = true;
                pdfDetails = new PDFDetail();
            }



            pdfDetails.ClinicalCaseSummary = det.ClinicalCaseSummary;
            pdfDetails.DocumentsReviewed   = det.DocumentsReviewed;
            pdfDetails.HowIMRDetermination = det.HowIMRDetermination;
            pdfDetails.IMRIssuesRationales = det.IMRIssuesRationales;
            pdfDetails.URDenialDate        = det.URDenialDate;
            pdfDetails.TreatmentID         = tID;
            if (addNew)
            {
                context.PDFDetails.InsertOnSubmit(pdfDetails);
            }
            context.SubmitChanges();
            context.Connection.Close();
            context.Dispose();
            context = null;
            return(0);
        }
예제 #2
0
        private void ParseFormat2Text()
        {
            try
            {
                Format2 f = new Format2();

                string urDenial = "";
                urDenial       = _text.Substring(_text.IndexOf("UR Denial Date:  ") + 17, 10);
                f.URDenialDate = DateTime.Parse(urDenial);

                int imrindex       = _text.IndexOf("HOW THE IMR FINAL DETERMINATION WAS MADE");
                int documentsindex = _text.IndexOf("DOCUMENTS REVIEWED");
                int caseindex      = _text.IndexOf("CLINICAL CASE SUMMARY");
                int issueindex     = _text.IndexOf("IMR DECISION(S) AND RATIONALE(S)");

                f.HowIMRDetermination = _text.Substring(imrindex + 40, documentsindex - imrindex - 40).Trim();
                f.DocumentsReviewed   = _text.Substring(documentsindex + 18, caseindex - documentsindex - 18).Trim();
                f.ClinicalCaseSummary = _text.Substring(caseindex + 21, issueindex - caseindex - 21).Trim();
                f.IMRIssuesRationales = _text.Substring(issueindex + 32).Trim();

                DBHelper helper = new DBHelper();
                helper.AddUpdateFormat2Detail(_treatmentID, f);
            }
            catch (Exception e)
            {
                throw new Exception("Could not parse PDF ", e);
            }
        }
예제 #3
0
            public ShpD2Frame(Stream s)
            {
                var flags = (FormatFlags)s.ReadUInt16();

                s.Position += 1;
                var width  = s.ReadUInt16();
                var height = s.ReadUInt8();

                Size = new Size(width, height);

                // Subtract header size
                var dataLeft = s.ReadUInt16() - 10;
                var dataSize = s.ReadUInt16();

                byte[] table;
                if ((flags & FormatFlags.PaletteTable) != 0)
                {
                    var n = (flags & FormatFlags.VariableLengthTable) != 0 ? s.ReadUInt8() : (byte)16;
                    table = new byte[n];
                    for (var i = 0; i < n; i++)
                    {
                        table[i] = s.ReadUInt8();
                    }

                    dataLeft -= n;
                }
                else
                {
                    table = new byte[256];
                    for (var i = 0; i < 256; i++)
                    {
                        table[i] = (byte)i;
                    }
                    table[1] = 0x7f;
                    table[2] = 0x7e;
                    table[3] = 0x7d;
                    table[4] = 0x7c;
                }

                Data = new byte[width * height];

                // Decode image data
                var compressed = s.ReadBytes(dataLeft);

                if ((flags & FormatFlags.SkipFormat80) == 0)
                {
                    var temp = new byte[dataSize];
                    Format80.DecodeInto(compressed, temp);
                    compressed = temp;
                }

                Format2.DecodeInto(compressed, Data, 0);

                // Lookup values in lookup table
                for (var j = 0; j < Data.Length; j++)
                {
                    Data[j] = table[Data[j]];
                }
            }
    static void Main(string[] args)
    {
        Format1 f1 = new Format1("5.10");

        f1.Data.Dic1.Add("Greet", "Hello World");
        f1.Data.Dic2.Add("RepeatGreet", 10);
        f1.Write("f1");
        Console.WriteLine("-------------------------------------------------------");
        Format2 f2 = new Format2("2.1", "general", f1.Data);

        f2.Data.Dic1.Add("Goodbye", "See you later, Alligator");
        f2.Data.Dic2.Add("RepeatBye", 1);
        f1.Write("f1");
        f2.Write("f2");
        Console.ReadKey();
    }
예제 #5
0
    public string XMLSave(string path)
    {
        XmlWriter xmlWriter = XmlWriter.Create(path);

        xmlWriter.WriteStartDocument();

        xmlWriter.WriteStartElement("QuestionDatabase");

        // write question data
        for (int i = 0; i < this.FormatList.Count; i++)
        {
            Format2 format = this.FormatList[i];
            xmlWriter.WriteStartElement("Questions");

            xmlWriter.WriteStartElement("Question");
            xmlWriter.WriteString(format.Question);
            xmlWriter.WriteEndElement();

            xmlWriter.WriteStartElement("IsTrue");
            xmlWriter.WriteString(format.IsTrue ? "1" : "0");
            xmlWriter.WriteEndElement();

            xmlWriter.WriteStartElement("Difficulty");
            xmlWriter.WriteString(format._Difficulty.ToString());
            xmlWriter.WriteEndElement();

            xmlWriter.WriteStartElement("Fact");
            xmlWriter.WriteString(format.Fact);
            xmlWriter.WriteEndElement();

            xmlWriter.WriteEndElement();
        }

        xmlWriter.WriteEndElement();

        xmlWriter.WriteEndDocument();
        xmlWriter.Close();

        string content = File.ReadAllText(path);

        content = UTF8ByteArrayToString(StringToUTF8ByteArray(content));
        return(content);
    }
예제 #6
0
    public override void OnDrawColumns()
    {
        this.Scroll = GUILayout.BeginScrollView(this.Scroll);
        {
            for (int i = 0; i < this.FormatList.Count; i++)
            {
                GUILayout.Space(5);

                Format2 format = this.FormatList[i];
                GUILayout.BeginVertical();
                {
                    GUILayout.BeginHorizontal();
                    {
                        GUI.skin.textField.wordWrap = true;

                        // question
                        format.Question = EditorGUILayout.TextField(format.Question, GUILayout.Width(this.QuestionWidth), GUILayout.Height(FieldHeight));
                        GUILayout.Space(5);
                        // is true
                        format.IsTrue = EditorGUILayout.Toggle(format.IsTrue, GUILayout.Width(this.IsTrueWidth), GUILayout.Height(FieldHeight));
                        GUILayout.Space(5);
                        // difficulty
                        format._Difficulty = (DifficultyLevel)EditorGUILayout.EnumPopup(format._Difficulty, GUILayout.Width(this.DifficultyWidth), GUILayout.Height(FieldHeight));
                        GUILayout.Space(5);
                        // fact
                        format.Fact = EditorGUILayout.TextField(format.Fact, GUILayout.Width(this.FactWidth), GUILayout.Height(FieldHeight));
                        GUILayout.Space(5);
                        // delete entry
                        if (GUILayout.Button("X", EditorStyles.toolbarButton, GUILayout.Width(20), GUILayout.Height(FieldHeight)))
                        {
                            this.FormatList.RemoveAt(i);
                        }
                    }
                    GUILayout.EndHorizontal();
                }
                GUILayout.EndVertical();
            }
        }
        GUILayout.EndScrollView();
    }
예제 #7
0
    public void XMLLoad(string path)
    {
        XmlDocument xmlDoc = new XmlDocument();

        xmlDoc.LoadXml(path == string.Empty ? EditorPrefs.GetString("lastXML_format2") : File.ReadAllText(path));
        int index = 0;

        foreach (XmlNode xmlNode in xmlDoc.DocumentElement)
        {
            Format2 format = new Format2();
            // get all parent nodes
            foreach (XmlNode questionsNode in xmlNode)
            {
                if (questionsNode.Name == "Question")
                {
                    format.Question = questionsNode.InnerText;
                }
                if (questionsNode.Name == "IsTrue")
                {
                    format.IsTrue = questionsNode.InnerText == "0" ? false : true;
                }
                if (questionsNode.Name == "Difficulty")
                {
                    string          inner = questionsNode.InnerText;
                    DifficultyLevel dif   = DifficultyLevel.Easy;
                    dif = inner == "Easy" ? DifficultyLevel.Easy :
                          inner == "Medium" ? DifficultyLevel.Medium :
                          inner == "Hard" ? DifficultyLevel.Hard :
                          DifficultyLevel.Bonus;
                    format._Difficulty = dif;
                }
                if (questionsNode.Name == "Fact")
                {
                    format.Fact = questionsNode.InnerText;
                }
                index++;
            }
            this.FormatList.Add(format);
        }
    }
예제 #8
0
        /// <summary>Get new subtable in this format by 
        /// <c>EncodingTableEntry</c>.
        /// This method is virtual so that
        /// the corresponding validator class can override this and
        /// return an object of its subclass of the subtable.
        /// </summary>
        virtual public Subtable GetSubtable(EncodingTableEntry ete)
        {
            Subtable st = null;

            // identify the format of the table
            ushort format = 0xffff;
            
            try
            {
                format = m_bufTable.GetUshort(ete.offset);
            }
            catch
            {
            }

            switch(format)
            {
                case 0:  st = new Format0 (ete, m_bufTable); break;
                case 2:  st = new Format2 (ete, m_bufTable); break;
                case 4:  st = new Format4 (ete, m_bufTable); break;
                case 6:  st = new Format6 (ete, m_bufTable); break;
                case 8:  st = new Format8 (ete, m_bufTable); break;
                case 10: st = new Format10(ete, m_bufTable); break;
                case 12: st = new Format12(ete, m_bufTable); break;
                case 14: st = new Format14(ete, m_bufTable); break;
            }

            return st;
        }
예제 #9
0
            public ShpTSFrame(Stream s, Size frameSize)
            {
                var x      = s.ReadUInt16();
                var y      = s.ReadUInt16();
                var width  = s.ReadUInt16();
                var height = s.ReadUInt16();

                // Pad the dimensions to an even number to avoid issues with half-integer offsets
                var dataWidth  = width;
                var dataHeight = height;

                if (dataWidth % 2 == 1)
                {
                    dataWidth += 1;
                }

                if (dataHeight % 2 == 1)
                {
                    dataHeight += 1;
                }

                Offset    = new int2(x + (dataWidth - frameSize.Width) / 2, y + (dataHeight - frameSize.Height) / 2);
                Size      = new Size(dataWidth, dataHeight);
                FrameSize = frameSize;

                Format      = s.ReadUInt8();
                s.Position += 11;
                FileOffset  = s.ReadUInt32();

                if (FileOffset == 0)
                {
                    return;
                }

                // Parse the frame data as we go (but remember to jump back to the header before returning!)
                var start = s.Position;

                s.Position = FileOffset;

                Data = new byte[dataWidth * dataHeight];

                if (Format == 3)
                {
                    // Format 3 provides RLE-zero compressed scanlines
                    for (var j = 0; j < height; j++)
                    {
                        var length = s.ReadUInt16() - 2;
                        Format2.DecodeInto(s.ReadBytes(length), Data, dataWidth * j);
                    }
                }
                else
                {
                    // Format 2 provides uncompressed length-prefixed scanlines
                    // Formats 1 and 0 provide an uncompressed full-width row
                    var length = Format == 2 ? s.ReadUInt16() - 2 : width;
                    for (var j = 0; j < height; j++)
                    {
                        s.ReadBytes(Data, dataWidth * j, length);
                    }
                }

                s.Position = start;
            }
예제 #10
0
파일: cmap.cs 프로젝트: Reavenk/Berny_Core
        public void Read(TTFReader r, uint tableStart)
        {
            r.ReadInt(out this.version);
            r.ReadInt(out this.numTables);

            this.encodingRecords = new List <EncodingRecord>();
            for (int i = 0; i < this.numTables; ++i)
            {
                EncodingRecord er = new EncodingRecord();
                er.Read(r);
                this.encodingRecords.Add(er);
            }

            foreach (EncodingRecord rc in this.encodingRecords)
            {
                r.SetPosition(tableStart + rc.subtableOffset);

                ushort format = r.ReadUInt16();

                if (format == 0)
                {
                    if (this.format0 == null)
                    {
                        this.format0 = new List <Format0>();
                    }

                    Format0 f0 = new Format0();
                    f0.Read(r);
                    this.format0.Add(f0);
                }
                else if (format == 2)
                {
                    if (this.format2 == null)
                    {
                        this.format2 = new List <Format2>();
                    }

                    Format2 f2 = new Format2();
                    f2.Read(r);
                    this.format2.Add(f2);
                }
                else if (format == 4)
                {
                    if (this.format4 == null)
                    {
                        this.format4 = new List <Format4>();
                    }

                    Format4 f4 = new Format4();
                    f4.Read(r);
                    this.format4.Add(f4);
                }
                else if (format == 6)
                {
                    if (this.format6 == null)
                    {
                        this.format6 = new List <Format6>();
                    }

                    Format6 f6 = new Format6();
                    f6.Read(r);
                    this.format6.Add(f6);
                }
                else if (format == 8)
                {
                    if (this.format8 == null)
                    {
                        this.format8 = new List <Format8>();
                    }

                    Format8 f8 = new Format8();
                    f8.Read(r);
                    this.format8.Add(f8);
                }
                else if (format == 10)
                {
                    if (this.format10 == null)
                    {
                        this.format10 = new List <Format10>();
                    }

                    Format10 f10 = new Format10();
                    f10.Read(r);
                    this.format10.Add(f10);
                }
                else if (format == 12)
                {
                    if (this.format12 == null)
                    {
                        this.format12 = new List <Format12>();
                    }

                    Format12 f12 = new Format12();
                    f12.Read(r);
                    this.format12.Add(f12);
                }
                else if (format == 13)
                {
                    if (this.format13 == null)
                    {
                        this.format13 = new List <Format13>();
                    }

                    Format13 f13 = new Format13();
                    f13.Read(r);
                    this.format13.Add(f13);
                }
                else if (format == 14)
                {
                    if (this.format14 == null)
                    {
                        this.format14 = new List <Format14>();
                    }

                    Format14 f14 = new Format14();
                    f14.Read(r);
                    this.format14.Add(f14);
                }
            }
        }