Ejemplo n.º 1
0
    // Copy constructor of ConfigData class.
    public ConfigData(ConfigData original)
    {
        // Create Frame Marker array and copy over values from original.
        frameMarkers =
            new FrameMarker[QCARUtilities.GlobalVars.MAX_NUM_FRAME_MARKERS];
        for (int i = 0; i < frameMarkers.Length; ++i)
        {
            frameMarkers[i] = original.frameMarkers[i];
        }

        // Create Frame Marker defined array and copy over values from original.
        frameMarkersDefined =
            new bool[QCARUtilities.GlobalVars.MAX_NUM_FRAME_MARKERS];
        for (int i = 0; i < frameMarkersDefined.Length; ++i)
        {
            frameMarkersDefined[i] = original.frameMarkersDefined[i];
        }

        // Create Image Target dictionary from original.
        imageTargets =
            new Dictionary<string, ImageTarget>(original.imageTargets);

        // Create Multi Target dictionary from original.
        multiTargets =
            new Dictionary<string, MultiTarget>(original.multiTargets);
    }
Ejemplo n.º 2
0
        public void CopyToRetryRemoteTest()
        {
            FileRetryCommand cmd = new FileRetryCommand();
            ConfigData stationConfig = new ConfigData(configStream);
            cmd.Initialize(stationConfig);

            string newID = DateTime.Now.Ticks.ToString();

            string remoteTargetDir = @"\\test1.company.com\C$\Inspector\Test\Delay\Ready\";
            string remoteTargetPath = remoteTargetDir + newID + ".tif";

            // delete existing file
            // NOTE: This is commented out because it had problems getting error 1219 from the UNC connection
            // Workaround: new filename every time.
            //string possibleError;
            //bool useUNC;
            //UNCAccessWithCredentials unc =
            //    Util.ConnectUNC("administrator", "password", remoteTargetDir, out possibleError, out useUNC);
            //Assert.IsNull(possibleError, "Error trying to delete remote test file: " + possibleError);
            //if (File.Exists(remoteTargetPath))
            //{
            //    File.Delete(remoteTargetPath);
            //}
            //if (unc != null) unc.Dispose();

            FileFolderInstance instance = new FileFolderInstance();
            instance.ID = newID;
            instance.FileName = "DOC46711.tif";
            instance.Location = "FileFolderTest/Failed/" + instance.FileName;
            instance.Path = ConfigDataTest.TESTFILEDIR + instance.Location;

            cmd.CopyToRetry(instance);

            Assert.IsTrue(File.Exists(remoteTargetPath));
        }
Ejemplo n.º 3
0
        private static void DoCompilation(ConfigData cfg, ref  bool showUsage)
        {
            var showUsage1 = showUsage;
            CompilerEngine.ExecuteInSeparateAppDomain(
                ce =>
                {
                    ce.Configuration = cfg.Configuration;
                    ce.CsProject = cfg.CsProject;
                    ce.OutDir = cfg.OutDir;
                    ce.Referenced.Clear();
                    ce.TranlationHelpers.Clear();
                    ce.ReferencedPhpLibsLocations.Clear();

                    // src and dest can be in different application domain
                    // we need to add item by item
                    ce.Set1(cfg.Referenced.ToArray(),
                        cfg.TranlationHelpers.ToArray(),
                        cfg.ReferencedPhpLibsLocations.Select(a => a.Key + "\n" + a.Value).ToArray()
                        );
                    ce.BinaryOutputDir = cfg.BinaryOutputDir;
                    Debug.Assert(ce.Referenced.Count == cfg.Referenced.Count);
                    Debug.Assert(ce.TranlationHelpers.Count == cfg.TranlationHelpers.Count);
                    Debug.Assert(ce.ReferencedPhpLibsLocations.Count == cfg.ReferencedPhpLibsLocations.Count);
                    //ce.CopyFrom(aa);
                    ce.Check();
                    showUsage1 = false;
                    ce.Compile();
                });
            showUsage = showUsage1;
        }
