Esempio n. 1
0
        public static void Initialize(int appID)
        {
            FindResult       = new APICallCallback <LeaderboardFindResult_t>();
            ScoresDownloaded = new APICallCallback <LeaderboardScoresDownloaded_t>();
            ScoreUploaded    = new APICallCallback <LeaderboardScoreUploaded_t>();

            Environment.SetEnvironmentVariable("SteamAppId", appID.ToString());

            SteamContext.Initialize(false);

            DebugLog.AppendText("Getting ISteam interface: ISteamFriends008...");

            Friends = SteamContext.SteamClient.GetISteamFriends <ISteamFriends008>(
                SteamContext.HSteamPipe,
                SteamContext.HSteamUser
                );

            DebugLog.AppendText(string.Format("ISteamFriends008 = 0x{0:8x}", Friends));

            DebugLog.AppendText("Getting ISteam interface: ISteamUserStats007...");

            UserStats = SteamContext.SteamClient.GetISteamUserStats <ISteamUserStats007>(
                SteamContext.HSteamUser,
                SteamContext.HSteamPipe
                );

            DebugLog.AppendText(string.Format("ISteamUserStats007 = 0x{0:8X}{1}", UserStats, Environment.NewLine));
        }
Esempio n. 2
0
        void EditFile(string fileName)
        {
            DebugLog.AppendText("Cloud - Reading File...");

            byte[] data = Cloud.ReadFile(fileName);

            if (data == null || data.Length == 0)
            {
                DebugLog.AppendText("Failed!{0}", Environment.NewLine);
                return;
            }

            DebugLog.AppendText("Done!{0}", Environment.NewLine);

            EditForm ef = new EditForm(fileName, data);

            if (ef.ShowDlg(this) == EditForm.EditResult.SaveChanges)
            {
                DebugLog.AppendText("Cloud - Saving Changes...");

                byte[] editData = ef.GetData();

                if (!Cloud.WriteFile(fileName, editData))
                {
                    DebugLog.AppendText("Failed!{0}", Environment.NewLine);
                    return;
                }

                DebugLog.AppendText("Done!{0}", Environment.NewLine);

                RefreshFiles();
            }
        }
Esempio n. 3
0
        void RefreshQuota()
        {
            DebugLog.AppendText("Cloud - Refreshing Quota...");

            int total;
            int avail;

            string strTotal = "Unknown";
            string strAvail = "Unknown";
            string strUsed  = "Unknown";

            if (Cloud.GetQuota(out total, out avail))
            {
                strTotal = Util.BytesToKB(total).ToString();
                strAvail = Util.BytesToKB(avail).ToString();

                strUsed = Util.BytesToKB(total - avail).ToString();
            }

            quotaAvailLabel.Text = string.Format("{0} KB Available", strAvail);
            quotaTotalLabel.Text = string.Format("{0} KB Total", strTotal);

            quotaUsedLabel.Text = string.Format("{0} KB Used", strUsed);

            DebugLog.AppendText("Done!{0}", Environment.NewLine);
        }
Esempio n. 4
0
        public static bool WriteFile(string fileName, byte[] data)
        {
            bool bRet = CloudContext.RemoteStorage.FileWrite(fileName, data);

            DebugLog.AppendText("ISteamRemoteStorage::FileWrite( \"{0}\", {1} ) = {2}", fileName, data.Length, bRet);

            return(bRet);
        }
Esempio n. 5
0
        public static bool DeleteFile(string fileName)
        {
            bool bRet = CloudContext.RemoteStorageOld.FileDelete(fileName);

            DebugLog.AppendText("ISteamRemoteStorage::FileDelete( \"{0}\" ) = {1}", fileName, bRet);

            return(bRet);
        }
Esempio n. 6
0
        public static void Initialize(int appId)
        {
            Environment.SetEnvironmentVariable("SteamAppId", appId.ToString());

            SteamContext.Initialize(false);

            DebugLog.AppendText("Getting ISteam interface: ISteamScreenshots001...");
            Screenshots = SteamContext.SteamClient.GetISteamGenericInterface <ISteamScreenshots001>(
                SteamContext.HSteamUser,
                SteamContext.HSteamPipe
                );
            DebugLog.AppendText("ISteamScreenshots001 = 0x{0:8x}", Screenshots.Interface);
        }
Esempio n. 7
0
        public static byte[] ReadFile(string fileName)
        {
            int fileSize = CloudContext.RemoteStorage.GetFileSize(fileName);

            DebugLog.AppendText("ISteamRemoteStorage::GetFileSize( \"{0}\" ) = {1}", fileName, fileSize);

            byte[] data = new byte[fileSize];

            int iRet = CloudContext.RemoteStorage.FileRead(fileName, data);

            DebugLog.AppendText("ISteamRemoteStorage::FileRead( \"{0}\", {1} ) = {2}", fileName, fileSize, iRet);

            return(data);
        }
