/*
         *  MissionRecoveryDialog::fundsIconGreen.name: UiElements_05
         *  MissionRecoveryDialog::fundsIconRed.name: UiElements_06
         *  MissionRecoveryDialog::reputationIconGreen.name: UiElements_07
         *  MissionRecoveryDialog::reputationIconRed.name: UiElements_08
         *  MissionRecoveryDialog::scienceIcon.name: UiElements_12
         * */
        public VOID_CareerStatus() : base()
        {
            this.Name = "Career Status";

            GameEvents.OnFundsChanged.Add(this.onFundsChange);
            GameEvents.OnReputationChanged.Add(this.onRepChange);
            GameEvents.OnScienceChanged.Add(this.onScienceChange);
            GameEvents.onGameStateLoad.Add(this.onGameStateLoad);

            bool texturesLoaded;

            texturesLoaded  = IOTools.LoadTexture(out this.fundsIconGreen, "VOID/Textures/fundsgreen.png", 10, 18);
            texturesLoaded &= IOTools.LoadTexture(out this.fundsIconRed, "VOID/Textures/fundsred.png", 10, 18);
            texturesLoaded &= IOTools.LoadTexture(out this.reputationIconGreen, "VOID/Textures/repgreen.png", 16, 18);
            texturesLoaded &= IOTools.LoadTexture(out this.reputationIconRed, "VOID/Textures/repred.png", 16, 18);
            texturesLoaded &= IOTools.LoadTexture(out this.scienceIcon, "VOID/Textures/science.png", 16, 18);

            this.fundsContent   = new GUIContent();
            this.repContent     = new GUIContent();
            this.scienceContent = new GUIContent();

            if (texturesLoaded)
            {
                this.fundsContent.image   = this.fundsIconGreen;
                this.repContent.image     = this.reputationIconGreen;
                this.scienceContent.image = this.scienceIcon;
            }

            this.currentFunds      = double.NaN;
            this.currentScience    = float.NaN;
            this.currentReputation = float.NaN;
        }
Beispiel #2
0
        private void Read(StreamPart streamFile, string name)
        {
            GetType(streamFile);

            int index = 0;

            streamFile.Stream.Position = streamFile.Position;
            using (BinaryReader reader = IOTools.OpenReadFile(streamFile.Stream, IsLittleEndian))
                do
                {
                    int Size = reader.ReadInt32();

                    if (streamFile.Position + streamFile.Size < Size + streamFile.Stream.Position)
                    {
                        throw new Exception("TBL error");
                    }

                    byte[]     tempdata = reader.ReadBytes(Size);
                    FormatEnum fileType = GameFormatHelper.GetFormat(tempdata);
                    string     ext      = Path.GetExtension(name);
                    string     tempName = name.Substring(0, name.Length - ext.Length) + "(" + index++.ToString().PadLeft(2, '0') + ")";
                    if (fileType == FormatEnum.Unknown)
                    {
                        tempName += ".DAT";
                    }
                    else
                    {
                        tempName += "." + fileType.ToString();
                    }

                    SubFiles.Add(GameFormatHelper.OpenFile(tempName, tempdata, fileType == FormatEnum.Unknown ? FormatEnum.DAT : fileType));
                    reader.BaseStream.Position += IOTools.Alignment(reader.BaseStream.Position - streamFile.Position, 16);
                } while (streamFile.Stream.Position < streamFile.Position + streamFile.Size);
        }
Beispiel #3
0
 /**
  * synchronizes a folder (recursively) or a favorite with IE Favorites
  *  (before, checks whether the folder is an IE folder)
  */
 private void SynchronizeIEResource(IResource res)
 {
     if (ExportToIEAllowed &&
         _bookmarkservice.GetOwnerProfile(res).GetType() == typeof(IEFavoritesBookmarkProfile))
     {
         string path = GetResourceFullname(res);
         if (res.Type == "Folder")
         {
             IOTools.CreateDirectory(path);
             IResourceList childs = res.GetLinksTo(null, FavoritesPlugin._propParent);
             foreach (IResource child in childs)
             {
                 SynchronizeIEResource(child);
             }
         }
         else
         {
             FileStream stream = File.Exists(path) ? IOTools.Open(path) : IOTools.CreateFile(path);
             if (stream != null)
             {
                 string       URL    = res.GetPropText(FavoritesPlugin._propURL);
                 StreamWriter writer = new StreamWriter(stream);
                 using ( writer )
                 {
                     writer.WriteLine("[DEFAULT]\r\nBASEURL={0}\r\n[InternetShortcut]\r\nURL={1}", URL, URL);
                 }
             }
         }
     }
 }