Ejemplo n.º 4
0
 //-------------------------------------------------------------------
 // Factory function for ConfigData to initialize an array of this class
 //-------------------------------------------------------------------
 public static ConfigData Create()
 {
    ConfigData configData = new ConfigData();
    for (int i = 0; i < 3; i++)
       configData.Games[i] = Buffers.GameData.Create();
    return configData;
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Считывает содержимое конфигурационного файла. Предполагается, что файл точно существует и корректен.
        /// </summary>
        private static void ReadConfig()
        {
            var dsr = new DataContractSerializer(typeof(ConfigData));
             configData = (ConfigData)dsr.ReadObject(new FileStream(ConfigFilePath, FileMode.Open));

             Logger.Print("GTA Folder: " + configData.GTAFolderPath);
        }
Ejemplo n.º 6
0
    //----------------------------------------------------------
    // Public interface methods for UI
    //----------------------------------------------------------
    public void JoinZone()
    {
        // Set connection parameters
        ConfigData cfg = new ConfigData();
        cfg.Host = Host;
        #if !UNITY_WEBGL
        cfg.Port = TcpPort;
        #else
        cfg.Port = WSPort;
        #endif
        cfg.Zone = Zone;

        // Initialize SFS2X client and add listeners
        #if !UNITY_WEBGL
        sfs = new SmartFox();
        #else
        sfs = new SmartFox(UseWebSocket.WS);
        #endif
        cfg.Debug = true;

        // Set ThreadSafeMode explicitly, or Windows Store builds will get a wrong default value (false)
        sfs.ThreadSafeMode = true;

        sfs.AddEventListener(SFSEvent.CONNECTION, OnConnection);
        sfs.AddEventListener(SFSEvent.CONNECTION_LOST, OnConnectionLost);
        sfs.AddEventListener(SFSEvent.LOGIN, OnLogin);
        sfs.AddEventListener(SFSEvent.LOGIN_ERROR, OnLoginError);

        // Connect to SFS2X
        sfs.Connect(cfg);
    }
Ejemplo n.º 7
0
        public static bool Load(out ConfigData cfg)
        {
            bool bSuccess = false;

            cfg = Reset();

            if (File.Exists(ConfigFile))
            {
                StreamReader cfgfilebe = File.OpenText(ConfigFile);
                string[] temp = new string[2];
                while (!cfgfilebe.EndOfStream)
                {
                    temp = cfgfilebe.ReadLine().Split('=');
                    switch (temp[0])
                    {
                        case "smloc": cfg.studiomdl = temp[1]; break;
                        case "gmdir": cfg.gamedir = temp[1]; break;
                        case "autoc": cfg.autoclose = bool.Parse(temp[1]); break;
                        case "qcloc":
                            if (File.Exists(temp[1]))
                            {
                                cfg.qcloc = temp[1];
                            }
                            break;
                        default: break;
                    }
                }
                cfgfilebe.Close();
                bSuccess = true;
            }
            return bSuccess;
        }
Ejemplo n.º 8
0
 // Add Virtual Buttons that are specified in the configuration data.
 public static void AddVirtualButtons(ImageTargetBehaviour it,
     ConfigData.VirtualButton[] vbs)
 {
     for (int i = 0; i < vbs.Length; ++i)
     {
         AddVirtualButton(it, vbs[i]);
     }
 }
 public void Connect(ConfigData data)
 {
     Debug.Log ("now connection Zone");
     sfs.ThreadSafeMode = true;
     Debug.Log ("IP : " + data.Host);
     Debug.Log ("Port : " + data.Port);
     sfs.Connect(data);
 }
Ejemplo n.º 10
0
    // Updates MultiTarget parts with the values stored in the "prtConfigs"
    // array. Deletes all parts and recreates them.
    public static void UpdateParts(MultiTargetBehaviour mt,
        ConfigData.MultiTargetPart[] prtConfigs)
    {
        Transform childTargets = mt.transform.Find("ChildTargets");

        if (childTargets != null)
        {
            Object.DestroyImmediate(childTargets.gameObject);
        }

        GameObject newObject = new GameObject();
        newObject.name = "ChildTargets";
        newObject.transform.parent = mt.transform;
        newObject.hideFlags = HideFlags.NotEditable;

        newObject.transform.localPosition = Vector3.zero;
        newObject.transform.localRotation = Quaternion.identity;
        newObject.transform.localScale = Vector3.one;

        childTargets = newObject.transform;

        Material maskMaterial =
            (Material)AssetDatabase.LoadAssetAtPath(
                QCARUtilities.GlobalVars.PATH_TO_MASK_MATERIAL,
                typeof(Material));

        int numParts = prtConfigs.Length;
        for (int i = 0; i < numParts; ++i)
        {
            ConfigData.ImageTarget itConfig;

            if (!SceneManager.Instance.GetImageTarget(prtConfigs[i].name, out itConfig) &&
                prtConfigs[i].name != QCARUtilities.GlobalVars.DEFAULT_NAME)
            {
                Debug.LogError("No image target named " + prtConfigs[i].name);
                return;
            }

            Vector2 size = itConfig.size;
            Vector3 scale = new Vector3(size.x * 0.1f, 1, size.y * 0.1f);

            GameObject plane = GameObject.CreatePrimitive(PrimitiveType.Plane);
            plane.name = prtConfigs[i].name;
            plane.transform.parent = childTargets.transform;

            plane.transform.localPosition = prtConfigs[i].translation;
            plane.transform.localRotation = prtConfigs[i].rotation;
            plane.transform.localScale = scale;

            UpdateMaterial(plane);

            plane.hideFlags = HideFlags.NotEditable;

            MaskOutBehaviour script =
                (MaskOutBehaviour)plane.AddComponent(typeof(MaskOutBehaviour));
            script.maskMaterial = maskMaterial;
        }
    }
Ejemplo n.º 11
0
 public static void Save(ConfigData cfg)
 {
     StreamWriter sw = new StreamWriter(ConfigFile);
     sw.WriteLine("smloc=" + cfg.studiomdl);
     sw.WriteLine("gmdir=" + cfg.gamedir);
     sw.WriteLine("autoc=" + cfg.autoclose);
     sw.WriteLine("qcloc=" + cfg.qcloc);
     sw.Close();
 }
Ejemplo n.º 12
0
        /// <summary>
        /// 刪除指定的組態。
        /// </summary>
        /// <param name="conf"></param>
        public void Remove(ConfigData conf)
        {
            if (Readonly)
                throw new ArgumentException("此類型的組態是唯讀的。");

            conf.Record.EditAction = 3; //刪除
            Provider.SaveConfiguration(new ConfigurationRecord[] { conf.Record });
            Cache.SyncData(conf.Namespace);
        }
Ejemplo n.º 13
0
        /**
         * initialization using data in ConfigData object.
         * This should be called immediately after the constructor.
         * Each Station subclass should call base.initialize(configData) from its
         * own initialize() class.
         */
        public override void Initialize(ConfigData configData, InstanceMemory memory, Resolver commandResolver)
        {
            base.Initialize(configData, memory, commandResolver); // common initialization

            StationDescription = ("Test Station");

            // for testing, set up StationEntity list
            setTestStationEntities();
        }
        public TagConfig(XmlElement categories, Dictionary<string, string> tagList)
        {
            InitializeComponent();

            config = K12.Data.School.Configuration["2010學生學籍表"];

            _categories = categories;
            _tagList = tagList;
        }
Ejemplo n.º 15
0
 public static ConfigData CreateConfigData(object[,] head)
 {
     ConfigData cfgData = new ConfigData();
     if (null == head || cfgData.Init(head) == false)
     {
         return null;
     }
     return cfgData;
 }
Ejemplo n.º 16
0
    void Connect()
    {
        ConfigData cfg = new ConfigData();
        cfg.Host = input_ipAddress.text;
        cfg.Port = System.Convert.ToInt32(sfsSetting.m_Port);
        cfg.Zone = sfsSetting.m_zone;
        cfg.Debug = true;

        m_NetworkLobby.Connect (cfg);
    }
Ejemplo n.º 17
0
    // Copy constructor of ConfigData class.
    public ConfigData(ConfigData original)
    {
        // Create Image Target dictionary from original.
        imageTargets =
            new Dictionary<string, ImageTargetData>(original.imageTargets);

        // Create Multi Target dictionary from original.
        multiTargets =
            new Dictionary<string, MultiTargetData>(original.multiTargets);
    }
Ejemplo n.º 18
0
        public static bool SaveConfigData(ConfigData config)
        {
            if (!File.Exists(CONFIG_FNAME)) return false; // don't do anything if file doesn't exist

            using (FileStream fs = new FileStream(CONFIG_FNAME, FileMode.Create))
            {
                XmlSerializer xs = new XmlSerializer(typeof(ConfigData));
                xs.Serialize(fs, config);
                return true;
            }
        }
Ejemplo n.º 19
0
 public static bool HasConnectionString(ConfigData cdApp)
 {
     if (!string.IsNullOrEmpty(cdApp["Server"]) &&
         !string.IsNullOrEmpty(cdApp["Database"]) &&
         !string.IsNullOrEmpty(cdApp["User"]) &&
         !string.IsNullOrEmpty(cdApp["Password"])
         )
         return true;
     else
         return false;
 }
    /// <summary>
    /// Define the ratio between sidelength, top diameter, and bottom diameter.
    /// Geometry and materials are updated according to the new parameters.
    /// </summary>
    public static void UpdateAspectRatio(IEditorCylinderTargetBehaviour ct, ConfigData.CylinderTargetData ctConfig)
    {
        var topRatio = ctConfig.topDiameter/ctConfig.sideLength;
        var bottomRatio = ctConfig.bottomDiameter/ctConfig.sideLength;

        ct.SetAspectRatio(topRatio, bottomRatio);
        UpdateGeometry(ct, 1.0f, topRatio, bottomRatio, ctConfig.hasTopGeometry, ctConfig.hasBottomGeometry);

        //assign materials
        UpdateMaterials(ct, ctConfig.hasBottomGeometry, ctConfig.hasTopGeometry, INSIDE_MATERIAL);
    }
Ejemplo n.º 21
0
    // Private constructor. Class is implemented as a singleton.
    private ConfigDataManager()
    {
        mConfigData = new ConfigData();

        mDoAsyncWrite = false;
        mReadInProgress = false;
        mLockData = false;

        mUpdateTimer = new Timer(20.0);
        mUpdateTimer.Elapsed += new ElapsedEventHandler(TimedUpdate);
        mUpdateTimer.Enabled = true;
    }
Ejemplo n.º 22
0
        public static Config Load(string filename)
        {
            if(!MyAPIGateway.Utilities.FileExistsInLocalStorage(filename, typeof(ConfigData))) {
                return new Config(filename, new ConfigData());
            } else {
                ConfigData data;
                TextReader reader = MyAPIGateway.Utilities.ReadFileInLocalStorage(filename, typeof(ConfigData));
                string xmlText = reader.ReadToEnd();
                reader.Close();

                if (string.IsNullOrWhiteSpace(xmlText)) {
                    data = new ConfigData();
                } else {
                    data = MyAPIGateway.Utilities.SerializeFromXML<ConfigData>(xmlText);
                }

                return new Config(filename, data);
            }
        }
Ejemplo n.º 23
0
        private void parseFile(string filename)
        {
            if (!File.Exists(filename))
            {
                //error out.  somehow thiis doesn't exist anymore
                return;
            }
            ConfigData cfg = new ConfigData();
            string[] fullconfigfile = File.ReadAllLines(filename);
            Dictionary<string, float> fileValues = new Dictionary<string, float>();
            for (int i = 0; i < fullconfigfile.Length; i++)
            {
                if(fullconfigfile[i].StartsWith("#define"))
                {
                    string tmpstr = fullconfigfile[i].Replace("#define ", string.Empty);
                    tmpstr = tmpstr.Replace(";", string.Empty);
                    string[] keyval = tmpstr.Split(' ');
                    fileValues.Add(keyval[0].Trim(), keyval.Length > 1 ? float.Parse(keyval[1].Trim()) : 0);

                }
            }
        }
Ejemplo n.º 24
0
 public static ConfigData GetConfigData()
 {
     if (!File.Exists(CONFIG_FNAME)) // create config file with default values
     {
         using (FileStream fs = new FileStream(CONFIG_FNAME, FileMode.Create))
         {
             XmlSerializer xs = new XmlSerializer(typeof(ConfigData));
             ConfigData sxml = new ConfigData();
             xs.Serialize(fs, sxml);
             return sxml;
         }
     }
     else // read configuration from file
     {
         using (FileStream fs = new FileStream(CONFIG_FNAME, FileMode.Open))
         {
             XmlSerializer xs = new XmlSerializer(typeof(ConfigData));
             ConfigData sc = (ConfigData)xs.Deserialize(fs);
             return sc;
         }
     }
 }
Ejemplo n.º 25
0
    public void BottoneLogin()
    {
        ManagerScenaZero.AttivaDisattivaCanvasGroupLogin(false);
        erroreText.text = "";

        ConfigData cfg = new ConfigData();
        cfg.Host = host;
        cfg.Port = port;
        cfg.Zone = zona;

        sfs = new SmartFox();

        sfs.ThreadSafeMode = true;
        sfs.AddEventListener(SFSEvent.CONNECTION, OnConnection);
        sfs.AddEventListener(SFSEvent.CONNECTION_LOST, OnConnectionLost);
        sfs.AddEventListener(SFSEvent.LOGIN, OnLogin);
        sfs.AddEventListener(SFSEvent.LOGIN_ERROR, OnLoginError);
        sfs.AddEventListener(SFSEvent.ROOM_JOIN, OnRoomJoin);
        sfs.AddEventListener(SFSEvent.ROOM_JOIN_ERROR, OnRoomJoinError);

        sfs.Connect(cfg);
    }
Ejemplo n.º 26
0
 public static void ReadConfigFile()
 {
     FileStream fileStream = null;
     try
     {
         string path = Application.persistentDataPath + GameSetting.SettingFileName;
         if (File.Exists(path))
         {
             fileStream = new FileStream(path, FileMode.Open, FileAccess.Read);
             if (fileStream != null)
             {
                 GameSetting.Data = (Serializer.NonGeneric.Deserialize(typeof(ConfigData), fileStream) as ConfigData);
             }
         }
     }
     catch (Exception ex)
     {
         global::Debug.LogWarning(new object[]
         {
             "Parse config file failed, using default data, Exception:" + ex.Message
         });
     }
     if (fileStream != null)
     {
         fileStream.Close();
     }
     if (GameSetting.Data == null)
     {
         GameSetting.Data = new ConfigData();
         if (GameSetting.Data == null)
         {
             global::Debug.LogError(new object[]
             {
                 "allocate ConfigData error"
             });
         }
     }
 }
    // This method creates a single data set from the trackables provided.
    // The method ignores the data set property in TrackableBehaviour and
    // adds all Trackables to a single file.
    // Default Trackables are not added to the data set.
    private ConfigData CreateDataSetFromTrackables(TrackableBehaviour[] trackables)
    {
        // Sanity check.
        if (trackables == null)
        {
            return null;
        }

        ConfigData sceneData = new ConfigData();

        foreach (TrackableBehaviour tb in trackables)
        {
            // Ignore non-data set trackables.
            if (!(tb is DataSetTrackableBehaviour))
            {
                continue;
            }

            IEditorDataSetTrackableBehaviour trackable = (DataSetTrackableBehaviour)tb;

            string dataSetName = trackable.DataSetName;
            string trackableName = trackable.TrackableName;

            // We ignore default Trackables or undefined Trackables.
            if (dataSetName == QCARUtilities.GlobalVars.DEFAULT_DATA_SET_NAME ||
                dataSetName == "" ||
                trackableName == QCARUtilities.GlobalVars.DEFAULT_TRACKABLE_NAME ||
                trackableName == "")
            {
                Debug.LogWarning("Ignoring default Trackable for export");
                continue;
            }

            if (trackable.GetType() == typeof(ImageTargetBehaviour))
            {
                ImageTargetBehaviour it = (ImageTargetBehaviour)trackable;
                IEditorImageTargetBehaviour editorIt = it;

                ConfigData.ImageTargetData itConfig = new ConfigData.ImageTargetData();

                itConfig.size = editorIt.GetSize();

                // Process Virtual Button list.
                VirtualButtonBehaviour[] vbs =
                    it.GetComponentsInChildren<VirtualButtonBehaviour>();
                itConfig.virtualButtons = new List<ConfigData.VirtualButtonData>(vbs.Length);
                foreach (VirtualButtonBehaviour vb in vbs)
                {
                    Vector2 leftTop;
                    Vector2 rightBottom;
                    if (!vb.CalculateButtonArea(out leftTop,
                                                out rightBottom))
                    {
                        // Invalid Button
                        continue;
                    }

                    ConfigData.VirtualButtonData vbConfig =
                        new ConfigData.VirtualButtonData();

                    IEditorVirtualButtonBehaviour editorVB = vb;
                    vbConfig.name = editorVB.VirtualButtonName;
                    vbConfig.enabled = editorVB.enabled;
                    vbConfig.rectangle = new Vector4(leftTop.x,
                                                        leftTop.y,
                                                        rightBottom.x,
                                                        rightBottom.y);
                    vbConfig.sensitivity = editorVB.SensitivitySetting;

                    itConfig.virtualButtons.Add(vbConfig);
                }

                sceneData.SetImageTarget(itConfig, editorIt.TrackableName);
            }
            else if (trackable.GetType() == typeof(MultiTargetBehaviour))
            {
                Debug.Log("Multi Targets not exported.");
            }
            else if (trackable.GetType() == typeof(CylinderTargetBehaviour))
            {
                Debug.Log("Cylinder Targets not exported.");
            }
        }

        return sceneData;
    }
Ejemplo n.º 28
0
 public LogicCreateAPI()
 {
     _config = ConfigUtility.GetData(_path);
 }
Ejemplo n.º 29
0
        private void _BGWAbsenceAndPeriodList_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            pictureBox.Visible = false;

            DataGridViewTextBoxColumn colName = new DataGridViewTextBoxColumn();

            colName.HeaderText   = "節次分類";
            colName.MinimumWidth = 70;
            colName.Name         = "colName";
            colName.ReadOnly     = true;
            colName.SortMode     = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
            colName.Width        = 70;
            this.dgv.Columns.Add(colName);

            foreach (string absence in absenceList)
            {
                System.Windows.Forms.DataGridViewCheckBoxColumn newCol = new DataGridViewCheckBoxColumn();
                newCol.HeaderText = absence;
                newCol.Width      = 55;
                newCol.ReadOnly   = false;
                newCol.SortMode   = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
                newCol.Tag        = absence;
                newCol.ValueType  = typeof(bool);
                this.dgv.Columns.Add(newCol);
            }
            foreach (string type in typeList)
            {
                DataGridViewRow row = new DataGridViewRow();
                row.CreateCells(dgv, type);
                row.Tag = type;
                dgv.Rows.Add(row);
            }

            #region 讀取列印設定 Preference
            ConfigData cd = K12.Data.School.Configuration[_preferenceElementName];
            if (cd.Contains("假別設定"))
            {
                XmlElement config = Framework.XmlHelper.LoadXml(cd["假別設定"]);
                #region 已有設定檔則將設定檔內容填回畫面上
                foreach (XmlElement type in config.SelectNodes("Type"))
                {
                    string typeName = type.GetAttribute("Text");
                    foreach (DataGridViewRow row in dgv.Rows)
                    {
                        if (typeName == ("" + row.Tag))
                        {
                            foreach (XmlElement absence in type.SelectNodes("Absence"))
                            {
                                string absenceName = absence.GetAttribute("Text");
                                foreach (DataGridViewCell cell in row.Cells)
                                {
                                    if (cell.OwningColumn is DataGridViewCheckBoxColumn && ("" + cell.OwningColumn.Tag) == absenceName)
                                    {
                                        cell.Value = true;
                                    }
                                }
                            }
                            break;
                        }
                    }
                }
                #endregion
            }
            #endregion
        }
