Ejemplo n.º 1
0
 private void InitialShared()
 {
     SharedDir = System.Environment.CurrentDirectory + "\\YatooShare";
     DownedDir = System.Environment.CurrentDirectory + "\\YatooShare";
     SharedWay = DownloadWay.NeedNothing;
     DownPassword = "";
 }
Ejemplo n.º 2
0
        private void InitialMyConfig()
        {
            if (File.Exists("MyConfig.xml") == false)
            {
                if (Directory.Exists(System.Environment.CurrentDirectory + "\\YatooShare") == false)
                {
                    Directory.CreateDirectory(System.Environment.CurrentDirectory + "\\YatooShare");
                }
                return;
            }
            
            XmlDocument xmlDoc = new XmlDocument();

            xmlDoc.Load("MyConfig.xml");

            XmlNode xn = xmlDoc.SelectSingleNode("Config");

            XmlNodeList xnl = xn.ChildNodes;

            foreach (XmlNode xnf in xnl)
            {
                XmlElement xe = (XmlElement)xnf;

                //MessageBox.Show(xe.Name + ":" + xe.InnerText);

                switch (xe.Name)
                {
                    case "name":
                        Hoster.name = xe.InnerText;
                        break;
                    case"image":
                        Hoster.image = xe.InnerText;
                        break;
                    case "talk":
                        Hoster.talk = xe.InnerText;
                        break;
                    case "Fontfamily":
                        MyFont.Fontfamily = xe.InnerText;
                        break;
                    case "Fontsize":
                        MyFont.Fontsize = Int32.Parse(xe.InnerText);
                        break;
                    case "Fontstyle":
                        if (xe.InnerText == "True")
                        {
                            MyFont.Fontstyle = true;
                        }
                        else
                        {
                            MyFont.Fontstyle = false;
                        }
                        break;
                    case "Fontweight":
                        if (xe.InnerText == "True")
                        {
                            MyFont.Fontweight = true;
                        }
                        else
                        {
                            MyFont.Fontweight = false;
                        }
                        break;
                    case "Fontcolor":
                        MyFont.Fontcolor = xe.InnerText;
                        break;
                    case "BackgroundImage":
                        BackgroundImage = xe.InnerText;
                        break;
                    case "WinOpacity":
                        WinOpacity = Double.Parse(xe.InnerText);
                        break;
                    case "ForeOpacity":
                        ForeOpacity = Double.Parse(xe.InnerText);
                        break;
                    case "SharedDir":
                        SharedDir = xe.InnerText;
                        break;
                    case "DownedDir":
                        DownedDir = xe.InnerText;
                        break;
                    case "SharedWay":
                        if (xe.InnerText == "NeedNothing")
                        {
                            SharedWay = DownloadWay.NeedNothing;
                        }
                        else if (xe.InnerText == "NeedPassword")
                        {
                            SharedWay = DownloadWay.NeedPassword;
                        }
                        break;
                    case "DownPassword":
                        DownPassword = xe.InnerText;
                        break;
                }
            } 
        }