コード例 #1
0
        public static PackageWrapper GetWrapperFromPackage(Package package)
        {
            if (package == null)
            {
                throw new ArgumentNullException(nameof(package));
            }

            string path;

            try
            {
                path = package.InstalledLocation.Path;
            }
            catch (Exception e) when(e is ArgumentException || e is FileNotFoundException)
            {
                ProgramLogger.LogException($"PackageWrapper", "GetWrapperFromPackage", "package.InstalledLocation.Path", $"Exception {package.Id.Name}", e);
                return(new PackageWrapper(
                           package.Id.Name,
                           package.Id.FullName,
                           package.Id.FamilyName,
                           package.IsFramework,
                           package.IsDevelopmentMode,
                           string.Empty));
            }

            return(new PackageWrapper(
                       package.Id.Name,
                       package.Id.FullName,
                       package.Id.FamilyName,
                       package.IsFramework,
                       package.IsDevelopmentMode,
                       path
                       ));
        }
コード例 #2
0
        public async Task <string> MD2HTML(string MarkdownContent, bool IsMobile) =>
        await Task.Run(async() =>
        {
            var body = md2body(MarkdownContent);

            Windows.ApplicationModel.Package package = Windows.ApplicationModel.Package.Current;

            StorageFolder highlightJSFolder = await package.InstalledLocation.GetFolderAsync("highlighting.js");
            var highlightJSFile             = await highlightJSFolder.GetFileAsync("highlight.js");
            var js = await FileIO.ReadTextAsync(highlightJSFile);

            var highlightJSCSSFile = await(await highlightJSFolder.GetFolderAsync("styles")).GetFileAsync("default.css");
            var js_css             = await FileIO.ReadTextAsync(highlightJSCSSFile);

            var cssFolder = await package.InstalledLocation.GetFolderAsync("css");

            string fileName = "Default.css";
            if (ApplicationData.Current.LocalSettings.Values.Keys.Contains("UseLightTheme") && !(bool)ApplicationData.Current.LocalSettings.Values["UseLightTheme"])
            {
                fileName = "Retro.css";
            }
            var cssFile = await cssFolder.GetFileAsync(fileName);
            var css     = await FileIO.ReadTextAsync(cssFile);


            return(merge(body, new string[] { js_css, css }, new string[] { js, "hljs.initHighlightingOnLoad();" }));
        });
コード例 #3
0
        public SettingsPage()
        {
            this.InitializeComponent();

            SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible;

            // set app version
            Windows.ApplicationModel.Package        pkg     = Windows.ApplicationModel.Package.Current;
            Windows.ApplicationModel.PackageVersion version = pkg.Id.Version;
            versionNumber.Text = "version: " +
                                 version.Major.ToString() + "." +
                                 version.Minor.ToString() + "." +
                                 version.Build.ToString() + "." +
                                 version.Revision.ToString();

            SetBackgroundMode();
            SetSecondsMode();
            SetColorMode();
            SetSoundMode();
            SetPlacementMode();
            SetFontMode();

            timer          = new DispatcherTimer();
            timer.Interval = TimeSpan.FromSeconds(1);
            timer.Tick    += Timer_Tick;
            timer.Start();
        }
