Beispiel #1
0
    // Displays the info of a topic, along with a possible title
    void IDialogView.DisplayInfo(string text, string title)
    {
        if (title != null)
        {
            title = char.ToUpper(title[0]) + title.Substring(1);

            var color    = IniManager.GetColor("FontColor", "color_big_header");
            var colorHex = ColorUtility.ToHtmlStringRGB(color);

            if (text == null)
            {
                text = $"<color=#{colorHex}>{title}</color>{text}";
            }
            else
            {
                text = $"<color=#{colorHex}>{title}</color>\r\n{text}";
            }
        }

        if (text != null)
        {
            var infoClone = Instantiate(infoPrefab, infoParent);
            infoClone.text = text;
        }

        ScrollToBottom();
    }
        private void CardMakerMDI_FormClosing(object sender, FormClosingEventArgs e)
        {
            CardMakerSettings.IniManager.AutoFlush = false;
            CardMakerSettings.IniManager.SetValue(Name, IniManager.GetFormSettings(this));
            foreach (Form zForm in MdiChildren)
            {
                CardMakerSettings.IniManager.SetValue(zForm.Name, IniManager.GetFormSettings(zForm));
                CardMakerSettings.IniManager.SetValue(zForm.Name + CardMakerConstants.VISIBLE_SETTING, zForm.Visible.ToString());
            }
            var zBuilder            = new StringBuilder();
            var dictionaryFilenames = new Dictionary <string, object>();

            foreach (string sFile in m_listRecentFiles)
            {
                string sLowerFile = sFile.ToLower();
                if (dictionaryFilenames.ContainsKey(sLowerFile))
                {
                    continue;
                }
                dictionaryFilenames.Add(sLowerFile, null);
                zBuilder.Append(sFile + CardMakerConstants.CHAR_FILE_SPLIT);
            }
            CardMakerSettings.IniManager.SetValue(IniSettings.PreviousProjects, zBuilder.ToString());
            CardMakerSettings.IniManager.FlushIniSettings();
            SaveOnClose(e);
        }
Beispiel #3
0
        public void SetSelectedServer(uint GroupIndex, uint ServerIndex)
        {
            string     SetupIniPath = Path.Combine(Directory.GetCurrentDirectory(), "ini", "GameSetup.ini");
            IniManager parser       = new IniManager(SetupIniPath, "ScreenMode");

            parser.Write("Group", "GroupRecord", GroupIndex);
            parser.Write("Server", "ServerRecord", ServerIndex);
        }
Beispiel #4
0
        public static void SaveSettings()
        {
            var    executableFileInfo      = new FileInfo(Application.ExecutablePath);
            string executableDirectoryName = executableFileInfo.DirectoryName;
            string ourDirectory            = executableDirectoryName;
            var    pIniManager             = new IniManager(ourDirectory + SettingsName);

            pIniManager.IniWriteValue("Config", "LoadedRotationManager", LoadedRotationManager);
        }
Beispiel #5
0
        public RadarForm()
        {
            InitializeComponent();
            var    executableFileInfo      = new FileInfo(Application.ExecutablePath);
            string executableDirectoryName = executableFileInfo.DirectoryName;

            OurDirectory = executableDirectoryName;
            pIniManager  = new IniManager(OurDirectory + SettingsName);
        }
Beispiel #6
0
        private static void Configs()
        {
            var manager = new IniManager("config.ini");

            manager.EnsureScheme(typeof(Config));

            Console.WriteLine(manager["password"].Value);
            Console.WriteLine(manager["someField"].Value);
            Console.WriteLine(manager["someProperty"].Value);
        }
Beispiel #7
0
        public MainWindow()
        {
            InitializeComponent();

            this.DataContext    = UiData = new MainWindowData();
            UiData.DefaultTitle = this.Title;
            IniConfigManager    = new IniManager(GetIniConfigFile());
            ImportIniConfig(IniConfigManager);
            SetLanguage();
        }
