public ToolManager()
 {
     rulerTool = new RulerTool(this);
     angleTool = new AngleTool(this);
     selectTool = new SelectTool(this);
     pathTool = new PathTool(this);
     sketchTool = new SketchTool(this);
     contextMenuTool = new ContextMenuTool(this);
     pointInspectTool = new PointInspectTool(this);
 }
        private void GetUnitAnim()
        {
            string path = string.Format("{0}/{1}/Animator/", UnitMgr.Instance.ModPath, Player.MTemp.model);

            path = Application.dataPath.Replace("Assets", path);
            string[] AnimPaths = PathTool.GetFiles(path);
            if (AnimPaths != null)
            {
                int length = AnimPaths.Length;
                for (int i = 0; i < length; i++)
                {
                    if (Path.GetExtension(AnimPaths[i]) == SuffixTool.Meta)
                    {
                        continue;
                    }
                    AnimNames.Add(Path.GetFileNameWithoutExtension(AnimPaths[i]));
                }
            }
        }
Exemple #3
0
        public Asset CreateTargetAsset(string resourcePath, string assetTypeName)
        {
            Type assetType;

            if (!AssetTypes.TryGetValue(assetTypeName, out assetType))
            {
                ToolDebug.Error("Failed to find target type {0} for {1}", assetTypeName, resourcePath);
                return(null);
            }

            resourcePath = Path.ChangeExtension(resourcePath, assetTypeName);
            resourcePath = PathTool.NormalizePathToProjectBase(resourcePath);

            var newAsset = Activator.CreateInstance(assetType, resourcePath) as Asset;


            //newAsset.SourcePath = resourcePath;
            return(newAsset);
        }
Exemple #4
0
    /// <summary>
    /// 根据bundleName获取加载路径
    /// </summary>
    /// <param name="bundleName"></param>
    /// <returns></returns>
    static string GetBundlePath(ResourcesConfig config)
    {
#if !UNITY_WEBGL
        bool            isLoadByPersistent = RecordManager.GetData(HotUpdateManager.c_HotUpdateRecordName).GetRecord(config.name, "null") == "null" ? false:true;
        ResLoadLocation loadType           = ResLoadLocation.Streaming;

        //加载路径由 加载根目录 和 相对路径 合并而成
        //加载根目录由配置决定
        if (isLoadByPersistent)
        {
            loadType = ResLoadLocation.Persistent;
            return(PathTool.GetAssetsBundlePersistentPath() + config.path + "." + c_AssetsBundlesExpandName);
        }

        return(PathTool.GetAbsolutePath(loadType, config.path + "." + c_AssetsBundlesExpandName));
#else
        return(PathTool.GetLoadURL(config.path + "." + c_AssetsBundlesExpandName));
#endif
    }