Ejemplo n.º 30
0
 protected override void LoadDefaultConfig()
 {
     LogWarning("Creating a new config file.");
     configData = LoadBaseConfig();
     SaveConfig();
 }
Ejemplo n.º 31
0
        private void btnSendEmail_Click(object sender, System.EventArgs e)
        {
            Hidistro.Membership.Context.SiteSettings siteSetting = this.GetSiteSetting();
            string text = siteSetting.EmailSender.ToLower();

            if (string.IsNullOrEmpty(text))
            {
                this.ShowMsg("请先选择发送方式", false);
                return;
            }
            ConfigData configData = null;

            if (siteSetting.EmailEnabled)
            {
                configData = new ConfigData(HiCryptographer.Decrypt(siteSetting.EmailSettings));
            }
            if (configData == null)
            {
                this.ShowMsg("请先选择发送方式并填写配置信息", false);
                return;
            }
            if (!configData.IsValid)
            {
                string text2 = "";
                foreach (string current in configData.ErrorMsgs)
                {
                    text2 += Formatter.FormatErrorMessage(current);
                }
                this.ShowMsg(text2, false);
                return;
            }
            string text3 = this.txtemailcontent.Value.Trim();

            if (string.IsNullOrEmpty(text3))
            {
                this.ShowMsg("请先填写发送的内容信息", false);
                return;
            }
            string text4 = null;

            foreach (System.Web.UI.WebControls.GridViewRow gridViewRow in this.grdUnderlings.Rows)
            {
                System.Web.UI.WebControls.CheckBox checkBox = (System.Web.UI.WebControls.CheckBox)gridViewRow.FindControl("checkboxCol");
                if (checkBox.Checked)
                {
                    string text5 = ((System.Web.UI.DataBoundLiteralControl)gridViewRow.Controls[3].Controls[0]).Text.Trim().Replace("<div></div>", "");
                    if (!string.IsNullOrEmpty(text5) && System.Text.RegularExpressions.Regex.IsMatch(text5, "([a-zA-Z\\.0-9_-])+@([a-zA-Z0-9_-])+((\\.[a-zA-Z0-9_-]{2,4}){1,2})"))
                    {
                        text4 = text4 + text5 + ",";
                    }
                }
            }
            if (text4 == null)
            {
                this.ShowMsg("请先选择要发送的会员或检测邮箱格式是否正确", false);
                return;
            }
            text4 = text4.Substring(0, text4.Length - 1);
            string[] array;
            if (text4.Contains(","))
            {
                array = text4.Split(new char[]
                {
                    ','
                });
            }
            else
            {
                array = new string[]
                {
                    text4
                };
            }
            System.Net.Mail.MailMessage mailMessage = new System.Net.Mail.MailMessage
            {
                IsBodyHtml      = true,
                Priority        = System.Net.Mail.MailPriority.High,
                SubjectEncoding = System.Text.Encoding.UTF8,
                BodyEncoding    = System.Text.Encoding.UTF8,
                Body            = text3,
                Subject         = "来自" + siteSetting.SiteName
            };
            string[] array2 = array;
            for (int i = 0; i < array2.Length; i++)
            {
                string addresses = array2[i];
                mailMessage.To.Add(addresses);
            }
            EmailSender emailSender = EmailSender.CreateInstance(text, configData.SettingsXml);

            try
            {
                if (emailSender.Send(mailMessage, System.Text.Encoding.GetEncoding(HiConfiguration.GetConfig().EmailEncoding)))
                {
                    this.ShowMsg("发送邮件成功", true);
                }
                else
                {
                    this.ShowMsg("发送邮件失败", false);
                }
            }
            catch (System.Exception)
            {
                this.ShowMsg("发送邮件成功,但存在无效的邮箱账号", true);
            }
            this.txtemailcontent.Value = "输入发送内容……";
        }
