Beispiel #1
0
        private async Task UploadAppAsync(string appTitle, string appDescription, string appVersionDescription, int appCategoryId, long packageSize, byte[] icon128x128, byte[] icon256x256, CpuArchitecture cpuArchitecture, string version)
        {
            await Task.Factory.StartNew(() =>
            {
                var paasteelProvider  = _ctx.LegalPeople.Single(lp => lp.PrimaryEmail == "*****@*****.**");
                var universalPlatform = _ctx.Platforms.First(p => p.PlatformCategory == PlatformCategory.Windows10Universal);

                var app = new App
                {
                    Guid                 = Guid.NewGuid(),
                    Developer            = paasteelProvider,
                    Name                 = appTitle,
                    Description          = appDescription,
                    Icon128X128          = icon128x128,
                    Icon256X256          = icon256x256,
                    AppCategoryId        = appCategoryId,
                    CpuArchitectureFlags = cpuArchitecture,
                    State                = AppState.Unpublished
                };
                app.Platforms.Add(universalPlatform);
                app.AppVersions.Add(new AppVersion()
                {
                    Description = appVersionDescription,
                    Downloads   = 0,
                    PublishDate = DateTime.Now,
                    Version     = version,
                    Size        = packageSize
                });
                _ctx.Apps.Add(app);
                _ctx.SaveChanges();
            });
        }
        public void DoCrudAndEnjoy()
        {
            WindowsStoreContext context = new WindowsStoreContext();
            var apps = context.Apps.Where(app => app.Guid != Guid.Empty && app.AppCategory.AppType == AppType.Game)
                       .ToList();

            for (int i = 0; i < apps.Count; i++)
            {
                apps[i].Name = $"بازی شماره {i}";
            }

            //foreach (var app in apps) {
            //    var thumbnailPath = $"C:\\Paasteel\\Apps\\{app.Guid}\\Screenshots\\Thumbnail";
            //    var thumbnails = Directory.EnumerateFiles(thumbnailPath);

            //    thumbnails.ForEach(thumb =>
            //    {
            //        app.Screenshots.Add(new Screenshot()
            //        {
            //            AppId = app.Id,
            //            FileName = Path.GetFileName(thumb),
            //            Type = ScreenshotType.Mobile
            //        });
            //    });

            //}

            context.SaveChanges();
        }
        public void RegisterNaturalPerson(NaturalPersonDataContract naturalPersonDataContract, string password, string[] userRoles)
        {
            // Create User
            var person = NaturalPersonBiz.Create(naturalPersonDataContract.ToNaturalPerson());

            MembershipBiz.CreateMembershipForPerson(person, password);

            // Assign Roles
            if (userRoles.Count() > 0)
            {
                RoleBiz
                .Where(role => userRoles.Contains(role.Name))
                .ToList()
                .ForEach(role => person.Roles.Add(role));
            }

            //
            _context.SaveChanges();
        }
        public void SetApps()
        {
            WindowsStoreContext context = new WindowsStoreContext();
            var apps = context.AppVersions.ToList();// .Include("AppVersion").ToList();

            foreach (var app in apps)
            {
                app.Size = 3161464;
            }
            ;

            context.SaveChanges();
        }
        public ServerDescriptorDataContract RegisterDevice(UserClientDescriptorDataContract descriptor)
        {
            DeviceBiz.RegisterDevice(descriptor.GetDevice());
            ActiveDeviceHistoryBiz.IncrementTodayActiveDevicesCount();
            _context.SaveChanges();

            return(new ServerDescriptorDataContract()
            {
                SupportedUserClientMinVersion = ConfigurationReader.SupportedUserClientMinVersion,
                SupportedUserClientMaxVersion = ConfigurationReader.SupportedUserClientMaxVersion,
                SupportedDeveloperClientMaxVersion = ConfigurationReader.SupportedDeveloperClientMinVersion,
                SupportedDeveloperClientMinVersion = ConfigurationReader.SupportedDeveloperClientMaxVersion,
            });
        }
        public void AddApp()
        {
            WindowsStoreContext context = new WindowsStoreContext();
            var paasteelProvider        = context.LegalPeople.Single(lp => lp.PrimaryEmail == "*****@*****.**");
            var universalPlatform       = context.Platforms.First(p => p.PlatformCategory == PlatformCategory.Windows10Universal);
            var appCategories           = context.AppCategories.ToList();

            FileInfo packageInfo    = new FileInfo(@"D:\WindowsPhoneApps\Music Beta\arm.appx");
            var      icon128X128    = File.ReadAllBytes(@"D:\WindowsPhoneApps\zoomit-ir\128.png");
            var      icon256X256    = File.ReadAllBytes(@"D:\WindowsPhoneApps\zoomit-ir\128.png");
            var      appTitle       = "#Music Beta";
            var      appDescription =
                "" + Environment.NewLine +
                "" + Environment.NewLine +
                "" + Environment.NewLine +


                "";
            var appVersionDescription = "رفع اشکال نمایش دیدگاه ها";
            var appCategory           = appCategories.ElementAt(6);
            var cpuArchitecture       = CpuArchitecture.Arm;
            var version = "1.0.0.0";

            var app = new App
            {
                Guid                 = Guid.NewGuid(),
                Developer            = paasteelProvider,
                Name                 = appTitle,
                Description          = appDescription,
                Icon128X128          = icon128X128,
                Icon256X256          = icon256X256,
                AppCategory          = appCategory,
                CpuArchitectureFlags = cpuArchitecture,
                State                = AppState.Published,
            };

            app.Platforms.Add(universalPlatform);
            app.AppVersions.Add(new AppVersion()
            {
                Description = appVersionDescription,
                Downloads   = 0,
                PublishDate = DateTime.Now,
                Version     = version,
                Size        = packageInfo.Length
            });
            context.Apps.Add(app);
            context.SaveChanges();
        }
