/// <summary>
        /// Constructs the Freshbooks API authentication and wrapper class
        /// </summary>
        /// <param name="accountName">The account name for which you are trying to access</param>
        /// <param name="consumerKey">The developer's freshbooks account name</param>
        /// <param name="oauthSecret">The developer's oauth-secret provided by freshbooks</param>
        public FreshbooksApi(string accountName, string consumerKey, string oauthSecret)
        {
            _accountName = accountName;
            _consumerKey = consumerKey;
            _oauthSecret = oauthSecret ?? String.Empty;

            _baseUri = new UriBuilder { Scheme = "https", Host = accountName + ".freshbooks.com" }.Uri;
            _serviceUri = new Uri(_baseUri, "/api/2.1/xml-in");
            Clear();

            UserAgent = String.Format("{0}/{1} ({2})", 
                GetType().Name,
                GetType().Assembly.GetName().Version.ToString(2), 
                GetType().Assembly.FullName);

            Callback = new CallbackService(new ServiceProxy(this, "callback"));
            Category = new CategoryService(new ServiceProxy(this, "category"));
            Client = new ClientService(new ServiceProxy(this, "client"));
            Estimate = new EstimateService(new ServiceProxy(this, "estimate"));
            Expense = new ExpenseService(new ServiceProxy(this, "expense"));
            Gateway = new GatewayService(new ServiceProxy(this, "gateway"));
            Invoice = new InvoiceService(new ServiceProxy(this, "invoice"));
            Item = new ItemService(new ServiceProxy(this, "item"));
            Language = new LanguageService(new ServiceProxy(this, "language"));
            Payment = new PaymentService(new ServiceProxy(this, "payment"));
            Project = new ProjectService(new ServiceProxy(this, "project"));
            Recurring = new RecurringService(new ServiceProxy(this, "recurring"));
            System = new SystemService(new ServiceProxy(this, "system"));
            Staff = new StaffService(new ServiceProxy(this, "staff"));
            Task = new TaskService(new ServiceProxy(this, "task"));
            Tax = new TaxService(new ServiceProxy(this, "tax"));
            TimeEntry = new TimeEntryService(new ServiceProxy(this, "time_entry"));
        }
Пример #2
0
		public SystemService Build(IProcessorArchitecture arch)
		{
			SystemService svc = new SystemService();
			svc.Name = Name;
			svc.SyscallInfo = new SyscallInfo();
			svc.SyscallInfo.Vector = Convert.ToInt32(SyscallInfo.Vector, 16);
			if (SyscallInfo.RegisterValues != null)
			{
				svc.SyscallInfo.RegisterValues = new RegValue[SyscallInfo.RegisterValues.Length];
				for (int i = 0; i < SyscallInfo.RegisterValues.Length; ++i)
				{
                    svc.SyscallInfo.RegisterValues[i] = new RegValue
                    {
                        Register = arch.GetRegister(SyscallInfo.RegisterValues[i].Register),
                        Value = Convert.ToInt32(SyscallInfo.RegisterValues[i].Value, 16),
                    };
				}
			}
			else
			{
				svc.SyscallInfo.RegisterValues = new RegValue[0];
			}
            TypeLibraryLoader loader = new TypeLibraryLoader(arch, true);
			ProcedureSerializer sser = arch.CreateProcedureSerializer(loader, "stdapi");
            svc.Signature = sser.Deserialize(Signature, arch.CreateFrame());
			svc.Characteristics = Characteristics != null ? Characteristics : DefaultProcedureCharacteristics.Instance;
			return svc;
		}
Пример #3
0
        //$TODO: http://www.delorie.com/djgpp/doc/rbinter/ix/29.html int 29 for console apps!
        //$TODO: http://msdn.microsoft.com/en-us/data/dn774154(v=vs.99).aspx

		public Win32Platform(IServiceProvider services, IProcessorArchitecture arch) : base(services, arch)
		{
            int3svc = new SystemService
            {
                SyscallInfo = new SyscallInfo
                {
                    Vector = 3,
                    RegisterValues = new RegValue[0],
                },
                Name = "int3",
                Signature = new ProcedureSignature(null, new Identifier[0]),
                Characteristics = new ProcedureCharacteristics(),
            };
            var frame = arch.CreateFrame();
            int29svc = new SystemService
            {
                SyscallInfo = new SyscallInfo
                {
                    Vector = 0x29,
                    RegisterValues = new RegValue[0]
                },
                Name = "__fastfail",
                Signature = new ProcedureSignature(
                    null,
                    frame.EnsureRegister(Registers.ecx)), //$bug what about win64?
                Characteristics = new ProcedureCharacteristics
                {
                    Terminates = true
                }
            };
        }
Пример #4
0
        public Win_x86_64_Platform(IServiceProvider sp, IProcessorArchitecture arch)
            : base(sp, arch)
        {
            int3svc = new SystemService
            {
                SyscallInfo = new SyscallInfo
                {
                    Vector = 3,
                    RegisterValues = new RegValue[0],
                },
                Name = "int3",
                Signature = new ProcedureSignature(null, new Identifier[0]),
                Characteristics = new ProcedureCharacteristics(),
            };

        }
