Ejemplo n.º 1
0
 public void Save()
 {
     if (iniFile != null)
     {
         iniFile.WriteString("Settings", "Logo", logoFile);
         iniFile.WriteString("Settings", "Description", description);
         iniFile.Save();
     }
 }
Ejemplo n.º 2
0
 public override void SaveConfiguration(MemIniFile ini)
 {
     if (!IsVirtual)
     {
         base.SaveConfiguration(ini);
         if (!string.IsNullOrEmpty(TargetDescription))
         {
             ini.WriteString(this.StoneID, "Description", TargetDescription);
         }
         if (!string.IsNullOrEmpty(CustomIcon))
         {
             ini.WriteString(this.StoneID, "CustomIcon", FileOperations.UnExpandPath(CustomIcon));
         }
     }
 }
Ejemplo n.º 3
0
        private void LoadFirst()
        {
            // Проверка авторизации
            Properties.Settings settings = Properties.Settings.Default;
            Registered = Data.Authorization(settings.CopyOwner, settings.CopyKey);
            Bonus      = !Registered;

            string configfilename = Application.StartupPath + "\\config.ini";

            if (File.Exists(configfilename))
            {
                MemIniFile mif     = new MemIniFile(configfilename);
                string     section = "Application";
                mif.WriteInteger(section, "Station", Properties.Settings.Default.Station);
                mif.WriteString(section, "StartupPath", Application.StartupPath);
                mif.WriteBool(section, "Registered", Registered);
                mif.WriteBool(section, "Bonus", Bonus);
                string[] channels = Properties.Settings.Default.Channels.Split('\t');

                // Загрузка плагина точек KR500
                PointPlugin.LoadPlugin(Application.StartupPath + "\\Points.KR500.dll");

                FetchKR500Functions.StartFetch(
                    new Tuple <int, string[], string, exitApp, int>(
                        Properties.Settings.Default.Station,
                        channels, mif.ToString(), closeServer,
                        Properties.Settings.Default.TimeOut));
            }
        }
Ejemplo n.º 4
0
 public override void SaveConfiguration(MemIniFile ini)
 {
     if (!IsVirtual)
     {
         base.SaveConfiguration(ini);
         if (!string.IsNullOrEmpty(TargetName))
         {
             ini.WriteString(this.StoneID, "Target", TargetName);
         }
         if (!string.IsNullOrEmpty(TargetParameters))
         {
             ini.WriteString(this.StoneID, "Parameters", TargetParameters);
         }
         if (!string.IsNullOrEmpty(ArgumentDescription))
         {
             ini.WriteString(this.StoneID, "Argument", ArgumentDescription);
         }
     }
 }
Ejemplo n.º 5
0
 public override void SaveConfiguration(MemIniFile ini)
 {
     if (!IsVirtual)
     {
         base.SaveConfiguration(ini);
         if (!string.IsNullOrEmpty(TargetName))
         {
             ini.WriteString(this.StoneID, "Target", TargetName);
         }
     }
 }
Ejemplo n.º 6
0
 public void Save()
 {
     if (iniFile == null)
     {
         iniFile = new MemIniFile(FileName);
         try
         {
             iniFile.Load();
             iniFile.WriteString("Settings", "Description", Description);
             iniFile.WriteString("Settings", "Logo", logoFile);
             iniFile.Save();
         }
         finally
         {
             iniFile.Dispose();
         }
     }
     else
     {
         iniFile.WriteString("Settings", "Description", Description);
         iniFile.WriteString("Settings", "Logo", logoFile);
         iniFile.Save();
     }
 }
Ejemplo n.º 7
0
        private void saveCustomReportProps()
        {
            //Data.SetReportProps(printReport.ReportName, printReport.PrintAuto,
            //    printReport.PrintTime, printReport.PrintPeriod);
            MemIniFile mif = new MemIniFile(String.Empty);

            mif.FromString(Properties.Settings.Default.ReportsConfig);
            mif.WriteString(internalname, "ReportName", printReport.ReportName);
            mif.WriteBool(internalname, "PrintAuto", printReport.PrintAuto);
            mif.WriteDate(internalname, "PrintTime", printReport.PrintTime);
            mif.WriteInteger(internalname, "PrintPeriod", printReport.PrintPeriod);
            //mif.UpdateFile();
            Properties.Settings settings = Properties.Settings.Default;
            settings.ReportsConfig = mif.ToString();
            settings.Save();
        }
Ejemplo n.º 8
0
        private static void SaveSettings()
        {
            MemIniFile mif     = new MemIniFile(Application.StartupPath + "\\config.ini");
            string     section = "ServerSQL";

            mif.WriteString(section, "Host", Settings.Host);
            mif.WriteString(section, "Port", Settings.Port);
            mif.WriteString(section, "User", Settings.User);
            mif.WriteString(section, "Password", Settings.Password);
            mif.WriteString(section, "Fetchbase", Settings.Fetchbase);
            mif.WriteString(section, "Database", Settings.Database);
            mif.UpdateFile();
        }
Ejemplo n.º 9
0
 public virtual void SaveConfiguration(MemIniFile ini)
 {
     if (!IsVirtual)
     {
         try
         {
             ini.WriteInteger(this.stoneID, "RunCount", RunCount);
             ini.WriteInteger(this.stoneID, "Rating", Rating);
             ini.WriteInteger(this.stoneID, "RunLevel", RunLevel);
             if (!string.IsNullOrEmpty(translationId))
             {
                 ini.WriteString(this.stoneID, "TranslationId", translationId);
             }
         }
         catch (Exception ex)
         {
             throw new StoneSettingsException(SR.WriteSettingsError, ex);
         }
     }
 }
