Пример #1
0
        /// <summary>
        /// Writes the byte array to the file.
        /// </summary>
        public override void WriteBytes(DataCategory category, string path, byte[] bytes)
        {
            string fileName = GetFileName(category, path);

            ForceDirectory(fileName);
            File.WriteAllBytes(fileName, bytes);
        }
Пример #2
0
        /// <summary>
        /// Writes the text to the file.
        /// </summary>
        public override void WriteText(DataCategory category, string path, string contents)
        {
            string fileName = GetFileName(category, path);

            ForceDirectory(fileName);
            File.WriteAllText(fileName, contents, Encoding.UTF8);
        }
Пример #3
0
        private void ShowData(DataCategory category, GEDCOMRecordType recordType)
        {
            switch (category)
            {
            case DataCategory.RecentActivity:
                lvData.Clear();
                break;

            case DataCategory.JumpHistory:
                lvData.Clear();
                break;

            case DataCategory.PotencialProblems:
                lvData.Clear();
                break;

            case DataCategory.Filters:
                lvData.Clear();
                break;

            case DataCategory.Bookmarks:
                lvData.Clear();
                break;

            case DataCategory.Records:
                fBase.ShowRecordsTab(recordType);
                ShowRecordsData(recordType);
                break;
            }
        }
Пример #4
0
        public async Task <int> Handle(CreateDataBlockCommand request, CancellationToken cancellationToken)
        {
            DataCategory dataCategory = await _context.DataCategories
                                        .Include(dc => dc.DataBlocks)
                                        .SingleOrDefaultAsync(dc => dc.CreatedBy.Equals(request.UserId) &&
                                                              dc.Id == request.DataCategoryId,
                                                              cancellationToken);

            if (dataCategory == null)
            {
                throw new NotFoundException(nameof(DataCategory), request.DataCategoryId);
            }

            if (dataCategory.DataCategoryType == DataCategoryType.InfoBlock ||
                dataCategory.DataCategoryType == DataCategoryType.PersonInfo)
            {
                throw new Exception($"Can not copy to DataCategory with CategoryType = \"{dataCategory.DataCategoryType}\"");
            }

            DataBlock entity = new DataBlock();

            entity.DataCategoryId = dataCategory.Id;
            entity.Title          = request.Title;
            entity.OrderNumber    = dataCategory.DataBlocks.Count() + 1;

            switch (dataCategory.DataCategoryType)
            {
            case DataCategoryType.Education:
                FillDefaultEducationDataBlock(entity);
                break;

            case DataCategoryType.Residencies:
                FillDefaultResidenciesDataBlock(entity);
                break;

            case DataCategoryType.LaborActivities:
                FillDefaultLaborActivitiesDataBlock(entity);
                break;

            case DataCategoryType.ImportantEvents:
                FillDefaultImportantEventsDataBlock(entity);
                break;

            default:
                break;
            }

            if (entity.DataHolders != null)
            {
                foreach (var dataHolder in entity.DataHolders)
                {
                    dataHolder.Privacy = CreateDefaultPrivacy();
                }
            }

            _context.DataBlocks.Add(entity);
            await _context.SaveChangesAsync(cancellationToken);

            return(entity.Id);
        }
Пример #5
0
    /// <summary>
    /// Create and add an asset.
    /// </summary>
    void AddButton()
    {
        GUI.color = Color.green;
        if (GUILayout.Button("Add"))
        {
            dataCategory = (DataCategory)toolbarIndex;
            dynamic data = null;

            switch (dataCategory)
            {
            case DataCategory.Characters:
                data = ScriptableObject.CreateInstance <Character>();
                break;

            case DataCategory.Items:
                data = ScriptableObject.CreateInstance <Item>();
                break;

            case DataCategory.Spells:
                data = ScriptableObject.CreateInstance <Spell>();
                break;

            default:
                break;
            }

            if (data != null)
            {
                AssetDatabase.CreateAsset(data, mainFolderPath + "/" + dataCategory + "/" + data.id.ToString() + ".asset");
                AssetDatabase.SaveAssets();
                dataSelectedIndex = data.id;
            }
        }
    }
