public void SetComputerName_NewName_RenamePendingIsTrue()
        {
            // Arrange
            Assert.IsFalse(_compNameBridge.IsRenamePending());
            var originalNetBIOSName = new EasClientDeviceInformation().FriendlyName;

            // Make sure the current NetBIOS name does not equal the new test one
            // If it does, alter the postfix on it
            string desiredNewName = $"{NEW_COMPUTERNAME_PREFIX}-1";

            if (String.Equals(
                    originalNetBIOSName,
                    desiredNewName,
                    StringComparison.OrdinalIgnoreCase))
            {
                desiredNewName = $"{NEW_COMPUTERNAME_PREFIX}-2";
            }

            // Act
            _compNameBridge.SetName(desiredNewName);

            // Assert
            var isPending = _compNameBridge.IsRenamePending();

            _compNameBridge.SetName(originalNetBIOSName); // Revert name change
            Assert.IsTrue(isPending);
        }
Ejemplo n.º 2
0
        static SystemInfoHelper()
        {
            AnalyticsVersionInfo ai = AnalyticsInfo.VersionInfo;

            SystemFamily = ai.DeviceFamily;

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

            SystemVersion = $"{v1}.{v2}.{v3}.{v4}";

            Package package = Package.Current;

            SystemArchitecture = package.Id.Architecture.ToString();
            Assembly sdkAssembly = Assembly.Load(new AssemblyName("SensorbergSDK"));
            var      version     = sdkAssembly.GetName().Version;

            SdkVersion      = $"{version.Major}.{version.Minor}.{version.Build}.{version.Revision}";
            ApplicationName = package.DisplayName;
            PackageName     = package.Id.Name;
            PackageVersion pv = package.Id.Version;

            ApplicationVersion = $"{pv.Major}.{pv.Minor}.{pv.Build}.{pv.Revision}";

            EasClientDeviceInformation eas = new EasClientDeviceInformation();

            DeviceManufacturer = eas.SystemManufacturer;
            DeviceModel        = eas.SystemProductName;
            SystemName         = eas.OperatingSystem;
        }
        /// <summary>
        /// Get System information by intern class
        /// </summary>
        /// <param name="returnedInfo">returned Dictionnary filled with new info</param>
        /// <returns></returns>
        public override async Task <Dictionary <string, string> > GetInfos(Dictionary <String, String> returnedInfo)
        {
            returnedInfo = await base.GetInfos(returnedInfo);

            returnedInfo.Add("--------- " + LABEL + " ---------", "----------------");

#if WINDOWS_UWP
            AnalyticsVersionInfo ai = AnalyticsInfo.VersionInfo;

            // get the system family information
            returnedInfo.Add("Device Family", ai.DeviceFamily);

            returnedInfo.Add("Device Family Version", ai.DeviceFamilyVersion);

            // get the system version number
            string sv = AnalyticsInfo.VersionInfo.DeviceFamilyVersion;

            returnedInfo.Add("System Version", parseSystemVersion(sv));
            // get the device manufacturer and model name
            EasClientDeviceInformation eas = new EasClientDeviceInformation();
            returnedInfo.Add("Device Manufacturer", eas.SystemManufacturer);
            returnedInfo.Add("Device Model", eas.SystemProductName);

            // get the device manufacturer, model name, OS details etc.
            returnedInfo.Add("Operating System", eas.OperatingSystem);

            returnedInfo.Add("Friendly Name", eas.FriendlyName);
#endif
            return(returnedInfo);
        }
Ejemplo n.º 4
0
        public static bool isPhone()
        {
            string os = new EasClientDeviceInformation().OperatingSystem;

            os = os.ToLowerInvariant();
            return(os.Contains("phone") || os.Contains("mobile"));
        }
        public static Task <Guid> DoSomeWork()
        {
            // Use some UWP specific API that unavaliable in .NETStandard.
            var deviceInfo = new EasClientDeviceInformation();

            return(Task.FromResult(deviceInfo.Id));
        }
