Esempio n. 1
0
        public override void Awake()
        {
            base.Awake();

            logger          = Msf.Create.Logger(GetType().Name);
            logger.LogLevel = logLevel;
        }
Esempio n. 2
0
        public SerialEchoPerformancePart(string partID, SerialEchoPerformancePartConfig config, PartsLib.Tools.MDRF.Writer.IMDRFWriter mdrfWriter)
            : base(partID, initialSettings: SimpleActivePartBaseSettings.DefaultVersion0.Build(waitTimeLimit: (0.10).FromSeconds(), goOnlineAndOfflineHandling: GoOnlineAndGoOfflineHandling.All))
        {
            Config          = new SerialEchoPerformancePartConfig(config);
            this.mdrfWriter = mdrfWriter;

            sampleIntervalTimer = new QpcTimer()
            {
                TriggerInterval = Config.SampleInterval, AutoReset = true
            }.Start();
            aggregationIntervalTimer = new QpcTimer()
            {
                TriggerInterval = Config.AggregationInterval, AutoReset = true
            }.Start();

            AddExplicitDisposeAction(() => Release());

            int targetCount = 1;

            serialEchoTrackerArray = Config.PortTargetSpecArray.Select(portTargetSpec => new SerialEchoTracker("SerialEchoPort_{0:d2}".CheckedFormat(targetCount++), portTargetSpec, binBoundariesArray, Config, this, Log)).ToArray();

            serialEchoTrackerArray.DoForEach(pt => mdrfWriter.Add(pt.hGrp.GroupInfo));

            noMDRFLogger = new Logging.Logger(PartID).SetDefaultNamedValueSetForEmitter(Logging.LogGate.All, new NamedValueSet()
            {
                { "noMDRF" }
            });
        }
Esempio n. 3
0
        public ActuatorBase(string name, ActuatorConfig config, IActuatorState initialState = null)
        {
            Config = new ActuatorConfig(config);

            initialState = initialState ?? Config.GetDefaultInitialActuatorState();

            slewRateLimitTool = new SlewRateLimitTool(minValue: 0.0, maxValue: 100.0, initialValue: initialState.PositionInPercent, initialTarget: initialState.TargetPositionInPercent, maxRatePerSec: 0.0);

            UpdateMotionRates();

            privateState = new ActuatorState(initialState);

            logger = new Logging.Logger(name, Logging.LogGate.All);

            if (config.InitialPos.IsTargetPositionValid(allowInBetween: true))
            {
                privateState.TargetPos = privateState.PosState = config.InitialPos;
                privateState.TargetPositionInPercent = privateState.PositionInPercent = GetTargetPositionInPercent(config.InitialPos, mapInBetweenToHalfWay: true);
                privateState.TargetPosStr            = privateState.PosStateStr = config.ToString(config.InitialPos);
            }

            logger.Debug.Emit("Initial state is:{0} [{1} {2:f0}%]", privateState.PosStateStr, privateState.PosState, privateState.PositionInPercent);

            PublishState();
        }
Esempio n. 4
0
        public async Task <HttpResponseMessage> SyncOtpCounter(dynamic authData)
        {
            Logging.Logger logger = new Logging.Logger(LogName);

            if (ReferenceEquals(null, authData.localCounter) || Equals(0, authData.localCounter))
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest,
                                                   "The localCounter value cannot be null or zero."));
            }

            if (ReferenceEquals(null, authData.userId) || Equals(0, authData.userId))
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest,
                                                   "The userId value cannot be null or zero."));
            }

            if (ReferenceEquals(null, authData.appId) || Equals(0, authData.appId))
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest,
                                                   "The appId value cannot be null or zero."));
            }

            long localCounter    = authData.localCounter;
            int  userId          = authData.userId;
            int  appId           = authData.appId;
            var  srvCounterValue = await GetDbOtpCounterValue(userId, appId);

            if (localCounter > srvCounterValue)
            {
                //update server counter
                var updateSuccess = await UpdateServerCounter(localCounter, userId, appId);

                var updateScenario = new { UpdateServer  = true, LocalCounter = localCounter,
                                           ServerCounter = localCounter, UpdateSuccess = updateSuccess, isEqual = false };
                var serialized = JsonConvert.SerializeObject(updateScenario);
                return(Request.CreateResponse <string> (serialized));
            }

            else
            if (localCounter < srvCounterValue)
            {
                //update local counter
                var updateScenario = new { UpdateServer = false, LocalCounter = srvCounterValue, ServerCounter = srvCounterValue, isEqual = false };
                var serialized     = JsonConvert.SerializeObject(updateScenario);
                return(Request.CreateResponse <string> (serialized));
            }

            else
            if (localCounter == srvCounterValue)
            {
                var updateScenario = new { UpdateServer = false, LocalCounter = srvCounterValue, ServerCounter = srvCounterValue, isEqual = true };
                var serialized     = JsonConvert.SerializeObject(updateScenario);
                return(Request.CreateResponse <string> (serialized));
            }

            else
            {
                return(Request.CreateResponse <string> ("SyncError"));
            }
        }