コード例 #4
0
        private async Task <Chapter> LoadData(int index, string title)
        {
            int[] count = this.GetCounts(this.fontsize);

            OKrStorage storage = new OKrStorage();

            Windows.ApplicationModel.Package package           = Windows.ApplicationModel.Package.Current;
            Windows.Storage.StorageFolder    installedLocation = package.InstalledLocation;

            this.chapter = this.book.Chapters[index];

            var file = await StorageFile.GetFileFromPathAsync(Path.Combine(Windows.ApplicationModel.Package.Current.InstalledLocation.Path, @"Assets\Data\book\" + this.chapter.FileName + ".txt"));

            var content = await FileIO.ReadTextAsync(file, Windows.Storage.Streams.UnicodeEncoding.Utf8);

            Chapter chapter = null;

            if (content != null)
            {
                chapter           = TextParser.GetChapter(content, count);
                chapter.Title     = title;
                chapter.ChapterNo = index;
            }

            return(chapter);
        }
コード例 #5
0
        private static StoreApp getAppFromNode(Windows.ApplicationModel.Package package, string packagePath,
                                               XmlNode appNode, XmlNamespaceManager xmlnsManager)
        {
            XmlNode appIdNode = appNode.SelectSingleNode("@Id", xmlnsManager);

            if (appIdNode == null)
            {
                return(null);
            }

            Dictionary <IconSize, string> icons = getIcons(packagePath, appNode, xmlnsManager);

            StoreApp storeApp = new StoreApp(package.Id.FamilyName + "!" + appIdNode.Value)
            {
                DisplayName        = getDisplayName(package.Id.Name, packagePath, appNode, xmlnsManager),
                SmallIconPath      = icons[IconSize.Small],
                MediumIconPath     = icons[IconSize.Medium],
                LargeIconPath      = icons[IconSize.Large],
                ExtraLargeIconPath = icons[IconSize.ExtraLarge],
                JumboIconPath      = icons[IconSize.Jumbo],
                IconColor          = getPlateColor(icons[IconSize.Small], appNode, xmlnsManager),
                EntryPoint         = getEntryPoint(appNode, xmlnsManager)
            };

            return(storeApp);
        }
コード例 #6
0
        public static PackageWrapper GetWrapperFromPackage(Package package)
        {
            if (package == null)
            {
                throw new ArgumentNullException(nameof(package));
            }

            string path;

            try
            {
                path = IsPackageDotInstallationPathAvailable.Value ? GetInstalledPath(package) : package.InstalledLocation.Path;
            }
            catch (Exception e) when(e is ArgumentException || e is FileNotFoundException || e is DirectoryNotFoundException)
            {
                ProgramLogger.Exception($"Exception {package.Id.Name}", e, MethodBase.GetCurrentMethod().DeclaringType, "Path could not be determined");
                return(new PackageWrapper(
                           package.Id.Name,
                           package.Id.FullName,
                           package.Id.FamilyName,
                           package.IsFramework,
                           package.IsDevelopmentMode,
                           string.Empty));
            }

            return(new PackageWrapper(
                       package.Id.Name,
                       package.Id.FullName,
                       package.Id.FamilyName,
                       package.IsFramework,
                       package.IsDevelopmentMode,
                       path));
        }
コード例 #7
0
        private async void Email_B_Click(object sender, RoutedEventArgs e)
        {
            Windows.System.Profile.AnalyticsVersionInfo analyticsVersion = Windows.System.Profile.AnalyticsInfo.VersionInfo;
            var body = "";

            body += "平台" + analyticsVersion.DeviceFamily;
            body += System.Environment.NewLine;
            ulong v  = ulong.Parse(Windows.System.Profile.AnalyticsInfo.VersionInfo.DeviceFamilyVersion);
            ulong v1 = (v & 0xFFFF000000000000L) >> 48;
            ulong v2 = (v & 0x0000FFFF00000000L) >> 32;
            ulong v3 = (v & 0x00000000FFFF0000L) >> 16;
            ulong v4 = (v & 0x000000000000FFFFL);

            body += "    版本" + $"{v1}.{v2}.{v3}.{v4}";
            body += System.Environment.NewLine;
            Windows.ApplicationModel.Package package = Windows.ApplicationModel.Package.Current;
            body += "   应用平台 " + package.Id.Architecture.ToString();
            body += System.Environment.NewLine;
            body += "   程序名称 " + "Komorenobi_UWP";
            EasClientDeviceInformation eas = new EasClientDeviceInformation();

            body += System.Environment.NewLine;
            body += "   机器制造商" + eas.SystemManufacturer;
            var address = "*****@*****.**";
            var subject = "反馈:";


            var mailto = new Uri($"mailto:{address}?subject={subject}&body={body}");
            await Launcher.LaunchUriAsync(mailto);
        }
コード例 #8
0
        public PackageDeploymentControl(Windows.ApplicationModel.Package Package)
        {
            this.InitializeComponent();

            this.deployedPackage = Package;

            SetupControl();
        }
コード例 #9
0
 public UserAppPackageDataModel(Windows.ApplicationModel.Package package)
 {
     this.AppPackageName       = package.Id.Name;
     this.AppPackageFullName   = package.Id.FullName;
     this.AppPackageFamilyName = package.Id.FamilyName;
     this.AppPublisherName     = package.Id.Publisher;
     this.AppPackageVersion    = string.Format("{0}.{1}.{2}.{3}", package.Id.Version.Major, package.Id.Version.Minor,
                                               package.Id.Version.Build, package.Id.Version.Revision);
 }
        public OptionalPackageControl(Pages.OptionalPackagesPage OptionalPackagesPage, Windows.ApplicationModel.Package OptionalPackage)
        {
            this.InitializeComponent();

            optionalPackagesPage = OptionalPackagesPage;
            optionalPackage      = OptionalPackage;

            SetupControl();
        }
コード例 #11
0
 public static PackageWrapper GetWrapperFromPackage(Package package)
 {
     return(new PackageWrapper(
                package.Id.Name,
                package.Id.FullName,
                package.Id.FamilyName,
                package.IsFramework,
                package.IsDevelopmentMode,
                package.InstalledLocation.Path
                ));
 }
コード例 #12
0
 private static StorageFolder SafeDirectory(Windows.ApplicationModel.Package package)
 {
     try
     {
         return(package.InstalledLocation);
     }
     catch (Exception)
     {
         return(null);
     }
 }
コード例 #13
0
ファイル: Package.cs プロジェクト: baskren/Pontoon
        private Package()
        {
#if __ANDROID__
            _packageInfo = Android.App.Application.Context.PackageManager.GetPackageInfo(Android.App.Application.Context.PackageName, PackageInfoFlags.MetaData);
#elif __UNIFIED__
            _mainBundle = NSBundle.MainBundle;
#elif WINDOWS_UWP || WINDOWS_APP || WINDOWS_PHONE_APP || WINDOWS_PHONE_81
            _package = Windows.ApplicationModel.Package.Current;
#elif TIZEN
            _info = Tizen.Applications.Application.Current.ApplicationInfo;
#endif
        }
コード例 #14
0
 public void PageRefresh()
 {
     Windows.ApplicationModel.Package        ThisPackage = Windows.ApplicationModel.Package.Current;
     Windows.ApplicationModel.PackageId      ThisId      = ThisPackage.Id;
     Windows.ApplicationModel.PackageVersion ThisVersion = ThisId.Version;
     NameOfApp.Text    = ThisPackage.DisplayName;
     VersionOfApp.Text = String.Format("版本: {0}.{1}.{2}.{3} [{4}]",
                                       ThisVersion.Major, ThisVersion.Minor, ThisVersion.Build, ThisVersion.Revision,
                                       ThisId.Architecture);
     InstalledDateOfApp.Text = Windows.ApplicationModel.Package.Current.InstalledDate.ToString("安装日期: yyyy-MM-dd");
     Debug.WriteLine("刷新了" + this.GetType().ToString() + "的内容");
 }
コード例 #15
0
        private static PackageWrapper TryGetWrapperFromPackage(Package package)
        {
            try
            {
                return(PackageWrapper.GetWrapperFromPackage(package));
            }
            catch (Exception e)
            {
                Log.Error(e.Message, typeof(PackageManagerWrapper));
            }

            return(null);
        }
コード例 #16
0
        private static string getPackagePath(Windows.ApplicationModel.Package package)
        {
            string path = "";

            // need to catch a system-thrown exception...
            try
            {
                path = package.InstalledLocation.Path;
            }
            catch {}

            return(path);
        }
コード例 #17
0
ファイル: Adapter.cs プロジェクト: alljoyn/dsb
        public Adapter()
        {
            byte[] ConfigurationDataPtr;
            if (GetConfiguration(out ConfigurationDataPtr) == ERROR_SUCCESS)
            {
                var temp = System.Text.Encoding.UTF8.GetString(ConfigurationDataPtr);
                m_gateway = new ModbusGateway(System.Text.Encoding.UTF8.GetString(ConfigurationDataPtr));  // The Designated IP address of the Modbus Gateway
            }

            Windows.ApplicationModel.Package        package        = Windows.ApplicationModel.Package.Current;
            Windows.ApplicationModel.PackageId      packageId      = package.Id;
            Windows.ApplicationModel.PackageVersion versionFromPkg = packageId.Version;

            this.Vendor      = "Microsoft";
            this.AdapterName = "Modbus Device System Bridge";

            // the adapter prefix must be something like "com.mycompany" (only alpha num and dots)
            // it is used by the Device System Bridge as root string for all services and interfaces it exposes
            this.ExposedAdapterPrefix   = "com." + this.Vendor.ToLower();
            this.ExposedApplicationGuid = Guid.Parse("{0xd3982475,0x38eb,0x4e53,{0xb8,0xd8,0x54,0x04,0xd8,0x78,0x88,0x1a}}");

            if (null != package && null != packageId)
            {
                this.ExposedApplicationName = packageId.Name;
                this.Version = versionFromPkg.Major.ToString() + "." +
                               versionFromPkg.Minor.ToString() + "." +
                               versionFromPkg.Revision.ToString() + "." +
                               versionFromPkg.Build.ToString();
            }
            else
            {
                this.ExposedApplicationName = "ModbusDeviceSystemBridge";
                this.Version = "0.0.0.0";
            }

            try
            {
                this.Signals         = new List <IAdapterSignal>();
                this.devices         = new List <IAdapterDevice>();
                this.signalListeners = new Dictionary <int, IList <SIGNAL_LISTENER_ENTRY> >();

                //Create Adapter Signals
                this.createSignals();
            }
            catch (OutOfMemoryException ex)
            {
                throw;
            }
        }
コード例 #18
0
        public Adapter()
        {
            Windows.ApplicationModel.Package        package        = Windows.ApplicationModel.Package.Current;
            Windows.ApplicationModel.PackageId      packageId      = package.Id;
            Windows.ApplicationModel.PackageVersion versionFromPkg = packageId.Version;

            this.Vendor      = "Morten Nielsen";
            this.AdapterName = "Philips Hue DSB";

            // the adapter prefix must be something like "com.mycompany" (only alpha num and dots)
            // it is used by the Device System Bridge as root string for all services and interfaces it exposes
            this.ExposedAdapterPrefix   = "com.dotMorten";
            this.ExposedApplicationGuid = Guid.Parse("{0x07c19f14,0x76c6,0x4d2f,{0xb4,0xd1,0x7d,0x4f,0x89,0x24,0x17,0x36}}");

            if (null != package && null != packageId)
            {
                this.ExposedApplicationName = packageId.Name;
                this.Version = versionFromPkg.Major.ToString() + "." +
                               versionFromPkg.Minor.ToString() + "." +
                               versionFromPkg.Revision.ToString() + "." +
                               versionFromPkg.Build.ToString();
            }
            else
            {
                this.ExposedApplicationName = "PhilipsHueDeviceSystemBridge";
                this.Version = "0.0.0.0";
            }

            try
            {
                this.Signals         = new List <IAdapterSignal>();
                this.devices         = new List <IAdapterDevice>();
                this.signalListeners = new Dictionary <int, IList <SIGNAL_LISTENER_ENTRY> >();

                //var EnableJoinMethod = new AdapterMethod("Find Hue Bridges", "Searches for new hue bridges", 0);
                //EnableJoinMethod.InvokeAction = LoadBridges;

                //Create Adapter Signals
                this.createSignals();

                checkForBridgesTimer = new System.Threading.Timer((s) => { LoadBridges(); }, null,
                                                                  0, (int)TimeSpan.FromMinutes(5).TotalMilliseconds);
            }
            catch (OutOfMemoryException)
            {
                throw;
            }
        }
コード例 #19
0
        public BridgeAdapter(string adapterName)
        {
            Windows.ApplicationModel.Package        package        = Windows.ApplicationModel.Package.Current;
            Windows.ApplicationModel.PackageId      packageId      = package.Id;
            Windows.ApplicationModel.PackageVersion versionFromPkg = packageId.Version;

            this.Vendor      = "win10";
            this.AdapterName = adapterName;

            // the adapter prefix must be something like "com.mycompany" (only alpha num and dots)
            // it is used by the Device System Bridge as root string for all services and interfaces it exposes
            this.ExposedAdapterPrefix   = "com." + this.Vendor.ToLower();
            this.ExposedApplicationGuid = Guid.Parse("{0x6516a3e3,0xcc3e,0x4c67,{0xb7,0x5f,0x73,0x75,0x8b,0x09,0x23,0xae}}");

            if (null != package && null != packageId)
            {
                this.ExposedApplicationName = packageId.Name;
                this.Version = versionFromPkg.Major.ToString() + "." +
                               versionFromPkg.Minor.ToString() + "." +
                               versionFromPkg.Revision.ToString() + "." +
                               versionFromPkg.Build.ToString();
            }
            else
            {
                this.ExposedApplicationName = "DeviceSystemBridge";
                this.Version = "0.0.0.0";
            }

            this.Signals         = new List <IAdapterSignal>();
            this.devices         = new List <IAdapterDevice>();
            this.signalListeners = new Dictionary <int, IList <SIGNAL_LISTENER_ENTRY> >();

            // Device Arrival Signal
            var deviceArrivalSignal  = new BridgeAdapterSignal(Constants.DEVICE_ARRIVAL_SIGNAL);
            var deviceHandle_arrival = new BridgeAdapterValue(Constants.DEVICE_ARRIVAL__DEVICE_HANDLE, null);

            deviceArrivalSignal.Params.Add(deviceHandle_arrival);
            this.Signals.Add(deviceArrivalSignal);

            // Device Removal Signal
            var deviceRemovalSignal  = new BridgeAdapterSignal(Constants.DEVICE_REMOVAL_SIGNAL);
            var deviceHandle_removal = new BridgeAdapterValue(Constants.DEVICE_REMOVAL__DEVICE_HANDLE, null);

            deviceRemovalSignal.Params.Add(deviceHandle_removal);
            this.Signals.Add(deviceRemovalSignal);
        }
コード例 #20
0
        public bool DoesDependencyPackageExist(string packageName, Windows.System.ProcessorArchitecture architecture)
        {
            bool result   = false;
            var  packages = _packageManager.FindPackages().ToList();

            Windows.ApplicationModel.Package installedPackage = null;
            foreach (var pkg in packages)
            {
                if (string.Compare(pkg.Id.Name, packageName, true) == 0 && pkg.Id.Architecture == architecture)
                {
                    var fpkg = _packageManager.FindPackages(pkg.Id.Name, pkg.Id.Publisher).ToList();
                    installedPackage = fpkg.FirstOrDefault();
                    break;
                }
            }

            return(result = (installedPackage != null));
        }
コード例 #21
0
        public Adapter()
        {
            Windows.ApplicationModel.Package        package        = Windows.ApplicationModel.Package.Current;
            Windows.ApplicationModel.PackageId      packageId      = package.Id;
            Windows.ApplicationModel.PackageVersion versionFromPkg = packageId.Version;

            this.DeviceName  = GetDeviceName();
            this.Vendor      = "glovebox";
            this.AdapterName = "rover";

            // the adapter prefix must be something like "com.mycompany" (only alpha num and dots)
            // it is used by the Device System Bridge as root string for all services and interfaces it exposes
            this.ExposedAdapterPrefix   = "com." + this.Vendor.ToLower();
            this.ExposedApplicationGuid = Guid.Parse("{0xc1e7ce4a,0x66fb,0x40e6,{0xb4,0xb7,0x74,0x2b,0x88,0x71,0x83,0x27}}");

            if (null != package && null != packageId)
            {
                this.ExposedApplicationName = packageId.Name;
                this.Version = versionFromPkg.Major.ToString() + "." +
                               versionFromPkg.Minor.ToString() + "." +
                               versionFromPkg.Revision.ToString() + "." +
                               versionFromPkg.Build.ToString();
            }
            else
            {
                this.ExposedApplicationName = "DeviceSystemBridge";
                this.Version = "0.0.0.0";
            }

            try
            {
                this.Signals         = new List <IAdapterSignal>();
                this.devices         = new List <IAdapterDevice>();
                this.signalListeners = new Dictionary <int, IList <SIGNAL_LISTENER_ENTRY> >();

                //Create Adapter Signals
                this.createSignals();
            }
            catch (OutOfMemoryException ex)
            {
                throw;
            }
        }
コード例 #22
0
 public static PackageWrapper GetWrapperFromPackage(Package package)
 {
     try
     {
         return(new PackageWrapper(
                    package.Id.Name,
                    package.Id.FullName,
                    package.Id.FamilyName,
                    package.IsFramework,
                    package.IsDevelopmentMode,
                    package.InstalledLocation.Path
                    ));
     }
     catch (FileNotFoundException ex)
     {
         ProgramLogger.LogException($"PackageWrapper", "GetWrapperFromPackage", "package.InstalledLocation.Path", $"File Not Found for package {package.Id.Name}", ex);
         return(new PackageWrapper());
     }
 }
コード例 #23
0
ファイル: viewModel.cs プロジェクト: xhowar/lindexi_gd
        public void 获取系统信息()
        {
            Windows.System.Profile.AnalyticsVersionInfo analyticsVersion = Windows.System.Profile.AnalyticsInfo.VersionInfo;

            reminder = analyticsVersion.DeviceFamily;

            ulong v  = ulong.Parse(Windows.System.Profile.AnalyticsInfo.VersionInfo.DeviceFamilyVersion);
            ulong v1 = (v & 0xFFFF000000000000L) >> 48;
            ulong v2 = (v & 0x0000FFFF00000000L) >> 32;
            ulong v3 = (v & 0x00000000FFFF0000L) >> 16;
            ulong v4 = (v & 0x000000000000FFFFL);

            reminder = $"{v1}.{v2}.{v3}.{v4}";
            Windows.ApplicationModel.Package package = Windows.ApplicationModel.Package.Current;
            reminder = package.Id.Architecture.ToString();
            reminder = package.DisplayName;
            EasClientDeviceInformation eas = new EasClientDeviceInformation();

            reminder = eas.SystemManufacturer;
        }
コード例 #24
0
        private void DisplayPackageInfo(Windows.ApplicationModel.Package package)
        {
            Console.WriteLine("Name: {0}", package.Id.Name);

            Console.WriteLine("FullName: {0}", package.Id.FullName);

            Console.WriteLine("Version: {0}.{1}.{2}.{3}", package.Id.Version.Major, package.Id.Version.Minor,
                              package.Id.Version.Build, package.Id.Version.Revision);

            Console.WriteLine("Publisher: {0}", package.Id.Publisher);

            Console.WriteLine("PublisherId: {0}", package.Id.PublisherId);

            Console.WriteLine("Installed Location: {0}", package.InstalledLocation.Path);

            //        Console.WriteLine("Architecture: {0}",
            //            Enum.GetName(typeof(Windows.Management.Deployment.PackageArchitecture), package.Id.Architecture));

            Console.WriteLine("IsFramework: {0}", package.IsFramework);
        }
コード例 #25
0
ファイル: Adapter.cs プロジェクト: matchboxmobile/Spectrum
        public Adapter()
        {
            Windows.ApplicationModel.Package        package        = Windows.ApplicationModel.Package.Current;
            Windows.ApplicationModel.PackageId      packageId      = package.Id;
            Windows.ApplicationModel.PackageVersion versionFromPkg = packageId.Version;

            this.Vendor      = VENDOR_NAME;
            this.AdapterName = ADAPTER_NAME;

            this.ExposedAdapterPrefix   = ADAPTER_PREFIX + this.Vendor.ToLower();
            this.ExposedApplicationGuid = Guid.Parse(APLICATION_GUID);

            if (null != package && null != packageId)
            {
                this.ExposedApplicationName = packageId.Name;
                this.Version = versionFromPkg.Major.ToString() + "." +
                               versionFromPkg.Minor.ToString() + "." +
                               versionFromPkg.Revision.ToString() + "." +
                               versionFromPkg.Build.ToString();
            }
            else
            {
                this.ExposedApplicationName = EXPOSED_APPLICATION_NAME;
                this.Version = VERSION_NUMBER;
            }

            try
            {
                this.Signals         = new List <IAdapterSignal>();
                this.devices         = new List <IAdapterDevice>();
                this.signalListeners = new Dictionary <int, IList <SIGNAL_LISTENER_ENTRY> >();

                //Create Adapter Signals
                this.createSignals();
            }
            catch (OutOfMemoryException ex)
            {
                Debug.WriteLine("Out of memory while trying to allocate adapter value parameter containers." + ex.Message);
                throw;
            }
        }
コード例 #26
0
        public static XboxLiveAppConfiguration Load(string path)
        {
            Windows.ApplicationModel.Package package           = Windows.ApplicationModel.Package.Current;
            Windows.Storage.StorageFolder    installedLocation = package.InstalledLocation;

            string fullPath = Path.Combine(installedLocation.Path, path);

            if (!File.Exists(fullPath))
            {
                throw new FileNotFoundException(string.Format("Unable to find Xbox Live app configuration file '{0}'.", path));
            }

            string content = File.ReadAllText(fullPath);

            if (string.IsNullOrWhiteSpace(content))
            {
                throw new XboxException(string.Format("Xbox Live app configeration file '{0}' was empty.", path));
            }

            return(JsonSerialization.FromJson <XboxLiveAppConfiguration>(content));
        }
コード例 #27
0
ファイル: ZigBeeAdapter.cs プロジェクト: alljoyn/dsb
        public Adapter()
        {
            Windows.ApplicationModel.Package        package        = Windows.ApplicationModel.Package.Current;
            Windows.ApplicationModel.PackageId      packageId      = package.Id;
            Windows.ApplicationModel.PackageVersion versionFromPkg = packageId.Version;

            this.Vendor      = AdapterHelper.ADAPTER_VENDOR;
            this.AdapterName = AdapterHelper.ADAPTER_NAME;

            // the adapter prefix must be something like "com.mycompany" (only alpha num and dots)
            // it is used by the Device System Bridge as root string for all services and interfaces it exposes
            this.ExposedAdapterPrefix   = AdapterHelper.ADAPTER_DOMAIN + "." + this.Vendor.ToLower();
            this.ExposedApplicationGuid = Guid.Parse(AdapterHelper.ADAPTER_APPLICATION_GUID);

            if (null != package && null != packageId)
            {
                this.ExposedApplicationName = packageId.Name;
                this.Version = versionFromPkg.Major.ToString() + "." +
                               versionFromPkg.Minor.ToString() + "." +
                               versionFromPkg.Revision.ToString() + "." +
                               versionFromPkg.Build.ToString();
            }
            else
            {
                this.ExposedApplicationName = AdapterHelper.ADAPTER_DEFAULT_APPLICATION_NAME;
                this.Version = AdapterHelper.ADAPTER_DEFAULT_VERSION;
            }

            try
            {
                this.Signals           = new List <IAdapterSignal>();
                this.m_signalListeners = new Dictionary <int, IList <SIGNAL_LISTENER_ENTRY> >();
            }
            catch (OutOfMemoryException ex)
            {
                Debug.WriteLine(ex);
                throw;
            }
        }
コード例 #28
0
        private static string ExtractDisplayName(string dir, Windows.ApplicationModel.Package package, Application application)
        {
            var priPath = Path.Combine(dir, "resources.pri");
            Uri uri;

            if (!Uri.TryCreate(application.VisualElements.DisplayName, UriKind.Absolute, out uri))
            {
                return(application.VisualElements.DisplayName);
            }

            var resource = string.Format("ms-resource://{0}/resources/{1}", package.Id.Name, uri.Segments.Last());
            var name     = NativeMethods.ExtractStringFromPRIFile(priPath, resource);

            if (!string.IsNullOrWhiteSpace(name))
            {
                return(name);
            }

            var res = string.Concat(uri.Segments.Skip(1));

            resource = string.Format("ms-resource://{0}/{1}", package.Id.Name, res);
            return(NativeMethods.ExtractStringFromPRIFile(priPath, resource));
        }
コード例 #29
0
        public MainWindow()
        {
            _configPage = new ConfigPage();
            _configPage.LayoutTransform = _zoomTransform;

            InitializeComponent();

            myApp().DeliverableList.SetConfig(myApp().CurrentConfig);

            // Load config page on startup
            MainFrame.Content = _configPage;

            // grab the version, if we're packaged up
            try
            {
                Windows.ApplicationModel.Package pkg = Windows.ApplicationModel.Package.Current;
                var v = pkg.Id.Version;
                VersionLabel.Content = "ver: " + v.Major + "." + v.Minor + "." + v.Build;
            }
            catch (System.Exception)
            {
                VersionLabel.Content = "Unpackaged";
            }
        }
コード例 #30
0
 // This is a separate method so the reference to .InstalledPath won't be loaded in API versions which do not support this API (e.g. older then Build 19041)
 private static string GetInstalledPath(Package package)
 => package.InstalledPath;
コード例 #31
0
ファイル: Package.cs プロジェクト: inthehand/Charming
        private Package()
        {
#if __ANDROID__
            _packageInfo = Android.App.Application.Context.PackageManager.GetPackageInfo(Android.App.Application.Context.PackageName, PackageInfoFlags.MetaData);
#elif __UNIFIED__
            _mainBundle = NSBundle.MainBundle;
#elif WINDOWS_UWP || WINDOWS_APP || WINDOWS_PHONE_APP || WINDOWS_PHONE_81
            _package = Windows.ApplicationModel.Package.Current;
#elif TIZEN
            _info = Tizen.Applications.Application.Current.ApplicationInfo;
#endif
        }