SetPath() 개인적인 메소드

private SetPath ( string aPath ) : void
aPath string
리턴 void
예제 #1
0
        public static Configuration Load()
        {
            XmlSerializer xml = new XmlSerializer(typeof(Configuration));

            string common = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
            string folder = Path.Combine(common, "ohSongcast");

            if (!Directory.Exists(folder))
            {
                Directory.CreateDirectory(folder);
            }

            string path = Path.Combine(folder, "Configuration.xml");

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

            try
            {
                using (TextReader reader = new StreamReader(path))
                {
                    Configuration configuration = (Configuration)xml.Deserialize(reader);
                    configuration.SetPath(path);
                    return(configuration);
                }
            }
            catch (Exception)
            {
                return(New(path));
            }
        }
예제 #2
0
        private static Configuration New(string aPath)
        {
            Configuration configuration = new Configuration();

            configuration.Subnet    = 0;
            configuration.Multicast = false;
            configuration.Channel   = (uint)(new Random().Next(65535) + 1);
            configuration.Ttl       = 1;
            configuration.Latency   = 100;
            configuration.Preset    = 0;
            configuration.SetPath(aPath);
            configuration.Save();
            return(configuration);
        }
예제 #3
0
 private static Configuration New(string aPath)
 {
     Configuration configuration = new Configuration();
     configuration.Subnet = 0;
     configuration.Multicast = false;
     configuration.Channel = (uint)(new Random().Next(65535) + 1);
     configuration.Ttl = 1;
     configuration.Latency = 100;
     configuration.Preset = 0;
     configuration.SetPath(aPath);
     configuration.Save();
     return (configuration);
 }