Esempio n. 5
0
        protected virtual void Awake()
        {
            if (string.IsNullOrEmpty(MstApplicationConfig.Instance.ApplicationKey))
            {
                throw new Exception("ApplicationKey is not defined");
            }

            Application.targetFrameRate = Mst.Args.AsInt(Mst.Args.Names.TargetFrameRate, targetFrameRate);

            logger          = Mst.Create.Logger(GetType().Name);
            logger.LogLevel = logLevel;

            connectedPeers     = new Dictionary <int, IPeer>();
            modules            = new Dictionary <Type, IBaseServerModule>();
            initializedModules = new HashSet <Type>();
            handlers           = new Dictionary <short, IPacketHandler>();
            peersByGuidLookup  = new Dictionary <Guid, IPeer>();

            // Create the server
            socket = Mst.Create.ServerSocket();

            // Setup secure connection
            socket.UseSecure           = MstApplicationConfig.Instance.UseSecure;
            socket.CertificatePath     = MstApplicationConfig.Instance.CertificatePath;
            socket.CertificatePassword = MstApplicationConfig.Instance.CertificatePassword;
            socket.ApplicationKey      = MstApplicationConfig.Instance.ApplicationKey;

            socket.OnPeerConnectedEvent    += OnPeerConnectedEventHandle;
            socket.OnPeerDisconnectedEvent += OnPeerDisconnectedEventHandler;

            // AesKey handler
            RegisterMessageHandler((short)MstMessageCodes.AesKeyRequest, GetAesKeyRequestHandler);
            RegisterMessageHandler((short)MstMessageCodes.PermissionLevelRequest, PermissionLevelRequestHandler);
            RegisterMessageHandler((short)MstMessageCodes.PeerGuidRequest, GetPeerGuidRequestHandler);
        }
Esempio n. 6
0
        protected virtual void Awake()
        {
            terminatableRoom = GetComponentInChildren <ITerminatableRoom>();

            logger          = Mst.Create.Logger(GetType().Name);
            logger.LogLevel = logLevel;
        }
        public PerformanceCountersPart(PerformanceCountersPartConfig config, PartsLib.Tools.MDRF.Writer.IMDRFWriter mdrfWriter)
            : base(config.PartID, initialSettings: SimpleActivePartBaseSettings.DefaultVersion0.Build(waitTimeLimit: (0.10).FromSeconds(), goOnlineAndOfflineHandling: GoOnlineAndGoOfflineHandling.All))
        {
            Config          = new PerformanceCountersPartConfig(config);
            this.mdrfWriter = mdrfWriter;

            // we trigger acquiring a new sample two times a second
            sampleIntervalTimer = new QpcTimer()
            {
                TriggerInterval = Config.SampleInterval, AutoReset = true
            }.Start();

            performanceCounterTrackerArray = Config.PerformanceCounterSpecArray.Select(pcs => new PerformanceCounterTracker(Log, pcs)).ToArray();

            pccTupleArray = performanceCounterTrackerArray.GroupBy(pct => pct.pcc, (pcc, pctSet) => Tuple.Create(pcc, pctSet.ToArray())).ToArray();

            groupInfo = new MDRF.Writer.GroupInfo()
            {
                Name = "{0}.Grp".CheckedFormat(PartID),
                GroupBehaviorOptions     = MDRF.Writer.GroupBehaviorOptions.UseVCHasBeenSetForTouched | MDRF.Writer.GroupBehaviorOptions.IncrSeqNumOnTouched,
                FileIndexUserRowFlagBits = (ulong)Config.PerformanceCounterGroupsFileIndexUserRowFlagBits,
                GroupPointInfoArray      = performanceCounterTrackerArray.Select(pct => pct.gpInfo).ToArray(),
            };

            mdrfWriter.Add(groupInfo);

            noMDRFLogger = new Logging.Logger(PartID).SetDefaultNamedValueSetForEmitter(Logging.LogGate.All, new NamedValueSet()
            {
                { "noMDRF" }
            });
        }