Beispiel #8
0
        public static void LoadSettings()
        {
            var    executableFileInfo      = new FileInfo(Application.ExecutablePath);
            string executableDirectoryName = executableFileInfo.DirectoryName;
            string ourDirectory            = executableDirectoryName;
            var    pIniManager             = new IniManager(ourDirectory + SettingsName);

            LoadedRotationManager = pIniManager.GetString("Config", "LoadedRotationManager", String.Empty);
            LoadKeys();
        }
Beispiel #9
0
        private static GraphicPack Process(ZipArchiveEntry entry)
        {
            try
            {
                var entries = entry.Archive?.Entries;
                var files   = entries?.Where(x => Match(x, entry) && !x.FullName.Contains("Cheats")).ToList();

                var rules   = files?.Find(x => x.Name.ToLower() == "rules.txt")?.GetString();
                var sources = files?.Where(x => !x.Name.ToLower().Contains("rules.txt")).ToList();

                if (string.IsNullOrEmpty(rules))
                {
                    return(null);
                }

                var iniFile       = new IniManager(rules);
                var titleIdsValue = iniFile.GetValue("Definition", "titleIds", null);
                var nameValue     = iniFile.GetValue("Definition", "name", null);

                if (titleIdsValue == null || nameValue == null)
                {
                    return(null);
                }

                var value = titleIdsValue.ToUpper();
                if (string.IsNullOrEmpty(value))
                {
                    return(null);
                }

                var titleIds = value.Split(',');
                var name     = nameValue.Replace("\"", "").Trim();

                var pack = new GraphicPack {
                    Name = name, Rules = rules
                };
                pack.TitleIds.AddRange(titleIds);
                foreach (var source in sources)
                {
                    var graphicPackSource = new GraphicPack.GraphicPackSource
                    {
                        FileName = source.Name,
                        Data     = source.GetString()
                    };
                    pack.Sources.Add(graphicPackSource);
                }

                return(pack);
            }
            catch (Exception e)
            {
                TextLog.MesgLog.WriteLog($"{e.Message}\n{e.StackTrace}");
                return(null);
            }
        }
Beispiel #10
0
 private static void WritePluginSettings(string name, bool enabled)
 {
     try
     {
         var pIniManager = new IniManager(LazyForms.OurDirectory + "\\Settings\\lazy_plugins.ini");
         pIniManager.IniWriteValue("Plugins", name, enabled.ToString());
     }
     catch
     {
     }
 }
Beispiel #11
0
 private void exitMainToolStripMenuItem_Click(object sender, EventArgs e)
 {
     m_bRun = false;
     if (WindowState == FormWindowState.Minimized)
     {
         WindowState = m_ePrevWindowState;
     }
     KeyCaptureLib.Shutdown();
     m_zIniManager.SetValue(Name, IniManager.GetFormSettings(this));
     Close();
 }
 private void Awake()
 {
     button.colors = new ColorBlock
     {
         normalColor      = IniManager.GetColor("FontColor", $"color_{key}"),
         highlightedColor = IniManager.GetColor("FontColor", $"color_{key}_over"),
         pressedColor     = IniManager.GetColor("FontColor", $"color_{key}_pressed"),
         disabledColor    = IniManager.GetColor("FontColor", $"color_disabled"),
         colorMultiplier  = 1
     };
 }
Beispiel #13
0
        public static void LoadSettings()
        {
            var    executableFileInfo      = new FileInfo(Application.ExecutablePath);
            string executableDirectoryName = executableFileInfo.DirectoryName;
            string ourDirectory            = executableDirectoryName;
            var    pIniManager             = new IniManager(ourDirectory + SettingsName);

            LoadedBeharvior = pIniManager.GetString("Config", "LoadedBeharvior", String.Empty);
            AvoidAddsCombat = pIniManager.GetBoolean("Config", "AvoidAddsCombat", false);
            SkipAddsDis     = pIniManager.GetInt("Config", "SkipAddsDis", 0);
            AllowScripts    = pIniManager.GetBoolean("Config", "AllowScripts", false);
        }
