Esempio n. 1
0
        public Music(string[] raw_data) : base(raw_data[0], ObjectType.Music)
        {
            if (headerVariables == null)
            {
                InitializeHeaderVariables();
            }

            TrackFile = raw_data[1];

            if (ImportantMethods.IsNumericGZ(raw_data[2]))
            {
                TrackFlagsGZ = ulong.Parse(raw_data[2]);
                TrackFlags   = SetFlags(TrackFlagsGZ);
            }
            else
            {
                TrackFlags   = raw_data[2];
                TrackFlagsGZ = SetFlagsGZ(TrackFlags);
            }

            if (ImportantMethods.IsNumericGZ(raw_data[3]))
            {
                ContinueTrackFlagsGZ = ulong.Parse(raw_data[3]);
                ContinueTrackFlags   = SetFlags(ContinueTrackFlagsGZ);
            }
            else
            {
                ContinueTrackFlags   = raw_data[3];
                ContinueTrackFlagsGZ = SetFlagsGZ(ContinueTrackFlags);
            }
        }
Esempio n. 2
0
        private void Create_btn_Click(object sender, EventArgs e)
        {
            bool newDir = false;
            bool isOK   = false;

            if (!useOriginalMod_cb.Checked)
            {
                // !!! HAS TO BE HERE FOR NOW !!! //
                string destModPath = ImportantMethods.GetDirectoryPathOnly(ProgramConsole.GetModuleInfoPath()) + '\\' + destinationModul_txt.Text;
                newDir = !Directory.Exists(destModPath);
                if (newDir)
                {
                    Directory.CreateDirectory(destModPath);
                }
                // !!! HAS TO BE HERE FOR NOW !!! //
            }

            isOK = CreateProjectFolder();
            if (!useOriginalMod_cb.Checked && isOK)
            {
                isOK = CreateModuleFolder(newDir);
            }

            if (isOK)
            {
                ProgramConsole.LoadProject(CodeReader.ProjectPath, true);
                ProjectCreated = true;
            }

            Close();
        }
Esempio n. 3
0
        private void InitializeGameMeu(string[] raw_data)
        {
            string[] tmpSX;
            int      tmp = 1, tmp2;

            if (ImportantMethods.IsNumericGZ(raw_data[tmp]))
            {
                FlagsGZ = ulong.Parse(raw_data[tmp]);
                SetFlags();
            }
            else
            {
                Flags = raw_data[tmp].Trim();
                SetFlagsGZ();
            }
            tmp++;
            Text = raw_data[tmp];
            tmp++;
            MeshName = raw_data[tmp];
            tmp++;
            tmp2 = int.Parse(raw_data[tmp]);
            if (tmp2 != 0)
            {
                OperationBlock = new string[tmp2 + 1];
                tmpSX          = new string[raw_data.Length - tmp - 1];
                tmp++;
                for (int i = tmp - 1; i < raw_data.Length - 1; i++)
                {
                    tmpSX[i - (tmp - 1)] = raw_data[i];
                }
                OperationBlock[0] = ID + 1;
                tmpSX             = CodeReader.DecompileScriptCode(OperationBlock, tmpSX);
                OperationBlock    = CodeReader.GetStringArrayStartFromIndex(tmpSX, 1);
            }
        }
Esempio n. 4
0
        private void StackTroopCount_txt_TextChanged(object sender, EventArgs e)
        {
            int selectedIndex = stack_troops_lb.SelectedIndex;

            if (selectedIndex >= 0)
            {
                if (stackTroopCount_txt.Text.Length > 0)
                {
                    string[] sp = stackTroopCount_txt.Text.Split('-');
                    if (ImportantMethods.IsNumericFKZ128(sp[0]))
                    {
                        if (sp.Length == 1)
                        {
                            memberValues[selectedIndex][0] = int.Parse(sp[0]);
                            memberValues[selectedIndex][1] = int.Parse(sp[0]);
                        }
                        else if (ImportantMethods.IsNumericFKZ128(sp[1]))
                        {
                            memberValues[selectedIndex][0] = int.Parse(sp[0]);
                            memberValues[selectedIndex][1] = int.Parse(sp[1]);
                        }
                    }
                }
                else
                {
                    memberValues[selectedIndex][0] = 0;
                    memberValues[selectedIndex][1] = 0;
                }
            }
        }