Esempio n. 8
0
        protected virtual void Awake()
        {
            handlers = new Dictionary <short, IPacketHandler>();

            logger          = Mst.Create.Logger(GetType().Name);
            logger.LogLevel = logLevel;
        }
Esempio n. 9
0
 public SMTPSessionOutgoing(string Server, int Port, Logging.Logger Logger, bool useSSL, bool IgnoreSSLCertificateErrors)
     : this(Server, Port)
 {
     _Logger                  = Logger;
     _useStartTLS             = useSSL;
     _ignoreCertificateErrors = IgnoreSSLCertificateErrors;
 }
Esempio n. 10
0
        protected override void Awake()
        {
            base.Awake();

            // If current object is destroying just make a return
            if (isNowDestroying)
            {
                return;
            }

            logger          = Mst.Create.Logger(typeof(ClientToMasterConnector).Name);
            logger.LogLevel = logLevel;

            // Set connection if it is null
            if (Connection == null)
            {
                Connection = ConnectionFactory();
            }

            // In case this object is not at the root level of hierarchy
            // move it there, so that it won't be destroyed
            if (transform.parent != null)
            {
                transform.SetParent(null, false);
            }

            if (Mst.Args.StartClientConnection)
            {
                connectOnStart = true;
            }
        }
Esempio n. 11
0
        public PingPerformancePart(string partID, PingPerformancePartConfig config, PartsLib.Tools.MDRF.Writer.IMDRFWriter mdrfWriter)
            : base(partID, initialSettings: SimpleActivePartBaseSettings.DefaultVersion0.Build(waitTimeLimit: (0.10).FromSeconds(), goOnlineAndOfflineHandling: GoOnlineAndGoOfflineHandling.All))
        {
            Config          = new PingPerformancePartConfig(config);
            this.mdrfWriter = mdrfWriter;

            sampleIntervalTimer = new QpcTimer()
            {
                TriggerInterval = Config.SampleInterval, AutoReset = true
            }.Start();
            aggregationIntervalTimer = new QpcTimer()
            {
                TriggerInterval = Config.AggregationInterval, AutoReset = true
            }.Start();

            AddExplicitDisposeAction(() => Release());

            pingTrackerArray = Config.PingTargetArray.Select(hostNameOrAddress => new PingTracker(hostNameOrAddress, binBoundariesArray, Config, this)).ToArray();

            pingTrackerArray.DoForEach(pt => mdrfWriter.Add(pt.hGrp.GroupInfo));

            noMDRFLogger = new Logging.Logger(PartID).SetDefaultNamedValueSetForEmitter(Logging.LogGate.All, new NamedValueSet()
            {
                { "noMDRF" }
            });
        }
Esempio n. 12
0
        protected virtual void Awake()
        {
            logger = Msf.Create.Logger(GetType().Name);
            logger.LogLevel = logLevel;

            Msf.Connection.OnStatusChangedEvent += OnConnectionStatusChanged;
        }
        protected override void Awake()
        {
            base.Awake();

            logger          = Msf.Create.Logger(typeof(ConnectionToMaster).Name);
            logger.LogLevel = logLevel;

            // In case this object is not at the root level of hierarchy
            // move it there, so that it won't be destroyed
            if (transform.parent != null)
            {
                transform.SetParent(null, false);
            }

            if (readMasterServerAddressFromCmd)
            {
                // If master IP is provided via cmd arguments
                if (Msf.Args.IsProvided(Msf.Args.Names.MasterIp))
                {
                    serverIp = Msf.Args.MasterIp;
                }

                // If master port is provided via cmd arguments
                if (Msf.Args.IsProvided(Msf.Args.Names.MasterPort))
                {
                    serverPort = Msf.Args.MasterPort;
                }
            }

            if (Msf.Args.AutoConnectClient)
            {
                connectOnStart = true;
            }
        }