Beispiel #4
0
    private static void genLuaFile(GameObject rootObj, string packageName, string desFilePath)
    {
        StringBuilder requireSB = new StringBuilder();
        StringBuilder descSB    = new StringBuilder();
        StringBuilder contentSB = new StringBuilder();

        //Debug.LogError("obj.name:" + obj.name);
        descSB.AppendFormat("\t\t---@return {0}_{1}\r\n", packageName, rootObj.name);
        descSB.Append("\t\t---@param ui UnityEngine.Transform\r\n");
        descSB.AppendFormat("function Get{0}_{1}Uis(ui)\r\n", packageName, rootObj.name);
        descSB.AppendFormat("\t\t---@class {0}_{1}\r\n", packageName, rootObj.name);
        descSB.AppendFormat("\t\t---@field public root UnityEngine.Transform\r\n");
        contentSB.Append("\t\tlocal uis={}\r\n");

        handleChild(rootObj, rootObj, requireSB, descSB, contentSB);

        contentSB.Append("\t\tuis.root=ui\r\n");
        contentSB.Append("\t\treturn uis\r\n");
        contentSB.Append("end");
        string finalStr = requireSB.ToString();

        finalStr += descSB.ToString();
        finalStr += contentSB.ToString();

        IOTools.WriteString(desFilePath, finalStr);
    }
Beispiel #5
0
        private void WriteUnnamed(Dictionary <int, byte[][]> data)
        {
            var unnamedFiles = SubFiles.FindAll(x => !MainFileList.Contains((int)(x.Tag as object[])[0]));

            foreach (var a in unnamedFiles)
            {
                byte[][] type = new byte[1][];
                var      temp = a.GameData.GetData();

                int    align    = IOTools.Alignment(temp.Length, 16);
                byte[] tempType = null;
                if (align == 0)
                {
                    tempType = temp;
                }
                else
                {
                    tempType = new byte[temp.Length + align];
                    Buffer.BlockCopy(temp, 0, tempType, 0, temp.Length);
                }

                type[0] = tempType;
                data.Add((int)(a.Tag as object[])[0], type);
            }
        }
Beispiel #6
0
        public static void TestTrainDataLabel(String paPath)
        {
            List <String> paths      = IOTools.ListPaths(paPath);
            List <String> labelTotal = new List <string>();
            List <String> dataTotal  = new List <string>();
            List <String> timeTotal  = new List <string>();
            int           i          = 0;
            int           testnum    = 1
            ;

            foreach (String path in paths)
            {
                i++;
                //if (i == testnum)
                //  continue;
                RecordAnalyzerPad ra = new RecordAnalyzerPad();
                List <String>     label, data, recordTIme;
                ra.DoAna(path, out label, out data, out recordTIme);
                // IOTools.WriteListToTxt(label, path + @"\label.txt");
                // IOTools.WriteListToTxt(data, path + @"\data.txt");
                labelTotal.AddRange(label);
                dataTotal.AddRange(data);
                timeTotal.AddRange(recordTIme);
            }
            IOTools.WriteListToTxt(labelTotal, paPath + @"\trainlabel.txt");
            IOTools.WriteListToTxt(dataTotal, paPath + @"\traindata.txt");
            IOTools.WriteListToTxt(timeTotal, paPath + @"\recordTime.txt");
        }