Пример #5
0
        //private static ILogService datalog = new LogService();


        /// <summary>
        /// 会员快速查询
        /// </summary>
        /// <param name="req"></param>
        /// <returns></returns>
        public static dt_Dyn_DispMemQuick_res DispMemQuick(dt_Dyn_DispMemQuick_req req)
        {
            DateTime      timeStart = DateTime.Now;
            SystemService _set      = new SystemService();

            try
            {
                HmjNew.Service.si_Dyn_DispMemQuick_obService s2 = new HmjNew.Service.si_Dyn_DispMemQuick_obService();

                string reqStr = js.Serialize(req);

                //logger.Info("会员信息快速查询si_Dyn_DispMemQuick_ob请求信息"+ timeStart + ":" + reqStr);

                _set.AddLog(new SPACRM.Entity.WXLOG()
                {
                    CON  = "会员信息快速查询si_Dyn_DispMemQuick_ob请求信息" + timeStart + ":" + reqStr,
                    TIME = DateTime.Now
                });
                dt_Dyn_DispMemQuick_res dt2 = s2.si_Dyn_DispMemQuick_ob(req);
                string   resStr             = js.Serialize(dt2);
                DateTime timeEnd            = DateTime.Now;

                _set.AddLog(new SPACRM.Entity.WXLOG()
                {
                    CON  = "会员信息快速查询响应信息" + timeStart + ":" + resStr + "\r\n",
                    TIME = DateTime.Now
                });

                //datalog.DataInfo(reqStr, resStr, timeStart, timeEnd, 0, "si_Dyn_DispMemQuick_ob", "会员信息快速查询");
                return(dt2);
            }
            catch (Exception ex)
            {
                _set.AddLog(new SPACRM.Entity.WXLOG()
                {
                    CON  = "会员信息快速查询响应信息" + timeStart + ":" + ex.Message + "\r\n",
                    TIME = DateTime.Now
                });
                throw new Exception(ex.Message);
            }
        }
Пример #6
0
        private SystemService ReadImpdef(LeImageReader rdr, TypeLibraryDeserializer loader)
        {
            if (!rdr.TryReadByte(out byte useOrdinal))
            {
                return(null);
            }
            var internalName = ReadString(rdr);

            if (internalName == null)
            {
                return(null);
            }
            var moduleName = ReadString(rdr);

            if (moduleName == null)
            {
                return(null);
            }
            if (useOrdinal != 0)
            {
                if (!rdr.TryReadLeInt16(out var ordinal))
                {
                    return(null);
                }
                var svc = new SystemService
                {
                    ModuleName  = moduleName,
                    Name        = internalName,
                    SyscallInfo = new SyscallInfo
                    {
                        Vector = ordinal
                    }
                };
                loader.LoadService(ordinal, svc);
                return(svc);
            }
            else
            {
                throw new NotImplementedException("non-ordinals");
            }
        }
Пример #7
0
    private IEnumerator _CheckMaintenance()
    {
        WWW   checkRequest = SystemService.CheckMaintenance();
        float timeLoading  = 0f;

        while (!checkRequest.isDone)
        {
            yield return(new WaitForSeconds(0.1f));
        }

        if (timeLoading < 3.0f)
        {
            float remainingTime = 3.0f - timeLoading;
            yield return(new WaitForSeconds(remainingTime));
        }

        Debug.Log("Header: " + checkRequest.responseHeaders["STATUS"]);
        Debug.Log("Text: " + checkRequest.text);

        if (checkRequest.responseHeaders["STATUS"] == HTML.HTTP_200)
        {
            if (checkRequest.text == IN_MAINTENANCE)
            {
                loadingHolder.SetActive(false);
                AlertsService.makeAlert("EM MANUTENÇÃO", "O Minha Árvore está em manutenção no momento. Por favor, tente novamente mais tarde.", "Entendi");
                reloadButton.gameObject.SetActive(true);
            }
            else
            {
                LoadView("Login");
            }
        }
        else
        {
            loadingHolder.SetActive(false);
            AlertsService.makeAlert("FALHA NA CONEXÃO", "Houve uma falha na conexão com o Minha Árvore. Por favor, tente novamente mais tarde.", "OK");
            reloadButton.gameObject.SetActive(true);
        }

        yield return(null);
    }
Пример #8
0
        public ActionResult Index()
        {
            string cityId   = this.GetCookieValue("cityid");
            string serverId = this.GetCookieValue("serverid");
            string systemId = this.GetCookieValue("systemid");

            if (!cityId.Equals(string.Empty) && !serverId.Equals(string.Empty) && !systemId.Equals(string.Empty))
            {
                ViewBag.CityName   = CityService.GetCityByCityID(cityId).ToString();
                ViewBag.ServerName = ServerService.GetServerById(serverId).ToString();
                ViewBag.SystemName = SystemService.GetSystemById(systemId).ToString();
            }
            else
            {
                this.RemoveCookie(cityId);
                this.RemoveCookie(serverId);
                this.RemoveCookie(systemId);
                FormsService.SignOut();
            }
            return(View());
        }