Esempio n. 14
0
        protected virtual void Awake()
        {
            Application.targetFrameRate = targetFrameRate;

            logger          = Mst.Create.Logger(GetType().Name);
            logger.LogLevel = logLevel;

            connectedPeers     = new Dictionary <int, IPeer>();
            modules            = new Dictionary <Type, IBaseServerModule>();
            initializedModules = new HashSet <Type>();
            handlers           = new Dictionary <short, IPacketHandler>();
            peersByGuidLookup  = new Dictionary <Guid, IPeer>();

            // Create the server
            socket                     = Mst.Create.ServerSocket();
            socket.UseSsl              = useSsl || Mst.Args.UseSsl;
            socket.CertificatePath     = Mst.Args.ExtractValue(Mst.Args.Names.CertificatePath, certificatePath);
            socket.CertificatePassword = Mst.Args.ExtractValue(Mst.Args.Names.CertificatePassword, certificatePassword);

            socket.OnPeerConnectedEvent    += OnConnectedEventHandle;
            socket.OnPeerDisconnectedEvent += OnDisconnectedEventHandler;

            // AesKey handler
            SetHandler((short)MstMessageCodes.AesKeyRequest, GetAesKeyRequestHandler);
            SetHandler((short)MstMessageCodes.PermissionLevelRequest, PermissionLevelRequestHandler);
            SetHandler((short)MstMessageCodes.PeerGuidRequest, GetPeerGuidRequestHandler);
        }
Esempio n. 15
0
        /// <summary>
        /// Sets the otp counter valid.
        /// </summary>
        /// <param name="userId">The user identifier.</param>
        /// <param name="appId">The application identifier.</param>
        /// <returns></returns>
        private async Task <bool> SetOtpCounterValid(int userId, int appId, long counter)
        {
            Logging.Logger logger = new Logging.Logger(LogName);

            using (var userApps = new userappsEntities())
            {
                userApps.ChangeTracker.DetectChanges();

                var otpData = userApps.OTPUsers.Where(usrOtp => usrOtp.userid == userId && usrOtp.appid == appId).FirstOrDefault();

                if (otpData != null)
                {
                    otpData.seqvalid   = true;
                    otpData.otpcounter = counter;
                    otpData.otpcreated = DateTime.UtcNow;
                    await userApps.SaveChangesAsync();

                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
Esempio n. 16
0
        public async Task <HttpResponseMessage> RemoveOtpUser(dynamic authData)
        {
            if (ReferenceEquals(null, authData.userId) || Equals(0, authData.userId))
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest,
                                                   "The userId value cannot be null or zero."));
            }

            if (ReferenceEquals(null, authData.appId) || Equals(0, authData.appId))
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest,
                                                   "The appId value cannot be null or zero."));
            }

            Logging.Logger logger = new Logging.Logger(LogName);

            try
            {
                int userId = authData.userId;
                int appId  = authData.appId;

                using (var userApps = new userappsEntities())
                {
                    userApps.ChangeTracker.DetectChanges();

                    var user = userApps.OTPUsers.Where(otpu => otpu.appid == appId &&
                                                       otpu.userid == userId).FirstOrDefault();

                    if (user != null)
                    {
                        userApps.OTPUsers.Remove(user);
                        await userApps.SaveChangesAsync();

                        var value = new { Message = "Otp user successfully removed", UserId = userId, AppId = appId };
                        var ser   = await JsonConvert.SerializeObjectAsync(value);

                        await logger.StoreNewLogMessage(new Logging.Message(String.Format("REMOVETOPUSERSUCCESS  {0} for appId {1} generated."
                                                                                          , userId, appId), LogName));

                        return(Request.CreateResponse <string>(ser));
                    }
                    else
                    {
                        var value = new { Message = "Otp user does not exist.", UserId = userId, AppId = appId };
                        var ser   = await JsonConvert.SerializeObjectAsync(value);

                        logger.StoreNewLogMessage(new Logging.Message(String.Format("APPERROR, METHOD {0} ERROR {1}"
                                                                                    , "RemoveOtpUser", "OTP User does not exist."), LogName)).Wait();
                        return(Request.CreateResponse <string>(ser));
                    }
                }
            }
            catch (Exception ex)
            {
                logger.StoreNewLogMessage(new Logging.Message(String.Format("APPERROR, METHOD {0} ERROR {1}"
                                                                            , "RemoveOtpUser", ex.ToString()), LogName)).Wait();
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError,
                                                   "Database Error"));
            }
        }
 public FormSendRaw()
 {
     InitializeComponent();
     _formConfig                  = new ClassFormConfig(this);
     _logger                      = new Logging.Logger();
     _logger.LogListBox           = listBoxLog;
     _logger.LogListBoxAutoScroll = true;
 }
