Search

Google Your PC

dir/b/s %1|find "%2"


save with a file name google.bat.
open the cmd.exe and type 
    google c: .bat
to search all files in c:\ with *.bat extension.

OvrIndexer.cs






using System;

///

/// Implements overloaded indexers.

///




namespace IndiLogiX.Tutorial

{

class OvrIndexer

{

private string[] myData;

private int arrSize;

public OvrIndexer(int size)

{

arrSize = size;

myData = new string[size];

for (int i=0; i < size; i++)

{

myData[i] = "empty";

}

}

public string this[int pos]

{

get

{

return myData[pos];

}

set

{

myData[pos] = value;

}

}<--more-->

public string this[string data]

{

get

{

int count = 0;

for (int i=0; i < arrSize; i++)

{

if (myData[i] == data)

{

count++;

}

}

return count.ToString();

}

set

{

for (int i=0; i < arrSize; i++)

{

if (myData[i] == data)

{

myData[i] = value;

}

}

}

}

static void Main(string[] args)

{

int size = 10;

OvrIndexer myInd = new OvrIndexer(size);

myInd[9] = "Some Value";

myInd[3] = "Another Value";

myInd[5] = "Any Value";

myInd["empty"] = "no value";

Console.WriteLine("\nIndexer Output\n");

for (int i=0; i < size; i++)

{

Console.WriteLine("myInd[{0}]: {1}", i, myInd[i]);

}

Console.WriteLine("\nNumber of \"no value\" entries: {0}",

myInd["no value"]);

}

}

}


OvrIndexer.cs






using System;

///

/// Implements overloaded indexers.

///




namespace IndiLogiX.Tutorial

{

class OvrIndexer

{

private string[] myData;

private int arrSize;

public OvrIndexer(int size)

{

arrSize = size;

myData = new string[size];

for (int i=0; i < size; i++)

{

myData[i] = "empty";

}

}

public string this[int pos]

{

get

{

return myData[pos];

}

set

{

myData[pos] = value;

}

}<--more-->

public string this[string data]

{

get

{

int count = 0;

for (int i=0; i < arrSize; i++)

{

if (myData[i] == data)

{

count++;

}

}

return count.ToString();

}

set

{

for (int i=0; i < arrSize; i++)

{

if (myData[i] == data)

{

myData[i] = value;

}

}

}

}

static void Main(string[] args)

{

int size = 10;

OvrIndexer myInd = new OvrIndexer(size);

myInd[9] = "Some Value";

myInd[3] = "Another Value";

myInd[5] = "Any Value";

myInd["empty"] = "no value";

Console.WriteLine("\nIndexer Output\n");

for (int i=0; i < size; i++)

{

Console.WriteLine("myInd[{0}]: {1}", i, myInd[i]);

}

Console.WriteLine("\nNumber of \"no value\" entries: {0}",

myInd["no value"]);

}

}

}


IntIndexer.cs






using System;

///

/// A simple indexer example.

///


namespace IndiLogiX.Tutorial



{

class IntIndexer

{

private string[] myData;

public IntIndexer(int size)

{

myData = new string[size];

for (int i=0; i < size; i++)

{

myData[i] = "empty";

}

}

public string this[int pos]

{

get

{

return myData[pos];

}

set

{

myData[pos] = value;

}

}



static void Main(string[] args)

{

int size = 10;

IntIndexer myInd = new IntIndexer(size);

myInd[9] = "Some Value";

myInd[3] = "Another Value";

myInd[5] = "Any Value";

Console.WriteLine("\nIndexer Output\n");

for (int i=0; i < size; i++)

{

Console.WriteLine("myInd[{0}]: {1}", i, myInd[i]);

}

}

}

}

indexer.cs




// indexer.cs

// arguments: indexer.txt

using System;

using System.IO;



// Class to provide access to a large file

// as if it were a byte array.

public class FileByteArray

{

Stream stream; // Holds the underlying stream

// used to access the file.

// Create a new FileByteArray encapsulating a particular file.

public FileByteArray(string fileName)

{

stream = new FileStream(fileName, FileMode.Open);

}



// Close the stream. This should be the last thing done

// when you are finished.

public void Close()

{

stream.Close();

stream = null;

}



// Indexer to provide read/write access to the file.

public byte this[long index] // long is a 64-bit integer

{

// Read one byte at offset index and return it.

get

{

byte[] buffer = new byte[1];

stream.Seek(index, SeekOrigin.Begin);

stream.Read(buffer, 0, 1);

return buffer[0];

}

// Write one byte at offset index and return it.

set

{

byte[] buffer = new byte[1] {value};

stream.Seek(index, SeekOrigin.Begin);

stream.Write(buffer, 0, 1);

}

}



// Get the total length of the file.

public long Length

{

get

{

return stream.Seek(0, SeekOrigin.End);

}

}

}



// Demonstrate the FileByteArray class.

// Reverses the bytes in a file.

public class Reverse

{

public static void Main(String[] args)

{

// Check for arguments.

if (args.Length != 1)

{

Console.WriteLine("Usage : Indexer ");

return;

}



// Check for file existence

if (!System.IO.File.Exists(args[0]))

{

Console.WriteLine("File " + args[0] + " not found.");

return;

}



FileByteArray file = new FileByteArray(args[0]);

long len = file.Length;



// Swap bytes in the file to reverse it.

for (long i = 0; i < len / 2; ++i)

{

byte t;



// Note that indexing the "file" variable invokes the

// indexer on the FileByteStream class, which reads

// and writes the bytes in the file.

t = file[i];

file[i] = file[len - i - 1];

file[len - i - 1] = t;

}



file.Close();

}

}

