Example #1
0
        //CaptureWindowToFile
        /// Captures a screen shot of the entire desktop, and saves it to a file
        public void CaptureScreenToFile(string filename, ImageFormat format)
        {
            Image img = CaptureScreen();

            UFile.RemoveReadOnly(filename);
            img.Save(filename, format);
        }
Example #2
0
        public bool ActivateEngine(string engineName)
        {
            bool hasActivate = false;

            LoadXmlDocument();
            XmlElement root     = xmldoc.DocumentElement;
            XmlNode    itemNode = root.SelectNodes("/Engines").Item(0);

            for (int i = 1; i < itemNode.ChildNodes.Count; i++)
            {
                if (itemNode.ChildNodes[i].ChildNodes[0].InnerText == engineName)
                {
                    XmlNode itemChildNode = itemNode.ChildNodes[i];
                    itemChildNode.ChildNodes[4].InnerText = "True";
                    hasActivate = true;
                    break;
                }
            }
            UFile.RemoveReadOnly(Ap.FileEngineData);

            //xmldoc.Save(_filePath);
            string xmlContent = xmldoc.InnerXml;

            InfinityStreamsManager.WriteFile(Ap.FileEngineData, xmlContent);

            return(hasActivate);
        }
Example #3
0
        //CaptureWindow
        /// Captures a screen shot of a specific window, and saves it to a file
        public void CaptureWindowToFile(IntPtr handle, string filename, ImageFormat format)
        {
            Image img = CaptureWindow(handle);

            UFile.RemoveReadOnly(filename);
            img.Save(filename, format);
        }
        public void Save(string paramsFilePath)
        {
            UFile.RemoveReadOnly(paramsFilePath);
            MemoryStream memoryStream = new MemoryStream();

            EngineParameterData.WriteXml(memoryStream);
            InfinityStreamsManager.WriteStreamToFile(paramsFilePath, memoryStream);
            memoryStream.Close();

            Ap.ParametersFiles.Set(EngineName, paramsFilePath);
            Ap.ParametersFiles.Save();
        }
 public static void WriteStreamToFile(string filePath, MemoryStream memoryStream)
 {
     try
     {
         string fileContent = GetStreamsContent(memoryStream);
         UFile.RemoveReadOnly(filePath);
         WriteFile(filePath, fileContent);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public static void WriteRegularFile(string filePath, string fileContent)
 {
     try
     {
         UFile.RemoveReadOnly(filePath);
         StreamWriter writer = new StreamWriter(filePath, false);
         writer.Write(fileContent);
         writer.Close();
         writer = null;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public static void WriteFile(string filePath, string fileContent)
 {
     try
     {
         UFile.RemoveReadOnly(filePath);
         UZip.WriteZip(filePath, fileContent);
     }
     catch (Exception ex)
     {
         MessageForm.Show(ex, fileContent);
         TestDebugger.Instance.WriteLog(ex);
         TestDebugger.Instance.WriteLog(fileContent);
         throw ex;
     }
 }
Example #8
0
        public void SaveDefaultEngine(string engineFilePath)
        {
            LoadXmlDocument();

            XmlElement root     = xmldoc.DocumentElement;
            XmlNode    itemNode = root.SelectNodes("/Engines").Item(0);

            itemNode.ChildNodes[0].InnerText = engineFilePath;

            UFile.RemoveReadOnly(Ap.FileEngineData);
            //xmldoc.Save(_filePath);
            string xmlContent = xmldoc.InnerXml;

            InfinityStreamsManager.WriteFile(Ap.FileEngineData, xmlContent);

            CloseXmlDocument();
        }
        public static string ReadFromRegularFile(string filePath)
        {
            string fileContent = "";

            try
            {
                UFile.RemoveReadOnly(filePath);
                StreamReader reader = new StreamReader(filePath);
                fileContent = reader.ReadToEnd();
                reader.Close();
                reader = null;
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(fileContent);
        }
Example #10
0
        public bool AddEngineNode()
        {
            LoadXmlDocument();
            if (_engineObject.CheckEngineExistance(xmldoc) != true)
            {
                _engineObject.AddEngineNode(ref xmldoc);
                UFile.RemoveReadOnly(Ap.FileEngineData);

                string xmlContent = xmldoc.InnerXml;
                InfinityStreamsManager.WriteFile(Ap.FileEngineData, xmlContent);

                CloseXmlDocument();
                return(true);
            }
            else
            {
                CloseXmlDocument();
                return(false);
            }
        }
Example #11
0
        public void UpdateEnginePath(string engineName, string filePath)
        {
            LoadXmlDocument();
            XmlElement root     = xmldoc.DocumentElement;
            XmlNode    itemNode = root.SelectNodes("/Engines").Item(0);

            for (int i = 1; i < itemNode.ChildNodes.Count; i++)
            {
                if (itemNode.ChildNodes[i].ChildNodes[0].InnerText == engineName)
                {
                    XmlNode itemChildNode = itemNode.ChildNodes[i];
                    itemChildNode.ChildNodes[5].InnerText = filePath;
                    break;
                }
            }
            UFile.RemoveReadOnly(Ap.FileEngineData);
            string xmlContent = xmldoc.InnerXml;

            InfinityStreamsManager.WriteFile(Ap.FileEngineData, xmlContent);
        }
        public static string ReadFromFile(string filePath)
        {
            string fileContent = "";

            try
            {
                UFile.RemoveReadOnly(filePath);
                //InfinityReader reader = new InfinityReader(filePath);
                //fileContent = reader.ReadToEnd();
                //reader.Close();
                //reader = null;

                fileContent = InfinityReader.ReadToEnd(filePath);
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(fileContent);
        }