Beispiel #7
0
    private static void handleChild(GameObject rootObj, GameObject parentObj, StringBuilder requireSB, StringBuilder descSB, StringBuilder contentSB)
    {
        for (int j = 0; j < parentObj.transform.childCount; j++)
        {
            var child = parentObj.transform.GetChild(j);

            //该子物体是预制体中的预制体
            if (PrefabUtility.IsPartOfPrefabInstance(child.gameObject))
            {
                Debug.LogError(child.name + "是预制件");
                string p = PrefabUtility.GetPrefabAssetPathOfNearestInstanceRoot(child.gameObject);


                string packageNameSub = IOTools.GetFileFolderName(p);
                string assetNameSub   = Path.GetFileNameWithoutExtension(p);
                //Debug.LogError("原始路径:" + p);
                requireSB.AppendFormat("require \'{0}_{1}ByName\'\r\n", packageNameSub, assetNameSub);
                descSB.AppendFormat("\t\t---@field public {0} {1}_{2}\r\n", child.name, packageNameSub, assetNameSub);
                contentSB.AppendFormat("\t\tuis.{0}=Get{1}_{2}Uis(ui:Find(\"{3}\"))\r\n", child.name, packageNameSub, assetNameSub, retrivePath(child, rootObj.transform));

                var asset = PrefabUtility.LoadPrefabContents(p);
                //////if (!subPrefabDic.ContainsKey(p))
                //////{
                //////    subPrefabDic.Add(p, asset);
                //////}
                handlePrefabAsset(asset, p);
            }
            else
            {
                genLuaItem(descSB, contentSB, child, retrivePath(child, rootObj.transform));
                handleChild(rootObj, child.gameObject, requireSB, descSB, contentSB);
            }
        }
    }
Beispiel #8
0
        public override void Run(Configuration config, CommandArguments args)
        {
            base.Run(config, args);

            var workDir   = Path.Combine(Directory.GetCurrentDirectory(), config.StagingDirectory, Configuration.WebTarget);
            var buildArgs = string.Join(" ", GetFilesToBuild(workDir));

            buildArgs += " -s EXPORTED_FUNCTIONS=[" + string.Join(",", config.Web.ExportedFuncs.Select(s => $"\"_{s}\"")) + "]" + " -s ASSERTIONS=2";
            Console.WriteLine($"Start Emscripten build with args: '{buildArgs}'");
            ProcessTools.RunProcessAndEnsureSuccess(this, "Emscripten Build", config.Web.EmccPath, buildArgs, workDir);

            var outputPath = Path.Combine(config.BuildsDirectory, Configuration.WebTarget);

            Console.WriteLine($"Copy build to '{outputPath}'");
            IOTools.CopyDirectory(workDir, outputPath);

            Console.WriteLine($"Strip sources from '{outputPath}'");
            var filesToStrip = new List <string>();

            filesToStrip.AddRange(Directory.GetFiles(outputPath, "*.cpp", SearchOption.AllDirectories));
            filesToStrip.AddRange(Directory.GetFiles(outputPath, "*.h", SearchOption.AllDirectories));
            foreach (var file in filesToStrip)
            {
                Console.WriteLine($"Stripping '{file}'");
                File.Delete(file);
            }
        }
Beispiel #9
0
        public int GetSize()
        {
            int returned = 0x10;

            returned += Entries.Count * 4;
            returned += IOTools.Alignment(returned, 0x10);

            int entryoffset = 0;

            if (type == 0)
            {
                entryoffset = 0x10;
            }
            else if (type == 1)
            {
                entryoffset = 4;
            }

            foreach (var a in Entries)
            {
                returned += entryoffset;
                returned += a.Sum(x => x.Length);
                returned += IOTools.Alignment(returned, 0x10);
            }

            return(returned);
        }
Beispiel #10
0
        private async Task AddCategory()
        {
            string icon = IconTextBlock.Text;
            string name = CategoryNameTextBox.Text;

            if (!string.IsNullOrEmpty(icon) && !string.IsNullOrEmpty(name))
            {
                IsPrimaryButtonEnabled = false;
                PrimaryButtonText      = AppTools.GetReswLanguage("Tip_Waiting");
                var cate = new Category(name, icon);
                MainPage.Current.Categories.Add(cate);
                MainPage.Current._categoryListCount += 1;
                new PopupToast(AppTools.GetReswLanguage("Tip_AddCategorySuccess")).ShowPopup();
                Hide();
                try
                {
                    await IOTools.AddCategory(cate);
                }
                catch (Exception)
                {
                    await Task.Delay(1000);

                    await IOTools.AddCategory(cate);
                }
            }
            else
            {
                new PopupToast(AppTools.GetReswLanguage("Tip_FieldEmpty"), AppTools.GetThemeSolidColorBrush(ColorType.ErrorColor)).ShowPopup();
            }
        }