Ejemplo n.º 32
0
        protected override void LoadDefaultConfig()
        {
            var config = new ConfigData
            {
                BarrageSettings = new Barrage
                {
                    NumberOfRockets = 20,
                    RocketDelay     = 0.33f,
                    RocketSpread    = 16f
                },
                DamageControl = new Damage
                {
                    DamageMultiplier = 0.2f,
                },
                Options = new Options
                {
                    EnableAutomaticEvents = true,
                    EventTimers           = new Timers
                    {
                        EventInterval  = 30,
                        RandomTimerMax = 45,
                        RandomTimerMin = 15,
                        UseRandomTimer = false
                    },
                    GlobalDropMultiplier = 1.0f,
                    NotifyEvent          = true
                },
                z_IntensitySettings = new Intensity
                {
                    Settings_Mild = new Settings
                    {
                        FireRocketChance = 30,
                        Radius           = 500f,
                        Duration         = 240,
                        ItemDropControl  = new Drops
                        {
                            EnableItemDrop = true,
                            ItemsToDrop    = new ItemDrop[]
                            {
                                new ItemDrop
                                {
                                    Maximum   = 120,
                                    Minimum   = 80,
                                    Shortname = "stones"
                                },
                                new ItemDrop
                                {
                                    Maximum   = 50,
                                    Minimum   = 25,
                                    Shortname = "metal.ore"
                                }
                            }
                        },
                        RocketAmount = 20
                    },
                    Settings_Optimal = new Settings
                    {
                        FireRocketChance = 20,
                        Radius           = 300f,
                        Duration         = 120,
                        ItemDropControl  = new Drops
                        {
                            EnableItemDrop = true,
                            ItemsToDrop    = new ItemDrop[]
                            {
                                new ItemDrop
                                {
                                    Maximum   = 250,
                                    Minimum   = 160,
                                    Shortname = "stones"
                                },
                                new ItemDrop
                                {
                                    Maximum   = 120,
                                    Minimum   = 60,
                                    Shortname = "metal.fragments"
                                },
                                new ItemDrop
                                {
                                    Maximum   = 50,
                                    Minimum   = 20,
                                    Shortname = "hq.metal.ore"
                                }
                            }
                        },
                        RocketAmount = 45
                    },
                    Settings_Extreme = new Settings
                    {
                        FireRocketChance = 10,
                        Radius           = 100f,
                        Duration         = 30,
                        ItemDropControl  = new Drops
                        {
                            EnableItemDrop = true,
                            ItemsToDrop    = new ItemDrop[]
                            {
                                new ItemDrop
                                {
                                    Maximum   = 400,
                                    Minimum   = 250,
                                    Shortname = "stones"
                                },
                                new ItemDrop
                                {
                                    Maximum   = 300,
                                    Minimum   = 125,
                                    Shortname = "metal.fragments"
                                },
                                new ItemDrop
                                {
                                    Maximum   = 50,
                                    Minimum   = 20,
                                    Shortname = "metal.refined"
                                },
                                new ItemDrop
                                {
                                    Maximum   = 120,
                                    Minimum   = 45,
                                    Shortname = "sulfur.ore"
                                }
                            }
                        },
                        RocketAmount = 70
                    }
                }
            };

            SaveConfig(config);
        }
Ejemplo n.º 33
0
        /// <summary>
        /// Create/Overwrite Azure Advisor configuration.
        /// </summary>
        /// <param name='configContract'>
        /// The Azure Advisor configuration data structure.
        /// </param>
        /// <param name='resourceGroup'>
        /// The name of the Azure resource group.
        /// </param>
        /// <param name='customHeaders'>
        /// Headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="CloudException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="SerializationException">
        /// Thrown when unable to deserialize the response
        /// </exception>
        /// <exception cref="ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        /// <exception cref="System.ArgumentNullException">
        /// Thrown when a required parameter is null
        /// </exception>
        /// <return>
        /// A response object containing the response body and response headers.
        /// </return>
        public async Task <AzureOperationResponse <ARMErrorResponseBody> > CreateInResourceGroupWithHttpMessagesAsync(ConfigData configContract, string resourceGroup, Dictionary <string, List <string> > customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (Client.ApiVersion == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
            }
            if (configContract == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "configContract");
            }
            if (Client.SubscriptionId == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
            }
            if (resourceGroup == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroup");
            }
            // Tracing
            bool   _shouldTrace  = ServiceClientTracing.IsEnabled;
            string _invocationId = null;

            if (_shouldTrace)
            {
                _invocationId = ServiceClientTracing.NextInvocationId.ToString();
                Dictionary <string, object> tracingParameters = new Dictionary <string, object>();
                tracingParameters.Add("configContract", configContract);
                tracingParameters.Add("resourceGroup", resourceGroup);
                tracingParameters.Add("cancellationToken", cancellationToken);
                ServiceClientTracing.Enter(_invocationId, this, "CreateInResourceGroup", tracingParameters);
            }
            // Construct URL
            var _baseUrl = Client.BaseUri.AbsoluteUri;
            var _url     = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Advisor/configurations").ToString();

            _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
            _url = _url.Replace("{resourceGroup}", System.Uri.EscapeDataString(resourceGroup));
            List <string> _queryParameters = new List <string>();

            if (Client.ApiVersion != null)
            {
                _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
            }
            if (_queryParameters.Count > 0)
            {
                _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
            }
            // Create HTTP transport objects
            var _httpRequest = new HttpRequestMessage();
            HttpResponseMessage _httpResponse = null;

            _httpRequest.Method     = new HttpMethod("PUT");
            _httpRequest.RequestUri = new System.Uri(_url);
            // Set Headers
            if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
            {
                _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
            }
            if (Client.AcceptLanguage != null)
            {
                if (_httpRequest.Headers.Contains("accept-language"))
                {
                    _httpRequest.Headers.Remove("accept-language");
                }
                _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
            }


            if (customHeaders != null)
            {
                foreach (var _header in customHeaders)
                {
                    if (_httpRequest.Headers.Contains(_header.Key))
                    {
                        _httpRequest.Headers.Remove(_header.Key);
                    }
                    _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
                }
            }

            // Serialize Request
            string _requestContent = null;

            if (configContract != null)
            {
                _requestContent      = Rest.Serialization.SafeJsonConvert.SerializeObject(configContract, Client.SerializationSettings);
                _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
                _httpRequest.Content.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
            }
            // Set Credentials
            if (Client.Credentials != null)
            {
                cancellationToken.ThrowIfCancellationRequested();
                await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
            }
            // Send Request
            if (_shouldTrace)
            {
                ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
            }
            cancellationToken.ThrowIfCancellationRequested();
            _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);

            if (_shouldTrace)
            {
                ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
            }
            HttpStatusCode _statusCode = _httpResponse.StatusCode;

            cancellationToken.ThrowIfCancellationRequested();
            string _responseContent = null;

            if ((int)_statusCode != 204 && (int)_statusCode != 400)
            {
                var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
                try
                {
                    _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);

                    CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject <CloudError>(_responseContent, Client.DeserializationSettings);
                    if (_errorBody != null)
                    {
                        ex      = new CloudException(_errorBody.Message);
                        ex.Body = _errorBody;
                    }
                }
                catch (JsonException)
                {
                    // Ignore the exception
                }
                ex.Request  = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
                ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
                if (_httpResponse.Headers.Contains("x-ms-request-id"))
                {
                    ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
                }
                if (_shouldTrace)
                {
                    ServiceClientTracing.Error(_invocationId, ex);
                }
                _httpRequest.Dispose();
                if (_httpResponse != null)
                {
                    _httpResponse.Dispose();
                }
                throw ex;
            }
            // Create Result
            var _result = new AzureOperationResponse <ARMErrorResponseBody>();

            _result.Request  = _httpRequest;
            _result.Response = _httpResponse;
            if (_httpResponse.Headers.Contains("x-ms-request-id"))
            {
                _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
            }
            // Deserialize Response
            if ((int)_statusCode == 400)
            {
                _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);

                try
                {
                    _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject <ARMErrorResponseBody>(_responseContent, Client.DeserializationSettings);
                }
                catch (JsonException ex)
                {
                    _httpRequest.Dispose();
                    if (_httpResponse != null)
                    {
                        _httpResponse.Dispose();
                    }
                    throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
                }
            }
            if (_shouldTrace)
            {
                ServiceClientTracing.Exit(_invocationId, _result);
            }
            return(_result);
        }
Ejemplo n.º 34
0
        public override void ConfigureUserSettings(ConfigData.ExternalPlayer currentConfiguration)
        {
            string iniPath = GetIniFilePath(currentConfiguration);

            if (string.IsNullOrEmpty(iniPath))
            {
                ConfigureUserSettingsIntoRegistry();
            }
            else
            {
                ConfigureUserSettingsIntoINIFile(iniPath);
            }
        }
