Exemplo n.º 1
0
 public void SetUp()
 {
     GetBrowser();
     InitializePageObjects();
     CreateScreenshotsDirectory();
     LogMsg("Test Browser: " + Browser.ToString());
     LogMsg("Silent Mode: " + ExecMode.ToString());
     LogMsg("Implicit wait: " + ImplicitWait.ToString() + " seconds");
 }
Exemplo n.º 2
0
        }         // PublishRunningTime

        protected virtual object Run(
            ConnectionWrapper cw,
            ExecMode nMode,
            CommandSpecies nSpecies,
            string spName,
            params QueryParameter[] aryParams
            )
        {
            return(Run(cw, null, nMode, nSpecies, spName, aryParams));
        }         // Run
Exemplo n.º 3
0
        void GenDriver(string builddir, List <string> profilers, ExecMode ee_mode, bool link_icalls)
        {
            var symbols = new List <string> ();

            foreach (var adata in assemblies)
            {
                if (adata.aot)
                {
                    symbols.Add(String.Format("mono_aot_module_{0}_info", adata.name.Replace('.', '_').Replace('-', '_')));
                }
            }

            var w = File.CreateText(Path.Combine(builddir, "driver-gen.c.in"));

            foreach (var symbol in symbols)
            {
                w.WriteLine($"extern void *{symbol};");
            }

            w.WriteLine("static void register_aot_modules ()");
            w.WriteLine("{");
            foreach (var symbol in symbols)
            {
                w.WriteLine($"\tmono_aot_register_module ({symbol});");
            }
            w.WriteLine("}");

            foreach (var profiler in profilers)
            {
                w.WriteLine($"void mono_profiler_init_{profiler} (const char *desc);");
                w.WriteLine("EMSCRIPTEN_KEEPALIVE void mono_wasm_load_profiler_" + profiler + " (const char *desc) { mono_profiler_init_" + profiler + " (desc); }");
            }

            switch (ee_mode)
            {
            case ExecMode.AotInterp:
                w.WriteLine("#define EE_MODE_LLVMONLY_INTERP 1");
                break;

            case ExecMode.Aot:
                w.WriteLine("#define EE_MODE_LLVMONLY 1");
                break;

            default:
                break;
            }

            if (link_icalls)
            {
                w.WriteLine("#define LINK_ICALLS 1");
            }

            w.Close();
        }
Exemplo n.º 4
0
 public SipUserData(string inSubNum, string inSubUserName, string inSubPassword, string inSubStatus, string inCallOutAuth, int iCallSrcCode, bool ATSPrepaid, ExecMode exMode, string webRef, decimal dFrom, decimal dTo)
 {
     this.inSubNum      = inSubNum;
     this.inSubUserName = inSubUserName;
     this.inSubPassword = inSubPassword;
     this.inSubStatus   = inSubStatus;
     this.inCallOutAuth = inCallOutAuth;
     this.iCallSrcCode  = iCallSrcCode;
     this.ATSPrepaid    = ATSPrepaid;
     this.exMode        = exMode;
     this.webRef        = webRef;
     this.dFrom         = dFrom;
     this.dTo           = dTo;
 }
Exemplo n.º 5
0
 public EslUserData(string sEquipmentID, string sGatewayDescription, string sSubscriberNumber, string sPassword, string sTerminationID, string sCallOutAuth, string sSubscriberStatus, int iGatewayType, int iProtocolType, int iCallSrcCode, bool bPrepaid, ExecMode exMode, EslMode eslMode, string webRef, decimal dFrom, decimal dTo)
 {
     this.sEquipmentID        = sEquipmentID;
     this.sGatewayDescription = sGatewayDescription;
     this.sSubscriberNumber   = sSubscriberNumber;
     this.sPassword           = sPassword;
     this.sTerminationID      = sTerminationID;
     this.iGatewayType        = iGatewayType;
     this.iProtocolType       = iProtocolType;
     this.iCallSrcCode        = iCallSrcCode;
     this.sCallOutAuth        = sCallOutAuth;
     this.sSubscriberStatus   = sSubscriberStatus;
     this.bPrepaid            = bPrepaid;
     this.exMode  = exMode;
     this.eslMode = eslMode;
     this.webRef  = webRef;
     this.dFrom   = dFrom;
     this.dTo     = dTo;
 }