Esempio n. 18
0
        public ScanEngineHelper(ScanEnginePartConfig config, params IScanEnginePlugin [] pluginParamsArray)
        {
            Config = new ScanEnginePartConfig(config);
            Logger = new Logging.Logger(Name);

            AddRange(Config.PluginsToAddSet);
            AddRange(pluginParamsArray);
        }
Esempio n. 19
0
        public virtual void Initialize(HttpServerModule httpServer)
        {
            HttpServer   = httpServer;
            MasterServer = httpServer.Server;

            logger          = Mst.Create.Logger(GetType().Name);
            logger.LogLevel = logLevel;
        }
Esempio n. 20
0
        /// <summary>
        /// Private constructor.  Instance may only be constructed by delegate used by the singletonHelper defined above.
        /// </summary>
        private SelectSocketMonitor()
        {
            string className = GetType().Name;

            Logger = new Logging.Logger(className);
            Trace  = new Logging.Logger(className + ".Trace", Logging.LookupDistributionGroupName, Logging.LogGate.All);

            AddExplicitDisposeAction(() => Shutdown());
        }
Esempio n. 21
0
        protected override void Awake()
        {
            base.Awake();

            logger          = Msf.Create.Logger(GetType().Name);
            logger.LogLevel = logLevel;

            Msf.Server.Spawners.DefaultPort = Msf.Args.RoomDefaultPort;
        }
Esempio n. 22
0
        public virtual void Initialize(HttpServerModule server)
        {
            Server = server;

            logger          = Mst.Create.Logger(GetType().Name);
            logger.LogLevel = logLevel;

            ComposeHtml();
        }
Esempio n. 23
0
 public Terrainnew(Window window)
     : base(ref window.logger)
 {
     log = window.logger;
     camera = (vbdetlevvb_engine.Rendering.Camera.BasicCamera)window.camera;
     this.window = window;
     window.Mouse.ButtonDown += new EventHandler<MouseButtonEventArgs>(Mouse_ButtonDown);
     window.Mouse.ButtonUp += new EventHandler<MouseButtonEventArgs>(Mouse_ButtonUp);
 }
Esempio n. 24
0
 /// <summary>
 /// Full HandleOnStartup method signature.
 /// argsRef line arguments string array will be used with the (optional) initial setup of Modular.Config.  This array will be replaced with one that has the consumed parameters removed from it.
 /// appLogger will be assigned to a new logger (this is expected to be used by the client in calls to later HandleYYY methods).
 /// logBaseName is used to define the name of the logger instances and will appear in the resulting output log file file names.
 /// When addWPFLMH is passed as true then this method will also add an instance of the WpfLogMessageHandlerToolBase to the default log distribution group.
 /// </summary>
 public static void HandleOnStartup(ref string[] argsRef, ref Logging.Logger appLogger, string logBaseName = null, bool addWPFLMH = false, bool addSetLMH = false, bool enableUEH = true)
 {
     HandleOnStartup(ref argsRef, ref appLogger, new NamedValueSet()
     {
         { "logBaseName", logBaseName },
         { "addWPFLMH", addWPFLMH },
         { "addSetLMH", addSetLMH },
         { "enableUEH", enableUEH },
     });
 }
        public override void Awake()
        {
            logger          = Msf.Create.Logger(GetType().Name);
            logger.LogLevel = logLevel;

            // Prevent to create player automatically
            autoCreatePlayer = false;

            base.Awake();
        }
