Ejemplo n.º 1
0
        /*public void GetAllFiles(ref List<string> filesList,string path)
        {
            if (!Directory.Exists(path))
                return;

            DirectoryInfo di = new DirectoryInfo(path);

            foreach (DirectoryInfo d in di.GetDirectories()){
                int indx = -1;
                indx = MainClass.Settings.IgnoresFolders.FindIndex(x => x.Folder == d.Name && x.IsForIde);

                if(indx<0){
                    GetAllFiles(ref filesList, d.FullName);
                }
            }

            foreach (FileInfo f in di.GetFiles()) {

                //if (f.Extension == ".ms") continue;

                filesList.Add( f.FullName );
            }

        }*/
        public void GeneratePublishCombination()
        {
            if(this.ProjectUserSetting.CombinePublish != null)
                this.ProjectUserSetting.CombinePublish.Clear();

            if (String.IsNullOrEmpty(this.ProjectArtefac)){
                string name = System.IO.Path.GetFileNameWithoutExtension(this.AppFilePath);
                this.ProjectArtefac = String.Format("{0}_$({1})_$({2})", name, MainClass.Settings.Platform.Name, MainClass.Settings.Resolution.Name);
            }

            List<Condition> fullCondition = new List<Condition>();

            //fullCondition.Add(MainClass.Settings.Platform.Clone());

            /*if ((this.SelectResolution == null) ||
                (this.SelectResolution.Count < 1)) {

                this.SelectResolution = new List<int>();
                SelectResolution.Add(-1);
            }*/

            // pridam rozlisenie,
            //fullCondition.Add(this.Resolution.Clone());

            fullCondition.Add(MainClass.Settings.Resolution.Clone());

            // pridam Conditions, ale len tie ktore su vmene pre aplikaciu
            foreach (Condition con in this.ConditoinsDefine) {
                int i = this.ProjectArtefac.IndexOf(String.Format("$({0})", con.Name));
                if (i > -1)
                    fullCondition.Add(con.Clone());
            }

            int indx = 0;
            List<CombinePublish> listCC = new List<CombinePublish>();

            // kombinacie si predplnim aplikaciami
            foreach (Rule rl in MainClass.Settings.Platform.Rules) {

                CombinePublish cc = new CombinePublish();

                CombineCondition cr = new CombineCondition();
                cr.RuleId = rl.Id;
                cr.RuleName = rl.Specific;
                cr.ConditionId = MainClass.Settings.Platform.Id;
                cr.ConditionName = MainClass.Settings.Platform.Name;
                cc.combineRule = new List<CombineCondition>();
                cc.combineRule.Add(cr);
                //cc.ProjectName = this.ProjectArtefac;
                cc.ProjectName = this.ProjectArtefac.Replace(String.Format("$({0})", cr.ConditionName), cr.RuleName);
                listCC.Add(cc);
            }

            // samotne kombibnacie
            while (indx < fullCondition.Count) {
                List<CombinePublish> listCCcopy = MainClass.Tools.Clone<CombinePublish>(listCC);
                listCC.Clear();
                foreach (CombinePublish cc in listCCcopy)

                        foreach (Rule rl in fullCondition [indx].Rules){
                            CombinePublish cc2 = cc.Clone();

                            CombineCondition cr = new CombineCondition();
                            cr.RuleId = rl.Id;
                            if (fullCondition [indx].Name == MainClass.Settings.Resolution.Name)
                                cr.RuleName = rl.Specific;
                            else
                                cr.RuleName = rl.Name;
                            cr.ConditionId = fullCondition [indx].Id;
                            cr.ConditionName = fullCondition [indx].Name;
                            cc2.combineRule.Add(cr);
                            cc2.ProjectName = cc2.ProjectName.Replace(String.Format("$({0})", cr.ConditionName), cr.RuleName);
                            listCC.Add(cc2);
                        }
                indx++;
            }
            ProjectUserSetting.CombinePublish = new List<CombinePublish>(listCC.ToArray());
            // return listCC;
        }