Exemplo n.º 6
0
        /// <summary>
        /// Function called when a key is pressed
        /// </summary>
        static void OnKeyPressed(object sender, KeyEventArgs e)
        {
            if (StaticResources.State.Dialog != null && StaticResources.State.Dialog.Active)
            {
                StaticResources.State.Dialog.KeyPress();
            }

            Window window = (Window)sender;
            if (e.Code == Keyboard.Key.Escape)
                window.Close();

            switch (mode)
            {
                case ExecMode.Title:
                    mode = ExecMode.Intro;
                    StaticResources.State.Dialog.Activate(
                        "Welcome to the Olympics, \n" +
                        "hosted this year by the sea ponies!\n" +
                        "The current event is: swimming!\n" +
                        "Collect all the taffies!\n" +
                        "Move - WASD\n" +
                        "Spin - Space\n" +
                        "Go!"
                    );
                    break;
                case ExecMode.Intro:
                    //Sound.StopAll();
                    //Sound.Loop("music/aurora", 40);
                    Sound.Loop("ambient/water", 40);
                    mode = ExecMode.Main;
                    for (int i = 0; i < 1024 * 2; i += 80)
                    {
                        StaticResources.State.Actors.Add(Actor.Taffy);
                        StaticResources.State.Actors.Last().Position = new Vector2f(i, 0);
                        TotalTaffies++;
                    }
                    int r = 400;
                    for (int x = -r; x < r; x += 64)
                    {
                        int y = (int)((float)Math.Sqrt(r * r - x * x));
                        Actor circleTaffy = Actor.Taffy;
                        circleTaffy.Position = new Vector2f(x, y);
                        StaticResources.State.Actors.Add(circleTaffy);

                        Actor circleTaffy2 = Actor.Taffy;
                        circleTaffy2.Position = new Vector2f(x, -y);
                        StaticResources.State.Actors.Add(circleTaffy2);

                        TotalTaffies += 2;
                    }

                    int L = -(512 + 128);
                    int thickness = 4 * 128;
                    int T = -700;
                    int R = L + 3000;
                    int B = T + 2000;

                    for (int i = L + 128; i < R - 128; i += 64)
                    {
                        Actor taffy = Actor.Taffy;
                        taffy.Position = new Vector2f(i, (float)
                            (512.0f * Math.Sin((i / 200.0f))));
                        StaticResources.State.Actors.Add(taffy);
                        TotalTaffies += 1;
                    }

                    //top
                    for (int y = T - thickness - 128; y < T ; y += 128)
                    {
                        for (int x = L - thickness; x < R + thickness; x += 128)
                        {
                            Actor c = Blocks.c;
                            c.Position = new Vector2f(x, y);
                            StaticResources.State.Actors.Add(c);
                        }
                    }

                    for (int x = L; x < R + 128; x += 128)
                    {
                        Actor b = Blocks.b;
                        b.Position = new Vector2f(x, T);
                        StaticResources.State.Actors.Add(b);
                    }

                    //bottom
                    for (int y = B + 128; y < B + thickness; y += 128)
                    {
                        for (int x = L - thickness; x < R + thickness; x += 128)
                        {
                            Actor c = Blocks.c;
                            c.Position = new Vector2f(x, y);
                            StaticResources.State.Actors.Add(c);
                        }
                    }
                    for (int x = L; x < R + 128; x += 128)
                    {
                        Actor t = Blocks.t;
                        t.Position = new Vector2f(x, B);
                        StaticResources.State.Actors.Add(t);
                    }

                    //left
                    for (int x = L - thickness - 128; x < L ; x += 128)
                    {
                        for (int y = T; y < B + 128; y += 128)
                        {
                            Actor c = Blocks.c;
                            c.Position = new Vector2f(x, y);
                            StaticResources.State.Actors.Add(c);
                        }
                    }
                    for (int y = T; y < B + 128; y += 128)
                    {
                        Actor ri = Blocks.r;
                        ri.Position = new Vector2f(L, y);
                        StaticResources.State.Actors.Add(ri);
                    }

                    //right
                    for (int x = R + 128; x < R + 128 + thickness; x += 128)
                    {
                        for (int y = T; y < B + 128; y += 128)
                        {
                            Actor c = Blocks.c;
                            c.Position = new Vector2f(x, y);
                            StaticResources.State.Actors.Add(c);
                        }
                    }
                    for (int y = T; y < B + 128; y += 128)
                    {
                        Actor l = Blocks.l;
                        l.Position = new Vector2f(R, y);
                        StaticResources.State.Actors.Add(l);
                    }

                    for (int i = 0; i < 30; i++)
                    {
                        //int x = i * 128;
                        //Actor c = Blocks.c;
                        //c.Position = new Vector2f(x, -(1024 + 128));
                        //StaticResources.State.Actors.Add(c);
                    }
                    break;
                case ExecMode.Main:

                    switch (e.Code)
                    {
                        case Keyboard.Key.Space:
                            StaticResources.State.MainCharacter.TrySquence(
                                Sequences.Spin, 600, 200
                            );
                            break;
                    }

                    break;
            }
        }
