Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Cyril Baskir
  Where is Cyril Baskir?
 
 Australia
 Cyril Baskir
 Tags
Subject: C# program: change date in settings file
Thread ID: 395805 Message ID: 395805 # Views: 50 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: General VFP Topics
Date: Monday, January 20, 2014 6:18:15 AM         
   


I have an exe program written in C# (with source code). It stores some defaults (e.g. dates) in a settings file xrep.xst. I want to change the dates in this file using FoxPro.

The author doesn't know FoxPro, but when I asked him how to do it he said:

You can open file
XeroValueObject.cs

You can define in your program as
XeroValueObject.cs
file.

Does anyone know what this means in FoxPro?

I opened the file he mentioned in notepad. This is what it contains (FromDate and ToDate are at the end):


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace XeroApi.SystemOne
{
    [Serializable()]
    public class XeroValueObject
    {
        public string UserAgent { get; private set; }
        public string ConsumerKey { get; set; }
        public string ConsumerSecret { get; set; }
        public string OutputFolder { get; set; }
        public string Delimeter { get; set; }
        public DateTime FromDate { get; set; }
        public DateTime ToDate { get; set; }
    }
}





He has a settings button on his form, where I can change the dates. But I want to prefill the dates from VFP.
Looking thru the code, this is where he saves the settings:


      private void SaveSettings(XeroValueObject xvo, string strFilename)
        {
            if (xvo == null) return;
            try
            {
                Stream s = File.Open(strFilename, FileMode.OpenOrCreate);
                BinaryFormatter b = new BinaryFormatter();
                b.Serialize(s, xvo);
                s.Close();
                MessageBox.Show("The Setting file has been saved successfully.", "Message");
            }
            catch (Exception)
            {
                MessageBox.Show("Error in saving File.", "Error");
            }
        }



I dont know C#, but there are clever people here who do :)

Can you give me some ideas as to how I can write my own dates to the settings file (or at least tell me what questions to ask)?

BTW the settings file xrep.xst, when opened in notepad, is a binary file of some kind (I guess that's what the Serialize does).
I can recognize some of the words in the file, but the dates are not in readable format.


Cyril

ENTIRE THREAD

C# program: change date in settings file Posted by Cyril Baskir @ 1/20/2014 6:18:15 AM
RE: C# program: change date in settings file Posted by David Mustakim @ 1/20/2014 7:33:47 AM
RE: C# program: change date in settings file Posted by Stefan Wuebbe @ 1/20/2014 11:09:49 AM
RE: C# program: change date in settings file Posted by Pete Sass @ 1/20/2014 7:36:05 PM
RE: C# program: change date in settings file Posted by Cyril Baskir @ 1/20/2014 11:05:57 PM
RE: C# program: change date in settings file Posted by Tom Saddul @ 1/21/2014 5:18:28 AM