Example #1
0
        public static String MakeRelative(String path, String fromPath)
        {
            List<String> pathComponents = new List<String>();

            if (fromPath == null)
            {
                return path;
            }

            /* Use FileSystemInfo to canonicalize paths, ensure fromPath ends in a trailing \ to fromPath. */
            path = new FileInfo(path).FullName;
            fromPath = new FileInfo(fromPath + @"\").FullName;

            if (fromPath.Equals(new FileInfo(path + @"\").FullName))
            {
                return ".";
            }

            /* Find the longest common base directory */
            String baseDirectory = null;

            for (int i = 0, lastSeparatorIdx = -1; ; i++)
            {
                if (i == path.Length || i == fromPath.Length || path[i] != fromPath[i])
                {
                    baseDirectory = (lastSeparatorIdx >= 0) ? path.Substring(0, lastSeparatorIdx + 1) : null;
                    break;
                }
                else if (path[i] == Path.DirectorySeparatorChar)
                {
                    lastSeparatorIdx = i;
                }
            }

            /* No common directories (on different drives), no relativization possible */
            if (baseDirectory == null)
            {
                return path;
            }

            /* Find the distance from the relativeFromPath to the baseDirectory */
            String fromRelativeToBase = fromPath.Substring(baseDirectory.Length);
            for (int i = 0; i < fromRelativeToBase.Length; i++)
            {
                if (fromRelativeToBase[i] == Path.DirectorySeparatorChar)
                {
                    pathComponents.Add("..");
                }
            }

            /* Add the path portion relative to the base */
            pathComponents.Add(path.Substring(baseDirectory.Length));

            return String.Join(new String(new char[] { Path.DirectorySeparatorChar }), pathComponents.ToArray());
        }
Example #2
0
        public static string CreateDocument(string path, bool refresh)
        {
            try {
                string filePath, extn, name;
                int    s = 0;

                if (Directory.Exists(path))
                {
                    while (System.IO.File.Exists(filePath = (path + @"\File" + (++s).ToString() + ".txt")))
                    {
                        ;
                    }
                }
                else
                {
                    extn = new System.IO.FileInfo(path).Extension;
                    name = new System.IO.FileInfo(path).Name;
                    name = name.Substring(0, name.LastIndexOf(extn));

                    if (System.IO.File.Exists(filePath = path))
                    {
                        while (System.IO.File.Exists(filePath = (path.Substring(0, path.LastIndexOf(name)) + name + " (" + (++s).ToString() + ")" + extn)))
                        {
                            ;
                        }
                    }
                }
                System.IO.File.Create(filePath).Close();
                if (refresh)
                {
                    LoadFiles(path);
                }
                return(filePath);
            } catch (Exception) { throw; }
        }
Example #3
0
        public static void INIT()
        {
            string path = new System.IO.FileInfo(System.Reflection.Assembly.GetExecutingAssembly().Location).DirectoryName;
            int    i    = path.IndexOf("MYLIVE");

            path     = path.Substring(0, i) + "MYLIVE\\";
            root     = path;
            data     = root + "DATA";
            test     = root + "TEST";
            outf     = root + "OUT";
            templ    = root + "TEMPLATES";
            _new     = root + "_NEW";
            _newd    = _new + "\\DOGANDCAT";
            _newf    = _new + "\\FRIENDS";
            _neww    = _new + "\\WORKOUT";
            _newb    = _new + "\\BOOK";
            _news    = _new + "\\SPORT";
            _newfood = _new + "\\FOOD";



            datad    = data + "\\PICTURES\\DOGANDCAT";
            datab    = data + "\\PICTURES\\BOOK";
            dataf    = data + "\\PICTURES\\FRIENDS";
            dataw    = data + "\\PICTURES\\WORKOUT";
            datas    = data + "\\PICTURES\\SPORT";
            datafood = data + "\\PICTURES\\FOOD";
            datat    = data + "\\PICTURES\\TRAVEL";


            imgProcessedFile = data + "\\parsed.txt";



            refs.Add(new refItem()
            {
                _type = "DOGANDCAT", newPass = PATH._newd, destinationPass = PATH.datad, htmlPath = ""
            });
            refs.Add(new refItem()
            {
                _type = "FRIENDS", newPass = PATH._newf, destinationPass = PATH.dataf, htmlPath = ""
            });
            refs.Add(new refItem()
            {
                _type = "WORKOUT", newPass = PATH._neww, destinationPass = PATH.dataw, htmlPath = ""
            });
            refs.Add(new refItem()
            {
                _type = "SPORT", newPass = PATH._news, destinationPass = PATH.datas, htmlPath = ""
            });
            refs.Add(new refItem()
            {
                _type = "FOOD", newPass = PATH._newfood, destinationPass = PATH.datafood, htmlPath = ""
            });
            refs.Add(new refItem()
            {
                _type = "BOOK", newPass = PATH._newb, destinationPass = PATH.datab, htmlPath = ""
            });
        }
Example #4
0
        static void Main( string[] args )
        {
            var outputDirPath = System.IO.Path.Combine( Application.StartupPath, "Output" );
            if( !Directory.Exists( outputDirPath ) )
            {
                try
                {
                    Directory.CreateDirectory( outputDirPath );
                }
                catch( Exception ex )
                {
                    Console.WriteLine( ex.Message );
                    Console.ReadKey();
                    return;
                }
            }
            foreach( var fn in Directory.GetFiles( Application.StartupPath, "PacketTemplate_*.dll" ) )
            {
                var asm = Assembly.LoadFile( fn );
                var t = Helpers.GetTemplate( asm );
                var shortfn = new FileInfo( fn ).Name;
                shortfn = shortfn.Substring( 0, shortfn.LastIndexOf( '.' ) );
                var path = System.IO.Path.Combine( outputDirPath, shortfn.Replace( ".", "_" ) );
                if( !Directory.Exists( path ) )
                {
                    try
                    {
                        Directory.CreateDirectory( path );
                    }
                    catch( Exception ex )
                    {
                        Console.WriteLine( ex.Message );
                        Console.ReadKey();
                        return;
                    }
                }

                var rtv = GenCPP.Gen( t, path, shortfn.Substring( "PacketTemplate_".Length ) );
                if( rtv != "" )
                {
                    Console.WriteLine( rtv );
                    Console.ReadKey();
                    return;
                }
            }
        }
Example #5
0
        public static void Gen()
        {
            var outputDirPath = @"..\Json";//System.IO.Path.Combine( Application.StartupPath, "Output" );
            if (!Directory.Exists(outputDirPath))
            {
                try
                {
                    Directory.CreateDirectory(outputDirPath);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                    Console.ReadKey();
                    return;
                }
            }
            foreach (var fn in Directory.GetFiles(AppDomain.CurrentDomain.BaseDirectory, "T_*.dll"))
            {
                var asm = Assembly.LoadFile(fn);
                var t = Helpers.GetTemplate(asm);
                var shortfn = new FileInfo(fn).Name;
                shortfn = shortfn.Substring(0, shortfn.LastIndexOf('.'));
                var path = outputDirPath;
                if (!Directory.Exists(path))
                {
                    try
                    {
                        Directory.CreateDirectory(path);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                        Console.ReadKey();
                        return;
                    }
                }

                var rtv = JsonGen.Gen(t, path, shortfn.Substring("T_".Length));
                if (rtv)
                {
                    Console.WriteLine(rtv.ToString());
                    Console.ReadKey();
                    return;
                }
            }
        }
Example #6
0
 public void Index()
 {
     Indexer indexer = new Indexer(new string[] { Environment.GetFolderPath(Environment.SpecialFolder.StartMenu) });
     Catalog catalog = new Catalog();
     List<string> items = indexer.Index();
     foreach (string item in items)
     {
         string name = new FileInfo(item).Name;
         catalog.Add(new CatalogItem() { Path = item, Name = name.Substring(0, name.Length - 4) });
     }
     _catalog = catalog;
     _catalog.Meta = new CatalogMeta { LastGenerated = DateTime.Now };
 }
 public void loadsave()
 {
     myspacenamelist = new SpaceNameDictionary();
     string[] files = System.IO.Directory.GetFiles(root, "*.❣");
     for (int i = 0; i < files.Length; i++)
     {
         string filetext = System.IO.File.ReadAllText(files[i]);
         string filename=new System.IO.FileInfo(files[i]).Name;
         string head = filename.Substring(0, filename.Length - 2);
         string body = filetext.Substring(filetext.IndexOf(head));
         SpaceName sn = new SpaceName(head, body);
         myspacenamelist.Add(sn);
     }
 }
 public List<Message> LoadMessagesFromFiles()
 {
     var result = new List<Message>();
     try
     {
         foreach (var fileName in Directory.GetFiles(ExecutablePath.ExecPath + folder, "*.txt"))
         {
             var shortName = new FileInfo(fileName).Name;
             var roomName = shortName.Substring(0, shortName.LastIndexOf(".txt"));
             lock (fileLock)
             {
                 using (var fs = new FileStream(fileName, FileMode.OpenOrCreate))
                 using (var sr = new StreamReader(fs))
                 {
                     var lineNumber = 0;
                     while (true)
                     {
                         var line = sr.ReadLine();
                         if (string.IsNullOrEmpty(line))
                             break;
                         var words = line.Split(new[] {"&#32;"}, StringSplitOptions.None);
                         if (words.Length < 4)
                         {
                             Logger.Error(string.Format("LoadMessagesFromFiles: format error: file: {0}, line: {1}", fileName, lineNumber));
                             lineNumber++;
                             continue;
                         }
                         var message = new Message
                             {
                                 TimeStamp = DateTime.Parse(words[0]),
                                 Sender = words[1].ToInt(),
                                 Room = roomName,
                                 Receiver = words[2].ToInt(),
                                 Text = words[3].Replace("&#10;", Environment.NewLine)
                             };
                         result.Add(message);
                         lineNumber++;
                     }
                 }
             }
         }
     }
     catch (Exception exception)
     {
         Logger.Info("ChatClientStorage.LoadMessagesFromFiles", exception);
     }
     return result;
 }
Example #9
0
 public InfoEFS(string fichero)
 {
     string b = fichero.Substring (0, fichero.LastIndexOf('.'));
     string c = fichero.Substring (fichero.LastIndexOf('.')+1);
     if (b==String.Empty){
         // TODO: Poner una excepcion personalizada.
         throw new Exception ("...");
     }
     string tmp = new FileInfo (fichero).Name;
     tmp = tmp.Substring (0, tmp.LastIndexOf('.'));
     nombreOriginal = tmp;
     string nf = c.Substring (0, c.LastIndexOf("_")).Trim();
     string f = c.Substring (c.LastIndexOf ("_") + 1).Trim();
     Fragmento = Convert.ToInt32 (f);
     totalFragmentos = Convert.ToInt32 (nf);
 }
Example #10
0
 /*метод, загружающий доступные исполняумые 
  * файлы из домашней директории проекта*/
 void LoadAvailableAssemblies()
 {
     //название файла сборки текущего приложения
     string except = new FileInfo(Application.ExecutablePath).Name;
     //получаем название файла без расширения
     except =  except.Substring(0, except.IndexOf("."));
     //получаем все *.exe файлы из домашней директории
     string[] files = Directory.GetFiles(Application.StartupPath, "*.exe");
     foreach (var file in files)
     {
         //получаем имя файла
         string fileName = new FileInfo(file).Name;
         /*если имя афйла не содержит имени исполняемого файла проекта, то оно добавляется в список*/
         if (fileName.IndexOf(except) == -1)
             AvailableAssemblies.Items.Add(fileName);
     }
 }
Example #11
0
 public static string[] GetDatasets(string root)
 {
   var subdirs = Directory.GetDirectories(root);
   Array.Sort(subdirs, delegate(string name1, string name2)
   {
     var n1 = new FileInfo(name1).Name;
     var n2 = new FileInfo(name2).Name;
     if (n1.StartsWith("GSE") && n2.StartsWith("GSE"))
     {
       return int.Parse(n1.Substring(3)).CompareTo(int.Parse(n2.Substring(3)));
     }
     else
     {
       return name1.CompareTo(name2);
     }
   });
   return subdirs;
 }
 private void button2_Click(object sender, EventArgs e)
 {
     try
     {
         OpenFileDialog op = new OpenFileDialog();
         op.ShowDialog();
         textBox3.Text = op.FileName;
         //ProjectData.creteProject(textBox3.Text, dir);
         string name = new FileInfo(op.FileName).Name;
         name = name.Substring(0, name.IndexOf("."));
         Directory.CreateDirectory(ProjectData.parent + dir + "/" + name);
         ProjectData.creteFile(textBox3.Text, dir + "/" + name);
         textBox1.Text = ProjectData.openTextFile(textBox3.Text, dir + "/" + name);
         ProjectData.loadProject(dir, treeView1);
     }
     catch
     {
         MessageBox.Show("Upload a file");
     }
 }
Example #13
0
File: ACCCxxx.cs Project: GregXP/XP
        public String GetHTML()
        {
            String email = Resource1.Email;
            try
            {
                String shortName = new FileInfo(Filename).Name;
                String typArq = shortName.Substring(shortName.IndexOf("ACCC"), 7);
                String sTypArq = Utils.GetTypArq(typArq);

                email = email.Replace(MAIL_NOMARQ, shortName);
                email = email.Replace(MAIL_TIPARQ, typArq + " - " + sTypArq);
                email = email.Replace(MAIL_TAMARQ, Tamanho.ToString("F2") + " MB");
                email = email.Replace(MAIL_PRO, shortName.Contains("PRO.xml") ? "Sim" : "N&atilde;o");

                StringBuilder sb = new StringBuilder();

                //header
                sb.AppendLine(String.Format(MAIL_LINHA_HDR, "Cabe&ccedil;alho"));
                foreach (KeyValuePair<String, String> dado in Header)
                {
                    String value = dado.Value;
                    if (!value.Equals(String.Empty))
                    {
                        sb.AppendLine(String.Format(MAIL_LINHADADO_HDR, dado.Key, dado.Value));
                    }
                }
                //body
                sb.AppendLine(String.Format(MAIL_LINHA_HDR, "Dados"));
                foreach (KeyValuePair<String, String> dado in Body)
                {
                    sb.AppendLine(String.Format(MAIL_LINHADADO, dado.Key, dado.Value));
                }
                email = email.Replace(MAIL_DADOSARQ, sb.ToString());
            }
            catch (Exception ex)
            {
                if (Utils._logger != null)
                    Utils._logger.Error("Erro ao construir o body do email." + ex.Message);
            }
            return email;
        }
        public void LoadAvailebleAssemblies()
        {
            try
            {
                string except = new FileInfo(Application.ExecutablePath).Name;

                except = except.Substring(0, except.IndexOf("."));
                string[] files = Directory.GetFiles(Application.StartupPath, "*.exe");
                foreach (var file in files)
                {
                    string fileName = new FileInfo(file).Name;
                    if (fileName.IndexOf(except) == -1)
                    {
                        AvailebleAssemblies.Items.Add(fileName);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #15
0
    // TODO! generate at buildtime
    private static List <string> GenerateWorldList()
    {
        _Worlds = new List <string>();

        string world  = "World";
        string ending = ".unity";

        foreach (UnityEditor.EditorBuildSettingsScene scene in UnityEditor.EditorBuildSettings.scenes)
        {
            if (scene.enabled)
            {
                string name = new System.IO.FileInfo(scene.path).Name;
                name = name.Substring(0, name.Length - ending.Length);

                if (0 == string.Compare(name, name.Length - world.Length, world, 0, world.Length))
                {
                    _Worlds.Add(name);
                }
            }
        }

        return(_Worlds);
    }
Example #16
0
        public static JoinInfo GetFromFile(string fichero)
        {
            JoinInfo info = new JoinInfo ();
            info.Directory = new FileInfo (fichero).Directory;
            string original = new FileInfo (fichero).Name;
            string extensionParte = original.Substring (original.LastIndexOf (".")+1);
            info.BaseName = original.Substring (0, original.LastIndexOf ('.') + 1);
            info.OriginalFile = original.Substring (0, original.LastIndexOf ('.'));

            // Soporte ultrasplit
            if (extensionParte.StartsWith ("u")) {
                info.BaseName = original.Substring (0, original.LastIndexOf ('.') + 2);
            }
            info.Digits = original.Length - info.BaseName.Length;

            if (File.Exists (info.Directory.FullName + Path.DirectorySeparatorChar + info.BaseName + UtilidadesCadenas.Format (0, info.Digits)))
            {
                info.InitialFragment = 0;
            }
            else if (File.Exists (info.Directory.FullName + Path.DirectorySeparatorChar + info.BaseName  + UtilidadesCadenas.Format (1, info.Digits)))
            {
                info.InitialFragment = 1;
            }
            else {
                return null;
            }
            int contador = 1;

            while (File.Exists (info.GetFragmentFullPath (contador)))
            {
                FileInfo fi = new FileInfo (info.GetFragmentFullPath (contador));
                info.Length += fi.Length;
                contador++;
            }
            info.FragmentsNumber = contador - 1;

            // Comprobar cutkiller
            if (info.InitialFragment == 1 && info.Digits == 3)
            {
                byte[] buffer = UtilidadesFicheros.LeerSeek (info.GetFragmentFullPath(1), 0, 8);
                string extension = UtArrays.LeerTexto (buffer, 0, 3);
                string fragmentos = UtArrays.LeerTexto (buffer, 3, 5);
                if (extension.Length > 0 && fragmentos.Length == 5)
                {
                    if (
                        Char.IsWhiteSpace (fragmentos[0]) &&
                        Char.IsWhiteSpace (fragmentos[1]) &&
                        Char.IsDigit (fragmentos[2]) &&
                        Char.IsDigit (fragmentos[3]) &&
                        Char.IsDigit (fragmentos[4]) &&
                        Int32.Parse (fragmentos.Trim ()) == info.FragmentsNumber

                    )
                    {
                        info.IsCutKiller = true;
                        info.OriginalFile = info.OriginalFile + "." + extension;
                        info.Length -= 8;
                    }
                }
            }
            info.CalculateLength();
            return info;
        }
Example #17
0
        /// <summary> Returns true if the directory path (not including a filename) is valid.
        /// 
        /// </summary>
        /// <param name="context">The validation context.</param>
        /// <param name="input">The directory to validate.</param>        
        /// <returns>Boolean value indicating whether the data is valid.</returns>
        /// <seealso cref="Owasp.Esapi.Interfaces.IValidator.GetValidDirectoryPath(string, string, bool)">
        /// </seealso>
        public string GetValidDirectoryPath(string context, string input, bool allowNull)
        {
            String canonical = "";
              try {
            if (IsEmpty(input)) {
              if (allowNull) return null;
              throw new ValidationException(context + " is required", "(" + context + ") input is required");
            }

            canonical = Esapi.Encoder().Canonicalize(input);

            // do basic validation
            Regex directoryNamePattern = ((SecurityConfiguration)Esapi.SecurityConfiguration()).GetValidationPattern("DirectoryName");
            if (!directoryNamePattern.Match(canonical).Success) {
              throw new ValidationException(context + " is an invalid directory name", "Attempt to use a directory name (" + canonical + ") that violates the global rule in ESAPI.properties (" + directoryNamePattern.ToString() + ")");
            }

            // get the canonical path without the drive letter if present
            String cpath = new FileInfo(canonical).Name.Replace("\\\\", "/");
            String temp = cpath.ToLower();
            if (temp.Length >= 2 && temp[0] >= 'a' && temp[0] <= 'z' && temp[1] == ':') {
              cpath = cpath.Substring(2);
            }

            // prepare the input without the drive letter if present
            String escaped = canonical.Replace("\\\\", "/");
            temp = escaped.ToLower();
            if (temp.Length >= 2 && temp[0] >= 'a' && temp[0] <= 'z' && temp[1] == ':') {
              escaped = escaped.Substring(2);
            }

            // the path is valid if the input matches the canonical path
            if (!escaped.Equals(cpath.ToLower())) {
              throw new ValidationException(context + " is an invalid directory name", "The input path does not match the canonical path (" + canonical + ")");
            }
              } catch (IOException e) {
            throw new ValidationException(context + " is an invalid directory name", "Attempt to use a directory name (" + canonical + ") that does not exist");
              } catch (EncodingException ee) {
            throw new IntrusionException(context + " is an invalid directory name", "Exception during directory validation", ee);
              }
              return canonical;
        }
Example #18
0
 private static string GetUserName(string filePath)
 {
     var name = new FileInfo(filePath).Name;
     return name.Substring(0, name.Length - 4);
 }
        public async Task<bool> AddProjectInclude(string containerDirectory, string scriptFile = null)
        {
            if (!Project.Saved)
            {
                var saveDialogResult = MessageBox.Show(_ownerWindow, "Save pending changes to solution?",
                    "Save pending changes", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (saveDialogResult == DialogResult.OK || saveDialogResult == DialogResult.Yes)
                    _dte.SaveAll();
            }
            if (!Project.Saved || string.IsNullOrEmpty(Project.FullName))
            {
                var saveDialogResult = MessageBox.Show(_ownerWindow, "Pending changes need to be saved. Please save the project before adding project imports, then retry.", "Save first",
                    MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk);
                if (saveDialogResult != DialogResult.Cancel) _dte.SaveAll();
                return false;
            }
            _logger.LogInfo("Begin adding project import file");
            if (string.IsNullOrWhiteSpace(containerDirectory))
                containerDirectory = Project.GetDirectory();

            if (string.IsNullOrWhiteSpace(scriptFile))
            {
                _logger.LogInfo("Prompting for file name");
                var dialog = new AddBuildScriptNamePrompt(containerDirectory, ".targets")
                {
                    HideInvokeBeforeAfter = true
                };
                var dialogResult = dialog.ShowDialog(VsEnvironment.OwnerWindow);
                if (dialogResult == DialogResult.Cancel) return false;
                scriptFile = dialog.FileName;
                _logger.LogInfo("File name chosen: " + scriptFile);
                dialogResult = MessageBox.Show(_ownerWindow, @"        !! IMPORTANT !!

You must not move, rename, or remove this file once it has been added to the project. By adding this file you are extending the project file itself. If you must change the filename or location, you must update the project XML directly where <Import> references it.",
                    "This addition is permanent", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
                if (dialogResult == DialogResult.Cancel) return false;
            }
            var scriptFileName = scriptFile;
            if (!scriptFile.Contains(":") && !scriptFile.StartsWith("\\\\"))
                scriptFile = Path.Combine(containerDirectory, scriptFile);
            var scriptFileRelativePath = FileUtilities.GetRelativePath(Project.GetDirectory(), scriptFile);
            var scriptFileShortName = new FileInfo(scriptFile).Name;
            if (scriptFileShortName.Contains("."))
                scriptFileShortName = scriptFileShortName.Substring(0, scriptFileShortName.LastIndexOf("."));

            if (Project == null) return false;

            File.WriteAllText(scriptFile, @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
    <Target Name=""" + scriptFileShortName + @"""><!-- consider adding attrib BeforeTargets=""Build"" or AfterTargets=""Build"" -->

        <!-- my tasks here -->
        <Message Importance=""high"" Text=""" + scriptFileShortName + @".targets output: ProjectGuid = $(ProjectGuid)"" />

    </Target>
</Project>");
            var projRoot = Project.GetProjectRoot();
            var import = projRoot.AddImport(scriptFileRelativePath);
            import.Condition = "Exists('" + scriptFileRelativePath + "')";
            Project = await Project.SaveProjectRoot();
            var addedItem = Project.ProjectItems.AddFromFile(scriptFile);
            addedItem.Properties.Item("ItemType").Value = "None";
            _logger.LogInfo("Project include file added to project: " + scriptFileName);
            Task.Run(() =>
            {
                System.Threading.Thread.Sleep(250);
                _dte.ExecuteCommand("File.OpenFile", "\"" + scriptFile + "\"");
            });
            return true;
        }
Example #20
0
 private static string GetMapName(string file)
 {
     var name = new FileInfo(file).Name;
     return name.Substring(0, name.IndexOf(".txt", StringComparison.OrdinalIgnoreCase));
 }
Example #21
0
        static void RegisterFile(string path)
        {
            var      fileName = new System.IO.FileInfo(path).Name;
            string   animName;
            bool     hasAlphaKey;
            AnimType animType;

            if (fileName.StartsWith("build_char_"))
            {
                animType = AnimType.Build;
                var nameWithExtension = fileName.Substring(15);
                animName = nameWithExtension.Substring(0, nameWithExtension.IndexOf('.'));
            }
            else if (fileName.StartsWith("char_"))
            {
                animType = AnimType.Fight;
                var nameWithExtension = fileName.Substring(9);
                animName = nameWithExtension.Substring(0, nameWithExtension.IndexOf('.'));
            }
            else
            {
                return;
            }

            hasAlphaKey = animName.Contains("[alpha]");
            animName    = animName.Replace("[alpha]", "");
            if (animName.IndexOf('#') >= 0)
            {
                animName = animName.Substring(0, animName.IndexOf('#'));
            }
            animName = animName.Replace(" ", "");

            if (!_fileDictionary.ContainsKey(animName))
            {
                _fileDictionary[animName] = new List <FileInfo>();
            }

            var fileExtensions = path.Split('.');


            if (fileExtensions[fileExtensions.Length - 1] == "png")
            {
                _fileDictionary[animName].Add(new FileInfo {
                    path = path, fileType = hasAlphaKey ? FileType.AlphaImage : FileType.Image, animType = animType
                });
            }
            else if (fileExtensions[fileExtensions.Length - 1] == "txt")
            {
                if (fileExtensions[fileExtensions.Length - 2].StartsWith("skel"))
                {
                    _fileDictionary[animName].Add(new FileInfo {
                        path = path, fileType = FileType.Skel, animType = animType
                    });
                }
                else if (fileExtensions[fileExtensions.Length - 2].StartsWith("atlas"))
                {
                    _fileDictionary[animName].Add(new FileInfo {
                        path = path, fileType = FileType.Atlas, animType = animType
                    });
                }
            }
        }
Example #22
0
        static void ExtractTPose()
        {
            var selectedObjects = Selection.objects;
            if (selectedObjects.Length > 0)
            {
                bool extracted = false;
                foreach (var selectedObject in selectedObjects)
                {
                    var assetPath = AssetDatabase.GetAssetPath(selectedObject);

                    if (!string.IsNullOrEmpty(assetPath))
                    {
                        // Get asset path directory
                        var assetDirectory = new FileInfo(assetPath).Directory.FullName + Path.DirectorySeparatorChar + "TPoses";

                        // Trim off the path at "Assets" to get the relative path to the assets directory
                        assetDirectory = assetDirectory.Substring(assetDirectory.IndexOf("Assets"));

                        var modelImporter = AssetImporter.GetAtPath(assetPath) as ModelImporter;
                        if( modelImporter != null )
                        {
                            var asset = UmaTPose.CreateInstance<UMA.UmaTPose>();
                            asset.ReadFromHumanDescription(modelImporter.humanDescription);
                            var name = selectedObject.name;
                            if (name.EndsWith("(Clone)"))
                            {
                                name = name.Substring(0, name.Length - 7);
                                asset.boneInfo[0].name = name;
                                asset.Serialize();
                            }
                            if (!Directory.Exists(assetDirectory))
                                Directory.CreateDirectory(assetDirectory);
                            try
                            {
                                AssetDatabase.CreateAsset(asset, assetDirectory + Path.DirectorySeparatorChar + name + "_TPose.asset");
                            }
                            catch (UnityException e)
                            {
                                Debug.Log(e.ToString());
                            }
                            extracted = true;
                        }
                    }
                }
                if (extracted)
                {
                    AssetDatabase.SaveAssets();
                    return;
                }
            }

            foreach (var animator in Transform.FindObjectsOfType(typeof(Animator)) as Animator[])
            {
                var asset = UmaTPose.CreateInstance<UmaTPose>();
                asset.ReadFromTransform(animator);
                var name = animator.name;
                if (name.EndsWith("(Clone)"))
                {
                    name = name.Substring(0, name.Length - 7);
                    asset.boneInfo[0].name = name;
                    asset.Serialize();
                }
                if (!Directory.Exists("Assets/UMA/UMA_Assets/TPoses"))
                    Directory.CreateDirectory("Assets/UMA/UMA_Assets/TPoses");
                AssetDatabase.CreateAsset(asset, "Assets/UMA/UMA_Assets/TPoses/" + name + "_TPose.asset");
                EditorUtility.SetDirty(asset);
                AssetDatabase.SaveAssets();
            }
        }
Example #23
0
 public void DeleteFile()
 {
     if (string.IsNullOrEmpty(SavePath))
         return;
     if (Directory.Exists(SavePath))
     {
        string[] strArr= Directory.GetFiles(SavePath);
        string mHour = DateTime.Now.ToString("HH");
        foreach (string str in strArr)
        {
            try
            {
                string FileName = new FileInfo(str).Name;
                if (FileName.Substring(0, 2) != mHour)
                {
                    File.Delete(str);
                }
            }
            catch
            {
                break;
            }
        }
     }
 }
Example #24
0
        public bool C_SendFiles(List<string[]> filePaths,ref Utilities.UpdateInfo notify)
        {
            /* UpdateInfo[0] = Cancel/Complate - bool
             * UpdateInfo[1] = ProgreeBarFiles Max Value - int
             * UpdateInfo[2] = ProgreeBarFiles Value - int
             * UpdateInfo[3] = ProgreeBarFile Max Value - int
             * UpdateInfo[4] = ProgreeBarFile Value - int
             */

            notify.SetValue(1, filePaths.Count);

            byte[] Buffers;
            Socket Sok = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            string contains = string.Empty;
            foreach (string[] item in filePaths)
            {
                //item[0] = client filename ; item[1] = server filename
                contains += new FileInfo(item[0]).Length + ";" + item[1] + ";";
            }
            contains = contains.Substring(0, contains.Length - 1);
            Buffers = GetCmd(OpCodeProcess.C_SendFiles, contains);

            Sok.Connect(config.IP, config.PORT);
            if (Sok.Connected == true)
            {
                Sok.Send(Buffers, Buffers.Length, SocketFlags.None);
            }

            Sok.Receive(Buffers, SocketFlags.None);
            if (Buffers[0] != (byte)OpCodeProcess.S_OK)
                throw new Exception("Server Refuse");

            int readed = 0;
            Buffers = new byte[4097];
            foreach (string[] item in filePaths)
            {
                FileStream fs = File.OpenRead(item[0]);
                
                notify.SetValue(3, fs.Length);
                notify.SetValue(4, 0);
                
                for (int i = 0; i < fs.Length; )
                {
                    readed = fs.Read(Buffers, 0, Buffers.Length - 1);
                    Sok.Send(Buffers, readed, SocketFlags.None);
                    i += readed;
                    notify.SetValue(4, Convert.ToInt32(notify.GetValue(4)) + readed);// File progress value
                }
                fs.Flush(); fs.Close(); fs.Dispose();
                notify.SetValue(2, Convert.ToInt32(notify.GetValue(2)) + 1);// Files progress value
            }
            return true;
        }
Example #25
0
 //压缩文件夹
 private void ZipFloder(string _OfloderPath, ZipOutputStream zos, string _floderPath)
 {
     foreach (FileSystemInfo item in new DirectoryInfo(_floderPath).GetFileSystemInfos())
     {
         if (Directory.Exists(item.FullName))
         {
             ZipFloder(_OfloderPath, zos, item.FullName);
         }
         else if (File.Exists(item.FullName))//如果是文件
         {
             DirectoryInfo ODir = new DirectoryInfo(_OfloderPath);
             string fullName2 = new FileInfo(item.FullName).FullName;
             string path = ODir.Name + fullName2.Substring(ODir.FullName.Length, fullName2.Length - ODir.FullName.Length);//获取相对目录
             FileStream fs = File.OpenRead(fullName2);
             byte[] bts = new byte[fs.Length];
             fs.Read(bts, 0, bts.Length);
             ZipEntry ze = new ZipEntry(path);
             zos.PutNextEntry(ze);             //为压缩文件流提供一个容器
             zos.Write(bts, 0, bts.Length);  //写入字节
         }
     }
 }
Example #26
0
        private void GetSelectedText()
        {
            int activeWinPtr = GetForegroundWindow().ToInt32();
               int activeThreadId = 0, processId;
               activeThreadId = GetWindowThreadProcessId(activeWinPtr, out processId);
               int currentThreadId = GetCurrentThreadId();
               //String prev = txtCmdLine.Text;
               if (activeThreadId != currentThreadId)
               {
               AttachThreadInput(activeThreadId, currentThreadId, true);
               SendCtrlC();
               System.Threading.Thread.Sleep(10);
               AttachThreadInput(activeThreadId, currentThreadId, false);
               ShowHide();
               if (Clipboard.ContainsText())
               {
                        HandleCmd(CmdInvoker.InvokeCommand("a "+Clipboard.GetText().Replace(Environment.NewLine," ")));
               }
               else if (Clipboard.ContainsFileDropList())
               {
                   for (int i = 0; i < Clipboard.GetFileDropList().Count; i++)
                   {
                       GGResult r;
                       String f = new FileInfo(Clipboard.GetFileDropList()[i]).Name;
                       if (f.Contains('.')) f = f.Substring(0, f.LastIndexOf('.'));
                       r = CmdInvoker.InvokeCommand("a \"" + f + "\"");
                       GGItem gg = CmdInvoker.GetGGList().GetGGItemAt(r.GetItemIndex());
                       HandleCmd(r);
                       HandleCmd(CmdInvoker.InvokeCommand("pin " + (CmdInvoker.GetGGList().IndexOfGGItem(gg) + 1) + " " + Clipboard.GetFileDropList()[i]));

                   }
               }
               //if (txtCmdLine.Text.Equals("a ")) txtCmdLine.Text = prev;
               }
        }
Example #27
0
        private static IEnumerable<int[]> GetUniqueCartesianProduct(string testName)
        {
            var files = Directory.GetFiles(string.Format(@"D:\test\MUTEX\CompleteComparison\sources\{0}", testName),
                                           @"main.c", SearchOption.AllDirectories).Select(p =>
                                                                                              {
                                                                                                  var dn =
                                                                                                      new FileInfo(p).
                                                                                                          DirectoryName;
                                                                                                  return
                                                                                                      Int32.Parse(
                                                                                                          dn.Substring(
                                                                                                              dn.LastIndexOf(
                                                                                                                  '\\') + 1));
                                                                                              }).ToList();

            var cp = from first in files
                     from second in files
                     orderby first , second
                     select new[] {first, second};

            var cartesianProduct = cp.Where(elem => elem[0] < elem[1]).ToList();
            return cartesianProduct;
        }
Example #28
0
 private void InitIcons(string text,string filename,string iconname,int index)
 {
     ListViewItem lvi = listView1.Items.Add(text);
     lvi.Tag = new FileInfo(filename).FullName;
     string ext = new FileInfo(filename).Extension;
     //MessageBox.Show(ext);
     Image ico = InitExtIcon(ext, iconname,index);
     if (ico != null && imageList2.Images.Keys.IndexOf(ext.ToLower() != ".exe" ? ext.Substring(1) : (iconname + "_" + index.ToString())) == -1)
     {
         imageList2.Images.Add(ext.ToLower() != ".exe" ? ext.Substring(1) : (iconname+"_"+index.ToString()), ico);
     }
     if (ext == "" || imageList2.Images.Keys.IndexOf(ext.ToLower() != ".exe" ? ext.Substring(1) : (iconname + "_" + index.ToString())) == -1)
     {
         lvi.ImageKey = "file";
     }
     else
     {
         lvi.ImageKey = ext.ToLower() != ".exe" ? ext.Substring(1) : (iconname + "_" + index.ToString());
     }
     listView1.DoubleClick += listView1_DoubleClick;
 }
Example #29
0
 public void Initialize()
 {
     foreach (var fileName in Directory.GetFiles("./Input", "*.sc"))
     {
         string caseName = new FileInfo(fileName).Name;
         caseName = caseName.Substring(0, caseName.Length - 3);
         string input = File.ReadAllText(string.Format("./Input/{0}.sc", caseName));
         string result = File.ReadAllText(string.Format("./Result/{0}.cpp", caseName));
         this.source[caseName] = new TestCase(input, result);
     }
 }
Example #30
0
        /*
         * see http://www.topografix.com/GPX/1/0 for more info
         *
         * Validating your GPX document
                Validation is done using the Xerces XML parser. Download the latest Xerces distribution from the Apache website.
                 Windows users should download the "Latest Xerces-C++ Binary Package for Windows". Unzip the files, and locate the
                 SAXCount.exe program in the bin folder. This is a command-line utility that will validate your GPX file.

            Assuming your GPX file is named my_gpx_file.gpx, and is located in the same folder as SaxCount.exe, use the following
             command line to validate your file:

                    SaxCount.exe -v=always -n -s -f test.gpx

            If your file validates successfully, SAXCount will display a count of the elements in your file, like the following:

                    test.gpx: 1012 ms (4025 elems, 1916 attrs, 8048 spaces, 36109 chars)

            Any other output from SAXCount.exe indicates that your GPX file is incorrect. It is your responsibility to ensure that any GPX files you create validate successfully against the GPX schema.
         */
        public void doWrite()
        {
            string diag = "Selected format: " + m_selectedFormat + "\r\n\r\n";
            trkpointCount = 0;
            waypointCount = 0;
            // could be "new DateTimeFormatInfo().UniversalSortableDateTimePattern;" - but it has space instead of 'T'

            messageBoxDirty = true;
            messageTextBox.Text = diag;

            try
            {
                if(m_selectedFormat.Equals(FileStreetsTripsCsv.FormatName))
                {
                    hasSaved = FileAndZipIO.saveCsv(m_selectedFileName, m_tracks, m_saveTracks,
                        m_waypoints, m_saveWaypoints, out waypointCount, out trkpointCount);
                }
                else if(m_selectedFormat.Equals(FileEasyGps.FormatName))
                {
                    int tracksCount;
                    hasSaved = FileAndZipIO.saveGpx(m_selectedFileName, m_tracks, m_saveTracks,
                        m_waypoints, m_saveWaypoints, out waypointCount, out trkpointCount, out tracksCount);

                    // try suggesting JPEG correlation here, if the folder has any .JPG files
                    if(tracksCount > 0)
                    {
                        bool hasJpegs = false;
                        try
                        {
                            FileInfo fi = new FileInfo(m_selectedFileName);
                            DirectoryInfo di = fi.Directory;
                            foreach(FileInfo fii in di.GetFiles())
                            {
                                if(fii.Name.ToLower().EndsWith(".jpg"))
                                {
                                    hasJpegs = true;
                                    break;
                                }
                            }
                        }
                        catch
                        {
                        }
                        if(hasJpegs)
                        {
                            string message = "The folder you selected contains images\r\n\r\nDo you want to relate them to trackpoints?";
                            if(Project.YesNoBox(this, message))
                            {
                                Project.photoFileName = m_selectedFileName;
                                Project.pmLastTabMode = 0;
                                DlgPhotoManager dlg = new DlgPhotoManager(0);
                                dlg.setImportButtonsAgitated();
                                dlg.ShowDialog();
                            }
                        }
                    }
                }
                else if(m_selectedFormat.Equals(FileKml.FormatName))
                {
                    string name = new FileInfo(m_selectedFileName).Name;

                    name = name.Substring(0, name.Length - FileKml.FileExtension.Length);

                    GoogleEarthManager.saveTracksWaypoints(
                        m_selectedFileName, name, m_tracks, m_saveTracks,
                        m_waypoints, m_saveWaypoints, out waypointCount, out trkpointCount
                    );
                }
                else
                {
                    messageTextBox.Text = "Error: format " + m_selectedFormat + " not supported for writing.";
                    LibSys.StatusBar.Error("FileExportForm:doWrite() format " + m_selectedFormat + " not supported for writing.");
                    return;
                }

                WaypointsCache.isDirty = false;

                if(waypointCount > 0 || trkpointCount > 0)
                {
                    diag += "OK: " + waypointCount + " waypoints and " + trkpointCount + " legs saved to file.";
                    messageTextBox.ForeColor = Color.Black;

                    FileInfo fi = new FileInfo(Project.GetLongPathName(m_selectedFileName));
                    FormattedFileDescr fd = new FormattedFileDescr(fi.FullName, m_selectedFormat, persistCheckBox.Checked);
                    Project.FileDescrListAdd(fd);

                    if(!m_selectedFormat.Equals(FileKml.FormatName))	// can't read back kmz
                    {
                        Project.insertRecentFile(fi.FullName);
                    }
                }
                else
                {
                    diag += "Error: failed to save to file (0 waypoints, 0 legs).";
                    messageTextBox.ForeColor = Color.Red;
                }

                messageTextBox.Text = diag;
            }
            catch (Exception e)
            {
                LibSys.StatusBar.Error("FileExportForm:doWrite() " + e); //.Message);
                messageTextBox.Text = diag + e.Message;
                messageTextBox.ForeColor = Color.Red;
            }
        }
Example #31
0
 private void GetImageName(string imagePath) {
   var imageName=new FileInfo(imagePath).Name;
   var imageNameShortened=imageName.Substring(0, imageName.Length-4);
   _globalParametersService.GlobalSettings.ImageName=imageNameShortened;
 }
Example #32
0
        public static void ReadExcelData()
        {
            var dbContext = new SupermarketContext();
            using (dbContext)
            {
                string[] subDirs;
                subDirs = Directory.GetDirectories(@"../../../../Reports/Sample-Sales-Extracted Files");
                foreach (var dir in subDirs)
                {
                    string[] files = Directory.GetFiles(dir);
                    //Console.WriteLine("Directory: " + dir);
                    //Console.WriteLine("Files:");
                    for (int i = 0; i < files.Length; i++)
                    {
                        string fileName = new FileInfo(files[i]).Name;
                        int length =fileName.Length;
                        DateTime date = Convert.ToDateTime(fileName.Substring(0 + length - 15,11));
                        //Console.WriteLine("{0:dd-MM-yyyy}",date);
                        string currentFilePath = (dir + @"\" + new FileInfo(files[i]).Name);
                        string connectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;" +
                         "Data Source=" + currentFilePath + ";Persist Security Info=False";

                        OleDbConnectionStringBuilder conString = new OleDbConnectionStringBuilder(connectionString);
                        conString.Add("Extended Properties", "Excel 12.0 Xml;HDR=YES");

                        OleDbConnection dbConn = new OleDbConnection(conString.ConnectionString);

                        dbConn.Open();
                        using (dbConn)
                        {
                            DataTable dataSet = new DataTable();
                            string selectSql = @"SELECT * FROM [Sales$]";
                            OleDbDataAdapter adapter = new OleDbDataAdapter(selectSql, dbConn);
                            adapter.Fill(dataSet);

                            int rows = dataSet.Rows.Count;
                            string location = dataSet.Rows[0].ItemArray[0].ToString();
                            // Console.WriteLine("Company name: " + location);
                            for (int row = 2; row < rows - 2; row++)
                            {
                                Sale currentSale = new Sale();
                                Location currentLocation = new Location();
                                // currentLocation.Name = location;
                                dbContext.Locations.Add(currentLocation);
                                currentSale.Location = currentLocation;
                                int productID = Convert.ToInt32(dataSet.Rows[row].ItemArray[0]);
                                var product = from p in dbContext.Products
                                              where p.ID == productID
                                              select p;
                                Product currentProduct = product.First();
                                // Console.WriteLine("productID = "+productID);
                                
                                currentSale.Quantity = Convert.ToInt32(dataSet.Rows[row].ItemArray[1]);
                                currentSale.UnitPrice = Convert.ToDecimal(dataSet.Rows[row].ItemArray[2]);
                                currentSale.Sum = Convert.ToDecimal(dataSet.Rows[row].ItemArray[3]);
                                currentSale.Date = date;
                                currentSale.Product = currentProduct;
                                //Console.WriteLine(currentSale.Location.Name + " " + currentSale.Sum);
                                dbContext.Sales.Add(currentSale);
                                // dbContext.Products.Add(currentProduct);
                               dbContext.SaveChanges();
                            }

                        }
                    }

                }
            }
        }
Example #33
0
        public ConverterTXT(string arquivo)
        {
            Auxiliar oAux = new Auxiliar();

            NFe.ConvertTxt.ConversaoTXT oUniTxtToXml = new NFe.ConvertTxt.ConversaoTXT();

            string pasta = new FileInfo(arquivo).DirectoryName;
            pasta = pasta.Substring(0, pasta.Length - 5); //Retirar a pasta \Temp do final - Wandrey 03/08/2011

            string ccMessage = string.Empty;
            string ccExtension = "-nfe.err";

            try
            {
                int emp = Empresas.FindEmpresaByThread();

                ///
                /// exclui o arquivo de erro
                /// 
                Functions.DeletarArquivo(Empresas.Configuracoes[emp].PastaXmlRetorno + "\\" + Path.GetFileName(Functions.ExtrairNomeArq(arquivo, Propriedade.ExtEnvio.Nfe_TXT) + ccExtension));
                Functions.DeletarArquivo(Empresas.Configuracoes[emp].PastaXmlRetorno + "\\" + Path.GetFileName(Functions.ExtrairNomeArq(arquivo, Propriedade.ExtEnvio.Nfe_TXT) + "-nfe-ret.xml"));
                Functions.DeletarArquivo(Empresas.Configuracoes[emp].PastaXmlErro + "\\" + Path.GetFileName(arquivo));
                ///
                /// exclui o arquivo TXT original
                /// 
                Functions.DeletarArquivo(Empresas.Configuracoes[emp].PastaXmlRetorno + "\\" + Path.GetFileNameWithoutExtension(arquivo) + "-orig.txt");

                ///
                /// processa a conversão
                /// 
                oUniTxtToXml.Converter(arquivo, pasta);//Empresas.Configuracoes[emp].PastaRetorno);

                //Deu tudo certo com a conversão?
                if (string.IsNullOrEmpty(oUniTxtToXml.cMensagemErro))
                {
                    ///
                    /// danasa 8-2009
                    /// 
                    if (oUniTxtToXml.cRetorno.Count == 0)
                    {
                        ccMessage = "cStat=02\r\n" +
                            "xMotivo=Falha na conversão. Sem informações para converter o arquivo texto";

                        oAux.MoveArqErro(arquivo, ".txt");
                    }
                    else
                    {
                        //
                        // salva o arquivo texto original
                        //
                        if (pasta.ToLower().Equals(Empresas.Configuracoes[emp].PastaXmlEnvio.ToLower()) || pasta.ToLower().Equals(Empresas.Configuracoes[emp].PastaValidar.ToLower()))
                        {
                            FileInfo ArqOrig = new FileInfo(arquivo);

                            string vvNomeArquivoDestino = Empresas.Configuracoes[emp].PastaXmlRetorno + "\\" + Path.GetFileNameWithoutExtension(arquivo) + "-orig.txt";
                            ArqOrig.MoveTo(vvNomeArquivoDestino);
                        }
                        ccExtension = "-nfe.txt";
                        ccMessage = "cStat=01\r\n" +
                            "xMotivo=Convertido com sucesso. Foi(ram) convertida(s) " + oUniTxtToXml.cRetorno.Count.ToString() + " nota(s) fiscal(is)";

                        foreach (NFe.ConvertTxt.txtTOxmlClassRetorno txtClass in oUniTxtToXml.cRetorno)
                        {
                            ///
                            /// monta o texto que será gravado no arquivo de aviso ao ERP
                            /// 
                            ccMessage += Environment.NewLine +
                                    "Nota fiscal: " + txtClass.NotaFiscal.ToString("000000000") +
                                    " Série: " + txtClass.Serie.ToString("000") +
                                    " - ChaveNFe: " + txtClass.ChaveNFe;

                            // move o arquivo XML criado na pasta Envio\Convertidos para a pasta Envio
                            // ou
                            // move o arquivo XML criado na pasta Validar\Convertidos para a pasta Validar
                            string nomeArquivoDestino = Path.Combine(pasta, Path.GetFileName(txtClass.XMLFileName));
                            Functions.Move(txtClass.XMLFileName, nomeArquivoDestino);

                            Functions.DeletarArquivo(Empresas.Configuracoes[emp].PastaXmlErro + "\\" + txtClass.ChaveNFe + Propriedade.ExtEnvio.Nfe);
                        }
                    }
                }
                else
                {
                    ///
                    /// danasa 8-2009
                    /// 
                    ccMessage = "cStat=99\r\n" +
                        "xMotivo=Falha na conversão\r\n" +
                        "MensagemErro=" + oUniTxtToXml.cMensagemErro;
                }
            }
            catch (Exception ex)
            {
                ccMessage = ex.Message;
                ccExtension = "-nfe.err";
            }

            if (!string.IsNullOrEmpty(ccMessage))
            {
                oAux.MoveArqErro(arquivo, ".txt");

                if (ccMessage.StartsWith("cStat=02") || ccMessage.StartsWith("cStat=99"))
                {
                    ///
                    /// exclui todos os XML gerados na pasta Envio\convertidos somente se houve erro na conversão
                    /// 
                    foreach (NFe.ConvertTxt.txtTOxmlClassRetorno txtClass in oUniTxtToXml.cRetorno)
                    {
                        Functions.DeletarArquivo(pasta + "\\convertidos\\" + Path.GetFileName(txtClass.XMLFileName));
                    }
                }
                ///
                /// danasa 8-2009
                /// 
                /// Gravar o retorno para o ERP em formato TXT com o erro ocorrido
                /// 
                oAux.GravarArqErroERP(Functions.ExtrairNomeArq(arquivo, Propriedade.ExtEnvio.Nfe_TXT) + ccExtension, ccMessage);
            }
        }
Example #34
0
 public void GetSourceMatchesGenerateZipFilePath(LeanDataLineTestParameters parameters)
 {
     var source = parameters.Data.GetSource(parameters.Config, parameters.Data.Time.Date, false);
     var normalizedSourcePath = new FileInfo(source.Source).FullName;
     var zipFilePath = LeanData.GenerateZipFilePath(Globals.DataFolder, parameters.Data.Symbol, parameters.Data.Time.Date, parameters.Resolution, parameters.TickType);
     var normalizeZipFilePath = new FileInfo(zipFilePath).FullName;
     var indexOfHash = normalizedSourcePath.LastIndexOf("#", StringComparison.Ordinal);
     if (indexOfHash > 0)
     {
         normalizedSourcePath = normalizedSourcePath.Substring(0, indexOfHash);
     }
     Assert.AreEqual(normalizeZipFilePath, normalizedSourcePath);
 }