Beispiel #11
0
        private void Read(StreamPart streamPart)
        {
            streamPart.Stream.Position = streamPart.Position;
            using (BinaryReader reader = IOTools.OpenReadFile(streamPart.Stream, IsLittleEndian))
            {
                int tempsize = 0;

                byte[] imageData;

                header = ReadHeader(reader.ReadBytes(0x40));

                ImageFormat   = TMXHelper.PS2ToAux(header.PixelFormat);
                PaletteFormat = TMXHelper.PS2ToAux(header.PaletteFormat);

                tempsize += 0x40;
                System.Drawing.Color[] colors = null;
                if (header.PaletteCount == 1)
                {
                    tempsize += TMXHelper.ReadPalette(reader, header.PixelFormat, header.PaletteFormat, out colors);
                }

                int datasize = header.Height * ImageHelper.GetStride(ImageFormat, header.Width);
                imageData = reader.ReadBytes(datasize);

                tempsize += datasize;

                if (header.FileSize != tempsize)
                {
                    throw new Exception("TMX: filesize not equal");
                }

                bitmap = new Bitmap(header.Width, header.Height, ImageFormat, imageData, colors);
            }
        }
Beispiel #12
0
        private void OpenNew(byte[] data)
        {
            using (BinaryReader reader = IOTools.OpenReadFile(new MemoryStream(data), IsLittleEndian))
            {
                int count = reader.ReadInt32();
                if (count == 0)
                {
                    throw new Exception("BIN: count is zero");
                }

                for (int i = 0; i < count; i++)
                {
                    string Name = Encoding.ASCII.GetString(reader.ReadBytes(0x20)).Trim('\0');
                    int    Size = reader.ReadInt32();
                    byte[] Data = reader.ReadBytes(Size);

                    GameFile objectFile = GameFormatHelper.OpenFile(Name, Data, GameFormatHelper.GetFormat(Name));
                    if (objectFile == null)
                    {
                        objectFile = GameFormatHelper.OpenFile(Name, Data, FormatEnum.DAT);
                    }
                    SubFiles.Add(objectFile);
                }

                if (reader.BaseStream.Position != reader.BaseStream.Length)
                {
                    throw new System.Exception("BIN: read error");
                }
            }
        }
Beispiel #13
0
        private byte[] GetOld()
        {
            using (MemoryStream MS = new MemoryStream())
            {
                BinaryWriter writer = IOTools.OpenWriteFile(MS, IsLittleEndian);

                foreach (var a in SubFiles)
                {
                    byte[] name = new byte[0x100 - 4];
                    Encoding.ASCII.GetBytes(a.Name, 0, a.Name.Length, name, 0);
                    writer.Write(name);
                    byte[] data = a.GameData.GetData();
                    int    size = a.GameData.GetSize();
                    if (data.Length != size)
                    {
                    }
                    writer.Write(size);
                    writer.Write(data);
                    writer.Write(new byte[IOTools.Alignment(MS.Position, 0x40)]);
                }

                writer.Write(new byte[0x100]);

                return(MS.ToArray());
            }
        }
Beispiel #14
0
        public int GetSize()
        {
            int returned = 0;

            if (Old)
            {
                foreach (var a in SubFiles)
                {
                    returned += 0x100;
                    returned += a.GameData.GetSize();
                    returned += IOTools.Alignment(returned, 0x40);
                }

                returned += 0x100;
            }
            else
            {
                returned += 4;
                foreach (var a in SubFiles)
                {
                    returned += 0x20 + 4;
                    int size  = a.GameData.GetSize();
                    int align = IOTools.Alignment(size, 0x20);
                    returned += size + align;
                }
            }

            return(returned);
        }
    /// <summary>
    /// 异步加载一个ab
    /// 返回AssetBundleCreateRequest
    /// </summary>
    protected static AssetBundleCreateRequest asyncLoadAb(string name)
    {
        //Logger.err("异步加载ab");
        AssetBundleCreateRequest abReq = null;

        if (IOTools.IsResInUpdateDir(name))
        {
            string path = IOTools.getUpdateResPath(name);
            abReq = AssetBundle.LoadFromFileAsync(path);
        }
        else
        {
            if (Application.platform == RuntimePlatform.Android)
            {
                string path = IOTools.GetPackageResPath(name);
                abReq = AssetBundle.LoadFromFileAsync(path);
            }
            else  //ios 判断目录
            {
                string path = IOTools.GetPackageResPath(name);
                if (File.Exists(path))
                {
                    abReq = AssetBundle.LoadFromFileAsync(path);
                }
            }
        }
        return(abReq);
    }