Esempio n. 5
0
        public PostFX(string raw_data) : base(raw_data.Split()[0], ObjectType.PostFX)
        {
            raw_data = raw_data.Trim();
            while (raw_data.Contains("  "))
            {
                raw_data = raw_data.Replace("  ", " ");
            }

            string[] tmpS = raw_data.Split();

            if (ImportantMethods.IsNumericGZ(tmpS[1]))
            {
                FlagsGZ = ulong.Parse(tmpS[1]);
                if ((FlagsGZ & 0x1) == 1)
                {
                    Flags = "fxf_highhdr";//change if more than one flag
                }
            }
            else
            {
                Flags   = tmpS[1];
                FlagsGZ = 0;
                if (Flags.Equals("fxf_highhdr"))//change if more than one flag
                {
                    FlagsGZ |= 0x1;
                }
            }

            TonemapOperatorType = ulong.Parse(tmpS[2]);

            AddValueFromIndexToShaderParameters123(tmpS, 3, 6);
            AddValueFromIndexToShaderParameters123(tmpS, 7, 10);
            AddValueFromIndexToShaderParameters123(tmpS, 11);
        }
Esempio n. 6
0
 private void SetAttributes(string attributes)
 {
     string[] sp = attributes.TrimStart().Split();
     if (sp.Length >= 5)
     {
         Strength     = int.Parse(sp[0]);
         Agility      = int.Parse(sp[1]);
         Intelligence = int.Parse(sp[2]);
         Charisma     = int.Parse(sp[3]);
         Level        = int.Parse(sp[4]);
         return;
     }
     else if (sp.Length != 1)
     {
         if (ImportantMethods.IsNumericGZ(sp[0]))
         {
             ulong attribs = ulong.Parse(sp[0]);
             Strength     = (int)(attribs & byte.MaxValue);
             Agility      = (int)((attribs >> 8) & byte.MaxValue);
             Intelligence = (int)((attribs >> 16) & byte.MaxValue);
             Charisma     = (int)((attribs >> 24) & byte.MaxValue);
             Level        = (int)((attribs >> 32) & byte.MaxValue);
             return;
         }
     }
     SendErrorMessage();
 }
Esempio n. 7
0
        private uint[] GetSkillCodes()
        {
            uint[] skillCodes = new uint[6];
            string tmp        = string.Empty;

            for (int i = 0; i < SkillHunter.Skillnames.Length - 6; i++)
            {
                for (int j = 0; j < groupBox_6_gb.Controls.Count; j++)
                {
                    Control num = groupBox_6_gb.Controls[j];
                    if (num.TabIndex == i && num.Name.Substring(num.Name.LastIndexOf('_') + 1).Equals("num"))
                    {
                        tmp += HexConverter.Dec2Hex((ulong)((NumericUpDown)num).Value).Substring(7);
                        j    = groupBox_6_gb.Controls.Count;
                    }
                }
            }
            tmp += "000000"; // maybe replace later if there are more than 42 skills possible 192 / 4 = 48
            for (int i = 5; i >= 0; i--)
            {
                skillCodes[i] = uint.Parse(HexConverter.Hex2Dec(ImportantMethods.ReverseString(tmp.Substring(i * 8, 8))).ToString());
            }
            //MessageBox.Show(skillCode);
            //IEnumerable<string> skillCodes = ImportantMethods.WholeChunks(skillCode, 8);
            //for (int i = 0; i < sss.Length; i++)
            //{
            //    sss[i] = skillCodes.GetEnumerator().Current;
            //    if (i < sss.Length - 1)
            //        skillCodes.GetEnumerator().MoveNext();
            //}
            //MessageBox.Show(HexConverter.Hex2Dec(sss[0]) + "|" + HexConverter.Hex2Dec(sss[1]) + "|" + HexConverter.Hex2Dec(sss[2]) + "|" + HexConverter.Hex2Dec(sss[3]) + "|" + HexConverter.Hex2Dec(sss[4]) + "|" + HexConverter.Hex2Dec(sss[5]));
            return(skillCodes);
        }
