public UserViewModel(AppInfo appInfo, TwitterClient client, string username) { _appInfo = appInfo; _client = client; Reload(username); }
public AppcastViewModel() : base(false) { Constants.SetApplicationName("Appcast"); // TODO try to fill in as much info automatically as possible AppcastItems = new ObservableCollection<AppcastItemViewModel>(); Instructions = "Enter the appcast information below and press 'Save'"; AcceptChanges(); #if TESTING var testingFolder = new DirectoryInfo(@"C:\code\tubeCentric.root\ASSETS\10centmail\"); var binaryFolder = new DirectoryInfo(@"C:\code\tubeCentric.root\amazon tools.root\Amazon SES\Amazon Email\bin\Release\"); var item = new AppcastItemViewModel( Path.Combine(binaryFolder.FullName, @"TenCentMail.exe"), Path.Combine(testingFolder.FullName, @"releasenotes.txt"), Path.Combine(testingFolder.FullName, @"NetSparkle_DSA.priv")); OutputPath = Path.Combine(testingFolder.FullName, @"testappcast.xml"); Language = "en"; var appInfo = new AppInfo(Assembly.LoadFrom(item.PathToBinary)); var appName = appInfo.Title; var appNameNoSpaces = appName.Replace(' ', '_'); ApplicationName = string.Format("{0} Changelog", appName); AppcastName = appNameNoSpaces; Description = @"Most recent changes with links to updates."; AppcastAddress = @"http://carverlab.com/appcast"; AppcastItems.Add(item); IsValid = true; #endif }
public Manager(Configuration configuration, Action<string> outputText) { Log.InitializeOutputSource(outputText, Path.Combine(configuration.StoragePath, "log.txt")); m_configuration = configuration; m_server = new Server(); m_info = new AppInfo(m_server, m_configuration); m_server.Initialize(m_info); m_features = new Dictionary<FeatureType, Feature>(); // Initialize features; we should have a better factory for this; any new features should be added here. m_features.Add(FeatureType.Contact, new Features.ContactFeature(m_info)); m_features.Add(FeatureType.Company, new Features.CompanyFeature(m_info)); m_features.Add(FeatureType.List, new Features.ListFeature(m_info)); m_features.Add(FeatureType.ListMembership, new Features.ListMembershipFeature(m_info)); m_features.Add(FeatureType.Workflow, new Features.WorkflowFeature(m_info)); m_features.Add(FeatureType.WorkflowEnrollment, new Features.WorkflowEnrollmentFeature(m_info)); m_features.Add(FeatureType.ContactProperty, new Features.ContactPropertyFeature(m_info)); m_features.Add(FeatureType.CompanyProperty, new Features.CompanyPropertyFeature(m_info)); m_features.Add(FeatureType.ContactPropertyGroup, new Features.SingleCallFeature(m_info, FeatureType.ContactPropertyGroup, "contacts/v2/groups")); m_features.Add(FeatureType.CompanyPropertyGroup, new Features.SingleCallFeature(m_info, FeatureType.CompanyPropertyGroup, "companies/v2/groups")); m_features.Add(FeatureType.Form, new Features.FormFeature(m_info)); m_features.Add(FeatureType.CalendarEvent, new Features.CalendarEventFeature(m_info)); }
public TweetsPanelViewModel(AppInfo appInfo, TwitterClient client, Func<string, UserViewModel> userViewModelFactory) { AppInfo = appInfo; Tweets = new TweetCollection(); _client = client; _userViewModelFactory = userViewModelFactory; }
public bool Add(AppInfo model) { int maxID = DbHelperOleDb.GetMaxID("ID", "AppInfo"); StringBuilder strSql = new StringBuilder(); strSql.Append("insert into AppInfo("); strSql.Append("AppName,AppPath,AppParam,AppOrder,AppType,ID)"); strSql.Append(" values ("); strSql.Append("@AppName,@AppPath,@AppParam,@AppOrder,@AppType,@ID)"); OleDbParameter[] parameters = { new OleDbParameter("@AppName", OleDbType.VarChar,255), new OleDbParameter("@AppPath", OleDbType.VarChar,255), new OleDbParameter("@AppParam", OleDbType.VarChar,255), new OleDbParameter("@AppOrder", OleDbType.Integer,4), new OleDbParameter("@AppType", OleDbType.Integer,4), new OleDbParameter("@ID", OleDbType.Integer,4)}; parameters[0].Value = model.AppName; parameters[1].Value = model.AppPath; parameters[2].Value = model.AppParam; parameters[3].Value = maxID; parameters[4].Value = model.AppType; parameters[5].Value = maxID; int rows = DbHelperOleDb.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return true; } else { return false; } }
private void TryLaunchApp(AppInfo app) { string exeFilePath = Path.Combine(GetAppExtractionDirectory(app), app.Name + ".exe"); string exeDirectory = PathExtensions.GetAbsolutePath(Path.GetDirectoryName(exeFilePath)); var processRunner = new ProcessRunner(exeFilePath) { WorkingDirectory = exeDirectory }; processRunner.Start(); }
/// <summary> /// Creates a new connection to the icontent.cache file. /// </summary> /// <param name="filename">The file to connect to.</param> public IGADatabaseConnector(String filename) { try { sqlite = new SqliteConnection("URI=file:" + filename + ",version=3"); sqlite.Open(); SqliteCommand query = new SqliteCommand("SELECT [appId] FROM [contentlist] LIMIT 1", sqlite); Object result = query.ExecuteScalar(); sqlite.Close(); if (result == null) { this._appID = 0; } else { this._appID = (int)result; } if (this._appID > 0) { this._appSupported = Common.AppInfos.ContainsKey(this._appID); } else { this._appSupported = false; } if (this._appSupported) { _appInfo = Common.AppInfos[this._appID]; } } catch (Exception) { throw new DatabaseConnectionFailureException(); } }
private static void AssertBuiltApp(AppInfo expectedApp, AppInfo actualApp) { Assert.AreEqual(expectedApp.Name, actualApp.Name); Assert.AreEqual(expectedApp.Platform, actualApp.Platform); Assert.AreEqual(expectedApp.AppGuid, actualApp.AppGuid); Assert.AreEqual(expectedApp.FilePath, actualApp.FilePath); }
private void LoadFile(string filename) { BinaryReader reader = new BinaryReader(new FileStream(filename, FileMode.Open)); int appCount = reader.ReadInt32(); appInfos.Clear(); DataTable dt = new DataTable(); foreach (FieldInfo pInfo in typeof(AppInfo).GetFields()) { dt.Columns.Add(pInfo.Name, pInfo.FieldType); } for (int i = 0; i < appCount; ++i) { AppInfo appInfo = new AppInfo(); appInfo.read(reader); appInfos.Add(appInfo); object[] fields = new object[typeof(AppInfo).GetFields().Length]; int j = 0; foreach (FieldInfo pInfo in typeof(AppInfo).GetFields()) { fields[j++] = pInfo.GetValue(appInfo); } dt.Rows.Add(fields); } dataGridView1.DataSource = appInfos; reader.Close(); }
protected override void LaunchApp(AppInfo app) { try { TryLaunchApp(app); } catch (Exception ex) { Logger.Warning(app.Name + " was closed with error: " + ex); } }
// ncrunch: no coverage end protected override void InstallApp(AppInfo app) { try { TryInstallApp(app); } catch (ArgumentException) { throw new InstallationFailedOnDevice(this, app); } }
// ncrunch: no coverage end protected override void InstallApp(AppInfo app) { try { MakeSureDeviceConnectionIsEstablished(); nativeDevice.InstallApplication(app.AppGuid, app.AppGuid, "Apps.Normal", "", app.FilePath); } catch (ArgumentException) { throw new InstallationFailedOnDevice(this, app); } }
protected override void UninstallApp(AppInfo app) { try { MakeSureDeviceConnectionIsEstablished(); RemoteApplication appOnDevice = nativeDevice.GetApplication(app.AppGuid); appOnDevice.Uninstall(); } catch (SmartDeviceException) { throw new UninstallationFailedOnDevice(this, app); } }
public static void InitApplication(XtallAppInfo appInfo) { var info = new AppInfo(appInfo); InitializationLock.EnterWriteLock(); try { Applications[info.VirtualPath] = info; } finally { InitializationLock.ExitWriteLock(); } }
protected override void LaunchApp(AppInfo app) { try { string exeFilePath = Path.Combine(GetAppExtractionDirectory(app), app.Name + ".exe"); string exeDirectory = PathExtensions.GetAbsolutePath(Path.GetDirectoryName(exeFilePath)); var processRunner = new ProcessRunner(exeFilePath) { WorkingDirectory = exeDirectory }; processRunner.Start(); } catch (Exception ex) { Logger.Warning(app.Name + " was closed with error: " + ex); } }
public bool Delete(AppInfo model) { StringBuilder strSql = new StringBuilder(); strSql.Append("delete from AppInfo"); strSql.Append(" where ID =" + model.ID); int rows = DbHelperOleDb.ExecuteSql(strSql.ToString()); if (rows > 0) { return true; } else { return false; } }
public static AppInfo GetGetAppInfo() { AppInfo appinfo = new AppInfo(); appinfo.appid = ConfigurationManager.AppSettings["appid"]; appinfo.secret = ConfigurationManager.AppSettings["secret"]; appinfo.token = ConfigurationManager.AppSettings["token"]; appinfo.URL = ConfigurationManager.AppSettings["URL"]; appinfo.EncodingAESKey = ConfigurationManager.AppSettings["EncodingAESKey"]; appinfo.mch_id = ConfigurationManager.AppSettings["mch_id"]; appinfo.cert_path = ConfigurationManager.AppSettings["cert_path"]; appinfo.cart_password = ConfigurationManager.AppSettings["cart_password"]; appinfo.PartnerKey = ConfigurationManager.AppSettings["PartnerKey"]; return appinfo; }
protected void Application_Start(object sender, EventArgs e) { Application[Constants.WEB_APPLICATION_NAME_KEY] = "tubeCentric.Service"; Application[Constants.WEB_COMPANY_NAME_KEY] = "Carver Lab"; //Logger.Activate(Utility.ApplicationStoragePath + "tubeCentric.Service.log", "tubeCentric.Service"); try { var appInfo = new AppInfo(Assembly.GetExecutingAssembly()); Logger.TraceInfo("====================== tubeCentric Service {0} Startup ========================", appInfo.Version); } catch (Exception exception) { Logger.TraceErr("Could not initialize AppInfo on startup. {0}", exception); } AppDomain.CurrentDomain.AssemblyResolve += CurrentDomainOnAssemblyResolve; }
// We can't pass in a HealthVaultClient directly because it's not a WinRT class. :( public ServiceMethodProvider(HealthVaultAppSettings appSettings) { ServiceInfo serviceInfo = (ServiceInfo)ServiceFactory.CreateServiceInfo( "https://chbaseplatform-ppev2.dev.grcdemo.com/platform/wildcat.ashx", "https://chbase-ppev2.dev.grcdemo.com"); AppInfo appInfo = new AppInfo(); appInfo.MasterAppId = Guid.Parse(appSettings.MasterAppId); appInfo.IsMultiInstanceAware = true; CHBaseClient client = new CHBaseClient( appInfo, serviceInfo, appSettings.IsFirstParty, appSettings.WebAuthorizer != null ? (IWebAuthorizer)appSettings.WebAuthorizer : null); m_serviceMethods = client.ServiceMethods; }
private IUserInfo GetUserInfoByUserIdentity(AppInfo appInfo, string accessToken, string userIdentity) { var url = UrlBuilder.Create("https://graph.qq.com/user/get_user_info") .WithParam("access_token", accessToken) .WithParam("oauth_consumer_key", appInfo.AppId) .WithParam("openid", userIdentity) .Build(); var json = HttpClient.Get(url, null, Encoding.UTF8); var result = (ApiResult)JsonSerializer.Deserialize(json, typeof(ApiResult)); if (result.ret < 0) throw new ApiException(result.msg, result.ret.ToString()); result.Id = userIdentity; return result; }
private EventInfo CreateEventInfoBase(Event errorData) { var appInfo = new AppInfo { Version = Config.AppVersion, ReleaseStage = Config.ReleaseStage, AppArchitecture = Diagnostics.AppArchitecture, ClrVersion = Diagnostics.ClrVersion }; var userInfo = new UserInfo { Id = errorData.UserId, Email = errorData.UserEmail, Name = errorData.UserName }; var deviceInfo = new DeviceInfo { OSVersion = Diagnostics.DetectedOSVersion, ServicePack = Diagnostics.ServicePack, OSArchitecture = Diagnostics.OSArchitecture, ProcessorCount = Diagnostics.ProcessorCount, MachineName = Diagnostics.MachineName, HostName = Diagnostics.HostName }; var eventInfo = new EventInfo { App = appInfo, Device = deviceInfo, Severity = errorData.Severity, User = userInfo, Context = errorData.Context, GroupingHash = errorData.GroupingHash, Exceptions = new List<ExceptionInfo>() }; return eventInfo; }
private void ListApp_SelectedIndexChanged(object sender, EventArgs e) { SelectIndex = this.listApp.SelectedIndex; if (SelectIndex == -1) { return; } if (CurrentAppInfo != null) { CurrentAppInfo.ChangeLog = null; } var tmpCurrentAppInfo = this.AppInfoList[SelectIndex]; this.btnRun.Text = tmpCurrentAppInfo.Runing ? "立即停止" : "立即运行"; if (tmpCurrentAppInfo.ChangeLog == null) { tmpCurrentAppInfo.ChangeLog = MyWriteLog; } this.ckbShowLog.Checked = tmpCurrentAppInfo.ReadLog; tmpCurrentAppInfo.UpdateLog(string.Empty); CurrentAppInfo = tmpCurrentAppInfo; }
public void ShouldConstructWithCorrectContact() { var info = new AppInfo("test", "test", "test", "*****@*****.**", Category.Game); Assert.AreEqual("*****@*****.**", info.Author.Contact); }
public void ShouldConstructWithCorrectAuthor() { var info = new AppInfo("foobar", "test", "Alice", "test", Category.Application); Assert.AreEqual("Alice", info.Author.Name); }
private UPnPDevice GetDevice(string deviceName) { UPnPDevice result; var allDoneEvent = new ManualResetEvent(false); var localDeviceName = deviceName; UPnPDevice localDeviceFound = null; if (!MediaServerModel.IsStarted) { // HACK: AppInfo searches by assembly title, not app title var appInfo = new AppInfo("tubeCentric.Service"); HTTPMessage.DefaultUserAgent = string.Format("{0} {1}.{2}", "tubeCore", appInfo.Version.Major, appInfo.Version.Minor); MediaServerModel.Start(); } var model = MediaServerModel.GetInstance(); EventHandler<NewDeviceFoundEventArgs> deviceFoundDelegate = delegate(object sender, NewDeviceFoundEventArgs e) { if (e.Device.FriendlyName == localDeviceName) { localDeviceFound = e.Device; allDoneEvent.Set(); } }; model.Actions.ContentDirectory.NewDeviceFound += deviceFoundDelegate; allDoneEvent.Reset(); model.Actions.ContentDirectory.OnCreateControlPoint(); allDoneEvent.WaitOne(TimeSpan.FromSeconds(30d)); model.Actions.ContentDirectory.NewDeviceFound -= deviceFoundDelegate; result = localDeviceFound; Write(result == null ? @"No device found." : string.Format(@"Device {0} found", result.FriendlyName)); return result; }
public ApplicationActivatedEventArgs(AppInfo app) { AppInfo = app; }
private void PrintVersion(string s) { Logo(System.Console.Error); var appInfo = new AppInfo(Assembly.GetEntryAssembly()); System.Console.WriteLine(@"Version: " + appInfo.Version); Environment.Exit(0); }
protected override void OnInit(QFramework.IUIData uiData) { if (Application.platform == RuntimePlatform.Android) { AudioManager.SetMusicOn(); AudioManager.PlayMusic("Main_BG_Music"); AndroidForUnity.CallAndroidHideSplash(); } else if (Application.platform == RuntimePlatform.IPhonePlayer) { Dictionary <string, object> param = new Dictionary <string, object>(); Dictionary <string, object> subParam = new Dictionary <string, object>(); param.Add("method", IOSClientUtil.MainPanelOnInit); param.Add("params", subParam); IOSClientUtil.CommonMethodCallIOSClient(param.ToJson()); if (App.IsFirstInitialize == 1) { AudioManager.SetMusicOn(); AudioManager.PlayMusic("Main_BG_Music"); } } else { AudioManager.SetMusicOn(); AudioManager.PlayMusic("Main_BG_Music"); } mTexture2DHBoy = mResLoader.LoadSync <Texture2D>("ic_head_boy"); mTexture2DHGirl = mResLoader.LoadSync <Texture2D>("ic_head_girl"); mMainAnimationGo = mResLoader.LoadSync <GameObject>("MainAnimation") .Instantiate() .transform .LocalScale(1.4f, 1.4f, 1.4f) .Position(-11.0f, -5.0f, 0) .gameObject; mData = uiData as MainPanelData ?? new MainPanelData(); BtnGift.onClick.AddListener(() => { AudioManager.PlaySound("Button_Audio"); UIMgr.OpenPanel <GiftListPanel>(new GiftListPanelData(), UITransitionType.CLOUD, this); }); BtnSetting.onClick.AddListener(() => { AudioManager.PlaySound("Button_Audio"); UIMgr.OpenPanel <SettingPanel>(new SettingPanelData(), UITransitionType.CLOUD, this); }); BtnListen.onClick.AddListener(() => { AudioManager.PlaySound("Button_Audio"); StartRequestForGetResourcePageUrl(); }); BtnMessage.onClick.AddListener(() => { // UIMgr.OpenPanel<AttendanceAddAudioPanel>(); }); BtnRobot.OnClickAsObservable().Subscribe((unit => { AudioManager.PlaySound("Button_Audio"); UIMgr.OpenPanel <DeviceStatusPanel>(new DeviceStatusPanelData(), UITransitionType.CLOUD, this); })).AddTo(this); BtnIntegral.onClick.AddListener(() => { AudioManager.PlaySound("Button_Audio"); Debug.Log("每日任务"); UIMgr.OpenPanel <DailyTaskPanel>(new DailyTaskPanelData(), UITransitionType.CLOUD, this); }); BtnMedal.onClick.AddListener(() => { AudioManager.PlaySound("Button_Audio"); Debug.Log("勋章"); UIMgr.OpenPanel <DailyTaskPanel>(new DailyTaskPanelData() { showMedal = 2, }, UITransitionType.CLOUD, this); }); BtnScan.onClick.AddListener(() => { AudioManager.PlaySound("Button_Audio"); if (Application.platform == RuntimePlatform.Android) { NativeGallery.RequestPermission((result, action) => { if (result == (int)NativeGallery.Permission.Granted) { Dictionary <string, object> param = new Dictionary <string, object>(); Dictionary <string, object> subParam = new Dictionary <string, object>(); param.Add("target", AppConst.SCAN); param.Add("params", subParam); AndroidForUnity.CallAndroidStartActivityForAnim(param.ToJson(), AppConst.ANIM_CLOUD); } }, (int)NativeAction.Camera); } else if (Application.platform == RuntimePlatform.IPhonePlayer) { Dictionary <string, object> param = new Dictionary <string, object>(); Dictionary <string, object> subParam = new Dictionary <string, object>(); param.Add("target", AppConst.SCAN_IOS); param.Add("params", subParam); IOSClientUtil.CallIOSClient(param.ToJson()); } }); BtnChineseShop.onClick.AddListener(() => { AudioManager.PlaySound("Button_Audio"); if (UserInfo.chPlanId != 0) { StartRequestForGetPlanInfo(UserInfo.chPlanId, 0); } else { UIMgr.OpenPanel <TipPanel>(new TipPanelData() { action = TipAction.PlanScan, message = "该计划未解锁\n需扫描盒子二维码进行解锁!", strConfirm = "去扫描", strTitle = "解锁提示" }); LoadingManager.GetInstance().DismissLoading(); } }); BtnEnglishShop.onClick.AddListener(() => { AudioManager.PlaySound("Button_Audio"); if (UserInfo.enPlanId != 0) { StartRequestForGetPlanInfo(UserInfo.enPlanId, 0); } else { UIMgr.OpenPanel <TipPanel>(new TipPanelData() { action = TipAction.PlanScan, message = "该计划未解锁\n需扫描盒子二维码进行解锁!", strConfirm = "去扫描", strTitle = "解锁提示" }); LoadingManager.GetInstance().DismissLoading(); } }); BtnLearningShop.onClick.AddListener(() => { AudioManager.PlaySound("Button_Audio"); if (UserInfo.qgPlanId != 0) { StartRequestForGetPlanInfo(UserInfo.qgPlanId, 0); } else { StartRequestForDrawPowerSpecialPlan(); } }); BtnPhotoWall.onClick.AddListener(() => { AudioManager.PlaySound("Button_Audio"); UIMgr.OpenPanel <WorksWallPanel>(new WorksWallPanelData(), UITransitionType.CLOUD, this); }); BtnAddRobot.onClick.AddListener(() => { UIMgr.OpenPanel <BindConfirmBootPanel>(new BindConfirmBootPanelData() { }, UITransitionType.CLOUD, this); }); SimpleEventSystem.GetEvent <ScanQRResult>() .Subscribe(_ => { if (_.ScanResult.IsNotNullAndEmpty()) { StartRequestForScanQR(_.ScanResult); } }).AddTo(this); //扫码动画关闭监听 SimpleEventSystem.GetEvent <CollectGiftBoxPanelClosed>() .Subscribe(_ => { if (_.CollectGiftBoxType == CollectGiftBoxType.ChineseLearningPlan || _.CollectGiftBoxType == CollectGiftBoxType.EnglishLearningPlan) { StartRequestForGetPlanInfo(ScanQrCodePlanId, ScanQrCodeMonth); } }).AddTo(this); SimpleEventSystem.GetEvent <TipConfirmClick>() .Subscribe(_ => { if (_.GetAction == TipAction.PlanScan) { if (Application.platform == RuntimePlatform.Android) { NativeGallery.RequestPermission((result, action) => { if (result == (int)NativeGallery.Permission.Granted) { Dictionary <string, object> param = new Dictionary <string, object>(); Dictionary <string, object> subParam = new Dictionary <string, object>(); param.Add("target", AppConst.SCAN); param.Add("params", subParam); AndroidForUnity.CallAndroidStartActivityForAnim(param.ToJson(), AppConst.ANIM_CLOUD); } }, (int)NativeAction.Camera); } else if (Application.platform == RuntimePlatform.IPhonePlayer) { Dictionary <string, object> param = new Dictionary <string, object>(); Dictionary <string, object> subParam = new Dictionary <string, object>(); param.Add("target", AppConst.SCAN_IOS); param.Add("params", subParam); IOSClientUtil.CallIOSClient(param.ToJson()); } } }).AddTo(this); /** * 展示完引导页 的事件 */ SimpleEventSystem.GetEvent <MainPanelGuideDismiss>().Subscribe(_ => { this.gameObject.SetActive(true); }).AddTo(this); SimpleEventSystem.GetEvent <LottieAnimationFinish>().Subscribe(_ => { if (Application.platform == RuntimePlatform.IPhonePlayer) { if (App.IsFirstInitialize == 1) { AudioManager.SetMusicOn(); AudioManager.PlayMusic("Main_BG_Music"); } } }).AddTo(this); /** * 勋章领取成功 */ SimpleEventSystem.GetEvent <MedalDrawSuccess>() .Subscribe(_ => { string medalCount = TvMedal.text; TvMedal.text = (medalCount.ToInt() + 1).ToString(); if (mMedalList.Count > 0) { mMedalList.RemoveAt(0); } ShowMedalAnimationPanel(); }).AddTo(this); setUserInfoData(); StartResquestForGetUserInfo(); RequestBabyMedalFindList(); if (Application.platform == RuntimePlatform.Android) { NativeGallery.GetSomethingFromNative((json, action1) => { if (json.IsNotNullAndEmpty()) { AppInfo model = SerializeHelper.FromJson <AppInfo>(json); StartResquestForFindReleaseInfo("2", model.build); } }, (int)NativeAction.VersionJson); } else if (Application.platform == RuntimePlatform.IPhonePlayer) { NativeGallery.GetSomethingFromIPhone(result => { Debug.Log("IOS - build = " + result); StartResquestForFindReleaseInfo("1", result.ToInt()); }, 4); } if (mData.ShopAction >= 1) { LoadingManager.GetInstance().CreatLoading(); StartCoroutine(WaitMainPanelAnimationCompleted(mData.ShopAction)); } }
/// <summary> /// 更新排序 /// </summary> public bool UpdateOrder(AppInfo model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update AppInfo set "); strSql.Append("AppOrder=@AppOrder"); strSql.Append(" where ID=@ID"); OleDbParameter[] parameters = { new OleDbParameter("@AppOrder", OleDbType.Integer,4), new OleDbParameter("@ID", OleDbType.Integer,4)}; parameters[0].Value = model.AppOrder; parameters[1].Value = model.ID; int rows = DbHelperOleDb.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return true; } else { return false; } }
public AppInfoViewModel() { ShowSettingsUICommand = new Command(() => AppInfo.ShowSettingsUI()); }
protected abstract string RetrieveContentInjectionInner(AppInfo app, SessionInfo session, CallbackPageContext context);
protected virtual string InvokeInner(AppInfo app, SessionInfo session, AbstractCallback.EventListener listener) { return((string)base.Invoke(app, session, listener)); }
public AppMenuItem(AppInfo app, bool show_icon) : base(app.Name) { this.app = app; if (!show_icon) return; Image = GtkBeans.Image.NewFromIcon (app.Icon, IconSize.Menu); #if GTK_2_16 this.SetAlwaysShowImage (true); #endif }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(AppInfo model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update AppInfo set "); strSql.Append("AppName=@AppName,"); strSql.Append("AppPath=@AppPath,"); strSql.Append("AppParam=@AppParam,"); strSql.Append("AppType=@AppType"); strSql.Append(" where ID=@ID"); OleDbParameter[] parameters = { new OleDbParameter("@AppName", OleDbType.VarChar,255), new OleDbParameter("@AppPath", OleDbType.VarChar,255), new OleDbParameter("@AppParam", OleDbType.VarChar,255), new OleDbParameter("@AppType", OleDbType.Integer,4), new OleDbParameter("@ID", OleDbType.Integer,4)}; parameters[0].Value = model.AppName; parameters[1].Value = model.AppPath; parameters[2].Value = model.AppParam; parameters[3].Value = model.AppType; parameters[4].Value = model.ID; int rows = DbHelperOleDb.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return true; } else { return false; } }
public void ShouldConstructWithCorrectCategory(Category category) { var info = new AppInfo("test", "test", "test", "test", category); Assert.AreEqual(category, info.Category); }
public IEnumerable <string> RetrieveContentInjection(CodeInjectionFactory.Locations location, bool allowsCallbacks, AppInfo app, SessionInfo session, Callbacks.CallbackPageContext context) { foreach (var c in _injectionElements.Where(c => !IsBroken(c))) { string content = string.Empty; if (c.GetLocation() == location) { var callback = c as AbstractCallback; if (callback != null) { if (allowsCallbacks) { try { content = callback.RetrieveContentInjection(app, session, context); } catch (Exception e) { RegisterError(callback, CallbackEvent.Unknown, app, e); } } } else { var js = c as InjectedJavascript; if (!app.OsContext.hasDisabledScript(js.Name) && !app.OsContext.hasDisabledScript("")) { content = js.Dump(); } } } yield return(content); } }
public sealed override object Invoke(AppInfo app, SessionInfo session, AbstractCallback.EventListener listener) { return(InvokeInner(app, session, listener)); }
private AppInfo DataRowToModel(DataRow row) { AppInfo model = new AppInfo(); if (row != null) { if (row["ID"] != null && row["ID"].ToString() != "") { model.ID = int.Parse(row["ID"].ToString()); } if (row["AppName"] != null) { model.AppName = row["AppName"].ToString(); } if (row["AppPath"] != null) { model.AppPath = row["AppPath"].ToString(); } if (row["AppParam"] != null) { model.AppParam = row["AppParam"].ToString(); } if (row["AppOrder"] != null && row["AppOrder"].ToString() != "") { model.AppOrder = int.Parse(row["AppOrder"].ToString()); } if (row["AppNum"] != null && row["AppNum"].ToString() != "") { model.AppNum = int.Parse(row["AppNum"].ToString()); } if (row["AppType"] != null && row["AppType"].ToString() != "") { model.AppType = int.Parse(row["AppType"].ToString()); } if (row["Type"] != null && row["Type"].ToString() != "") { model.Type = row["Type"].ToString(); } if (row["IsChecked"] != null && row["IsChecked"].ToString() != "") { model.IsChecked = int.Parse(row["IsChecked"].ToString()); } } return model; }
public sealed override void StoreResults(CallbackEvent evt, AppInfo app, SessionInfo session, object results) { StoreResults(evt, app, session, (string)results); }
private void comboBox_Loaded(object sender, RoutedEventArgs e) { var apps = new List <Model>(10); var getAppsTask = Task.Run(() => { if (comboBox.ItemsSource != null) { return; } var currentUser = WindowsIdentity.GetCurrent(); if (currentUser?.User == null) { return; } var sid = currentUser.User.ToString(); var packageManager = new PackageManager(); var packages = packageManager.FindPackagesForUserWithPackageTypes(sid, PackageTypes.Main).ToList(); if (Environment.OSVersion.Version.Major == 10) { var appXInfos = GetAppXInfosFromReg(); if (appXInfos == null || appXInfos.Count == 0) { return; } foreach (var package in packages) { try { using (var key = Registry.ClassesRoot.OpenSubKey($@"Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\SystemAppData\{package.Id.FamilyName}\SplashScreen\")) { var appUserModelIds = key?.GetSubKeyNames().Where(k => k.StartsWith(package.Id.FamilyName)); List <AppInfo> infoList = ReadAppInfosFromManifest(package.InstalledLocation.Path); if (appUserModelIds == null || infoList == null) { continue; } foreach (string appUserModelId in appUserModelIds) { Model model = new Model(); AppInfo info = infoList.Find(i => appUserModelId.EndsWith(i.ID)); string displayName = info.DisplayName; var color = ColorConverter.ConvertFromString(info.BackgroundColor); if (color != null) { model.BackgroundColor = (Color)color == Colors.Transparent ? SystemParameters.WindowGlassBrush : new SolidColorBrush((Color)color); model.BackgroundColor.Freeze(); } if (appXInfos.ContainsKey(appUserModelId)) { var appXInfo = appXInfos[appUserModelId]; displayName = ExtractDisplayName(package, appXInfo.ApplicationName); if (string.IsNullOrEmpty(displayName)) { continue; } if (infoList.Count > 1) { displayName = displayName + "\n(" + info.ID + ")"; } var logoPath = GetDisplayIconPath(package.InstalledLocation.Path, appXInfo.ApplicationIcon); if (string.IsNullOrEmpty(logoPath)) { logoPath = ExtractDisplayIcon(package.InstalledLocation.Path, info.Logo); } model.Logo = logoPath; model.AppInfo = new KeyValuePair <string, string>(appUserModelId, displayName); } else { using (var subKey = key.OpenSubKey(appUserModelId)) { var appName = subKey?.GetValue("AppName"); if (appName != null) { displayName = ExtractDisplayName(package, appName.ToString()); } if (string.IsNullOrEmpty(displayName) || displayName.Contains("ms-resource:")) { continue; } if (infoList.Count > 1) { displayName = displayName + "\n(" + info.ID + ")"; } model.AppInfo = new KeyValuePair <string, string>(appUserModelId, displayName); model.Logo = ExtractDisplayIcon(package.InstalledLocation.Path, info.Logo); } } apps.Add(model); } } } catch (Exception exception) { Logging.LogMessage(package.Id.FullName); Logging.LogException(exception); continue; } } } else { foreach (var package in packages) { try { List <AppInfo> infoList = ReadAppInfosFromManifest(package.InstalledLocation.Path); if (infoList == null) { continue; } foreach (var info in infoList) { string displayName = ExtractDisplayName(package.InstalledLocation.Path, package.Id.Name, info.DisplayName); string logo = ExtractDisplayIcon(package.InstalledLocation.Path, info.Logo); var color = ColorConverter.ConvertFromString(info.BackgroundColor); if (color == null) { continue; } var model = new Model { AppInfo = new KeyValuePair <string, string>(GetAppUserModelId(package.Id.FullName), displayName), BackgroundColor = (Color)color == Colors.Transparent ? SystemParameters.WindowGlassBrush : new SolidColorBrush((Color)color), Logo = logo }; model.BackgroundColor.Freeze(); apps.Add(model); } } catch (Exception exception) { Logging.LogMessage(package.Id.FullName); Logging.LogException(exception); continue; } } } }); getAppsTask.ContinueWith(task => { string message = null; if (task.Exception != null) { foreach (var item in task.Exception.InnerExceptions) { Logging.LogException(item); message = item.Message; } } comboBox.Dispatcher.BeginInvoke(new Action(() => { if (message != null) { TipTextBlock.Text = message; return; } if (apps.Count != 0) { comboBox.ItemsSource = apps.OrderBy(app => app.AppInfo.Value).ToList(); } var launchApp = DataContext as LaunchApp; if (launchApp != null) { comboBox.SelectedItem = (comboBox.ItemsSource as List <Model>)?.Find(m => m.AppInfo.Equals(launchApp.AppInfo)); } TipTextBlock.Text = LocalizationProvider.Instance.GetTextValue("CorePlugins.LaunchApp.Tip"); comboBox.Visibility = Visibility.Visible; })); }); }
protected abstract void StoreResults(CallbackEvent evt, AppInfo app, SessionInfo session, string results);
// TODO Unused session argument, remove in future version public static void AutoLogin(AppInfo info, SessionInfo session) { LoginExtendedAction.AutoLogin(info.OsContext); }
public void RunCallbacks(AppInfo app, SessionInfo session, CallbackEvent evt) { RunCallbacks(app, session, evt, app.eSpaceId, session == null ? (int?)null : app.Tenant.Id); }
public string CanPatch(AppInfo app) { return(null); }
public string CanPatch(AppInfo app) { return null; }
public string Show(string name) { return(JsonFileManager.GetContentJsonFromObject(AppInfo.GetAppInfo().GetConfiguration(name))); }
// Token: 0x06000057 RID: 87 RVA: 0x00007994 File Offset: 0x00005B94 protected override void View() { this.appinfo = DbHelper.ExecuteModel <AppInfo>(this.appid); if (this.appinfo.id == 0) { this.ShowErr("该应用不存在或已被删除。"); } else { if (this.ispost) { string mapPath = FPUtils.GetMapPath(this.webpath + "cache"); string fileName = Path.GetFileName(FPRequest.Files["uploadfile"].FileName); string a = Path.GetExtension(fileName).ToLower(); if (a != ".fpk" && a != ".zip") { this.ShowErr("对不起,该文件不是方配系统应用更新文件类型。"); return; } if (!Directory.Exists(mapPath)) { Directory.CreateDirectory(mapPath); } if (File.Exists(mapPath + "\\" + fileName)) { File.Delete(mapPath + "\\" + fileName); } FPRequest.Files["uploadfile"].SaveAs(mapPath + "\\" + fileName); if (Directory.Exists(mapPath + "\\" + Path.GetFileNameWithoutExtension(fileName))) { Directory.Delete(mapPath + "\\" + Path.GetFileNameWithoutExtension(fileName), true); } FPZip.UnZipFile(mapPath + "\\" + fileName, ""); File.Delete(mapPath + "\\" + fileName); if (!File.Exists(mapPath + "\\" + Path.GetFileNameWithoutExtension(fileName) + "\\app.config")) { Directory.Delete(mapPath + "\\" + Path.GetFileNameWithoutExtension(fileName), true); this.ShowErr("应用配置文件不存在或有错误。"); return; } AppInfo appInfo = FPSerializer.Load <AppInfo>(mapPath + "\\" + Path.GetFileNameWithoutExtension(fileName) + "\\app.config"); if (this.appinfo.guid == "") { this.ShowErr("对不起,该应用标识码错误,更新失败。"); return; } SqlParam sqlParam = DbHelper.MakeAndWhere("guid", this.appinfo.guid); this.appinfo = DbHelper.ExecuteModel <AppInfo>(new SqlParam[] { sqlParam }); if (this.appinfo.id == 0) { this.ShowErr("对不起,该应用不存在或已被删除。"); return; } Version v = new Version(FPUtils.StrToDecimal(appInfo.version).ToString("0.0")); Version v2 = new Version(FPUtils.StrToDecimal(this.appinfo.version).ToString("0.0")); if (v < v2) { this.ShowErr("对不起,您更新的版本比安装版本还低,不能更新"); return; } this.appinfo.name = appInfo.name; this.appinfo.version = appInfo.version; this.appinfo.notes = appInfo.notes; this.appinfo.author = appInfo.author; string mapPath2 = FPUtils.GetMapPath(this.webpath + this.appinfo.installpath); string sourcePath = mapPath + "\\" + Path.GetFileNameWithoutExtension(fileName); this.appinfo.files = appupdate.CopyDirectory(sourcePath, mapPath2, "", this.appinfo.files); if (DbHelper.ExecuteUpdate <AppInfo>(this.appinfo) > 0) { foreach (string strContent in appInfo.sortapps.Split(new char[] { '|' })) { string[] array2 = FPUtils.SplitString(strContent, ",", 4); if (!(array2[0] == "")) { SqlParam[] sqlparams = new SqlParam[] { DbHelper.MakeAndWhere("appid", this.appinfo.id), DbHelper.MakeAndWhere("name", array2[0]) }; SortAppInfo sortAppInfo = DbHelper.ExecuteModel <SortAppInfo>(sqlparams); if (sortAppInfo.id > 0) { sortAppInfo.name = array2[0]; sortAppInfo.markup = array2[1]; sortAppInfo.indexpage = array2[2]; sortAppInfo.viewpage = array2[3]; DbHelper.ExecuteUpdate <SortAppInfo>(sortAppInfo); } else { sortAppInfo.appid = this.appinfo.id; sortAppInfo.name = array2[0]; sortAppInfo.markup = array2[1]; sortAppInfo.indexpage = array2[2]; sortAppInfo.viewpage = array2[3]; DbHelper.ExecuteInsert <SortAppInfo>(sortAppInfo); } } } } Directory.Delete(mapPath + "\\" + Path.GetFileNameWithoutExtension(fileName), true); CacheBll.RemoveSortCache(); base.Response.Redirect("appmanage.aspx"); } base.SaveRightURL(); } }
public void RequestAppInfo(uint appId, bool bForce = false) { if ((AppInfo.ContainsKey(appId) && !bForce) || bAborted) { return; } bool completed = false; Action <SteamApps.PICSTokensCallback> cbMethodTokens = (appTokens) => { completed = true; if (appTokens.AppTokensDenied.Contains(appId)) { Log.Info("Insufficient privileges to get access token for app {0}", appId); } foreach (var token_dict in appTokens.AppTokens) { this.AppTokens[token_dict.Key] = token_dict.Value; } }; WaitUntilCallback(() => { callbacks.Subscribe(steamApps.PICSGetAccessTokens(new List <uint>() { appId }, new List <uint>() { }), cbMethodTokens); }, () => { return(completed); }); completed = false; Action <SteamApps.PICSProductInfoCallback> cbMethod = (appInfo) => { completed = !appInfo.ResponsePending; foreach (var app_value in appInfo.Apps) { var app = app_value.Value; Log.Info("Got AppInfo for {0}", app.ID); AppInfo[app.ID] = app; } foreach (var app in appInfo.UnknownApps) { AppInfo[app] = null; } }; SteamApps.PICSRequest request = new SteamApps.PICSRequest(appId); if (AppTokens.ContainsKey(appId)) { request.AccessToken = AppTokens[appId]; request.Public = false; } WaitUntilCallback(() => { callbacks.Subscribe(steamApps.PICSGetProductInfo(new List <SteamApps.PICSRequest>() { request }, new List <SteamApps.PICSRequest>() { }), cbMethod); }, () => { return(completed); }); }
async Task GenerateIcon(AppInfo appInfo, IconInfo iconInfo, StorageFolder folder) { // Draw the icon image into a command list. var commandList = new CanvasCommandList(device); using (var ds = commandList.CreateDrawingSession()) { appInfo.DrawIconImage(ds, iconInfo); } ICanvasImage iconImage = commandList; // Rasterize into a rendertarget. var renderTarget = new CanvasRenderTarget(device, iconInfo.Width, iconInfo.Height, 96); using (var ds = renderTarget.CreateDrawingSession()) { // Initialize with the appropriate background color. ds.Clear(iconInfo.TransparentBackground ? Colors.Transparent : appInfo.BackgroundColor); // Work out where to position the icon image. var imageBounds = iconImage.GetBounds(ds); imageBounds.Height *= 1 + iconInfo.BottomPadding; float scaleUpTheSmallerIcons = Math.Max(1, 1 + (60f - iconInfo.Width) / 50f); float imageScale = appInfo.ImageScale * scaleUpTheSmallerIcons; var transform = Matrix3x2.CreateTranslation((float)-imageBounds.X, (float)-imageBounds.Y) * Utils.GetDisplayTransform(renderTarget.Size.ToVector2(), new Vector2((float)imageBounds.Width, (float)imageBounds.Height)) * Matrix3x2.CreateScale(imageScale, renderTarget.Size.ToVector2() / 2); if (iconInfo.Monochrome) { // Optionally convert to monochrome. iconImage = new DiscreteTransferEffect { Source = new Transform2DEffect { Source = new LuminanceToAlphaEffect { Source = iconImage }, TransformMatrix = transform }, RedTable = new float[] { 1 }, GreenTable = new float[] { 1 }, BlueTable = new float[] { 1 }, AlphaTable = new float[] { 0, 1 } }; } else { ds.Transform = transform; // Optional shadow effect. if (appInfo.AddShadow) { var shadow = new ShadowEffect { Source = iconImage, BlurAmount = 12, }; ds.DrawImage(shadow); } } // draw the main icon image. ds.DrawImage(iconImage); } // Save to a file. using (var stream = await folder.OpenStreamForWriteAsync(iconInfo.Filename, CreationCollisionOption.ReplaceExisting)) { await renderTarget.SaveAsync(stream.AsRandomAccessStream(), CanvasBitmapFileFormat.Png); } }
private void AppSettingsButton_Click(object sender, RoutedEventArgs e) { AppInfo.ShowSettingsUI(); }
private void OpenSettings() { AppInfo.ShowSettingsUI(); }
public void ShouldConstructWithCorrectTitle() { var info = new AppInfo("foobar", "fizz", "alice", "@home", Category.Application); Assert.AreEqual("foobar", info.Title); }
private List <AppInfo> ReadAppInfosFromManifest(string path) { var file = Path.Combine(path, "AppxManifest.xml"); if (!File.Exists(file)) { return(null); } List <AppInfo> list = new List <AppInfo>(); using (var xtr = new XmlTextReader(file) { WhitespaceHandling = WhitespaceHandling.None }) { if (xtr.ReadToFollowing("Applications")) { if (xtr.ReadToDescendant("Application")) { int depth = xtr.Depth; do { if (xtr.NodeType != XmlNodeType.Element || xtr.Depth > depth) { continue; } var id = xtr.GetAttribute("Id"); if (string.IsNullOrWhiteSpace(id)) { continue; } AppInfo info = new AppInfo { ID = id }; while (xtr.Read()) { if (xtr.NodeType != XmlNodeType.Element) { continue; } if ("VisualElements".Equals(xtr.LocalName, StringComparison.OrdinalIgnoreCase)) { info.BackgroundColor = xtr.GetAttribute("BackgroundColor"); info.DisplayName = xtr.GetAttribute("DisplayName"); info.Logo = xtr.GetAttribute("Square44x44Logo"); list.Add(info); break; } } }while (xtr.Read() && xtr.Depth >= depth); if (list.Count > 0) { return(list); } } } } return(null); }
public void ShouldConstructWithCorrectDescription() { var info = new AppInfo("foobar", "My description", "test", "foo", Category.Game); Assert.AreEqual("My description", info.Description); }
/// <summary> /// Creates the map view and adds locations /// </summary> /// <param name="appInfo">app info object to use for initialising</param> private void CreateMapView(AppInfo appInfo) { this.mapView.Create(appInfo.AreaRectangle, 14); this.mapView.AddLocationList(this.locationList); }
/// <summary> /// Invoked when the Functional agent is activated. This is /// the entry point. /// </summary> /// <returns>true on success</returns> public override bool Activate() { _scannerShown = false; ExitCode = CompletionCode.ContextSwitch; _appToLaunchInfo = null; _launchAppScanner = Context.AppPanelManager.CreatePanel("LaunchAppScanner") as LaunchAppScanner; if (_launchAppScanner != null) { _launchAppScanner.FormClosing += _form_FormClosing; _launchAppScanner.EvtQuit += _launchAppScanner_EvtQuit; _launchAppScanner.EvtLaunchApp += _launchAppScanner_EvtLaunchApp; Context.AppPanelManager.ShowDialog(_launchAppScanner); } return true; }
public FileInfo GetTargetFile(AppInfo app) { var file = Combine(app.BaseDirectory.FullName, "PillarsOfEternityII_Data", "Managed", "Assembly-CSharp.dll"); return(new FileInfo(file)); }
/// <summary> /// Launch the specified app /// </summary> /// <param name="info">info about the app</param> /// <returns>true on success</returns> private bool launchProcess(AppInfo info) { bool retVal = true; var startInfo = new ProcessStartInfo { FileName = info.Path, Arguments = normalizeCommandLine(info.CommandLine) }; try { var process = Process.Start(startInfo); if (process == null) { retVal = false; } else { waitForProcessAndActivate(process); } } catch (Exception ex) { Log.Debug(ex.ToString()); retVal = false; } return retVal; }
public Task InitializeAsync(AppInfo info) { Called?.Invoke(this, new MockCall(nameof(InitializeAsync), info)); return(Task.CompletedTask); }
/// <summary> /// Request came in to launch an app /// </summary> /// <param name="sender">event sender</param> /// <param name="appinfo">which app to launch</param> private void _launchAppScanner_EvtLaunchApp(object sender, AppInfo appInfo) { _appToLaunchInfo = appInfo; launchProcess(_appToLaunchInfo); closeScanner(); Close(); }