Esempio n. 1
0
        /// <summary>
        /// 
        /// </summary>
        protected void SetRampData()
        {
            Param.UnLoadValues();
            Param.LoadSettings();
            Param.SetValue(Param.InputType, _projInputType);
            Param.LoadSettings();
            //ramp.RampId = "ykmb9i6zlh";
            CreatedOn = DateTime.Now.ToString("r");
            Ready = "Y";
            Title = Param.GetMetadataValue(Param.Title, Param.GetOrganization());
            BroadType = _projInputType.ToLower() == "dictionary" ? "wider_audience" : "vernacular";
            TypeMode = "Text";
            FormatMedium = "Paper";
            DescStage = "rough_draft";
            VersionType = "first";
            IncludeScriptureProperty();
            TypeScholarlyWork = "Book";
            AddSubjLanguage(Common.GetLanguageCode(_folderPath, _projInputType, true));
            //CoverageSpacialRegionHas = "Y";//
            //AddCoverageSpacialCountry("IN:India, Andhra Pradesh");//
            SubjectLanguageHas = "Y";
            AddLanguageIso(Common.GetLanguageCodeList(_folderPath, _projInputType));
            AddLanguageScript(Common.GetLanguageScriptList(_folderPath, _projInputType));
            string role = _projInputType.ToLower() == "scripture" ? "translator" : "compiler";
            AddContributor(Param.GetMetadataValue(Param.Creator).Replace(",", "--") + "," + role);
            FormatExtentText = GetNumberOfPdfPages(_folderPath);
            FormatExtentImages = GetImageCount(_folderPath);//
            if (Int32.Parse(FormatExtentImages) > 0)
            {
                TypeMode = TypeMode + ",Graphic";
            }
            ModifiedDate = DateTime.Now.ToString("yyyy-MM-dd");
            Publisher = Param.GetMetadataValue(Param.Publisher);
            //DescSponsership = Param.GetOrganization();
            //DescTableofContentsHas = " ";//
            SilDomain = "LING:Linguistics";
            DomainSubTypeLing = "lexicon (LING)";
            AddSubject(Param.GetMetadataValue(Param.Subject) + ",eng");
            RelRequiresHas = "Y";
            AddRelRequires(Common.GetFontList(_folderPath, _projInputType, _outputExtension));
            RelConformsto = "TTF";
            AddRightsHolder(Param.GetMetadataValue(Param.Publisher));
            Rights = GetLicenseFileName();//
            SilSensitivityMetaData = "Public";
            SilSensitivityPresentation = "Public";
            SilSensitivitySource = "Insite users";
            RampDescription = Param.GetMetadataCurrentValue(Param.Description);
            if (RampDescription != null && RampDescription.Trim().Length > 0)
            {
                RampDescriptionHas = "Y";
            }

            if (_folderPath != null)
            {
                string[] files = Directory.GetFiles(Path.GetDirectoryName(_folderPath));
                foreach (string file in files)
                {
                    RampFile rFile = new RampFile();
                    rFile.FileName = Path.GetFileName(file);
                    string fileExtn = Path.GetExtension(file);
                    if (fileExtn == ".odm" || fileExtn == ".jar" || fileExtn == ".epub" || fileExtn == ".mybible" || fileExtn == ".ldml")
                    {

                        rFile.FileDescription = Path.GetFileNameWithoutExtension(file) + " " + fileExtn.Replace(".", "") + " document";
                        rFile.FileRelationship = "presentation";
                        rFile.FileIsPrimary = "Y";
                        rFile.FileSilPublic = "Y";
                    }
                    else if (fileExtn == ".odt" || fileExtn == ".pdf" || fileExtn == ".jad" || fileExtn == ".nt")
                    {
                        rFile.FileDescription = Path.GetFileNameWithoutExtension(file) + " " + fileExtn.Replace(".", "") + " document";
                        rFile.FileRelationship = "presentation";
                        rFile.FileSilPublic = "Y";
                        if (_outputExtension.IndexOf(".odt") == 0 || _outputExtension.IndexOf(".pdf") == 0 || fileExtn == ".nt")
                        {
                            rFile.FileIsPrimary = "Y";
                        }
                    }
                    else if (fileExtn == ".xhtml")
                    {
                        rFile.FileDescription = Path.GetFileNameWithoutExtension(file) + " XHTML file";
                        rFile.FileRelationship = "source";
                    }
                    else if (fileExtn == ".css")
                    {
                        rFile.FileDescription = Path.GetFileNameWithoutExtension(file) + " stylesheet";
                        rFile.FileRelationship = "source";
                    }
                    AddFile(rFile);
                }
            }
            Status = "ready";
        }
Esempio n. 2
0
        private void AddFile(RampFile file)
        {
            string newFile = string.Empty;
            if (file.FileName != null)
            {
                newFile = " \": \"" + file.FileName;
            }
            if (file.FileDescription != null)
            {
                newFile = newFile + "\", \"description\": \"" + file.FileDescription;
            }
            if (file.FileRelationship != null)
            {
                newFile = newFile + "\", \"relationship\": \"" + file.FileRelationship;
            }
            if (file.FileIsPrimary != null)
            {
                newFile = newFile + "\", \"is_primary\": \"" + file.FileIsPrimary;
            }
            if (file.FileSilPublic != null)
            {
                newFile = newFile + "\", \"silPublic\": \"" + file.FileSilPublic;
            }
            RampFile.Add(newFile);

            if (file.FileName != null)
            {
                string isPrimary = string.Empty;
                if (file.FileIsPrimary != null)
                {
                    isPrimary = "preferred";
                }
                _fileList.Add(file.FileName, isPrimary);
            }
        }