Esempio n. 8
0
 public void RemoveWindowHandleFromControlsParent()
 {
     if (!HasParent || KillModeActive)
     {
         return;
     }
     ImportantMethods.RemoveWindowHandleFromParent(Handle);
     HasParent = false;
 }
Esempio n. 9
0
        /*private static bool ModuleInfoTextContains(string s)
         * {
         *  return GetRealModuleInfoText().Contains(s);
         * }*/

        private static void CopyDefaultFiles()
        {
            string path = SourceWriter.ModuleFilesPath;

            Console.WriteLine(path);
            File.WriteAllText(path + "module_info.py", "export_dir = \"" + GetDestinationModPathFromVariable(GetModuleInfoPath()).Replace('\\', '/') + '\"');//File.Copy(ModuleInfoRealFile, path + "module_info.py", true);
            File.Copy(CodeReader.FILES_PATH + "module_constants.py", path + "module_constants.py", true);
            //File.Copy(CodeReader.FILES_PATH + "module_my_mod_set.py", path + "module_my_mod_set.py", true);//probably unused!
            File.Copy(CodeReader.FILES_PATH + "header_mb_decompiler.py", ImportantMethods.GetDirectoryPathOnly(path) + "\\headerFiles\\header_mb_decompiler.py", true);
        }
Esempio n. 10
0
        public Skin(List <string[]> raw_data) : base(raw_data[0][0], ObjectType.Skin)
        {
            Flags    = ulong.Parse(raw_data[0][1]);
            BodyMesh = raw_data[1][0];
            CalfMesh = raw_data[1][1];
            HandMesh = raw_data[1][2];
            HeadMesh = raw_data[2][0];
            SetFaceKeys(raw_data[2]);
            HairMeshes = raw_data[3];
            if (HairMeshes.Length == 1 && HairMeshes[0].Trim().Equals(string.Empty))
            {
                HairMeshes = new string[0];
            }
            BeardMeshes = raw_data[4];
            if (BeardMeshes.Length == 1 && BeardMeshes[0].Trim().Equals(string.Empty))
            {
                BeardMeshes = new string[0];
            }
            HairTextures = new string[int.Parse(raw_data[5][0])];
            for (int i = 0; i < HairTextures.Length; i++)
            {
                HairTextures[i] = raw_data[5][i + 1];
            }
            BeardTextures = new string[int.Parse(raw_data[6][0])];
            for (int i = 0; i < BeardTextures.Length; i++)
            {
                BeardTextures[i] = raw_data[6][i + 1];
            }
            SetFaceTextures(raw_data[7]);
            SetVoices(raw_data[8]);
            SkeletonName     = raw_data[9][0];
            Scale            = double.Parse(CodeReader.Repl_DotWComma(raw_data[9][1]));
            BloodParticle1GZ = int.Parse(raw_data[10][0]);
            BloodParticle2GZ = int.Parse(raw_data[10][1]);
            BloodParticle1   = CodeReader.ParticleSystems[BloodParticle1GZ];
            BloodParticle2   = CodeReader.ParticleSystems[BloodParticle2GZ];
            int fkcCount = 0;

            if (ImportantMethods.IsNumericFKZ128(raw_data[11][0]))
            {
                fkcCount = int.Parse(raw_data[11][0]);
                if (fkcCount > 0)
                {
                    FaceKeyConstraints = new FaceKeyConstraint[int.Parse(raw_data[11][0])];
                    for (int i = 0; i < FaceKeyConstraints.Length; i++)
                    {
                        FaceKeyConstraints[i] = new FaceKeyConstraint(raw_data[12 + i]); //raw_data[11 + i]
                    }
                }
            }
            if (fkcCount <= 0)
            {
                FaceKeyConstraints = new FaceKeyConstraint[0];
            }
        }