Beispiel #14
0
        public static void Save()
        {
            var pIniManager = new IniManager(OurDirectory + SettingsName);

            pIniManager.IniWriteValue("Geometry", "MainGeometry", MainGeometry);
            pIniManager.IniWriteValue("Geometry", "RotatorStatus", RotatorStatus);
            pIniManager.IniWriteValue("Geometry", "RotationForm", RotationForm);
            pIniManager.IniWriteValue("Geometry", "ProcessSelector", ProcessSelector);
            pIniManager.IniWriteValue("Geometry", "RotatorForm", RotatorForm);
            pIniManager.IniWriteValue("Geometry", "RuleEditor", RuleEditor);
            pIniManager.IniWriteValue("Geometry", "ScriptEditor", ScriptEditor);
        }
Beispiel #15
0
        public static void SaveSettings()
        {
            var    executableFileInfo      = new FileInfo(Application.ExecutablePath);
            string executableDirectoryName = executableFileInfo.DirectoryName;

            OurDirectory = executableDirectoryName;
            var pIniManager = new IniManager(OurDirectory + SettingsName);

            pIniManager.IniWriteValue("Fishing", "LureBar", LureBar);
            pIniManager.IniWriteValue("Fishing", "LureKey", LureKey);
            pIniManager.IniWriteValue("Fishing", "UseLure", UseLure.ToString());
        }
Beispiel #16
0
        public static void LoadSettings()
        {
            var    executableFileInfo      = new FileInfo(Application.ExecutablePath);
            string executableDirectoryName = executableFileInfo.DirectoryName;

            OurDirectory = executableDirectoryName;
            var pIniManager = new IniManager(OurDirectory + SettingsName);

            LureBar = pIniManager.GetString("Fishing", "LureBar", "1");
            LureKey = pIniManager.GetString("Fishing", "LureKey", "1");
            UseLure = pIniManager.GetBoolean("Fishing", "UseLure", false);
        }
Beispiel #17
0
        public static void SaveSettings()
        {
            var    executableFileInfo      = new FileInfo(Application.ExecutablePath);
            string executableDirectoryName = executableFileInfo.DirectoryName;
            string ourDirectory            = executableDirectoryName;
            var    pIniManager             = new IniManager(ourDirectory + SettingsName);

            pIniManager.IniWriteValue("Config", "LoadedBeharvior", LoadedBeharvior);
            pIniManager.IniWriteValue("Config", "AvoidAddsCombat", AvoidAddsCombat.ToString());
            pIniManager.IniWriteValue("Config", "SkipAddsDis", SkipAddsDis.ToString());
            pIniManager.IniWriteValue("Config", "AllowScripts", AllowScripts);
        }
Beispiel #18
0
 private static bool LoadPluginSettings(string name)
 {
     try
     {
         var pIniManager = new IniManager(LazyForms.OurDirectory + "\\Settings\\lazy_plugins.ini");
         return(pIniManager.GetBoolean("Plugins", name, false));
     }
     catch
     {
     }
     return(false);
 }