Exemplo n.º 7
0
 public NeuralNetwork(ExecMode execMode, double learningRate)
 {
     this.Layers       = new List <Layer.Layer>();
     this.ExecMode     = execMode;
     this.LearningRate = learningRate;
 }
Exemplo n.º 8
0
 public static void Run(Services service, DirectoryInfo directory, ExecMode mode = ExecMode.Run, bool noNewWindows=true)
 {
     Shell.SilentMode = noNewWindows;
     Main(new string[] { service.ToString(), directory.FullName, mode.ToString() });
 }
Exemplo n.º 9
0
 public static void Repair(DirectoryInfo directory, bool face, ExecMode mode = ExecMode.Run)
 {
     Main(Services.Repair.ToString(), directory.FullName, face ? "face" : "desktop", mode.ToString());
 }
Exemplo n.º 10
0
        }         // Run

        protected virtual object RunOnce(
            ConnectionWrapper oConnectionToUse,
            Func <DbDataReader, bool, ActionResult> oAction,
            ExecMode nMode,
            DbCommand command,
            LogVerbosityLevel nLogVerbosityLevel,
            string spName,
            string sArgsForLog,
            Guid guid
            )
        {
            ConnectionWrapper oConnection = null;

            bool bAllesInOrdnung = true;

            bool bDropAfterUse = oConnectionToUse == null;

            try {
                oConnection = oConnectionToUse ?? TakeFromPool();

                if (oConnection == null)
                {
                    throw new NullReferenceException("There is no available connection to execute the query.");
                }

                command.Connection = oConnection.Connection;

                if (oConnection.Transaction != null)
                {
                    command.Transaction = oConnection.Transaction;
                }

                string sPooledConID = oConnection.Pooled.Name;

                var sw = new Stopwatch();
                sw.Start();

                switch (nMode)
                {
                case ExecMode.Scalar:
                    oConnection.Open();
                    object value = command.ExecuteScalar();
                    PublishRunningTime(sPooledConID, nLogVerbosityLevel, spName, sArgsForLog, guid, sw);
                    return(value);

                case ExecMode.Reader:
                    oConnection.Open();

                    var oReader = command.ExecuteReader();

                    long nPrevStopwatchValue = sw.ElapsedMilliseconds;

                    if (nLogVerbosityLevel == LogVerbosityLevel.Verbose)
                    {
                        PublishRunningTime(sPooledConID, nLogVerbosityLevel, spName, sArgsForLog, guid, sw);
                    }

                    var dataTable = new DataTable();
                    dataTable.Load(oReader);

                    string sMsg;

                    switch (nLogVerbosityLevel)
                    {
                    case LogVerbosityLevel.Compact:
                        sMsg = "completed and data loaded";
                        break;

                    case LogVerbosityLevel.Verbose:
                        sMsg = "data loaded";
                        break;

                    default:
                        throw new ArgumentOutOfRangeException();
                    }                     // switch

                    PublishRunningTime(sPooledConID, nLogVerbosityLevel, spName, sArgsForLog, guid, sw, nPrevStopwatchValue, sMsg);

                    oReader.Close();

                    return(dataTable);

                case ExecMode.NonQuery:
                    oConnection.Open();
                    int    nResult = command.ExecuteNonQuery();
                    string sResult = ((nResult == 0) || (nResult == -1)) ? "no" : nResult.ToString(CultureInfo.InvariantCulture);
                    PublishRunningTime(sPooledConID, nLogVerbosityLevel, spName, sArgsForLog, guid, sw, sAuxMsg: string.Format("- {0} row{1} changed", sResult, nResult == 1 ? "" : "s"));
                    return(nResult);

                case ExecMode.ForEachRow:
                    oConnection.Open();
                    command.ForEachRow(oAction, () => PublishRunningTime(sPooledConID, nLogVerbosityLevel, spName, sArgsForLog, guid, sw));
                    return(null);

                case ExecMode.Enumerable:
                    return(command.ExecuteEnumerable(
                               oConnection,
                               bDropAfterUse ? this : null,
                               () => PublishRunningTime(sPooledConID, nLogVerbosityLevel, spName, sArgsForLog, guid, sw)
                               ));

                default:
                    throw new ArgumentOutOfRangeException("nMode");
                }                 // switch
            } catch (Exception) {
                bAllesInOrdnung = false;
                throw;
            } finally {
                if (bDropAfterUse && (nMode != ExecMode.Enumerable))
                {
                    DisposeAfterOneUsage(bAllesInOrdnung, oConnection);
                }
            }     // try
        }         // RunOnce
