Exemplo n.º 1
0
        public static bool checkFilepathLength(PropertyInfo property, object classObj, ExportItem exportItem)
        {
            bool   result = true;
            string text   = string.Empty;

            object[] customAttributes = property.GetCustomAttributes(typeof(PropertyCategoryAttribute), false);
            if (0 < customAttributes.Length)
            {
                PropertyCategoryAttribute propertyCategoryAttribute = customAttributes[0] as PropertyCategoryAttribute;
                if (!string.IsNullOrEmpty(propertyCategoryAttribute.PropertyCategory))
                {
                    text = text + "[" + propertyCategoryAttribute.PropertyCategory + "] -> ";
                }
            }
            customAttributes = property.GetCustomAttributes(typeof(PropertyDisplayNameAttribute), false);
            if (0 < customAttributes.Length)
            {
                PropertyDisplayNameAttribute propertyDisplayNameAttribute = customAttributes[0] as PropertyDisplayNameAttribute;
                if (!string.IsNullOrEmpty(propertyDisplayNameAttribute.PropertyDisplayName))
                {
                    text = text + "[" + propertyDisplayNameAttribute.PropertyDisplayName + "] : ";
                }
            }
            else
            {
                text = text + "[" + property.Name + "] : ";
            }
            switch (property.Name)
            {
            case "m_bgmFilePath":
            case "m_imageFilePath":
            case "m_filePath":
            case "m_iconFilePath":
                if (32 < exportItem.m_exportFile.Length)
                {
                    result = false;
                    text   = text + "\"" + exportItem.m_exportFile + "\"";
                    text  += "\n";
                    text  += ErrorMsg.GetString(ErrorMsg.DEFINES.OVER_PATH_LENGTH);
                    object obj = text;
                    text = string.Concat(obj, " ", exportItem.m_exportFile.Length.ToString(), "/", 32, "(chars)\n");
                    Dialog.AddMsg(text);
                }
                if (!string.IsNullOrEmpty(exportItem.m_exportThumbnailFile) && 32 < exportItem.m_exportThumbnailFile.Length)
                {
                    result = false;
                    text   = text + "\"" + exportItem.m_exportThumbnailFile + "\"";
                    text  += "\n";
                    text  += ErrorMsg.GetString(ErrorMsg.DEFINES.OVER_PATH_LENGTH);
                    object obj2 = text;
                    text = string.Concat(obj2, " ", exportItem.m_exportThumbnailFile.Length.ToString(), "/", 32, "(chars)\n");
                    Dialog.AddMsg(text);
                }
                break;
            }
            return(result);
        }