Exemple #5
0
        /// <summary>
        /// 获取元数据库文件的绝对路径
        /// </summary>
        /// <returns></returns>
        public String GetMetaDllAbsPath()
        {
            if (strUtil.IsNullOrEmpty(this.MetaDLL))
            {
                return("");
            }

            String dllPath = this.MetaDLL;

            if (dllPath.ToLower().EndsWith(".dll") == false)
            {
                dllPath = dllPath + ".dll";
            }

            dllPath = Path.Combine(PathTool.GetBinDirectory(), dllPath);


            return(dllPath);
        }
    static void OpenWriteFileStream(string fileName)
    {
        try
        {
            string path = PathTool.GetAbsolutePath(ResLoadLocation.Persistent,
                                                   PathTool.GetRelativelyPath(
                                                       c_directoryName,
                                                       fileName,
                                                       c_randomExpandName));

            string dirPath = Path.GetDirectoryName(path);

            if (!Directory.Exists(dirPath))
            {
                Directory.CreateDirectory(dirPath);
            }


            //Debug.Log("EventStream Name: " + PathTool.GetAbsolutePath(ResLoadLocation.Persistent,
            //                             PathTool.GetRelativelyPath(
            //                                            c_directoryName,
            //                                            fileName,
            //                                            c_randomExpandName)));

            m_RandomWriter = new StreamWriter(PathTool.GetAbsolutePath(ResLoadLocation.Persistent,
                                                                       PathTool.GetRelativelyPath(
                                                                           c_directoryName,
                                                                           fileName,
                                                                           c_randomExpandName)));
            m_RandomWriter.AutoFlush = true;

            m_EventWriter = new StreamWriter(PathTool.GetAbsolutePath(ResLoadLocation.Persistent,
                                                                      PathTool.GetRelativelyPath(
                                                                          c_directoryName,
                                                                          fileName,
                                                                          c_eventExpandName)));
            m_EventWriter.AutoFlush = true;
        }
        catch (Exception e)
        {
            Debug.LogError(e.ToString());
        }
    }
    public static void LoadReplayFile(string fileName)
    {
        string eventContent = ResourceIOTool.ReadStringByFile(
            PathTool.GetAbsolutePath(ResLoadLocation.Persistent,
                                     PathTool.GetRelativelyPath(
                                         c_directoryName,
                                         fileName,
                                         c_eventExpandName)));

        string randomContent = ResourceIOTool.ReadStringByFile(
            PathTool.GetAbsolutePath(ResLoadLocation.Persistent,
                                     PathTool.GetRelativelyPath(
                                         c_directoryName,
                                         fileName,
                                         c_randomExpandName)));

        LoadEventStream(eventContent.Split('\n'));
        LoadRandomList(randomContent.Split('\n'));
    }
    public void Init()
    {
#if !(UNITY_WEBGL && !UNITY_EDITOR)
        try
        {
            ApplicationManager.s_OnApplicationQuit += Close;

            this.mWritingLogQueue = new Queue <LogInfo>();
            this.mWaitingLogQueue = new Queue <LogInfo>();

            this.mLogLock = new object();
            System.DateTime now     = System.DateTime.Now;
            string          logName = string.Format("Log{0}{1}{2}#{3}_{4}_{5}",
                                                    now.Year, now.Month, now.Day, now.Hour, now.Minute, now.Second);

            string logPath = PathTool.GetAbsolutePath(ResLoadLocation.Persistent, PathTool.GetRelativelyPath(LogPath, logName, expandName));

            UpLoadLogic(logPath);

            if (File.Exists(logPath))
            {
                File.Delete(logPath);
            }
            string logDir = Path.GetDirectoryName(logPath);

            if (!Directory.Exists(logDir))
            {
                Directory.CreateDirectory(logDir);
            }

            this.mLogWriter           = new StreamWriter(logPath);
            this.mLogWriter.AutoFlush = true;
            this.mIsRunning           = true;
            this.mFileLogThread       = new Thread(new ThreadStart(WriteLog));
            this.mFileLogThread.Start();
        }
        catch
        {
            //Debug.LogError(e);
        }
#endif
    }
Exemple #9
0
        public string loadFile()
        {
            string str = cn.com.fcsoft.util.Tools.demoAction(this.httpRequest_0);

            if (str != "")
            {
                throw new Exception(str);
            }
            Logger.debug("开始打开文件:");
            string str2 = "";

            if (CellNo.sVersionNo == "3")
            {
                str2 = CellNo.sCustomerName + "\n" + CellNo.sProjectName;
            }
            string sFileName = this.httpRequest_0.Params["spath"];

            if (this.httpRequest_0.Params["fromdb"] == "yes")
            {
                str2 = str2 + ToDatabase.Load(this.httpRequest_0, this.dboperator_0, sFileName);
            }
            else
            {
                sFileName = PathTool.getRealPath(this.httpRequest_0, FileAction.basePath + sFileName);
                StringBuilder builder = new StringBuilder();
                try
                {
                    StreamReader reader = new StreamReader(sFileName, Encoding.Default);
                    for (string str5 = reader.ReadLine(); str5 != null; str5 = reader.ReadLine())
                    {
                        builder.Append(str5);
                    }
                    reader.Close();
                    str2 = str2 + builder.ToString();
                }
                catch (Exception exception)
                {
                    str2 = exception.Message;
                }
            }
            return(str2.Replace("<fc />", "").Replace("<fc></fc>", ""));
        }
    public void FindConfigName(string path)
    {
        //string[] allUIPrefabName = Directory.GetFiles(path);
        //foreach (var item in allUIPrefabName)
        //{
        //    if (item.EndsWith(".txt"))
        //    {
        //        //string configName = FileTool.RemoveExpandName(FileTool.GetFileNameByPath(item));
        //        s_dataNameList.Add(FileTool.RemoveExpandName(PathTool.GetDirectoryRelativePath(m_directoryPath + "/", item)));
        //    }
        //}

        string[] dires = Directory.GetDirectories(path);
        for (int i = 0; i < dires.Length; i++)
        {
            s_languageList.Add(FileTool.RemoveExpandName(PathTool.GetDirectoryRelativePath(m_directoryPath + "/", dires[i])));

            //FindConfigName(dires[i]);
        }
    }