Exemplo n.º 11
0
        }         // Run

        protected virtual object Run(
            ConnectionWrapper cw,
            Func <DbDataReader, bool, ActionResult> oAction,
            ExecMode nMode,
            CommandSpecies nSpecies,
            string spName,
            params QueryParameter[] aryParams
            )
        {
            if ((nMode == ExecMode.ForEachRow) && ReferenceEquals(oAction, null))
            {
                throw new DbException("Callback action not specified in 'ForEachRow' call.");
            }

            var oArgsForLog = new StringBuilder();

            LogVerbosityLevel nLogVerbosityLevel = LogVerbosityLevel;

            foreach (QueryParameter prm in aryParams)
            {
                oArgsForLog.Append(oArgsForLog.Length > 0 ? ", " : string.Empty).Append(prm);
            }

            string sArgsForLog = "(" + oArgsForLog + ")";

            Guid guid = Guid.NewGuid();

            if (nLogVerbosityLevel == LogVerbosityLevel.Verbose)
            {
                Log.Debug("Starting to run query:\n\tid = {0}\n\t{1}{2}", guid, spName, sArgsForLog);
            }

            SqlRetryer oRetryer = CreateRetryer();

            oRetryer.LogVerbosityLevel = this.LogVerbosityLevel;

            DbCommand oCmdToDispose = null;

            try {
                DbCommand cmd = BuildCommand(spName, nSpecies, aryParams);
                oCmdToDispose = cmd;

                object oResult = null;

                oRetryer.Retry(() =>
                               oResult = RunOnce(cw, oAction, nMode, cmd, nLogVerbosityLevel, spName, sArgsForLog, guid)
                               );  // Retry

                return(oResult);
            } catch (Exception e) {
                if (nLogVerbosityLevel == LogVerbosityLevel.Verbose)
                {
                    Log.Error(e, "Error while executing query {0}", guid);
                }
                else
                {
                    Log.Error(e, "Error while executing query:\n\tid = {0}\n\t{1}{2}", guid, spName, sArgsForLog);
                }

                throw;
            } finally {
                if (oCmdToDispose != null)
                {
                    oCmdToDispose.Dispose();

                    if (nLogVerbosityLevel == LogVerbosityLevel.Verbose)
                    {
                        Log.Debug("Command has been disposed.");
                    }
                } // if
            }     // try
        }         // Run
