Example #1
0
        // �v���W�F�N�g�̐ݒ�𔽉f���܂��B
        public override EcmResponse Post(HttpRequest rq)
        {
            // �V���� Setting �C���X�^���X��쐬

            Setting newSetting = new Setting();
            Type t = newSetting.GetType();
            PropertyInfo[] fields = t.GetProperties();
            foreach(PropertyInfo pi in fields){

                //XmlIgnore ��?
                bool ignore = false;
                Object[] attrs = pi.GetCustomAttributes(false);
                foreach(Object o in attrs){
                    if(o is XmlIgnoreAttribute){
                        ignore = true;
                        break;
                    }
                }
                if(ignore) continue;

                string propValue = rq.Form[pi.Name];
                Type propType = pi.PropertyType;
                Object result = null;
                if(propType == typeof(int)){
                    int intResult = 0;
                    int.TryParse(propValue, out intResult);
                    result = intResult;
                } else if(propType == typeof(bool)){
                    if(propValue != null){
                        result = true;
                    } else {
                        result = false;
                    }
                } else if(propType.IsEnum){
                    try{
                        result = Enum.Parse(propType, propValue);
                    } catch {
                        result = 0;
                    }
                } else if(propType == typeof(string)){
                    result = propValue;
                }
                pi.SetValue(newSetting, result, null);
            }

            XmlSerializer xs = new XmlSerializer(typeof(Setting));

            using(FileStream fs = myProject.Setting.BaseFile.Open(FileMode.Create, FileAccess.Write, FileShare.None)){
                using(StreamWriter sw = new StreamWriter(fs)){
                    xs.Serialize(fs, newSetting);
                    sw.Close();
                }
                fs.Close();
            }

            XmlElement p = myXhtml.P();
            p.InnerText = "�ݒ��ۑ����܂����B";
            return new HtmlResponse(myXhtml, p);
        }
Example #2
0
 public EcmPluginParams(Parser p, Setting s, EcmProject e, MarkedData incoming, int calledCount)
 {
     myParser = p;
     mySetting = s;
     myProject = e;
     myMarkedData = incoming;
     myCalledCount = calledCount;
 }
Example #3
0
        public EcmTemplate(EcmProject proj, string templateName)
        {
            myProject = proj;
            mySetting = proj.Setting;
            myName = templateName;

            string templateFileName = mySetting.TemplateFullPath.FullName.TrimEnd('\\') + '\\' + templateName + '.' + mySetting.TemplateExt.TrimStart('.');
            myFile = new FileInfo(templateFileName);
            myBackupFile = new FileInfo(GetBackupPath());
        }
Example #4
0
 // �R���X�g���N�^
 public PluginCompiler(Setting s)
 {
     mySetting = s;
 }
Example #5
0
File: eccm.cs Project: bakera/ECCM
        // �V�K�v���W�F�N�g��lj����܂��B
        private void PostNewProject()
        {
            string projName = Request.Form[ProjectIdEditName];

            if(string.IsNullOrEmpty(projName)){
                ShowError("�v���W�F�N�g ID ���w�肳��Ă��܂���B");
                XmlNode form = GetNewProjectForm();
                xhtml.Body.AppendChild(form);
                return;
            }
            if(!ProjectIdRegex.IsMatch(projName)){
                ShowError("�v���W�F�N�g ID [{0}]�͐���������܂���B" + ProjectIdRuleDescription, projName);
                XmlNode form = GetNewProjectForm();
                xhtml.Body.AppendChild(form);
                return;
            }

            FileInfo fi = new FileInfo(GetXmlPath(projName));
            if(fi.Exists){
                ShowError("�v���W�F�N�g ID [{0}]�͊��Ɏg�p����Ă��܂��B", projName);
                XmlNode form = GetNewProjectForm();
                xhtml.Body.AppendChild(form);
                return;
            }

            if(!fi.Directory.Exists){
                fi.Directory.Create();
            }

            Setting newSetting =  new Setting();
            XmlSerializer xs = new XmlSerializer(typeof(Setting));
            using(FileStream fs = fi.Open(FileMode.Create, FileAccess.Write, FileShare.None)){
                using(StreamWriter sw = new StreamWriter(fs)){
                    xs.Serialize(fs, newSetting);
                    sw.Close();
                }
                fs.Close();
            }

            XmlElement a = GetLink(projName + "�̃y�[�W", projName);
            ;
            XmlElement p = xhtml.P(null, "�v���W�F�N�g [" + projName + "] ��쐬���܂����B", a);
            xhtml.Body.AppendChild(p);
        }
Example #6
0
 // �R���X�g���N�^
 public EcmProject(EcmProjectManager manager, Setting s)
 {
     myManager = manager;
     mySetting = s;
     if(File.Exists(s.CsvFullPath)) LoadData();
 }
Example #7
0
 // �R���X�g���N�^
 public EcmProcessorBase(EcmProject proj)
 {
     myProject = proj;
     mySetting = proj.Setting;
 }