示例#1
0
 void NewClientInfo()
 {
     label9.Text            = "Not Loaded";
     SelectedClientInfo     = new FileFormat.ClientInfo();
     Locked                 = false;
     SelectedClientInfoPath = "";
     LoadUIElements();
 }
示例#2
0
        public static string GetScriptFuncForType(string ClientName, ScriptType type)
        {
            FileFormat.ClientInfo info = GlobalFuncs.GetClientInfoValues(ClientName);

            string rbxexe = "";

            if (info.LegacyMode)
            {
                rbxexe = GlobalPaths.ClientDir + @"\\" + ClientName + @"\\RobloxApp.exe";
            }
            else
            {
                rbxexe = GlobalPaths.ClientDir + @"\\" + ClientName + @"\\RobloxApp_client.exe";
            }

#if LAUNCHER
            string md5dir = !info.AlreadyHasSecurity ? SecurityFuncs.GenerateMD5(Assembly.GetExecutingAssembly().Location) : "";
#else
            string md5dir = !info.AlreadyHasSecurity ? SecurityFuncs.GenerateMD5(GlobalPaths.RootPathLauncher + "\\Novetus.exe") : "";
#endif
            string md5script = !info.AlreadyHasSecurity ? SecurityFuncs.GenerateMD5(GlobalPaths.ClientDir + @"\\" + ClientName + @"\\content\\scripts\\" + GlobalPaths.ScriptName + ".lua") : "";
            string md5exe    = !info.AlreadyHasSecurity ? SecurityFuncs.GenerateMD5(rbxexe) : "";
            string md5s      = "'" + md5exe + "','" + md5dir + "','" + md5script + "'";

            switch (type)
            {
            case ScriptType.Client:
                return("_G.CSConnect("
                       + (info.UsesID ? GlobalVars.UserConfiguration.UserID : 0) + ",'"
                       + GlobalVars.IP + "',"
                       + GlobalVars.UserConfiguration.RobloxPort + ",'"
                       + (info.UsesPlayerName ? GlobalVars.UserConfiguration.PlayerName : "Player") + "',"
                       + GlobalVars.Loadout + ","
                       + md5s + ",'"
                       + GlobalVars.UserConfiguration.PlayerTripcode + "')");

            case ScriptType.Server:
                return("_G.CSServer("
                       + GlobalVars.UserConfiguration.RobloxPort + ","
                       + GlobalVars.UserConfiguration.PlayerLimit + ","
                       + md5s + ")");

            case ScriptType.Solo:
            case ScriptType.EasterEgg:
                return("_G.CSSolo("
                       + (info.UsesID ? GlobalVars.UserConfiguration.UserID : 0) + ",'"
                       + (info.UsesPlayerName ? GlobalVars.UserConfiguration.PlayerName : "Player") + "',"
                       + GlobalVars.soloLoadout + ")");

            case ScriptType.Studio:
                return("_G.CSStudio()");

            default:
                return("");
            }
        }
示例#3
0
        public static string GetRawArgsForType(ScriptType type, string ClientName, string luafile)
        {
            FileFormat.ClientInfo info = GlobalFuncs.GetClientInfoValues(ClientName);

            if (!info.Fix2007)
            {
                return(Generator.GetScriptFuncForType(ClientName, type));
            }
            else
            {
                return(luafile);
            }
        }
