Exemplo n.º 1
0
        // IMMUTABLE - all fields are readonly, all variables are immutable
        // A configuration is a set of information about a skyline file, data, reports and scripts.
        // To be a valid configuration, it must contain enough of this information to run a batch
        // script that will copy the skyline file, import data, export reports, and run r scripts.


        public SkylineBatchConfig(string name, DateTime created, DateTime modified, MainSettings mainSettings, ReportSettings reportSettings, SkylineSettings skylineSettings)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentException(Resources.SkylineBatchConfig_Please_enter_a_name_for_the_configuration_);
            }
            Name            = name;
            Created         = created;
            Modified        = modified;
            MainSettings    = mainSettings;
            ReportSettings  = reportSettings;
            SkylineSettings = skylineSettings;
        }
Exemplo n.º 2
0
        public static SkylineBatchConfig ReadXml(XmlReader reader)
        {
            var      name = reader.GetAttribute(Attr.Name);
            DateTime created;
            DateTime modified;

            DateTime.TryParse(reader.GetAttribute(Attr.Created), out created);
            DateTime.TryParse(reader.GetAttribute(Attr.Modified), out modified);

            do
            {
                reader.Read();
            } while (reader.NodeType != XmlNodeType.Element);

            MainSettings    mainSettings     = null;
            ReportSettings  reportSettings   = null;
            SkylineSettings skylineSettings  = null;
            string          exceptionMessage = null;

            try
            {
                mainSettings = MainSettings.ReadXml(reader);
                do
                {
                    reader.Read();
                } while (reader.NodeType != XmlNodeType.Element);
                reportSettings = ReportSettings.ReadXml(reader);
                do
                {
                    reader.Read();
                } while (reader.NodeType != XmlNodeType.Element);
                skylineSettings = SkylineSettings.ReadXml(reader);
            }
            catch (ArgumentException e)
            {
                exceptionMessage = string.Format("\"{0}\" ({1})", name, e.Message);
            }

            do
            {
                reader.Read();
            } while (!(reader.Name == "skylinebatch_config" && reader.NodeType == XmlNodeType.EndElement));

            if (exceptionMessage != null)
            {
                throw new ArgumentException(exceptionMessage);
            }

            return(new SkylineBatchConfig(name, created, modified, mainSettings, reportSettings, skylineSettings));
        }
Exemplo n.º 3
0
 protected bool Equals(SkylineSettings other)
 {
     return(Type == other.Type);
 }