Exemple #1
0
        public IGenericSearchServicesBuilder AddList <TRequest, TEntity, TResult>(Action <IListExpression <TRequest, TEntity, TResult> > action = null)
        {
            var profile    = new ListProfile();
            var expression = profile.AddList <TRequest, TEntity, TResult>();

            action?.Invoke(expression);
            services.AddSingleton <IListDefinitionSource>(profile);
            return(this);
        }
Exemple #2
0
        internal void Create(ListProfile lp)
        {
            string sql = @"
      INSERT INTO listProfiles
      (profileId, listId)
      VALUES
      (@ProfileId, @ListId);";

            _db.Execute(sql, lp);
        }
        internal void Create(ListProfile lr, string id)
        {
            Listy list = _lr.GetById(lr.ListId);

            if (list == null)
            {
                throw new Exception("Invalid Id");
            }
            if (list.CreatorId != id)
            {
                throw new NotAuthorized("Not The Owner of this List");
            }
            _repo.Create(lr);
        }
Exemple #4
0
        public IGenericSearchServicesBuilder Configure(Action <ListProfile> configureAction)
        {
            var profile = new ListProfile();

            configureAction(profile);

            var source = (IListDefinitionSource)profile;

            foreach (var definition in source.Definitions)
            {
                services.AddSingleton(definition);
            }

            return(this);
        }
Exemple #5
0
        public async Task <ActionResult <string> > Create([FromBody] ListProfile lp)
        {
            try
            {
                Profile userInfo = await HttpContext.GetUserInfoAsync <Profile>();

                _service.Create(lp, userInfo.Id);
                return(Ok("success"));
            }
            catch (NotAuthorized e)
            {
                return(Forbid(e.Message));
            }
            catch (System.Exception e)
            {
                return(BadRequest(e.Message));
            }
        }
    private static string EditVersionJson(string graphName)
    {
        // popupを開く。
        // ファイルが存在しない場合、ファイルを作成
        // ファイルはAssetBundleListの作成に使用される。
        // Autoyaが入っているフォルダを見つける必要がある。
        var autoyaAssetGraphIntegrationInstalledPath = GetTargetFolderPath("Autoya.AssetGraphIntegration", "Assets");

        if (string.IsNullOrEmpty(autoyaAssetGraphIntegrationInstalledPath))
        {
            Debug.LogError("Autoya.AssetGraphIntegration folder not found.");
            return(string.Empty);
        }

        var targetPath = Path.Combine(autoyaAssetGraphIntegrationInstalledPath, "ListVersionSettings");

        if (!Directory.Exists(targetPath))
        {
            Directory.CreateDirectory(targetPath);
        }

        var settingFilePaths = Directory.GetFiles(targetPath).ToList();


        var generatedFilePath = string.Empty;

        // graph名の指定がある場合、内部からの呼び出しなので、ファイルがなければ作成する。
        if (!string.IsNullOrEmpty(graphName))
        {
            var settingFileNames = settingFilePaths.Select(s => Path.GetFileNameWithoutExtension(s));
            if (settingFileNames.Contains(graphName))
            {
                var filePath = Path.Combine(targetPath, graphName + ".json");
                return(filePath);
            }
            else
            {
                var targetListVersionSettingPath = Path.Combine(targetPath, graphName + ".json");

                var defaultVersionJson = new ListProfile();
                defaultVersionJson.identity = graphName;
                defaultVersionJson.version  = "0";
                var jsonStr = JsonUtility.ToJson(defaultVersionJson);

                using (var sw = new StreamWriter(targetListVersionSettingPath, false))
                {
                    sw.WriteLine(jsonStr);
                }
                AssetDatabase.Refresh();

                return(targetListVersionSettingPath);
            }
        }

        var saveActions  = new List <VersionSettingAndSaveAction>();
        var allFilePaths = Directory.GetFiles(targetPath).Where(p => !p.EndsWith(".meta")).ToArray();

        foreach (var filePath in allFilePaths)
        {
            var contents = string.Empty;
            using (var sr = new StreamReader(filePath))
            {
                contents = sr.ReadToEnd();
            }

            var listVersinSetting = JsonUtility.FromJson <ListProfile>(contents);

            Action <string> saveAct = newVersion =>
            {
                if (newVersion != listVersinSetting.version)
                {
                    listVersinSetting.version = newVersion;
                    var jsonStr = JsonUtility.ToJson(listVersinSetting);
                    using (var sw = new StreamWriter(filePath, false))
                    {
                        sw.WriteLine(jsonStr);
                    }

                    AssetDatabase.Refresh();
                }
            };

            var isNew = filePath == generatedFilePath;
            var versionSettingAndSaveAction = new VersionSettingAndSaveAction(listVersinSetting.identity, listVersinSetting.version, saveAct);
            saveActions.Add(versionSettingAndSaveAction);
        }

        // ポップアップを開く
        var window = EditorWindow.GetWindow <AssetBundleListVersionSettingsEditWindow>(typeof(AssetBundleListVersionSettingsEditWindow));

        window.Init(saveActions);
        window.titleContent = new GUIContent("ABListVer Edit");

        return(string.Empty);
    }