Esempio n. 26
0
        public virtual void Initialize(HttpServerModule httpServer, WsControllerService wsService)
        {
            HttpServer   = httpServer;
            MasterServer = httpServer.Server;

            WsService = wsService;

            logger          = Mst.Create.Logger(GetType().Name);
            logger.LogLevel = logLevel;
        }
Esempio n. 27
0
        public StackExchangeClient(string host, int db, Logging.Logger logger = null) : base(null)
        {
            Logger = logger ?? new Logging.Logger("REDIS", null);

            Logger.Log("Connecting to Redis: {0}", host);
            ConnectionMultiplexer = ConnectionMultiplexer.Connect(host);

            Logger.Log("Getting Database {0}", db);
            DatabaseAsync = Database = ConnectionMultiplexer.GetDatabase(db);
        }
Esempio n. 28
0
        public HouseMemberFuzzyCalc([NotNull] Logging.Logger logger)
        {
            _logger = logger;
            //
            // Create empty fuzzy system
            //

            //
            // Create input variables for the system
            //
            var energy = new FuzzyVariable("energy", 0.0, 10000.0);

            //// finetune these parameters some more / automate the fine tuning
            energy.Terms.Add(new FuzzyTerm("zeroenergy", new TriangularMembershipFunction(-5.0, 0.0, 1000)));
            energy.Terms.Add(new FuzzyTerm("onethousand", new TrapezoidMembershipFunction(1000, 1200, 1300, 1800)));
            energy.Terms.Add(new FuzzyTerm("twothousand", new TrapezoidMembershipFunction(1500, 2200, 2500, 3500)));
            energy.Terms.Add(new FuzzyTerm("threethousand", new TrapezoidMembershipFunction(3300, 4000, 4700, 5000)));
            energy.Terms.Add(new FuzzyTerm("fourthousand", new TrapezoidMembershipFunction(4500, 5000, 6000, 6500)));
            energy.Terms.Add(new FuzzyTerm("fivethousand", new TriangularMembershipFunction(6500, 7500, 8000)));
            energy.Terms.Add(new FuzzyTerm("sixthousand", new TriangularMembershipFunction(7000, 8000, 10000)));
            _fsTips.Input.Add(energy);

            /*FuzzyVariable fvFood = new FuzzyVariable("food", 0.0, 10.0);
             * fvFood.Terms.Add(new FuzzyTerm("rancid", new TrapezoidMembershipFunction(0.0, 0.0, 1.0, 3.0)));
             * fvFood.Terms.Add(new FuzzyTerm("delicious", new TrapezoidMembershipFunction(7.0, 9.0, 10.0, 10.0)));
             * fsTips.Input.Add(fvFood);*/

            //
            // Create output variables for the system
            //
            var people = new FuzzyVariable("people", 0.0, 10);

            people.Terms.Add(new FuzzyTerm("zero", new TriangularMembershipFunction(0.0, 0.2, 0.5)));
            people.Terms.Add(new FuzzyTerm("oneperson", new TriangularMembershipFunction(0.0, 1, 2)));
            people.Terms.Add(new FuzzyTerm("twopersons", new TriangularMembershipFunction(1, 2, 3)));
            people.Terms.Add(new FuzzyTerm("threepersons", new TriangularMembershipFunction(2, 3, 4)));
            people.Terms.Add(new FuzzyTerm("fourpersons", new TriangularMembershipFunction(3, 4, 5)));
            people.Terms.Add(new FuzzyTerm("fivepersons", new TriangularMembershipFunction(4, 5, 6)));
            people.Terms.Add(new FuzzyTerm("sixpersons", new TriangularMembershipFunction(5, 6, 7)));
            _fsTips.Output.Add(people);

            //
            // Create three fuzzy rules
            //
            //  try
            //            {// or (food is rancid)
            _fsTips.Rules.Add(_fsTips.ParseRule("if (energy is zeroenergy ) then people is zero"));
            _fsTips.Rules.Add(_fsTips.ParseRule("if (energy is onethousand) then people is oneperson"));
            _fsTips.Rules.Add(_fsTips.ParseRule("if (energy is twothousand) then (people is twopersons)"));
            _fsTips.Rules.Add(_fsTips.ParseRule("if (energy is threethousand) then (people is threepersons)"));
            _fsTips.Rules.Add(_fsTips.ParseRule("if (energy is fourthousand) then (people is fourpersons)"));
            _fsTips.Rules.Add(_fsTips.ParseRule("if (energy is fivethousand) then (people is fivepersons)"));
            _fsTips.Rules.Add(_fsTips.ParseRule("if (energy is sixthousand) then (people is sixpersons)"));
        }