Ejemplo n.º 6
0
        private async void definitionDialogPrimaryButton_Click(ContentDialog sender, ContentDialogButtonClickEventArgs args)
        {
            if (string.IsNullOrEmpty(inputCommentsOrReplies.Text) || inputCommentsOrReplies.Text.Length <= 0)
            {
                await MessageDialogTemplateUtil.showMessageDialog("请填写您的评论", "评论不能为空,请输入您的评论。", MessageDialogStyle.HAVING_BOTH).ShowAsync();
            }
            else if (inputCommentsOrReplies.Text.Length <= 9)
            {
                await MessageDialogTemplateUtil.showMessageDialog("评论字数过少", "您发表的评论字数过少,请至少输入10个字符以上。", MessageDialogStyle.HAVING_BOTH).ShowAsync();
            }
            else
            {
                EasClientDeviceInformation systemInfo = new EasClientDeviceInformation();

                try
                {
                    SingleResultEntity resultEntity = await HTTPRequestHelper <SingleResultEntity> .requestAndResponseSingleResult(MobileInterfaceFactory.PUBLISH_COMMENTS_OR_REPLIES_INFO, "{\"articleId\": " + articleId + ",\"userId\" : " + localSettings.Values["userIdentity"] + ",\"content\" : " + inputCommentsOrReplies.Text + ",\"device\" : " + systemInfo.SystemSku + ",\"system\" : " + systemInfo.OperatingSystem + " }");

                    if (bool.Parse(resultEntity.result.ToString()) == true)
                    {
                        await MessageDialogTemplateUtil.showMessageDialog("评论成功", "恭喜,您的评论/回复消息发布成功!您的评论/回复消息需要人工审核之后才能正常显示,还请您耐心等待哦~", MessageDialogStyle.HAVING_BOTH).ShowAsync();

                        InitMainPageDatas(true);
                    }
                    cOrRList.IsSwipeEnabled = true;
                }
                catch (Exception ex)
                {
                    await MessageDialogTemplateUtil.showMessageDialog("评论失败", "非常抱歉,在您尝试发表评论/回复消息时发生了错误,请稍后再试。\n异常信息为:\n" + ex.Message, MessageDialogStyle.HAVING_BOTH).ShowAsync();
                }
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 获取系统信息
        /// </summary>
        /// <returns></returns>
        public static string GetSystemDetail()
        {
            StringBuilder sb = new StringBuilder();

            try
            {
                EasClientDeviceInformation eas = new EasClientDeviceInformation();
                sb.Append(eas.SystemManufacturer);
                sb.Append(' ');
                sb.Append(eas.SystemProductName);
                sb.Append(' ');

                AnalyticsVersionInfo analyticsVersion = AnalyticsInfo.VersionInfo;
                sb.Append(analyticsVersion.DeviceFamily);
                sb.Append(' ');

                ulong v = ulong.Parse(AnalyticsInfo.VersionInfo.DeviceFamilyVersion);
                sb.Append((v & 0xFFFF000000000000L) >> 48);
                sb.Append('.');
                sb.Append((v & 0x0000FFFF00000000L) >> 32);
                sb.Append('.');
                sb.Append((v & 0x00000000FFFF0000L) >> 16);
                sb.Append('.');
                sb.Append(v & 0x000000000000FFFFL);
                sb.Append(' ');

                Package package = Package.Current;
                sb.Append(package.Id.Architecture);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            return(sb.ToString());
        }
        public PlatformInfo GetPlatformInfo()
        {
#if WINDOWS_PHONE
            return(new PlatformInfo(PlatformType.XamarinFormsWinPhone, Environment.OSVersion.Version));
#elif TOUCH
            Version result;
            Version.TryParse(UIKit.UIDevice.CurrentDevice.SystemVersion, out result);
            return(new PlatformInfo(PlatformType.XamarinFormsiOS, result));
#elif ANDROID
            Version result;
            Version.TryParse(global::Android.OS.Build.VERSION.Release, out result);
            return(new PlatformInfo(PlatformType.XamarinFormsAndroid, result));
#elif WINDOWS_UWP
            // get the system version number
            var deviceFamilyVersion = AnalyticsInfo.VersionInfo.DeviceFamilyVersion;
            var version             = ulong.Parse(deviceFamilyVersion);
            var majorVersion        = (version & 0xFFFF000000000000L) >> 48;
            var minorVersion        = (version & 0x0000FFFF00000000L) >> 32;
            var buildVersion        = (version & 0x00000000FFFF0000L) >> 16;
            var revisionVersion     = (version & 0x000000000000FFFFL);
            var isPhone             = new EasClientDeviceInformation().OperatingSystem.SafeContains("WindowsPhone", StringComparison.OrdinalIgnoreCase);
            return(new PlatformInfo(isPhone ? PlatformType.XamarinFormsUWPPhone : PlatformType.XamarinFormsUWP,
                                    new Version((int)majorVersion, (int)minorVersion, (int)buildVersion, (int)revisionVersion)));
#elif NETFX_CORE
            var isPhone   = new EasClientDeviceInformation().OperatingSystem.SafeContains("WindowsPhone", StringComparison.OrdinalIgnoreCase);
            var isWinRT10 = typeof(DependencyObject).GetMethodEx("RegisterPropertyChangedCallback", MemberFlags.Instance | MemberFlags.Public) != null;
            var version   = isWinRT10 ? new Version(10, 0) : new Version(8, 1);
            return(new PlatformInfo(isPhone ? PlatformType.XamarinFormsWinRTPhone : PlatformType.XamarinFormsWinRT, version));
#endif
        }
Ejemplo n.º 9
0
 static void Init()
 {
     if (_type == DeviceTypes.Unknown)
     {
         var deviceInfo = new EasClientDeviceInformation();
         _productName = deviceInfo.SystemProductName;
         if (deviceInfo.SystemProductName.IndexOf("MinnowBoard", StringComparison.OrdinalIgnoreCase) >= 0)
         {
             _type = DeviceTypes.MBM;
         }
         else if (deviceInfo.SystemProductName.IndexOf("Raspberry", StringComparison.OrdinalIgnoreCase) >= 0)
         {
             if (deviceInfo.SystemProductName.IndexOf("Pi 3", StringComparison.OrdinalIgnoreCase) >= 0)
             {
                 _type = DeviceTypes.RPI3;
             }
             else
             {
                 _type = DeviceTypes.RPI2;
             }
         }
         else if (deviceInfo.SystemProductName == "SBC")
         {
             _type = DeviceTypes.DB410;
         }
         else
         {
             _type = DeviceTypes.GenericBoard;
         }
     }
 }
Ejemplo n.º 10
0
        public RaygunEnvironmentMessage()
        {
            Locale = CultureInfo.CurrentCulture.DisplayName;

            DateTime now = DateTime.Now;

            UtcOffset = TimeZoneInfo.Local.GetUtcOffset(now).TotalHours;

            if (Window.Current != null)
            {
                WindowBoundsWidth  = Window.Current.Bounds.Width;
                WindowBoundsHeight = Window.Current.Bounds.Height;

                var sensor = Windows.Devices.Sensors.SimpleOrientationSensor.GetDefault();

                if (sensor != null)
                {
                    CurrentOrientation = sensor.GetCurrentOrientation().ToString();
                }
            }

            var deviceInfo = new EasClientDeviceInformation();

            try
            {
                DeviceManufacturer = deviceInfo.SystemManufacturer;
                DeviceName         = deviceInfo.SystemProductName;
                OSVersion          = deviceInfo.OperatingSystem;
            }
            catch (Exception e)
            {
                Debug.WriteLine("Failed to get device information: {0}", e.Message);
            }
        }
Ejemplo n.º 11
0
        /// <summary>
        /// 开始发送使用信息
        /// </summary>
        /// <param name="mod"></param>
        private async void Begin_tongji_Run(string mod)
        {
            try
            {
                ClassHttp CH = new ClassHttp();
                CH.HttpURL = URLSTR.tongji;
                IDictionary <string, string> CS = new Dictionary <string, string>();
                //可选参数,但如果要获取的地址不是网页,而是一个文件或图片,服务器一般默认配置不接受Post进而导致无法获取到。
                //直接使用图片地址的,不要设置这个参数,避免使用Post方式,直接传递null。

                HardwareToken hardwareToken = HardwareIdentification.GetPackageSpecificToken(null);
                EasClientDeviceInformation easClientDeviceInformation = new EasClientDeviceInformation();


                CS["mod"] = mod;
                CS["hardwareToken_Id"]                              = Buffer2Base64(hardwareToken.Id);
                CS["hardwareToken_Signature"]                       = Buffer2Base64(hardwareToken.Signature);
                CS["hardwareToken_Certificate"]                     = Buffer2Base64(hardwareToken.Certificate);
                CS["easClientDeviceInformation_Version"]            = "固件版本:" + easClientDeviceInformation.SystemFirmwareVersion + "★硬件版本:" + easClientDeviceInformation.SystemHardwareVersion;
                CS["easClientDeviceInformation_FriendlyName"]       = easClientDeviceInformation.FriendlyName;
                CS["easClientDeviceInformation_OperatingSystem"]    = easClientDeviceInformation.OperatingSystem;
                CS["easClientDeviceInformation_SystemManufacturer"] = easClientDeviceInformation.SystemManufacturer;
                CS["easClientDeviceInformation_SystemProductName"]  = easClientDeviceInformation.SystemProductName;
                IDictionary <string, object> RE = await CH.LoadHttpText(CS);
            }
            catch (Exception exx)
            { }
        }
        /// <summary>
        /// ReportError Method
        /// </summary>
        /// <param name="viewName"></param>
        /// <param name="msg"></param>
        /// <param name="pageSummary"></param>
        /// <param name="includeDeviceInfo"></param>
        /// <returns></returns>
        public static async Task ReportError(string msg = null, string pageSummary = "N/A", bool includeDeviceInfo = true)
        {
            var deviceInfo = new EasClientDeviceInformation();

            string subject = GetUIString("Feedback_Subject");
            string body    = $"{GetUIString("Feedback_Body")}:{msg}  " +
                             $"({GetUIString("Feedback_Version")}:{Utils.GetAppVersion()} ";

            if (includeDeviceInfo)
            {
                body += $", {GetUIString("Feedback_FriendlyName")}:{deviceInfo.FriendlyName}, " +
                        $"{GetUIString("Feedback_OS")}:{deviceInfo.OperatingSystem}, " +
                        $"SKU:{deviceInfo.SystemSku}, " +
                        $"{GetUIString("Feedback_SPN")}:{deviceInfo.SystemProductName}, " +
                        $"{GetUIString("Feedback_SMF")}:{deviceInfo.SystemManufacturer}, " +
                        $"{GetUIString("Feedback_SFV")}:{deviceInfo.SystemFirmwareVersion}, " +
                        $"{GetUIString("Feedback_SHV")}:{deviceInfo.SystemHardwareVersion})";
            }
            else
            {
                body += ")";
            }

            string to = "*****@*****.**";
            await Tasks.OpenEmailComposeAsync(to, subject, body);
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Launch feedback email.
        /// </summary>
        private async Task LaunchFeedbackEmailAsync()
        {
            string company = GetCompanyName(this);

            if (company == null || company.Length <= 0)
            {
                company = "<Company>";
            }

            var easClientDeviceInformation = new EasClientDeviceInformation();

            // Body text including hardware, firmware and software info
            string body = string.Format(GetFeedbackBody(this),
                                        easClientDeviceInformation.SystemProductName,
                                        easClientDeviceInformation.SystemManufacturer,
                                        easClientDeviceInformation.SystemFirmwareVersion,
                                        easClientDeviceInformation.SystemHardwareVersion,
                                        GetAppVersion(),
                                        company);

            // Send an Email with attachment
            EmailMessage email = new EmailMessage();

            email.To.Add(new EmailRecipient(GetFeedbackTo(this)));
            email.Subject = string.Format(GetFeedbackSubject(this), GetApplicationName());
            email.Body    = body;
            await EmailManager.ShowComposeNewEmailAsync(email);
        }
Ejemplo n.º 14
0
                                      )> DoVerificationAsync(string verifyCode)
        {
            await Task.Delay(VerificationRequestDelay.CalculateDelay());

            try
            {
                var deviceInfo  = new EasClientDeviceInformation();
                var currentDate = DateTimeOffset.UtcNow.ToString("s");
                var auth        = await GitHubClientBase.Instance.Authorization.Create(
                    GitHubClientBase.ClientId,
                    GitHubClientBase.ClientSecret.FromHex(),
                    new NewAuthorization(
                        $"{GitHubClientBase.BaseClientId}{GitHubClientBase.Client2FAAction}({deviceInfo.FriendlyName}:{currentDate})",
                        new List <string>()
                        ),
                    verifyCode
                    );

                return(!string.IsNullOrEmpty(auth.Token)
                    ? (VerificationResponseTypes.Success, auth.Token)
                    : (VerificationResponseTypes.WrongVerifyCode, null));
            }
            catch (ApiValidationException)
            {
                return(VerificationResponseTypes.WrongVerifyCode, null);
            }
            catch (ApiException)
            {
                return(VerificationResponseTypes.WrongVerifyCode, null);
            }
        }
Ejemplo n.º 15
0
        public FlowDiagram_WP()
        {
            this.InitializeComponent();

            deviceinfo = new EasClientDeviceInformation();
            var nodes = new ObservableCollection <Node>();

            nodes.CollectionChanged += (s, e) =>
            {
                if (e.NewItems != null)
                {
                    //(e.NewItems[0] as CustomNode).Update();
                }
            };
            diagramControl.Nodes      = nodes;
            diagramControl.Connectors = new ObservableCollection <Connector>();
            //Initialize the Nodes and Connection
            createNodes();
            diagramControl.PageSettings                 = null;
            diagramControl.Constraints                 |= GraphConstraints.Pannable;
            diagramControl.DefaultConnectorType         = ConnectorType.Line;
            diagramControl.SnapSettings.SnapConstraints = SnapConstraints.All;
            diagramControl.SnapSettings.SnapToObject    = SnapToObject.All;
            diagramControl.KnownTypes = GetKnownTypes;


            diagramControl.PointerReleased += diagramControl_PointerReleased;

            //this.NavigationCacheMode = NavigationCacheMode.Required;
        }
Ejemplo n.º 16
0
        private async void programO(string Input, bool key)
        {
            string url = "http://api.program-o.com/v2/chatbot/";
            var    deviceInformation = new EasClientDeviceInformation();
            string Id = deviceInformation.Id.ToString();

            if (Input == "" || Input.Replace(" ", "") == "")
            {
                if (key == false)
                {
                    Input             = "Hi!";
                    txtOutputTwo.Text = Input;
                }
                else
                {
                    Input = "Hi!";
                }
            }
            else
            {
                txtOutputTwo.Text = Input;
            }

            string param = "?bot_id=6&convo_id=sam" + Id.Substring(0, 12) + "&format=json&say=" + Input;

            // Send Request
            Windows.Web.Http.HttpClient httpClient = new Windows.Web.Http.HttpClient();
            Uri requestUri = new Uri(url + param);

            Windows.Web.Http.HttpResponseMessage httpResponse = new Windows.Web.Http.HttpResponseMessage();
            string httpResponseBody = "";

            try
            {
                httpResponse = await httpClient.GetAsync(requestUri);

                httpResponse.EnsureSuccessStatusCode();
                httpResponseBody = await httpResponse.Content.ReadAsStringAsync();

                JsonObject root = JsonValue.Parse(httpResponseBody).GetObject();
                string     text = Convert.ToString(root["botsay"]);

                txtOutput.Text = ((text.Replace("\"", "")).Replace("Program-O", "Sam")).Replace("\\", "");
            }
            catch
            {
                Random r  = new Random();
                int    nr = r.Next(1, 3);
                if (nr == 1)
                {
                    txtOutput.Text = "Check your internet connection!";
                }
                else
                {
                    txtOutput.Text = "Error can't connect to my ship!";
                }
            }

            txtInput.Text = "";
        }
Ejemplo n.º 17
0
        public static async Task ReportError(string viewName, string errorStack = null, bool includeDeviceInfo = true)
        {
            var deviceInfo = new EasClientDeviceInformation();

            const string to      = "*****@*****.**";
            const string subject = "《饥荒百科全书 by tpxxn》应用错误报告";
            var          body    = $"{errorStack}  " + //错误堆栈
                                   $"(程序版本:{GetAppVersion()}, " +
                                   $"所在页面:{viewName}, ";

            if (includeDeviceInfo)
            {
                body += $", 设备名:{deviceInfo.FriendlyName}, " +
                        $"操作系统:{deviceInfo.OperatingSystem}, " +
                        $"系统版本:{Global.GetOsVersion()}, " +
                        $"SKU:{deviceInfo.SystemSku}, " +
                        $"产品名称:{deviceInfo.SystemProductName}, " +
                        $"制造商:{deviceInfo.SystemManufacturer}, " +
                        $"固件版本:{deviceInfo.SystemFirmwareVersion}, " +
                        $"硬件版本:{deviceInfo.SystemHardwareVersion})";
            }
            else
            {
                body += ")";
            }

            await CallExternalContent.OpenEmailComposeAsync(to, subject, body);
        }
Ejemplo n.º 18
0
 public DeviceInfo GetDeviceInfo()
 {
     if (DeviceInfo == null)
     {
         var easClientDeviceInformation = new EasClientDeviceInformation();
         DeviceInfo = new DeviceInfo
         {
             ClientSdk                = GetClientSdk(),
             HardwareId               = UtilUap.GetHardwareId(),
             NetworkAdapterId         = UtilUap.GetNetworkAdapterId(),
             AppDisplayName           = UtilUap.GetAppDisplayName(),
             AppVersion               = UtilUap.GetAppVersion(),
             AppPublisher             = UtilUap.GetAppPublisher(),
             DeviceType               = UtilUap.GetDeviceType(),
             DeviceManufacturer       = UtilUap.GetDeviceManufacturer(),
             Architecture             = UtilUap.GetArchitecture(),
             OsName                   = GetOsName(),
             OsVersion                = UtilUap.GetOsVersion(),
             Language                 = UtilUap.GetLanguage(),
             Country                  = UtilUap.GetCountry(),
             ReadWindowsAdvertisingId = ReadWindowsAdvertisingId,
             EasFriendlyName          = UtilUap.ExceptionWrap(() => easClientDeviceInformation.FriendlyName),
             EasId = UtilUap.ExceptionWrap(() => easClientDeviceInformation.Id.ToString()),
             EasOperatingSystem       = UtilUap.ExceptionWrap(() => easClientDeviceInformation.OperatingSystem),
             EasSystemFirmwareVersion = UtilUap.ExceptionWrap(() => easClientDeviceInformation.SystemFirmwareVersion),
             EasSystemHardwareVersion = UtilUap.ExceptionWrap(() => easClientDeviceInformation.SystemHardwareVersion),
             EasSystemManufacturer    = UtilUap.ExceptionWrap(() => easClientDeviceInformation.SystemManufacturer),
             EasSystemProductName     = UtilUap.ExceptionWrap(() => easClientDeviceInformation.SystemProductName),
             EasSystemSku             = UtilUap.ExceptionWrap(() => easClientDeviceInformation.SystemSku),
         };
     }
     return(DeviceInfo);
 }
Ejemplo n.º 19
0
        public static async Task <string> GetResults(Uri url)
        {
            HttpBaseProtocolFilter fiter = new HttpBaseProtocolFilter();

            fiter.IgnorableServerCertificateErrors.Add(Windows.Security.Cryptography.Certificates.ChainValidationResult.Expired);
            using (HttpClient hc = new HttpClient(fiter))
            {
                if (url.AbsoluteUri.Contains("23moe"))
                {
                    var ts = ApiHelper.GetTimeSpan.ToString();
                    EasClientDeviceInformation deviceInfo = new EasClientDeviceInformation();
                    hc.DefaultRequestHeaders.Add("client", "bilibili-uwp");
                    hc.DefaultRequestHeaders.Add("ts", ts);
                    hc.DefaultRequestHeaders.Add("appsign", Utils.ToMD5("biliUwpXycz0423" + ts + "bilibili-uwp" + SettingHelper.GetVersion() + "0BJSDAHDUAHGAI5D45ADS5" + deviceInfo.Id.ToString()));
                    hc.DefaultRequestHeaders.Add("version", SettingHelper.GetVersion());
                    hc.DefaultRequestHeaders.Add("device-id", deviceInfo.Id.ToString());
                }

                //hc.DefaultRequestHeaders.Add("user-agent", $"Mozilla/5.0 BiliDroid/6.1.0 ([email protected])");
                //hc.DefaultRequestHeaders.Referer = new Uri("http://www.bilibili.com/");
                HttpResponseMessage hr = await hc.GetAsync(url);

                hr.EnsureSuccessStatusCode();
                var encodeResults = await hr.Content.ReadAsBufferAsync();

                string results = Encoding.UTF8.GetString(encodeResults.ToArray(), 0, encodeResults.ToArray().Length);

                //string result = await response.Content.ReadAsStringAsync();
                return(results);
            }
        }
Ejemplo n.º 20
0
        private async void Review_Clicked(object sender, RoutedEventArgs e)
        {
            EmailRecipient sendTo = new EmailRecipient()
            {
                Address = "*****@*****.**"
            };

            // Create mail object
            EmailMessage mail = new EmailMessage();

            // Define body text
            mail.Subject = "Palautetta Edumenusta";
            string body = "[Palautteesi tähän]";
            var    easClientDeviceInformation = new EasClientDeviceInformation();
            string deviceRmCode = easClientDeviceInformation.SystemProductName;

            mail.Body = body + Environment.NewLine + Environment.NewLine +
                        "---------------------------------" + Environment.NewLine +
                        "Laite: " + deviceRmCode + Environment.NewLine +
                        "Edumenun versio: " + version.ToString() + Environment.NewLine +
                        "---------------------------------";

            // Add recipients to the mail object
            mail.To.Add(sendTo);

            await EmailManager.ShowComposeNewEmailAsync(mail);
        }
        public Task <string> GenerateUserAgentHeaderAsync(bool isHybrid, string qualifier)
        {
            var            appName              = GetApplicationDisplayNameAsync().Result;
            var            deviceInfo           = AnalyticsInfo.VersionInfo.DeviceFamily + "/" + GetDeviceFamilyVersion(AnalyticsInfo.VersionInfo.DeviceFamilyVersion);
            var            deviceModel          = new EasClientDeviceInformation().SystemProductName;
            var            deviceId             = new EasClientDeviceInformation().Id;
            PackageVersion packageVersion       = Package.Current.Id.Version;
            string         packageVersionString = packageVersion.Major + "." + packageVersion.Minor + "." +
                                                  packageVersion.Build;
            var appType = new StringBuilder(isHybrid ? "Hybrid" : "Native");

            if (isHybrid)
            {
                appType.Append(new BootConfig().IsLocal ? "Local" : "Remote");
            }
            if (!String.IsNullOrWhiteSpace(qualifier))
            {
                appType.Append(qualifier);
            }
            var UserAgentHeader = String.Format(UserAgentHeaderFormat, SdkVersion, deviceInfo, deviceModel,
                                                appName, packageVersionString, appType, deviceId);

            AppType = appType.ToString();
            return(Task.FromResult(UserAgentHeader));
        }
Ejemplo n.º 22
0
        public RadialTree_WP()
        {
            this.InitializeComponent();
            deviceinfo          = new EasClientDeviceInformation();
            diagramControl.Menu = null;

            diagramControl.Tool = Tool.None;


            diagramControl.LayoutManager = new LayoutManager()
            {
                Layout = new RadialTreeLayout()
            };


            (diagramControl.LayoutManager.Layout as RadialTreeLayout).HorizontalSpacing = 5;
            (diagramControl.LayoutManager.Layout as RadialTreeLayout).VerticalSpacing   = 15;

            Node head = addNode(toggle, 0);

            ConnectNode(head, Flower(4));
            diagramControl.PageSettings = null;
            (diagramControl.LayoutManager.Layout as RadialTreeLayout).LayoutRoot = head;

            // this.NavigationCacheMode = NavigationCacheMode.Required;
        }
Ejemplo n.º 23
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SystemInformation"/> class.
        /// </summary>
        private SystemInformation()
        {
            ApplicationName    = Package.Current.DisplayName;
            ApplicationVersion = Package.Current.Id.Version;
            try
            {
                Culture = GlobalizationPreferences.Languages.Count > 0 ? new CultureInfo(GlobalizationPreferences.Languages.First()) : null;
            }
            catch
            {
                Culture = null;
            }

            DeviceFamily = AnalyticsInfo.VersionInfo.DeviceFamily;
            ulong version = ulong.Parse(AnalyticsInfo.VersionInfo.DeviceFamilyVersion);

            OperatingSystemVersion = new OSVersion
            {
                Major    = (ushort)((version & 0xFFFF000000000000L) >> 48),
                Minor    = (ushort)((version & 0x0000FFFF00000000L) >> 32),
                Build    = (ushort)((version & 0x00000000FFFF0000L) >> 16),
                Revision = (ushort)(version & 0x000000000000FFFFL)
            };
            OperatingSystemArchitecture = Package.Current.Id.Architecture;
            EasClientDeviceInformation deviceInfo = new EasClientDeviceInformation();

            OperatingSystem       = deviceInfo.OperatingSystem;
            DeviceManufacturer    = deviceInfo.SystemManufacturer;
            DeviceModel           = deviceInfo.SystemProductName;
            IsFirstRun            = DetectIfFirstUse();
            IsAppUpdated          = DetectIfAppUpdated();
            FirstUseTime          = DetectFirstUseTime();
            FirstVersionInstalled = DetectFirstVersionInstalled();
            InitializeValuesSetWithTrackAppUse();
        }
Ejemplo n.º 24
0
        public static List <KeyValuePair <string, string> > GetBasicPostData()
        {
            EasClientDeviceInformation deviceInfo = new EasClientDeviceInformation();
            var data = new List <KeyValuePair <string, string> >();

            if (deviceInfo.SystemManufacturer != null)
            {
                data.Add(new KeyValuePair <string, string>("phoneBrand", deviceInfo.SystemManufacturer));
            }
            else
            {
                data.Add(new KeyValuePair <string, string>("phoneBrand", "DeskTop"));
            }
            data.Add(new KeyValuePair <string, string>("platform", "1"));
            data.Add(new KeyValuePair <string, string>("phoneVersion", "19"));
            data.Add(new KeyValuePair <string, string>("channel", "SoftwareUpdate"));
            if (deviceInfo.FriendlyName != null)
            {
                data.Add(new KeyValuePair <string, string>("phoneModel", deviceInfo.FriendlyName));
            }
            else
            {
                data.Add(new KeyValuePair <string, string>("phoneModel", "UnKnown"));
            }
            data.Add(new KeyValuePair <string, string>("versionNumber", "7.8.4"));
            return(data);
        }
Ejemplo n.º 25
0
        public static string GetDeviceUniqueId()
        {
            //return "0421460710001350";

            EasClientDeviceInformation deviceInfo = new EasClientDeviceInformation();

            byte[] bytes             = deviceInfo.Id.ToByteArray();
            string strTemp           = "";
            string strDeviceUniqueID = "";

            foreach (byte b in bytes)
            {
                strTemp = b.ToString();
                if (1 == strTemp.Length)
                {
                    strTemp = "00" + strTemp;
                }
                else if (2 == strTemp.Length)
                {
                    strTemp = "0" + strTemp;
                }
                strDeviceUniqueID += strTemp;
            }
            return(strDeviceUniqueID.Substring(0, 16));
        }
Ejemplo n.º 26
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);
        }
Ejemplo n.º 27
0
        public static async Task SendFeedback(string msg, bool includeDeviceInfo)
        {
            var deviceInfo = new EasClientDeviceInformation();

            string subject = "Image Portray (Tracing / 描图) Feedback";
            string body    = $"Message: {msg}\n\n" +
                             $"App Version: {Utils.GetAppVersion()} \n";

            if (includeDeviceInfo)
            {
                body += $"Device Name: {deviceInfo.FriendlyName}, " +
                        $"OS Version: {deviceInfo.OperatingSystem}, " +
                        $"SKU: {deviceInfo.SystemSku}, " +
                        $"Product: {deviceInfo.SystemProductName}, " +
                        $"Manufacturer: {deviceInfo.SystemManufacturer}, " +
                        $"Firmware Version: {deviceInfo.SystemFirmwareVersion}, " +
                        $"Hardware Version: {deviceInfo.SystemHardwareVersion})";
            }
            else
            {
                body += ")";
            }

            string to = "*****@*****.**";
            await Tasks.OpenEmailComposeAsync(to, subject, body);
        }
        public PlatInfoSap1Page()
        {
            InitializeComponent();

#if __IOS__
            UIDevice device = new UIDevice();
            modelLabel.Text   = device.Model.ToString();
            versionLabel.Text = String.Format("{0} {1}", device.SystemName,
                                              device.SystemVersion);
#elif __ANDROID__
            modelLabel.Text = String.Format("{0} {1}", Build.Manufacturer,
                                            Build.Model);
            versionLabel.Text = Build.VERSION.Release.ToString();
#elif WINDOWS_PHONE
            modelLabel.Text = String.Format("{0} {1}", DeviceStatus.DeviceManufacturer,
                                            DeviceStatus.DeviceName);
            versionLabel.Text = Environment.OSVersion.ToString();
#elif WINDOWS_APP || WINDOWS_PHONE_APP
            EasClientDeviceInformation devInfo = new EasClientDeviceInformation();
            modelLabel.Text = String.Format("{0} {1}", devInfo.SystemManufacturer,
                                            devInfo.SystemProductName);
            versionLabel.Text = devInfo.OperatingSystem;
#elif WINDOWS_UWP
            EasClientDeviceInformation devInfo = new EasClientDeviceInformation();
            modelLabel.Text = String.Format("{0} {1}", devInfo.SystemManufacturer,
                                            devInfo.SystemProductName);
            versionLabel.Text = devInfo.OperatingSystem;
#endif
        }
Ejemplo n.º 29
0
        public static Guid GetDeviceId()
        {
            //Get the Device ID to pass to the server
            EasClientDeviceInformation deviceInformation = new EasClientDeviceInformation();

            return(deviceInformation.Id);
        }
        private void InitializeComponentValue()
        {
            var deviceFamilyVersion = AnalyticsInfo.VersionInfo.DeviceFamilyVersion;
            var version             = ulong.Parse(deviceFamilyVersion);
            var majorVersion        = (version & 0xFFFF000000000000L) >> 48;
            var minorVersion        = (version & 0x0000FFFF00000000L) >> 32;
            var buildVersion        = (version & 0x00000000FFFF0000L) >> 16;
            var revisionVersion     = (version & 0x000000000000FFFFL);

            EasClientDeviceInformation clientDeviceInformation = new EasClientDeviceInformation();

            //this.m_BoardName.Text = "Askey PCA6800";
            //this.m_DeviceName.Text = clientDeviceInformation.FriendlyName;
            this.m_DeviceName.Text = GetHostName();


            this.m_OsVersion.Text = $"{majorVersion}.{minorVersion}.{buildVersion}.{revisionVersion}";;

            this.m_AdapterName.Text = "Qualcomm Atheros Wireless LAN Adapter";// await GetWifiAdapterName();
            this.m_AdapterMac.Text  = GetAdapterMAC("Qualcomm Atheros Wireless LAN Adapter");

            this.m_WifiNetworkName.Text = GetCurrentProfile();
            this.m_WifiNetworkAddr.Text = GetCurrentIpv4Address();

            this.m_BluetoothName.Text = "Qualcomm Bluetooth Device";
            this.m_BluetoothMac.Text  = GetAdapterMAC("Bluetooth Device (Personal Area Network)");
        }
        public PlatformInfo GetPlatformInfo()
        {
#if WINDOWS_PHONE
            return new PlatformInfo(PlatformType.XamarinFormsWinPhone, Environment.OSVersion.Version);
#elif TOUCH
            Version result;
            Version.TryParse(UIKit.UIDevice.CurrentDevice.SystemVersion, out result);
            return new PlatformInfo(PlatformType.XamarinFormsiOS, result);
#elif ANDROID
            Version result;
            Version.TryParse(global::Android.OS.Build.VERSION.Release, out result);
            return new PlatformInfo(PlatformType.XamarinFormsAndroid, result);
#elif WINDOWSCOMMON
            var isPhone = new EasClientDeviceInformation().OperatingSystem.SafeContains("WindowsPhone", StringComparison.OrdinalIgnoreCase);
            var isWinRT10 = typeof(DependencyObject).GetMethodEx("RegisterPropertyChangedCallback", MemberFlags.Instance | MemberFlags.Public) != null;
            var version = isWinRT10 ? new Version(10, 0) : new Version(8, 1);
            return new PlatformInfo(isPhone ? PlatformType.XamarinFormsWinRTPhone : PlatformType.XamarinFormsWinRT, version);
#endif
        }
        private async void Feedback()
#endif
        {
            string version = string.Empty;

#if SILVERLIGHT
            var appManifestResourceInfo = Application.GetResourceStream(new Uri("WMAppManifest.xml", UriKind.Relative));

            using (var appManifestStream = appManifestResourceInfo.Stream)
            {
                using (var reader = XmlReader.Create(appManifestStream, new XmlReaderSettings { IgnoreWhitespace = true, IgnoreComments = true }))
                {
                    var doc = XDocument.Load(reader);
                    var app = doc.Descendants("App").FirstOrDefault();
                    if (app != null)
                    {
                        var versionAttribute = app.Attribute("Version");
                        if (versionAttribute != null)
                        {
                            version = versionAttribute.Value;
                        }
                    }
                }
            }

            if (string.IsNullOrEmpty(version))
            {
                // Application version
                var asm = System.Reflection.Assembly.GetExecutingAssembly();
                var parts = asm.FullName.Split(',');
                version = parts[1].Split('=')[1];
            }
#else
            var uri = new System.Uri("ms-appx:///AppxManifest.xml");
            StorageFile file = await Windows.Storage.StorageFile.GetFileFromApplicationUriAsync(uri);
            using (var rastream = await file.OpenReadAsync())
            using (var appManifestStream = rastream.AsStreamForRead())
            {
                using (var reader = XmlReader.Create(appManifestStream, new XmlReaderSettings { IgnoreWhitespace = true, IgnoreComments = true }))
                {
                    var doc = XDocument.Load(reader);
                    var app = doc.Descendants("Identity").FirstOrDefault();
                    if (app != null)
                    {
                        var versionAttribute = app.Attribute("Version");
                        if (versionAttribute != null)
                        {
                            version = versionAttribute.Value;
                        }
                    }
                }
            }
#endif

            string company = GetCompanyName(this);
            if (company == null || company.Length <= 0)
            {
                company = "<Company>";
            }

#if SILVERLIGHT
            // Body text including hardware, firmware and software info
            string body = string.Format(FeedbackOverlay.GetFeedbackBody(this),
                 DeviceStatus.DeviceName,
                 DeviceStatus.DeviceManufacturer,
                 DeviceStatus.DeviceFirmwareVersion,
                 DeviceStatus.DeviceHardwareVersion,
                 version,
                 company);

            // Email task
            var email = new EmailComposeTask();
            email.To = FeedbackOverlay.GetFeedbackTo(this);
            email.Subject = string.Format(FeedbackOverlay.GetFeedbackSubject(this), GetApplicationName());
            email.Body = body;

            email.Show();
#else
            var easClientDeviceInformation = new EasClientDeviceInformation();

            // Body text including hardware, firmware and software info
            string body = string.Format(FeedbackOverlay.GetFeedbackBody(this),
                 easClientDeviceInformation.SystemProductName,
                 easClientDeviceInformation.SystemManufacturer,
                 easClientDeviceInformation.SystemFirmwareVersion,
                 easClientDeviceInformation.SystemHardwareVersion,
                 version,
                 company);

            // Send an Email with attachment
            EmailMessage email = new EmailMessage();
            email.To.Add(new EmailRecipient(FeedbackOverlay.GetFeedbackTo(this)));
            email.Subject = string.Format(FeedbackOverlay.GetFeedbackSubject(this), GetApplicationName());
            email.Body = body;
            await EmailManager.ShowComposeNewEmailAsync(email);
#endif			
        }