Пример #9
0
        public ViewMassMove(SystemService service, LogicalMotionComponent component)
        {
            Service         = service;
            MotionComponent = component;

            // create user controls of Axis4MassMove
            AxisControlCollection = new List <UserControls.Axis4MassMove>();
            for (int i = 0; i < component.LogicalAxisCollection.Count; i++)
            {
                var logicalaxis = component.LogicalAxisCollection[i];

                AxisControlCollection.Add(new UserControls.Axis4MassMove()
                {
                    TotalAxes   = component.LogicalAxisCollection.Count,
                    AxisName    = logicalaxis.AxisName,
                    Position    = logicalaxis.PhysicalAxisInst.UnitHelper.RelPosition,
                    IsAbsMode   = logicalaxis.PhysicalAxisInst.IsAbsMode,
                    LogicalAxis = logicalaxis
                });
            }
        }
Пример #10
0
        public void Should_Be_OK_When_Post()
        {
            var fakeContext = new FakeContext();

            fakeContext.FillWith <SystemModel>();

            using (ApplicationDbContext dbContext = new ApplicationDbContext(fakeContext.FakeOptions)) {
                var service    = new SystemService(dbContext);
                var controller = new SystemController(service);
                var form       = new SystemModel()
                {
                    Name = "testxtg",
                };
                var result   = controller.Post(form);
                var expected = service.Get(s => s.Name == form.Name).FirstOrDefault();
                Assert.IsType <CreatedResult>(result.Result);
                result = (result.Result as CreatedResult).Value as SystemModel;
                result.Value.Should().NotBeNull();
                result.Value.Should().BeEquivalentTo(expected);
            }
        }
Пример #11
0
 public JsonResult SMSVerificationCode(string phone, string captcha)
 {
     if (string.IsNullOrEmpty(phone) || string.IsNullOrEmpty(captcha))
     {
         return(Json(new { Status = "error", Msg = "手机号或者验证码不能为空!" }));
     }
     if (!CheckerHelper.IsMobile(phone))
     {
         return(Json(new { Status = "error", Msg = "输入的手机号不正确!" }));
     }
     if (!BConfigs.SimulateSendVCode && Session[CAPTCHA] != null && Session[CAPTCHA].ToString().ToUpper() != captcha.ToUpper())
     {
         return(Json(new { Status = "error", Msg = "验证码不正确!" }));
     }
     if (!UserBackendService.IsExist(phone))
     {
         return(Json(new { Status = "error", Msg = "您不是我们的成员,请联系后台管理员注册!" }));
     }
     SystemService.SendVerificationCode(phone, 120);
     return(Json(new { Status = "success", Msg = "短信已发送成功!" }));
 }
Пример #12
0
        public object Login(HttpContext context)
        {
            ExecuteBcfMethodResult result = new ExecuteBcfMethodResult();

            string data = context.Request["data"];
            MDictionary <string, string> dic = new MDictionary <string, string>();

            if (!string.IsNullOrEmpty(data))
            {
                dic = JsonConvert.DeserializeObject <MDictionary <string, string> >(data);
            }

            string userId    = dic["userId"];
            string password  = dic["password"];
            bool   quitOther = false;

            SystemService service = new SystemService();

            result.Result = service.Login1(userId, password, quitOther);
            return(result);
        }
Пример #13
0
        public ActionResult GetOpenid(int id)
        {
            JsonSMsg rMsg   = new JsonSMsg();
            string   openid = "1111";
            //获取openid
            AR_QR_FANS ar = SystemService.QueryArInfo(id);

            if (ar != null)
            {
                openid       = ar.OPENID;
                rMsg.Status  = 1;
                rMsg.Message = "成功";
                rMsg.Data    = openid;
            }
            else
            {
                rMsg.Status  = 0;
                rMsg.Message = "失败";
            }
            return(Json(rMsg));
        }
Пример #14
0
        public void Before()
        {
            if (GameService.testable)
            {
                gs = new GameService();
            }
            else
            {
                gs = new GameServiceStub();
            }
            us = new SystemService();
            gc = new GameCenterService();

            userName = "******";
            Password = "******";
            us.register(userName, Password);
            us.login(userName, Password);
            GamePreferences pref = new GamePreferences(8, 2, 5, 10, 1, 2, 3, true);

            gameID = gc.createGame(pref, userName).getID();
        }
Пример #15
0
        static void Main(string[] args)
        {
            var service = new SystemService();

            service.SetDataByDefault();    //准备数据

            /*
             * 实现学生成绩的插入、
             * 通过名字查询
             * 显示总成绩排名列表
             */
            //输入输出
            Console.WriteLine("请选择你的操作:");
            Console.WriteLine("1.学生添加学生");
            Console.WriteLine("2.通过名字查询");
            Console.WriteLine("3.添加User");

            switch (Console.ReadLine())
            {
            case "1":
                var student = UIGetStudent();
                service.AddStudent(student);
                break;

            case "2": break;

            case "3":
                var user = UIGetUser();
                service.AddUser(user);
                break;

            default: break;
            }

            //service.ShowStudentInformations(100, new ConsoleOutput());
            service.ShowStudentInformations(100, new ConsoleOutput());

            //var stu = service.QueryStudent(101);
            //service.SortByScore();
        }