Exemple #11
0
        public void saveasExcel(HttpRequest req, HttpResponse res, bool bBreakPage)
        {
            string str = PathTool.getRealPath(req, FileAction.basePath + req["spath"]);

            //req.get_Item("pageno");
            try
            {
                Report report = method_4(str, req, method_3(req["e_paramid"]));
                string str2   = "ereport";
                res.ContentType = ("application/x-msdownload");
                res.AppendHeader("Content-Disposition", new StringBuilder("attachment; filename=").Append(str2).Append(".xls").ToString().ToString());
                report.exportToExcel(res.OutputStream, bBreakPage);
            }
            catch (Exception exception)
            {
                res.ContentType = ("text/html;charset=UTF-8");
                res.Output.Write(exception.Message);
                Console.Out.WriteLine(exception.Message);
            }
        }
    public static void SaveReplayFile(string fileName)
    {
        List <Dictionary <string, string> > EventStreamContent = SaveEventStream();
        List <int> randomListContent = SaveRandomList();

        Dictionary <string, object> replayInfo = new Dictionary <string, object>();

        replayInfo.Add(c_eventStreamKey, EventStreamContent);
        replayInfo.Add(c_randomListKey, randomListContent);

        string content = Json.Serialize(replayInfo);

        ResourceIOTool.WriteStringByFile(
            PathTool.GetAbsolutePath(ResLoadType.Persistent,
                                     PathTool.GetRelativelyPath(
                                         c_directoryName,
                                         fileName,
                                         c_expandName))
            , content);
    }
        protected override Result DoRenameDirectory(U8Span oldPath, U8Span newPath)
        {
            Unsafe.SkipInit(out FsPath normalizedCurrentPath);
            Unsafe.SkipInit(out FsPath normalizedNewPath);

            Result rc = PathTool.Normalize(normalizedCurrentPath.Str, out _, oldPath, false, false);

            if (rc.IsFailure())
            {
                return(rc);
            }

            rc = PathTool.Normalize(normalizedNewPath.Str, out _, newPath, false, false);
            if (rc.IsFailure())
            {
                return(rc);
            }

            return(FileTable.RenameDirectory(normalizedCurrentPath, normalizedNewPath));
        }
Exemple #14
0
        public void Init()
        {
            if (sched != null && !sched.IsShutdown)
            {
                return;
            }

            sched = sf.GetScheduler();
            var path = PathTool.getInstance().Map(JobsConfigPath);

            processor.ProcessFileAndScheduleJobs(path, sched);

            if (GlobalJobListener != null)
            {
                if (sched.ListenerManager.GetJobListener(GlobalJobListener.Name) == null)
                {
                    sched.ListenerManager.AddJobListener(GlobalJobListener, null);
                }
            }
        }
Exemple #15
0
    public static string ReadResourceConfigContent()
    {
#if !UNITY_WEBGL
        string dataJson = "";

        if (ResourceManager.m_gameLoadType == ResLoadLocation.Resource)
        {
            dataJson = ResourceIOTool.ReadStringByResource(
                c_ManifestFileName + "." + ConfigManager.c_expandName);
        }
        else
        {
            ResLoadLocation type = ResLoadLocation.Streaming;

            if (RecordManager.GetData(HotUpdateManager.c_HotUpdateRecordName).GetRecord(HotUpdateManager.c_useHotUpdateRecordKey, false))
            {
                type = ResLoadLocation.Persistent;

                dataJson = ResourceIOTool.ReadStringByFile(
                    PathTool.GetAbsolutePath(
                        type,
                        c_ManifestFileName + "." + ConfigManager.c_expandName));
            }
            else
            {
                AssetBundle ab = AssetBundle.LoadFromFile(PathTool.GetAbsolutePath(
                                                              type,
                                                              c_ManifestFileName + "." + AssetsBundleManager.c_AssetsBundlesExpandName));

                TextAsset text = (TextAsset)ab.mainAsset;
                dataJson = text.text;

                ab.Unload(true);
            }
        }

        return(dataJson);
#else
        return(WEBGLReadResourceConfigContent());
#endif
    }