Esempio n. 11
0
        public static void InitializeConstants(string path)
        {
            int    deli;
            string line;

            string[]        split;
            List <Variable> constantsX = new List <Variable>();

            using (StreamReader sr = new StreamReader(path))
            {
                while (!sr.EndOfStream)
                {
                    line = sr.ReadLine().Split('#')[0];
                    if (line.Contains("="))
                    {
                        split    = line.Split('=');
                        split[0] = split[0].Trim();
                        split[1] = split[1].Trim().ToLower();
                        if (ImportantMethods.IsNumericFKZ128(split[1]) || split[1].Contains("0x"))
                        {
                            decimal d;
                            if (ImportantMethods.IsNumericFKZ128(split[1]))
                            {
                                if (split[1].IndexOf('.') == 0)
                                {
                                    split[1] = "0" + split[1];
                                }
                                d = decimal.Parse(split[1]);
                            }
                            else
                            {
                                d = decimal.Parse(HexConverter.Hex2Dec(split[1].Substring(2)).ToString());
                            }
                            deli = -1;
                            for (int i = 0; i < constantsX.Count; i++)
                            {
                                if (constantsX[i].Name.Equals(split[0]))
                                {
                                    deli = i;
                                    i    = constantsX.Count;
                                }
                            }
                            if (deli >= 0)
                            {
                                constantsX.RemoveAt(deli);
                            }
                            constantsX.Add(new Variable(split[0], d));
                        }
                    }
                }
            }
            constants = constantsX.ToArray();
            //if (File.Exists("test.txt"))
            //    File.Delete("test.txt");
        }
Esempio n. 12
0
 private void TriggerSelector_Load(object sender, EventArgs e)
 {
     if (TriggerNames.Length != 0)
     {
         foreach (string t in TriggerNames)
         {
             trigger_cbb.Items.Add(ImportantMethods.ToUpperAfterBlank(t.Substring(t.IndexOf('_') + 1).Replace('_', ' ')));
         }
         trigger_cbb.SelectedIndex = 0;
     }
 }
Esempio n. 13
0
        protected override void InitializeControls()
        {
            base.InitializeControls();

            ImportantMethods.AddWindowHandleToControl(designer.Handle, Parent, Height, Width, Top);

            mno_choose_lb.Items.Add(NEW_OPTION);
            mno_ID_text.KeyUp += Mno_ID_text_KeyUp;

            ResetControls();
        }
Esempio n. 14
0
        private void SetFirstLine(string line)
        {
            string[] lineData = line.Trim().Split();

            if (lineData.Length >= 10)
            {
                //ID = lineData[0];
                Name       = lineData[1].Replace('_', ' ');
                PluralName = lineData[2].Replace('_', ' ');

                DialogImage = lineData[3];

                Flags = lineData[4].Trim();
                if (ImportantMethods.IsNumericGZ(Flags))
                {
                    FlagsGZ = ulong.Parse(Flags);
                    Flags   = GetFlagsFromValues(HexConverter.Dec2Hex(FlagsGZ));
                }
                else
                {
                    FlagsGZ = GetFlagsGZFromString(Flags);
                }

                SetSceneCode(lineData[5]);

                SetReserved(lineData[6]);

                FactionID = int.Parse(lineData[7]);//if not ID/numeric --> ERROR!!!

                try
                {
                    UpgradeTroop1 = int.Parse(lineData[8]);
                }
                catch (Exception)
                {
                    UpgradeTroop1ErrorCode = lineData[8];
                    SendUpgradePathErrorMessage(1, UpgradeTroop1ErrorCode);
                }

                try
                {
                    UpgradeTroop2 = int.Parse(lineData[9]);
                }
                catch (Exception)
                {
                    UpgradeTroop2ErrorCode = lineData[9];
                    SendUpgradePathErrorMessage(2, UpgradeTroop2ErrorCode);
                }
            }
            else
            {
                SendErrorMessage(true);
            }
        }
