public void Clean(AuditTrailViewModel sender)
        {
            try
            {
                TStrings Lines = new TStrings();

                Lines.LoadFromFile(outputFile);

                while (Lines.Count > sender.MaxLines)
                {
                    Lines.Delete(0);
                }
                ;

                Lines.SaveToFile(outputFile, System.Text.Encoding.ASCII);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);

                if (Debugger.IsAttached)
                {
                    Debugger.Break();
                }
                ;
            };
        }
Beispiel #2
0
        private void saveChangesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            // TStrings File =

            if (File1Modified)
            {
                TStrings File = new TStrings();

                for (int i = 0; i < File1.Count; i++)
                {
                    if (File1.GetObject(i) != null)
                    {
                        File.Add(File1[i]);
                    }
                    ;
                }
                ;

                File.SaveToFile(FileName1, System.Text.Encoding.Unicode);
                File1Modified = false;
            }
            ;

            if (File2Modified)
            {
                TStrings File = new TStrings();

                for (int i = 0; i < File2.Count; i++)
                {
                    if (File2.GetObject(i) != null)
                    {
                        File.Add(File2[i]);
                    }
                    ;
                }
                ;

                File.SaveToFile(FileName2, System.Text.Encoding.Unicode);
                File2Modified = false;
            }
            ;
        }
    public bool Load()
    {
        {
            TIniFile IniFile = new TIniFile(IniFileName);
            FileName = IniFile.ReadString("General", "FileName", FileName);
            Glow     = IniFile.ReadBool("General", "Glow", Glow);
        };

        // - - -  - - -

        using (Stream stream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream(TemplatesFileName))
            using (StreamReader reader = new StreamReader(stream))
            {
                TStrings text = new TStrings();
                text.Text = reader.ReadToEnd();
                text.SaveToFile("Templates.ini");

                TIniFile IniFile = new TIniFile("Templates.ini");
#if PCL
                await IniFile.LoadValues();
#else
                IniFile.LoadValues();
#endif

                TStrings Sections = IniFile.ReadSections();

                Icons.Clear();

                for (int s = 0; s < Sections.Count; s++)
                {
                    if (Sections[s].StartsWith("#"))
                    {
                        TStrings l = IniFile.ReadSectionValues(Sections[s]);

                        for (int i = 0; i < l.Count; i++)
                        {
                            var o = new Icon();
                            o.Section = Sections[s].Substring(1);
                            o.Name    = l.Names(i);

                            string st = l.ValueFromIndex(i);
                            o.Width  = int.Parse(st.Split(new char[] { 'x', 'X' })[0]);
                            o.Height = int.Parse(st.Split(new char[] { 'x', 'X', ',' })[1]);

                            if (st.Split(new char[] { 'x', 'X', ',' }).Length > 2)
                            {
                                o.Scale = int.Parse(st.Split(new char[] { 'x', 'X', ',' })[2]);
                            }
                            ;

                            Application.Current.Dispatcher.Invoke(new Action(() =>
                            {
                                Icons.Add(o);
                            }));
                        }
                        ;
                    }
                    ;
                }
                ;

                OnPropertyChanged("Icons");
            };

        return(true);
    }