Пример #16
0
        //$TODO: http://www.delorie.com/djgpp/doc/rbinter/ix/29.html int 29 for console apps!
        //$TODO: http://msdn.microsoft.com/en-us/data/dn774154(v=vs.99).aspx

        public Win32Platform(IServiceProvider services, IProcessorArchitecture arch) : base(services, arch)
        {
            //$REVIEW: should probably be loaded from configuration.
            Heuristics.ProcedurePrologs = new BytePattern[] {
                new BytePattern
                {
                    Bytes = new byte[] { 0x55, 0x8B, 0xEC },
                    Mask  = new byte[] { 0xFF, 0xFF, 0xFF }
                }
            };
            int3svc = new SystemService
            {
                SyscallInfo = new SyscallInfo
                {
                    Vector         = 3,
                    RegisterValues = new RegValue[0],
                },
                Name            = "int3",
                Signature       = new ProcedureSignature(null, new Identifier[0]),
                Characteristics = new ProcedureCharacteristics(),
            };
            var frame = arch.CreateFrame();

            int29svc = new SystemService
            {
                SyscallInfo = new SyscallInfo
                {
                    Vector         = 0x29,
                    RegisterValues = new RegValue[0]
                },
                Name      = "__fastfail",
                Signature = new ProcedureSignature(
                    null,
                    frame.EnsureRegister(Registers.ecx)), //$bug what about win64?
                Characteristics = new ProcedureCharacteristics
                {
                    Terminates = true
                }
            };
        }
        public void TestGetChages()
        {
            var changes = SystemService.GetChages();

            Assert.IsTrue(changes.Any());

            var firstOrDefault = changes.FirstOrDefault();

            Assert.IsTrue(firstOrDefault != null && !string.IsNullOrEmpty(firstOrDefault.Type.ToString().Trim()));

            var changesTypes = new[]
            {
                ChangeType.GetFreeCapacity,
                ChangeType.GetGuestReview,
                ChangeType.GetMessages
            };

            changes = SystemService.GetChages(changesTypes);

            Assert.IsTrue(changes.Any());


            foreach (var change in changes)
            {
                Assert.IsTrue(change.Type == ChangeType.GetFreeCapacity || change.Type == ChangeType.GetGuestReview ||
                              change.Type == ChangeType.GetMessages);
            }

            changesTypes = new[]
            {
                ChangeType.GetFreeCapacity
            };

            changes = SystemService.GetChages(changesTypes);

            foreach (var change in changes)
            {
                Assert.IsTrue(change.Type == ChangeType.GetFreeCapacity);
            }
        }
Пример #18
0
        protected void ProcessData(object sender, DirectEventArgs e)
        {
            try
            {
                AttendanceImportingService service = null;
                service = new AttendanceImportingService(new CSVImporter(CurrentPath.Text), _employeeService);
                List <AttendanceShift> shifts = service.ImportUnvalidated(CurrentPath.Text);

                File.Delete(CurrentPath.Text);
                if (shifts.Count == 0)
                {
                    throw new Exception();
                }



                DictionarySessionStorage storage = new DictionarySessionStorage();
                storage.Save("AccountId", _systemService.SessionHelper.Get("AccountId"));
                storage.Save("UserId", _systemService.SessionHelper.Get("UserId"));
                storage.Save("key", _systemService.SessionHelper.Get("Key"));
                SessionHelper         h        = new SessionHelper(storage, new APIKeyBasedTokenGenerator());
                EmployeeService       emp      = new EmployeeService(new EmployeeRepository(), h);
                TimeAttendanceService _timeAtt = new TimeAttendanceService(h, new TimeAttendanceRepository());
                SystemService         _system  = new SystemService(new SystemRepository(), h);
                AttendanceBatchRunner runner   = new AttendanceBatchRunner(storage, _timeAtt, _system, emp)
                {
                    Items = shifts, OutputPath = MapPath("~/Imports/" + _systemService.SessionHelper.Get("AccountId") + "/")
                };
                runner.Process();
                this.ResourceManager1.AddScript("{0}.startTask('longactionprogress');", this.TaskManager1.ClientID);
            }
            catch
            {
                X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorOperation).Show();
                this.ResourceManager1.AddScript("{0}.stopTask('longactionprogress');", this.TaskManager1.ClientID);
                Viewport1.ActiveIndex = 0;
            }
        }
Пример #19
0
        public ActionResult GetSystemLog(int index, int pageNo, int pageSize, string search, int section, int severity,
                                         string dateFrom, string dateTo, int tz)
        {
            if (dateFrom.Trim().Length <= 10)
            {
                dateFrom = dateFrom.Trim() + " 00:00:00";
            }
            if (dateTo.Trim().Length <= 10)
            {
                dateTo = dateTo.Trim() + " 23:59:59";
            }

            return(Json(SystemService.FindLogListModel(index,
                                                       pageNo,
                                                       pageSize,
                                                       search,
                                                       section,
                                                       severity,
                                                       dateFrom.ParseDateTime(CurrentUser.DateFormat + " HH:mm:ss", tz),   //dtFromO,
                                                       dateTo.ParseDateTime(CurrentUser.DateFormat + " HH:mm:ss", tz)),    //dtToO),
                        JsonRequestBehavior.AllowGet));
        }