Esempio n. 15
0
 private void ChangeProjectPathsToNewOne(string currentPath, string newPath)
 {
     foreach (string dir in Directory.GetDirectories(currentPath))
     {
         string[] info = ProgramConsole.ReadProjectFileInfoInFolder(dir);
         if (info != null)
         {
             info[1] = newPath + ImportantMethods.GetDirectoryNameOnly(info[1]);
             ProgramConsole.SaveProjectFileInfo(dir, info);
         }
     }
 }
Esempio n. 16
0
        private void InitializeHeaderFlags(string file = "header_troops.py", List <HeaderVariable> itemPointsX = null)
        {
            List <HeaderVariable> itemPoints = new List <HeaderVariable>();
            string file2 = "header_mb_decompiler.py";

            itemPoints = itemPointsX ?? new List <HeaderVariable>();

            using (StreamReader sr = new StreamReader(SkillHunter.FilesPath + file))
            {
                while (!sr.EndOfStream)
                {
                    string s = sr.ReadLine().Split('#')[0];
                    if (s.Split('_')[0].Equals("tf"))
                    {
                        string[] sp         = s.Replace(" ", string.Empty).Replace("\t", string.Empty).Split('=');
                        bool     isHexValue = sp[1].Contains("0x");
                        bool     isNumeric  = ImportantMethods.IsNumericGZ(sp[1]);
                        if (isHexValue)
                        {
                            s = sp[1].Substring(2);
                        }
                        else if (isNumeric)
                        {
                            s = string.Empty;
                            int leftCount = 8 - sp[1].Length;// because of 8 character hex -> 00000000
                            for (int i = 0; i < leftCount; i++)
                            {
                                s += '0';
                            }
                            s += sp[1];
                        }
                        //else
                        // FIND tf_female|tf_hero or something like that in here

                        if (isHexValue || isNumeric)
                        {
                            RemoveHeaderVariableListEquals(ref itemPoints, s);
                            itemPoints.Add(new HeaderVariable(s, sp[0]));
                        }
                    }
                }
            }

            if (!file.Equals(file2))
            {
                InitializeHeaderFlags(file2, itemPoints);
            }
            else
            {
                headerFlags = itemPoints;
            }
        }
Esempio n. 17
0
        public Faction(string[] raw_data) : base(raw_data[0].Split()[0].Replace("fac_", string.Empty), ObjectType.Faction)
        {
            string[] tmp = raw_data[0].Split();
            Name = tmp[1];
            if (ImportantMethods.IsNumericGZ(tmp[2]))
            {
                FlagsGZ = ulong.Parse(tmp[2]);
                SetFlags();
            }
            else
            {
                Flags = tmp[2].Replace('\t', ' ').Replace(" ", string.Empty);
                SetFlagsGZ();
            }

            if (ImportantMethods.IsNumericGZ(tmp[3]))
            {
                ColorCode = HexConverter.Dec2Hex(ulong.Parse(tmp[3])).Substring(2);
            }
            else if (tmp[3].StartsWith("0x"))
            {
                ColorCode = tmp[3].Substring(2);
            }
            else
            {
                ColorCode = tmp[3];
            }

            lastID++;
            id = lastID;

            string[] relationsString = raw_data[1].Split();
            Relations = new double[relationsString.Length];
            for (int i = 0; i < relationsString.Length; i++)
            {
                Relations[i] = double.Parse(CodeReader.Repl_DotWComma(relationsString[i]));
            }

            tmp = raw_data[2].Split();

            int x = int.Parse(tmp[0]);

            if (x > 0)
            {
                Ranks = new string[x];
                for (int i = 0; i < x; i++)
                {
                    Ranks[i] = tmp[i + 1];
                }
            }
        }