Beispiel #7
0
        private void RegisterFiles()
        {
            var files = Directory.EnumerateFiles(screenshotsDirectoryTextBox.Text);
            var app   = appsComboBox.SelectedItem as App;

            foreach (var file in files)
            {
                app.Screenshots.Add(new Screenshot()
                {
                    App      = app,
                    FileName = Path.GetFileName(file),
                    Type     = Store.Common.Enum.ScreenshotType.Mobile
                });
            }

            context.SaveChanges();
            MessageBox.Show("Screenshots renamed & Registered!");
        }
        public void AddDemoApps()
        {
            Random rnd = new Random();
            WindowsStoreContext context = new WindowsStoreContext();
            var developer         = context.People.Single(p => p.PrimaryEmail == "*****@*****.**");
            var appCategories     = context.AppCategories.ToList();
            var description       = string.Concat(Enumerable.Repeat("توضیحات مربوط به برنامه.", 10));
            var universalPlatform = context.Platforms.First(p => p.PlatformCategory == PlatformCategory.Windows10Universal);

            for (int i = 1; i <= 100; i++)
            {
                var icon128x128 = File.ReadAllBytes($"D:\\png\\1 ({(i % 13) + 1}).png");
                var app         = new App
                {
                    Guid                 = Guid.NewGuid(),
                    Developer            = developer,
                    Name                 = $"برنامه {i}",
                    Description          = $"توضیحات مربوط به برنامه شماره {i}",
                    Icon128X128          = icon128x128,
                    Icon256X256          = icon128x128,
                    AppCategory          = appCategories.ElementAt(rnd.Next(appCategories.Count())),
                    CpuArchitectureFlags = CpuArchitecture.Arm,
                    State                = AppState.Published,
                };

                for (int versionCounter = 1; versionCounter <= 2; versionCounter++)
                {
                    app.AppVersions.Add(new AppVersion()
                    {
                        Description = description,
                        Downloads   = rnd.Next(1000),
                        PublishDate = DateTime.Now.AddDays(rnd.Next(-1000, 1000)),
                        Version     = $"{versionCounter}.0.0.0",
                        Size        = 0
                    });
                }

                app.Platforms.Add(universalPlatform);
                context.Apps.Add(app);
            }

            context.SaveChanges();
        }