Пример #20
0
        private void InitOptionItems()
        {
            if (string.IsNullOrEmpty(_state.SavePath))
            {
                _state.SavePath = Path.GetDirectoryName(Path.GetTempFileName());
            }

            _options = new List <MenuItem>();
            _options.AddRange(new[]
            {
                new MenuItem("Start at login", this.OnSelectStartup)
                {
                    Checked = SystemService.IsEnabledAtStartup()
                },
                new MenuItem(_state.SavePath, OnSelectSavePath),
                new MenuItem("-")
                {
                    Enabled = false
                },
                new MenuItem("Quit Wallcat", (sender, args) => Application.Exit())
            });
        }
Пример #21
0
        public UC_ScriptEditer()
        {
            InitializeComponent();
            SetScintillaToCurrentOptions(TextArea);
            StrFilePath = "";
            Messenger.Default.Register <string>(this, "ScriptStart", m => {
                {
                    //Task task = new Task(new Action(StartScript));
                    //task.Start();
                    //May be a bug ,I don't know why now,must reset the debughook everytime.


                    SystemService service = SimpleIoc.Default.GetInstance <SystemService>();
                    if (service.ScriptState == ScriptState.PAUSE)
                    {
                        service.Resume();
                    }
                    else
                    {
                        lua.lua.DebugHook -= Lua_DebugHook;
                        lua.lua.DebugHook += Lua_DebugHook;

                        if (ScriptThread == null || ScriptThread.ThreadState != ThreadState.Running)
                        {
                            ScriptThread = new Thread(new ThreadStart(StartScript));
                            ScriptThread.Start();
                        }
                    }
                }
            });
            Messenger.Default.Register <string>(this, "ScriptStop", m => {
                {
                    if (ScriptThread != null)
                    {
                        ScriptThread.Abort();
                    }
                }
            });
        }
Пример #22
0
        public Tuple <int?, SystemService> ParseLine()
        {
            try
            {
                int?ordinal = ParseOrdinal();

                string callconv = ParseCallingConvention();

                var options = ParseOptions();

                var    tok    = Get();
                string fnName = tok.Value;
                var    ssig   = new SerializedSignature
                {
                    Convention = callconv,
                };
                ssig.Arguments = ParseParameters(ssig);
                SkipToEndOfLine();

                var deser = new ProcedureSerializer(platform, tlLoader, ssig.Convention);
                var sig   = deser.Deserialize(ssig, new Frame(platform.FramePointerType));
                var svc   = new SystemService
                {
                    ModuleName = moduleName.ToUpper(),
                    Name       = fnName,
                    Signature  = sig
                };
                return(Tuple.Create(ordinal, svc));
            }
            catch
            {
                Services.RequireService <DecompilerEventListener>().Warn(
                    new NullCodeLocation(moduleName),
                    "Line {0} in the Wine spec file could not be read; skipping.",
                    lexer.lineNumber);
                SkipToEndOfLine();
                return(null);
            }
        }
Пример #23
0
        public ActionResult CreateEmp(EMPLOYEE_MODEL model)
        {
            JsonSMsg rMsg = new JsonSMsg();

            string accessToken = HmjClientServiceApi.Create().GetAccessToken();

            WeiPage wp      = new WeiPage();
            string  mpToken = wp.Token(AppConfig.FWHOriginalID);
            int     ewmId   = SystemService.GetEwmId() + 1;

            model.EwmId = ewmId;
            QRCodeResponse qrCodeResponse = WXMPClientServiceApi.Create().CreateQRCode(mpToken, ewmId);

            if (qrCodeResponse != null)
            {
                model.EwmUrl = "https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=" + qrCodeResponse.Ticket;
            }
            DeptInfo dept = new DeptInfo();

            dept.ID = model.EmpGroupId;
            string errMsg = null;
            int    rows   = EmployeeService.SaveEmployee(accessToken, model, dept, ref errMsg);

            if (rows > 0)
            {
                rMsg.Status = 1;
                rMsg.Data   = rows;
            }
            else
            {
                if (string.IsNullOrEmpty(errMsg))
                {
                    errMsg = "保存失败。";
                }
                rMsg.Message = errMsg;
            }

            return(Json(rMsg));
        }
Пример #24
0
        public ClientGame spectateGame(int gameId)
        {
            if (!AuthManager.Instance.containsConnection(Context.ConnectionId))
            {
                return(null);
            }
            string            userName    = AuthManager.Instance.GetNameByConnectionId(Context.ConnectionId);
            GameCenterService gc          = new GameCenterService();
            List <string>     usersToSend = new List <string>();

            if ((usersToSend = gc.spectateGame(gameId, userName)) != null)
            {
                GameCenterManager.Instance.spectateGame(userName, gameId);
                //await Groups.Add(Context.ConnectionId, "game " + gameId);
                SystemService     userService = new SystemService();
                ClientUserProfile userProfile = userService.getUser(userName);
                Clients.Clients(usersToSend.Select(user => AuthManager.Instance.GetConnectionIdByName(user)).ToList()).spectateGame(gameId, userProfile);
                return(gc.getGameById(gameId));
            }

            return(null);
        }