Exemple #16
0
        public override bool ProcessFeatures(Dictionary <string, Feature> features)
        {
            // If the base fails, just fail out
            if (!base.ProcessFeatures(features))
            {
                return(false);
            }

            // Get feature flags
            bool nostore = GetBoolean(features, NoStoreHeaderValue);

            // Get only files from the inputs
            List <ParentablePath> files = PathTool.GetFilesOnly(Inputs);

            foreach (ParentablePath file in files)
            {
                DetectTransformStore(file.CurrentPath, OutputDir, nostore);
            }

            return(true);
        }
Exemple #17
0
        public override void Start(AssetBuildContext context)
        {
            StringBuilder commandParameter = new StringBuilder();

            commandParameter.AppendFormat(" {0}", DefaultLibOptions);

            AddParameterSetting(context, commandParameter, stm_OptionMap);

            var outputPath = PathTool.NormalizePathAndCreate(context.CurrentOutput.SourceFilePath);

            commandParameter.AppendFormat(" /OUT:{0}", outputPath);

            foreach (var input in context.CurrentInputs)
            {
                commandParameter.AppendFormat(" {0}", input.SourceFilePath);
            }

            StartInfo.FileName  = Command;
            StartInfo.Arguments = commandParameter.ToString();
            base.Start(context);
        }
Exemple #18
0
    public void Jar2Smali(string jarPath, string filePath)
    {
        string smaliPath    = filePath + "\\smali";
        string JavaTempPath = PathTool.GetCurrentPath() + "\\JavaTempPath";
        string jarName      = FileTool.GetFileNameByPath(jarPath);
        string tempPath     = JavaTempPath + "\\" + jarName;

        FileTool.CreatPath(JavaTempPath);

        CmdService cmd = new CmdService(OutPut, errorCallBack);

        //Jar to dex
        cmd.Execute("java -jar dx.jar --dex --output=" + tempPath + " " + jarPath, true, true);

        //dex to smali
        cmd.Execute("java -jar baksmali-2.1.3.jar --o=" + smaliPath + " " + tempPath);

        //删除临时目录
        FileTool.DeleteDirectory(JavaTempPath);
        Directory.Delete(JavaTempPath);
    }