Esempio n. 8
0
        void ReplaceFile(string fileName)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.CheckFileExists = true;
            ofd.CheckPathExists = true;
            ofd.DefaultExt      = Path.GetExtension(fileName);
            ofd.Filter          = string.Format("{0} Files (*.{0})|*.{0}|All Files (*.*)|*.*", ofd.DefaultExt);
            ofd.Multiselect     = false;
            ofd.SupportMultiDottedExtensions = true;
            ofd.Title         = string.Format("Replace \"{0}\"...", fileName);
            ofd.ValidateNames = true;

            if (ofd.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            byte[] data = null;

            DebugLog.AppendText("Reading Local File...");

            try
            {
                data = File.ReadAllBytes(ofd.FileName);
            }
            catch (Exception ex)
            {
                DebugLog.AppendText("Failed: {1}{0}", ex.Message, Environment.NewLine);
                return;
            }

            DebugLog.AppendText("Done!{0}", Environment.NewLine);


            DebugLog.AppendText("Cloud - Writing File...");

            if (!Cloud.WriteFile(fileName, data))
            {
                DebugLog.AppendText("Failed!{0}", Environment.NewLine);
                return;
            }

            DebugLog.AppendText("Done!{0}", Environment.NewLine);

            RefreshFiles();
        }
Esempio n. 9
0
        void RefreshFiles()
        {
            DebugLog.AppendText("Cloud - Refreshing Files...");

            fileList.Items.Clear();

            foreach (var fileInfo in Cloud.GetFiles())
            {
                FileListViewItem lvi = new FileListViewItem(fileInfo.FileName, fileInfo.Size);

                fileList.Items.Add(lvi);
            }

            DebugLog.AppendText("Done!{0}", Environment.NewLine);

            RefreshQuota();
        }
Esempio n. 10
0
        public static bool GetQuota(out int total, out int avail)
        {
            total = 0;
            avail = 0;

            bool bRet = CloudContext.RemoteStorage.GetQuota(ref total, ref avail);

            if (bRet)
            {
                DebugLog.AppendText("ISteamRemoteStorage::GetQuota() = {0}, {1}", total, avail);
            }
            else
            {
                DebugLog.AppendText("ISteamRemoteStorage::GetQuota() Failed!");
            }

            return(bRet);
        }
Esempio n. 11
0
        void SaveFile(string fileName)
        {
            SaveFileDialog sfd = new SaveFileDialog();

            sfd.CheckPathExists = true;
            sfd.DefaultExt      = Path.GetExtension(fileName);
            sfd.OverwritePrompt = true;
            sfd.SupportMultiDottedExtensions = true;
            sfd.FileName      = Path.GetFileName(fileName);
            sfd.Filter        = string.Format("{0} Files (*.{0})|*.{0}|All Files (*.*)|*.*", sfd.DefaultExt);
            sfd.Title         = string.Format("Save \"{0}\"...", fileName);
            sfd.ValidateNames = true;

            if (sfd.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            DebugLog.AppendText("Cloud - Reading File...");

            byte[] data = Cloud.ReadFile(fileName);

            if (data == null || data.Length == 0)
            {
                DebugLog.AppendText("Failed!{0}", Environment.NewLine);
                return;
            }

            DebugLog.AppendText("Done!{0}", Environment.NewLine);

            DebugLog.AppendText("Writing Local File...");
            try
            {
                File.WriteAllBytes(sfd.FileName, data);
            }
            catch (Exception ex)
            {
                DebugLog.AppendText("Failed: {1}{0}", ex.Message, Environment.NewLine);
                return;
            }

            DebugLog.AppendText("Done!{0}", Environment.NewLine);
        }
Esempio n. 12
0
        public static FileInfo[] GetFiles()
        {
            int fileCount = CloudContext.RemoteStorage.GetFileCount();

            DebugLog.AppendText("ISteamRemoteStorage::GetFileCount() = {0}", fileCount);

            FileInfo[] files = new FileInfo[fileCount];

            for (int x = 0; x < fileCount; ++x)
            {
                int    fileSize = 0;
                string fileName = CloudContext.RemoteStorage.GetFileNameAndSize(x, ref fileSize);

                DebugLog.AppendText("ISteamRemoteStorage::GetFileNameAndSize( {0} ) = \"{1}\", {2}", x, fileName, fileSize);

                files[x].FileName = fileName;
                files[x].Size     = fileSize;
            }

            return(files);
        }
Esempio n. 13
0
        public static void Initialize()
        {
            SteamContext.Initialize(false);


            DebugLog.AppendText("Getting ISteam interface: ISteamRemoteStorage002...");

            RemoteStorage = SteamContext.SteamClient.GetISteamRemoteStorage <ISteamRemoteStorage002>(
                SteamContext.HSteamUser,
                SteamContext.HSteamPipe
                );

            DebugLog.AppendText(string.Format("ISteamRemoteStorage002 = 0x{0:8X}", RemoteStorage.Interface));


            DebugLog.AppendText("Getting ISteam interface: ISteamRemoteStorage001...");

            RemoteStorageOld = SteamContext.SteamClient.GetISteamRemoteStorage <ISteamRemoteStorage001>(
                SteamContext.HSteamUser,
                SteamContext.HSteamPipe
                );

            DebugLog.AppendText(string.Format("ISteamRemoteStorage001 = 0x{0:8X}{1}", RemoteStorageOld.Interface, Environment.NewLine));
        }
Esempio n. 14
0
 //
 //  Writes to Log textbox at the bottom of program
 //
 private void Log(string message)
 {
     DebugLog.AppendText(message + "\r\n");
 }