Пример #25
0
 /// <summary>
 /// 心跳监测定时线程。
 /// </summary>
 private void Heartbeat()
 {
     //每隔10分钟检查心跳监测表,如果发现有超过10分钟没有心跳的,则马上报警
     new Thread(() => {
         while (true)
         {
             DateTime temp = DateTime.Now.AddMinutes(-10);
             try
             {
                 foreach (HeartbeatEntity heartbeatEntity in heartbeatEntityRepository.FindList(a => a.LastHeartbeatTime < temp))
                 {
                     SystemService.SendWarning(heartbeatEntity);
                 }
             }
             catch (Exception ex)
             {
                 log.Error(ex.Message, ex);
             }
             Thread.Sleep(600000);
         }
     }).Start();
 }
Пример #26
0
        private void Save(object arg)
        {
            switch (EditState)
            {
            case "add":
                string count = SystemService.ExecuteScalar("select count(*) from Workflow where WorkflowName = '" + WorkflowName + "'");
                if (Convert.ToInt32(count) == 0)
                {
                    Workflow = new DynObject("Workflow");
                    Workflow["WorkflowID"]        = SystemService.GetNextID("Workflow");
                    Workflow["WorkflowName"]      = WorkflowName;
                    Workflow["Definition"]        = _designer.Text;
                    Workflow["RuntimeDefinition"] = RemoveViewState(_designer.Text);
                    Workflow["State"]             = "已保存";
                    SystemService.AddDynObject(Workflow);
                    MessageBox.Show("当前工作流已经成功新增到数据库!");
                    EditState = "modify";
                }
                else
                {
                    MessageBox.Show("工作流名称:" + WorkflowName + "  已经存在,请检查!");
                    return;
                }
                break;

            case "modify":
                Workflow["WorkflowName"]      = WorkflowName;
                Workflow["Definition"]        = _designer.Text;
                Workflow["RuntimeDefinition"] = RemoveViewState(_designer.Text);
                SystemService.ModifyDynObject(Workflow);
                MessageBox.Show("当前工作流已经成功更新到数据库!");
                break;

            default:
                break;
            }
            DeleteCommand.RaiseCanExecuteChanged();
        }
