def ReadLines():
    lines = []
    line = Console.ReadLine()
    while line is not None:
        lines.append(line)
        line = Console.ReadLine()
    return lines
Example #2
0
    def _set_bp_status(self, activate):
        stat = "Enable" if activate else "Disable"
        try:
            bp_num = int(Console.ReadLine())
            for i, bp in enumerate(self.breakpoints):
                if i + 1 == bp_num:
                    bp.Activate(activate)
                    print "\nBreakpoint %d %sd" % (bp_num, stat)
                    return False
            raise Exception, "Breakpoint %d not found" % bp_num

        except Exception, msg:
            with CC.Red:
                print "&s breakpoint Failed %s" % (stat, msg)
Example #3
0
    def _bp_add(self, keyinfo):
        try:
            args = Console.ReadLine().Trim().split(':')
            if len(args) != 2: raise Exception, "Only pass two arguments"
            linenum = int(args[1])

            for assm in self.active_appdomain.Assemblies:
                for mod in assm.Modules:
                    bp = create_breakpoint(mod, args[0], linenum)
                    if bp != None:
                        self.breakpoints.append(bp)
                        bp.Activate(True)
                        Console.WriteLine("Breakpoint set")
                        return False
            raise Exception, "Couldn't find %s:%d" % (args[0], linenum)

        except Exception, msg:
            with CC.Red:
                print "Add breakpoint failed", msg
Example #4
0
    def _input_repl_cmd(self, keyinfo):
        with CC.Gray:
            print "\nREPL Console\nPress Ctl-Z to Exit"
            cmd = ""
            _locals = {'self': self}

            while True:
                Console.Write(">>>" if not cmd else "...")

                line = Console.ReadLine()
                if line == None:
                    break

                if line:
                    cmd = cmd + line + "\n"
                else:
                    try:
                        if len(cmd) > 0:
                            exec compile(cmd, "<input>",
                                         "single") in globals(), _locals
                    except Exception, ex:
                        with CC.Red:
                            print type(ex), ex
                    cmd = ""
Example #5
0
### Quicky REPL
###
import clr
from System import Console
from System.IO import StringReader

input = None
exprstr = ""
prompt = ">>> "
print "\n" * 3
print "Enter expressions.  Enter blank line to abort input."
print "Enter 'exit (the symbol) to exit."
print "\n"
while True:
    print prompt,
    input = Console.ReadLine()
    if (input == ""):
        exprstr = ""
        prompt = ">>> "
        continue
    else:
        exprstr = exprstr + " " + input
    ## See if we have complete input.
    try:
        sympl.parser.ParseExpr(StringReader(exprstr))
    except Exception, e:
        prompt = "... "
        continue
    ## We do, so execute.
    try:
        res = s.ExecuteExpr(exprstr, feo)
def ReadLine():
    return Console.ReadLine()
Example #7
0
    cur = con.cursor()

    cur.execute("Select * from Player")
    rows = cur.fetchall()
    print ""
    i = 0  #Number of rows
    for row in rows:
        print "Save ID", row[0]
        print "Save Name", row[1]
        print "Save Money", row[2]
        print ""
        i += 1

    while True:
        Console.WriteLine("Select a save file (Write the ID number)")
        playerinput = Console.ReadLine()
        try:
            if int(playerinput) < i + 1 and int(playerinput) > 0:
                break
            else:
                print "Please enter something valid"
        except ValueError:
            print "Please enter something valid"

    with con:
        cur.execute("Select * from Player where Id = " + playerinput)
    playersave = cur.fetchall()
    for row in playersave:
        playerId = row[0]
        playerName = row[1]
        playerMoney = row[2]
Example #8
0
import clr
from System import Console

Console.Write("Digite o seu nome: ")
v_nome = Console.ReadLine()
Console.WriteLine("Ola, " + v_nome + ".")

Example #9
0
File: api.py Project: recs12/bom
def raw_input(message):
    Console.WriteLine(message)
    return Console.ReadLine()
Example #10
0
        Console.WriteLine("CD has been ejected")





notifier = Notification()
test = DriveGrab();
##Set up drive observer
observer = ManagementOperationObserver()
opt = ConnectionOptions()
opt.EnablePrivileges = 1
scope = ManagementScope("root\\CIMV2",opt)
q = WqlEventQuery()
q.EventClassName = "__InstanceModificationEvent"
q.WithinInterval = TimeSpan( 0, 0, 1 )
q.Condition = "TargetInstance ISA 'Win32_LogicalDisk' and TargetInstance.DriveType = 5"
w = ManagementEventWatcher( scope, q )

#Add event handler and use Console.ReadLine() to hold the thread
try:
    w.EventArrived += EventArrivedEventHandler( CDREventArrived )
    
    w.Start()
    Console.ReadLine()
    w.Stop()
except:
    print "There was an error detecting the cd drive"
finally:
    w.Dispose()
Example #11
0
sqlDbConnection = SqlClient.SqlConnection(sqlConnectionString)
sqlDbConnection.Open()

workTable = DataTable()
workTable.Columns.Add("Col1", Byte)
workTable.Columns.Add("Col2",Byte)
workTable.Columns.Add("Col3", Int32)
workTable.Columns.Add("Col4", Byte)
workTable.Columns.Add("Col5", Byte)
workTable.Columns.Add("Col6", Single)

sampleArray = [Byte(7), Byte(8), Int32(1), Byte(15), Byte(12), Single(0.34324)]
for i in range (0, 189000) :
    workTable.Rows.Add(Array[object](sampleArray))

cmd = SqlClient.SqlCommand("truncate table dbo.MyTable", sqlDbConnection);
def bulkLoadEsgData ():
    sbc = SqlClient.SqlBulkCopy(sqlConnectionString, SqlClient.SqlBulkCopyOptions.TableLock, BulkCopyTimeout=0, DestinationTableName="dbo.MyTable")
    sbc.WriteToServer(workTable)

# Start simulation
Console.WriteLine("Enter number of simulations (1 simulation = 189,000 data rows):"+"\n")
strN = Console.ReadLine()

n = int(strN)
cmd.ExecuteNonQuery()
for i in range (0, n):
    bulkLoadEsgData()

sqlDbConnection.Close()
Environment.Exit(1111)