Ejemplo n.º 1
0
        public static void Save()
        {
            foreach (var ds in ProtokollerConfiguration.ActualConfigInstance.Datasets)
            {
                foreach (var rw in ds.DatasetConfigRows)
                {
                    if (rw.PLCTag != null)
                    {
                        rw.PLCTag.ClearValue();
                    }
                }
            }

            string conf = SerializeToString <ProtokollerConfiguration> .Serialize(ProtokollerConfiguration.ActualConfigInstance);

            /*
             * RegistryKey regKey = Registry.LocalMachine;
             * regKey = regKey.CreateSubKey("SYSTEM\\CurrentControlSet\\services\\" + StaticServiceConfig.MyServiceName + "\\Parameters");
             * if (regKey != null)
             * {
             *  regKey.SetValue("XMLConfig", conf,RegistryValueKind.String);
             *  ProtokollerConfiguration.ActualConfigInstance.isDirty = false;
             * }
             * else
             *  MessageBox.Show("Error writing Config to the Registry, maybe you need to Login as Administrator?");
             */
            Directory.CreateDirectory(Path.GetDirectoryName(ConfigFileName()));
            StreamWriter sstrm = new StreamWriter(ConfigFileName(), false);

            sstrm.Write(conf);
            sstrm.Close();
        }
Ejemplo n.º 2
0
        public static void SaveToFile(string filename)
        {
            StreamWriter fstrm = new StreamWriter(filename, false);

            string conf = SerializeToString <ProtokollerConfiguration> .Serialize(ProtokollerConfiguration.ActualConfigInstance);

            fstrm.Write(conf);
            fstrm.Close();
        }
Ejemplo n.º 3
0
 public DatasetConfig Clone()
 {
     return(SerializeToString <DatasetConfig> .DeSerialize(SerializeToString <DatasetConfig> .Serialize(this)));
 }