コード例 #1
0
        /// <summary>Reads a user data file. (Standalone Application)</summary>
        public static void ReadFile_Standalone(string filePath, ReadFileCallback callback)
        {
            Debug.Assert(!string.IsNullOrEmpty(filePath));
            Debug.Assert(callback != null);

            byte[] data = null;
            data = IOUtilities.LoadBinaryFile(filePath);
            callback.Invoke(true, data);
        }
コード例 #2
0
        /// <summary>Function for reading a user-specific file.</summary>
        public static void ReadFile(string filePathRelative, ReadFileCallback callback)
        {
            Debug.Assert(UserDataStorage.isInitialized);
            Debug.Assert(!string.IsNullOrEmpty(filePathRelative));

            string filePath = IOUtilities.CombinePath(UserDataStorage.activeUserDirectory, filePathRelative);

            UserDataStorage.PLATFORM.ReadFile(filePath, callback);
        }
コード例 #3
0
        // --- File I/O ---
        /// <summary>Reads a file.</summary>
        public void ReadFile(string relativePath, ReadFileCallback callback)
        {
            Debug.Assert(!string.IsNullOrEmpty(relativePath));
            Debug.Assert(callback != null);

            string path = IOUtilities.CombinePath(this.userDir, relativePath);

            byte[] data;
            bool   success = this.ReadFile(path, out data);

            callback.Invoke(relativePath, success, data);
        }
コード例 #4
0
        /// <summary>Loads the user data file. (Facepunch.Steamworks)</summary>
        public static void ReadFile_Facepunch(string filePath, ReadFileCallback callback)
        {
            Debug.Assert(!string.IsNullOrEmpty(filePath));
            Debug.Assert(callback != null);

            byte[] data = null;
            if (Steamworks.SteamRemoteStorage.FileExists(filePath))
            {
                data = Steamworks.SteamRemoteStorage.FileRead(filePath);
            }

            callback.Invoke(true, data);
        }
コード例 #5
0
        // --- File I/O ---
        /// <summary>Reads a file.</summary>
        public void ReadFile(string relativePath, ReadFileCallback callback)
        {
            Debug.Assert(!string.IsNullOrEmpty(relativePath));
            Debug.Assert(callback != null);

            string path = IOUtilities.CombinePath(this.userDir, relativePath);

            byte[] data = null;
            if (Steamworks.SteamRemoteStorage.FileExists(path))
            {
                data = Steamworks.SteamRemoteStorage.FileRead(path);
            }

            callback.Invoke(relativePath, (data != null), data);
        }
コード例 #6
0
        /// <summary>Reads a user data file. (Steamworks.NET)</summary>
        public static void ReadFile_SteamworksNET(string filePath, ReadFileCallback callback)
        {
            Debug.Assert(!string.IsNullOrEmpty(filePath));
            Debug.Assert(callback != null);

            byte[] data = null;
            if (Steamworks.SteamRemoteStorage.FileExists(filePath))
            {
                int fileSize = Steamworks.SteamRemoteStorage.GetFileSize(filePath);

                if (fileSize > 0)
                {
                    data = new byte[fileSize];
                    Steamworks.SteamRemoteStorage.FileRead(filePath, data, fileSize);
                }
            }

            callback.Invoke(true, data);
        }
コード例 #7
0
        // --- File I/O ---
        /// <summary>Reads a file.</summary>
        public void ReadFile(string relativePath, ReadFileCallback callback)
        {
            Debug.Assert(!string.IsNullOrEmpty(relativePath));
            Debug.Assert(callback != null);

            string path = IOUtilities.CombinePath(this.UserDirectory, relativePath);

            byte[] data = null;
            if (Steamworks.SteamRemoteStorage.FileExists(path))
            {
                int fileSize = Steamworks.SteamRemoteStorage.GetFileSize(path);

                if (fileSize > 0)
                {
                    data = new byte[fileSize];
                    Steamworks.SteamRemoteStorage.FileRead(path, data, fileSize);
                }
            }

            callback.Invoke(relativePath, (data != null), data);
        }
