Beispiel #1
0
        public Index(File file, string name, BiosParameterBlock bpb, UpperCase upCase)
        {
            _file = file;
            _name = name;
            _bpb = bpb;
            _isFileIndex = name == "$I30";

            _blockCache = new ObjectCache<long, IndexBlock>();

            _root = _file.GetStream(AttributeType.IndexRoot, _name).GetContent<IndexRoot>();
            _comparer = _root.GetCollator(upCase);

            using (Stream s = _file.OpenStream(AttributeType.IndexRoot, _name, FileAccess.Read))
            {
                byte[] buffer = Utilities.ReadFully(s, (int)s.Length);
                _rootNode = new IndexNode(WriteRootNodeToDisk, 0, this, true, buffer, IndexRoot.HeaderOffset);

                // Give the attribute some room to breathe, so long as it doesn't squeeze others out
                // BROKEN, BROKEN, BROKEN - how to figure this out?  Query at the point of adding entries to the root node?
                _rootNode.TotalSpaceAvailable += _file.MftRecordFreeSpace(AttributeType.IndexRoot, _name) - 100;
            }

            if (_file.StreamExists(AttributeType.IndexAllocation, _name))
            {
                _indexStream = _file.OpenStream(AttributeType.IndexAllocation, _name, FileAccess.ReadWrite);
            }

            if (_file.StreamExists(AttributeType.Bitmap, _name))
            {
                _indexBitmap = new Bitmap(_file.OpenStream(AttributeType.Bitmap, _name, FileAccess.ReadWrite), long.MaxValue);
            }
        }
Beispiel #2
0
 public void TestCountCaptialsStarWars()
 {
     Assert.AreEqual(2, UpperCase.CountCaps("Star Wars"));
     Assert.AreEqual(12, UpperCase.CountCaps("NowIsTheTimeForAllGoodMenToComeAndEat"));
     Assert.AreEqual(4, UpperCase.CountCaps("ThisIsPascalCase"));
     Assert.AreEqual(7, UpperCase.CountCaps("It's ALWAYS a good time for tacos!"));
 }
        public void TestUpperCaser()
        {
            var output = UpperCase.UpperCaseThis("hi there");

            Assert.AreEqual("HI THERE", output);

            Assert.AreNotEqual("hi there", output);
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            UpperCase uc   = new UpperCase();
            string    temp = uc.ChangeToUpperCase(TextBox1.Text, TextBox3.Text);

            string[] arr = temp.Split(',');
            string   a   = arr[0];
            string   b   = arr[1];

            Response.Redirect("~/Status.aspx?Name=" + Server.UrlEncode(a) + "&Mobile=" + Server.UrlEncode(TextBox2.Text) + "&Email=" + Server.UrlEncode(b));
        }
Beispiel #5
0
    static void Main(string[] args)
    {
        //Example 1
        PrintAndWriteIntoFile obj = new PrintAndWriteIntoFile();

        PrintAndWriteIntoFile.PrintAndWrite t = new PrintAndWriteIntoFile.PrintAndWrite(obj.WriteToFile);
        t += obj.PrintMessage;

        obj.SendMessage(t);

        //Example 2
        UpperCase upper = new UpperCase();

        upper.CallDel("perls", new UpperCase.UpperCaseDel(upper.MakeFirstUpperLetter));
        upper.CallDel("perls", new UpperCase.UpperCaseDel(upper.MakeLastUpperLetter));
        upper.CallDel("perls", new UpperCase.UpperCaseDel(upper.MakeAllUpper));
    }
Beispiel #6
0
        private Index(AttributeType attrType, AttributeCollationRule collationRule, File file, string name, BiosParameterBlock bpb, UpperCase upCase)
        {
            _file = file;
            _name = name;
            _bpb = bpb;
            _isFileIndex = name == "$I30";

            _blockCache = new ObjectCache<long, IndexBlock>();

            _file.CreateStream(AttributeType.IndexRoot, _name);

            _root = new IndexRoot()
            {
                AttributeType = (uint)attrType,
                CollationRule = collationRule,
                IndexAllocationSize = (uint)bpb.IndexBufferSize,
                RawClustersPerIndexRecord = bpb.RawIndexBufferSize
            };

            _comparer = _root.GetCollator(upCase);

            _rootNode = new IndexNode(WriteRootNodeToDisk, 0, this, true, 32);
        }
Beispiel #7
0
 public static unsafe string EncodeUpper(ReadOnlySpan <byte> bytes)
 {
     return(UpperCase.Encode(bytes));
 }
Beispiel #8
0
 /// <summary>
 /// Decode Upper/Lowercase Base16 text into bytes.
 /// </summary>
 /// <param name="text">Hex string.</param>
 /// <returns>Decoded bytes.</returns>
 public static Span <byte> Decode(string text)
 {
     return(UpperCase.Decode(text.AsSpan()));
 }
Beispiel #9
0
 public static Task EncodeUpperAsync(Stream input, TextWriter output)
 {
     return(UpperCase.EncodeAsync(input, output));
 }
Beispiel #10
0
 public static void EncodeUpper(Stream input, TextWriter output)
 {
     UpperCase.Encode(input, output);
 }
Beispiel #11
0
 public void TestCountCapitalsStarWars()
 {
     Assert.AreEqual(2, UpperCase.CountCapitals("Star Wars"));
 }