예제 #1
0
 public MainWindow()
 {
     InitializeComponent();
     checker.CheckComponents(path);
     InfoHandler.readDatas();
     PartnerHandler.RefreshPartners();
 }
예제 #2
0
 public void GetFriendAndGroup()
 {
     this.GetQunCookies();
     this.Friends = this.Get_Friend_List();
     this.Groups  = this.Get_Group_List();
     InfoHandler.GetFriendAndGroup(this.QQ, this.Friends, this.Groups);
 }
예제 #3
0
        //validate the items, and save them to their files
        private void SaveBtn_Click(object sender, RoutedEventArgs e)
        {
            string[] records = { NameBox.Text, AddressBox.Text, TaxNumberBox.Text, AccountNumberBox.Text };
            if (!Validator.ValidateTextArray(records))
            {
                MessageBox.Show("Hibás adatok!", "Hiba", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            InfoHandler.ownCompany.Name          = NameBox.Text;
            InfoHandler.ownCompany.Address       = AddressBox.Text;
            InfoHandler.ownCompany.TaxNumber     = TaxNumberBox.Text;
            InfoHandler.ownCompany.AccountNumber = AccountNumberBox.Text;
            if (Validator.ValidateTaxRate(TaxToAddBox.Text) && !InfoHandler.taxRate.TaxRates.Contains(TaxToAddBox.Text))
            {
                InfoHandler.taxRate.TaxRates.Add(TaxToAddBox.Text);
            }
            if (Validator.ValidateTaxRate(TaxToDelete.Text))
            {
                InfoHandler.taxRate.TaxRates.Remove(TaxToDelete.Text);
            }

            InfoHandler.SaveDatas();
            loadDatas();
            MessageBox.Show("Sikeres mentés", "Mentve", MessageBoxButton.OK);
        }
예제 #4
0
        /// <summary>
        /// 获取消息
        /// </summary>
        /// <typeparam name="TInfo"></typeparam>
        /// <param name="handler"></param>
        /// <param name="error"></param>
        public bool GetInfo <TInfo>(Action <List <TInfo>, int, int> handler, Action <ErrorResult> error) where TInfo : IInfo
        {
            // 测试连接状态
            if (!TryConnect(error))
            {
                return(false);
            }
            // 获取信息环境准备
            var are  = new AutoResetEvent(false);
            var flag = false;
            var cmd  = Command.Create(typeof(TInfo).Name);
            var info = new InfoHandler <TInfo>(Serial)
            {
                DataHandler = handler,
                Exit        = success =>
                {
                    flag = success;
                    are.Set();
                }
            };

            // 开始获取数据
            info.BeginGetInfo(cmd.ToString(), error);
            are.WaitOne();
            return(flag);
        }
예제 #5
0
    void Awake()
    {
        awaked = false;
        info   = InfoHandler.GetInfo();
        if (info == null)
        {
            var mods = new bool[modeInfos.Length];
            mods[0] = true;
            info    = new Info(1f, 1f, 1f, 1f, 0, mods);
            InfoHandler.SetInfo(info);
        }
        if (info.mods.Length != modeInfos.Length)
        {
            var newmods = new bool[modeInfos.Length];
            for (var i = 0; i < info.mods.Length && i < modeInfos.Length; i++)
            {
                newmods[i] = info.mods[i];
            }
            info.mods = newmods;
            InfoHandler.SetInfo(info);
        }
        currentMod = info.mod;

        r.value = info.r;
        g.value = info.g;
        b.value = info.b;
        a.value = info.a;

        awaked = true;
        UpdateMod();
        UpdateColor();
    }
예제 #6
0
        public async Task <IActionResult> Register(RegisterViewModel model, string returnUrl = null)
        {
            ViewData["ReturnUrl"] = returnUrl;
            if (ModelState.IsValid)
            {
                var user = new ApplicationUser {
                    UserName = model.Email, Email = model.Email
                };
                var result = await _userManager.CreateAsync(user, model.Password);

                if (result.Succeeded)
                {
                    _logger.LogInformation("User created a new account with password.");

                    var code = await _userManager.GenerateEmailConfirmationTokenAsync(user);

                    var callbackUrl = Url.EmailConfirmationLink(user.Id, code, Request.Scheme);
                    await _emailSender.SendEmailConfirmationAsync(model.Email, callbackUrl);

                    await _signInManager.SignInAsync(user, isPersistent : false);

                    _logger.LogInformation("User created a new account with password.");
                    InfoHandler getLoginInfo = new InfoHandler(_userManager, _signInManager, _userDateTime);
                    await getLoginInfo.reg(model, returnUrl);

                    return(RedirectToLocal(returnUrl));
                }
                AddErrors(result);
            }

            // If we got this far, something failed, redisplay form
            return(View(model));
        }
예제 #7
0
        public IActionResult NewMessage(NewMassageviewmodel model)
        {
            //ViewData["Message"] = "Your contact page.";
            InfoHandler a = new InfoHandler(_userManager, _signInManager, _userDateTime);

            a.send(_userManager.GetUserId(User), model);
            return(View(model));
        }
예제 #8
0
        public IActionResult Inbox(InboxViewModel model)
        {
            InfoHandler a = new InfoHandler(_userManager, _signInManager, _userDateTime);

            a.inbox(_userManager.GetUserId(User), model);
            a.Readmsg(_userManager.GetUserId(User), model);
            a.deletedMsg(_userManager.GetUserId(User), model);
            return(View(model));
        }
예제 #9
0
        public IActionResult Index(Indexviewmodel model)
        {
            InfoHandler a = new InfoHandler(_userManager, _signInManager, _userDateTime);

            a.Totallogin(_userManager.GetUserId(User), model);
            a.Datelogin(_userManager.GetUserId(User), model);
            a.unReadmsg(_userManager.GetUserId(User), model);
            return(View(model));
        }
예제 #10
0
        public ActionResult MessageDetail(string submit2, MessageDetailviewmodel model)
        {
            HttpContext.Session.Set("msgkey", Encoding.ASCII.GetBytes(submit2));
            InfoHandler a = new InfoHandler(_userManager, _signInManager, _userDateTime);

            a.Changereadtabel(submit2, model);
            // a.msgDetails(submit, model);
            return(this.RedirectToAction("TheMessage", "Home"));
        }
예제 #11
0
        static void Main(string[] args)
        {
            //ARGUMENTS:
            //0	= UserID
            //1	= outObjectID
            //2	= SnapshotAfterSec
            //3	= ImgLActionProfile
            //4	= ImgSActionProfile
            //5	= ImgXSActionProfile
            // ENABLE FOR DEBUGGING
            //InfoHandler obj1 = new InfoHandler();
            //
            //obj1.WriteMonitoringLog("", strObjectID, "", 7, "generate image snapshot (Step 7 / 14)", _4screen.CSB.Common.MonitoringLogState.OKWithWarning, "Anzahl argumente: " + args.Length.ToString());

            if (args.Length == 6)
            {
                //Read Arguments
                strOutputPath         = ConfigurationSettings.AppSettings["ConverterLocalPathTarget"];
                strUserID             = args[0];
                strObjectID           = args[1];
                intSnapShotAfterSec   = Convert.ToInt32(args[2]) * 1000;
                strImgLActionProfile  = args[3];
                strImgSActionProfile  = args[4];
                strImgXSActionProfile = args[5];


                string[] strArchiveFile = Directory.GetFiles(ConfigurationSettings.AppSettings["ConverterRootPath"] + "\\Media\\" + strUserID + "\\" + Helper.GetMediaFolder(ObjectType.Video) + "\\a", "*" + strObjectID + ".*");
                if (strArchiveFile.Length == 1)
                {
                    strVideoFile = strArchiveFile[0];
                }

                if (File.Exists(strVideoFile))
                {
                    // set outputfiles
                    strOutputFileSnap = System.IO.Path.Combine(strOutputPath, strObjectID + "_Snap.jpg");
                    try
                    {
                        // generate the thumbnails
                        GenerateSnapshot();
                    }
                    catch (Exception ex)
                    {
                        InfoHandler obj2 = new InfoHandler();

                        obj2.WriteMonitoringLog("", strObjectID, "", 7, "generate image snapshot (Step 7 / 14)", _4screen.CSB.Common.MonitoringLogState.OKWithWarning, "System exception: " + ex.Message);
                    }
                }
                else
                {
                    InfoHandler obj3 = new InfoHandler();

                    obj3.WriteMonitoringLog("", strObjectID, "", 7, "generate image snapshot (Step 7 / 14)", _4screen.CSB.Common.MonitoringLogState.OKWithWarning, "input FLV file not found: " + strVideoFile);
                }
            }
        }
예제 #12
0
        public ActionResult MessageDetail(MessageDetailviewmodel model)
        {
            byte[] bite;
            HttpContext.Session.TryGetValue("key", out bite);
            string      someString = Encoding.ASCII.GetString(bite);
            InfoHandler a          = new InfoHandler(_userManager, _signInManager, _userDateTime);

            a.msgDetails(someString, model);
            return(View(model));
        }
예제 #13
0
        public ActionResult TheMessage()
        {
            byte[] bite;
            HttpContext.Session.TryGetValue("msgkey", out bite);
            string      someString = Encoding.ASCII.GetString(bite);
            InfoHandler a          = new InfoHandler(_userManager, _signInManager, _userDateTime);

            a.Changedeletedtabel(someString);
            return(View());
        }
예제 #14
0
        public static void UseInfoActuator(IConfiguration configuration, IEnumerable <IInfoContributor> contributors = null, ILoggerFactory loggerFactory = null)
        {
            var options = new InfoOptions(configuration);

            contributors = contributors ?? new List <IInfoContributor>()
            {
                new GitInfoContributor(), new AppSettingsInfoContributor(configuration)
            };
            var ep      = new InfoEndpoint(options, contributors, CreateLogger <InfoEndpoint>(loggerFactory));
            var handler = new InfoHandler(ep, SecurityService, CreateLogger <InfoHandler>(loggerFactory));

            ConfiguredHandlers.Add(handler);
        }
예제 #15
0
 public ActionResult Inbox(String submit, MessageDetailviewmodel model)
 {
     HttpContext.Session.Set("key", Encoding.ASCII.GetBytes(submit));
     if (submit != null)
     {
         InfoHandler a = new InfoHandler(_userManager, _signInManager, _userDateTime);
         a.msgDetails(submit, model);
         return(this.RedirectToAction("MessageDetail", "Home"));
     }
     else
     {
         return(View());
     }
 }
예제 #16
0
        public async Task <IActionResult> Login(LoginViewModel model, string returnUrl = null)
        {
            ViewData["ReturnUrl"] = returnUrl;
            if (ModelState.IsValid)
            {
                InfoHandler getLoginInfo = new InfoHandler(_userManager, _signInManager, _userDateTime);
                await getLoginInfo.Login(model, returnUrl);

                return(RedirectToLocal(returnUrl));
            }

            // If we got this far, something failed, redisplay form
            return(View(model));
        }
예제 #17
0
    private void Awake()
    {
        info = InfoHandler.GetInfo();
        if (info == null)
        {
            r         = 1f; g = 1f;
            b         = 1f; a = 1f;
            chosenMod = 0;
        }
        else
        {
            r         = info.r;
            g         = info.g;
            b         = info.b;
            a         = info.a;
            chosenMod = info.mod;
        }

        spriteRenderer       = GetComponent <SpriteRenderer>();
        spriteRenderer.color = new Color(r, g, b, a);
        switch (chosenMod)
        {
        case 0:
            ultraScript = gameObject.AddComponent <DefaultUltra>();
            break;

        case 1:
            ultraScript = gameObject.AddComponent <FirstAidKit>();
            break;

        case 2:
            ultraScript = gameObject.AddComponent <Impulse>();
            break;

        case 3:
            ultraScript = gameObject.AddComponent <turretSpawner>();
            break;

        case 4:
            ultraScript = gameObject.AddComponent <Stealth>();
            break;

        case 5:
            ultraScript = gameObject.AddComponent <Support>();
            break;
        }

        ultraScript.button = GameObject.Find("Ultra");
    }
예제 #18
0
    public void updatePlayersInfo()
    {
        var players = manager.getPlayers();

        for (int i = 0; i < players.Count; i++)
        {
            InfoHandler infoHandler = playerObjects[i].GetComponent <InfoHandler>();

            if (infoHandler.getPlayer().id == players[i].id)
            {
                infoHandler.setReady(manager.isReady());
                infoHandler.setPlayer(players[i]);
                infoHandler.setTurn(manager.getTurnIndex());
            }
        }
    }
예제 #19
0
    void populatePlayers()
    {
        foreach (var player in manager.getPlayers())
        {
            var playerObject = Instantiate(playerPrefab,
                                           new Vector2(), Quaternion.identity);
            playerObject.transform.SetParent(playerGrid.transform, false);
            playerObject.transform.localScale = Vector3.one;

            InfoHandler infoHandler = playerObject.GetComponent <InfoHandler>();
            infoHandler.setPlayer(player);
            infoHandler.setTurn(manager.getTurnIndex());

            playerObjects.Add(playerObject);
        }
    }
예제 #20
0
 /// <summary>
 /// Attempt a connection.
 /// </summary>
 /// <returns>True if successful, false otherwise</returns>
 /// <remarks>If it fail, check the LastConnectError property to see the details of the failure.</remarks>
 public bool Connect()
 {
     try {
         if (Disposed)
         {
             RestartSocket();
         }
         Client.Connect(ServerAddress, Port);
         LastConnectError               = null;
         InfoHandler.EnableSsl          = SSLTargetHost != null;
         InfoHandler.SSLTargetHost      = SSLTargetHost;
         InfoHandler.IsLengthInOneFrame = IsLengthInOneFrame;
         InfoHandler.StartReceive();
         return(true);
     } catch (Exception e) {
         LastConnectError = e;
         return(false);
     }
 }
예제 #21
0
        /// <summary>
        /// 获取文件列表
        /// </summary>
        /// <param name="dir"></param>
        /// <param name="progress"></param>
        /// <param name="error"></param>
        /// <returns></returns>
        public List <AnFile> GetFileList(string dir, Action <int, int> progress, Action <ErrorResult> error)
        {
            // 获取AnFile列表
            var are   = new AutoResetEvent(false);
            var files = new List <AnFile>();

            // 测试连接状态
            if (!TryConnect(error))
            {
                return(null);
            }
            // 获取信息
            var cmd  = Command.Create(typeof(AnFile).Name);
            var info = new InfoHandler <AnFile>(Serial)
            {
                DataHandler = (infos, current, total) =>
                {
                    files.AddRange(infos);
                    progress?.Invoke(current, total);
                },
                // 处理退出事件
                Exit = success => { are.Set(); }
            };

            info.BeginGetInfo(cmd.ToString(), error);
            are.WaitOne();
            if (files.Count == 0)
            {
                return(null);
            }
            // 解析Anfile
            var root = new List <AnFile>();

            foreach (var file in files.FindAll(file => file.IsRoot))
            {
                root.Add(file);
                AnFile.Prepare(file, files);
            }
            return(root);
        }
예제 #22
0
        /// <summary>
        /// Attempt a connection.
        /// </summary>
        /// <returns>True if successful, false otherwise</returns>
        /// <remarks>If it fail, check the LastConnectError property to see the details of the failure.</remarks>
        public async Task <bool> ConnectAsync()
        {
            Task task = null;

            try {
                if (Disposed)
                {
                    RestartSocket();
                }
                task = Client.ConnectAsync(ServerAddress, Port);
                await task;
                LastConnectError               = null;
                InfoHandler.EnableSsl          = SSLTargetHost != null;
                InfoHandler.SSLTargetHost      = SSLTargetHost;
                InfoHandler.IsLengthInOneFrame = IsLengthInOneFrame;
                InfoHandler.StartReceive();
                return(true);
            } catch {
                LastConnectError = task != null ? task.Exception : null;
                return(false);
            }
        }
예제 #23
0
    // Start is called before the first frame update
    void Awake()
    {
        Debug.Log(transform.position);

        target   = transform.position;
        target.y = transform.position.y + Screen.height / 13;
        og       = transform.position;

        first   = transform.position;
        first.y = transform.position.y - 150 - delay;

        transform.position = first;

        infoInstance = transform.parent.Find("Info").GetComponent <InfoHandler>();
        infoGO       = transform.parent.Find("Info").gameObject;

        GameObject temp = transform.parent.Find("Seal").gameObject;

        seal = new Vector3(temp.transform.position.x, temp.transform.position.y, transform.position.z);

        speed1 = Vector3.Distance(target, og) / speed1;
        speed2 = Vector3.Distance(target, og) / speed2;
        speed3 = Vector3.Distance(og, seal) / speed3;
    }
예제 #24
0
 /// <summary>
 /// Send a whole file, given a prebuffer and a postbuffer, and if the 8 bytes length is sent before the real message.
 /// </summary>
 /// <param name="filepath">The path to the file</param>
 /// <param name="preBuffer">A prefixed buffer</param>
 /// <param name="postBuffer">A suffixed buffer</param>
 /// <param name="withLengthPrefixed">if the 4 bytes length is sent before the real message</param>
 /// <param name="preBufferIsBeforeLength">Weither the prebuffer is placed before the length prefix (if applicable)</param>
 /// <returns>A Task</returns>
 /// <remarks>If withLengthPrefixed is true, it's important for the receiving end to know that he is receiving a longer a 8 bytes length prefix. For the receiving end and within this class, you can set 'InfoHandler.ReadNextAsLong' to true to do so.</remarks>
 public async Task SendFileAsync(string filepath, byte[] preBuffer = null, byte[] postBuffer = null, bool withLengthPrefixed = true, bool preBufferIsBeforeLength = false)
 {
     await InfoHandler.SendFileAsync(filepath, preBuffer, postBuffer, withLengthPrefixed, preBufferIsBeforeLength);
 }
예제 #25
0
 public void SetChagnes()
 {
     InfoHandler.SetInfo(info);
 }
예제 #26
0
 public static void OnLogInfo(string message)
 {
     InfoHandler.Invoke(message);
 }
예제 #27
0
    static int Main(string[] args)
    {
        if (args.Length < 1)
        {
            Console.WriteLine("usage logging.exe mw-id=<middleware ID>");
            return(-1);
        }

        //o Load the command-line input into a GMSEC Config object
        // A Config object is basically a key-value pair map which is used to
        // pass configuration options into objects such as Connections,
        // ConnectionManagers, Subscribe and Publish function calls, Messages,
        // etc.
        Config config = new Config(args);

        ErrorHandler   errorHandler   = new ErrorHandler();
        WarningHandler warningHandler = new WarningHandler();
        InfoHandler    infoHandler    = new InfoHandler();
        VerboseHandler verboseHandler = new VerboseHandler();
        DebugHandler   debugHandler   = new DebugHandler();
        AnyHandler     anyHandler     = new AnyHandler();

        Log.RegisterHandler(LoggingLevel.ERROR, errorHandler);
        Log.RegisterHandler(LoggingLevel.WARNING, warningHandler);
        Log.RegisterHandler(LoggingLevel.INFO, infoHandler);
        Log.RegisterHandler(LoggingLevel.VERBOSE, verboseHandler);
        Log.RegisterHandler(LoggingLevel.DEBUG, debugHandler);

        //o Set logging reporting level
        Log.SetReportingLevel(LoggingLevel.VERBOSE);
        Log.Verbose("The log reporting level is now set to: " + Log.GetReportingLevel());

        //o Print the GMSEC API version number using the GMSEC Logging
        // interface
        // This is useful for determining which version of the API is
        // configured within the environment
        // TODO: Once available, replace this statement with usage of
        // ConnectionManager::getAPIVersion (See RTC 4798)
        Log.Info(Connection.GetAPIVersion());

        try
        {
            //o Create the ConnectionManager
            ConnectionManager connMgr = new ConnectionManager(config);

            //o Connect
            Log.Info("Opening the connection to the middleware server");
            connMgr.Initialize();

            //o Output middleware client/wrapper version
            Log.Info(connMgr.GetLibraryVersion());

            //o Publish a message
            PublishTestMessage(connMgr, "GMSEC.TEST.PUBLISH");

            //o Disconnect from the middleware and clean up the Connection
            connMgr.Cleanup();
        }
        catch (Exception e)
        {
            Log.Error(e.ToString());
            return(-1);
        }

        //o Unregister log handlers
        Log.RegisterHandler(null);

        //o Set log stream to stderr
        config.AddValue("LOGFILE", "STDERR");

        Log.Info("This message should go to stderr, not stdout.  " +
                 "For example, in bash test by running as:\n" +
                 "./logging mw-id=bolt 2> testfile.txt\n" +
                 "... and then check the contents of testfile.txt");

        //o Reset log stream to stdout
        config.AddValue("LOGFILE", "STDOUT");

        Log.Error("This is an example error message.");
        Log.Warning("This is an example warning message.");
        Log.Verbose("This is an example \"verbose\" message.");
        Log.Debug("This is an example debug message which should not show.");

        // This last message cannot be shown right now because
        // Log::setReportingLevel(logVERBOSE), used above, does not
        // allow DEBUG messages to come out.
        Log.Verbose("This is another example \"verbose\" message.");

        Log.SetReportingLevel(LoggingLevel.DEBUG);
        if (Log.GetReportingLevel() == LoggingLevel.DEBUG)
        {
            Log.Info("Changed reporting level to logDEBUG");
        }
        else
        {
            Log.Error("Failed to change reporting level to logDEBUG");
        }

        // The DEBUG message below will be shown successfully, unlike the last
        // debug message.
        Log.Debug("This is an example debug message which should show.");

        Log.Debug("NONE reporting level, numerically, is " + Log.LevelFromString("NONE"));
        Log.Debug("ERROR reporting level, numerically, is " + Log.LevelFromString("ERROR"));
        Log.Debug("SECURE reporting level, numerically, is " + Log.LevelFromString("SECURE"));
        Log.Debug("WARNING reporting level, numerically, is " + Log.LevelFromString("WARNING"));
        Log.Debug("INFO reporting level, numerically, is " + Log.LevelFromString("INFO"));
        Log.Debug("VERBOSE reporting level, numerically, is " + Log.LevelFromString("VERBOSE"));
        Log.Debug("DEBUG reporting level, numerically, is " + Log.LevelFromString("DEBUG"));

        //o Register general-purpose handler and test
        Log.RegisterHandler(anyHandler);

        Log.Error("NONE reporting level, numerically, is " + Log.LevelFromString("NONE"));
        Log.Error("ERROR reporting level, numerically, is " + Log.LevelFromString("ERROR"));
        Log.Warning("WARNING reporting level, numerically, is " + Log.LevelFromString("WARNING"));
        Log.Info("INFO reporting level, numerically, is " + Log.LevelFromString("INFO"));
        Log.Verbose("VERBOSE reporting level, numerically, is " + Log.LevelFromString("VERBOSE"));
        Log.Debug("DEBUG reporting level, numerically, is " + Log.LevelFromString("DEBUG"));

        //o Unregister log handlers
        Log.RegisterHandler(null);

        return(0);
    }
예제 #28
0
 public static void Info(string message) => InfoHandler?.Invoke(message);
예제 #29
0
 /// <summary>
 /// Send a whole file, given a prebuffer and a postbuffer, and if the 8 bytes length is sent before the real message.
 /// </summary>
 /// <param name="filepath">The path to the file</param>
 /// <param name="preBuffer">A prefixed buffer</param>
 /// <param name="postBuffer">A suffixed buffer</param>
 /// <param name="withLengthPrefixed">if the 4 bytes length is sent before the real message</param>
 /// <param name="preBufferIsBeforeLength">Weither the prebuffer is placed before the length prefix (if applicable)</param>
 /// <remarks>If withLengthPrefixed is true, it's important for the receiving end to know that he is receiving a longer a 8 bytes length prefix. For the receiving end and within this class, you can set 'InfoHandler.ReadNextAsLong' to true to do so.</remarks>
 public void SendFile(string filepath, byte[] preBuffer = null, byte[] postBuffer = null, bool withLengthPrefixed = true, bool preBufferIsBeforeLength = false)
 {
     InfoHandler.SendFile(filepath, preBuffer, postBuffer, withLengthPrefixed, preBufferIsBeforeLength);
 }
예제 #30
0
 void ILogger.Info(string message) => InfoHandler?.Invoke(message);