Ejemplo n.º 35
0
        static public void Main()
        {
            // 匯入驗證規則
            FactoryProvider.FieldFactory.Add(new EquipmentFieldValidatorFactory());
            FactoryProvider.RowFactory.Add(new EquipmentRowValidatorFactory());

            #region Init UDT
            {
                ConfigData cd = K12.Data.School.Configuration["設備預約模組載入設定Version_1008"];

                bool   checkUDT = false;
                string name     = "設備預約UDT是否已載入";

                //如果尚無設定值,預設為
                if (string.IsNullOrEmpty(cd[name]))
                {
                    cd[name] = "false";
                }

                //檢查是否為布林
                bool.TryParse(cd[name], out checkUDT);

                if (!checkUDT)
                {
                    AccessHelper access = new AccessHelper();
                    access.Select <UDT.Equipment>("UID = '00000'");
                    access.Select <UDT.EquipmentUnit>("UID = '00000'");
                    access.Select <UDT.EquipmentUnitAdmin>("UID = '00000'");
                    access.Select <UDT.EquipmentApplication>("UID = '00000'");
                    access.Select <UDT.EquipmentApplicationDetail>("UID = '00000'");
                    access.Select <UDT.EquipmentIOHistory>("UID = '00000'");

                    cd[name] = "true";
                    cd.Save();
                }
            }
            #endregion

            #region 建立設備預約模組管理者專用角色
            {
                // 如果管理者角色不存在,建立角色並取回角色ID
                if (!DAO.Role.CheckIsRoleExist(_roleAdminName))
                {
                    _roleAdminID = DAO.Role.InsertRole(_roleAdminName, "", _adminPermission);
                }
                else // 更新角色權限
                {
                    DAO.Role.UpdateRole(_roleAdminID, _adminPermission);
                }
            }
            #endregion

            #region 建立設備預約單位管理員角色
            {
                // 如果專用角色不存在,建立角色並取回角色ID
                if (!DAO.Role.CheckIsRoleExist(_roleUnitAdminName))
                {
                    _roleUnitAdminID = DAO.Role.InsertRole(_roleUnitAdminName, "", _unitAdminPermission);
                }
                else // 更新角色權限
                {
                    DAO.Role.UpdateRole(_roleUnitAdminID, _unitAdminPermission);
                }
            }
            #endregion

            // 取得登入帳號與身分
            Actor actor = Actor.Instance;

            // 建立設備預約分頁
            //MotherForm.AddPanel(BookingEquipmentAdmin.Instance);

            #region 設備預約
            {
                //2021-12-15 Cynthia 因原先操作指南無法在x64版本上作為背景載入,故參考俊威的意見,將操作指南另外用一個button點擊開啟。
                MotherForm.RibbonBarItems["設備預約", "使用說明"]["操作指南"].Image = Properties.Resources._03;
                MotherForm.RibbonBarItems["設備預約", "使用說明"]["操作指南"].Size  = RibbonBarButton.MenuButtonSize.Large;
                #region 操作指南
                {
                    MotherForm.RibbonBarItems["設備預約", "使用說明"]["操作指南"].Click += delegate
                    {
                        System.Diagnostics.Process.Start("https://sites.google.com/ischool.com.tw/booking-equipment/%E9%A6%96%E9%A0%81");
                    };
                }
                #endregion

                MotherForm.RibbonBarItems["設備預約", "基本設定"]["設定管理單位"].Size     = RibbonBarButton.MenuButtonSize.Medium;
                MotherForm.RibbonBarItems["設備預約", "基本設定"]["設定管理單位"].Image    = Properties.Resources.meeting_config_64;
                MotherForm.RibbonBarItems["設備預約", "基本設定"]["設定單位管理員"].Size    = RibbonBarButton.MenuButtonSize.Medium;
                MotherForm.RibbonBarItems["設備預約", "基本設定"]["設定單位管理員"].Image   = Properties.Resources.foreign_language_config_64;
                MotherForm.RibbonBarItems["設備預約", "基本設定"]["設備管理"].Size       = RibbonBarButton.MenuButtonSize.Large;
                MotherForm.RibbonBarItems["設備預約", "基本設定"]["設備管理"].Image      = Properties.Resources.shopping_cart_config_64;
                MotherForm.RibbonBarItems["設備預約", "資料統計"]["匯出"].Size         = RibbonBarButton.MenuButtonSize.Large;
                MotherForm.RibbonBarItems["設備預約", "資料統計"]["匯出"].Image        = Properties.Resources.Export_Image;
                MotherForm.RibbonBarItems["設備預約", "資料統計"]["匯入"].Size         = RibbonBarButton.MenuButtonSize.Large;
                MotherForm.RibbonBarItems["設備預約", "資料統計"]["匯入"].Image        = Properties.Resources.Import_Image;
                MotherForm.RibbonBarItems["設備預約", "資料統計"]["報表"].Size         = RibbonBarButton.MenuButtonSize.Large;
                MotherForm.RibbonBarItems["設備預約", "資料統計"]["報表"].Image        = Properties.Resources.Report;
                MotherForm.RibbonBarItems["設備預約", "設備出借作業"]["查詢出借紀錄"].Size   = RibbonBarButton.MenuButtonSize.Large;
                MotherForm.RibbonBarItems["設備預約", "設備出借作業"]["查詢出借紀錄"].Image  = Properties.Resources.barcode_zoom_128;
                MotherForm.RibbonBarItems["設備預約", "設備出借作業"]["設備出借/歸還"].Size  = RibbonBarButton.MenuButtonSize.Large;
                MotherForm.RibbonBarItems["設備預約", "設備出借作業"]["設備出借/歸還"].Image = Properties.Resources.barcode_ok_128;

                #region 設定管理單位
                MotherForm.RibbonBarItems["設備預約", "基本設定"]["設定管理單位"].Enable = Permissions.設定管理單位權限;
                MotherForm.RibbonBarItems["設備預約", "基本設定"]["設定管理單位"].Click += delegate
                {
                    ManagementUnit form = new ManagementUnit();
                    form.ShowDialog();
                };
                #endregion

                #region 設定單位管理員
                MotherForm.RibbonBarItems["設備預約", "基本設定"]["設定單位管理員"].Enable = Permissions.設定單位管理員權限;
                MotherForm.RibbonBarItems["設備預約", "基本設定"]["設定單位管理員"].Click += delegate
                {
                    SetUnitAdmin form = new SetUnitAdmin();
                    form.ShowDialog();
                };
                #endregion

                #region 設備管理
                MotherForm.RibbonBarItems["設備預約", "基本設定"]["設備管理"].Enable = Permissions.管理設備權限;
                MotherForm.RibbonBarItems["設備預約", "基本設定"]["設備管理"].Click += delegate
                {
                    ManageEquipment form = new ManageEquipment();
                    form.ShowDialog();
                };
                #endregion

                #region 資料統計

                #region 匯出設備清單
                MotherForm.RibbonBarItems["設備預約", "資料統計"]["匯出"]["匯出設備清單"].Enable = Permissions.匯出設備清單權限;
                MotherForm.RibbonBarItems["設備預約", "資料統計"]["匯出"]["匯出設備清單"].Click += delegate
                {
                    ExportEquipmentForm form = new ExportEquipmentForm();
                    form.ShowDialog();
                };
                #endregion

                #region 匯入設備清單
                MotherForm.RibbonBarItems["設備預約", "資料統計"]["匯入"]["匯入設備清單"].Enable = Permissions.匯入設備清單權限;
                MotherForm.RibbonBarItems["設備預約", "資料統計"]["匯入"]["匯入設備清單"].Click += delegate
                {
                    new ImportEquipmentData().Execute();
                };
                #endregion

                #region 統計設備使用狀況
                MotherForm.RibbonBarItems["設備預約", "資料統計"]["報表"]["統計設備使用狀況"].Enable = Permissions.統計設備使用狀況權限;
                MotherForm.RibbonBarItems["設備預約", "資料統計"]["報表"]["統計設備使用狀況"].Click += delegate
                {
                    StatisticalTableForm form = new StatisticalTableForm();
                    form.ShowDialog();
                };
                #endregion

                #endregion

                #region 查詢設備出借紀錄
                {
                    MotherForm.RibbonBarItems["設備預約", "設備出借作業"]["查詢出借紀錄"].Enable = Permissions.查詢出借紀錄權限;
                    MotherForm.RibbonBarItems["設備預約", "設備出借作業"]["查詢出借紀錄"].Click += delegate
                    {
                        (new frmSearchApplication()).ShowDialog();
                    };
                }
                #endregion

                #region 設備出借/歸還
                MotherForm.RibbonBarItems["設備預約", "設備出借作業"]["設備出借/歸還"].Enable = Permissions.設備出借歸還權限;
                MotherForm.RibbonBarItems["設備預約", "設備出借作業"]["設備出借/歸還"].Click += delegate
                {
                    BorrowEquipmentForm form = new BorrowEquipmentForm();
                    form.ShowDialog();
                };
                #endregion
            }
            #endregion

            #region  限管理
            Catalog detail = new Catalog();
            detail = RoleAclSource.Instance["設備預約"]["功能按鈕"];
            detail.Add(new RibbonFeature(Permissions.管理單位, "設定管理單位"));
            detail.Add(new RibbonFeature(Permissions.設備單位管理員, "設定設備單位管理員"));
            detail.Add(new RibbonFeature(Permissions.管理設備, "管理設備"));
            detail.Add(new RibbonFeature(Permissions.匯出設備清單, "匯出設備清單"));
            detail.Add(new RibbonFeature(Permissions.匯入設備清單, "匯入設備清單"));
            detail.Add(new RibbonFeature(Permissions.統計設備使用狀況, "統計設備使用狀況"));
            detail.Add(new RibbonFeature(Permissions.設備出借歸還, "設備出借歸還"));
            detail.Add(new RibbonFeature(Permissions.查詢出借紀錄, "查詢出借紀錄"));
            #endregion
        }