示例#4
0
        public static string CompileScript(string ClientName, string code, string tag, string endtag, string mapfile, string luafile, string rbxexe, bool usesharedtags = true)
        {
            string start = tag;
            string end   = endtag;

            FileFormat.ClientInfo info = GlobalFuncs.GetClientInfoValues(ClientName);

            ScriptType type = GetTypeFromTag(start);

            //we must have the ending tag before we continue.
            if (string.IsNullOrWhiteSpace(end))
            {
                return("");
            }

            if (usesharedtags)
            {
                string sharedstart = "<shared>";
                string sharedend   = "</shared>";

                if (code.Contains(sharedstart) && code.Contains(sharedend))
                {
                    start = sharedstart;
                    end   = sharedend;
                }
            }

            if (info.Fix2007)
            {
                Generator.GenerateScriptForClient(type);
            }

            string extractedCode = GetArgsFromTag(code, start, end);

            if (extractedCode.Contains("%donothing%"))
            {
                return("");
            }

            string WebServer_CustomPlayerDir = "http://" + GlobalVars.IP + ":" + (GlobalVars.UserConfiguration.WebServerPort.ToString()).ToString() + "/charcustom/";
            string WebServer_HatDir          = WebServer_CustomPlayerDir + "hats/";
            string WebServer_FaceDir         = WebServer_CustomPlayerDir + "faces/";
            string WebServer_HeadDir         = WebServer_CustomPlayerDir + "heads/";
            string WebServer_TShirtDir       = WebServer_CustomPlayerDir + "tshirts/";
            string WebServer_ShirtDir        = WebServer_CustomPlayerDir + "shirts/";
            string WebServer_PantsDir        = WebServer_CustomPlayerDir + "pants/";
            string WebServer_ExtraDir        = WebServer_CustomPlayerDir + "custom/";

#if LAUNCHER
            string md5dir = !info.AlreadyHasSecurity ? SecurityFuncs.GenerateMD5(Assembly.GetExecutingAssembly().Location) : "";
#else
            string md5dir = !info.AlreadyHasSecurity ? SecurityFuncs.GenerateMD5(GlobalPaths.RootPathLauncher + "\\Novetus.exe") : "";
#endif
            string md5script = !info.AlreadyHasSecurity ? SecurityFuncs.GenerateMD5(GlobalPaths.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\content\\scripts\\" + GlobalPaths.ScriptName + ".lua") : "";
            string md5exe    = !info.AlreadyHasSecurity ? SecurityFuncs.GenerateMD5(rbxexe) : "";
            string md5s      = "'" + md5exe + "','" + md5dir + "','" + md5script + "'";
            string compiled  = extractedCode.Replace("%version%", GlobalVars.ProgramInformation.Version)
                               .Replace("%mapfile%", mapfile)
                               .Replace("%luafile%", luafile)
                               .Replace("%charapp%", GlobalVars.UserCustomization.CharacterID)
                               .Replace("%ip%", GlobalVars.IP)
                               .Replace("%port%", GlobalVars.UserConfiguration.RobloxPort.ToString())
                               .Replace("%name%", GlobalVars.UserConfiguration.PlayerName)
                               .Replace("%icone%", ConvertIconStringToInt().ToString())
                               .Replace("%icon%", GlobalVars.UserCustomization.Icon)
                               .Replace("%id%", GlobalVars.UserConfiguration.UserID.ToString())
                               .Replace("%face%", GlobalVars.UserCustomization.Face)
                               .Replace("%head%", GlobalVars.UserCustomization.Head)
                               .Replace("%tshirt%", GlobalVars.UserCustomization.TShirt)
                               .Replace("%shirt%", GlobalVars.UserCustomization.Shirt)
                               .Replace("%pants%", GlobalVars.UserCustomization.Pants)
                               .Replace("%hat1%", GlobalVars.UserCustomization.Hat1)
                               .Replace("%hat2%", GlobalVars.UserCustomization.Hat2)
                               .Replace("%hat3%", GlobalVars.UserCustomization.Hat3)
                               .Replace("%faced%", GlobalVars.UserCustomization.Face.Contains("http://") ? GlobalVars.UserCustomization.Face : GlobalPaths.faceGameDir + GlobalVars.UserCustomization.Face)
                               .Replace("%headd%", GlobalPaths.headGameDir + GlobalVars.UserCustomization.Head)
                               .Replace("%tshirtd%", GlobalVars.UserCustomization.TShirt.Contains("http://") ? GlobalVars.UserCustomization.TShirt : GlobalPaths.tshirtGameDir + GlobalVars.UserCustomization.TShirt)
                               .Replace("%shirtd%", GlobalVars.UserCustomization.Shirt.Contains("http://") ? GlobalVars.UserCustomization.Shirt : GlobalPaths.shirtGameDir + GlobalVars.UserCustomization.Shirt)
                               .Replace("%pantsd%", GlobalVars.UserCustomization.Pants.Contains("http://") ? GlobalVars.UserCustomization.Pants : GlobalPaths.pantsGameDir + GlobalVars.UserCustomization.Pants)
                               .Replace("%hat1d%", GlobalPaths.hatGameDir + GlobalVars.UserCustomization.Hat1)
                               .Replace("%hat2d%", GlobalPaths.hatGameDir + GlobalVars.UserCustomization.Hat2)
                               .Replace("%hat3d%", GlobalPaths.hatGameDir + GlobalVars.UserCustomization.Hat3)
                               .Replace("%headcolor%", GlobalVars.UserCustomization.HeadColorID.ToString())
                               .Replace("%torsocolor%", GlobalVars.UserCustomization.TorsoColorID.ToString())
                               .Replace("%larmcolor%", GlobalVars.UserCustomization.LeftArmColorID.ToString())
                               .Replace("%llegcolor%", GlobalVars.UserCustomization.LeftLegColorID.ToString())
                               .Replace("%rarmcolor%", GlobalVars.UserCustomization.RightArmColorID.ToString())
                               .Replace("%rlegcolor%", GlobalVars.UserCustomization.RightLegColorID.ToString())
                               .Replace("%md5launcher%", md5dir)
                               .Replace("%md5script%", info.ScriptMD5)
                               .Replace("%md5exe%", info.ClientMD5)
                               .Replace("%md5scriptd%", md5script)
                               .Replace("%md5exed%", md5exe)
                               .Replace("%limit%", GlobalVars.UserConfiguration.PlayerLimit.ToString())
                               .Replace("%extra%", GlobalVars.UserCustomization.Extra)
                               .Replace("%hat4%", GlobalVars.UserCustomization.Extra)
                               .Replace("%extrad%", GlobalPaths.extraGameDir + GlobalVars.UserCustomization.Extra)
                               .Replace("%hat4d%", GlobalPaths.hatGameDir + GlobalVars.UserCustomization.Extra)
                               .Replace("%args%", GetRawArgsForType(type, md5s, luafile))
                               .Replace("%facews%", GlobalVars.UserCustomization.Face.Contains("http://") ? GlobalVars.UserCustomization.Face : WebServer_FaceDir + GlobalVars.UserCustomization.Face)
                               .Replace("%headws%", WebServer_HeadDir + GlobalVars.UserCustomization.Head)
                               .Replace("%tshirtws%", GlobalVars.UserCustomization.TShirt.Contains("http://") ? GlobalVars.UserCustomization.TShirt : WebServer_TShirtDir + GlobalVars.UserCustomization.TShirt)
                               .Replace("%shirtws%", GlobalVars.UserCustomization.Shirt.Contains("http://") ? GlobalVars.UserCustomization.Shirt : WebServer_ShirtDir + GlobalVars.UserCustomization.Shirt)
                               .Replace("%pantsws%", GlobalVars.UserCustomization.Pants.Contains("http://") ? GlobalVars.UserCustomization.Pants : WebServer_PantsDir + GlobalVars.UserCustomization.Pants)
                               .Replace("%hat1ws%", WebServer_HatDir + GlobalVars.UserCustomization.Hat1)
                               .Replace("%hat2ws%", WebServer_HatDir + GlobalVars.UserCustomization.Hat2)
                               .Replace("%hat3ws%", WebServer_HatDir + GlobalVars.UserCustomization.Hat3)
                               .Replace("%extraws%", WebServer_ExtraDir + GlobalVars.UserCustomization.Extra)
                               .Replace("%hat4ws%", WebServer_HatDir + GlobalVars.UserCustomization.Extra)
                               .Replace("%mapfiled%", GlobalPaths.BaseGameDir + GlobalVars.UserConfiguration.MapPathSnip.Replace(@"\\", @"\").Replace(@"/", @"\"))
                               .Replace("%mapfilec%", GlobalFuncs.CopyMapToRBXAsset())
                               .Replace("%tripcode%", GlobalVars.UserConfiguration.PlayerTripcode)
                               .Replace("%scripttype%", Generator.GetNameForType(type))
                               .Replace("%addonscriptpath%", GlobalPaths.AddonScriptPath);
            return(compiled);
        }
        private void CustomGraphicsOptions_Load(object sender, EventArgs e)
        {
            ClientName = GlobalVars.UserConfiguration.SelectedClient;
            info       = GlobalFuncs.GetClientInfoValues(ClientName);

            string terms = "_" + ClientName;

            string[] dirs = Directory.GetFiles(GlobalPaths.ConfigDirClients);

            foreach (string dir in dirs)
            {
                if (dir.Contains(terms) && !dir.Contains("_default"))
                {
                    string    oldfile   = "";
                    string    fixedfile = "";
                    XDocument doc       = null;

                    try
                    {
                        oldfile   = File.ReadAllText(dir);
                        fixedfile = RobloxXML.RemoveInvalidXmlChars(RobloxXML.ReplaceHexadecimalSymbols(oldfile));
                        doc       = XDocument.Parse(fixedfile);
                    }
                    catch (Exception)
                    {
                        return;
                    }

                    //read a few handpicked things to not take up memory

                    try
                    {
                        MeshDetail = Convert.ToInt32(RobloxXML.GetRenderSettings(doc, "maxMeshDetail", XMLTypes.Float));
                        GraphicsMeshQuality.Value = MeshDetail;
                    }
                    catch (Exception)
                    {
                        GraphicsMeshQuality.Enabled = false;
                    }

                    try
                    {
                        ShadingQuality = Convert.ToInt32(RobloxXML.GetRenderSettings(doc, "maxShadingQuality", XMLTypes.Float));
                        GraphicsShadingQuality.Value = ShadingQuality;
                    }
                    catch (Exception)
                    {
                        GraphicsShadingQuality.Enabled = false;
                    }

                    try
                    {
                        MaterialQuality = Convert.ToInt32(RobloxXML.GetRenderSettings(doc, "WoodQuality", XMLTypes.Token));
                        GraphicsMaterialQuality.SelectedIndex = MaterialQuality;
                    }
                    catch (Exception)
                    {
                        try
                        {
                            MaterialQuality = Convert.ToInt32(RobloxXML.GetRenderSettings(doc, "TrussDetail", XMLTypes.Token));
                            GraphicsMaterialQuality.SelectedIndex = MaterialQuality;
                        }
                        catch (Exception)
                        {
                            GraphicsMaterialQuality.Enabled = false;
                        }
                    }

                    try
                    {
                        AA = Convert.ToInt32(RobloxXML.GetRenderSettings(doc, "Antialiasing", XMLTypes.Token));
                        GraphicsAntiAliasing.SelectedIndex = AA;
                    }
                    catch (Exception)
                    {
                        GraphicsAntiAliasing.Enabled = false;
                    }

                    try
                    {
                        AASamples = Convert.ToInt32(RobloxXML.GetRenderSettings(doc, "AASamples", XMLTypes.Token));

                        switch (AASamples)
                        {
                        case 4:
                            GraphicsAASamples.SelectedIndex = 1;
                            break;

                        case 8:
                            GraphicsAASamples.SelectedIndex = 2;
                            break;

                        default:
                            GraphicsAASamples.SelectedIndex = 0;
                            break;
                        }
                    }
                    catch (Exception)
                    {
                        GraphicsAASamples.Enabled = false;
                    }

                    try
                    {
                        Bevels = Convert.ToInt32(RobloxXML.GetRenderSettings(doc, "Bevels", XMLTypes.Token));
                        GraphicsBevels.SelectedIndex = Bevels;
                    }
                    catch (Exception)
                    {
                        GraphicsBevels.Enabled = false;
                    }

                    try
                    {
                        Shadows_2008 = Convert.ToInt32(RobloxXML.GetRenderSettings(doc, "Shadow", XMLTypes.Token));
                        GraphicsShadows2008.SelectedIndex = Shadows_2008;
                    }
                    catch (Exception)
                    {
                        GraphicsShadows2008.Enabled = false;
                    }

                    try
                    {
                        Shadows_2007 = Convert.ToBoolean(RobloxXML.GetRenderSettings(doc, "Shadows", XMLTypes.Bool));

                        switch (Shadows_2007)
                        {
                        case false:
                            GraphicsShadows2007.SelectedIndex = 1;
                            break;

                        default:
                            GraphicsShadows2007.SelectedIndex = 0;
                            break;
                        }
                    }
                    catch (Exception)
                    {
                        GraphicsShadows2007.Enabled = false;
                    }

                    try
                    {
                        QualityLevel        = Convert.ToInt32(RobloxXML.GetRenderSettings(doc, "QualityLevel", XMLTypes.Token));
                        GraphicsLevel.Value = QualityLevel;
                    }
                    catch (Exception)
                    {
                        GraphicsLevel.Enabled = false;
                    }

                    doc = null;
                    GC.Collect();
                    GC.WaitForPendingFinalizers();
                }
            }
        }
示例#6
0
        public static string CompileScript(string ClientName, string code, string tag, string endtag, string mapfile, string luafile, string rbxexe, bool usesharedtags = true)
        {
            string start = tag;
            string end   = endtag;

            FileFormat.ClientInfo info = GlobalFuncs.GetClientInfoValues(ClientName);

            ScriptType type = GetTypeFromTag(start);

            //we must have the ending tag before we continue.
            if (string.IsNullOrWhiteSpace(end))
            {
                return("");
            }

            if (usesharedtags)
            {
                string sharedstart = "<shared>";
                string sharedend   = "</shared>";

                if (code.Contains(sharedstart) && code.Contains(sharedend))
                {
                    start = sharedstart;
                    end   = sharedend;
                }
            }

            if (info.Fix2007)
            {
                Generator.GenerateScriptForClient(type);
            }

            string extractedCode = GetArgsFromTag(code, start, end);

            if (extractedCode.Contains("%donothing%"))
            {
                return("");
            }

#if LAUNCHER
            string md5dir = !info.AlreadyHasSecurity ? SecurityFuncs.GenerateMD5(Assembly.GetExecutingAssembly().Location) : "";
#else
            string md5dir = !info.AlreadyHasSecurity ? SecurityFuncs.GenerateMD5(GlobalPaths.RootPathLauncher + "\\Novetus.exe") : "";
#endif
            string md5script = !info.AlreadyHasSecurity ? SecurityFuncs.GenerateMD5(GlobalPaths.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\content\\scripts\\" + GlobalPaths.ScriptName + ".lua") : "";
            string md5exe    = !info.AlreadyHasSecurity ? SecurityFuncs.GenerateMD5(rbxexe) : "";
            string md5sd     = "'" + md5exe + "','" + md5dir + "','" + md5script + "'";
            string md5s      = "'" + info.ClientMD5 + "','" + md5dir + "','" + info.ScriptMD5 + "'";
            string compiled  = extractedCode.Replace("%version%", GlobalVars.ProgramInformation.Version)
                               .Replace("%mapfile%", mapfile)
                               .Replace("%luafile%", luafile)
                               .Replace("%charapp%", GlobalVars.UserCustomization.CharacterID)
                               .Replace("%ip%", GlobalVars.IP)
                               .Replace("%port%", GlobalVars.UserConfiguration.RobloxPort.ToString())
                               .Replace("%joinport%", GlobalVars.JoinPort.ToString())
                               .Replace("%name%", GlobalVars.UserConfiguration.PlayerName)
                               .Replace("%icone%", ConvertIconStringToInt().ToString())
                               .Replace("%icon%", GlobalVars.UserCustomization.Icon)
                               .Replace("%id%", GlobalVars.UserConfiguration.UserID.ToString())
                               .Replace("%face%", GlobalVars.UserCustomization.Face)
                               .Replace("%head%", GlobalVars.UserCustomization.Head)
                               .Replace("%tshirt%", GlobalVars.UserCustomization.TShirt)
                               .Replace("%shirt%", GlobalVars.UserCustomization.Shirt)
                               .Replace("%pants%", GlobalVars.UserCustomization.Pants)
                               .Replace("%hat1%", GlobalVars.UserCustomization.Hat1)
                               .Replace("%hat2%", GlobalVars.UserCustomization.Hat2)
                               .Replace("%hat3%", GlobalVars.UserCustomization.Hat3)
                               .Replace("%faced%", GlobalVars.UserCustomization.Face.Contains("http://") ? GlobalVars.UserCustomization.Face : GlobalPaths.faceGameDir + GlobalVars.UserCustomization.Face)
                               .Replace("%headd%", GlobalPaths.headGameDir + GlobalVars.UserCustomization.Head)
                               .Replace("%tshirtd%", GlobalVars.UserCustomization.TShirt.Contains("http://") ? GlobalVars.UserCustomization.TShirt : GlobalPaths.tshirtGameDir + GlobalVars.UserCustomization.TShirt)
                               .Replace("%shirtd%", GlobalVars.UserCustomization.Shirt.Contains("http://") ? GlobalVars.UserCustomization.Shirt : GlobalPaths.shirtGameDir + GlobalVars.UserCustomization.Shirt)
                               .Replace("%pantsd%", GlobalVars.UserCustomization.Pants.Contains("http://") ? GlobalVars.UserCustomization.Pants : GlobalPaths.pantsGameDir + GlobalVars.UserCustomization.Pants)
                               .Replace("%hat1d%", GlobalPaths.hatGameDir + GlobalVars.UserCustomization.Hat1)
                               .Replace("%hat2d%", GlobalPaths.hatGameDir + GlobalVars.UserCustomization.Hat2)
                               .Replace("%hat3d%", GlobalPaths.hatGameDir + GlobalVars.UserCustomization.Hat3)
                               .Replace("%headcolor%", GlobalVars.UserCustomization.HeadColorID.ToString())
                               .Replace("%torsocolor%", GlobalVars.UserCustomization.TorsoColorID.ToString())
                               .Replace("%larmcolor%", GlobalVars.UserCustomization.LeftArmColorID.ToString())
                               .Replace("%llegcolor%", GlobalVars.UserCustomization.LeftLegColorID.ToString())
                               .Replace("%rarmcolor%", GlobalVars.UserCustomization.RightArmColorID.ToString())
                               .Replace("%rlegcolor%", GlobalVars.UserCustomization.RightLegColorID.ToString())
                               .Replace("%md5launcher%", md5dir)
                               .Replace("%md5script%", info.ScriptMD5)
                               .Replace("%md5exe%", info.ClientMD5)
                               .Replace("%md5scriptd%", md5script)
                               .Replace("%md5exed%", md5exe)
                               .Replace("%md5s%", md5s)
                               .Replace("%md5sd%", md5sd)
                               .Replace("%limit%", GlobalVars.UserConfiguration.PlayerLimit.ToString())
                               .Replace("%extra%", GlobalVars.UserCustomization.Extra)
                               .Replace("%hat4%", GlobalVars.UserCustomization.Extra)
                               .Replace("%extrad%", GlobalPaths.extraGameDir + GlobalVars.UserCustomization.Extra)
                               .Replace("%hat4d%", GlobalPaths.hatGameDir + GlobalVars.UserCustomization.Extra)
                               .Replace("%mapfiled%", GlobalPaths.BaseGameDir + GlobalVars.UserConfiguration.MapPathSnip.Replace(@"\\", @"\").Replace(@"/", @"\"))
                               .Replace("%mapfilec%", extractedCode.Contains("%mapfilec%") ? GlobalFuncs.CopyMapToRBXAsset() : "")
                               .Replace("%tripcode%", GlobalVars.PlayerTripcode)
                               .Replace("%scripttype%", Generator.GetNameForType(type))
                               .Replace("%addonscriptpath%", GlobalPaths.AddonScriptPath)
                               .Replace("%notifications%", GlobalVars.UserConfiguration.ShowServerNotifications.ToString().ToLower())
                               .Replace("%loadout%", code.Contains("<solo>") ? GlobalVars.soloLoadout : GlobalVars.Loadout)
                               .Replace("%doublequote%", "\"")
                               .Replace("%validatedextrafiles%", GlobalVars.ValidatedExtraFiles.ToString())
                               .Replace("%argstring%", GetRawArgsForType(type, ClientName, luafile))
                               .Replace("%tshirttexid%", GlobalVars.TShirtTextureID)
                               .Replace("%shirttexid%", GlobalVars.ShirtTextureID)
                               .Replace("%pantstexid%", GlobalVars.PantsTextureID)
                               .Replace("%facetexid%", GlobalVars.FaceTextureID)
                               .Replace("%tshirttexidlocal%", GlobalVars.TShirtTextureLocal)
                               .Replace("%shirttexidlocal%", GlobalVars.ShirtTextureLocal)
                               .Replace("%pantstexidlocal%", GlobalVars.PantsTextureLocal)
                               .Replace("%facetexlocal%", GlobalVars.FaceTextureLocal)
                               .Replace("%newgui%", GlobalVars.UserConfiguration.NewGUI.ToString().ToLower());

            if (compiled.Contains("%disabled%"))
            {
                MessageBox.Show("This option has been disabled for this client.", "Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return("");
            }

            return(compiled);
        }
示例#7
0
        private void CustomGraphicsOptions_Load(object sender, EventArgs e)
        {
            ClientName = GlobalVars.UserConfiguration.SelectedClient;
            info       = GlobalFuncs.GetClientInfoValues(ClientName);

            string terms       = "_" + ClientName;
            bool   hasFoundDir = false;

            string[] dirs = Directory.GetFiles(GlobalPaths.ConfigDirClients);

            foreach (string dir in dirs)
            {
                if (dir.Contains(terms) && !dir.Contains("_default"))
                {
                    string    oldfile   = "";
                    string    fixedfile = "";
                    XDocument doc       = null;

                    try
                    {
                        oldfile   = File.ReadAllText(dir);
                        fixedfile = RobloxXML.RemoveInvalidXmlChars(RobloxXML.ReplaceHexadecimalSymbols(oldfile));
                        doc       = XDocument.Parse(fixedfile);
                    }
                    catch (Exception)
                    {
                        return;
                    }

                    //read a few handpicked things to not take up memory

                    try
                    {
                        MeshDetail = Convert.ToInt32(RobloxXML.GetRenderSettings(doc, "maxMeshDetail", XMLTypes.Float));
                        GraphicsMeshQuality.Value = MeshDetail;
                    }
                    catch (Exception)
                    {
                        GraphicsMeshQuality.Enabled = false;
                    }

                    try
                    {
                        ShadingQuality = Convert.ToInt32(RobloxXML.GetRenderSettings(doc, "maxShadingQuality", XMLTypes.Float));
                        GraphicsShadingQuality.Value = ShadingQuality;
                    }
                    catch (Exception)
                    {
                        GraphicsShadingQuality.Enabled = false;
                    }

                    try
                    {
                        MaterialQuality = Convert.ToInt32(RobloxXML.GetRenderSettings(doc, "WoodQuality", XMLTypes.Token));
                        GraphicsMaterialQuality.SelectedIndex = MaterialQuality;
                    }
                    catch (Exception)
                    {
                        try
                        {
                            MaterialQuality = Convert.ToInt32(RobloxXML.GetRenderSettings(doc, "TrussDetail", XMLTypes.Token));
                            GraphicsMaterialQuality.SelectedIndex = MaterialQuality;
                        }
                        catch (Exception)
                        {
                            GraphicsMaterialQuality.Enabled = false;
                        }
                    }

                    try
                    {
                        AA = Convert.ToInt32(RobloxXML.GetRenderSettings(doc, "Antialiasing", XMLTypes.Token));
                        GraphicsAntiAliasing.SelectedIndex = AA;
                    }
                    catch (Exception)
                    {
                        GraphicsAntiAliasing.Enabled = false;
                    }

                    try
                    {
                        AASamples = Convert.ToInt32(RobloxXML.GetRenderSettings(doc, "AASamples", XMLTypes.Token));

                        switch (AASamples)
                        {
                        case 4:
                            GraphicsAASamples.SelectedIndex = 1;
                            break;

                        case 8:
                            GraphicsAASamples.SelectedIndex = 2;
                            break;

                        default:
                            GraphicsAASamples.SelectedIndex = 0;
                            break;
                        }
                    }
                    catch (Exception)
                    {
                        GraphicsAASamples.Enabled = false;
                    }

                    try
                    {
                        Bevels = Convert.ToInt32(RobloxXML.GetRenderSettings(doc, "Bevels", XMLTypes.Token));
                        GraphicsBevels.SelectedIndex = Bevels;
                    }
                    catch (Exception)
                    {
                        GraphicsBevels.Enabled = false;
                    }

                    try
                    {
                        Shadows_2008 = Convert.ToInt32(RobloxXML.GetRenderSettings(doc, "Shadow", XMLTypes.Token));
                        GraphicsShadows2008.SelectedIndex = Shadows_2008;
                    }
                    catch (Exception)
                    {
                        GraphicsShadows2008.Enabled = false;
                    }

                    try
                    {
                        Shadows_2007 = Convert.ToBoolean(RobloxXML.GetRenderSettings(doc, "Shadows", XMLTypes.Bool));
                    }
                    catch (Exception)
                    {
                        // try doing march 2007.
                        try
                        {
                            Shadows_2007 = Convert.ToBoolean(RobloxXML.GetRenderSettings(doc, "shadows", XMLTypes.Bool));
                        }
                        catch (Exception)
                        {
                            GraphicsShadows2007.Enabled = false;
                        }
                    }

                    if (GraphicsShadows2007.Enabled)
                    {
                        switch (Shadows_2007)
                        {
                        case false:
                            GraphicsShadows2007.SelectedIndex = 1;
                            break;

                        default:
                            GraphicsShadows2007.SelectedIndex = 0;
                            break;
                        }
                    }

                    try
                    {
                        bool checkSkin = RobloxXML.IsRenderSettingStringValid(doc, "_skinFile", XMLTypes.String);
                        if (checkSkin)
                        {
                            Style_2007     = RobloxXML.GetRenderSettings(doc, "_skinFile", XMLTypes.String).Replace(@"Styles\", "");
                            Style2007.Text = Style_2007;
                        }
                        else
                        {
                            Style2007.Enabled             = false;
                            Style2007FolderFinder.Enabled = false;
                        }
                    }
                    catch (Exception)
                    {
                        Style2007.Enabled             = false;
                        Style2007FolderFinder.Enabled = false;
                    }

                    try
                    {
                        QualityLevel        = Convert.ToInt32(RobloxXML.GetRenderSettings(doc, "QualityLevel", XMLTypes.Token));
                        GraphicsLevel.Value = QualityLevel;
                    }
                    catch (Exception)
                    {
                        GraphicsLevel.Enabled = false;
                    }

                    doc = null;
                    GC.Collect();
                    GC.WaitForPendingFinalizers();
                    hasFoundDir = true;
                }
            }

            if (!hasFoundDir)
            {
                MessageBox.Show("This client does not support setting adjustment through the Novetus Launcher.\nTry opening this client in ROBLOX Studio and adjust it through the settings in Tools -> Settings.");
                Close();
            }
        }