Exemple #1
0
        private ConfType get_node_conf_type(XmlNode node)
        {
            ConfType.Type type = ConfType.Type.unk;
            XmlAttribute  attr = get_attr(node, "ConfigurationType");

            if (attr != null)
            {
                try {
                    type = (ConfType.Type)XmlConvert.ToInt32(attr.Value);
                }
                catch {
                }
            }
            return(ConfType.find(type));
        }
Exemple #2
0
        public static IConfigurationRoot GetConfiguration(this IServiceCollection services, ConfType confType)
        {
            var builder = new ConfigurationBuilder();

            builder.SetBasePath(Directory.GetCurrentDirectory())
            .AddJsonFile(ConfigPaths[confType]);

            return(builder.Build());
        }
Exemple #3
0
 public static void AddConfiguration(this IServiceCollection services, ConfType confType, string configPath)
 {
     ConfigPaths.Add(confType, configPath);
 }
Exemple #4
0
        private ListViewItem prepare_item(XmlNode conf)
        {
            string cname = get_node_name(conf);
            string pname = "unk";
            int    ind   = cname.IndexOf('|');

            if (ind != -1)
            {
                pname = cname.Substring(ind + 1);
                cname = cname.Substring(0, ind);
            }

            bool   correct = true;
            string rtl_name;
            int    rtl_code = get_rtl_code(conf);

            if (rtl_code == -1)
            {
                rtl_name = "unk";
            }
            else
            {
                RtlType mt = RtlType.find(rtl_code);
                if (mt == null)
                {
                    rtl_name = "unk";
                }
                else
                {
                    rtl_name = mt.ToString();
                    string   curr = cname.ToLower();
                    ConfType cf   = get_node_conf_type(conf);
                    if ((cf.id == ConfType.Type.app) || (cf.id == ConfType.Type.make) || (cf.id == ConfType.Type.util) || (cf.id == ConfType.Type.unk))
                    {
                        ;
                    }
                    else if (!mt.m_multi)
                    {
                        correct = false;
                    }
                    else
                    {
                        int len;
                        int pos = -1;
                        if (mt.m_release)
                        {
                            pos = curr.IndexOf("release");
                            len = 7;
                        }
                        else
                        {
                            pos = curr.IndexOf("debug");
                            len = 5;
                        }
                        if (pos == -1)
                        {
                            correct = false;
                        }
                        else if (-1 != curr.IndexOf("dll"))
                        {
                            correct = false;
                        }
                        else
                        {
                            string   rest_of_name = curr.Substring(pos).Trim().ToLower();
                            char[]   separator    = new char[] { ' ' };
                            string[] parts        = rest_of_name.Split(separator);
                            string   rest         = parts[0];
                            rest = rest.Substring(len).Trim();
                            ind  = rest.IndexOf('s');
                            if (!mt.m_dynamic && (ind == -1))
                            {
                                correct = false;
                            }
                            else if (mt.m_dynamic && (ind != -1))
                            {
                                correct = false;
                            }
                        }
                    }
                }
            }

            string ctype = get_node_conf_type_name(conf);

            string[] vals = new string[COL_NUM];
            vals[COL_WARN]     = correct ? "" : "X";
            vals[COL_CTYPE]    = ctype;
            vals[COL_CNAME]    = cname;
            vals[COL_PLATFORM] = pname;
            vals[COL_RTL_NAME] = rtl_name;
            vals[COL_OUT_DIR]  = get_node_out_dir(conf);
            return(new ListViewItem(vals));
        }
Exemple #5
0
        private string get_node_conf_type_name(XmlNode node)
        {
            ConfType cf = get_node_conf_type(node);

            return(cf.name);
        }
 public WatcherInfo(NanoAmount amount, ConfType confType, string hash)
 {
     this.amount   = amount;
     this.confType = confType;
     this.hash     = hash;
 }
Exemple #7
0
 private void BindDataSetField(ref DataSet dataSet, Aspect.Domain.Configuration conf, ConfType type, Aspect.Domain.Configuration alternate)
 {
     if (type == ConfType.Nulled) {
         DataRow row = dataSet.Tables[0].NewRow();
         row["hideConfigurationID"] = Guid.Empty;
         row["hideProductID"] = Guid.Empty;
         row["hideType"] = "nulled";
         row["Name"] = SafeWhiteString(conf.Product._dictNomen.superpole);
         row["Version"] = SafeWhiteString(conf.Product.Version);
         row["Count"] = SafeWhiteString(conf.Quantity.ToString());
         row["Position"] = SafeWhiteString(conf.Position);
         row["Comment"] = SafeWhiteString(conf.Comment);
         row["Ngroup"] = SafeWhiteString(conf.GroupNumber.ToString());
         row["Ngrchange"] = SafeWhiteString(conf.GroupToChange.ToString());
         row["Zone"] = SafeWhiteString(conf.Zone);
         dataSet.Tables[0].Rows.Add(row);
     }
     else {
         DataRow row = dataSet.Tables[0].NewRow();
         row["hideConfigurationID"] = conf.ID;
         row["hideProductID"] = conf.ProductID;
         switch (type)
         {
             case ConfType.Normal: row["hideType"] = "normal"; break;
             case ConfType.Changed: row["hideType"] = "changed"; break;
             case ConfType.Newed: row["hideType"] = "newed"; break;
         }
         row["Name"] = conf.Product._dictNomen.superpole;
         if (!alternate.ID.Equals(Guid.Empty))
         {
             row["hideAlternateID"] = alternate.ProductID;
             row["ImageCompare"] = "~/img/compare.png";
         }
         row["Version"] = conf.Product.Version;
         row["Count"] = conf.Quantity;
         row["Position"] = conf.Position;
         row["Comment"] = conf.Comment;
         row["Ngroup"] = conf.GroupNumber;
         row["Ngrchange"] = conf.GroupToChange;
         row["Zone"] = conf.Zone;
         dataSet.Tables[0].Rows.Add(row);
     }
 }