Exemple #19
0
        public string fileExist()
        {
            string sourPath = Escape.unescape(this.httpRequest_0.Params["spath"]);

            sourPath = PathTool.getRealPath(this.httpRequest_0, sourPath);
            string str2 = "";

            try
            {
                if (!File.Exists(sourPath))
                {
                    return("no");
                }
                str2 = "yes";
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(str2);
        }
Exemple #20
0
    public static void MarkAssetBundle()
    {
        AssetDatabase.RemoveUnusedAssetBundleNames();
        string        path    = Global.AssetBundlePath;
        DirectoryInfo tempDir = new DirectoryInfo(path);

        FileSystemInfo[] filesInfo = tempDir.GetFileSystemInfos();
        for (int i = 0; i < filesInfo.Length; i++)
        {
            FileSystemInfo tmpFile = filesInfo[i];
            if (tmpFile is DirectoryInfo)
            {
                string tempPath = Path.Combine(path, tmpFile.Name);
                LoadScenceBundle(tempPath);
            }
        }
        string outPath = PathTool.GetBundlePath();

        CopyRecordTxt(path, outPath);
        AssetDatabase.Refresh();
    }
Exemple #21
0
        private HashSet <string> assetNames = new HashSet <string>();//资源名称记录:包和资源的对应

        /// <summary>
        /// 读取本场景资源记录
        /// </summary>
        private void ReadRecords()
        {
            string recordFileName = PathTool.GetRecordFileName(SceneManager.GetActiveScene().name);

            FileStream   fs = new FileStream(recordFileName, FileMode.Open);
            StreamReader sr = new StreamReader(fs);

            string l;

            while ((l = sr.ReadLine()) != null)
            {
                if (!assetNames.Contains(l))
                {
                    assetNames.Add(l);
                }
            }
            sr.Close();
            fs.Close();
            sr.Dispose();
            fs.Dispose();
        }
Exemple #22
0
        /// <summary>
        /// 解析配置表
        /// </summary>
        private void Analysis()
        {
            string path = Config.PathConfig[ConfigKey.TablePath];

            if (string.IsNullOrEmpty(path))
            {
                UpdateNotification("初始化失败,没有找到配置表路径");
                return;
            }
            PathNames = PathTool.GetFiles(path);
            if (PathNames == null)
            {
                IsInit = false;
                UpdateNotification(string.Format("初始化失败,路径{0}没有获取到数据文件", path));
                return;
            }
            ToggleList = new bool[PathNames.Length];
            InputConfig();
            UpdateConfig();
            InitComplete();
        }
    static void CheckLocalVersion()
    {
        AssetBundle ab = AssetBundle.LoadFromFile(PathTool.GetAbsolutePath(ResLoadLocation.Streaming,
                                                                           c_versionFileName + "." + AssetsBundleManager.c_AssetsBundlesExpandName));
        TextAsset text = (TextAsset)ab.mainAsset;
        string    StreamVersionContent = text.text;

        ab.Unload(true);

        //stream版本
        Dictionary <string, object> StreamVersion = (Dictionary <string, object>)MiniJSON.Json.Deserialize(StreamVersionContent);

        //Streaming版本如果比Persistent版本还要新,则更新Persistent版本
        if ((GetInt(StreamVersion[c_largeVersionKey]) > GetInt(m_versionConfig[c_largeVersionKey])) ||
            (GetInt(StreamVersion[c_smallVersonKey]) > GetInt(m_versionConfig[c_smallVersonKey]))
            )
        {
            RecordManager.CleanRecord(c_HotUpdateRecordName);
            Init();
        }
    }
Exemple #24
0
    public static void LoadResourceConfig()
    {
#if !UNITY_WEBGL
        string data = "";

        if (ResourceManager.LoadType == AssetsLoadType.Resources)
        {
            data = ResourceIOTool.ReadStringByResource(c_ManifestFileName + "." + DataManager.c_expandName);
        }
        else
        {
            ResLoadLocation type   = ResLoadLocation.Streaming;
            string          r_path = null;
            if (RecordManager.GetData(HotUpdateManager.c_HotUpdateRecordName).GetRecord(c_ManifestFileName.ToLower(), "null") != "null")
            {
                Debug.Log("LoadResourceConfig 读取沙盒路径");

                type = ResLoadLocation.Persistent;
                //更新资源存放在Application.persistentDataPath+"/Resources/"目录下
                r_path = PathTool.GetAssetsBundlePersistentPath() + c_ManifestFileName.ToLower();
            }
            else
            {
                Debug.Log("LoadResourceConfig 读取stream路径");

                r_path = PathTool.GetAbsolutePath(type, c_ManifestFileName.ToLower());
            }
            AssetBundle ab = AssetBundle.LoadFromFile(r_path);

            TextAsset text = ab.LoadAsset <TextAsset>(c_ManifestFileName);
            data = text.text;

            ab.Unload(true);
        }

        s_config = DataTable.Analysis(data);
#else
        return(WEBGLReadResourceConfigContent());
#endif
    }
Exemple #25
0
    public static DataTable GetData(string DataName)
    {
        try
        {
            //编辑器下不处理缓存
            if (s_dataCache.ContainsKey(DataName))
            {
                return(s_dataCache[DataName]);
            }

            DataTable data     = null;
            string    dataJson = "";

            if (Application.isPlaying)
            {
                dataJson = ResourceManager.LoadText(DataName);
            }
            else
            {
                dataJson = ResourceIOTool.ReadStringByResource(
                    PathTool.GetRelativelyPath(c_directoryName,
                                               DataName,
                                               c_expandName));
            }

            if (dataJson == "")
            {
                throw new Exception("Dont Find ->" + DataName + "<-");
            }
            data             = DataTable.Analysis(dataJson);
            data.m_tableName = DataName;

            s_dataCache.Add(DataName, data);
            return(data);
        }
        catch (Exception e)
        {
            throw new Exception("GetData Exception ->" + DataName + "<- : " + e.ToString());
        }
    }
Exemple #26
0
    //解析版本号文件
    static void AnalysisVersionFile()
    {
        string version = ResourceIOTool.ReadStringByFile(PathTool.GetAbsolutePath(ResLoadLocation.Resource, HotUpdateManager.c_versionFileName + ".json"));

        Dictionary <string, object> VersionData = null;

        if (version == "")
        {
            VersionData = null;
        }
        else
        {
            VersionData = (Dictionary <string, object>)FrameWork.Json.Deserialize(version);
        }

        if (VersionData == null)
        {
            largeVersion = -1;
            smallVersion = -1;
            return;
        }

        if (VersionData.ContainsKey(HotUpdateManager.c_largeVersionKey))
        {
            largeVersion = int.Parse(VersionData[HotUpdateManager.c_largeVersionKey].ToString());
        }
        else
        {
            largeVersion = -1;
        }

        if (VersionData.ContainsKey(HotUpdateManager.c_smallVersonKey))
        {
            smallVersion = int.Parse(VersionData[HotUpdateManager.c_smallVersonKey].ToString());
        }
        else
        {
            smallVersion = -1;
        }
    }
Exemple #27
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string uid     = Request.QueryString["uid"];
            string cbk     = Request.QueryString["callback"];
            string id      = Request.QueryString["id"];
            string nameLoc = Request.QueryString["nameLoc"];
            string pathLoc = Request.QueryString["pathLoc"];
            string sizeSvr = Request.QueryString["sizeSvr"];

            sizeSvr = PathTool.url_decode(sizeSvr);
            pathLoc = PathTool.url_decode(pathLoc);
            nameLoc = PathTool.url_decode(nameLoc);

            if (string.IsNullOrEmpty(uid) ||
                string.IsNullOrEmpty(nameLoc) ||
                string.IsNullOrEmpty(pathLoc)
                )
            {
                Response.Write(cbk + "(0)");
                return;
            }

            DnFileInf fd = new DnFileInf();

            fd.nameLoc = nameLoc;
            fd.pathLoc = pathLoc;
            fd.id      = id;
            fd.sizeSvr = sizeSvr;
            fd.fdTask  = true;
            DnFile db = new DnFile();

            db.Add(ref fd);

            string json = JsonConvert.SerializeObject(fd);

            json = HttpUtility.UrlEncode(json);
            json = json.Replace("+", "%20");
            json = cbk + "({\"value\":\"" + json + "\"})";//返回jsonp格式数据。
            Response.Write(json);
        }
    public static DataTable GetData(string DataName)
    {
        if (s_dataCatch.ContainsKey(DataName))
        {
            return(s_dataCatch[DataName]);
        }

        DataTable data = null;

        string dataJson = "";

#if UNITY_EDITOR
        if (Application.isPlaying)
        {
            dataJson = ResourceManager.ReadTextFile(DataName);
        }
        else
        {
            dataJson = ResourceIOTool.ReadStringByResource(
                PathTool.GetRelativelyPath(c_directoryName,
                                           DataName,
                                           c_expandName));
        }
#else
        dataJson = ResourceManager.ReadTextFile(DataName);
#endif

        if (dataJson == "")
        {
            throw new Exception("Dont Find ->" + DataName + "<-");
        }

        data             = DataTable.Analysis(dataJson);
        data.m_tableName = DataName;

        s_dataCatch.Add(DataName, data);

        return(data);
    }
