Esempio n. 1
0
    public void LoadData()
    {
        ComputerData data = SaveSetting.LoadData();

        itemList = data.itemList;
        workList = data.workList;
    }
Esempio n. 2
0
        private static bool LoadSettings()
        {
            bool yes = false;

            try
            {
                Options o = new Options();
                if (System.IO.File.Exists(SaveSetting.path_to_set_file))
                {
                    SaveSetting.LoadSettings(ref o);
                }
                //else
                //{
                //    FormSettings frm_set = new FormSettings();
                //    if (frm_set.ShowDialog() == DialogResult.OK)
                //    {
                //        SaveSetting.LoadSettings(ref o);
                //    }
                //}
                SshSettings.base_dir     = o.base_dir;
                SshSettings.key_fname    = o.key_fname;
                SshSettings.key_size     = o.key_size;
                SshSettings.pwd_file_enc = o.pwd_file_enc;
                //SshSettings.local_path = string.Empty;//AppDomain.CurrentDomain.BaseDirectory;
                SshSettings.server = o.server;
                SshSettings.user   = o.user;
                yes = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Ошибка: " + ex.Message);
                yes = false;
            }
            return(yes);
        }
        private void SaveClick(object sender, RoutedEventArgs e)
        {
            actSetting.Fontfamily = new FontFamily(tb1.FontFamily.ToString());
            actSetting.NickColor  = new SolidColorBrush(NickColor.SelectedColor);
            if (actSetting.OneColorOnly)
            {
                actSetting.MessageColor = new SolidColorBrush(NickColor.SelectedColor);
            }
            else
            {
                actSetting.MessageColor = new SolidColorBrush(MessageColor.SelectedColor);
            }
            actSetting.Size          = tb1.FontSize;
            actSetting.Bold          = TheBold.IsChecked.Value ? FontWeights.Bold : FontWeights.Normal;
            actSetting.Italic        = TheItalic.IsChecked.Value ? FontStyles.Italic : FontStyles.Normal;
            actSetting.Strikethrough = TheStrikethrough.IsChecked.Value;
            actSetting.Underline     = TheUnderline.IsChecked.Value;

            Properties.Settings.Default.GetType().GetProperty(styleName).SetValue(Properties.Settings.Default, MessageSettings.ObjToSetting(actSetting), null);
            Properties.Settings.Default.Save();

            if (SaveSetting != null)
            {
                SaveSetting.BeginInvoke(this, null, null, null);
            }

            this.Close();
        }
Esempio n. 4
0
    void Update()
    {
        SettingData data = SaveSetting.LoadSetting();

        try{
            Debug.Log(data.shape);

            if (data.shape.Equals("Triangle"))
            {
                Hexagon.SetActive(false);
                Triangle.SetActive(true);
            }
            else if (data.shape.Equals("Hexagon"))
            {
                Hexagon.SetActive(true);
                Triangle.SetActive(false);
            }
            else
            {
                Hexagon.SetActive(true);
                Triangle.SetActive(false);
            }
        }
        catch {
            Hexagon.SetActive(true);
            Triangle.SetActive(false);
        }
    }
Esempio n. 5
0
    /// <summary>
    /// 保存+默认保存路径+默认风格
    /// </summary>
    /// <typeparam name="保存的类型"></typeparam>
    /// <param name="保存的内容"></param>
    /// <param name="保存的key"></param>
    /// <param name="保存的实现方式"></param>

    public static void Write <T>(T param, string key, SaveImplementType type = SaveImplementType.ImplementByte)
    {
        SaveSetting setting = new SaveSetting(key, type);

        using (Writer writer = Writer.Create(setting)) {
            writer.Write <T>(param, setting.filenameData.tag);
        }
    }
Esempio n. 6
0
 private async System.Threading.Tasks.Task saveTheSettingsAsync()
 {
     App.currentApplicationSettings.isDefaultWords           = this.defaultWordsToggle.IsOn;
     App.currentApplicationSettings.isNotClearRecognizedCode = this.isNotClearCodeToggle.IsOn;
     try {
         await SaveSetting.saveAllSettingsAsync(App.currentSettingFile, App.currentApplicationSettings);
     }
     catch (Exception) {
     }
 }