コード例 #8
0
ファイル: virilib.cs プロジェクト: dbensonviri/virilay
    /// <summary>
    /// Virilib.ReadFile((word) =>
    ///            {
    ///                foreach (string x in word) Console.Write(x+" ");
    ///            }
    ///           , "config.txt");
    /// </summary>
    /// <param name="rfc"></param>
    /// <param name="file"></param>
    public static bool ReadFile(string file, ReadFileCallback rfc)
    {
        if (!File.Exists(file))
        {
            return(false);
        }
        string Line = "";

        char[] sep = new char[] { ' ', '=', '\t' };

        //sep[0] = ','; sep[1] = '='; sep[2] = ';'; sep[3] = ' '; sep[4] = '{'; sep[5] = '}'; sep[6] = ':';
        //sep.Concat(Environment.NewLine.ToCharArray());
        using (StreamReader Reader = new StreamReader(file))
        {
            Line = "A";
            while (Line != null)
            {
                Line = Reader.ReadLine();
                if (Line != null)
                {
                    if (Line != "")
                    {
                        if (Line[0] != '#')
                        {
                            List <string> something = Line.Split(sep, StringSplitOptions.RemoveEmptyEntries).ToList();
                            if (something[something.Count - 1] == "")
                            {
                                something.RemoveAt(something.Count - 1);
                            }
                            rfc(something);
                        }
                    }
                }
            }

            Reader.Close();
            return(true);
        }
    }
コード例 #9
0
ファイル: AdvDLSolcLib.cs プロジェクト: karlptrck/SolcNet
 public string CompileLegacyJson(string input, bool optimize, ReadFileCallback readCallback)
 {
     return(_native.compileJSONCallback(input, optimize, new AvdDLReadFileCallback(readCallback)));
 }
コード例 #10
0
 public string CompileLegacyJson(string input, bool optimize, ReadFileCallback readCallback)
 {
     return(_compileJsonCallback.Value(input, optimize, new NativeReadFileCallback(readCallback)));
 }
コード例 #11
0
 public string Compile(string input, ReadFileCallback readCallback)
 {
     return(_compileStandard.Value(input, new NativeReadFileCallback(readCallback)));
 }
コード例 #12
0
ファイル: Proxy.cs プロジェクト: angelinai/nethermind
 public static extern string compileStandard(string _input, ReadFileCallback _readCallback);
コード例 #13
0
 public static extern void wkeOnReadFile(ReadFileCallback _callback);
コード例 #14
0
ファイル: AdvDLSolcLib.cs プロジェクト: karlptrck/SolcNet
 public string Compile(string input, ReadFileCallback readCallback)
 {
     return(_native.compileStandard(input, new AvdDLReadFileCallback(readCallback)));
 }
コード例 #15
0
ファイル: DataStorage.cs プロジェクト: rootlawz/EduDemo
 // ------ File I/O ------
 /// <summary>Reads a file.</summary>
 public static void ReadFile(string path, ReadFileCallback onComplete)
 {
     DataStorage.PLATFORM_IO.ReadFile(path, onComplete);
 }
コード例 #16
0
 public SourceFileResolver(string solSourceRoot, Dictionary <string, string> fileContents)
 {
     _solSourceRoot   = solSourceRoot;
     _fileContents    = fileContents ?? new Dictionary <string, string>();
     ReadFileDelegate = ReadSolSourceFileManaged;
 }
コード例 #17
0
ファイル: Proxy.cs プロジェクト: angelinai/nethermind
 public static extern string compileJSONCallback(string _input, bool _optimize, ReadFileCallback _readCallback);
コード例 #18
0
ファイル: Proxy.cs プロジェクト: angelinai/nethermind
 static Proxy()
 {
     IsWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
     Callback  = CallBack;
 }
コード例 #19
0
 // ---------[ I/O Interface ]---------
 /// <summary>Function for reading a user-specific file.</summary>
 public static void ReadFile(string relativePath, ReadFileCallback callback)
 {
     UserDataStorage.PLATFORM_IO.ReadFile(relativePath, callback);
 }
コード例 #20
0
 static extern int assetbundle_merge(ReadFileCallback callback, IntPtr userdata, string fromAssetbundle, string toAssetbundle, string diff);
コード例 #21
0
 static extern int assetbundle_merge(ReadFileCallback callback, IntPtr userdata, string fromAssetbundle, string toAssetbundle, string diff);
コード例 #22
0
ファイル: Proxy.cs プロジェクト: vkerrysingh/nethermind
 static Proxy()
 {
     Platform = GetPlatform();
     Callback = CallBack;
 }