Пример #1
0
 private bool RunArchiveOnModFolder(string sourceFolder, string bigFilename)
 {
     ArchiveCommands = new List <ArchiveCommandStruct>();
     if (CArchive.CreateBuildFile(CConfig.ModType, ref ArchiveCommands, TempFolder, sourceFolder, bigFilename))
     {
         if (ArchiveCommands.Count > 0)
         {
             bProcesOutputDone = false;
             archive_index     = 0;
             RunArchiveForArchiveIndex();
             return(true);
         }
     }
     else
     {
         workshopTextBox1.PrintLine(string.Format("  {0}", CArchive.ArchiveErrorMessage));
     }
     return(false);
 }
Пример #2
0
 private void PublishedItems(EResult Result)
 {
     if (Result == EResult.k_EResultOK)
     {
         if (CSteamInterface.publishedWorkshopItems == null || CSteamInterface.publishedWorkshopItems.Length == 0)
         {
             workshopTextBox1.PrintLine("  You don't have any items published to the Steam Workshop.");
         }
         else
         {
             bool bUpdateFoundWorkshopId = false;
             for (int index = 0; index < CSteamInterface.publishedWorkshopItems.Length; index++)
             {
                 SteamUGCDetails_t item = CSteamInterface.publishedWorkshopItems[index];
                 if (bIsExecutingUpdateCommand)
                 {
                     if ((ulong)item.m_nPublishedFileId == CConfig.workshopId)
                     {
                         bUpdateFoundWorkshopId = true;
                         updateItemFileId       = item.m_nPublishedFileId;
                         workshopTextBox1.PrintNewLine();
                         workshopTextBox1.PrintLine(string.Format("Updating Workshop item number: '{0}'", item.m_nPublishedFileId));
                         workshopTextBox1.PrintLine(string.Format("Title: {0}", CConfig.title));
                         TempFolder = CArchive.CreateArchiveTempFolder();
                         CConfig.CopyConfigFilesToFolder(TempFolder);
                         workshopTextBox1.PrintNewLine();
                         workshopTextBox1.PrintLine(string.Format("Running Archive.exe on MOD folder..."));
                         if (RunArchiveOnModFolder(MODFolder, CConfig.bigfilename))
                         {
                             return;
                         }
                         workshopTextBox1.PrintLine("  There was a problem creating the .big file(s) for your mod.  You may need to set the WorkshopTool to 'Run this program as an Administrator'");
                     }
                 }
                 else
                 {
                     workshopTextBox1.PrintLine(string.Format("  Item # {0}", index + 1));
                     if (item.m_eResult == EResult.k_EResultOK)
                     {
                         workshopTextBox1.PrintLine(string.Format("    Title = {0}", item.m_rgchTitle));
                         workshopTextBox1.PrintLine(string.Format("    Tags = {0}", item.m_rgchTags));
                         workshopTextBox1.PrintLine(string.Format("    Visibility = {0}", VisibilityTypes[(int)item.m_eVisibility]));
                         workshopTextBox1.PrintLine(string.Format("    Banned = {0}", item.m_bBanned ? "True" : "False"));
                         workshopTextBox1.PrintLine(string.Format("    Published Workshop Id = {0}", item.m_nPublishedFileId.m_PublishedFileId));
                         workshopTextBox1.PrintLine(string.Format("    Upvotes / Downvotes = {0} / {1}", item.m_unVotesUp, item.m_unVotesDown));
                     }
                     else
                     {
                         workshopTextBox1.PrintLine("    This item is in an invalid state.  You might want to delete it then create it again.");
                     }
                 }
             }
             if (!bUpdateFoundWorkshopId && bIsExecutingUpdateCommand)
             {
                 workshopTextBox1.PrintNewLine();
                 workshopTextBox1.PrintLine(string.Format("Could not find Workshop item number '{0}' from your MOD folder's config.txt file in list of published items.  Make sure that you have not modified the WorkshopID number in the config.txt file.", CConfig.workshopId));
                 workshopTextBox1.PrintLine(string.Format("Use the 'list' command to get a list of items that you have published to the Steam Workshop and make sure that the WorkshopID number in your config.txt file matches one of those items."));
                 workshopTextBox1.PrintNewLine();
                 workshopTextBox1.PrintLine(string.Format("You may have to delete your item on the Steam Workshop web page and create it again (or manually fix the WorkshopID number in the config.txt file)."));
                 workshopTextBox1.PrintNewLine();
             }
         }
     }
     else
     {
         workshopTextBox1.PrintLine(string.Format("  Steam error getting published Workshop items: Error code = {0}", Result));
     }
     workshopTextBox1.PrintPrompt();
 }