Esempio n. 18
0
        public AnimationSequence(string[] raw_data)
        {
            if (headerVariables == null)
            {
                InitializeHeaderVariables();
            }

            //if (ImportantMethods.IsNumeric(CodeReader.Repl_DotWComma(raw_data[0]), true))
            Duration = double.Parse(CodeReader.Repl_DotWComma(raw_data[0]));    //change if needed

            ResourceName = raw_data[1];

            //if (ImportantMethods.IsNumericGZ(raw_data[2]))
            BeginFrame = int.Parse(raw_data[2]);    //change if needed

            //if (ImportantMethods.IsNumericGZ(raw_data[3]))
            EndFrame = int.Parse(raw_data[3]);    //change if needed

            if (ImportantMethods.IsNumericGZ(raw_data[4]))
            {
                FlagsGZ = ulong.Parse(raw_data[4]);
                SetFlags();
            }
            else
            {
                Flags = raw_data[4];
                SetFlagsGZ();
            }

            if (ImportantMethods.IsNumericGZ(raw_data[5]))
            {
                LastNumberGZ = ulong.Parse(raw_data[5]);
            }

            for (int i = 0; i < LastNumbersFKZ.Length; i++)
            {
                string tmp = CodeReader.Repl_DotWComma(raw_data[i + 6]);
                if (tmp.Length > 3)
                {
                    LastNumbersFKZ[i] = double.Parse(tmp);
                    if (tmp.Contains("-") && LastNumbersFKZ[i] == 0d)
                    {
                        LastNumbersFKZ[i] = -0.0000001;
                    }
                }
                else
                {
                    LastNumbersFKZ[i] = double.NaN;
                }
            }
        }
Esempio n. 19
0
 public Quest(string[] raw_data) : base(raw_data[0], ObjectType.Quest)
 {
     Name = raw_data[1];
     if (ImportantMethods.IsNumericGZ(raw_data[2]))
     {
         FlagsGZ = ulong.Parse(raw_data[2]);
         SetFlags();
     }
     else
     {
         Flags = raw_data[2];
         SetFlagsGZ();
     }
     Description = raw_data[3];
 }
Esempio n. 20
0
 public SimpleTrigger(string checkInterval, ObjectType objectType = ObjectType.SimpleTrigger) : base("SIMPLE_TRIGGER", objectType)
 {
     if (intervalCodes.Count == 0)
     {
         InitializeIntervalCodes();
     }
     if (ImportantMethods.IsNumeric(checkInterval, true))
     {
         CheckInterval = ReplaceIntervalWithCode(double.Parse(CodeReader.Repl_DotWComma(checkInterval)));
     }
     else
     {
         CheckInterval = checkInterval;
     }
 }
Esempio n. 21
0
 public Skill(string[] raw_data) : base(raw_data[0], ObjectType.Skill)
 {
     Name = raw_data[1].Replace('_', ' ');
     if (ImportantMethods.IsNumericGZ(raw_data[2]))
     {
         FlagsGZ = ulong.Parse(raw_data[2]);
         SetFlags();
     }
     else
     {
         Flags = raw_data[2];
         SetFlagsGZ();
     }
     MaxLevel    = int.Parse(raw_data[3]);
     Description = raw_data[4].Replace('_', ' ');
 }