Пример #6
0
        public async Task <Unit> Handle(CopyDataBlocksCommand request, CancellationToken cancellationToken)
        {
            DataCategory dataCategory = await _context.DataCategories
                                        .Include(dc => dc.DataBlocks)
                                        .SingleOrDefaultAsync(dc => dc.CreatedBy.Equals(request.UserId) &&
                                                              dc.Id == request.DataCategoryId,
                                                              cancellationToken);

            if (dataCategory == null)
            {
                throw new NotFoundException(nameof(DataCategory), request.DataCategoryId);
            }

            if (dataCategory.DataCategoryType == DataCategoryType.InfoBlock ||
                dataCategory.DataCategoryType == DataCategoryType.PersonInfo)
            {
                throw new Exception($"Can not copy to DataCategory with CategoryType = \"{dataCategory.DataCategoryType}\"");
            }

            var dataBlocks = await _context.DataBlocks
                             .Include(db => db.DataHolders)
                             .ThenInclude(dh => dh.Privacy)
                             .Where(db => db.CreatedBy.Equals(request.UserId) &&
                                    request.DataBlocksIds.Contains(db.Id))
                             .ToListAsync(cancellationToken);

            foreach (var dataBlock in dataBlocks)
            {
                await _copying.CopyDataBlockToDataCategory(dataCategory, dataBlock, cancellationToken);
            }

            return(Unit.Value);
        }
Пример #7
0
        protected string GenerateSubmissionFileAndAddToTransaction(DataCategory dataCategory)
        {
            Dictionary <string, DbAppendSelectWhereClause> selectClauses = new Dictionary <string, DbAppendSelectWhereClause>();

            selectClauses.Add("CERS_CERS",
                              new DbAppendSelectWhereClause(_baseDao, "DATA_CATEGORY = ? AND EMIS_YEAR = ?", dataCategory.ToString(),
                                                            _emissionsYear));

            List <CERSDataType> dataList = _objectsFromDatabase.LoadFromDatabase <CERSDataType>(_baseDao, selectClauses);

            if (CollectionUtils.IsNullOrEmpty(dataList))
            {
                throw new ArgumentException(string.Format("No EIS data was found to submit for submission type \"{0}\"",
                                                          EnumUtils.ToDescription(dataCategory)));
            }
            else if (dataList.Count > 1)
            {
                throw new ArgumentException(string.Format("More than one set of EIS data was found for submission type \"{0}\"",
                                                          EnumUtils.ToDescription(dataCategory)));
            }
            else
            {
                CERSDataType data = dataList[0];
                AppendAuditLogEvent(GetSubmissionResultsString(data, dataCategory));
                return(GenerateSubmissionFileAndAddToTransaction(data, _dataRequest.TransactionId, _authorName, _organizationName,
                                                                 _senderContactInfo, _isProductionSubmission,
                                                                 _attachmentFolderPath, _baseDao));
            }
        }
    // Token: 0x060009F0 RID: 2544 RVA: 0x0002AE14 File Offset: 0x00029214
    public void Show(int categoryIndex)
    {
        base.gameObject.SetActive(true);
        DataCategory dataCategory = DataManager.Instance.dataDirectoryGroup.dataCategoryList[categoryIndex];
        Text         component    = base.transform.Find("TitleText").GetComponent <Text>();

        component.text = DataManager.Instance.dataLocalizationGroup.GetText(dataCategory.title);
        if (this._categroyIcon != null)
        {
            this._categroyIcon.transform.SetParent(null);
            UnityEngine.Object.Destroy(this._categroyIcon);
        }
        this._categroyIcon = ResourceHelper.Load(UICategroyDetialPanel.CATEGORY_ICON_PREFIX + dataCategory.title);
        Transform parent = base.transform.Find("IconPosition");

        this._categroyIcon.transform.SetParent(parent);
        this._categroyIcon.transform.localPosition = Vector2.zero;
        this._categroyIcon.transform.localScale    = Vector2.one;
        GameObject    gameObject = base.transform.Find("MyScrollView").gameObject;
        List <string> picList    = dataCategory.picList;

        if (picList.Count > 0)
        {
            this._grid = gameObject.transform.Find("Viewport/Grid").gameObject;
            foreach (string tid in picList)
            {
                this.AddCell(this._grid, tid);
            }
        }
    }