Пример #3
0
        private void WorkshopTextBox_CommandEntered(object sender, EventArgs e)
        {
            Console.WriteLine("cmd = {0}", workshopTextBox1.Command);
            string command = workshopTextBox1.Command;

            string[] args = GetCommandArguments(command);
            bIsExecutingCreateCommand = false;
            bIsExecutingUpdateCommand = false;
            if (args != null && args.Length != 0)
            {
                switch (args[0].ToLower())
                {
                case "quit":
                case "exit":
                    Application.Exit();
                    return;

                case "help":
                    workshopTextBox1.PrintLine("help:");
                    workshopTextBox1.PrintLine("  Use 'quit' or 'exit' to exit WorkshopTool.");
                    workshopTextBox1.PrintLine("  Use 'list' to print out a list of Workshop items that you have uploaded to Workshop.");
                    workshopTextBox1.PrintLine("  Use 'create <foldername>' to create and upload a new Workshop item.");
                    workshopTextBox1.PrintLine("  Use 'update <foldername>' to update an existing Workshop item.");
                    break;

                case "list":
                    CSteamInterface.GetPublishedItems(accountId, Workshop_AppId, Game_AppId, PublishedItems);
                    return;

                case "create":
                    if (args.Length > 1)
                    {
                        MODFolder = args[1];
                        MODFolder = MODFolder.Trim();
                        MODFolder = MODFolder.TrimEnd('\\');
                        if (!CConfig.ValidateFolderContents(MODFolder))
                        {
                            workshopTextBox1.PrintLine(string.Format("  {0}", CConfig.ValidationErrorMessage));
                        }
                        else
                        {
                            workshopTextBox1.PrintNewLine();
                            workshopTextBox1.PrintLine(string.Format("Using the following settings from the config.txt file in MOD folder '{0}'", MODFolder));
                            workshopTextBox1.PrintLine(string.Format("  Title: {0}", CConfig.title));
                            workshopTextBox1.PrintLine(string.Format("  Tags: {0}", CConfig.tags));
                            workshopTextBox1.PrintLine(string.Format("  BigFilename: {0}.big", CConfig.bigfilename));
                            bIsExecutingCreateCommand = true;
                            TempFolder = CArchive.CreateArchiveTempFolder();
                            if (TempFolder != null)
                            {
                                if (bDontDeleteTempFiles)
                                {
                                    workshopTextBox1.PrintNewLine();
                                    workshopTextBox1.PrintLine(string.Format("TEMP folder is: '{0}'", TempFolder));
                                }
                                CConfig.CopyConfigFilesToFolder(TempFolder);
                                workshopTextBox1.PrintNewLine();
                                workshopTextBox1.PrintLine(string.Format("Running Archive.exe on MOD folder..."));
                                if (RunArchiveOnModFolder(MODFolder, CConfig.bigfilename))
                                {
                                    return;
                                }
                                workshopTextBox1.PrintLine("  There was a problem creating the .big file(s) for your mod.  You may need to set the WorkshopTool to 'Run this program as an Administrator'");
                            }
                            else
                            {
                                workshopTextBox1.PrintLine(string.Format("  {0}", CArchive.ArchiveErrorMessage));
                            }
                        }
                    }
                    else
                    {
                        workshopTextBox1.PrintLine("  Usage: 'create <foldername>' - You must provide the folder name that contains your MOD files.");
                    }
                    break;

                case "update":
                    if (args.Length > 1)
                    {
                        MODFolder = args[1];
                        MODFolder = MODFolder.Trim();
                        MODFolder = MODFolder.TrimEnd('\\');
                        if (!CConfig.ValidateFolderContents(MODFolder))
                        {
                            workshopTextBox1.PrintLine(string.Format("  {0}", CConfig.ValidationErrorMessage));
                        }
                        else
                        {
                            if (CConfig.workshopId != 0)
                            {
                                bIsExecutingUpdateCommand = true;
                                workshopTextBox1.PrintNewLine();
                                workshopTextBox1.PrintLine("Retrieving list of published Workshop items...");
                                CSteamInterface.GetPublishedItems(accountId, Workshop_AppId, Game_AppId, PublishedItems);
                                return;
                            }
                            workshopTextBox1.PrintLine(string.Format("  The Workshop item in the folder '{0}' doesn't have a valid Steam Workshop ID number.  You need to use the 'create' command to create the Workshop item first before you can update it.", MODFolder));
                        }
                    }
                    else
                    {
                        workshopTextBox1.PrintLine("  Usage: 'update <foldername>' - You must provide the folder name that contains your MOD files.");
                    }
                    break;

                default:
                    workshopTextBox1.PrintLine(string.Format("  unknown command: {0}", command));
                    break;
                }
            }
            workshopTextBox1.PrintPrompt();
        }