Esempio n. 22
0
        private void SetFlagsGZ()
        {
            ulong  flagsGZ = 0ul;
            string tmp;

            string[] sp = Flags.Split('|');

            foreach (string s in sp)
            {
                if (s.Equals("mnf_join_battle"))
                {
                    flagsGZ |= 0x00000001; //Consider this menu when the player joins a battle
                }
                else if (s.Equals("mnf_auto_enter"))
                {
                    flagsGZ |= 0x00000010; //Automatically enter the town with the first menu option.
                }
                else if (s.Equals("mnf_enable_hot_keys"))
                {
                    flagsGZ |= 0x00000100; //Enables P,I,C keys
                }
                else if (s.Equals("mnf_disable_all_keys"))
                {
                    flagsGZ |= 0x00000200; //Disables all keys
                }
                else if (s.Equals("mnf_scale_picture"))
                {
                    flagsGZ |= 0x00001000; //Scale menu picture to offest screen aspect ratio
                }
                else if (s.StartsWith("menu_text_color("))
                {
                    tmp = s.Split('(')[1].Split(')')[0].Trim('\t', ' ');
                    if (!ImportantMethods.IsNumericGZ(tmp))
                    {
                        if (tmp.StartsWith("0x"))
                        {
                            tmp = tmp.Substring(2);
                        }
                        tmp = HexConverter.Hex2Dec(tmp).ToString();
                    }
                    flagsGZ |= (ulong.Parse(tmp) << 32); //color
                }
            }

            FlagsGZ = flagsGZ;
        }
Esempio n. 23
0
        public Animation(string[] raw_data) : base(raw_data[0], ObjectType.Animation)
        {
            if (headerVariablesNormal == null)
            {
                InitializeHeaderVariables(SP_NORMAL_FLAGS);
            }
            if (headerVariablesMaster == null)
            {
                InitializeHeaderVariables(SP_MASTER_FLAGS);
            }

            if (ImportantMethods.IsNumericGZ(raw_data[1]))
            {
                FlagsGZ = ulong.Parse(raw_data[1]);
                Flags   = SetFlagsX(FlagsGZ, headerVariablesNormal);
                ulong x = (FlagsGZ & 0xff000000);
                if (x != 0)
                {
                    Flags += "|" + ACF_ANIM_LENGTH + (x >> 24) + ")";
                    Flags  = Flags.TrimStart('0', '|');
                }
            }
            else
            {
                Flags   = raw_data[1];
                FlagsGZ = SetFlagsXGZ(Flags, headerVariablesNormal);
                if (Flags.Contains(ACF_ANIM_LENGTH))
                {
                    FlagsGZ |= ulong.Parse(Flags.Substring(Flags.IndexOf(ACF_ANIM_LENGTH)).Split(')')[0].Trim());
                }
            }

            if (ImportantMethods.IsNumericGZ(raw_data[2]))
            {
                MasterFlagsGZ = ulong.Parse(raw_data[2]);
                MasterFlags   = SetFlagsX(MasterFlagsGZ, headerVariablesMaster);
            }
            else
            {
                MasterFlags   = raw_data[2];
                MasterFlagsGZ = SetFlagsXGZ(MasterFlags, headerVariablesMaster);
            }
        }
Esempio n. 24
0
 public Trigger(string checkInterval, string delayInterval, string rearmInterval) : base(checkInterval, ObjectType.Trigger)
 {
     if (ImportantMethods.IsNumeric(delayInterval, true))
     {
         DelayInterval = ReplaceIntervalWithCode(double.Parse(CodeReader.Repl_DotWComma(delayInterval)));
     }
     else
     {
         DelayInterval = delayInterval;
     }
     if (ImportantMethods.IsNumeric(rearmInterval, true))
     {
         ReArmInterval = ReplaceIntervalWithCode(double.Parse(CodeReader.Repl_DotWComma(rearmInterval)));
     }
     else
     {
         ReArmInterval = rearmInterval;
     }
 }
Esempio n. 25
0
        public void AddWindowHandleToControlsParent(Control childX, bool addOnRightSide = true)
        {
            if (KillModeActive)
            {
                return;
            }

            int left;

            if (addOnRightSide)
            {
                left = childX.Width;
            }
            else
            {
                left = childX.Left;
            }
            ImportantMethods.AddWindowHandleToControl(Handle, childX.Parent, childX.Height, left, childX.Top, 32);
            HasParent = true;
        }