Esempio n. 7
0
    public void LoadSetting()
    {
        if (File.Exists(SAVE_DATA_DIRECTORY + SAVE_FILENAME))
        {
            string loadJson = File.ReadAllText(SAVE_DATA_DIRECTORY + SAVE_FILENAME);
            saveSetting = JsonUtility.FromJson <SaveSetting>(loadJson);

            MasterVolume(saveSetting.volume);
            MouseSensitivity(saveSetting.mouseSensitivity);
        }
    }
Esempio n. 8
0
 public Form2(ref SetOpacity opacity,ref SaveSetting savset, double nowopa, ref int lang, bool savepos, bool mosttop, bool copyclip)
 {
     InitializeComponent();
     this.opacity = opacity;
     this.save_set = savset;
     trackBar1.Value = (int)nowopa;
     comboBox1.SelectedIndex = lang;
     checkBox1.Checked = savepos;
     checkBox2.Checked = mosttop;
     checkBox3.Checked = copyclip;
 }
Esempio n. 9
0
    /// <summary>
    /// 读取文件+有自定义风格的
    /// </summary>
    /// <typeparam name="读取的类型"></typeparam>
    /// <param name="读取的key"></param>
    /// <param name="读取的自定义风格"></param>
    /// <returns></returns>

    public static T Reader <T>(string key, SaveSetting setting)
    {
        SaveSetting settingClone = setting.Clone();

        using (Read reader = Read.Create(settingClone)) {
            //if (!Exists(identifier)) {
            //    return default(T);
            //}
            return(reader.Reader <T>(setting.filenameData.tag));
        }
    }
Esempio n. 10
0
    /// <summary>
    /// 读取文件+可以输入默认值的,如果读不到的情况
    /// </summary>
    /// <typeparam name="读取的类型"></typeparam>
    /// <param name="读取的key"></param>
    /// <param name="读取的默认值"></param>
    /// <param name="读取的方式"></param>
    /// <returns></returns>

    public static T Reader <T>(string key, T defaultData, SaveImplementType type = SaveImplementType.ImplementByte)
    {
        SaveSetting setting = new SaveSetting(key, type);

        using (Read reader = Read.Create(setting)) {
            //if (!Exists(identifier)) {
            //    return default(T);
            //}
            return(reader.Reader(setting.filenameData.tag, defaultData));
        }
    }
Esempio n. 11
0
    public void SetSaveSetting(SaveSetting saveSetting)
    {
        m_SaveSetting = saveSetting;
        int         index;
        SaveSetting temp = PathConfig.Instance.GetSaveSettingPath(m_SaveSetting.Name, out index);

        if (temp != null)
        {
            PathConfig.Instance.saveSettingList[index] = m_SaveSetting;
        }
        else
        {
            PathConfig.Instance.saveSettingList.Add(m_SaveSetting);
        }
    }
Esempio n. 12
0
    public virtual bool Read()
    {
        int         index;
        SaveSetting temp = PathConfig.Instance.GetSaveSettingPath(m_SaveSetting.Name, out index);

        if (temp != null)
        {
            m_SaveSetting = temp;
        }
        else
        {
            PathConfig.Instance.saveSettingList.Add(m_SaveSetting);
        }
        return(m_DataReader.Read(ref m_Data, string.Format("{0}/{1}.json", m_SaveSetting.DataPath, m_Data.GetType().Name)));
    }
Esempio n. 13
0
 public void LoadSettings()
 {
     string settingsFile = _settingsDir + "\\Settings.dat";
     if (!File.Exists(settingsFile)) SaveSettings();
     else
     {
         FileStream fs = File.OpenRead(settingsFile);
         BinaryReader br = new BinaryReader(fs);
         ShowCenter = br.ReadBoolean();
         AutoCenter = br.ReadBoolean();
         _transparentColor = br.ReadInt32();
         AutoSave = (SaveSetting)br.ReadByte();
         fs.Close();
     }
 }