Beispiel #9
0
        static void Main(string[] args)
        {
            WindowsStoreContext context = new WindowsStoreContext();
            var apps = context.Apps.Where(app => app.Guid != Guid.Empty);

            foreach (var app in apps)
            {
                var thumbnailPath = $"C:\\Paasteel\\Apps\\{app.Guid}\\Screenshots\\Thumbnail";
                var thumbnails    = Directory.EnumerateFiles(thumbnailPath);

                thumbnails.ForEach(thumb =>
                {
                    app.Screenshots.Add(new Screenshot()
                    {
                        AppId    = app.Id,
                        FileName = Path.GetFileName(thumb),
                        Type     = ScreenshotType.Mobile
                    });
                });
            }
            context.SaveChanges();



            //bool b=   TestCall();
            //System.ServiceModel.NetHttpBinding biding = new NetHttpBinding();
            //EndpointAddress endPoint = new EndpointAddress("http://localhost:1578/Service/DeveloperService.svc/~/Service/Developer.svc");
            //DeveloperService.DeveloperServiceClient proxy2 = new DeveloperService.DeveloperServiceClient(biding, endPoint);

            //try
            //{
            //    proxy2.SignIn("", "");

            //}
            //catch (FaultException<GeneralInternalFault> x)
            //{

            //    Console.WriteLine(x.Detail.FaultCode);
            //}
            //catch (FaultException)
            //{

            //}



            //AppsService.AppsServiceClient appClient = new AppsService.AppsServiceClient("BasicHttpBinding_IAppsService");
            //Console.WriteLine(appClient.GetServiceName());
            //appClient.Close();

            //Console.ReadLine();
            //1
            //  createProxyAndReadData_1();

            //2
            //readServiceNameAsynk_2();
            //Console.WriteLine("get service name called asycronoslly...");
            //Console.ReadLine();

            //3
            //
        }
        public void Seed(WindowsStoreContext context)
        {
            #region Platform
            var platform1 = new Platform
            {
                PlatformCategory = PlatformCategory.Windows10Universal,
                Title            = "ویندوز 10، یونیورسال"
            };
            var platform2 = new Platform
            {
                PlatformCategory = PlatformCategory.Windows10Desktop,
                Title            = "ویندوز 10، خانواده دسکتاپ"
            };
            var platform3 = new Platform
            {
                PlatformCategory = PlatformCategory.Windows10Mobile,
                Title            = "ویندوز 10، خانواده موبایل"
            };
            var platform4 = new Platform
            {
                PlatformCategory = PlatformCategory.Windows10XBox,
                Title            = "ویندوز 10، خانواده XBox"
            };
            var platform5 = new Platform
            {
                PlatformCategory = PlatformCategory.Windows10Iot,
                Title            = "ویندوز 10، خانواده IOT"
            };
            var platform6 = new Platform
            {
                PlatformCategory = PlatformCategory.Windows10HoloLens,
                Title            = "ویندوز 10، خانواده HoloLens"
            };

            context.Platforms.AddRange(
                new Platform[] { platform1, platform2, platform3, platform4, platform5, platform6 });

            #endregion

            #region AppCategory
            var appCategory1 = new AppCategory {
                AppType = AppType.Application, Title = "کسب و کار"
            };
            var appCategory2 = new AppCategory {
                AppType = AppType.Application, Title = "توسعه نرم افزار"
            };
            var appCategory3 = new AppCategory {
                AppType = AppType.Application, Title = "غذا و آشپزی"
            };
            var appCategory4 = new AppCategory {
                AppType = AppType.Application, Title = "خانواده"
            };
            var appCategory5 = new AppCategory {
                AppType = AppType.Application, Title = "سبک زندگی"
            };
            var appCategory6 = new AppCategory {
                AppType = AppType.Application, Title = "موسیقی"
            };
            var appCategory7 = new AppCategory {
                AppType = AppType.Application, Title = "مسافرت-نقشه"
            };
            var appCategory8 = new AppCategory {
                AppType = AppType.Application, Title = "خبر-آب‌ و‌ هوا"
            };
            var appCategory9 = new AppCategory {
                AppType = AppType.Application, Title = "تصویر و ویدیو"
            };
            var appCategory10 = new AppCategory {
                AppType = AppType.Application, Title = "خرید"
            };
            var appCategory11 = new AppCategory {
                AppType = AppType.Application, Title = "ابزار"
            };
            var appCategory12 = new AppCategory {
                AppType = AppType.Application, Title = "کتاب‌ها و مراجع"
            };
            var appCategory13 = new AppCategory {
                AppType = AppType.Application, Title = "خرید"
            };
            var appCategory14 = new AppCategory {
                AppType = AppType.Application, Title = "اجتماعی"
            };
            var appCategory15 = new AppCategory {
                AppType = AppType.Application, Title = "ورزش"
            };
            var appCategory16 = new AppCategory {
                AppType = AppType.Application, Title = "ابزار"
            };
            var appCategory17 = new AppCategory {
                AppType = AppType.Game, Title = "اکشن"
            };
            var appCategory18 = new AppCategory {
                AppType = AppType.Game, Title = "کارت و تخته"
            };
            var appCategory19 = new AppCategory {
                AppType = AppType.Game, Title = "آموزشی"
            };
            var appCategory20 = new AppCategory {
                AppType = AppType.Game, Title = "پلتفرمر"
            };
            var appCategory21 = new AppCategory {
                AppType = AppType.Game, Title = "معمایی"
            };
            var appCategory22 = new AppCategory {
                AppType = AppType.Game, Title = "پرواز"
            };
            var appCategory23 = new AppCategory {
                AppType = AppType.Game, Title = "تیراندازی"
            };
            var appCategory24 = new AppCategory {
                AppType = AppType.Game, Title = "شبیه‌سازی"
            };
            var appCategory25 = new AppCategory {
                AppType = AppType.Game, Title = "استراتژی"
            };
            var appCategory26 = new AppCategory {
                AppType = AppType.Game, Title = "کلمات"
            };

            context.AppCategories.AddRange(new AppCategory[] {
                appCategory1, appCategory2, appCategory3, appCategory4, appCategory5,
                appCategory6, appCategory7, appCategory8, appCategory9, appCategory10,
                appCategory11, appCategory12, appCategory13, appCategory14, appCategory15,
                appCategory16, appCategory17, appCategory18, appCategory19, appCategory20,
                appCategory21, appCategory22, appCategory23, appCategory24, appCategory25,
                appCategory26
            }
                                           );
            #endregion

            #region Role
            var AdminRole = new Role {
                Title = "Admin", Name = "Admin"
            };
            var developerRole = new Role {
                Title = "Developer", Name = "Developer"
            };
            context.Roles.AddRange(new Role[] { AdminRole, developerRole });
            #endregion

            #region LegalPerson
            var paasteelCompany = new LegalPerson
            {
                PrimaryEmail = "*****@*****.**",
                Name         = "پاستیل",
                Membership   = new Membership
                {
                    CreateDate = DateTime.Now,
                    FailedPasswordAttemptCount = 0,
                    IsApproved                   = true,
                    IsIdentityVerified           = true,
                    IsLockedOut                  = true,
                    Password                     = SecurityHelper.ComputeSha256Hash("12345"),
                    VerificationCodeLastSendDate = DateTime.Now,
                    VerificationCode             = 0
                }
            };

            var paasteelAppProvider = new LegalPerson
            {
                PrimaryEmail = "*****@*****.**",
                Name         = "(گرد آورنده: پاستیل)",
                Membership   = new Membership
                {
                    CreateDate = DateTime.Now,
                    FailedPasswordAttemptCount = 0,
                    IsApproved                   = true,
                    IsIdentityVerified           = true,
                    IsLockedOut                  = true,
                    Password                     = SecurityHelper.ComputeSha256Hash("12345"),
                    VerificationCodeLastSendDate = DateTime.Now,
                    VerificationCode             = 0
                }
            };
            context.LegalPeople.AddRange(new LegalPerson[] { paasteelCompany, paasteelAppProvider });
            #endregion

            #region Natural Person
            var mehrdad = new NaturalPerson
            {
                PrimaryEmail = "*****@*****.**",
                FirstName    = "مهرداد",
                LastName     = "تاجدینی",
                Age          = 29,
                Sexuality    = Sexuality.Male,
                Membership   = new Membership
                {
                    CreateDate = DateTime.Now,
                    FailedPasswordAttemptCount = 0,
                    IsApproved                   = true,
                    IsIdentityVerified           = true,
                    IsLockedOut                  = true,
                    Password                     = SecurityHelper.ComputeSha256Hash("12345"),
                    VerificationCodeLastSendDate = DateTime.Now,
                    VerificationCode             = 0
                }
            };
            mehrdad.Roles.Add(AdminRole);
            mehrdad.Roles.Add(developerRole);

            var vahid = new NaturalPerson
            {
                PrimaryEmail = "*****@*****.**",
                FirstName    = "وحید",
                LastName     = "انصاری",
                Age          = 29,
                Sexuality    = Sexuality.Male,
                Membership   = new Membership
                {
                    CreateDate = DateTime.Now,
                    FailedPasswordAttemptCount = 0,
                    IsApproved                   = true,
                    IsIdentityVerified           = true,
                    IsLockedOut                  = true,
                    Password                     = SecurityHelper.ComputeSha256Hash("12345"),
                    VerificationCodeLastSendDate = DateTime.Now,
                    VerificationCode             = 0
                }
            };
            vahid.Roles.Add(AdminRole);
            vahid.Roles.Add(developerRole);

            context.NaturalPeople.AddRange(new NaturalPerson[] { mehrdad, vahid });
            #endregion

            #region App
            var paasteelApp = new App
            {
                Guid                 = Guid.Empty,
                Developer            = paasteelCompany,
                Name                 = "پاستیل",
                Description          = "پاستیل",
                Icon128X128          = new byte[1],
                Icon256X256          = new byte[1],
                AppCategory          = appCategory16,
                State                = AppState.Unpublished,
                CpuArchitectureFlags = CpuArchitecture.Arm,
            };
            paasteelApp.Platforms.Add(platform1);
            paasteelApp.AppVersions.Add(new AppVersion()
            {
                Downloads   = 0,
                PublishDate = DateTime.Now,
                Description = "پاستیل",
                Version     = "1.0.0.0",
                Size        = 0
            });
            context.Apps.Add(paasteelApp);
            #endregion

            context.SaveChanges();
        }
Beispiel #11
0
 public void RegisterApp(AppDataContract appDataContract)
 {
     AppBiz.Create(appDataContract.ToApp());
     _context.SaveChanges();
 }