Beispiel #1
0
    //use this to set up a new class of data

    /*the structure is
     * classInstance= (class type)SetUpAndLoadDataFile<class type>(
     *        class.fileName,
     *        class.fileHash,
     *        classInstance);
     */

    //you would call this function in another class before useing the file
    public static object SetUpAndLoadDataFile <DataType>(string fileName, string filehash, object dataInput)
    {
        string Path = DataManaginigMethods.createFilePathname(fileName);

        if (File.Exists(Path))
        {
            DataType Data = (DataType)
                            loadData <DataType>(Path, filehash);

            return(Data);
        }
        else
        {
            DataManaginigMethods.SaveSomeData(dataInput, fileName, filehash);

            DataType Data = (DataType)
                            loadData <DataType>(Path, filehash);

            return(Data);
        }
    }
Beispiel #2
0
 public static void saveData()
 {
     DataManaginigMethods.SaveSomeData(m_myclass, "filename", "hash");
 }
Beispiel #3
0
 // public static MyClass m_myclass = new MyClass();
 public static void LoadTheData()
 {
     m_my_class = (MyClass)DataManaginigMethods.SetUpAndLoadDataFile <MyClass>("filename", "hash", m_myclass);
 }