Пример #9
0
        public async Task <Unit> Handle(DeleteDataCategoryCommand request, CancellationToken cancellationToken)
        {
            DataCategory dataCategory = await _context.DataCategories
                                        .SingleOrDefaultAsync(dh => dh.CreatedBy.Equals(request.UserId) &&
                                                              dh.Id == request.Id,
                                                              cancellationToken);

            if (dataCategory == null)
            {
                throw new NotFoundException(nameof(DataHolder), request.Id);
            }

            if (!dataCategory.IsDeletable.Value)
            {
                throw new Exception("Can\'t delete DataHolder. This DataHolder isn\'t deletable");
            }

            var dataCategories = await _context.DataCategories
                                 .Where(dc => dc.PersonId == dataCategory.PersonId)
                                 .OrderBy(dc => dc.OrderNumber)
                                 .ToListAsync(cancellationToken);

            for (int i = dataCategory.OrderNumber; i < dataCategories.Count; i++)
            {
                dataCategories[i].OrderNumber = i;
            }

            _context.DataCategories.Remove(dataCategory);

            await _context.SaveChangesAsync(cancellationToken);

            return(Unit.Value);
        }
        public async Task <ActionResult> Edit([Bind(Include = "Id,Name")] DataCategory category)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    var responseString = await(Data.URL + "Categories/EditCategory").WithHeader("Authorization", Data.Token).PostJsonAsync(category);

                    if (responseString.IsSuccessStatusCode)
                    {
                        return(RedirectToAction("Index"));
                    }
                    else
                    {
                        return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                    }
                }

                return(View(category));
            }
            catch
            {
                return(new HttpStatusCodeResult(HttpStatusCode.RequestTimeout));
            }
        }
Пример #11
0
        public IEnumerator SaveOne <T>(Coroutine coroutine, Ranking _this, DataCategory cat, string key, T v)
            where T : IExtensible
        {
            PlayerLog.WriteLog((int)LogType.SaveRanking, "--------------------RankSave--------------------{0}", key);
            var ret = RankServer.Instance.DB.Set(coroutine, cat, key, v);

            yield return(ret);
        }
Пример #12
0
        public static DataTable FindName(string findCategoryName)
        {
            DataCategory obj = new DataCategory();

            obj.FindCategoryName = findCategoryName;

            return(obj.FindName(obj));
        }
Пример #13
0
        public static string Delete(int idcategory)
        {
            DataCategory obj = new DataCategory();

            obj.IdCategory = idcategory;

            return(obj.Delete(obj));
        }
Пример #14
0
        /// <summary>
        /// Gets a list of file paths that match the specified pattern.
        /// </summary>
        public override ICollection <string> GetFileList(DataCategory category, string path, string searchPattern)
        {
            string directory = GetFileName(category, path);

            return(Directory.Exists(directory)
                ? Directory.GetFiles(directory, searchPattern, SearchOption.AllDirectories)
                : Array.Empty <string>());
        }
Пример #15
0
        public static string Insert(string name, string description)
        {
            DataCategory obj = new DataCategory();

            obj.Name        = name;
            obj.Description = description;

            return(obj.Insert(obj));
        }
Пример #16
0
        public static string Update(int idcategory, string name, string description)
        {
            DataCategory obj = new DataCategory();

            obj.IdCategory  = idcategory;
            obj.Name        = name;
            obj.Description = description;

            return(obj.Update(obj));
        }
    // Token: 0x06000832 RID: 2098 RVA: 0x00022EC4 File Offset: 0x000212C4
    public void RefershAllImage()
    {
        int amount = DataManager.Instance.dataDirectoryGroup.amount;

        for (int i = 1; i < amount; i++)
        {
            DataCategory dataCategory = DataManager.Instance.dataDirectoryGroup.GetDataCategory(i);
            dataCategory.UpdateOtherCategory();
        }
    }
Пример #18
0
        public ServerApiClient(CommonRequestParams @params, CancellationToken cancellationToken = default(CancellationToken))
        {
            _http = new Http.Http(cancellationToken);
            _requestParameters = CommonRequestParams.ToRequestParameters(@params);

            Auth   = new AuthCategory(this);
            App    = new AppCategory(this);
            Data   = new DataCategory(this);
            Notice = new NoticeCategory(this);
        }