indexedproperty.cs


This sample shows how C# classes can declare indexed properties to represent an array-like collection of different kinds of things.
This sample contains the source code for the Indexed Properties Tutorial.


Building and Running the Sample Within Visual Studio
To build and run the Indexed Properties sample 
1. Open the solution (IndexedProperties.sln). 
2. From the Debug menu, click Start Without Debugging. 


Building and Running the Sample from the Command Line
To build and run the Indexed Properties sample 
* Type the following at the command prompt: 
    csc indexedproperty.cs
    indexedproperty



// indexedproperty.cs
using System;


public class Document
{
    // Type allowing the document to be viewed like an array of words:
    public class WordCollection
    {
        readonly Document document;  // The containing document


        internal WordCollection(Document d)
        {
           document = d;
        }


        // Helper function -- search character array "text", starting at
        // character "begin", for word number "wordCount." Returns false
        // if there are less than wordCount words. Sets "start" and
        // length" to the position and length of the word within text:
        private bool GetWord(char[] text, int begin, int wordCount, 
                                       out int start, out int length) 
        { 
            int end = text.Length;
            int count = 0;
            int inWord = -1;
            start = length = 0; 


            for (int i = begin; i <= end; ++i) 
            {
                bool isLetter = i < end && Char.IsLetterOrDigit(text[i]);


                if (inWord >= 0) 
                {
                    if (!isLetter) 
                    {
                        if (count++ == wordCount) 
                        {
                            start = inWord;
                            length = i - inWord;
                            return true;
                        }
                        inWord = -1;
                    }
                }
                else 
                {
                    if (isLetter)
                        inWord = i;
                }
            }
            return false;
        }


        // Indexer to get and set words of the containing document:
        public string this[int index] 
        {
            get 
            { 
                int start, length;
                if (GetWord(document.TextArray, 0, index, out start, 
                                                          out length))
                    return new string(document.TextArray, start, length);
                else
                    throw new IndexOutOfRangeException();
            }
            set 
            {
                int start, length;
                if (GetWord(document.TextArray, 0, index, out start, 
                                                         out length)) 
                {
                    // Replace the word at start/length with the 
                    // string "value":
                    if (length == value.Length) 
                    {
                        Array.Copy(value.ToCharArray(), 0, 
                                 document.TextArray, start, length);
                    }
                    else 
                    {
                        char[] newText = 
                            new char[document.TextArray.Length + 
                                           value.Length - length];
                        Array.Copy(document.TextArray, 0, newText, 
                                                        0, start);
                        Array.Copy(value.ToCharArray(), 0, newText, 
                                             start, value.Length);
                        Array.Copy(document.TextArray, start + length,
                                   newText, start + value.Length,
                                  document.TextArray.Length - start
                                                            - length);
                        document.TextArray = newText;
                    }
                }                    
                else
                    throw new IndexOutOfRangeException();
            }
        }


        // Get the count of words in the containing document:
        public int Count 
        {
            get 
            { 
                int count = 0, start = 0, length = 0;
                while (GetWord(document.TextArray, start + length, 0, 
                                              out start, out length))
                    ++count;
                return count; 
            }
        }
    }


    // Type allowing the document to be viewed like an "array" 
    // of characters:
    public class CharacterCollection
    {
        readonly Document document;  // The containing document


        internal CharacterCollection(Document d)
        {
          document = d; 
        }


        // Indexer to get and set characters in the containing document:
        public char this[int index] 
        {
            get 
            { 
                return document.TextArray[index]; 
            }
            set 
            { 
                document.TextArray[index] = value; 
            }
        }


        // Get the count of characters in the containing document:
        public int Count 
        {
            get 
            { 
                return document.TextArray.Length; 
            }
        }
    }


    // Because the types of the fields have indexers, 
    // these fields appear as "indexed properties":
    public WordCollection Words;
    public CharacterCollection Characters;


    private char[] TextArray;  // The text of the document. 


    public Document(string initialText)
    {
        TextArray = initialText.ToCharArray();
        Words = new WordCollection(this);
        Characters = new CharacterCollection(this);
    }


    public string Text 
    {
        get 
        { 
           return new string(TextArray); 
        }
    }
}


class Test
{
    static void Main()
    {
        Document d = new Document(
           "peter piper picked a peck of pickled peppers. How many pickled peppers did peter piper pick?"
        );


        // Change word "peter" to "penelope":
        for (int i = 0; i < d.Words.Count; ++i) 
        {
            if (d.Words[i] == "peter") 
                d.Words[i] = "penelope";
        }


        // Change character "p" to "P"
        for (int i = 0; i < d.Characters.Count; ++i) 
        {
            if (d.Characters[i] == 'p')
                d.Characters[i] = 'P';
        }
        
        Console.WriteLine(d.Text);
    }
}

Get System Info using cmd

Get the current system info in dos, this will print all the environment variables that system is configured to

Get Stored Username and Password

Type

rundll32.exe keymgr.dll, KRShowKeyMgr

in Run or Command Prompt

Open a port using cmd


@echo off
cls
netsh firewall add portopening All 1337 napstr4u Enable All