Exemple #1
0
        public void saveAs(string file_Name)
        {
            fileName = file_Name;
            FX        fx   = (FX)fxWin.Tag;
            ArrayList data = fxWin.getData();

            common.COH_IO.writeDistFile(data, fileName);
            FxLauncher.FXLauncherForm.runFx(fileName, (COH_CostumeUpdaterForm)this.FindForm());
        }
Exemple #2
0
 public Condition(int fx_index, FX fx, bool isComment)
 {
     isDirty = false;
     parent  = fx;
     events  = new ArrayList();
     initialize_cParameters();
     this.fxIndex = fx_index;
     isCommented  = isComment;
 }
Exemple #3
0
        public void setConditionsData(FX fx)
        {
            settingCells = true;

            if (this.dataGridView1.Rows.Count > 0)
            {
                this.dataGridView1.Rows.Clear();
            }

            foreach (Condition condition in fx.conditions)
            {
                setCondition(condition);
            }

            settingCells = false;
        }
Exemple #4
0
        public static ArrayList parse(string fileName, ref ArrayList fileContent)
        {
            ArrayList fxList = new ArrayList();

            ArrayList conditions = new ArrayList();

            ArrayList inputs = new ArrayList();

            if (FX_Parser.mBones == null)
            {
                FX_Parser.mBones = new ArrayList();
            }
            else
            {
                FX_Parser.mBones.Clear();

                common.COH_IO.fillList(FX_Parser.mBones, @"assetEditor/objectTrick/bones.txt", true);
            }

            FX fx = null;

            ArrayList fxData = null;

            int fxStartIndex = -1, fxEndIndex = -1;

            string fxName = System.IO.Path.GetFileNameWithoutExtension(fileName);

            bool isFx = false;

            bool createFx = false;

            int endCount = 0;

            int maxEndCount = 0;

            for (int j = 0; j < fileContent.Count; j++)
            {
                System.Windows.Forms.Application.DoEvents();

                string line = (string)fileContent[j];

                line = common.COH_IO.removeExtraSpaceBetweenWords(line.Replace("\t", " ")).Trim();

                line = line.Replace("//", "#");

                if (isFx != true && line.ToLower().StartsWith("FxInfo".ToLower()))
                {
                    fxStartIndex = j;

                    isFx = true;

                    createFx = false;

                    fx = new FX(fileName);

                    fxData = new ArrayList();
                }

                else if (isFx)
                {
                    fxData.Add(line);

                    bool isComment = line.StartsWith("#");

                    //skip title lines that has multiple # Char
                    if (isComment && line.Substring(1).Trim().StartsWith("#") && j != fileContent.Count - 1)
                    {
                        continue;
                    }

                    if (line.ToLower().StartsWith("Flags".ToLower()))
                    {
                        string flagsStr = line.Substring("Flags ".Length).Split('#')[0];

                        string[] flags = flagsStr.Split(' ');

                        foreach (string flag in flags)
                        {
                            if (fx.flags.ContainsKey(fixFXflags(flag)))
                            {
                                fx.flags[flag] = true;
                            }
                        }
                    }

                    else if (line.ToLower().StartsWith("Input".ToLower()))
                    {
                        maxEndCount++;

                        string input = FX_Parser.getInput(fileContent, ref j);

                        if (input != null)
                        {
                            inputs.Add(input);
                        }
                        else
                        {
                            maxEndCount--;
                        }
                    }

                    //haldle comment for condition and fx tags
                    if (isComment)
                    {
                        line = line.Substring(1).Trim();
                    }

                    if (line.ToLower().StartsWith("Condition".ToLower()))
                    {
                        int conditionIndex = fxList.Count;

                        conditions.Add(new Condition(conditionIndex, fx, isComment));

                        fillCondition(fileContent, ref j, ref conditions);
                    }

                    else if (line.IndexOf(' ') > -1)
                    {
                        string tagStr = fixFXtag(line.Substring(0, line.IndexOf(' ')).Trim());

                        string tagVal = line.Substring(tagStr.Length).Trim();

                        if (fx.fParameters.ContainsKey(tagStr))
                        {
                            if (isComment)
                            {
                                tagVal = "#" + tagVal;
                            }

                            //if tgaVal is not commented overwrite param value
                            if (!isComment)
                            {
                                fx.fParameters[tagStr] = tagVal;
                            }

                            //to avoid overwriting a value line by a commented line
                            else if (fx.fParameters[tagStr] == null)
                            {
                                fx.fParameters[tagStr] = tagVal;
                            }
                        }
                    }
                    //&& !isComment added to skip commented end
                    if (line.ToLower().Equals("End".ToLower()) && !isComment)
                    {
                        endCount++;
                    }

                    if (endCount > maxEndCount || j == fileContent.Count - 1)
                    {
                        isFx = false;

                        fxEndIndex = j;

                        createFx = true;
                    }

                    if (createFx)
                    {
                        fx.conditions.AddRange(conditions);

                        fx.inputs.AddRange(inputs);

                        fxList.Add(fx);

                        endCount = 0;

                        maxEndCount = 0;
                    }
                }
            }

            return(fxList);
        }