Exemple #29
0
    public static bool GetIsExistConfig(string ConfigName)
    {
        string dataJson = "";

        #if UNITY_EDITOR
        dataJson = ResourceIOTool.ReadStringByResource(
            PathTool.GetRelativelyPath(c_directoryName,
                                       ConfigName,
                                       c_expandName));
        #else
        dataJson = ResourceManager.ReadTextFile(ConfigName);
        #endif

        if (dataJson == "")
        {
            return(false);
        }
        else
        {
            return(true);
        }
    }
Exemple #30
0
    public static DataTable GetData(string ConfigName)
    {
        string dataJson = "";

        #if UNITY_EDITOR
        dataJson = ResourceIOTool.ReadStringByResource(
            PathTool.GetRelativelyPath(c_directoryName,
                                       ConfigName,
                                       c_expandName));
        #else
        dataJson = ResourceManager.ReadTextFile(ConfigName);
        #endif

        if (dataJson == "")
        {
            return(null);
        }
        else
        {
            return(DataTable.Analysis(dataJson));
        }
    }
        protected override Result DoCreateFile(U8Span path, long size, CreateFileOptions options)
        {
            FsPath normalizedPath;

            unsafe { _ = &normalizedPath; } // workaround for CS0165

            Result rc = PathTool.Normalize(normalizedPath.Str, out _, path, false, false);

            if (rc.IsFailure())
            {
                return(rc);
            }

            if (size == 0)
            {
                var emptyFileEntry = new SaveFileInfo {
                    StartBlock = int.MinValue, Length = size
                };
                FileTable.AddFile(normalizedPath, ref emptyFileEntry);

                return(Result.Success);
            }

            int blockCount = (int)Utilities.DivideByRoundUp(size, AllocationTable.Header.BlockSize);
            int startBlock = AllocationTable.Allocate(blockCount);

            if (startBlock == -1)
            {
                return(ResultFs.AllocationTableInsufficientFreeBlocks.Log());
            }

            var fileEntry = new SaveFileInfo {
                StartBlock = startBlock, Length = size
            };

            FileTable.AddFile(normalizedPath, ref fileEntry);

            return(Result.Success);
        }