Esempio n. 14
0
        /// <summary>
        /// 在应用程序由最终用户正常启动时进行调用。
        /// 将在启动应用程序以打开特定文件等情况下使用。
        /// </summary>
        /// <param name="e">有关启动请求和过程的详细信息。</param>
        protected override async void OnLaunched(LaunchActivatedEventArgs e)
        {
            Frame rootFrame = Window.Current.Content as Frame;

            // 不要在窗口已包含内容时重复应用程序初始化,
            // 只需确保窗口处于活动状态
            if (rootFrame == null)
            {
                // 创建要充当导航上下文的框架,并导航到第一页
                rootFrame = new Frame();

                rootFrame.NavigationFailed += OnNavigationFailed;

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: 从之前挂起的应用程序加载状态
                }

                // 将框架放在当前窗口中
                Window.Current.Content = rootFrame;
            }

            if (e.PrelaunchActivated == false)
            {
                if (rootFrame.Content == null)
                {
                    // 当导航堆栈尚未还原时,导航到第一页,
                    // 并通过将所需信息作为导航参数传入来配置
                    // 参数
                    rootFrame.Navigate(typeof(MainPage), e.Arguments);
                }
                // 确保当前窗口处于活动状态
                Window.Current.Activate();
            }
            try {
                currentSettingFile = await ApplicationData.Current.LocalFolder.GetFileAsync("settings.json");
            }
            catch (FileNotFoundException) {
                currentSettingFile = await ApplicationData.Current.LocalFolder.CreateFileAsync("settings.json");
            }
            try {
                currentApplicationSettings = await SaveSetting.importAllSettingsAsync(currentSettingFile);
            }
            catch (Exception) {
                currentApplicationSettings = null;
            }
        }
Esempio n. 15
0
    public void LoadPlayer()
    {
        PlayerData data = SaveSetting.LoadPlayer();

        level      = data.level;
        MaxHP      = data.MaxHP;
        level      = data.level;
        ATK        = data.ATK;
        energy     = data.energy;
        weapon     = data.weapon;
        exp        = data.exp;
        expMax     = data.expMax;
        skillPoint = data.skillPoint;
        money      = data.money;
        progress   = data.progress;
        date       = data.date;
        itemUse    = data.itemUse;
    }
Esempio n. 16
0
        public void LoadSettings()
        {
            string settingsFile = _settingsDir + "\\Settings.dat";

            if (!File.Exists(settingsFile))
            {
                SaveSettings();
            }
            else
            {
                FileStream   fs = File.OpenRead(settingsFile);
                BinaryReader br = new BinaryReader(fs);
                ShowCenter        = br.ReadBoolean();
                AutoCenter        = br.ReadBoolean();
                _transparentColor = br.ReadInt32();
                AutoSave          = (SaveSetting)br.ReadByte();
                fs.Close();
            }
        }
Esempio n. 17
0
    // Start is called before the first frame update


    void Start()
    {
        SettingData data = SaveSetting.LoadSetting();

        try{
            Debug.Log(data.shape);

            if (data.shape.Equals("Triangle"))
            {
                _usedprefab = trianglePrefab;
            }
            else if (data.shape.Equals("Hexagon"))
            {
                _usedprefab = hexagonPrefab;
            }
            else
            {
                _usedprefab = hexagonPrefab;
            }
        }
        catch {
            _usedprefab = hexagonPrefab;
        }
    }
Esempio n. 18
0
 public void Hexagon()
 {
     shape = "Hexagon";
     SaveSetting.SettingSave(this);
 }
Esempio n. 19
0
    /// <summary>
    /// 删除当前文件夹(调用这个要慎重)
    /// </summary>
    public static void Clear()
    {
        SaveSetting setting = new SaveSetting();

        setting.Clear();
    }
Esempio n. 20
0
    /// <summary>
    /// 获取当前保存的key的文件的保存位置信息
    /// </summary>
    /// <param name="保存的key"></param>
    /// <returns></returns>
    public static string GetFiles(string key)
    {
        SaveSetting setting = new SaveSetting();

        return(setting.GetFiles(key));
    }
Esempio n. 21
0
 /// <summary>
 /// 保存文件+需要自定义风格
 /// </summary>
 /// <typeparam name="保存的类型"></typeparam>
 /// <param name="保存的内容"></param>
 /// <param name="保存的Key"></param>
 /// <param name="自定义风格"></param>
 public static void Write <T>(T param, string key, SaveSetting setting)
 {
     using (Writer writer = Writer.Create(setting)) {
         writer.Write <T>(param, setting.filenameData.tag);
     }
 }
Esempio n. 22
0
    /// <summary>
    /// 是否拥有这个文件
    /// </summary>
    /// <param name="保存的key"></param>
    /// <returns></returns>
    public static bool Exists(string key)
    {
        SaveSetting setting = new SaveSetting();

        return(setting.IsExists(key));
    }