Пример #19
0
        public async Task CopyDataBlockToDataCategory(DataCategory dataCategory, DataBlock dataBlock, CancellationToken cancellationToken)
        {
            DataBlock entity = new DataBlock()
            {
                DataCategory = dataCategory,
                Title        = dataBlock.Title,
                OrderNumber  = dataCategory.DataBlocks.Count + 1,
                DataHolders  = new List <DataHolder>()
            };

            _context.DataBlocks.Add(entity);
            await _context.SaveChangesAsync(cancellationToken);

            var dataHolders = dataBlock.DataHolders
                              .OrderBy(dh => dh.OrderNumber)
                              .ToList();

            foreach (var dataHolder in dataHolders)
            {
                await CopyDataHolderToDataBlock(entity, dataHolder, cancellationToken);
            }

            var images = await _context.DataBlockImages
                         .Include(dbi => dbi.Image.Privacy)
                         .Where(dbi => dbi.DataBlockId == dataBlock.Id)
                         .Select(dbi => dbi.Image)
                         .ToListAsync(cancellationToken);

            foreach (var image in images)
            {
                await CopyImageToDataBlock(entity, image, cancellationToken);
            }

            var videos = await _context.DataBlockVideos
                         .Include(dbv => dbv.Video.Privacy)
                         .Where(dbv => dbv.DataBlockId == dataBlock.Id)
                         .Select(dbv => dbv.Video)
                         .ToListAsync(cancellationToken);

            foreach (var video in videos)
            {
                await CopyVideoToDataBlock(entity, video, cancellationToken);
            }

            var audios = await _context.DataBlockAudios
                         .Include(dba => dba.Audio.Privacy)
                         .Where(dba => dba.DataBlockId == dataBlock.Id)
                         .Select(dba => dba.Audio)
                         .ToListAsync(cancellationToken);

            foreach (var audio in audios)
            {
                await CopyAudioToDataBlock(entity, audio, cancellationToken);
            }
        }
Пример #20
0
        private IEnumerator DeleteData(Coroutine coroutine, DataCategory cat, string characterId)
        {
            var result = DB.Delete(coroutine, cat, characterId);

            yield return(result);

            if (result.Status != DataStatus.Ok)
            {
                Logger.Error("Save data for character {0} failed.", characterId);
            }
        }
Пример #21
0
 /// <summary>
 /// Reads text from the file.
 /// </summary>
 public override string ReadText(DataCategory category, string path)
 {
     if (category == DataCategory.View)
     {
         byte[] contents = ReadByteaContents(GetTableName(category), path);
         return(Encoding.UTF8.GetString(contents));
     }
     else
     {
         return(ReadVarcharContents(GetTableName(category), App, path));
     }
 }
 /// <summary>
 ///     Sets the passed <paramref name="anonymizerOption" /> <paramref name="anonymizerApproach" />
 /// </summary>
 /// <param name="anonymizerOption">the passed DataCategory to</param>
 /// <param name="anonymizerApproach">t</param>
 public void SetOption(DataCategory anonymizerOption, AnonymizerApproach anonymizerApproach)
 {
     try
     {
         Operations.Add(anonymizerOption, anonymizerApproach);
     }
     catch (ArgumentException)
     {
         Operations.Remove(anonymizerOption);
         Operations.Add(anonymizerOption, anonymizerApproach);
     }
 }