Exemple #32
0
        private void InitializeWorkingPath(XPoint start)
        {
            _geometry = XPathGeometry.Create(
                new List<XPathFigure>(),
                _editor.Project.Options.DefaultFillRule);

            _geometry.BeginFigure(
                start,
                _editor.Project.Options.DefaultIsFilled,
                _editor.Project.Options.DefaultIsClosed);

            _path = XPath.Create(
                "Path",
                _editor.Project.CurrentStyleLibrary.CurrentStyle,
                _geometry,
                _editor.Project.Options.DefaultIsStroked,
                _editor.Project.Options.DefaultIsFilled);

            _editor.Project.CurrentContainer.WorkingLayer.Shapes = _editor.Project.CurrentContainer.WorkingLayer.Shapes.Add(_path);

            _previousPathTool = _editor.CurrentPathTool;
            _isInitialized = true;
        }
Exemple #33
0
        private void SwitchPathTool(double x, double y)
        {
            switch (_previousPathTool)
            {
                case PathTool.Line:
                    {
                        RemoveLastLineSegment();
                        RemoveLineHelpers();
                    }
                    break;
                case PathTool.Arc:
                    {
                        RemoveLastArcSegment();
                        RemoveArcHelpers();
                    }
                    break;
                case PathTool.Bezier:
                    {
                        RemoveLastBezierSegment();
                        RemoveBezierHelpers();
                    }
                    break;
                case PathTool.QBezier:
                    {
                        RemoveLastQBezierSegment();
                        RemoveQBezierHelpers();
                    }
                    break;
            }

            _currentState = State.None;

            switch (_editor.CurrentPathTool)
            {
                case PathTool.Line:
                    {
                        LineLeftDown(x, y);
                    }
                    break;
                case PathTool.Arc:
                    {
                        ArcLeftDown(x, y);
                    }
                    break;
                case PathTool.Bezier:
                    {
                        BezierLeftDown(x, y);
                    }
                    break;
                case PathTool.QBezier:
                    {
                        QBezierLeftDown(x, y);
                    }
                    break;
                case PathTool.Move:
                    {
                        _editor.Project.CurrentContainer.WorkingLayer.Invalidate();
                        _editor.Project.CurrentContainer.HelperLayer.Invalidate();
                    }
                    break;
            }

            if (_editor.CurrentPathTool == PathTool.Move)
            {
                _movePathTool = _previousPathTool;
            }

            _previousPathTool = _editor.CurrentPathTool;
        }