Beispiel #16
0
        public byte[] GetData()
        {
            byte[] returned;

            using (MemoryStream MS = new MemoryStream())
                using (BinaryWriter writer = IOTools.OpenWriteFile(MS, IsLittleEndian))
                {
                    writer.Write(HeaderNumber);
                    writer.Write(MagicNumber);
                    writer.Write(GetSize());
                    writer.Write((uint)((type << 16) + Entries.Count));
                    writer.BaseStream.Position += Entries.Count * 4;
                    writer.BaseStream.Position += IOTools.Alignment(writer.BaseStream.Position, 0x10);

                    if (type == 0)
                    {
                        GetT0(writer);
                    }
                    else if (type == 1)
                    {
                        GetT1(writer);
                    }

                    returned = MS.ToArray();
                }

            return(returned);
        }
Beispiel #17
0
        public static void DrawMultipleResult(String paPath, List <int> epcList)
        {
            for (int i = 0; i < epcList.Count; i++)
            {
                int           epc        = epcList[i];
                List <String> paths      = IOTools.ListPaths(paPath);
                List <String> labelTotal = new List <string>();
                List <String> dataTotal  = new List <string>();
                List <String> timeTotal  = new List <string>();
                int           fileoffset = 0;
                CVO           cvo        = new CVO();
                foreach (String path in paths)
                {
                    List <String> indexList = IOTools.ReadListFromTxt(path + @"\index" + epc + ".txt");
                    if (i == 0)
                    {
                        cvo.DrawDLInVedio(path + @"\1.avi",
                                          path + @"\epc" + epcList[i] + ".avi", paPath + @"\modelResult" + epc + ".txt", path + @"\index" + epc + ".txt", fileoffset, colorList[0]);
                    }
                    else
                    {
                        cvo.DrawDLInVedio(path + @"\epc" + epcList[i - 1] + ".avi",
                                          path + @"\epc" + epcList[i] + ".avi", paPath + @"\modelResult" + epc + ".txt", path + @"\index" + epc + ".txt", fileoffset, colorList[i]);
                    }

                    fileoffset += indexList.Count;

                    //if (i == testnum)
                    //  continue;
                }
            }
        }
Beispiel #18
0
        private async void ExportOpmlButton_Click(object sender, RoutedEventArgs e)
        {
            ExportOpmlButton.IsEnabled = false;
            ExportOpmlButton.Content   = AppTools.GetReswLanguage("Tip_Waiting");
            var allList = MainPage.Current.Categories.ToList();

            try
            {
                var    opml     = new Opml(allList);
                string content  = opml.ToString();
                string fileName = AppTools.GetLocalSetting(AppSettings.UserName, "") + "_" + DateTime.Now.ToString("yyyyMMdd_HH_mm_ss") + ".opml";
                var    file     = await IOTools.GetSaveFile(".opml", fileName, "OPML File");

                if (file != null)
                {
                    await FileIO.WriteTextAsync(file, content);

                    new PopupToast(AppTools.GetReswLanguage("Tip_ExportSuccess")).ShowPopup();
                }
            }
            catch (Exception)
            {
                new PopupToast(AppTools.GetReswLanguage("Tip_ImportError"), AppTools.GetThemeSolidColorBrush(ColorType.ErrorColor)).ShowPopup();
            }
            ExportOpmlButton.IsEnabled = true;
            ExportOpmlButton.Content   = AppTools.GetReswLanguage("Tip_Export");
        }
Beispiel #19
0
        public void Run(Configuration config, CommandArguments args)
        {
            var target = args.GetTarget(this);

            IOTools.DeleteDirectory(Path.Combine(config.StagingDirectory, target), false);
            IOTools.DeleteDirectory(Path.Combine(config.BuildsDirectory, target), false);
        }