Ejemplo n.º 36
0
        private Action <IActivity> ShowEmailList()
        {
            return(activity =>
            {
                var messageActivity = activity.AsMessageActivity();

                // Get showed mails:
                var showedItems = ((MockServiceManager)this.ServiceManager).MailService.MyMessages;

                var replies = this.ParseReplies(EmailSharedResponses.ShowEmailPrompt, new StringDictionary()
                {
                    { "TotalCount", showedItems.Count.ToString() },
                    { "EmailListDetails", SpeakHelper.ToSpeechEmailListString(showedItems, TimeZoneInfo.Local, ConfigData.GetInstance().MaxReadSize) },
                });

                CollectionAssert.Contains(replies, messageActivity.Text);
                Assert.AreNotEqual(messageActivity.Attachments.Count, 0);
            });
        }
Ejemplo n.º 37
0
        private void btnSendMessage_Click(object sender, System.EventArgs e)
        {
            Hidistro.Membership.Context.SiteSettings siteSetting = this.GetSiteSetting();
            string sMSSender = siteSetting.SMSSender;

            if (string.IsNullOrEmpty(sMSSender))
            {
                this.ShowMsg("请先选择发送方式", false);
                return;
            }
            ConfigData configData = null;

            if (siteSetting.SMSEnabled)
            {
                configData = new ConfigData(HiCryptographer.Decrypt(siteSetting.SMSSettings));
            }
            if (configData == null)
            {
                this.ShowMsg("请先选择发送方式并填写配置信息", false);
                return;
            }
            if (!configData.IsValid)
            {
                string text = "";
                foreach (string current in configData.ErrorMsgs)
                {
                    text += Formatter.FormatErrorMessage(current);
                }
                this.ShowMsg(text, false);
                return;
            }
            string text2 = this.txtmsgcontent.Value.Trim();

            if (string.IsNullOrEmpty(text2))
            {
                this.ShowMsg("请先填写发送的内容信息", false);
                return;
            }
            int    num   = System.Convert.ToInt32(this.litsmscount.Text);
            string text3 = null;

            foreach (System.Web.UI.WebControls.GridViewRow gridViewRow in this.grdUnderlings.Rows)
            {
                System.Web.UI.WebControls.CheckBox checkBox = (System.Web.UI.WebControls.CheckBox)gridViewRow.FindControl("checkboxCol");
                if (checkBox.Checked)
                {
                    string text4 = ((System.Web.UI.DataBoundLiteralControl)gridViewRow.Controls[2].Controls[0]).Text.Trim().Replace("<div></div>", "");
                    if (!string.IsNullOrEmpty(text4) && System.Text.RegularExpressions.Regex.IsMatch(text4, "^(13|14|15|18)\\d{9}$"))
                    {
                        text3 = text3 + text4 + ",";
                    }
                }
            }
            if (text3 == null)
            {
                this.ShowMsg("请先选择要发送的会员或检测所选手机号格式是否正确", false);
                return;
            }
            text3 = text3.Substring(0, text3.Length - 1);
            string[] array;
            if (text3.Contains(","))
            {
                array = text3.Split(new char[]
                {
                    ','
                });
            }
            else
            {
                array = new string[]
                {
                    text3
                };
            }
            if (num < array.Length)
            {
                this.ShowMsg("发送失败,您的剩余短信条数不足", false);
                return;
            }
            SMSSender sMSSender2 = SMSSender.CreateInstance(sMSSender, configData.SettingsXml);
            string    string_;
            bool      success = sMSSender2.Send(array, text2, out string_);

            this.ShowMsg(string_, success);
            this.txtmsgcontent.Value = "输入发送内容……";
            this.litsmscount.Text    = (num - array.Length).ToString();
        }
Ejemplo n.º 38
0
        public void SetConfig(MainWindow mainWindow)
        {
            parent = mainWindow;
            ConfigData config = ConfigData.Instance;

            setCheckBox(checkBox1, ConfigCode.IgnoreCase);
            setCheckBox(checkBox2, ConfigCode.UseRenameFile);
            setCheckBox(checkBox3, ConfigCode.UseMouse);
            setCheckBox(checkBox4, ConfigCode.UseMenu);
            setCheckBox(checkBox5, ConfigCode.UseDebugCommand);
            setCheckBox(checkBox6, ConfigCode.AllowMultipleInstances);
            setCheckBox(checkBox7, ConfigCode.AutoSave);
            setCheckBox(checkBox8, ConfigCode.SizableWindow);
            setCheckBox(checkBox10, ConfigCode.UseReplaceFile);
            setCheckBox(checkBox11, ConfigCode.IgnoreUncalledFunction);
            //setCheckBox(checkBox12, ConfigCode.ReduceFormattedStringOnLoad);
            setCheckBox(checkBox13, ConfigCode.DisplayReport);
            setCheckBox(checkBox14, ConfigCode.ButtonWrap);
            setCheckBox(checkBox15, ConfigCode.SearchSubdirectory);
            setCheckBox(checkBox16, ConfigCode.SortWithFilename);
            setCheckBox(checkBox17, ConfigCode.SetWindowPos);
            setCheckBox(checkBox18, ConfigCode.UseKeyMacro);
            setCheckBox(checkBox20, ConfigCode.AllowFunctionOverloading);
            setCheckBox(checkBox19, ConfigCode.WarnFunctionOverloading);
            setCheckBox(checkBox21, ConfigCode.WindowMaximixed);
            setCheckBox(checkBox22, ConfigCode.WarnNormalFunctionOverloading);
            setCheckBox(checkBox23, ConfigCode.WarnBackCompatibility);
            setCheckBox(checkBoxCompatiErrorLine, ConfigCode.CompatiErrorLine);
            setCheckBox(checkBoxCompatiCALLNAME, ConfigCode.CompatiCALLNAME);
            setCheckBox(checkBox24, ConfigCode.UseSaveFolder);
            setCheckBox(checkBox27, ConfigCode.SystemSaveInUTF8);
            setCheckBox(checkBoxCompatiRAND, ConfigCode.CompatiRAND);
            setCheckBox(checkBoxCompatiLinefeedAs1739, ConfigCode.CompatiLinefeedAs1739);
            setCheckBox(checkBox28, ConfigCode.CompatiCallEvent);
            setCheckBox(checkBoxFuncNoIgnoreCase, ConfigCode.CompatiFunctionNoignoreCase);
            setCheckBox(checkBoxSystemFullSpace, ConfigCode.SystemAllowFullSpace);
            setCheckBox(checkBox12, ConfigCode.CompatiFuncArgOptional);
            setCheckBox(checkBox25, ConfigCode.CompatiFuncArgAutoConvert);
            setCheckBox(checkBox26, ConfigCode.SystemSaveInBinary);
            setCheckBox(checkBoxSystemTripleSymbol, ConfigCode.SystemIgnoreTripleSymbol);
            setCheckBox(checkBoxCompatiSP, ConfigCode.CompatiSPChara);
            setCheckBox(checkBox9, ConfigCode.TimesNotRigorousCalculation);
            setCheckBox(checkBox29, ConfigCode.SystemNoTarget);
            setNumericUpDown(numericUpDown2, ConfigCode.WindowX);
            setNumericUpDown(numericUpDown3, ConfigCode.WindowY);
            setNumericUpDown(numericUpDown4, ConfigCode.MaxLog);
            setNumericUpDown(numericUpDown1, ConfigCode.PrintCPerLine);
            setNumericUpDown(numericUpDown9, ConfigCode.PrintCLength);
            setNumericUpDown(numericUpDown6, ConfigCode.LineHeight);
            setNumericUpDown(numericUpDown7, ConfigCode.FPS);
            setNumericUpDown(numericUpDown8, ConfigCode.ScrollHeight);
            setNumericUpDown(numericUpDown5, ConfigCode.FontSize);
            setNumericUpDown(numericUpDown10, ConfigCode.InfiniteLoopAlertTime);
            setNumericUpDown(numericUpDown11, ConfigCode.SaveDataNos);

            setNumericUpDown(numericUpDownPosX, ConfigCode.WindowPosX);
            setNumericUpDown(numericUpDownPosY, ConfigCode.WindowPosY);

            setColorBox(colorBoxFG, ConfigCode.ForeColor);
            setColorBox(colorBoxBG, ConfigCode.BackColor);
            setColorBox(colorBoxSelecting, ConfigCode.FocusColor);
            setColorBox(colorBoxBacklog, ConfigCode.LogColor);

            ConfigItem <TextDrawingMode> itemTDM = (ConfigItem <TextDrawingMode>)ConfigData.Instance.GetConfigItem(ConfigCode.TextDrawingMode);

            switch (itemTDM.Value)
            {
            case TextDrawingMode.WINAPI:
                comboBoxTextDrawingMode.SelectedIndex = 0; break;

            case TextDrawingMode.TEXTRENDERER:
                comboBoxTextDrawingMode.SelectedIndex = 1; break;

            case TextDrawingMode.GRAPHICS:
                comboBoxTextDrawingMode.SelectedIndex = 2; break;
            }
            comboBoxTextDrawingMode.Enabled = !itemTDM.Fixed;

            ConfigItem <string> itemStr = (ConfigItem <string>)ConfigData.Instance.GetConfigItem(ConfigCode.FontName);
            string fontname             = itemStr.Value;
            int    nameIndex            = comboBox2.Items.IndexOf(fontname);

            if (nameIndex >= 0)
            {
                comboBox2.SelectedIndex = nameIndex;
            }
            else
            {
                comboBox2.Text = fontname;
                //nameIndex = comboBox2.Items.IndexOf("MS ゴシック");
                //if (nameIndex >= 0)
                //    comboBox2.SelectedIndex = nameIndex;
            }
            comboBox2.Enabled = !itemStr.Fixed;


            ConfigItem <ReduceArgumentOnLoadFlag> itemRA = (ConfigItem <ReduceArgumentOnLoadFlag>)ConfigData.Instance.GetConfigItem(ConfigCode.ReduceArgumentOnLoad);

            switch (itemRA.Value)
            {
            case ReduceArgumentOnLoadFlag.NO:
                comboBoxReduceArgumentOnLoad.SelectedIndex = 0; break;

            case ReduceArgumentOnLoadFlag.ONCE:
                comboBoxReduceArgumentOnLoad.SelectedIndex = 1; break;

            case ReduceArgumentOnLoadFlag.YES:
                comboBoxReduceArgumentOnLoad.SelectedIndex = 2; break;
            }
            comboBoxReduceArgumentOnLoad.Enabled = !itemRA.Fixed;


            ConfigItem <int> itemInt = (ConfigItem <int>)ConfigData.Instance.GetConfigItem(ConfigCode.DisplayWarningLevel);

            if (itemInt.Value <= 0)
            {
                comboBox5.SelectedIndex = 0;
            }
            else if (itemInt.Value >= 3)
            {
                comboBox5.SelectedIndex = 3;
            }
            else
            {
                comboBox5.SelectedIndex = itemInt.Value;
            }
            comboBox5.Enabled = !itemInt.Fixed;


            ConfigItem <DisplayWarningFlag> itemDWF = (ConfigItem <DisplayWarningFlag>)ConfigData.Instance.GetConfigItem(ConfigCode.FunctionNotFoundWarning);

            switch (itemDWF.Value)
            {
            case DisplayWarningFlag.IGNORE:
                comboBox3.SelectedIndex = 0; break;

            case DisplayWarningFlag.LATER:
                comboBox3.SelectedIndex = 1; break;

            case DisplayWarningFlag.ONCE:
                comboBox3.SelectedIndex = 2; break;

            case DisplayWarningFlag.DISPLAY:
                comboBox3.SelectedIndex = 3; break;
            }
            comboBox3.Enabled = !itemDWF.Fixed;

            itemDWF = (ConfigItem <DisplayWarningFlag>)ConfigData.Instance.GetConfigItem(ConfigCode.FunctionNotCalledWarning);
            switch (itemDWF.Value)
            {
            case DisplayWarningFlag.IGNORE:
                comboBox4.SelectedIndex = 0; break;

            case DisplayWarningFlag.LATER:
                comboBox4.SelectedIndex = 1; break;

            case DisplayWarningFlag.ONCE:
                comboBox4.SelectedIndex = 2; break;

            case DisplayWarningFlag.DISPLAY:
                comboBox4.SelectedIndex = 3; break;
            }
            comboBox4.Enabled = !itemDWF.Fixed;

            ConfigItem <UseLanguage> itemLang = (ConfigItem <UseLanguage>)ConfigData.Instance.GetConfigItem(ConfigCode.useLanguage);

            switch (itemLang.Value)
            {
            case UseLanguage.JAPANESE:
                comboBox1.SelectedIndex = 0; break;

            case UseLanguage.KOREAN:
                comboBox1.SelectedIndex = 1; break;

            case UseLanguage.CHINESE_HANS:
                comboBox1.SelectedIndex = 2; break;

            case UseLanguage.CHINESE_HANT:
                comboBox1.SelectedIndex = 3; break;
            }

            ConfigItem <TextEditorType> itemET = (ConfigItem <TextEditorType>)ConfigData.Instance.GetConfigItem(ConfigCode.EditorType);

            switch (itemET.Value)
            {
            case TextEditorType.SAKURA:
                comboBox6.SelectedIndex = 0; break;

            case TextEditorType.TERAPAD:
                comboBox6.SelectedIndex = 1; break;

            case TextEditorType.EMEDITOR:
                comboBox6.SelectedIndex = 2; break;

            case TextEditorType.USER_SETTING:
                comboBox6.SelectedIndex = 3; break;
            }
            comboBox6.Enabled = !itemET.Fixed;


            textBox1.Text    = Config.TextEditor;
            textBox2.Text    = Config.EditorArg;
            textBox2.Enabled = itemET.Value == TextEditorType.USER_SETTING;
        }
