示例#1
0
        public void AdddNode(string Path, profileNode newNode)
        {
            profileNode aux;

            if (Path == null || Path.Length == 0 || Path == "/")
            {
                masterNode.Add(newNode.profName, newNode);
                return;
            }

            aux = FindNode(Path);
            if (aux != null && !aux.childrens.ContainsKey(newNode.profName))
            {
                aux.childrens.Add(newNode.profName, newNode);
            }
            else
            {
                throw new Exception("New node cannot be added, wrong Path!");
            }
        }
示例#2
0
        public void GenerateProfile(profileNode item)
        {
            Process myProc = new Process();

            myProc.StartInfo.FileName = item.profProgram;
            myProc.StartInfo.RedirectStandardOutput = false;
            myProc.StartInfo.RedirectStandardError  = false;
            myProc.StartInfo.UseShellExecute        = false;
            //myProc.StartInfo.CreateNoWindow = true ;

/*            Environment.SetEnvironmentVariable("INSTALLDIR", set.installDir);
 *          Environment.SetEnvironmentVariable("INPUTFILE", listFile);
 *          Environment.SetEnvironmentVariable("OUTPUTFILE", item.OutFileName);*/
            string param = item.progParameters;

            myProc.StartInfo.Arguments = param + " " + item.OutFileName;


            myProc.Start();
            myProc.WaitForExit();
        }
示例#3
0
        public Dictionary <string, protInfo> ReadProfile(profileNode node)
        {
            string   line;
            bool     flag = false;
            protInfo profile;
            Dictionary <string, protInfo> profList = new Dictionary <string, protInfo>();
            string protName;

            if (File.Exists(node.OutFileName))
            {
                StreamReader file = null;
                try
                {
                    file = new StreamReader(node.OutFileName);
                    line = file.ReadLine();
                    while (line != null)
                    {
                        if (line.Contains(">"))
                        {
                            string[] profState;
                            profile = new protInfo();
                            flag    = true;
                            string [] nameTmp;
                            protName = line.Replace(">", "");

                            nameTmp          = protName.Split(new char [] { '/', '\\' });
                            protName         = nameTmp[nameTmp.Length - 1];
                            profile.sequence = file.ReadLine();
                            line             = file.ReadLine();
                            profState        = line.Split(' ');

                            profile.profile = new List <byte>(profState.Length);
                            foreach (var item in profState)
                            {
                                profile.profile.Add(node.GetCodedState(item));
                            }
                            if (profile.sequence.Length > 5 || profile.profile.Count != 0)
                            {
                                profList.Add(protName, profile);
                            }
                            line = file.ReadLine();
                        }
                        else
                        {
                            line = file.ReadLine();
                        }
                    }
                }
                finally
                {
                    if (file != null)
                    {
                        file.Close();
                    }
                }
                if (!flag)
                {
                    throw new Exception("Error: In the profile file: " + node.OutFileName + " could not find line that begins with > ");
                }
            }

            return(profList);
        }
示例#4
0
 public profileNode(profileNode copy)
 {
     CopyNode(copy);
 }