Пример #1
0
        public override bool Equals(object obj)
        {
            TemplateSource other = obj as TemplateSource;

            if (other == null)
            {
                return(false);
            }
            if (Type != other.Type)
            {
                return(false);
            }

            if (SourceFolder != null && !SourceFolder.Equals(other.SourceFolder))
            {
                return(false);
            }

            if (GitUrl != null && !GitUrl.Equals(other.GitUrl))
            {
                return(false);
            }

            if (PackageVersion != null && !PackageVersion.Equals(other.PackageVersion))
            {
                return(false);
            }

            if (PackageName != null && !PackageName.Equals(other.PackageName))
            {
                return(false);
            }

            return(true);
        }
Пример #2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.WelcomeActivity);

            //뷰페이저 설정
            _ViewPager = FindViewById <NonSwipeableViewPager>(Resource.Id.wa_viewpager);
            _NextBtn   = FindViewById <Button>(Resource.Id.wa_nextBtn);

            WelcomeScreenAdapter adapter = new WelcomeScreenAdapter(this, _Screens);

            _ViewPager.Adapter = adapter;
            _NextBtn.Click    += _NextBtn_Click;

            //처음이 아닌 경우
            _IsFirst = DataStorageManager.LoadBoolData(this, "isFirst", true);
            if (_IsFirst == false)
            {
                //기본 패키지로 되어있는가?
                if (PackageName.Equals(Telephony.Sms.GetDefaultSmsPackage(this)))
                {
                    _IsDefaultPackage = true;
                }

                _NeedRecategorize = DataStorageManager.LoadBoolData(this, "needRecategorize", false);

                //권한이 있는가?
                if (PermissionManager.HasPermission(this, PermissionManager.essentialPermissions))
                {
                    ;
                }
                _HasPermission = true;

                if (_IsDefaultPackage == false)                                                         //기본 패키지가 아니라면, 기본앱 설정 페이지로 이동.
                {
                    _ViewPager.SetCurrentItem((int)WELCOME_SCREEN.PACKAGE, false);
                }
                else if (_HasPermission == false)                                                       //권한이 없다면, 권한페이지로 이동.
                {
                    _ViewPager.SetCurrentItem((int)WELCOME_SCREEN.PERMISSION, false);
                }
                else if (_NeedRecategorize == true)
                {
                    _MessageDBLoadTsk = Task.Run(() => LoadMessageDBAsync());                               //미리 메시지 로드
                    _ViewPager.SetCurrentItem((int)WELCOME_SCREEN.CATEGORIZE, false);
                    DataStorageManager.SaveBoolData(this, "needRecategorize", false);
                }
                else                                                                                    //이미 설정 다되있으면 피니쉬
                {
                    Finish();
                }
            }
            else
            {
                _CreatePrivacyDialogTsk = Task.Run(() => CreatePrivacyDialog());                        //개인정보취급방침 미리 읽어온다.
            }
        }
Пример #3
0
 public override string ToString()
 {
     if (PackageName.Equals(UserDefinitions))
     {
         return(Name);
     }
     else
     {
         return(PackageName + " : " + Name);
     }
 }
        public override bool Equals(object obj)
        {
            var other = obj as PackageViewModel;

            if (other == null)
            {
                return(false);
            }

            var packageName      = new PackageName(package.Id, package.Version);
            var otherPackageName = new PackageName(other.package.Id, other.package.Version);

            return(packageName.Equals(otherPackageName));
        }