Esempio n. 29
0
 public Chunk(ref Window window, Vector2 position)
 {
     log = window.logger;
     camera = (vbdetlevvb_engine.Rendering.Camera.BasicCamera)window.camera;
     this.window = window;
     ChunkPosition = position;
     window.Mouse.ButtonDown += new EventHandler<MouseButtonEventArgs>(Mouse_ButtonDown);
     window.Mouse.ButtonUp += new EventHandler<MouseButtonEventArgs>(Mouse_ButtonUp);
     drawer = new List<ChunkDrawer>();
     drawer.Add(new ChunkDrawer(ref window.logger));
     shape = new List<VertexPosition[]>();
 }
Esempio n. 30
0
        /// <summary>
        /// Web socket instance
        /// </summary>
        /// <param name="url"></param>
        public WebSocket(Uri url)
        {
            logger = Mst.Create.Logger(typeof(WebSocket).Name);

            this.url = url;
            string protocol = this.url.Scheme;

            if (!protocol.Equals("ws") && !protocol.Equals("wss"))
            {
                throw new ArgumentException($"Unsupported protocol: {protocol}");
            }
        }
Esempio n. 31
0
        public ConsoleCtrlHandlerHook(string name, ClientProvidedDelegate clientProvidedDelegate = null, int defaultExitCode = 0)
        {
            Logger = new Logging.Logger(name);

            this.clientProvidedDelegate = clientProvidedDelegate;
            ExitCode = defaultExitCode;

            consoleCtrlHandlerDelegate = ConsoleCtrlHandler;

            Hooks.Fcns.SetConsoleCtrlHandler(consoleCtrlHandlerDelegate, true);

            AddExplicitDisposeAction(() => Release());
        }
Esempio n. 32
0
        public override void Awake()
        {
            logger          = Mst.Create.Logger(GetType().Name);
            logger.LogLevel = logLevel;

            // Prevent to create player automatically
            autoCreatePlayer = false;

            // Prevent start network manager in headless mode automatically
            autoStartServerBuild = false;

            base.Awake();
        }
Esempio n. 33
0
 public World(Window window)
 {
     //	-32,768 to 32,767
     chunks = new Chunk[65535,255];
     log = window.logger;
     this.window = window;
     this.camera = (BasicCamera)window.camera;
     /*
      *
      * Chunkgröße = 2*2
      * byte 256;
      * Höhe 256 CHunks
      */
 }
Esempio n. 34
0
        /// <summary>
        /// Private constructor.  Instance may only be constructed by delegate used by the singletonHelper defined above.
        /// </summary>
        private SelectSocketMonitor()
        {
            string className = GetType().Name;

            Logger = new Logging.Logger(className);
            Trace = new Logging.Logger(className + ".Trace", Logging.LookupDistributionGroupName, Logging.LogGate.All);

            AddExplicitDisposeAction(() => Shutdown());
        }
Esempio n. 35
0
 /// <summary>Constructor.  Requires an instance name.</summary>
 public PartsInterconnection(string name)
 {
     Name = name;
     Logger = new Logging.Logger(name);
 }