Пример #23
0
    void ShowElement(DataCategory dataCategory, int index)
    {
        showAllElementsPanel.SetActive(false);
        helpPanel.SetActive(false);
        showElementPanel.SetActive(true);

        //Clean the Panel
        showElementImage.sprite = null;
        showElementName.text    = "";
        showElementDesc.text    = "";

        switch (dataCategory)
        {
        case DataCategory.Characters:
            if (index < 0 || index > characters.Count - 1)
            {
                //print(characters.Count);
                DisplayMessage("Index out of range");
                return;
            }
            Character character = characters[index];
            showElementImage.sprite = character.sprite;
            showElementName.text    = character.name;
            showElementDesc.text    = character.ToString();
            break;

        case DataCategory.Items:
            if (index < 0 || index > items.Count - 1)
            {
                DisplayMessage("Index out of range");
                return;
            }
            Item item = items[index];
            showElementImage.sprite = item.sprite;
            showElementName.text    = item.name;
            showElementDesc.text    = item.ToString();
            break;

        case DataCategory.Spells:
            if (index < 0 || index > spells.Count - 1)
            {
                DisplayMessage("Index out of range");
                return;
            }
            Spell spell = spells[index];
            showElementName.text = spell.name;
            showElementDesc.text = spell.ToString();
            break;

        default:
            break;
        }
    }
Пример #24
0
        private IEnumerator SaveData <T>(Coroutine coroutine, DataCategory cat, string characterId, T data)
            where T : IExtensible
        {
            var result = DB.Set(coroutine, cat, characterId, data);

            yield return(result);

            if (result.Status != DataStatus.Ok)
            {
                Logger.Error("Save data for character {0} failed.", characterId);
            }
        }
Пример #25
0
 /// <summary>
 /// Opens a binary file for reading.
 /// </summary>
 public override BinaryReader OpenBinary(DataCategory category, string path)
 {
     if (category == DataCategory.View)
     {
         return(GetViewReader(path));
     }
     else
     {
         byte[] bytes = ReadBytes(category, path);
         return(new BinaryReader(new MemoryStream(bytes, false), Encoding.UTF8, false));
     }
 }
Пример #26
0
 /// <summary>
 /// Writes the byte array to the file.
 /// </summary>
 public override void WriteBytes(DataCategory category, string path, byte[] bytes)
 {
     if (category == DataCategory.View)
     {
         WriteByteaContents(GetTableName(category), path, bytes);
     }
     else
     {
         string contents = bytes == null ? null : Convert.ToBase64String(bytes);
         WriteVarcharContents(GetTableName(category), App, path, contents);
     }
 }
Пример #27
0
 /// <summary>
 /// Writes the text to the file.
 /// </summary>
 public override void WriteText(DataCategory category, string path, string contents)
 {
     if (category == DataCategory.View)
     {
         byte[] bytes = string.IsNullOrEmpty(contents) ? null : Encoding.UTF8.GetBytes(contents);
         WriteByteaContents(GetTableName(category), path, bytes);
     }
     else
     {
         WriteVarcharContents(GetTableName(category), App, path, contents);
     }
 }
Пример #28
0
 /// <summary>
 /// Reads a byte array from the file.
 /// </summary>
 public override byte[] ReadBytes(DataCategory category, string path)
 {
     if (category == DataCategory.View)
     {
         return(ReadByteaContents(GetTableName(category), path));
     }
     else
     {
         string contents = ReadVarcharContents(GetTableName(category), App, path);
         return(Convert.FromBase64String(contents));
     }
 }
Пример #29
0
        protected IEnumerator SaveData <T>(Coroutine coroutine, DataCategory cat, string GMName, T data)
            where T : IExtensible
        {
            var result = DB.Set(coroutine, cat, GMName, data);

            yield return(result);

            if (result.Status != DataStatus.Ok)
            {
                Logger.Error("Save data for GMName {0} failed.", GMName);
            }
        }
        public async Task <ActionResult> Create([Bind(Include = "Id,Name")] DataCategory category)
        {
            try
            {
                await(Data.URL + "Categories/AddCategory").WithHeader("Authorization", Data.Token).PostJsonAsync(category);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(new HttpStatusCodeResult(HttpStatusCode.RequestTimeout));
            }
        }
Пример #31
0
 public bool TryGetIndex(DataCategory category, out uint index)
 {
     return _categoryIndexMap.TryGetValue(DataKeys[category], out index);
 }
Пример #32
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ImportColumnType"/> class.
 /// </summary>
 /// <param name="displayName">The display name.</param>
 /// <param name="type">The type.</param>
 /// <param name="multiplicity">The multiplicity.</param>
 public ImportColumnType(string displayName, DataCategory type, Multiplicity multiplicity)
 {
     DisplayName = displayName;
     Type = type;
     Multiplicity = multiplicity;
 }