コード例 #1
0
        public ClientImageInfo GetUserImageByID(string PhotoID)
        {
            CExecSql        sql = new CExecSql();
            ClientImageInfo ret = new ClientImageInfo();

            ret.PhotoData = sql.GetImage(PhotoID);
            ret.PhotoID   = PhotoID;
            return(ret);
        }
コード例 #2
0
        public App SetupApp(BaiduAppDetail appItem, AppProject appProject, App app)
        {
            var originalApp  = CloneHelper.DeepClone <App>(app);
            var originalApp2 = RedisService.Get <App>(app.Id);

            app.AppNo             = appProject.AppNo;
            app.AppProjectId      = appProject.Id;
            app.UseGreaterVersion = true;
            ClientImageInfo lg = new ClientImageInfo
            {
                BelongsToAppId = app.Id,
                FileUrl        = Path.Combine(LogoDirRoot, GetFileNameFromUri(GetDownloadUrl(appItem.IconUrl))),
                TypeId         = AppConfigKey.CLIENT_IMAGE_TYPE_ID
            };

            RedisService.Add <ClientImageInfo>(lg);
            app.ClientLogos = new List <ClientImageInfo>
            {
                lg
            };

            ImageInfo lg2 = new ImageInfo
            {
                BelongsToAppId = app.Id,
                FileUrl        = Path.Combine(LogoDirRoot, GetFileNameFromUri(GetDownloadUrl(appItem.IconUrl)))
            };

            RedisService.Add <ImageInfo>(lg2);
            app.Logo = lg2;

            app.Name          = appItem.Name;
            app.OrderNumber   = appItem.Score;
            app.DownloadTimes = appItem.Score;
            app.Status        = 1;
            var screenShotlist = GetScreenShotlist(appItem);

            foreach (var s in screenShotlist)
            {
                ImageInfo ss = new ImageInfo
                {
                    BelongsToAppId = app.Id,
                    FileUrl        = Path.Combine(ScreenshotDirRoot, GetFileNameFromUri(GetDownloadUrl(s)))
                };
                RedisService.Add <ImageInfo>(ss);
                app.ScreenShot.Add(ss);
            }
            app.PlatformType = AppConfigKey.PLATFORM_TYPE_ID.ConfigValue().ToInt32();
            app.Summary      = appItem.Summary.Replace("<br/>", string.Empty).Replace("<br>", string.Empty);
            var changeLog = appItem.ChangeLog.Replace("<br/>", string.Empty).Replace("<br>", string.Empty).Replace("NULL", string.Empty);

            app.Summary = string.Format("{0}\r\n{1}", app.Summary, changeLog);
            RedisService.UpdateWithRebuildIndex <App>(originalApp2, app);

            return(app);
        }