Esempio n. 36
0
        public static void HandleOnStartup(StartupEventArgs e, ref Logging.Logger appLogger, string logBaseName)
        {
            MosaicLib.Modular.Config.Config.AddStandardProviders(e.Args);

            int ringQueueSize = 500;
            int traceQueueSize = 1000;
            Logging.ListMesgEmitter issueListEmitter = new Logging.ListMesgEmitter() { MesgType = Logging.MesgType.Error };
            Logging.ListMesgEmitter valuesListEmitter = new Logging.ListMesgEmitter() { MesgType = Logging.MesgType.Debug };

            Logging.FileRotationLoggingConfig ringConfig = new Logging.FileRotationLoggingConfig((logBaseName ?? String.Empty) + "LogFile")
            {
                mesgQueueSize = ringQueueSize,
                nameUsesDateAndTime = true,
            }.UpdateFromModularConfig("Config.Logging.FileRing.", issueListEmitter, valuesListEmitter);

            Logging.FileRotationLoggingConfig traceRingConfig = new Logging.FileRotationLoggingConfig((logBaseName ?? String.Empty) + "TraceRing")
            {
                mesgQueueSize = traceQueueSize,
                nameUsesDateAndTime = false,     // will use 4 digit file names.  Limit of 100 files total
                includeThreadInfo = true,
            }.UpdateFromModularConfig("Config.Logging.TraceRing.", issueListEmitter, valuesListEmitter);

            Logging.ILogMessageHandler dirRingLMH = Logging.CreateQueuedTextFileRotationDirectoryLogMessageHandler(ringConfig);
            Logging.ILogMessageHandler lmh = null; //  Logging.CreateDiagnosticTraceLogMessageHandler(Logging.LogGate.Debug);
            Logging.ILogMessageHandler wpfLMH = MosaicLib.WPF.Logging.WpfLogMessageHandlerToolBase.Instance;

            if (dirRingLMH != null)
                Logging.AddLogMessageHandlerToDefaultDistributionGroup(dirRingLMH);
            if (lmh != null)
                Logging.AddLogMessageHandlerToDefaultDistributionGroup(lmh);

            // how to change wpfLMH logging level after construction
            if (wpfLMH != null)
                Logging.AddLogMessageHandlerToDefaultDistributionGroup(wpfLMH);

            appLogger = new Logging.Logger("AppLogger");
            Logging.LogMessage lm = appLogger.GetLogMessage(Logging.MesgType.Signif, "App Starting", appLogger.GetStackFrame(0));
            lm.KeywordArray = new string[] { "Application", "OnStartup" };
            appLogger.EmitLogMessage(ref lm);

            // emit the config messages obtained above.
            Logging.Logger appLoggerCopy = appLogger;
            issueListEmitter.EmittedItemList.ForEach((item) => appLoggerCopy.Error.Emit(item.MesgStr));
            valuesListEmitter.EmittedItemList.ForEach((item) => appLoggerCopy.Debug.Emit(item.MesgStr));

            // setup the loadPortTraceGroup - to recieve trace data from
            string traceLoggingGroupName = "LGID.Trace";

            Logging.ILogMessageHandler traceRingLMH = Logging.CreateQueuedTextFileRotationDirectoryLogMessageHandler(traceRingConfig);

            Logging.AddLogMessageHandlerToDistributionGroup(traceLoggingGroupName, traceRingLMH);
            Logging.SetDistributionGroupGate(traceLoggingGroupName, Logging.LogGate.All);

            Logging.LinkDistributionToGroup(Logging.DefaultDistributionGroupName, traceLoggingGroupName);
            Logging.MapLoggersToDistributionGroup(Logging.LoggerNameMatchType.Regex, @"(\.Data|\.Trace)", traceLoggingGroupName);
        }
Esempio n. 37
0
 public ChunkDrawer(ref Logging.Logger log)
 {
     this.log = log;
 }
Esempio n. 38
0
 public VectorUpload()
 {
     this.comms = new GbdxComms(Jarvis.LogFile, false);
     this.logger = new Logger(Jarvis.LogFile, false);
 }