Ejemplo n.º 39
0
 protected override void LoadDefaultConfig()
 {
     config = GetDefaultConfig();
 }
Ejemplo n.º 40
0
        private void LoadConfig()
        {
            string filename = Path.Combine(DataDir, ConfigFile);
            if (File.Exists(filename))
            {
                // Load the data
                configdata = JsonConvert.DeserializeObject<ConfigData>(File.ReadAllText(filename));

                // Fix window position for legacy configs
                if (!(configdata.windowx > -32000 && configdata.windowy > -32000))
                {
                    configdata.ResetWindow();
                }

                // Set window position
                arenawindow.Left = configdata.windowx;
                arenawindow.Top = configdata.windowy;

                // Set options
                arenawindow.CheckBoxOverlay.IsChecked = configdata.overlay;
                arenawindow.CheckBoxManual.IsChecked = configdata.manualclicks;
                arenawindow.CheckBoxAutoSave.IsChecked = configdata.autosave;
                arenawindow.CheckBoxDebug.IsChecked = configdata.debug;
            }

            configinit = true;
        }
Ejemplo n.º 41
0
 private void LoadConfigVariables() => configData = Config.ReadObject <ConfigData>();
Ejemplo n.º 42
0
        private void SaveConfig()
        {
            ConfigData config = ConfigData.Instance.Copy();

            config.GetConfigItem(ConfigCode.IgnoreCase).SetValue <bool>(checkBox1.Checked);
            config.GetConfigItem(ConfigCode.UseRenameFile).SetValue <bool>(checkBox2.Checked);
            config.GetConfigItem(ConfigCode.UseMouse).SetValue <bool>(checkBox3.Checked);
            config.GetConfigItem(ConfigCode.UseMenu).SetValue <bool>(checkBox4.Checked);
            config.GetConfigItem(ConfigCode.UseDebugCommand).SetValue <bool>(checkBox5.Checked);
            config.GetConfigItem(ConfigCode.AllowMultipleInstances).SetValue <bool>(checkBox6.Checked);
            config.GetConfigItem(ConfigCode.AutoSave).SetValue <bool>(checkBox7.Checked);
            config.GetConfigItem(ConfigCode.SizableWindow).SetValue <bool>(checkBox8.Checked);
            config.GetConfigItem(ConfigCode.UseReplaceFile).SetValue <bool>(checkBox10.Checked);
            config.GetConfigItem(ConfigCode.IgnoreUncalledFunction).SetValue <bool>(checkBox11.Checked);
            //config.GetConfigItem(ConfigCode.ReduceFormattedStringOnLoad).SetValue<bool>(checkBox12.Checked);
            config.GetConfigItem(ConfigCode.DisplayReport).SetValue <bool>(checkBox13.Checked);
            config.GetConfigItem(ConfigCode.ButtonWrap).SetValue <bool>(checkBox14.Checked);
            config.GetConfigItem(ConfigCode.SearchSubdirectory).SetValue <bool>(checkBox15.Checked);
            config.GetConfigItem(ConfigCode.SortWithFilename).SetValue <bool>(checkBox16.Checked);
            config.GetConfigItem(ConfigCode.SetWindowPos).SetValue <bool>(checkBox17.Checked);
            config.GetConfigItem(ConfigCode.UseKeyMacro).SetValue <bool>(checkBox18.Checked);
            config.GetConfigItem(ConfigCode.AllowFunctionOverloading).SetValue <bool>(checkBox20.Checked);
            config.GetConfigItem(ConfigCode.WarnFunctionOverloading).SetValue <bool>(checkBox19.Checked);
            config.GetConfigItem(ConfigCode.WindowMaximixed).SetValue <bool>(checkBox21.Checked);
            config.GetConfigItem(ConfigCode.WarnNormalFunctionOverloading).SetValue <bool>(checkBox22.Checked);
            config.GetConfigItem(ConfigCode.WarnBackCompatibility).SetValue <bool>(checkBox23.Checked);
            config.GetConfigItem(ConfigCode.CompatiErrorLine).SetValue <bool>(checkBoxCompatiErrorLine.Checked);
            config.GetConfigItem(ConfigCode.CompatiCALLNAME).SetValue <bool>(checkBoxCompatiCALLNAME.Checked);
            config.GetConfigItem(ConfigCode.UseSaveFolder).SetValue <bool>(checkBox24.Checked);
            config.GetConfigItem(ConfigCode.CompatiRAND).SetValue <bool>(checkBoxCompatiRAND.Checked);
            config.GetConfigItem(ConfigCode.CompatiLinefeedAs1739).SetValue <bool>(checkBoxCompatiLinefeedAs1739.Checked);
            config.GetConfigItem(ConfigCode.CompatiCallEvent).SetValue <bool>(checkBox28.Checked);
            config.GetConfigItem(ConfigCode.SystemSaveInUTF8).SetValue <bool>(checkBox27.Checked);

            config.GetConfigItem(ConfigCode.CompatiFuncArgOptional).SetValue <bool>(checkBox12.Checked);
            config.GetConfigItem(ConfigCode.CompatiFuncArgAutoConvert).SetValue <bool>(checkBox25.Checked);
            config.GetConfigItem(ConfigCode.SystemSaveInBinary).SetValue <bool>(checkBox26.Checked);
            config.GetConfigItem(ConfigCode.SystemIgnoreTripleSymbol).SetValue <bool>(checkBoxSystemTripleSymbol.Checked);

            config.GetConfigItem(ConfigCode.CompatiFunctionNoignoreCase).SetValue <bool>(checkBoxFuncNoIgnoreCase.Checked);
            config.GetConfigItem(ConfigCode.SystemAllowFullSpace).SetValue <bool>(checkBoxSystemFullSpace.Checked);
            config.GetConfigItem(ConfigCode.CompatiSPChara).SetValue <bool>(checkBoxCompatiSP.Checked);
            config.GetConfigItem(ConfigCode.TimesNotRigorousCalculation).SetValue <bool>(checkBox9.Checked);
            config.GetConfigItem(ConfigCode.SystemNoTarget).SetValue <bool>(checkBox29.Checked);


            config.GetConfigItem(ConfigCode.WindowX).SetValue <int>((int)numericUpDown2.Value);
            config.GetConfigItem(ConfigCode.WindowY).SetValue <int>((int)numericUpDown3.Value);
            config.GetConfigItem(ConfigCode.MaxLog).SetValue <int>((int)numericUpDown4.Value);
            config.GetConfigItem(ConfigCode.PrintCPerLine).SetValue <int>((int)numericUpDown1.Value);
            config.GetConfigItem(ConfigCode.PrintCLength).SetValue <int>((int)numericUpDown9.Value);
            config.GetConfigItem(ConfigCode.LineHeight).SetValue <int>((int)numericUpDown6.Value);
            config.GetConfigItem(ConfigCode.FPS).SetValue <int>((int)numericUpDown7.Value);
            config.GetConfigItem(ConfigCode.ScrollHeight).SetValue <int>((int)numericUpDown8.Value);
            config.GetConfigItem(ConfigCode.InfiniteLoopAlertTime).SetValue <int>((int)numericUpDown10.Value);
            config.GetConfigItem(ConfigCode.SaveDataNos).SetValue <int>((int)numericUpDown11.Value);

            config.GetConfigItem(ConfigCode.WindowPosX).SetValue <int>((int)numericUpDownPosX.Value);
            config.GetConfigItem(ConfigCode.WindowPosY).SetValue <int>((int)numericUpDownPosY.Value);

            config.GetConfigItem(ConfigCode.FontSize).SetValue <int>((int)numericUpDown5.Value);
            int nameIndex = comboBox2.SelectedIndex;

            if (nameIndex >= 0)
            {
                config.GetConfigItem(ConfigCode.FontName).SetValue <string>((string)comboBox2.SelectedItem);
            }
            else
            {
                config.GetConfigItem(ConfigCode.FontName).SetValue <string>(comboBox2.Text);
            }



            config.GetConfigItem(ConfigCode.ForeColor).SetValue <Color>(colorBoxFG.SelectingColor);
            config.GetConfigItem(ConfigCode.BackColor).SetValue <Color>(colorBoxBG.SelectingColor);
            config.GetConfigItem(ConfigCode.FocusColor).SetValue <Color>(colorBoxSelecting.SelectingColor);
            config.GetConfigItem(ConfigCode.LogColor).SetValue <Color>(colorBoxBacklog.SelectingColor);

            switch (comboBoxTextDrawingMode.SelectedIndex)
            {
            case 0:
                config.GetConfigItem(ConfigCode.TextDrawingMode).SetValue <TextDrawingMode>(TextDrawingMode.WINAPI); break;

            case 1:
                config.GetConfigItem(ConfigCode.TextDrawingMode).SetValue <TextDrawingMode>(TextDrawingMode.TEXTRENDERER); break;

            case 2:
                config.GetConfigItem(ConfigCode.TextDrawingMode).SetValue <TextDrawingMode>(TextDrawingMode.GRAPHICS); break;
            }

            switch (comboBoxReduceArgumentOnLoad.SelectedIndex)
            {
            case 0:
                config.GetConfigItem(ConfigCode.ReduceArgumentOnLoad).SetValue <ReduceArgumentOnLoadFlag>(ReduceArgumentOnLoadFlag.NO); break;

            case 1:
                config.GetConfigItem(ConfigCode.ReduceArgumentOnLoad).SetValue <ReduceArgumentOnLoadFlag>(ReduceArgumentOnLoadFlag.ONCE); break;

            case 2:
                config.GetConfigItem(ConfigCode.ReduceArgumentOnLoad).SetValue <ReduceArgumentOnLoadFlag>(ReduceArgumentOnLoadFlag.YES); break;
            }
            config.GetConfigItem(ConfigCode.DisplayWarningLevel).SetValue <int>(comboBox5.SelectedIndex);


            switch (comboBox3.SelectedIndex)
            {
            case 0:
                config.GetConfigItem(ConfigCode.FunctionNotFoundWarning).SetValue <DisplayWarningFlag>(DisplayWarningFlag.IGNORE); break;

            case 1:
                config.GetConfigItem(ConfigCode.FunctionNotFoundWarning).SetValue <DisplayWarningFlag>(DisplayWarningFlag.LATER); break;

            case 2:
                config.GetConfigItem(ConfigCode.FunctionNotFoundWarning).SetValue <DisplayWarningFlag>(DisplayWarningFlag.ONCE); break;

            case 3:
                config.GetConfigItem(ConfigCode.FunctionNotFoundWarning).SetValue <DisplayWarningFlag>(DisplayWarningFlag.DISPLAY); break;
            }
            switch (comboBox4.SelectedIndex)
            {
            case 0:
                config.GetConfigItem(ConfigCode.FunctionNotCalledWarning).SetValue <DisplayWarningFlag>(DisplayWarningFlag.IGNORE); break;

            case 1:
                config.GetConfigItem(ConfigCode.FunctionNotCalledWarning).SetValue <DisplayWarningFlag>(DisplayWarningFlag.LATER); break;

            case 2:
                config.GetConfigItem(ConfigCode.FunctionNotCalledWarning).SetValue <DisplayWarningFlag>(DisplayWarningFlag.ONCE); break;

            case 3:
                config.GetConfigItem(ConfigCode.FunctionNotCalledWarning).SetValue <DisplayWarningFlag>(DisplayWarningFlag.DISPLAY); break;
            }
            switch (comboBox1.SelectedIndex)
            {
            case 0:
                config.GetConfigItem(ConfigCode.useLanguage).SetValue <UseLanguage>(UseLanguage.JAPANESE); break;

            case 1:
                config.GetConfigItem(ConfigCode.useLanguage).SetValue <UseLanguage>(UseLanguage.KOREAN); break;

            case 2:
                config.GetConfigItem(ConfigCode.useLanguage).SetValue <UseLanguage>(UseLanguage.CHINESE_HANS); break;

            case 3:
                config.GetConfigItem(ConfigCode.useLanguage).SetValue <UseLanguage>(UseLanguage.CHINESE_HANT); break;
            }
            switch (comboBox6.SelectedIndex)
            {
            case 0:
                config.GetConfigItem(ConfigCode.EditorType).SetValue <TextEditorType>(TextEditorType.SAKURA); break;

            case 1:
                config.GetConfigItem(ConfigCode.EditorType).SetValue <TextEditorType>(TextEditorType.TERAPAD); break;

            case 2:
                config.GetConfigItem(ConfigCode.EditorType).SetValue <TextEditorType>(TextEditorType.EMEDITOR); break;

            case 3:
                config.GetConfigItem(ConfigCode.EditorType).SetValue <TextEditorType>(TextEditorType.USER_SETTING); break;
            }

            config.GetConfigItem(ConfigCode.TextEditor).SetValue <string>(textBox1.Text);
            config.GetConfigItem(ConfigCode.EditorArgument).SetValue <string>(textBox2.Text);

            config.SaveConfig();
        }
Ejemplo n.º 43
0
 void SaveConfig(ConfigData config) => Config.WriteObject(config, true);
Ejemplo n.º 44
0
        private static string GetIniFilePath(ConfigData.ExternalPlayer currentConfiguration)
        {
            string directory = Path.GetDirectoryName(currentConfiguration.Command);

            string path = Path.Combine(directory, "mpc-hc.ini");

            if (File.Exists(path))
            {
                return path;
            }

            path = Path.Combine(directory, "mpc-hc64.ini");

            if (File.Exists(path))
            {
                return path;
            }

            return string.Empty;
        }
Ejemplo n.º 45
0
 private Config(string filename, ConfigData data)
 {
     mFilename   = filename;
     mConfigData = data;
 }