コード例 #3
0
        public String PostFile()
        {
            ANICshare share = new ANICshare();

            ClientImageInfo image_info = new ClientImageInfo();


            share.dbHost      = dbHost;
            share.dbPort      = dbPort;
            share.dbUser      = dbUser;
            share.dbPass      = dbPass;
            share.dbName      = dbName;
            share.db_testName = db_testName;


            image_info.dbHost      = dbHost;
            image_info.dbPort      = dbPort;
            image_info.dbUser      = dbUser;
            image_info.dbPass      = dbPass;
            image_info.dbName      = dbName;
            image_info.db_testName = db_testName;

            share.refresh_connection();



            var context = (HttpContextBase)Request.Properties["MS_HttpContext"];

            context.Request.InputStream.Seek(0, SeekOrigin.Begin);
            String ret = string.Empty;

            using (var sr = new StreamReader(context.Request.InputStream, Encoding.UTF8, true, 1024, true))
            {
                string   observation_id = "";
                string   examined_by    = "";
                string   command        = "";
                string[] bodyValues     = sr.ReadToEnd().Split(';');

                try
                {
                    command        = share.dencry_value(bodyValues[0]);
                    observation_id = share.dencry_value(bodyValues[2]);
                    examined_by    = share.dencry_value(bodyValues[3]);
                }
                catch (Exception)
                {
                    throw;
                }
                if (!share.dencry_value(bodyValues[1]).Equals(dbUser))
                {
                    return(null);
                }

                ///0; db_name; oberserver_id; examineby; path; StartIndex; PhotoBytes


                switch (command)
                {
                case "0":
                    //登陆
                    //      if (bodyValues[1] == "admin" && bodyValues[2] == "123456")
                    //      {
                    ret = image_info.CreateNewFile(bodyValues[6]);
                    //删除除了今天创建的文件。保存目录下只留下今天的文件。
                    try
                    {
                        image_info.DeleteOldDayFile();
                    }
                    catch (Exception e)
                    {
                        return(e.Message);
                    }
                    return(ret);

                    //     }
                    break;

                case "1":
                    //追到到指定文件当中

                    ret = image_info.AppandToFile(bodyValues[4], bodyValues[5], bodyValues[6]);

                    break;

                case "2":
                    //完成文件的上传。
                    ret = image_info.CmpleteUpLoadFile(bodyValues[4], observation_id, examined_by, bodyValues[6]);

                    break;

                case "3":
                    //完成文件的上传。
                    ret = "Cancel Upload";
                    try
                    {
                        File.Delete(@bodyValues[3]);
                    }
                    catch (Exception e)
                    {
                        return(e.Message + "\n" + @bodyValues[3]);
                    }
                    break;
                }
            }

            return("true");
        }