Beispiel #19
0
    private Gradient GetGradient(string section, string key)
    {
        var gradient  = new Gradient();
        var colorKeys = new List <GradientColorKey>();

        // All times are normalized from 0-1, where 0 = midnight, 0.5 = midday, then 1 = midnight again
        var transitionDelta = IniManager.GetFloat(section, "Transition Delta");

        // Transition delta is said to be in realtime, but lets make it independant of current time scale
        var secondsPerDay = (60 * 60 * 24) / 30;         // 2880, number of realtime seconds in a MW day

        transitionDelta = (1f / transitionDelta) / secondsPerDay;

        var sunriseColor = IniManager.GetColor(section, $"{key} Sunrise Color");
        var dayColor     = IniManager.GetColor(section, $"{key} Day Color");
        var nightColor   = IniManager.GetColor(section, $"{key} Night Color");
        var sunsetColor  = IniManager.GetColor(section, $"{key} Sunset Color");

        // Sunrise
        var sunriseTime     = IniManager.GetFloat("Weather", "Sunrise Time") / 24;
        var sunriseDuration = IniManager.GetFloat("Weather", "Sunrise Duration") / 24;
        var preSunriseTime  = IniManager.GetFloat("Weather", $"{key} Pre-Sunrise Time") / 24;
        var postSunriseTime = IniManager.GetFloat("Weather", $"{key} Post-Sunrise Time") / 24;

        // Night/Sunrise/Day transition
        var sunriseStart = sunriseTime - preSunriseTime;
        var sunriseStop  = sunriseTime + sunriseDuration + postSunriseTime;

        colorKeys.Add(new GradientColorKey(nightColor, sunriseStart));
        colorKeys.Add(new GradientColorKey(sunriseColor, sunriseStart + transitionDelta));

        colorKeys.Add(new GradientColorKey(sunriseColor, sunriseStop));
        colorKeys.Add(new GradientColorKey(dayColor, sunriseStop + transitionDelta));

        // Day/sunset/night transition
        var sunsetTime     = IniManager.GetFloat("Weather", "Sunset Time") / 24;
        var sunsetDuration = IniManager.GetFloat("Weather", "Sunset Duration") / 24;
        var preSunsetTime  = IniManager.GetFloat("Weather", $"{key} Pre-Sunset Time") / 24;
        var postSunsetTime = IniManager.GetFloat("Weather", $"{key} Post-Sunset Time") / 24;

        var sunsetStart = sunsetTime - preSunsetTime;
        var sunsetStop  = sunsetTime + sunsetDuration + postSunsetTime;

        colorKeys.Add(new GradientColorKey(dayColor, sunsetStart));
        colorKeys.Add(new GradientColorKey(sunsetColor, sunsetStart + transitionDelta));

        colorKeys.Add(new GradientColorKey(sunsetColor, sunsetStop));
        colorKeys.Add(new GradientColorKey(nightColor, sunsetStop + transitionDelta));

        gradient.colorKeys = colorKeys.ToArray();
        return(gradient);
    }