Exemplo n.º 12
0
        /// <summary>
        /// Function called when a key is pressed
        /// </summary>
        static void OnKeyPressed(object sender, KeyEventArgs e)
        {
            if (StaticResources.State.Dialog != null && StaticResources.State.Dialog.Active)
            {
                StaticResources.State.Dialog.KeyPress();
            }

            Window window = (Window)sender;

            if (e.Code == Keyboard.Key.Escape)
            {
                window.Close();
            }

            switch (mode)
            {
            case ExecMode.Title:
                mode = ExecMode.Intro;
                StaticResources.State.Dialog.Activate(
                    "Welcome to the Olympics, \n" +
                    "hosted this year by the sea ponies!\n" +
                    "The current event is: swimming!\n" +
                    "Collect all the taffies!\n" +
                    "Move - WASD\n" +
                    "Spin - Space\n" +
                    "Go!"
                    );
                break;

            case ExecMode.Intro:
                //Sound.StopAll();
                //Sound.Loop("music/aurora", 40);
                Sound.Loop("ambient/water", 40);
                mode = ExecMode.Main;
                for (int i = 0; i < 1024 * 2; i += 80)
                {
                    StaticResources.State.Actors.Add(Actor.Taffy);
                    StaticResources.State.Actors.Last().Position = new Vector2f(i, 0);
                    TotalTaffies++;
                }
                int r = 400;
                for (int x = -r; x < r; x += 64)
                {
                    int   y           = (int)((float)Math.Sqrt(r * r - x * x));
                    Actor circleTaffy = Actor.Taffy;
                    circleTaffy.Position = new Vector2f(x, y);
                    StaticResources.State.Actors.Add(circleTaffy);

                    Actor circleTaffy2 = Actor.Taffy;
                    circleTaffy2.Position = new Vector2f(x, -y);
                    StaticResources.State.Actors.Add(circleTaffy2);

                    TotalTaffies += 2;
                }

                int L         = -(512 + 128);
                int thickness = 4 * 128;
                int T         = -700;
                int R         = L + 3000;
                int B         = T + 2000;

                for (int i = L + 128; i < R - 128; i += 64)
                {
                    Actor taffy = Actor.Taffy;
                    taffy.Position = new Vector2f(i, (float)
                                                  (512.0f * Math.Sin((i / 200.0f))));
                    StaticResources.State.Actors.Add(taffy);
                    TotalTaffies += 1;
                }

                //top
                for (int y = T - thickness - 128; y < T; y += 128)
                {
                    for (int x = L - thickness; x < R + thickness; x += 128)
                    {
                        Actor c = Blocks.c;
                        c.Position = new Vector2f(x, y);
                        StaticResources.State.Actors.Add(c);
                    }
                }

                for (int x = L; x < R + 128; x += 128)
                {
                    Actor b = Blocks.b;
                    b.Position = new Vector2f(x, T);
                    StaticResources.State.Actors.Add(b);
                }

                //bottom
                for (int y = B + 128; y < B + thickness; y += 128)
                {
                    for (int x = L - thickness; x < R + thickness; x += 128)
                    {
                        Actor c = Blocks.c;
                        c.Position = new Vector2f(x, y);
                        StaticResources.State.Actors.Add(c);
                    }
                }
                for (int x = L; x < R + 128; x += 128)
                {
                    Actor t = Blocks.t;
                    t.Position = new Vector2f(x, B);
                    StaticResources.State.Actors.Add(t);
                }

                //left
                for (int x = L - thickness - 128; x < L; x += 128)
                {
                    for (int y = T; y < B + 128; y += 128)
                    {
                        Actor c = Blocks.c;
                        c.Position = new Vector2f(x, y);
                        StaticResources.State.Actors.Add(c);
                    }
                }
                for (int y = T; y < B + 128; y += 128)
                {
                    Actor ri = Blocks.r;
                    ri.Position = new Vector2f(L, y);
                    StaticResources.State.Actors.Add(ri);
                }

                //right
                for (int x = R + 128; x < R + 128 + thickness; x += 128)
                {
                    for (int y = T; y < B + 128; y += 128)
                    {
                        Actor c = Blocks.c;
                        c.Position = new Vector2f(x, y);
                        StaticResources.State.Actors.Add(c);
                    }
                }
                for (int y = T; y < B + 128; y += 128)
                {
                    Actor l = Blocks.l;
                    l.Position = new Vector2f(R, y);
                    StaticResources.State.Actors.Add(l);
                }



                for (int i = 0; i < 30; i++)
                {
                    //int x = i * 128;
                    //Actor c = Blocks.c;
                    //c.Position = new Vector2f(x, -(1024 + 128));
                    //StaticResources.State.Actors.Add(c);
                }
                break;

            case ExecMode.Main:

                switch (e.Code)
                {
                case Keyboard.Key.Space:
                    StaticResources.State.MainCharacter.TrySquence(
                        Sequences.Spin, 600, 200
                        );
                    break;
                }

                break;
            }
        }