Ejemplo n.º 10
0
        private void LoadFirst()
        {
            // Проверка авторизации
            Properties.Settings settings = Properties.Settings.Default;
            Registered = Data.Authorization(settings.CopyOwner, settings.CopyKey);
            Bonus      = !Registered;

            string configfilename = Application.StartupPath + "\\config.ini";

            if (File.Exists(configfilename))
            {
                MemIniFile mif     = new MemIniFile(configfilename);
                string     section = "Application";
                mif.WriteInteger(section, "Station", Properties.Settings.Default.Station);
                mif.WriteString(section, "StartupPath", Application.StartupPath);
                mif.WriteBool(section, "Registered", Registered);
                mif.WriteBool(section, "Bonus", Bonus);
                FetchVirtualFunctions.StartFetch(new Tuple <int, string, exitApp>(
                                                     Properties.Settings.Default.Station, mif.ToString(), closeServer));
            }
        }
Ejemplo n.º 11
0
        static void Main(string[] args)
        {
            string path     = System.Environment.CurrentDirectory + "\\";
            string filename = path + "base_afh2.txt";
            string ininame  = path + "base_afh2.ini";

            if (File.Exists(filename))
            {
                MemIniFile mif = new MemIniFile(ininame);
                mif.Clear();
                string[] lines   = System.IO.File.ReadAllLines(filename);
                string[] headers = new string[0];
                bool     first   = true;
                foreach (string line in lines)
                {
                    if (first)
                    {
                        first   = false;
                        headers = line.Split(new char[] { '\t' });
                    }
                    else
                    {
                        string[] values = line.Split(new char[] { '\t' });
                        if (headers.Length >= values.Length)
                        {
                            string npp    = String.Empty;
                            string ngroup = String.Empty;
                            string ptname = String.Empty;
                            string ptdesc = String.Empty;
                            string pttype = String.Empty;
                            for (int i = 0; i < headers.Length; i++)
                            {
                                string header = headers[i];
                                string value  = (i < values.Length) ? values[i].Trim() : String.Empty;
                                switch (i)
                                {
                                case 0: npp = value; break;

                                case 1: ngroup = value; break;

                                case 2:
                                    ptname = value;
                                    mif.WriteString(ptname, header, value);
                                    mif.WriteString(ptname, "Plugin", "KR500");
                                    break;

                                case 3:
                                    ptdesc = value;
                                    mif.WriteString(ptname, header, value);
                                    break;

                                case 4:
                                    if (value.Length == 0)
                                    {
                                        value = "FA";
                                    }
                                    pttype = value;
                                    mif.WriteString(ptname, header, value);
                                    switch (value)
                                    {
                                    case "ND":
                                    case "SM":
                                        mif.WriteString(ptname, "PtKind", "0");
                                        break;

                                    case "AI":
                                    case "AO":
                                    case "CR":
                                    case "FA":
                                        mif.WriteString(ptname, "PtKind", "1");
                                        mif.WriteString(ptname, "Trend", "False");
                                        mif.WriteString(ptname, "Koeff", "1");
                                        mif.WriteString(ptname, "Offset", "0");
                                        break;

                                    case "DI":
                                    case "DO":
                                        mif.WriteString(ptname, "PtKind", "2");
                                        mif.WriteString(ptname, "Trend", "False");
                                        break;

                                    case "GP":
                                    case "GO":
                                    case "GR":
                                    case "FD":
                                    case "VC":
                                        mif.WriteString(ptname, "PtKind", "3");
                                        break;
                                    }
                                    break;

                                default:
                                    if (value.Length > 0 && !header.Equals("Station") &&
                                        !header.Equals("TimeUnit"))
                                    {
                                        switch (header)
                                        {
                                        case "Opros":   header = "Actived"; break;

                                        case "Alarm":   header = "Logged";  break;

                                        case "Confirm": header = "Asked";   break;

                                        case "TimeBase": header = "FetchTime"; break;

                                        case "Controller": header = "Node"; break;

                                        case "Algoblock": header = "Block"; break;

                                        case "InOut": header = "Place"; break;

                                        case "PVSource": header = "Source"; value = ""; break;

                                        case "PVFormat": header = "FormatPV"; break;

                                        case "PVEUHI": header = "PVEUHi"; break;

                                        case "PVEULO": header = "PVEULo"; break;
                                        }
                                        if (header.StartsWith("Link"))
                                        {
                                            header = "Child" + header.Substring(4);
                                        }
                                        switch (value)
                                        {
                                        case "D0": value = "0"; break;

                                        case "D1": value = "1"; break;

                                        case "D2": value = "2"; break;

                                        case "D3": value = "3"; break;

                                        case "Нет": value = "False"; break;

                                        case "Да": value = "True"; break;
                                        }
                                        mif.WriteString(ptname, header, value);
                                        switch (header)
                                        {
                                        case "Source":
                                            mif.WriteString(ptname, "Parent", "");
                                            break;

                                        case "PVEUHi":
                                            mif.WriteString(ptname, "PVSUHi", value);
                                            break;

                                        case "PVEULo":
                                            mif.WriteString(ptname, "PVSULo", value);
                                            break;
                                        }
                                    }
                                    break;
                                }
                            }
                        }
                    }
                }
                mif.UpdateFile();
            }
        }