Beispiel #20
0
    private void Awake()
    {
        Camera.onPreCull += OnCameraPreCull;
        CellManager.OnFinishedLoadingCells += SwitchCell;

        // Night Sky
        //var nightNif = new Nif.NiFile(nightSkyPath);
        //var nightGo = nightNif.CreateGameObject();

        //nightCommandBuffer = new CommandBuffer();
        //var nightMeshes = nightGo.GetComponentsInChildren<MeshFilter>();
        //var nightMeshRenderers = nightGo.GetComponentsInChildren<MeshRenderer>();
        //for (var i = 0; i < nightMeshes.Length; i++)
        //{
        //	if (i > 3)
        //		continue;

        //	var material = nightMeshRenderers[i].sharedMaterial;
        //	material.shader = MaterialManager.Instance.NightSkyShader;

        //	var mesh = nightMeshes[i].sharedMesh;
        //	nightCommandBuffer.DrawMesh(mesh, Matrix4x4.identity, material);
        //}

        //Camera.main.AddCommandBuffer(CameraEvent.AfterForwardOpaque, nightCommandBuffer);
        //Destroy(nightGo);

        // Load skybox
        var reader = BsaFileReader.LoadArchiveFileData($"meshes\\{skyboxPath}");
        var nif    = new Nif.NiFile(reader);
        var go     = nif.CreateGameObject(Camera.main.transform);

        var renderer = go.GetComponentInChildren <Renderer>();

        skyboxMaterial = new Material(MaterialManager.Instance.SkyShader);
        //var skyCommandBuffer = new CommandBuffer();
        skyboxMesh = go.GetComponentInChildren <MeshFilter>().sharedMesh;
        //skyCommandBuffer.DrawMesh(skyboxMesh, Matrix4x4.TRS(new Vector3(0, -15, 0), Quaternion.identity, Vector3.one), skyboxMaterial);

        //Camera.main.AddCommandBuffer(CameraEvent.BeforeSkybox, skyCommandBuffer);
        if (!Application.isPlaying)
        {
            DestroyImmediate(go);
        }
        else
        {
            Destroy(go);
        }

        minimumTimeBetweenEnvironmentalSounds = IniManager.GetFloat("Weather", "Minimum Time Between Environmental Sounds");
        maximumTimeBetweenEnvironmentalSounds = IniManager.GetFloat("Weather", "Maximum Time Between Environmental Sounds");
    }
        public SettingDialog()
        {
            InitializeComponent();

            this.GroupDefaultPath.Text = SettingDialogLang.GroupTitle;
            this.FrameworkLabel.Text   = SettingDialogLang.FrameworkLabel;
            this.DirectoryLabel.Text   = SettingDialogLang.DirectoryLabel;
            this.ButtonAccept.Text     = SettingDialogLang.ButtonAccept;
            this.ButtonCancel.Text     = SettingDialogLang.ButtonCancel;

            this.FrameworkBox.Text = IniManager.Read(Common.settingSection, Common.settingFramework, Common.SettingFilePath, Common.defaultFramework);
            this.DirectoryBox.Text = IniManager.Read(Common.settingSection, Common.settingDirectory, Common.SettingFilePath, Common.defaultDirectory);
        }
 private void button2_Click(object sender, EventArgs e)
 {
     if (textBox1.Text == "")
     {
         MessageBox.Show("相机名字不能为空");
     }
     else
     {
         PublicData.settingMessage.CaremerName = textBox1.Text;
         IniManager.WriteToIni(PublicData.settingMessage, Application.StartupPath + "\\Config" + "\\SettingMessage.Jason");
         MessageBox.Show("保存成功!请重启软件!");
     }
 }
Beispiel #23
0
        public ResourcesManager()
        {
            IniManagerDashboard =
                new IniManager(Path.Combine(WebHelper.WebDirectory(ConfigurationHelper.AppSettings <string>("Directory.Configuration")),
                                            "INI/DashboardResources.ini"));

            IniManagerMenu =
                new IniManager(Path.Combine(WebHelper.WebDirectory(ConfigurationHelper.AppSettings <string>("Directory.Configuration")),
                                            "INI/MenuResources.ini"));

            IniManagerReport =
                new IniManager(Path.Combine(WebHelper.WebDirectory(ConfigurationHelper.AppSettings <string>("Directory.Configuration")),
                                            "INI/ReportResources.ini"));
        }
Beispiel #24
0
 private void 切换模板ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     //changeModelDlg.SendModelName = this.Receiver;
     if (changeModelDlg.ShowDialog() == DialogResult.OK)
     {
         PublicData.CheckModel = IniManager.ReadFromIni <CheckModel>(changeModelDlg.sChangeModelPath + "\\CheckModel.jason");
         if (PublicData.CheckModel == null)
         {
             PublicData.CheckModel = new CheckModel();
         }
         PublicData.CheckModel.ReadModel(changeModelDlg.sChangeModelPath);
         label2.Text = changeModelDlg.ModelName;
     }
 }
