コード例 #1
0
        private List <NintendoSubmissionPackageExtraData> CreateExtraSource(List <Tuple <string, string> > iconList, List <Tuple <string, string> > nxIconList, uint maxNxIconSize)
        {
            Dictionary <string, Tuple <string, string> > mergedIconPathMap    = IconConverter.GetMergedIconPathMap(iconList, nxIconList);
            List <NintendoSubmissionPackageExtraData>    packageExtraDataList = new List <NintendoSubmissionPackageExtraData>();

            foreach (KeyValuePair <string, Tuple <string, string> > keyValuePair in mergedIconPathMap)
            {
                string key = keyValuePair.Key;
                Tuple <string, string> tuple1 = keyValuePair.Value;
                Tuple <byte[], byte[]> tuple2 = IconConverter.Convert(tuple1.Item1, tuple1.Item2, maxNxIconSize);
                packageExtraDataList.Add(new NintendoSubmissionPackageExtraData(string.Format("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.raw.{0}.jpg", (object)key), (ISource) new MemorySource(tuple2.Item1, 0, tuple2.Item1.Length)));
                packageExtraDataList.Add(new NintendoSubmissionPackageExtraData(string.Format("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.nx.{0}.jpg", (object)key), (ISource) new MemorySource(tuple2.Item2, 0, tuple2.Item2.Length)));
            }
            return(packageExtraDataList);
        }
コード例 #2
0
 public static void Generate(string metaPath, List <Tuple <string, string> > iconPathList, List <Tuple <string, string> > nxIconPathList, uint nxIconMaxSize, string outputDirectoryPath, bool cleanup = true)
 {
     if (Directory.Exists(outputDirectoryPath))
     {
         if (cleanup)
         {
             Directory.Delete(outputDirectoryPath, true);
             int num = 0;
             while (num < 3000 && Directory.Exists(outputDirectoryPath))
             {
                 Thread.Sleep(100);
                 num += 100;
             }
             Directory.CreateDirectory(outputDirectoryPath);
         }
     }
     else
     {
         Directory.CreateDirectory(outputDirectoryPath);
     }
     using (FileStream fileStream = new FileStream(outputDirectoryPath + "/control.nacp", FileMode.Create, FileAccess.Write))
     {
         byte[] buffer = ApplicationControl.MakeApplicationControlPropertyBytes(metaPath);
         fileStream.Write(buffer, 0, buffer.Length);
     }
     foreach (KeyValuePair <string, Tuple <string, string> > mergedIconPath in IconConverter.GetMergedIconPathMap(iconPathList, nxIconPathList))
     {
         string key         = mergedIconPath.Key;
         string rawIconPath = mergedIconPath.Value.Item1;
         string nxIconPath  = mergedIconPath.Value.Item2;
         try
         {
             Enum.Parse(typeof(Language), key);
         }
         catch
         {
             throw new ArgumentException(string.Format("Undefined language '{0}' specified.", (object)key));
         }
         byte[] buffer = IconConverter.ConvertNxIcon(rawIconPath, nxIconPath, nxIconMaxSize);
         using (FileStream fileStream = File.OpenWrite(outputDirectoryPath + "/icon_" + key + ".dat"))
             fileStream.Write(buffer, 0, buffer.Length);
     }
 }