Esempio n. 23
0
 /// <summary>
 /// 删除保存的文件
 /// </summary>
 /// <param name="保存的key"></param>
 public static void Delete(string key)
 {
     SaveSetting setting = new SaveSetting(key, SaveReadingType.Delete);
 }
Esempio n. 24
0
 public void SavePlayer()
 {
     SaveSetting.SavePlayer(this);
 }
Esempio n. 25
0
 public SaveSettingViewModel(string _path)
 {
     manager        = new SaveSetting();
     SaveFolderPath = _path;
 }
Esempio n. 26
0
 public SaveSettingViewModel()
 {
     manager = new SaveSetting();
 }
Esempio n. 27
0
 public WriterData(SaveSetting data)
 {
     this.saveSetting = data;
 }
Esempio n. 28
0
 public void Dispose()
 {
     saveSetting = null;
 }
Esempio n. 29
0
 private void 옵션ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     SetOpacity opacitysetting = new SetOpacity(set_opacity);
     SaveSetting sav = new SaveSetting(save_setting);
     Form2 f2 = new Form2(ref opacitysetting, ref sav, this.Opacity * 100, ref lang, save_pos, mosttop, copyclip);
     Console.WriteLine(lang);
     f2.Show();
     Console.WriteLine("f");
 }
Esempio n. 30
0
    public void Triangle()
    {
        shape = "Triangle";

        SaveSetting.SettingSave(this);
    }
Esempio n. 31
0
 public static Read Create(SaveSetting setting)
 {
     return(new Read(setting));
 }
Esempio n. 32
0
 public DataHandler()
 {
     m_Data        = new T();
     m_SaveSetting = new SaveSetting(m_Data.GetType().Name + "SaveSetting");
 }
Esempio n. 33
0
 public Read(SaveSetting saveSetting)
 {
     readData = new ReadData(saveSetting);
     Setting  = saveSetting;
 }
Esempio n. 34
0
        private void go_trans()
        {
            if(richTextBox1.Text == "")
            {
                Console.WriteLine("HI!");
                return;
            }else if((richTextBox1.Text == "/exit")|| (richTextBox1.Text == "/ㄷ턋") || (richTextBox1.Text == "/EXIT") || (richTextBox1.Text == "/나가기"))
            {
                Application.Exit();
                return;
            }else if(richTextBox1.Text == "/option")
            {
                SetOpacity opacitysetting = new SetOpacity(set_opacity);
                SaveSetting sav = new SaveSetting(save_setting);
                Form2 f2 = new Form2(ref opacitysetting, ref sav, this.Opacity * 100, ref lang, save_pos, mosttop, copyclip);
                f2.Show();
                return;
            }else if(richTextBox1.Text == "/clip")
            {
                get_word();
                Thread.Sleep(2);
            }
            else if (richTextBox1.Text == "/clip")
            {
                Form5 f5 = new Form5(ref commands);
            }
            else
            {
                for (int i = 0; i < commands.Length; i++)
                {
                    if (richTextBox1.Text == commands[i,0])
                    {
                        if (commands[i, 2] == "cmd")
                        {

                        }else if (commands[i, 2] == "msg")
                        {
                            MessageBox.Show(commands[i, 1]);
                        }
                        break;
                    }
                }
            }
            string lang_str="ERROR";
            if (lang==0)
            {
                lang_str = "ko";
                Console.WriteLine("Get Korean");
            }
            else if (lang == 1)
            {
                lang_str = "en";
            }
            else if (lang == 2)
            {
                lang_str = "ja";
            }
            else if (lang == 3)
            {
                lang_str = "fr";
            }
            else if (lang == 4)
            {
                lang_str = "es";
            }
            else if (lang == 5)
            {
                lang_str = "ar";
            }
            else
            {
                lang_str = "ERROR";
            }
            if (lang_str == "ERROR")
            {
                notifyIcon1.ShowBalloonTip(1,"Errored", "Translation Errored Can't Find Language Code / Code:"+Convert.ToString(lang),ToolTipIcon.Error);
            }
            else
            {
                string url = "https://translate.google.com/#auto/" + lang_str + "/" + richTextBox1.Text;
                Console.WriteLine(url);
                Console.WriteLine("navigate");
                webBrowser1.Navigate(url);
            }
        }