Пример #5
0
        protected override void OnCreate(Bundle bundle)
        {
            try
            {
                TabLayoutResource = Haulage.Droid.Resource.Layout.Tabbar;
                ToolbarResource   = Haulage.Droid.Resource.Layout.Toolbar;
                base.OnCreate(bundle);

                Xamarin.Essentials.Platform.Init(this, bundle);
                Rg.Plugins.Popup.Popup.Init(this, bundle);
                global::Xamarin.Forms.Forms.Init(this, bundle);
                Xamarin.FormsMaps.Init(this, bundle);
                Xamarin.FormsGoogleMaps.Init(this, bundle);
                UserDialogs.Init(this);
                ImageCircleRenderer.Init();
                ZXing.Net.Mobile.Forms.Android.Platform.Init();
                ZXing.Mobile.MobileBarcodeScanner.Initialize(Application);
                Ultis.Settings.App = PackageName;

                if (Build.VERSION.SdkInt >= BuildVersionCodes.M)
                {
                    if (PackageName.Equals("asolute.Mobile.AILSHaulage"))
                    {
                        RequestPermissions(new String[] { Manifest.Permission.AccessFineLocation }, 1);
                    }

                    if (CheckSelfPermission(Manifest.Permission.AccessFineLocation) == Permission.Granted && PackageName.Equals("asolute.Mobile.AILSHaulage"))
                    {
                        StartLocationTracking();
                    }
                }

                if (PackageName.Equals("asolute.Mobile.AILSBUS"))
                {
                    var backgroundDataSyncPendingIntent = PendingIntent.GetBroadcast(this, 0, new Intent(this, typeof(BackgroundDataSyncReceiver)), PendingIntentFlags.UpdateCurrent);
                    var alarmManagerBackgroundDataSync  = GetSystemService(AlarmService).JavaCast <AlarmManager>();
                    alarmManagerBackgroundDataSync.SetRepeating(AlarmType.ElapsedRealtimeWakeup, SystemClock.ElapsedRealtime(), 60000, backgroundDataSyncPendingIntent);
                }

                App.DisplayScreenWidth  = Resources.DisplayMetrics.WidthPixels / Resources.DisplayMetrics.Density;
                App.DisplayScreenHeight = Resources.DisplayMetrics.HeightPixels / Resources.DisplayMetrics.Density;

                LoadApplication(new App());
            }
            catch
            {
            }
        }
Пример #6
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            Window.RequestFeature(WindowFeatures.NoTitle);
            Window.AddFlags(WindowManagerFlags.Fullscreen);

            mGLView = new DemoGLSurfaceView(this);
            SetContentView(mGLView);

            if (!PackageName.Equals("com.polygontek.devtech.AndroidPlayer"))
            {
                SetAssetManager(JNIEnv.Handle, Assets.Handle, FilesDir.AbsolutePath);
            }
            else
            {
                SetAssetManager(JNIEnv.Handle, Assets.Handle, "/sdcard/blueshift");
            }
        }
Пример #7
0
 public bool Equals(PackageWithAssemblyResult other)
 => PackageName.Equals(other.PackageName);
Пример #8
0
        public override void OnRequestPermissionsResult(int requestCode, string[] permissions, Permission[] grantResults)
        {
            global::ZXing.Net.Mobile.Android.PermissionsHandler.OnRequestPermissionsResult(requestCode, permissions, grantResults);
            Plugin.Permissions.PermissionsImplementation.Current.OnRequestPermissionsResult(requestCode, permissions, grantResults);
            Xamarin.Essentials.Platform.OnRequestPermissionsResult(requestCode, permissions, grantResults);
            switch (requestCode)
            {
            case PrinterDiscoveryImplementation.RequestLocationId:
                if (grantResults[0] == Permission.Granted)
                {
                    //Permission granted
                    PrinterDiscoveryImplementation discoveryImp = new PrinterDiscoveryImplementation();
                    discoveryImp.FindBluetoothPrinters(PrinterDiscoveryImplementation.TempHandler);
                }
                else
                {
                    System.Diagnostics.Debug.WriteLine("Location permission denied. Cannot do Bluetooth discovery.");
                }
                break;
            }

            if (Build.VERSION.SdkInt >= BuildVersionCodes.M)
            {
                if (grantResults.Length > 0 && permissions.Length > 0)
                {
                    if (permissions[0].Equals(Manifest.Permission.AccessFineLocation) && PackageName.Equals("asolute.Mobile.AILSHaulage"))
                    {
                        StartLocationTracking();
                    }
                }
            }
        }