Beispiel #25
0
        public ManagePage()
        {
            InitializeComponent();
            MainWindow mainwin = (MainWindow)Application.Current.MainWindow;

            if (mainwin.iniType.IsNormal())
            {
                iniManager = new IniManagerNormal();
            }
            else
            {
                iniManager = new IniManagerModel();
            }
        }
        public void SchemeTest()
        {
            const string file = "test3.1.ini";

            File.WriteAllText(file, "key1 = false\nkey2 = 1338\n");

            var config = new IniManager(file);

            config.Load();

            config.EnsureScheme(typeof(Config));

            Assert.Equal(ulong.MaxValue, config["count"].ValueAs <ulong>());
            Assert.Equal(default, config["port"].ValueAs <int>());
        /// <summary>
        /// Get the fully-qualified path to the Crystal reports template file
        /// </summary>
        /// <param name="installDirIn">The root installation directory name</param>
        /// <param name="areaIn">The area name</param>
        /// <param name="versionIn">The version number</param>
        /// <param name="viewName">The name of the view</param>
        /// <returns>The fully-qualified path to the Crystal reports template file</returns>
        private string GetCrystalReportFileNameFromReportIniFile(string installDirIn, string areaIn, string versionIn, string viewName)
        {
            var        filenameOnly = string.Empty;
            var        iniFileName  = areaIn + "rpt.ini";
            var        iniPath      = Path.Combine(installDirIn, areaIn + versionIn, iniFileName);
            IniManager iniManager   = new IniManager(iniPath);

            if (iniManager.KeyExists(Constants.CRYSTALREPORTS_TEMPLATEFILE_INIKEY, viewName))
            {
                var reportTemplateNameFromIni = iniManager.Read(Constants.CRYSTALREPORTS_TEMPLATEFILE_INIKEY, viewName);
                filenameOnly = $"{reportTemplateNameFromIni}{Constants.REPORTEXTENSION}";
            }
            return(filenameOnly);
        }
Beispiel #28
0
 private void Form1_Load(object sender, EventArgs e)
 {
     HOperatorSet.OpenWindow(0, 0, pictureBox1.Width, pictureBox1.Height, pictureBox1.Handle, "visible", "", out PublicData.WindowsHandle);
     HalconCommonFunc.SetPart(PublicData.WindowsHandle, 1920, 1200, pictureBox1.Width, pictureBox1.Height);
     PublicData.settingMessage = IniManager.ReadFromIni <SettingMessage>(Application.StartupPath + "\\Config" + "\\SettingMessage.Jason");
     HkCameraCltr.EnumDevices();
     PublicData.OpenCrame = PublicData.hkCameraCltr.OpenDevices(PublicData.settingMessage.CaremerName);
     if (0 == PublicData.OpenCrame)
     {
         MessageBox.Show("相机连接成功");
     }
     else
     {
         MessageBox.Show("相机连接失败");
     }
 }
        public void TypeConversionsTest()
        {
            const string file = "test2.ini";

            File.WriteAllText(file, "key1 = false\nkey2 = 1338\n");

            var config = new IniManager(file);

            config.Load();

            var key1 = config["key1"].ValueAs <bool>();
            var key2 = config["key2"].ValueAs <int>();

            Assert.False(key1);
            Assert.Equal(1338, key2);
        }
Beispiel #30
0
        public static void LoadSettings()
        {
            var    executableFileInfo      = new FileInfo(Application.ExecutablePath);
            string executableDirectoryName = executableFileInfo.DirectoryName;

            OurDirectory = executableDirectoryName;
            var pIniManager = new IniManager(OurDirectory + SettingsName);

            MainGeometry    = pIniManager.GetString("Geometry", "MainGeometry", string.Empty);
            RotatorStatus   = pIniManager.GetString("Geometry", "RotatorStatus", string.Empty);
            RotationForm    = pIniManager.GetString("Geometry", "RotationForm", string.Empty);
            ProcessSelector = pIniManager.GetString("Geometry", "ProcessSelector", string.Empty);
            RotatorForm     = pIniManager.GetString("Geometry", "RotatorForm", string.Empty);
            RuleEditor      = pIniManager.GetString("Geometry", "RuleEditor", string.Empty);
            ScriptEditor    = pIniManager.GetString("Geometry", "ScriptEditor", string.Empty);
        }