Exemplo n.º 2
0
        public override bool CheckProperties()
        {
            bool   result = true;
            string msg;

            if (!string.IsNullOrEmpty(m_bgmFilePath))
            {
                if (!checkFileSize(out msg, m_bgmFilePath, 5242880L))
                {
                    msg = m_bgmFilePath + msg + "\n";
                    Dialog.AddMsg(msg);
                    result = false;
                }
                if (!BgmChecker.bgmFileCheck(m_bgmFilePath))
                {
                    msg = ErrorMsg.GetString(ErrorMsg.DEFINES.INVALID_BGM_FILE) + " : " + m_bgmFilePath + "\n";
                    Dialog.AddMsg(msg);
                    result = false;
                }
            }
            string empty = string.Empty;
            string text  = empty;

            empty = text + "[" + GetPropertyCategory(this, "m_bgParam") + "] -> [" + GetPropertyDisplayName(this, "m_bgParam") + "] -> ";
            for (int i = 0; i < m_bgParam.Length; i++)
            {
                if (!checkImageFile(out msg, m_bgParam[i].m_imageFilePath, 32, false, 960, 512, 614400L))
                {
                    msg = empty + "[" + i + "] -> [" + GetPropertyDisplayName(m_bgParam[i], "m_imageFilePath") + "] : " + m_bgParam[i].m_imageFilePath + "\n" + msg;
                    Dialog.AddMsg(msg);
                    result = false;
                }
            }
            if (!checkImageFile(out msg, m_basePageFilePath, 22, 22, 4096L))
            {
                msg = "[" + GetPropertyCategory("m_basePageFilePath") + "] -> [" + GetPropertyDisplayName("m_basePageFilePath") + "] : " + m_basePageFilePath + "\n" + msg;
                Dialog.AddMsg(msg);
                result = false;
            }
            if (!checkImageFile(out msg, m_curPageFilePath, 22, 22, 4096L))
            {
                msg = "[" + GetPropertyCategory("m_curPageFilePath") + "] -> [" + GetPropertyDisplayName("m_curPageFilePath") + "] : " + m_curPageFilePath + "\n" + msg;
                Dialog.AddMsg(msg);
                result = false;
            }
            if (!checkEmptyPage())
            {
                result = false;
            }
            return(result);
        }
        private bool checkLangaugeParam(LanguageParam lp, string prefix)
        {
            bool result = true;

            Encoding.GetEncoding("utf-8");
            string msg;

            if (lp.m_param != null)
            {
                PropertyInfo[] properties = lp.m_param.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.FlattenHierarchy);
                PropertyInfo[] array      = properties;
                foreach (PropertyInfo propertyInfo in array)
                {
                    object[] customAttributes = propertyInfo.GetCustomAttributes(typeof(SaveAttribute), false);
                    if (0 < customAttributes.Length)
                    {
                        string text = (string)propertyInfo.GetValue(lp.m_param, null);
                        if (!string.IsNullOrEmpty(text) && !checkStringByteSize(out msg, text, 127))
                        {
                            string text2 = "[" + GetPropertyDisplayName(lp, "m_param") + "] -> [" + GetPropertyDisplayName(propertyInfo) + "] : ";
                            msg = prefix + text2 + msg;
                            Dialog.AddMsg(msg);
                            result = false;
                        }
                    }
                }
            }
            if (!checkStringNullOrEmpty(out msg, lp.m_default))
            {
                msg  = prefix + "[" + GetPropertyDisplayName(lp, "m_default") + "] : " + msg;
                msg += ErrorMsg.GetString(ErrorMsg.DEFINES.MUST_PARAMETER);
                msg += "\n";
                Dialog.AddMsg(msg);
                result = false;
            }
            else if (!checkStringByteSize(out msg, lp.m_default, 127))
            {
                msg = prefix + "[" + GetPropertyDisplayName(lp, "m_default") + "] : " + msg;
                Dialog.AddMsg(msg);
                result = false;
            }
            return(result);
        }
Exemplo n.º 4
0
        private bool checkEmptyPage()
        {
            bool   result = true;
            string msg    = string.Empty;

            int[]          array      = new int[10];
            PropertyInfo[] properties = GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.FlattenHierarchy);
            PropertyInfo[] array2     = properties;
            foreach (PropertyInfo propertyInfo in array2)
            {
                object value = propertyInfo.GetValue(this, null);
                if (!(value is IconParam))
                {
                    continue;
                }
                object[] customAttributes = propertyInfo.GetCustomAttributes(typeof(SaveAttribute), false);
                if (0 >= customAttributes.Length)
                {
                    continue;
                }
                string empty = string.Empty;
                empty = empty + "[" + GetPropertyCategory(propertyInfo) + "] -> ";
                empty = empty + "[" + GetPropertyDisplayName(propertyInfo) + "]";
                IconParam iconParam = value as IconParam;
                if (!checkImageFile(out msg, iconParam.m_iconFilePath, 32, false, 128, 128, 32768L))
                {
                    msg = empty + " -> [" + GetPropertyDisplayName(iconParam, "m_iconFilePath") + "] : " + iconParam.m_iconFilePath + "\n" + msg;
                    Dialog.AddMsg(msg);
                    result = false;
                }
                if (iconParam.m_pagePos != -1)
                {
                    if (checkPageIndex(out msg, iconParam.m_pagePos, 10))
                    {
                        array[iconParam.m_pagePos]++;
                        continue;
                    }
                    msg = empty + " -> [" + GetPropertyDisplayName(iconParam, "m_pagePos") + "] : \n" + msg;
                    Dialog.AddMsg(msg);
                    result = false;
                }
            }
            string text = string.Empty;

            for (int j = 0; j < 10; j++)
            {
                if (array[j] != 0)
                {
                    continue;
                }
                bool flag = false;
                for (int k = j + 1; k < 10; k++)
                {
                    if (array[k] != 0)
                    {
                        flag = true;
                    }
                }
                if (flag)
                {
                    text += ErrorMsg.GetString(ErrorMsg.DEFINES.NON_CONTIGUOUS_PAGE);
                    text  = text + " : Page " + j + "\n";
                }
            }
            if (!string.IsNullOrEmpty(text))
            {
                Dialog.AddMsg(text);
                result = false;
            }
            return(result);
        }