Пример #9
0
        internal IPackage FindPackage(Func<string, IPackage> openPackage, string packageId, SemanticVersion version)
        {
            var lookupPackageName = new PackageName(packageId, version);
            string packagePath;
            // If caching is enabled, check if we have a cached path. Additionally, verify that the file actually exists on disk since it might have moved.
            if (_enableCaching &&
                _packagePathLookup.TryGetValue(lookupPackageName, out packagePath) &&
                FileSystem.FileExists(packagePath))
            {
                // When depending on the cached path, verify the file exists on disk.
                return GetPackage(openPackage, packagePath);
            }

            // Lookup files which start with the name "<Id>." and attempt to match it with all possible version string combinations (e.g. 1.2.0, 1.2.0.0) 
            // before opening the package. To avoid creating file name strings, we attempt to specifically match everything after the last path separator
            // which would be the file name and extension.
            return (from path in GetPackageLookupPaths(packageId, version)
                    let package = GetPackage(openPackage, path)
                    where lookupPackageName.Equals(new PackageName(package.Id, package.Version))
                    select package).FirstOrDefault();
        }
Пример #10
0
        private async Task OnExecuteAsync()
        {
            if (ToolPath == null)
            {
                var userProfilePath = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
                ToolPath = Path.Combine(userProfilePath, $".dotnet{Path.DirectorySeparatorChar}tools{Path.DirectorySeparatorChar}.store");
            }

            var httpClient  = new HttpClient();
            var resultsCnt  = 0;
            var outdatedCnt = 0;
            var unlistedCnt = 0;

            var dirs = Directory.GetDirectories(ToolPath);

            if (dirs != null)
            {
                var pkgs = new List <OutdatedResponse>();
                // fetch the package name
                foreach (var dir in dirs)
                {
                    var pkgName = Path.GetFileName(dir);
                    if (pkgName.Equals(".stage", StringComparison.Ordinal))
                    {
                        continue;
                    }
                    pkgs.Add(new OutdatedResponse()
                    {
                        PackageName = pkgName, Directory = dir
                    });
                }

                // tasks for awaiting when all done together
                var apiGetResponseOkContinuedTasks = new List <Task>();
                var pkgResponseReadTasks           = new List <Task <string> >();

                // prerelease parameter value
                var prereleasePar = CheckPrelease ? "true" : "false";
                foreach (var pkg in pkgs)
                {
                    if (!string.IsNullOrEmpty(PackageName) && !PackageName.Equals(pkg.PackageName, StringComparison.Ordinal))
                    {
                        continue;
                    }

                    // fetch the installed version
                    var verDirs = Directory.GetDirectories(pkg.Directory);
                    if (verDirs == null)
                    {
                        Console.WriteLine($"{pkg.PackageName} package - no sub-dirs about version");
                        continue;
                    }

                    if (verDirs.Length > 1)
                    {
                        Console.WriteLine($"ambiguity for {pkg.PackageName} package - seems to be more version sub-dirs");
                        continue;
                    }
                    if (verDirs.Length == 1)
                    {
                        pkg.CurrentVer = Path.GetFileName(verDirs[0]);
                    }

                    // start tasks for fetching the available version
                    var url             = $"https://api-v2v3search-0.nuget.org/autocomplete?id={pkg.PackageName}&prerelease={prereleasePar}";
                    var pureHttpGetTask = httpClient.GetAsync(url);
                    pkg.processing.ApiGetTaskOkContinued = pureHttpGetTask.ContinueWith(t =>
                    {
                        // on run to completion continue with async processing of the response message ..
                        HttpResponseMessage response = t.Result;
                        if (response.IsSuccessStatusCode)
                        {
                            pkg.processing.OkResponseReadTask = response.Content.ReadAsStringAsync();
                            pkgResponseReadTasks.Add(pkg.processing.OkResponseReadTask);
                        }
                        else
                        {
                            Console.WriteLine($"No results found for {pkg.PackageName}");
                        }
                    },
                                                                                        TaskContinuationOptions.OnlyOnRanToCompletion);
                    // on faulted output a message to console
                    pureHttpGetTask.ContinueWith(
                        t => Console.WriteLine($"Task finding results for {pkg.PackageName} has faulted!"),
                        TaskContinuationOptions.OnlyOnFaulted)
                    .RunAsyncAndForget();

                    apiGetResponseOkContinuedTasks.Add(pkg.processing.ApiGetTaskOkContinued);
                }

                // await tasks for fetching the available version
                await Task.WhenAll(apiGetResponseOkContinuedTasks);

                // there should be same amount of response read tasks, which should be awaited
                await Task.WhenAll(pkgResponseReadTasks);

                // finish fetching the available version
                foreach (var pkg in pkgs)
                {
                    // no response read task at all => do not finish processing the available version
                    if (pkg.processing.OkResponseReadTask == null)
                    {
                        continue;
                    }

                    // check error/ cancellation of the response read task
                    if (!pkg.processing.OkResponseReadTask.IsCompletedSuccessfully)
                    {
                        if (pkg.processing.OkResponseReadTask.IsFaulted)
                        {
                            Console.WriteLine($"Error parsing the response for {pkg.PackageName}");
                        }
                        else if (pkg.processing.OkResponseReadTask.IsCanceled)
                        {
                            Console.WriteLine($"Cancellation parsing the response for {pkg.PackageName}");
                        }
                        continue;
                    }

                    // the response read task was completed successfully
                    var versionsResponseStr = pkg.processing.OkResponseReadTask.Result;

                    // set the available version
                    var versionsResponse = JsonSerializer.Deserialize <VersionsResponse>(versionsResponseStr);
                    pkg.AvailableVer = (versionsResponse.Versions.Length > 0) ? versionsResponse.Versions[versionsResponse.Versions.Length - 1] : "";

                    // since now all is fetched ok
                    pkg.processing.ProcessedOk = true;
                    resultsCnt++;

                    if (pkg.IsOutdated)
                    {
                        // the package is determined as outdated
                        pkg.processing.ProcessedOkOutdated = true;
                        if (pkg.BecomeUnlisted)
                        {
                            unlistedCnt++;
                        }
                        outdatedCnt++;
                    }
                }

                PrintOutdatedResults(pkgs);
            }
        }
Пример #11
0
        /// <summary>
        /// Find-Package
        /// </summary>
        /// <param name="openPackage">Delegate function which is actually finding a package</param>
        /// <param name="packageId">Package Id</param>
        /// <param name="version">Package version</param>
        /// <param name="nugetRequest"></param>
        /// <returns></returns>
        private IPackage FindPackage(Func<string, Request, IPackage> openPackage, string packageId, SemanticVersion version, NuGetRequest nugetRequest)
        {
            if (nugetRequest == null) {
                return null;
            }

            nugetRequest.Debug(Resources.Messages.SearchingRepository, "FindPackage", packageId);

            var lookupPackageName = new PackageName(packageId, version);

            //handle file cache here if we want to support local package cache later

            // Lookup files which start with the name "<Id>." and attempt to match it with all possible version string combinations (e.g. 1.2.0, 1.2.0.0)
            // before opening the package. To avoid creating file name strings, we attempt to specifically match everything after the last path separator
            // which would be the file name and extension.
            return (from path in GetPackageLookupPaths(packageId, version)
                    let package = GetPackage(openPackage, path, nugetRequest)
                where lookupPackageName.Equals(new PackageName(package.Id, package.Version))
                select package).FirstOrDefault();
        }