Пример #27
0
        //保存
        private void BtnSave_Click()
        {
            bool success = false;

            try
            {
                if (!InputValidity(md))
                {
                    return;                    //验证失败
                }
                var model = new SystemService();
                model.Code          = int.Parse(View.txtCode.Text);
                model.ServiceName   = View.txtName.Text.Trim();
                model.Remark        = View.txtRemark.Text;
                model.ServiceURL    = View.txtUrl.Text;
                model.Describtion   = View.txtDecrip.Text;
                model.ServiceTypeID = int.Parse(View.cmbServiceType.SelectedValue.ToString());
                model.EnableStatus  = int.Parse(View.cmbEnable.SelectedValue.ToString());
                if (md != null)
                {
                    model.ID = int.Parse(View.txtID.Text);            //修改需要ID的值
                }
                if (new SystemServiceBIZ().Insert(model) > 0)
                {
                    MessageBox.Show("保存成功!");
                    View.Close();
                }
                else
                {
                    MessageBox.Show("保存失败!");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("保存失败!原因是:" + ex.Message);
                UIHelper.WriteLog(ex.Message);
            }
        }
Пример #28
0
        public ActionResult ConfirmedReset(string phone, string imgVerificationCode)
        {
            if (string.IsNullOrEmpty(phone) || string.IsNullOrEmpty(imgVerificationCode))
            {
                return(RedirectToAction("ConfirmIdentity", new { Message = "账户或者验证码不为空!" }));
            }
            if (!CheckerHelper.IsMobile(phone))
            {
                return(RedirectToAction("ConfirmIdentity", new { Message = "您输入的不是手机号!" }));
            }
            if (!BConfigs.SimulateSendVCode && Session[CAPTCHA] != null && Session[CAPTCHA].ToString().ToUpper() != imgVerificationCode.ToUpper())
            {
                return(RedirectToAction("ConfirmIdentity", new { Message = "您输入的验证码不对!" }));
            }
            var userbackend = db.UserBackend.Where(e => e.UserName == phone).FirstOrDefault();

            if (userbackend == null)
            {
                return(RedirectToAction("ConfirmIdentity", new { Message = "没有该用户账号,请查证后再修改!" }));
            }
            //密码强度
            var isdetectionoff = ConfigHelper.GetAppSetting("PasswordStrengthDetectionSwitch") != "on";

            ViewData["IsDetection"] = !isdetectionoff;
            ViewData["RegexTxt"]    = !isdetectionoff?ConfigHelper.GetAppSetting("PasswordRegEx") : string.Empty;

            var desc = ConfigHelper.GetAppSetting("RegExDesc");

            ViewData["RegExDesc"] = !isdetectionoff ? (string.IsNullOrEmpty(desc) ? "密码长度必须不少于6个字符长度,密码只能包含英文字母(a-z)、数字字符(0-9)两个组合,不能全是数字或者全是字母!" : desc) : string.Empty;
            ViewBag.Phone         = userbackend.UserName;
            ViewBag.Captcha       = (string)Session[CAPTCHA];

            ViewBag.Phone   = phone;
            ViewBag.Captcha = imgVerificationCode;

            SystemService.SendVerificationCode(userbackend.UserName, 120);
            return(View());
        }
Пример #29
0
        public void Export()
        {
            var exportDirectory    = SystemService.GetExportPath();
            var exportFilename     = string.Format("Wox.WebApp-Save-{0}.wap.txt", SystemService.GetUID());
            var exportFullFilename = Path.Combine(exportDirectory, exportFilename);

            using (var fileGenerator = FileGeneratorService.CreateGenerator(exportFullFilename))
            {
                var configurations = GetConfigurations();
                if (configurations.ContainsKey("default"))
                {
                    var configuration = configurations["default"];
                    fileGenerator.AddLine(string.Format("# launcher: {0}", configuration.WebAppLauncher));
                    fileGenerator.AddLine(string.Format("# argumentsPattern: {0}", configuration.WebAppArgumentPattern));
                }
                foreach (var configuration in configurations.Values)
                {
                    if (configuration.Profile != "default")
                    {
                        fileGenerator.AddLine(string.Format("# launcher[{1}]: {0}", configuration.WebAppLauncher, configuration.Profile));
                        fileGenerator.AddLine(string.Format("# argumentsPattern[{1}]: {0}", configuration.WebAppArgumentPattern, configuration.Profile));
                    }
                }
                foreach (var webAppItem in WebAppItemRepository.SearchItems(new List <string>()))
                {
                    if (webAppItem.Profile == "default")
                    {
                        fileGenerator.AddLine(string.Format("{0} ({1})", webAppItem.Url, webAppItem.Keywords));
                    }
                    else
                    {
                        fileGenerator.AddLine(string.Format("{0} ({1}) [{2}]", webAppItem.Url, webAppItem.Keywords, webAppItem.Profile));
                    }
                }
                fileGenerator.Generate();
            }
            SystemService.StartCommandLine(exportDirectory, "");
        }
        public bool AddModule()
        {
            DynEntity moduleDynEntity = new DynEntity("Module");

            Module.ModuleID                = SystemService.GetNextID("Module");
            moduleDynEntity["ModuleID"]    = Module.ModuleID;
            moduleDynEntity["ModuleName"]  = Module.ModuleName;
            moduleDynEntity["Description"] = Module.Description;
            //moduleDynEntity["LocalVersion"] = 1;
            //moduleDynEntity["CascadeVersion"] = 1;
            //moduleDynEntity["ReleaseVersion"] = "1";

            try
            {
                SystemService.AddDynEntity(moduleDynEntity);
                ModuleManagerViewModel.ModuleSouce.Add(Module);
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Пример #31
0
        private void PostProcessSignature(IPlatform platform, SystemService svc)
        {
            var parameters = svc.Signature !.Parameters !;

            for (int i = 0; i < parameters.Length; ++i)
            {
                var p  = parameters[i];
                var at = p.DataType.ResolveAs <Reko.Core.Types.ArrayType>();
                if (at != null && (at.IsUnbounded || at.Length <= 1))
                {
                    // Size 1 arrays are commonly used as boundless arrays in signatures.
                    var     dtNew  = new Core.Types.Pointer(at.ElementType, platform.PointerType.BitSize);
                    Storage stgNew = CreateStorage(dtNew, p.Storage);
                    p             = new Identifier(p.Name, dtNew, stgNew);
                    parameters[i] = p;
                }
                var st = p.DataType.ResolveAs <Core.Types.StructureType>();
                if (st != null)
                {
                    st.Size = st.GetInferredSize();
                }
            }
        }
Пример #32
0
 public PartitionController(
     DbContextOptions <AppDbContext> options,
     ILogger <SystemInformationController> logger,
     IConfiguration config,
     IOptions <ConfigEnvironment> envOpt
     )
 {
     _context = new AppDbContext(options);
     if (envOpt.Value.UseSsh)
     {
         var credentials = new OSCommander.Dtos.SshCredentials(
             config["Ssh:Host"],
             config["Ssh:Username"],
             config["Ssh:Password"]);
         _service    = new PartitionService(logger, credentials);
         _sysService = new SystemService(logger, credentials);
     }
     else
     {
         _service    = new PartitionService(logger);
         _sysService = new SystemService(logger);
     }
 }
Пример #33
0
 /// <summary>
 /// 删除分类及子分类
 /// </summary>
 /// <param name="catalogId"></param>
 public void DeleteCatalog2(int catalogId)
 {
     try
     {
         SystemService ss = Context.GetService <SystemService>();
         Hashtable     p  = new Hashtable();
         p.Add("Pid", catalogId);
         IList <S_Catalog> sublist = ss.SCatalogBll.GetSubList(catalogId);
         //先删除两级子分类
         sublist.ToList().ForEach(c =>
         {
             c.SubCatalog.ToList().ForEach(c1 => ss.SCatalogBll.Delete(c1.CatalogId));
             ss.SCatalogBll.Delete(c.CatalogId);
         });
         ss.SCatalogBll.Delete(catalogId);
         AddSuccess("操作成功");
     }
     catch {
         AddError("系统错误");
     }
     Redirect("Catalog.do");
     return;
 }
Пример #34
0
        public bool AddDesignApplication()
        {
            DynEntity applicationDynEntity = new DynEntity("Application");

            DesignApplication.ApplicationID         = SystemService.GetNextID("Application");
            applicationDynEntity["ApplicationID"]   = DesignApplication.ApplicationID;
            applicationDynEntity["ApplicationName"] = DesignApplication.ApplicationName;
            applicationDynEntity["Description"]     = DesignApplication.Description;
            //applicationDynEntity["LocalVersion"] = 1;
            //applicationDynEntity["CascadeVersion"] = 1;
            //applicationDynEntity["ReleaseVersion"] = "1";

            try
            {
                SystemService.AddDynEntity(applicationDynEntity);
                ApplicationManagerViewModel.ApplicationSource.Add(DesignApplication);
                return(true);
            }
            catch (Exception ex)
            {
                throw(ex);
            }
        }
Пример #35
0
 public void SetTreeNodeProperties(SystemService svc)
 {
     TreeNode.Text = svc.Name;
     TreeNode.ImageName = "Binary.ico";
 }
Пример #36
0
        private void ParseExports(TypeLibraryLoader lib)
        {
            while (Peek().Type == TokenType.Id)
            {
                string entryName = Expect(TokenType.Id);
                string internalName = null;
                if (PeekAndDiscard(TokenType.Eq))
                {
                    internalName = Expect(TokenType.Id);
                }
                int ordinal = -1;
                if (PeekAndDiscard(TokenType.At))
                {
                    ordinal = Convert.ToInt32(Expect(TokenType.Number));
                    PeekAndDiscard(TokenType.NONAME);
                }
                PeekAndDiscard(TokenType.PRIVATE);
                PeekAndDiscard(TokenType.DATA);

                var svc = new SystemService
                {
                    Name = entryName,
                    Signature = ParseSignature(entryName, lib),
                };
                Debug.Print("Loaded {0} @ {1}", entryName, ordinal);
                if (ordinal != -1)
                {
                    svc.SyscallInfo = new SyscallInfo { Vector = ordinal };
                    lib.LoadService(ordinal, svc);
                }
                lib.LoadService(entryName, svc);
            }
        }
 /// <summary>
 /// There are no comments for SystemServiceSet in the schema.
 /// </summary>
 public void AddToSystemServiceSet(SystemService systemService)
 {
     base.AddObject("SystemServiceSet", systemService);
 }
Пример #38
0
        public void Bwi_IndirectCallMatchedByPlatform()
        {
            var platform = mr.StrictMock<Platform>(null, arch);
            var reg0 = proc.Frame.EnsureRegister(new RegisterStorage("r0", 0, PrimitiveType.Pointer32));
            var reg1 = proc.Frame.EnsureRegister(new RegisterStorage("r1", 1, PrimitiveType.Pointer32));
            var sysSvc = new SystemService {
                Name = "SysSvc", 
                Signature = new ProcedureSignature(null, reg1),
                Characteristics = new ProcedureCharacteristics()
            };
            platform.Expect(p => p.FindService(null, arch.CreateProcessorState())).IgnoreArguments().Return(sysSvc);
            platform.Stub(p => p.PointerType).Return(PrimitiveType.Pointer32);
            prog.Platform = platform;
            scanner.Stub(f => f.FindContainingBlock(Address.Ptr32(0x100000))).Return(block);
            scanner.Stub(f => f.FindContainingBlock(Address.Ptr32(0x100004))).Return(block);
            scanner.Stub(f => f.GetCallSignatureAtAddress(Address.Ptr32(0x100000))).Return(null);
            scanner.Stub(s => s.GetTrace(null, null, null)).IgnoreArguments().Return(trace);
            mr.ReplayAll();

            trace.Add(m => m.Call(m.LoadDw(m.IAdd(reg0, -32)), 4));
            var wi = CreateWorkItem(Address.Ptr32(0x100000), arch.CreateProcessorState());
            wi.ProcessInternal();

            Assert.AreEqual("SysSvc(r1)", block.Statements[0].ToString());
            mr.VerifyAll();
        }
Пример #39
0
 private void button2_Click(object sender, EventArgs e)
 {
     SystemService ss = new SystemService();
     ss.StopWindowsService("MySQL");
 }
 /// <summary>
 /// Create a new SystemService object.
 /// </summary>
 /// <param name="serviceId">Initial value of ServiceId.</param>
 /// <param name="name">Initial value of Name.</param>
 public static SystemService CreateSystemService(int serviceId, string name)
 {
     SystemService systemService = new SystemService();
     systemService.ServiceId = serviceId;
     systemService.Name = name;
     return systemService;
 }