Beispiel #20
0
        private async void RemoveToastButton_Click(object sender, RoutedEventArgs e)
        {
            (sender as Button).IsEnabled = false;
            var data = (sender as Button).DataContext as Channel;

            if (data != null)
            {
                if (SettingPivot.SelectedIndex == 3)
                {
                    await IOTools.RemoveNeedToastChannel(data);

                    ToastChannels.Remove(data);
                    MainPage.Current.ToastList.RemoveAll(p => p.Id == data.Id);
                }
                else if (SettingPivot.SelectedIndex == 4)
                {
                    await IOTools.RemoveNeedReadableChannel(data);

                    ReadableChannels.Remove(data);
                    MainPage.Current.ReadableList.RemoveAll(p => p.Id == data.Id);
                }
                new PopupToast(AppTools.GetReswLanguage("Tip_Removed")).ShowPopup();
            }
            (sender as Button).IsEnabled = true;
        }
Beispiel #21
0
    private static void handlePrefabAsset(UnityEngine.Object prefabAsset, string path)
    {
        string assetName = prefabAsset.name;


        //Debug.LogError("path:" + path);
        string packageName = IOTools.GetFileFolderName(path);

        string desFolderPath = Application.dataPath + "/../../client/LuaScript/Windows/AutoExport/" + packageName;
        string desFilePath   = desFolderPath + "/" + packageName + "_" + assetName + "ByName" + ".lua";

        if (!Directory.Exists(desFolderPath))
        {
            Directory.CreateDirectory(desFolderPath);
        }
        if (!File.Exists(desFilePath))
        {
            File.Create(desFilePath).Dispose();
        }



        GameObject rootObj = PrefabUtility.LoadPrefabContents(path);

        genLuaFile(rootObj, packageName, desFilePath);
    }
Beispiel #22
0
        private async void ClearCacheButton_Click(object sender, RoutedEventArgs e)
        {
            await IOTools.DeleteCache();

            new PopupToast(AppTools.GetReswLanguage("Tip_ClearSuccess")).ShowPopup();
            CacheSizeTextBlock.Text = await IOTools.GetCacheSize();
        }
Beispiel #23
0
        private async void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
        {
            args.Cancel = true;
            string icon = IconTextBlock.Text;
            string name = CategoryNameTextBox.Text;

            if (!string.IsNullOrEmpty(icon) && !string.IsNullOrEmpty(name))
            {
                IsPrimaryButtonEnabled = false;
                PrimaryButtonText      = AppTools.GetReswLanguage("Tip_Waiting");
                _sourceCategory.Name   = name;
                _sourceCategory.Icon   = icon;
                foreach (var item in MainPage.Current.Categories)
                {
                    if (item.Id == _sourceCategory.Id)
                    {
                        item.Name = _sourceCategory.Name;
                        item.Icon = _sourceCategory.Icon;
                    }
                }
                new PopupToast(AppTools.GetReswLanguage("Tip_UpdateCategorySuccess")).ShowPopup();
                Hide();
                await IOTools.UpdateCategory(_sourceCategory);
            }
            else
            {
                new PopupToast(AppTools.GetReswLanguage("Tip_FieldEmpty"), AppTools.GetThemeSolidColorBrush(ColorType.ErrorColor)).ShowPopup();
            }
        }
 public void OpenFile()
 {
     if (!IOTools.OpenWithDefault(FilePath))
     {
         windowService.ShowMessage(string.Format("Can't open {0}.", FilePath));
     }
 }
Beispiel #25
0
 public void DisplayResource(IResource resource)
 {
     _resource             = resource;
     _errorLabel.Visible   = false;
     _picturePanel.Visible = true;
     using (new LayoutSuspender(this))
     {
         FileStream stream = IOTools.OpenRead(Core.FileResourceManager.GetSourceFile(resource));
         if (stream != null)
         {
             _imageStream = new JetMemoryStream(0x10000);
             using ( stream )
             {
                 FileResourceManager.CopyStream(stream, _imageStream);
                 try
                 {
                     _picturebox.Image = Image.FromStream(_imageStream);
                 }
                 catch (Exception)
                 {
                     _errorLabel.Visible   = true;
                     _picturePanel.Visible = false;
                     return;
                 }
             }
         }
     }
     PerformLayout();
 }