コード例 #4
0
        private AppProject AddNewApp(TencentAppStoreModel.AppListItem app, AppProject appProject, AppInfo appInfo)
        {
            try
            {
                #region Set up Applist
                appProject = new AppProject();
                var appProjectId = RedisService.Add <AppProject>(appProject);
                App ap           = new App();
                var appId        = RedisService.Add <App>(ap);
                AppSettingsForAppList appSetting = new AppSettingsForAppList()
                {
                    Id             = appId,
                    CreateDateTime = DateTime.Now
                };
                CustomProperty prop = new CustomProperty()
                {
                    Id    = AppConfigKey.OS_ATTR_ID,
                    Value = AppConfigKey.OS_ATTR_VALUE
                };
                RedisService.AddCustomPropertyFor <App, CustomProperty>(ap.Id, prop);


                var lcdDetails = AppStoreUIService.GetElementDetailList(AppConfigKey.LCD_ATTR_ID);
                foreach (var lcd in lcdDetails)
                {
                    SetLCD(ap.Id, lcd.Value.ToString());
                }

                AppStoreUIService.SetAppForAppList <AppProject>(appProjectId, appSetting);
                #endregion

                #region Set up app project
                var originalAppProject = CloneHelper.DeepClone <AppProject>(appProject);
                appProject.AppNo       = "tencent_" + app.appid;
                appProject.Creator     = app.cpname;
                appProject.LogoFile    = GetFileNameFromUri(appInfo.logo);
                appProject.Name        = appInfo.name;
                appProject.PackageName = appInfo.packageName;
                appProject.Rate        = appInfo.star.ToFloat();
                RedisService.UpdateWithRebuildIndex <AppProject>(originalAppProject, appProject);
                #endregion

                #region Set up App
                var originalApp  = CloneHelper.DeepClone <App>(ap);
                var originalApp2 = RedisService.Get <App>(ap.Id);

                ap.AppNo             = appProject.AppNo;
                ap.AppProjectId      = appProject.Id;
                ap.UseGreaterVersion = true;
                ClientImageInfo lg = new ClientImageInfo
                {
                    BelongsToAppId = ap.Id,
                    FileUrl        = Path.Combine(LogoDirRoot, GetFileNameFromUri(appInfo.logo)),
                    TypeId         = "1"
                };
                RedisService.Add <ClientImageInfo>(lg);
                ap.ClientLogos = new List <ClientImageInfo>
                {
                    lg
                };

                ImageInfo lg2 = new ImageInfo
                {
                    BelongsToAppId = ap.Id,
                    FileUrl        = Path.Combine(LogoDirRoot, GetFileNameFromUri(appInfo.logo))
                };
                RedisService.Add <ImageInfo>(lg2);
                ap.Logo = lg2;

                ap.Name          = appInfo.name;
                ap.OrderNumber   = appInfo.downnum;
                ap.DownloadTimes = appInfo.downnum;
                ap.Status        = 1;
                foreach (var s in appInfo.images)
                {
                    ImageInfo ss = new ImageInfo
                    {
                        BelongsToAppId = ap.Id,
                        FileUrl        = Path.Combine(ScreenshotDirRoot, GetFileNameFromUri(s))
                    };
                    RedisService.Add <ImageInfo>(ss);
                    ap.ScreenShot.Add(ss);
                }
                ap.PlatformType = AppConfigKey.PLATFORM_TYPE_ID.ConfigValue().ToInt32();
                ap.Summary      = appInfo.detail.Replace("<br/>", string.Empty).Replace("<br>", string.Empty);
                RedisService.UpdateWithRebuildIndex <App>(originalApp2, ap);
                #endregion

                #region Set up App Version
                if (!string.IsNullOrEmpty(appInfo.apkurl))
                {
                    FileInfo fi = new FileInfo(Path.Combine(APK_Folder_Base, GetFileNameFromUri(appInfo.apkurl)));

                    if (fi != null && fi.Exists)
                    {
                        AppVersion ver = new AppVersion
                        {
                            FileSize        = (int)fi.Length,
                            FileUrl         = GetFileNameFromUri(appInfo.apkurl),
                            PublishDateTime = appInfo.updatetime,
                            Status          = 1,
                            VersionName     = appInfo.apkver,
                            Id = appInfo.versionCode.ToString()
                        };
                        RedisService.SetSubModel <App, AppVersion>(ap.Id, ver);
                        AppStoreUIService.SetAppCurrentTestVersion(appId, ver.Id);
                        AppStoreUIService.PublishAppVersion(appId);

                        AndroidPackageView apkInfo = FileService.GetAndroidPackageInfomation(fi.FullName);
                        apkInfo.Id = ver.Id;
                        RedisService.SetSubModel <App, AndroidPackageView>(ap.Id, apkInfo);
                    }
                }
                #endregion

                #region Set up tags
                if (appInfo.type.StartsWith("soft", StringComparison.OrdinalIgnoreCase))
                {
                    AppStoreUIService.AddTagForAppProject(AppConfigKey.TAG_SOFTWARE, appProject.Id);
                    AppStoreUIService.AddTagForAppProject(AppConfigKey.TAG_TOT_10_SOFTWARE, appProject.Id);
                }
                else
                {
                    AppStoreUIService.AddTagForAppProject(AppConfigKey.TAG_GAME, appProject.Id);
                    AppStoreUIService.AddTagForAppProject(AppConfigKey.TAG_TOT_10_GAMES, appProject.Id);
                }
                AppStoreUIService.AddTagForAppProject(AppConfigKey.TAG_LATEST, appProject.Id);
                AppStoreUIService.AddTagForAppProject(appInfo.category, appProject.Id);
                AddMarketTag(appInfo.category, ap.Id);
                AppStoreUIService.AddTagForApp("Live", ap.Id);
                AppStoreUIService.AddTagForApp("Valid", ap.Id);
                AppStoreUIService.AddTagForAppProject("From_tencent", appProject.Id);
                #endregion
            }
            catch (Exception ex)
            {
                LogHelper.WriteError(ex.Message + ex.StackTrace);
                LogHelper.WriteInfo(string.Format("This AppProject {0} will delete, appProjectId is {1}", appProject.Name, appProject.Id));
                AppProjectDelete(appProject.Id);
            }
            return(appProject);
        }