Esempio n. 26
0
        private static void InitializeIntervalCodes()
        {
            string line;

            string[] split;
            using (StreamReader sr = new StreamReader(CodeReader.FILES_PATH + "header_triggers.py"))
            {
                while (!sr.EndOfStream)
                {
                    line = sr.ReadLine().Split('#')[0].Replace(" ", string.Empty).Replace("\t", string.Empty);
                    if (line.Length >= 8 && line.Contains("=") && line.Contains("ti_"))
                    {
                        split = line.Split('=');
                        if (ImportantMethods.IsNumeric(split[1].Split('.')[0].Replace("-", string.Empty), true))
                        {
                            intervalCodes.Add(new IntervalCode(split[0], (int)double.Parse(split[1].Replace(".", ","))));
                        }
                    }
                }
            }
        }
Esempio n. 27
0
        public static string GetProjectFilePath(string projectPath)
        {
            string projectFilePath = projectPath.TrimEnd('\\') + '\\' + ImportantMethods.GetDirectoryNameOnly(projectPath) + ".mbsp";

            if (!File.Exists(projectFilePath))
            {
                string[] info = Directory.GetFiles(projectPath);
                for (int i = 0; i < info.Length; i++)
                {
                    if (info[i].Contains("."))
                    {
                        if (Path.GetFileName(info[i]).Split('.')[1].Equals("mbsp"))
                        {
                            projectFilePath = info[i];
                            i = info.Length;
                        }
                    }
                }
            }
            return(projectFilePath);
        }
Esempio n. 28
0
        private void InitializeProject()
        {
            string s = ProgramConsole.GetModuleInfoPath();

            if (s.Equals(ProgramConsole.DEFAULT_STEAMPATH))
            {
                ProgramConsole.SetModPath(false);
            }

            projectVorlagenSearch_txt.Click     += ProjectVorlagenSearch_txt_Click;
            projectVorlagenSearch_txt.LostFocus += ProjectVorlagenSearch_txt_LostFocus;

            string projectsPath = Properties.Settings.Default.projectsFolderPath.TrimEnd('\\'); //Application.StartupPath + "\\Projects";

            if (Directory.Exists(projectsPath))
            {
                foreach (string dir in Directory.GetDirectories(projectsPath))
                {
                    string[] files = Directory.GetFiles(dir);
                    foreach (string file in files)
                    {
                        if (file.Contains("."))
                        {
                            if (file.Substring(file.LastIndexOf('.')).Equals(".mbsp"))
                            {
                                projects_cbb.Items.Add(ImportantMethods.GetDirectoryNameOnly(dir));
                            }
                        }
                    }
                }
                if (projects_cbb.Items.Count > 0)
                {
                    projects_cbb.SelectedIndex = 0;
                }
            }
            else
            {
                Directory.CreateDirectory(projectsPath);
            }
        }
Esempio n. 29
0
 private void SetProficiencies(string proficies)
 {
     string[] profS = proficies.Substring(1).Split();
     if (profS.Length >= 7)
     {
         for (int i = 0; i < profS.Length; i++)
         {
             Proficiencies[i] = int.Parse(profS[i]);
         }
         SetProficiesSC();
         return;
     }
     else if (profS.Length == 1)
     {
         if (ImportantMethods.IsNumericGZ(profS[1]))
         {
             Proficiencies = GetProficiesFromSC(profS[0]);
             return;
         }
     }
     SendErrorMessage();
 }
Esempio n. 30
0
 public SceneProp(string[] raw_data) : base(raw_data[0].Substring(4), ObjectType.SceneProp)
 {
     if (headerVariables == null)
     {
         InitializeHeaderVariables();
     }
     if (ImportantMethods.IsNumericGZ(raw_data[1]))
     {
         FlagsGZ           = ulong.Parse(raw_data[1]);
         HitPoints         = int.Parse(raw_data[2]);
         MeshName          = raw_data[3];
         PhysicsObjectName = raw_data[4];
         SetFlags();
     }
     else
     {
         Flags             = raw_data[1];
         MeshName          = raw_data[2];
         PhysicsObjectName = raw_data[3];
         SetFlagsGZAndHitPoints();
     }
 }