Beispiel #26
0
 public override AbstractJob GetNextJob()
 {
     if (!Interrupted && _folderEnumerator.MoveNext())
     {
         HashMap.Entry entry  = (HashMap.Entry)_folderEnumerator.Current;
         string        path   = (string)entry.Key;
         IResource     folder = (IResource)entry.Value;
         Core.UIManager.GetStatusWriter(this, StatusPane.UI).ShowStatus(path);
         string jobName = "Scanning file folder - " + path;
         _args[0] = folder;
         if (IsPathDeferred(path) || IsPathMonitored(path))
         {
             if (_indexHidden)
             {
                 return(new DelegateJob(jobName, _enumerateDelegate, _args));
             }
             DirectoryInfo info = IOTools.GetDirectoryInfo(path);
             if (info != null && (IOTools.GetAttributes(info) & FileAttributes.Hidden) == 0)
             {
                 return(new DelegateJob(jobName, _enumerateDelegate, _args));
             }
         }
         return(new DelegateJob(jobName, _excludeDelegate, _args));
     }
     return(null);
 }
Beispiel #27
0
        public byte[] GetData()
        {
            using (MemoryStream MS = new MemoryStream())
                using (BinaryWriter writer = IOTools.OpenWriteFile(MS, IsLittleEndian))
                {
                    writer.BaseStream.Position = (SubFiles.Count + 1) * 12;

                    List <int[]> Entry = new List <int[]>();

                    for (int i = 0; i < SubFiles.Count; i++)
                    {
                        Entry.Add(new int[] { FlagList[i], (int)writer.BaseStream.Position, SubFiles[i].GameData.GetSize() });

                        writer.Write(SubFiles[i].GameData.GetData());
                        writer.Write(new byte[IOTools.Alignment(writer.BaseStream.Position, 16)]);
                    }

                    writer.BaseStream.Position = 0;

                    foreach (var a in Entry)
                    {
                        writer.WriteInt32Array(a);
                    }

                    return(MS.ToArray());
                }
        }
Beispiel #28
0
        private void OnCreatedOrChanged(object source, FileSystemEventArgs e)
        {
            string path = e.FullPath;

            Trace.WriteLineIf(TraceWatchers(), "OnCreatedOrChanged( " + path + " )", "FilePlugin");

            if (Directory.Exists(path))
            {
                IResource directory = FindOrCreateDirectory(path);
                if (directory != null)
                {
                    FileProxy.UpdateFoldersTreePane(directory);
                }
            }
            else
            {
                FileInfo fileInfo = IOTools.GetFileInfo(path);
                if (fileInfo != null)
                {
                    if (((IOTools.GetAttributes(fileInfo) & FileAttributes.Hidden) == 0 || _indexHidden) &&
                        _ftm.GetResourceTypeByExtension(IOTools.GetExtension(fileInfo)) != null)
                    {
                        FindOrCreateFile(fileInfo, false);
                    }
                }
            }
        }
Beispiel #29
0
        private async void ImportButton_Click(object sender, RoutedEventArgs e)
        {
            var file = await IOTools.OpenLocalFile(".guanzhi");

            if (file != null)
            {
                string text = await FileIO.ReadTextAsync(file);

                var model     = JsonConvert.DeserializeObject <ExportModel>(text);
                var tipDialog = new ConfirmDialog("导入提醒", $"您将导入用户名为'{model.UserName}'用户的相关配置及历史记录。这会覆盖您目前的配置及记录,是否确认?");
                var result    = await tipDialog.ShowAsync();

                if (result == ContentDialogResult.Primary)
                {
                    bool importResult = await ExportModel.ImportModel(model);

                    if (importResult)
                    {
                        var closeDialog = new ConfirmDialog("请重启软件", "配置及历史记录已成功导入,现在请关闭软件,重新启动应用", "关闭", "关闭", "还是关闭");
                        await closeDialog.ShowAsync();

                        App.Current.Exit();
                    }
                }
            }
        }
Beispiel #30
0
        private void GenerateResourceFile()
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("Id,BundleName,BundleFullName,Size,Md5\r");
            for (int i = 0; i < abItemList.Count; ++i)
            {
                AssetBundleItem item = abItemList[i];
                sb.Append((i + 1).ToString());
                sb.Append(",");
                sb.Append(item.bundleName);
                sb.Append(",");
                sb.Append(item.bundleFullName);
                sb.Append(",");
                sb.Append(item.size.ToString());
                sb.Append(",");
                sb.Append(item.md5);
                if (i < abItemList.Count - 1)
                {
                    sb.Append('\r');
                }
            }

            string resourceFilePath = GetAssetBundlePath(curBuildTarget) + resourceFile;

            IOTools.WriteFile(resourceFilePath, sb.ToString());
        }